]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix race in PurgeQueue::wait_for_recovery() 18385/head
authorYan, Zheng <zyan@redhat.com>
Thu, 19 Oct 2017 03:32:38 +0000 (11:32 +0800)
committerYan, Zheng <zyan@redhat.com>
Thu, 19 Oct 2017 03:34:59 +0000 (11:34 +0800)
After PurgeQueue::wait_for_recovery() locks the mutex, purge queue
may have already been recovered.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/MDSRank.cc
src/mds/PurgeQueue.cc
src/mds/PurgeQueue.h

index d5cdc0dfbf66b970af31dfe3a670b149a66719fa..51ae378947f57f30fbb44557670b2ce98e36a775 100644 (file)
@@ -1097,7 +1097,7 @@ void MDSRank::boot_start(BootStep step, int r)
        MDSGatherBuilder gather(g_ceph_context,
            new C_MDS_BootStart(this, MDS_BOOT_REPLAY_DONE));
 
-       if (!standby_replaying && !purge_queue.is_recovered()) {
+       if (!standby_replaying) {
          dout(2) << "boot_start " << step << ": waiting for purge queue recovered" << dendl;
          purge_queue.wait_for_recovery(new C_IO_Wrapper(this, gather.new_sub()));
        }
index 98f245b5fd5894ee38948389da18877cd97a7e3a..49e48b04cc6d12700a4ff97ab149177a8a2f5c2b 100644 (file)
@@ -180,16 +180,13 @@ void PurgeQueue::open(Context *completion)
   }));
 }
 
-bool PurgeQueue::is_recovered()
-{
-  Mutex::Locker l(lock);
-  return recovered;
-}
-
 void PurgeQueue::wait_for_recovery(Context* c)
 {
   Mutex::Locker l(lock);
-  waiting_for_recovery.push_back(c);
+  if (recovered)
+    c->complete(0);
+  else
+    waiting_for_recovery.push_back(c);
 }
 
 void PurgeQueue::_recover()
index 221add80e9e461bf3999d21d2568d297c5474382..6a13a57ee30360f14d913d0abc8166718d95f99d 100644 (file)
@@ -146,7 +146,6 @@ public:
   // Read the Journaler header for an existing queue and start consuming
   void open(Context *completion);
 
-  bool is_recovered();
   void wait_for_recovery(Context *c);
 
   // Submit one entry to the work queue.  Call back when it is persisted