]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
librbd: make CreatePrimaryRequest remove any unlinked mirror snapshots
authorIlya Dryomov <idryomov@gmail.com>
Sat, 26 Aug 2023 11:04:52 +0000 (13:04 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 4 Sep 2023 15:03:08 +0000 (17:03 +0200)
commit4877fefa6305fb2cb1a5de0a5778b8f0d50f92f9
treed4a2f3d5e0e41bfaeb2990a42a7b9e2647bb3b4a
parent76fc2c32795fed721432d51db5d74a1f0adbd700
librbd: make CreatePrimaryRequest remove any unlinked mirror snapshots

After commit ac552c9b4d65 ("librbd: localize snap_remove op for mirror
snapshots"), rbd-mirror daemon no longer removes mirror snapshots when
it's done syncing them -- instead it only unlinks from them.  However,
CreatePrimaryRequest state machine was not adjusted to compensate and
hence two cases were missed:

- primary demotion snapshot (rbd-mirror daemon unlinks from primary
  demotion snapshots just like it does from regular primary snapshots);
  this comes up when an image is demoted but then promoted on the same
  cluster

- non-primary demotion snapshot (unlike regular non-primary snapshots,
  non-primary demotion snapshots store peer uuids and rbd-mirror daemon
  does unlinking just like in the case of primary snapshots); this
  comes up when an image is demoted and promoted on the other cluster

Related is the case of orphan snapshots.  Since they are dummy to begin
with, CreatePrimaryRequest would now clean up the orphan snapshot after
the creation of the force promote snapshot.

Fixes: https://tracker.ceph.com/issues/61707
Co-authored-by: Christopher Hoffman <choffman@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit 9c05d3d81f4b06af2cfd47376e9ad86369bdf8cf)

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