]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
librbd: remove previous incomplete primary snapshot after successfully creating a...
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
Mon, 6 Mar 2023 09:58:03 +0000 (15:28 +0530)
committerChristopher Hoffman <choffman@redhat.com>
Wed, 10 May 2023 23:43:28 +0000 (23:43 +0000)
commitdf274a879da302dda52211a9edad15d3dd9688b0
treeb7be0794b203c0a9240027d0ee20acce51d04139
parentf9dcd39ea06ade80796f2c5a7cf4d6cef0d4e30c
librbd: remove previous incomplete primary snapshot after successfully 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 <prasanna.kalever@redhat.com>
(cherry picked from commit 165c9a4e163c5edfa77c900f61c680cc944b2b5d)

Conflicts:
src/test/librbd/mirror/snapshot/test_mock_CreatePrimaryRequest.cc [
  commit 3a93b40 ("librbd: s/boost::variant/std::variant/")
  not in pacific ]
src/librbd/mirror/snapshot/CreatePrimaryRequest.cc
src/test/librbd/mirror/snapshot/test_mock_CreatePrimaryRequest.cc