]> 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>
Fri, 1 Sep 2023 17:05:36 +0000 (19:05 +0200)
commit9c05d3d81f4b06af2cfd47376e9ad86369bdf8cf
tree1b4fd696ddb8ae31b6eaf26885d2eb5550128cd6
parentcfae3f79bd0513e2753b0deb8c2624ab07cf2d1b
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>
src/librbd/mirror/snapshot/CreatePrimaryRequest.cc
src/test/librbd/mirror/snapshot/test_mock_CreatePrimaryRequest.cc