Skip to content

quincy: librbd: remove previous incomplete primary snapshot after successfully creating a new one - #51173

Merged
idryomov merged 2 commits into
ceph:quincyfrom
idryomov:wip-58887-quincy
May 24, 2023
Merged

idryomov merged 2 commits into
ceph:quincyfrom
idryomov:wip-58887-quincy

Conversation

@idryomov

Copy link
Copy Markdown
Contributor

Prasanna Kumar Kalever and others added 2 commits April 21, 2023 18:43
…y creating a new one

Problem:
-------
At a high level, creating a primary snapshot consists of three steps:

1. actually creating a snapshot in the mirror namespace
2. generating a set of image state objects with additional metadata for
   the snapshot
3. marking the snapshot as complete after the image state objects are
   written out

Depending on the circumstances, a request to create a primary snapshot
can be forwarded to rbd-mirror daemon.  If that happens and rbd-mirror
daemon gets axed for some practical reason after completing steps (1)
and/or (2) but before completing step (3), we are left with a
permanently incomplete primary snapshot because upon retrying that
primary snapshot creation request, librbd notices that such snapshot
already exists.  It does not check whether this "pre-existing" snapshot
is complete.

Solution:
--------
As part of the next mirror snapshot create (say triggered by the
scheduler) the unlink_peer() is called, it checks if there exists any
incomplete snapshot and delete them accordingly.

Fixes: https://tracker.ceph.com/issues/58887
Signed-off-by: Prasanna Kumar Kalever <[email protected]>
(cherry picked from commit 165c9a4)

Conflicts:
	src/test/librbd/mirror/snapshot/test_mock_CreatePrimaryRequest.cc [
	  commit 3a93b40 ("librbd: s/boost::variant/std::variant/")
	  not in quincy ]
Up until now this was conditioned on whether the caller expressed
interest in the ID of the created snapshot and happened to work only
because CreatePrimaryRequest wasn't actually consulting any mirror
snapshot metadata.  This has just changed with unlink_peer() needing to
see an up-to-date complete flag which is set in SetImageStateRequest
following the write out of image state object(s).

Signed-off-by: Ilya Dryomov <[email protected]>
(cherry picked from commit df2bb13)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants