From: Yan, Zheng Date: Thu, 14 Mar 2013 03:57:16 +0000 (+0800) Subject: mds: notify bystanders if export aborts X-Git-Tag: v0.62~120^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fcf170b81b5b70dc4e764784870ca51d2ffc1df1;p=ceph.git mds: notify bystanders if export aborts So bystanders know the subtree is single auth earlier. Signed-off-by: Yan, Zheng Reviewed-by: Greg Farnum --- diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index 7706641bdbf0..bf64ed40f830 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -251,25 +251,28 @@ void Migrator::handle_mds_failure_or_stop(int who) mds->send_message_mds(new MExportDirCancel(dir->dirfrag()), export_peer[dir]); break; - // NOTE: state order reversal, warning comes after loggingstart+prepping + // NOTE: state order reversal, warning comes after prepping case EXPORT_WARNING: dout(10) << "export state=warning : unpinning bounds, unfreezing, notifying" << dendl; // fall-thru case EXPORT_PREPPING: if (p->second != EXPORT_WARNING) - dout(10) << "export state=loggingstart|prepping : unpinning bounds, unfreezing" << dendl; + dout(10) << "export state=prepping : unpinning bounds, unfreezing" << dendl; { // unpin bounds set bounds; cache->get_subtree_bounds(dir, bounds); - for (set::iterator p = bounds.begin(); - p != bounds.end(); - ++p) { - CDir *bd = *p; + for (set::iterator q = bounds.begin(); + q != bounds.end(); + ++q) { + CDir *bd = *q; bd->put(CDir::PIN_EXPORTBOUND); bd->state_clear(CDir::STATE_EXPORTBOUND); } + // notify bystanders + if (p->second == EXPORT_WARNING) + export_notify_abort(dir, bounds); } dir->unfreeze_tree(); export_state.erase(dir); // clean up @@ -1307,9 +1310,21 @@ void Migrator::handle_export_ack(MExportDirAck *m) m->put(); } +void Migrator::export_notify_abort(CDir *dir, set& bounds) +{ + dout(7) << "export_notify_abort " << *dir << dendl; - - + for (set::iterator p = export_notify_ack_waiting[dir].begin(); + p != export_notify_ack_waiting[dir].end(); + ++p) { + MExportDirNotify *notify = new MExportDirNotify(dir->dirfrag(), false, + pair(mds->get_nodeid(),export_peer[dir]), + pair(mds->get_nodeid(),CDIR_AUTH_UNKNOWN)); + for (set::iterator i = bounds.begin(); i != bounds.end(); ++i) + notify->get_bounds().push_back((*i)->dirfrag()); + mds->send_message_mds(notify, *p); + } +} /* * this happens if hte dest failes after i send teh export data but before it is acked @@ -1356,6 +1371,9 @@ void Migrator::export_reverse(CDir *dir) bd->state_clear(CDir::STATE_EXPORTBOUND); } + // notify bystanders + export_notify_abort(dir, bounds); + // process delayed expires cache->process_delayed_expire(dir); diff --git a/src/mds/Migrator.h b/src/mds/Migrator.h index 2889a74f4918..f395bc1d2377 100644 --- a/src/mds/Migrator.h +++ b/src/mds/Migrator.h @@ -227,6 +227,7 @@ public: void export_go(CDir *dir); void export_go_synced(CDir *dir); void export_reverse(CDir *dir); + void export_notify_abort(CDir *dir, set& bounds); void handle_export_ack(MExportDirAck *m); void export_logged_finish(CDir *dir); void handle_export_notify_ack(MExportDirNotifyAck *m);