mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
All LV locks are non-blocking so remove LCK_NONBLOCK from separate macros.
This commit is contained in:
parent
fce6fb489f
commit
c07d773e67
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.50 -
|
Version 2.02.50 -
|
||||||
================================
|
================================
|
||||||
|
All LV locks are non-blocking so remove LCK_NONBLOCK from separate macros.
|
||||||
Fix race condition with vgcreate and vgextend on same device (2.02.49).
|
Fix race condition with vgcreate and vgextend on same device (2.02.49).
|
||||||
Remove redundant validate_name call from vgreduce.
|
Remove redundant validate_name call from vgreduce.
|
||||||
Add lvm_{pv|vg|lv}_get_{name|uuid} liblvm functions.
|
Add lvm_{pv|vg|lv}_get_{name|uuid} liblvm functions.
|
||||||
|
@ -65,8 +65,6 @@ struct lv_info {
|
|||||||
int lock_mode;
|
int lock_mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LCK_MASK (LCK_TYPE_MASK | LCK_SCOPE_MASK)
|
|
||||||
|
|
||||||
static const char *decode_locking_cmd(unsigned char cmdl)
|
static const char *decode_locking_cmd(unsigned char cmdl)
|
||||||
{
|
{
|
||||||
static char buf[128];
|
static char buf[128];
|
||||||
@ -482,28 +480,28 @@ int do_lock_lv(unsigned char command, unsigned char lock_flags, char *resource)
|
|||||||
cmd->partial_activation = (lock_flags & LCK_PARTIAL_MODE) ? 1 : 0;
|
cmd->partial_activation = (lock_flags & LCK_PARTIAL_MODE) ? 1 : 0;
|
||||||
|
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case LCK_LV_EXCLUSIVE:
|
case LCK_LV_EXCLUSIVE & LCK_MASK:
|
||||||
status = do_activate_lv(resource, lock_flags, LKM_EXMODE);
|
status = do_activate_lv(resource, lock_flags, LKM_EXMODE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LCK_LV_SUSPEND:
|
case LCK_LV_SUSPEND & LCK_MASK:
|
||||||
status = do_suspend_lv(resource);
|
status = do_suspend_lv(resource);
|
||||||
if (!status)
|
if (!status)
|
||||||
suspended++;
|
suspended++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LCK_UNLOCK:
|
case LCK_UNLOCK:
|
||||||
case LCK_LV_RESUME: /* if active */
|
case LCK_LV_RESUME & LCK_MASK: /* if active */
|
||||||
status = do_resume_lv(resource);
|
status = do_resume_lv(resource);
|
||||||
if (!status)
|
if (!status)
|
||||||
suspended--;
|
suspended--;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LCK_LV_ACTIVATE:
|
case LCK_LV_ACTIVATE & LCK_MASK:
|
||||||
status = do_activate_lv(resource, lock_flags, LKM_CRMODE);
|
status = do_activate_lv(resource, lock_flags, LKM_CRMODE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LCK_LV_DEACTIVATE:
|
case LCK_LV_DEACTIVATE & LCK_MASK:
|
||||||
status = do_deactivate_lv(resource, lock_flags);
|
status = do_deactivate_lv(resource, lock_flags);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -386,9 +386,10 @@ int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags)
|
|||||||
/* If LVM1 driver knows about the VG, it can't be accessed. */
|
/* If LVM1 driver knows about the VG, it can't be accessed. */
|
||||||
if (!check_lvm1_vg_inactive(cmd, vol))
|
if (!check_lvm1_vg_inactive(cmd, vol))
|
||||||
return 0;
|
return 0;
|
||||||
|
break;
|
||||||
case LCK_LV:
|
case LCK_LV:
|
||||||
/* Suspend LV if it's active. */
|
/* All LV locks are non-blocking. */
|
||||||
strncpy(resource, vol, sizeof(resource));
|
flags |= LCK_NONBLOCK;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
log_error("Unrecognised lock scope: %d",
|
log_error("Unrecognised lock scope: %d",
|
||||||
@ -396,6 +397,8 @@ int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strncpy(resource, vol, sizeof(resource));
|
||||||
|
|
||||||
if (!_lock_vol(cmd, resource, flags))
|
if (!_lock_vol(cmd, resource, flags))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -106,17 +106,19 @@ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname);
|
|||||||
#define LCK_VG_DROP_CACHE (LCK_VG | LCK_WRITE | LCK_CACHE)
|
#define LCK_VG_DROP_CACHE (LCK_VG | LCK_WRITE | LCK_CACHE)
|
||||||
#define LCK_VG_BACKUP (LCK_VG | LCK_CACHE)
|
#define LCK_VG_BACKUP (LCK_VG | LCK_CACHE)
|
||||||
|
|
||||||
#define LCK_LV_EXCLUSIVE (LCK_LV | LCK_EXCL | LCK_NONBLOCK)
|
#define LCK_LV_EXCLUSIVE (LCK_LV | LCK_EXCL)
|
||||||
#define LCK_LV_SUSPEND (LCK_LV | LCK_WRITE | LCK_NONBLOCK)
|
#define LCK_LV_SUSPEND (LCK_LV | LCK_WRITE)
|
||||||
#define LCK_LV_RESUME (LCK_LV | LCK_UNLOCK | LCK_NONBLOCK)
|
#define LCK_LV_RESUME (LCK_LV | LCK_UNLOCK)
|
||||||
#define LCK_LV_ACTIVATE (LCK_LV | LCK_READ | LCK_NONBLOCK)
|
#define LCK_LV_ACTIVATE (LCK_LV | LCK_READ)
|
||||||
#define LCK_LV_DEACTIVATE (LCK_LV | LCK_NULL | LCK_NONBLOCK)
|
#define LCK_LV_DEACTIVATE (LCK_LV | LCK_NULL)
|
||||||
|
|
||||||
|
#define LCK_MASK (LCK_TYPE_MASK | LCK_SCOPE_MASK)
|
||||||
|
|
||||||
#define LCK_LV_CLUSTERED(lv) \
|
#define LCK_LV_CLUSTERED(lv) \
|
||||||
(vg_is_clustered((lv)->vg) ? LCK_CLUSTER_VG : 0)
|
(vg_is_clustered((lv)->vg) ? LCK_CLUSTER_VG : 0)
|
||||||
|
|
||||||
#define lock_lv_vol(cmd, lv, flags) \
|
#define lock_lv_vol(cmd, lv, flags) \
|
||||||
lock_vol(cmd, (lv)->lvid.s, flags | LCK_LV_CLUSTERED(lv))
|
lock_vol(cmd, (lv)->lvid.s, flags | LCK_LV_CLUSTERED(lv) | LCK_NONBLOCK)
|
||||||
|
|
||||||
#define unlock_vg(cmd, vol) lock_vol(cmd, vol, LCK_VG_UNLOCK)
|
#define unlock_vg(cmd, vol) lock_vol(cmd, vol, LCK_VG_UNLOCK)
|
||||||
#define unlock_and_release_vg(cmd, vg, vol) \
|
#define unlock_and_release_vg(cmd, vg, vol) \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user