summaryrefslogtreecommitdiff
path: root/drivers/block
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2024-07-23 19:08:08 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-08-03 09:54:30 +0300
commit9a2acb02c1ecaaf57e95e577e9ec12d93b71edbc (patch)
tree8cf73207b7466f195deb6660a68123f4e9c0e2fa /drivers/block
parentdcb5620d2dedf1955e64c8b773bb12e89ac75623 (diff)
downloadlinux-9a2acb02c1ecaaf57e95e577e9ec12d93b71edbc.tar.xz
rbd: don't assume rbd_is_lock_owner() for exclusive mappings
commit 3ceccb14f5576e02b81cc8b105ab81f224bd87f6 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/rbd.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 1e2596c5efd8..02fd21e40013 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -6588,11 +6588,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;
}