]> 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 14:56:13 +0000 (16:56 +0200)
commit8aeb7bd5ae935f7a7b44a71df1511c08b7c78529
tree4426fe46df69598c406e54da8e645d7d05354ecb
parentf49978084fa339e6db77edb6cd8c69d8e359ee28
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 pacific ]
src/librbd/mirror/snapshot/CreatePrimaryRequest.cc
src/test/librbd/mirror/snapshot/test_mock_CreatePrimaryRequest.cc