]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: use finisher for BootStart contexts
authorJohn Spray <john.spray@redhat.com>
Wed, 23 Jul 2014 12:11:46 +0000 (13:11 +0100)
committerJohn Spray <john.spray@redhat.com>
Mon, 25 Aug 2014 00:34:03 +0000 (01:34 +0100)
Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/MDS.cc

index b2ff94f0d6071ac415e88dd059c6d469908c81bd..11cc608069d3c61cb74d25043b1d10fcf20039ad 100644 (file)
@@ -1382,7 +1382,10 @@ class C_MDS_BootStart : public Context {
   MDS::BootStep nextstep;
 public:
   C_MDS_BootStart(MDS *m, MDS::BootStep n) : mds(m), nextstep(n) {}
-  void finish(int r) { mds->boot_start(nextstep, r); }
+  void finish(int r) {
+      Mutex::Locker l(mds->mds_lock);
+      mds->boot_start(nextstep, r);
+  }
 };
 
 
@@ -1408,7 +1411,7 @@ void MDS::boot_start(BootStep step, int r)
       {
         mdcache->init_layouts();
 
-        C_GatherBuilder gather(g_ceph_context, new C_MDS_BootStart(this, MDS_BOOT_OPEN_ROOT));
+        C_GatherBuilder gather(g_ceph_context, new C_OnFinisher(new C_MDS_BootStart(this, MDS_BOOT_OPEN_ROOT), &finisher));
         dout(2) << "boot_start " << step << ": opening inotable" << dendl;
         inotable->load(gather.new_sub());
 
@@ -1430,7 +1433,7 @@ void MDS::boot_start(BootStep step, int r)
       {
         dout(2) << "boot_start " << step << ": loading/discovering base inodes" << dendl;
 
-        C_GatherBuilder gather(g_ceph_context, new C_MDS_BootStart(this, MDS_BOOT_PREPARE_LOG));
+        C_GatherBuilder gather(g_ceph_context, new C_OnFinisher(new C_MDS_BootStart(this, MDS_BOOT_PREPARE_LOG), &finisher));
 
         mdcache->open_mydir_inode(gather.new_sub());
 
@@ -1447,7 +1450,7 @@ void MDS::boot_start(BootStep step, int r)
     case MDS_BOOT_PREPARE_LOG:
       if (is_any_replay()) {
         dout(2) << "boot_start " << step << ": replaying mds log" << dendl;
-        mdlog->replay(new C_MDS_BootStart(this, MDS_BOOT_REPLAY_DONE));
+        mdlog->replay(new C_OnFinisher(new C_MDS_BootStart(this, MDS_BOOT_REPLAY_DONE), &finisher));
       } else {
         dout(2) << "boot_start " << step << ": positioning at end of old mds log" << dendl;
         mdlog->append();
@@ -1511,7 +1514,7 @@ void MDS::replay_start()
     dout(1) << " waiting for osdmap " << mdsmap->get_last_failure_osd_epoch() 
            << " (which blacklists prior instance)" << dendl;
     objecter->wait_for_map(mdsmap->get_last_failure_osd_epoch(),
-                          new C_MDS_BootStart(this, MDS_BOOT_INITIAL));
+                          new C_OnFinisher(C_MDS_BootStart(this, MDS_BOOT_INITIAL)));
   }
 }
 
@@ -1551,7 +1554,7 @@ inline void MDS::standby_replay_restart()
     dout(1) << " waiting for osdmap " << mdsmap->get_last_failure_osd_epoch() 
            << " (which blacklists prior instance)" << dendl;
     objecter->wait_for_map(mdsmap->get_last_failure_osd_epoch(),
-                          new C_MDS_BootStart(this, MDS_BOOT_PREPARE_LOG));
+                          new C_OnFinisher(new C_MDS_BootStart(this, MDS_BOOT_PREPARE_LOG)));
   } else {
     mdlog->get_journaler()->reread_head_and_probe(
       new C_MDS_StandbyReplayRestartFinish(this, mdlog->get_journaler()->get_read_pos()));