]> git-server-git.apps.pok.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>
Thu, 11 Feb 2021 19:32:54 +0000 (14:32 -0500)
commit8385912b5e67f12cb45557abffd542ec1059fe95
tree465d72262613dd6332c75b4ec0151b0791c7ebee
parent1f43660df8a5aa35736746eec85a18d89fd1242d
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