]> 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)
committerIlya Dryomov <idryomov@gmail.com>
Tue, 9 Feb 2021 13:29:35 +0000 (14:29 +0100)
commit707907ea3f6ff39968666af4ba718ceef8cd8953
treeafeda05d712a5576488b3c20c4c7469a78f72e02
parent948f3c761dce4678b38d22e240da06434dbe10e4
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>
src/librbd/image/PreRemoveRequest.cc
src/test/librbd/image/test_mock_PreRemoveRequest.cc
src/test/librbd/mock/MockImageCtx.h