]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs-mirror: record directory path cancel in DirRegistry
authorVenky Shankar <vshankar@redhat.com>
Wed, 14 Jul 2021 09:31:43 +0000 (05:31 -0400)
committerVenky Shankar <vshankar@redhat.com>
Fri, 23 Jul 2021 05:12:59 +0000 (01:12 -0400)
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 <vshankar@redhat.com>
(cherry picked from commit 1a956be9baf0f21e64d81a684cd8f90cb6481f6a)

src/tools/cephfs_mirror/PeerReplayer.cc
src/tools/cephfs_mirror/PeerReplayer.h

index 6c2e6ee5b884ccb7092e72609cd870d3bc85e152..44796cb4973af0f5ba07b9c8b9740d9c6a5f01ea 100644 (file)
@@ -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();
 }
index f32064278695427b4da09f119d7f027dea6b321c..886c9532944b8828cc6936bac9a50d35e363423f 100644 (file)
@@ -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;
     }