diff options
author | Milan Broz <mbroz@redhat.com> | 2010-01-05 16:07:56 +0000 |
---|---|---|
committer | Milan Broz <mbroz@redhat.com> | 2010-01-05 16:07:56 +0000 |
commit | c9118a1d20b27bcd51a7396881128381115a230f (patch) | |
tree | efe41a98ea9c6f8e2a749d49e364974fb68474c7 /daemons | |
parent | d37be0b86571c6d46816d30638faef75e123f30d (diff) | |
download | lvm2-c9118a1d20b27bcd51a7396881128381115a230f.tar.gz |
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.
Diffstat (limited to 'daemons')
-rw-r--r-- | daemons/clvmd/clvmd-command.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/daemons/clvmd/clvmd-command.c b/daemons/clvmd/clvmd-command.c index 1f8d0cfc1..0d9d09f87 100644 --- a/daemons/clvmd/clvmd-command.c +++ b/daemons/clvmd/clvmd-command.c @@ -193,6 +193,7 @@ static int lock_vg(struct local_client *client) (struct clvm_header *) client->bits.localsock.cmd; unsigned char lock_cmd; unsigned char lock_flags; + int lock_mode; char *args = header->node + strlen(header->node) + 1; int lkid; 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_mode = ((int)lock_cmd & LCK_TYPE_MASK); lock_flags = args[1]; lockname = &args[2]; 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); if (lkid == 0) @@ -230,11 +232,9 @@ static int lock_vg(struct local_client *client) } else { /* Read locks need to be PR; other modes get passed through */ - if ((lock_cmd & LCK_TYPE_MASK) == LCK_READ) { - lock_cmd &= ~LCK_TYPE_MASK; - lock_cmd |= LCK_PREAD; - } - status = sync_lock(lockname, (int)lock_cmd, (lock_cmd & LCK_NONBLOCK) ? LKF_NOQUEUE : 0, &lkid); + if (lock_mode == LCK_READ) + lock_mode = LCK_PREAD; + status = sync_lock(lockname, lock_mode, (lock_cmd & LCK_NONBLOCK) ? LKF_NOQUEUE : 0, &lkid); if (status) status = errno; else |