diff options
author | Christopher Hoffman <choffman@redhat.com> | 2023-04-19 17:26:27 +0200 |
---|---|---|
committer | Christopher Hoffman <choffman@redhat.com> | 2023-05-08 16:33:49 +0200 |
commit | ac552c9b4d65198db8038d397a3060d5a030917d (patch) | |
tree | 7a1040a6caff48a6c3e393e1c7b13c3fae3a2d2a /src/cls | |
parent | Merge pull request #51030 from batrick/i59425 (diff) | |
download | ceph-ac552c9b4d65198db8038d397a3060d5a030917d.tar.xz ceph-ac552c9b4d65198db8038d397a3060d5a030917d.zip |
librbd: localize snap_remove op for mirror snapshots
A client may attempt a lock request not quickly enough to
obtain exclusive lock for operations when another competing
client responds quicker. This can happen when a peer site has
different performance characteristics or latency. Instead of
relying on this unpredictable behavior, localize operation to
primary cluster.
Fixes: https://tracker.ceph.com/issues/59393
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
Diffstat (limited to 'src/cls')
-rw-r--r-- | src/cls/rbd/cls_rbd.cc | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/src/cls/rbd/cls_rbd.cc b/src/cls/rbd/cls_rbd.cc index b4efc23ceb6..229f85d4909 100644 --- a/src/cls/rbd/cls_rbd.cc +++ b/src/cls/rbd/cls_rbd.cc @@ -5720,24 +5720,6 @@ int image_snapshot_unlink_peer(cls_method_context_t hctx, return -ENOENT; } - if (mirror_ns->mirror_peer_uuids.size() == 1) { - // if this is the last peer to unlink and we have at least one additional - // newer mirror snapshot, return a special error to inform the caller it - // should remove the snapshot instead. - auto search_lambda = [snap_id](const cls_rbd_snap& snap_meta) { - if (snap_meta.id > snap_id && - std::holds_alternative<cls::rbd::MirrorSnapshotNamespace>( - snap_meta.snapshot_namespace)) { - return -EEXIST; - } - return 0; - }; - r = image::snapshot::iterate(hctx, search_lambda); - if (r == -EEXIST) { - return -ERESTART; - } - } - mirror_ns->mirror_peer_uuids.erase(mirror_peer_uuid); r = image::snapshot::write(hctx, snap_key, std::move(snap)); |