]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
librbd: refuse to release exclusive lock when removing
authorIlya Dryomov <idryomov@gmail.com>
Sun, 7 Feb 2021 12:46:15 +0000 (13:46 +0100)
committerJason Dillaman <dillaman@redhat.com>
Tue, 9 Mar 2021 21:50:03 +0000 (16:50 -0500)
commit0d552e9576375976d0eb93c578e6e8f2143922a8
tree0bfdeff1a434e81fab2e66c0c84064147e5c17be
parentef150478a00adcca34a76b8aca02212ab1bb1053
librbd: refuse to release exclusive lock when removing

Commit 25c2ffe145be ("librbd: acquire exclusive lock from peer when
removing") changed PreRemoveRequest to request exclusive lock from the
peer instead of giving up and proceeding without exclusive lock.  This
caused one of the test cases that sometimes runs concurrent "rbd rm"
against the same image to fail intermittently, most often on assert

  ceph_assert(image_ctx.exclusive_lock == nullptr ||
              image_ctx.exclusive_lock->is_lock_owner());

because exclusive lock is now automatically transitioned to another
"rbd rm" on its request.

The root cause is older and probably goes back to when synchronous
librbd::remove() which held owner_lock across all operations including
trim_image() was converted to a set of state machines.  Since then, any
peer that requests exclusive lock (instead of trying once and backing
off) is able to mess with image removal.

Install StandardPolicy to disable automatic exclusive lock transitions
during image removal.

Fixes: https://tracker.ceph.com/issues/49226
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit 707907ea3f6ff39968666af4ba718ceef8cd8953)
src/librbd/image/PreRemoveRequest.cc
src/test/librbd/image/test_mock_PreRemoveRequest.cc
src/test/librbd/mock/MockImageCtx.h