From: Prasanna Kumar Kalever Date: Fri, 21 Mar 2025 08:59:45 +0000 (+0530) Subject: rbd-mirror: fix m_stop_requested leading to a race X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=6de2342987f7b42abd6e55bf7aaf90c8b6d20d48;p=ceph.git rbd-mirror: fix m_stop_requested leading to a race * if m_stop_requested is set then is_replay_interrupted return true. * also shut_down should set m_stop_requested to false, it is instead setting it to true this will lead to race and a possible crash accessing GR b/w shut_down() and notify_group_listener_stop() Signed-off-by: Prasanna Kumar Kalever --- diff --git a/src/tools/rbd_mirror/group_replayer/Replayer.cc b/src/tools/rbd_mirror/group_replayer/Replayer.cc index 57ab0d8b90259..c1c59c34e5691 100644 --- a/src/tools/rbd_mirror/group_replayer/Replayer.cc +++ b/src/tools/rbd_mirror/group_replayer/Replayer.cc @@ -78,7 +78,7 @@ bool Replayer::is_replay_interrupted() { template bool Replayer::is_replay_interrupted(std::unique_lock* locker) { - if (m_state == STATE_COMPLETE) { + if (m_state == STATE_COMPLETE || m_stop_requested) { locker->unlock(); return true; } @@ -1220,7 +1220,7 @@ void Replayer::shut_down(Context* on_finish) { { std::unique_lock locker{m_lock}; - m_stop_requested = true; + m_stop_requested = false; ceph_assert(m_on_shutdown == nullptr); std::swap(m_on_shutdown, on_finish);