]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
rbd: remove the incomplete primary snapshot
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
Mon, 6 Mar 2023 09:58:03 +0000 (15:28 +0530)
committerPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
Tue, 18 Apr 2023 15:04:18 +0000 (20:34 +0530)
commit0097e73d564a8fb3c4ba2ba49ec3509bd71ca796
treeec0a581bf5e28405cc60bea292b02a0ffd45e3c0
parent0ad603862bf3cdd8b551a61ad8ea9691a2f5cb22
rbd: remove the incomplete primary snapshot

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
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2120624
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
src/librbd/mirror/snapshot/CreatePrimaryRequest.cc
src/test/librbd/mirror/snapshot/test_mock_CreatePrimaryRequest.cc