]> www.infradead.org Git - users/hch/block.git/commitdiff
rbd: don't assume rbd_is_lock_owner() for exclusive mappings
authorIlya Dryomov <idryomov@gmail.com>
Tue, 23 Jul 2024 16:08:08 +0000 (18:08 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 25 Jul 2024 10:18:29 +0000 (12:18 +0200)
Expanding on the previous commit, assuming that rbd_is_lock_owner()
always returns true (i.e. that we are either in RBD_LOCK_STATE_LOCKED
or RBD_LOCK_STATE_QUIESCING) if the mapping is exclusive is wrong too.
In case ceph_cls_set_cookie() fails, the lock would be temporarily
released even if the mapping is exclusive, meaning that we can end up
even in RBD_LOCK_STATE_UNLOCKED.

IOW, exclusive mappings are really "just" about disabling automatic
lock transitions (as documented in the man page), not about grabbing
the lock and holding on to it whatever it takes.

Cc: stable@vger.kernel.org
Fixes: 637cd060537d ("rbd: new exclusive lock wait/wake code")
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
drivers/block/rbd.c

index ea6c592e015c6a10045ed34890c0078f25fab100..da22ce38c0390c271a8284de75e904195c1e8971 100644 (file)
@@ -6589,11 +6589,6 @@ static int rbd_add_acquire_lock(struct rbd_device *rbd_dev)
        if (ret)
                return ret;
 
-       /*
-        * The lock may have been released by now, unless automatic lock
-        * transitions are disabled.
-        */
-       rbd_assert(!rbd_dev->opts->exclusive || rbd_is_lock_owner(rbd_dev));
        return 0;
 }