]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
librbd: retry ENOENT in V2_REFRESH_PARENT as well
authorIlya Dryomov <idryomov@gmail.com>
Sun, 4 Sep 2022 15:52:51 +0000 (17:52 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 5 Sep 2022 21:02:39 +0000 (23:02 +0200)
commitbd885d75b2e4d728086f744e0d10e7cd12d3f15b
tree52bbc8bf7774525eb09cbb51b557e8965f4cb410
parent8570194b133462db6b7d4ab108383db0967b1cb9
librbd: retry ENOENT in V2_REFRESH_PARENT as well

With auto-deletion of trashed snapshots, it is relatively easy to lose
a race to "rbd flatten" as follows:

- when V2_GET_PARENT runs, the image is technically still a clone
- when V2_REFRESH_PARENT runs, the image is fully flattened and the
  snapshot in the parent image is deleted

This results in a spurious ENOENT error, mainly when trying to open the
image (e.g. for "rbd info").  This race condition has always been there
but auto-deletion of trashed snapshots makes it much worse.

Retry ENOENT in V2_REFRESH_PARENT the same way as in V2_GET_SNAPSHOTS.

Fixes: https://tracker.ceph.com/issues/52810
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
src/librbd/image/RefreshRequest.cc
src/librbd/image/RefreshRequest.h
src/test/librbd/image/test_mock_RefreshRequest.cc