From 878ee969b8011de46a7ba1d37409b7af13fff22e Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Kalever Date: Mon, 22 Sep 2025 20:06:40 +0530 Subject: [PATCH] rbd-mirror: skip validation of primary demote snapshots Problem: When a primary demotion is in progress, the demote snapshot is in an incomplete state. However, the group replayer incorrectly attempts to validate this snapshot using validate_local_group_snapshots(), treating the cluster as if it were secondary. This results in the group status being incorrectly set to up+replaying instead of up+unknown. Solution: Avoid validating snapshots that are in the process of being demoted on the primary. This ensures the group replayer does not mistakenly assign an incorrect role or state during transition. Signed-off-by: Prasanna Kumar Kalever --- src/tools/rbd_mirror/group_replayer/Replayer.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/tools/rbd_mirror/group_replayer/Replayer.cc b/src/tools/rbd_mirror/group_replayer/Replayer.cc index d8a58ac747c..fdd2826af81 100644 --- a/src/tools/rbd_mirror/group_replayer/Replayer.cc +++ b/src/tools/rbd_mirror/group_replayer/Replayer.cc @@ -419,7 +419,7 @@ void Replayer::validate_local_group_snapshots() { // skip validation for primary snapshots auto ns = std::get_if( &local_snap.snapshot_namespace); - if (ns != nullptr && ns->state == cls::rbd::MIRROR_SNAPSHOT_STATE_PRIMARY) { + if (ns != nullptr && ns->is_primary()) { continue; } @@ -763,8 +763,7 @@ void Replayer::try_create_group_snapshot( << snap->id << dendl; create_group_snapshot(*snap, locker); continue; - } else if (next_remote_snap_ns->state == cls::rbd::MIRROR_SNAPSHOT_STATE_PRIMARY || - next_remote_snap_ns->state == cls::rbd::MIRROR_SNAPSHOT_STATE_PRIMARY_DEMOTED) { + } else if (next_remote_snap_ns->is_primary()) { dout(10) << "found primary remote mirror group snapshot: " << snap->id << dendl; create_group_snapshot(*snap, locker); -- 2.39.5