]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: scatter pin frozen tree on importer too
authorSage Weil <sage@newdream.net>
Thu, 23 Sep 2010 23:12:21 +0000 (16:12 -0700)
committerSage Weil <sage@newdream.net>
Thu, 23 Sep 2010 23:44:47 +0000 (16:44 -0700)
The importer also needs to scatter pin.  This avoids scatterlock gather
races like so:

A: start exporting to B
A: freeze, scatter pin tree
C: initiate gather
A: delay replay to gather
B: reply to gather, do not include (non-auth) dirfrag
A,B: finish migration
A: reply to gather, do not include (now non-auth) dirfrag
C: gets no info about the dirfrag!

By pinning on the importer, we ensure that at least one MDS will respond
to the gather with auth dirfrag info.

Signed-off-by: Sage Weil <sage@newdream.net>
src/mds/Migrator.cc

index 94915d53d0725239879d7a780c431206dbd60c08..d36745befe5cb41260e0756ea6cc7bc957d811ec 100644 (file)
@@ -1684,6 +1684,9 @@ void Migrator::handle_export_prep(MExportDirPrep *m)
   
   // freeze.
   dir->_freeze_tree();
+
+  // pin parent scatterlocks (sloppily!)
+  dir->inode->get_scatter_pin();
   
   // ok!
   dout(7) << " sending export_prep_ack on " << *dir << dendl;
@@ -1943,6 +1946,9 @@ void Migrator::import_reverse_unfreeze(CDir *dir)
 {
   dout(7) << "import_reverse_unfreeze " << *dir << dendl;
   dir->unfreeze_tree();
+  list<Context*> ls;
+  dir->inode->put_scatter_pin(ls);
+  mds->queue_waiters(ls);
   cache->discard_delayed_expire(dir);
   import_reverse_final(dir);
 }
@@ -2051,6 +2057,10 @@ void Migrator::import_finish(CDir *dir)
   cache->show_subtrees();
   //audit();  // this fails, bc we munge up the subtree map during handle_import_map (resolve phase)
 
+  list<Context*> ls;
+  dir->inode->put_scatter_pin(ls);
+  mds->queue_waiters(ls);
+
   // re-eval imported caps
   for (map<CInode*, map<client_t,Capability::Export> >::iterator p = cap_imports.begin();
        p != cap_imports.end();