mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +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 -
|
||||
================================
|
||||
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).
|
||||
Remove redundant validate_name call from vgreduce.
|
||||
Add lvm_{pv|vg|lv}_get_{name|uuid} liblvm functions.
|
||||
|
@ -65,8 +65,6 @@ struct lv_info {
|
||||
int lock_mode;
|
||||
};
|
||||
|
||||
#define LCK_MASK (LCK_TYPE_MASK | LCK_SCOPE_MASK)
|
||||
|
||||
static const char *decode_locking_cmd(unsigned char cmdl)
|
||||
{
|
||||
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;
|
||||
|
||||
switch (command) {
|
||||
case LCK_LV_EXCLUSIVE:
|
||||
case LCK_LV_EXCLUSIVE & LCK_MASK:
|
||||
status = do_activate_lv(resource, lock_flags, LKM_EXMODE);
|
||||
break;
|
||||
|
||||
case LCK_LV_SUSPEND:
|
||||
case LCK_LV_SUSPEND & LCK_MASK:
|
||||
status = do_suspend_lv(resource);
|
||||
if (!status)
|
||||
suspended++;
|
||||
break;
|
||||
|
||||
case LCK_UNLOCK:
|
||||
case LCK_LV_RESUME: /* if active */
|
||||
case LCK_LV_RESUME & LCK_MASK: /* if active */
|
||||
status = do_resume_lv(resource);
|
||||
if (!status)
|
||||
suspended--;
|
||||
break;
|
||||
|
||||
case LCK_LV_ACTIVATE:
|
||||
case LCK_LV_ACTIVATE & LCK_MASK:
|
||||
status = do_activate_lv(resource, lock_flags, LKM_CRMODE);
|
||||
break;
|
||||
|
||||
case LCK_LV_DEACTIVATE:
|
||||
case LCK_LV_DEACTIVATE & LCK_MASK:
|
||||
status = do_deactivate_lv(resource, lock_flags);
|
||||
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 (!check_lvm1_vg_inactive(cmd, vol))
|
||||
return 0;
|
||||
break;
|
||||
case LCK_LV:
|
||||
/* Suspend LV if it's active. */
|
||||
strncpy(resource, vol, sizeof(resource));
|
||||
/* All LV locks are non-blocking. */
|
||||
flags |= LCK_NONBLOCK;
|
||||
break;
|
||||
default:
|
||||
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;
|
||||
}
|
||||
|
||||
strncpy(resource, vol, sizeof(resource));
|
||||
|
||||
if (!_lock_vol(cmd, resource, flags))
|
||||
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_BACKUP (LCK_VG | LCK_CACHE)
|
||||
|
||||
#define LCK_LV_EXCLUSIVE (LCK_LV | LCK_EXCL | LCK_NONBLOCK)
|
||||
#define LCK_LV_SUSPEND (LCK_LV | LCK_WRITE | LCK_NONBLOCK)
|
||||
#define LCK_LV_RESUME (LCK_LV | LCK_UNLOCK | LCK_NONBLOCK)
|
||||
#define LCK_LV_ACTIVATE (LCK_LV | LCK_READ | LCK_NONBLOCK)
|
||||
#define LCK_LV_DEACTIVATE (LCK_LV | LCK_NULL | LCK_NONBLOCK)
|
||||
#define LCK_LV_EXCLUSIVE (LCK_LV | LCK_EXCL)
|
||||
#define LCK_LV_SUSPEND (LCK_LV | LCK_WRITE)
|
||||
#define LCK_LV_RESUME (LCK_LV | LCK_UNLOCK)
|
||||
#define LCK_LV_ACTIVATE (LCK_LV | LCK_READ)
|
||||
#define LCK_LV_DEACTIVATE (LCK_LV | LCK_NULL)
|
||||
|
||||
#define LCK_MASK (LCK_TYPE_MASK | LCK_SCOPE_MASK)
|
||||
|
||||
#define LCK_LV_CLUSTERED(lv) \
|
||||
(vg_is_clustered((lv)->vg) ? LCK_CLUSTER_VG : 0)
|
||||
|
||||
#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_and_release_vg(cmd, vg, vol) \
|
||||
|
Loading…
Reference in New Issue
Block a user