From patchwork Sun Mar 17 14:51:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 2283941 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id A40D7E00E5 for ; Sun, 17 Mar 2013 15:06:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932720Ab3CQOxz (ORCPT ); Sun, 17 Mar 2013 10:53:55 -0400 Received: from mga03.intel.com ([143.182.124.21]:30053 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932663Ab3CQOxy (ORCPT ); Sun, 17 Mar 2013 10:53:54 -0400 Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga101.ch.intel.com with ESMTP; 17 Mar 2013 07:53:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,859,1355126400"; d="scan'208";a="215704522" Received: from unknown (HELO zyan5-mobl.ccr.corp.intel.com) ([10.255.20.118]) by AZSMGA002.ch.intel.com with ESMTP; 17 Mar 2013 07:53:50 -0700 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org Cc: sage@inktank.com, greg@inktank.com, "Yan, Zheng" Subject: [PATCH 33/39] mds: notify bystanders if export aborts Date: Sun, 17 Mar 2013 22:51:36 +0800 Message-Id: <1363531902-24909-34-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1363531902-24909-1-git-send-email-zheng.z.yan@intel.com> References: <1363531902-24909-1-git-send-email-zheng.z.yan@intel.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org From: "Yan, Zheng" So bystanders know the subtree is single auth earlier. Signed-off-by: Yan, Zheng Reviewed-by: Greg Farnum --- src/mds/Migrator.cc | 34 ++++++++++++++++++++++++++-------- src/mds/Migrator.h | 1 + 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index 40a5394..0672d03 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 2889a74..f395bc1 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);