From: Venky Shankar Date: Wed, 14 Jul 2021 09:31:43 +0000 (-0400) Subject: cephfs-mirror: record directory path cancel in DirRegistry X-Git-Tag: v16.2.6~119^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f5d4626e8b746dd97896296f37c07c6ffee7eb29;p=ceph.git cephfs-mirror: record directory path cancel in DirRegistry When removing a directory path from mirroring, cephfs-mirror records this state in a thread-local storage. The replayer thread backs-off in midst of mirroring the directory snapshots for this directory path. However, the state (canceled state) is never cleared causing the thread to incorrectly assume that other directory paths (which are picked up by this thread) need backing-off, hence, marking these directory paths as failed (to synchronize snapshots). Fix is to store this state in the directory specific store which is allocated when a thread picks up a directory path for synchronization. Signed-off-by: Venky Shankar (cherry picked from commit 1a956be9baf0f21e64d81a684cd8f90cb6481f6a) --- diff --git a/src/tools/cephfs_mirror/PeerReplayer.cc b/src/tools/cephfs_mirror/PeerReplayer.cc index 6c2e6ee5b884..44796cb4973a 100644 --- a/src/tools/cephfs_mirror/PeerReplayer.cc +++ b/src/tools/cephfs_mirror/PeerReplayer.cc @@ -282,7 +282,7 @@ void PeerReplayer::remove_directory(string_view dir_root) { if (it1 == m_registered.end()) { m_snap_sync_stats.erase(_dir_root); } else { - it1->second.replayer->cancel(); + it1->second.canceled = true; } m_cond.notify_all(); } diff --git a/src/tools/cephfs_mirror/PeerReplayer.h b/src/tools/cephfs_mirror/PeerReplayer.h index f32064278695..886c9532944b 100644 --- a/src/tools/cephfs_mirror/PeerReplayer.h +++ b/src/tools/cephfs_mirror/PeerReplayer.h @@ -88,21 +88,13 @@ private: return 0; } - void cancel() { - canceled = true; - } - - bool is_canceled() const { - return canceled; - } - private: PeerReplayer *m_peer_replayer; - bool canceled = false; }; struct DirRegistry { int fd; + bool canceled = false; SnapshotReplayerThread *replayer; }; @@ -244,7 +236,7 @@ private: return true; } auto &dr = m_registered.at(dir_root); - if (dr.replayer->is_canceled()) { + if (dr.canceled) { *retval = -ECANCELED; return true; }