]> git-server-git.apps.pok.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>
Tue, 6 Sep 2022 18:22:17 +0000 (20:22 +0200)
commitd489d2dc31a070e8ac707cd7d7ef3df4c444e1c7
tree5eeda5ec7a8114a84b26d6df535f6809d9449334
parentf61611abb712e1990394bab38b2928fdbd14c74d
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>
(cherry picked from commit bd885d75b2e4d728086f744e0d10e7cd12d3f15b)
src/librbd/image/RefreshRequest.cc
src/librbd/image/RefreshRequest.h
src/test/librbd/image/test_mock_RefreshRequest.cc