From 043c9c8bed5c49a519654ebaedc085434e0d981b Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 23 Sep 2010 16:12:21 -0700 Subject: [PATCH] mds: scatter pin frozen tree on importer too 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 --- src/mds/Migrator.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index 94915d53d0725..d36745befe5cb 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -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 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 ls; + dir->inode->put_scatter_pin(ls); + mds->queue_waiters(ls); + // re-eval imported caps for (map >::iterator p = cap_imports.begin(); p != cap_imports.end(); -- 2.39.5