mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
Proper mask lock mode for vg lock.
Lock mode is int masked by LCK_TYPE_MASK, always. Patch also remove uneccessary masking lock flag on sender side, if masking is needed, it is don on client side already.
This commit is contained in:
parent
d37be0b865
commit
c9118a1d20
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.57 -
|
Version 2.02.57 -
|
||||||
====================================
|
====================================
|
||||||
|
Use proper mask for VG lock mode in clvmd.
|
||||||
Add possibility to drop precommitted metadata in lvmcache.
|
Add possibility to drop precommitted metadata in lvmcache.
|
||||||
Move processing of VG locks to separate function in clvmd.
|
Move processing of VG locks to separate function in clvmd.
|
||||||
Properly decode flags even for VG locks.
|
Properly decode flags even for VG locks.
|
||||||
|
@ -193,6 +193,7 @@ static int lock_vg(struct local_client *client)
|
|||||||
(struct clvm_header *) client->bits.localsock.cmd;
|
(struct clvm_header *) client->bits.localsock.cmd;
|
||||||
unsigned char lock_cmd;
|
unsigned char lock_cmd;
|
||||||
unsigned char lock_flags;
|
unsigned char lock_flags;
|
||||||
|
int lock_mode;
|
||||||
char *args = header->node + strlen(header->node) + 1;
|
char *args = header->node + strlen(header->node) + 1;
|
||||||
int lkid;
|
int lkid;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
@ -212,11 +213,12 @@ static int lock_vg(struct local_client *client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
lock_cmd = args[0] & (LCK_NONBLOCK | LCK_HOLD | LCK_SCOPE_MASK | LCK_TYPE_MASK);
|
lock_cmd = args[0] & (LCK_NONBLOCK | LCK_HOLD | LCK_SCOPE_MASK | LCK_TYPE_MASK);
|
||||||
|
lock_mode = ((int)lock_cmd & LCK_TYPE_MASK);
|
||||||
lock_flags = args[1];
|
lock_flags = args[1];
|
||||||
lockname = &args[2];
|
lockname = &args[2];
|
||||||
DEBUGLOG("doing PRE command LOCK_VG '%s' at %x (client=%p)\n", lockname, lock_cmd, client);
|
DEBUGLOG("doing PRE command LOCK_VG '%s' at %x (client=%p)\n", lockname, lock_cmd, client);
|
||||||
|
|
||||||
if (lock_cmd == LCK_UNLOCK) {
|
if (lock_mode == LCK_UNLOCK) {
|
||||||
|
|
||||||
lkid = (int)(long)dm_hash_lookup(lock_hash, lockname);
|
lkid = (int)(long)dm_hash_lookup(lock_hash, lockname);
|
||||||
if (lkid == 0)
|
if (lkid == 0)
|
||||||
@ -230,11 +232,9 @@ static int lock_vg(struct local_client *client)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Read locks need to be PR; other modes get passed through */
|
/* Read locks need to be PR; other modes get passed through */
|
||||||
if ((lock_cmd & LCK_TYPE_MASK) == LCK_READ) {
|
if (lock_mode == LCK_READ)
|
||||||
lock_cmd &= ~LCK_TYPE_MASK;
|
lock_mode = LCK_PREAD;
|
||||||
lock_cmd |= LCK_PREAD;
|
status = sync_lock(lockname, lock_mode, (lock_cmd & LCK_NONBLOCK) ? LKF_NOQUEUE : 0, &lkid);
|
||||||
}
|
|
||||||
status = sync_lock(lockname, (int)lock_cmd, (lock_cmd & LCK_NONBLOCK) ? LKF_NOQUEUE : 0, &lkid);
|
|
||||||
if (status)
|
if (status)
|
||||||
status = errno;
|
status = errno;
|
||||||
else
|
else
|
||||||
|
@ -409,7 +409,6 @@ int lock_resource(struct cmd_context *cmd, const char *resource, uint32_t flags)
|
|||||||
|
|
||||||
lock_scope = "VG";
|
lock_scope = "VG";
|
||||||
clvmd_cmd = CLVMD_CMD_LOCK_VG;
|
clvmd_cmd = CLVMD_CMD_LOCK_VG;
|
||||||
flags &= LCK_TYPE_MASK;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LCK_LV:
|
case LCK_LV:
|
||||||
|
Loading…
Reference in New Issue
Block a user