]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commit
librbd/mirror: detect trashed snapshots in UnlinkPeerRequest
authorIlya Dryomov <idryomov@gmail.com>
Tue, 24 Feb 2026 11:46:35 +0000 (12:46 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Tue, 24 Feb 2026 12:38:56 +0000 (13:38 +0100)
commit3596ca077097a4e0ff8e8d05a410c2044332391e
tree9b7ac836c112b90fa9e8238936a7abe1c98bdbd6
parente5b9f92dfe1df13d87b8dede472928df27e67f24
librbd/mirror: detect trashed snapshots in UnlinkPeerRequest

If two instances of UnlinkPeerRequest race with each other (e.g. due
to rbd-mirror daemon unlinking from a previous mirror snapshot and the
user taking another mirror snapshot at same time), the snapshot that
UnlinkPeerRequest was created for may be in the process of being removed
(which may mean trashed by SnapshotRemoveRequest::trash_snap()) or fully
removed by the time unlink_peer() grabs the image lock.  Because trashed
snapshots weren't handled explicitly, UnlinkPeerRequest could spuriously
fail with EINVAL ("not mirror snapshot" case) instead of the expected
ENOENT ("missing snapshot" case).  This in turn could lead to spurious
ImageReplayer failures with it stopping prematurely.

Fixes: https://tracker.ceph.com/issues/68279
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
src/librbd/mirror/snapshot/UnlinkPeerRequest.cc
src/test/librbd/mirror/snapshot/test_mock_UnlinkPeerRequest.cc