From patchwork Sun Mar 17 14:51:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 2283661 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 6F652E00E5 for ; Sun, 17 Mar 2013 15:06:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932521Ab3CQOwG (ORCPT ); Sun, 17 Mar 2013 10:52:06 -0400 Received: from mga03.intel.com ([143.182.124.21]:34328 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932476Ab3CQOwF (ORCPT ); Sun, 17 Mar 2013 10:52:05 -0400 Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga101.ch.intel.com with ESMTP; 17 Mar 2013 07:52:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,859,1355126400"; d="scan'208";a="215704221" 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:52:02 -0700 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org Cc: sage@inktank.com, greg@inktank.com, "Yan, Zheng" Subject: [PATCH 05/39] mds: send table request when peer is in proper state. Date: Sun, 17 Mar 2013 22:51:08 +0800 Message-Id: <1363531902-24909-6-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" Table client/server should send request/reply when the peer is active. Anchor query is an exception, because MDS in rejoin stage may need fetch files before sending rejoin ack, the anchor server can also be in rejoin stage. Signed-off-by: Yan, Zheng Reviewed-by: Greg Farnum --- src/mds/AnchorClient.cc | 5 ++++- src/mds/MDSTableClient.cc | 9 ++++++--- src/mds/MDSTableServer.cc | 3 ++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/mds/AnchorClient.cc b/src/mds/AnchorClient.cc index 455e97f..d7da9d1 100644 --- a/src/mds/AnchorClient.cc +++ b/src/mds/AnchorClient.cc @@ -80,9 +80,12 @@ void AnchorClient::lookup(inodeno_t ino, vector& trace, Context *onfinis void AnchorClient::_lookup(inodeno_t ino) { + int ts = mds->mdsmap->get_tableserver(); + if (mds->mdsmap->get_state(ts) < MDSMap::STATE_REJOIN) + return; MMDSTableRequest *req = new MMDSTableRequest(table, TABLESERVER_OP_QUERY, 0, 0); ::encode(ino, req->bl); - mds->send_message_mds(req, mds->mdsmap->get_tableserver()); + mds->send_message_mds(req, ts); } diff --git a/src/mds/MDSTableClient.cc b/src/mds/MDSTableClient.cc index beba0a3..df0131f 100644 --- a/src/mds/MDSTableClient.cc +++ b/src/mds/MDSTableClient.cc @@ -149,9 +149,10 @@ void MDSTableClient::_prepare(bufferlist& mutation, version_t *ptid, bufferlist void MDSTableClient::send_to_tableserver(MMDSTableRequest *req) { int ts = mds->mdsmap->get_tableserver(); - if (mds->mdsmap->get_state(ts) >= MDSMap::STATE_CLIENTREPLAY) + if (mds->mdsmap->get_state(ts) >= MDSMap::STATE_CLIENTREPLAY) { mds->send_message_mds(req, ts); - else { + } else { + req->put(); dout(10) << " deferring request to not-yet-active tableserver mds." << ts << dendl; } } @@ -193,7 +194,9 @@ void MDSTableClient::got_journaled_ack(version_t tid) void MDSTableClient::finish_recovery() { dout(7) << "finish_recovery" << dendl; - resend_commits(); + int ts = mds->mdsmap->get_tableserver(); + if (mds->mdsmap->get_state(ts) >= MDSMap::STATE_CLIENTREPLAY) + resend_commits(); } void MDSTableClient::resend_commits() diff --git a/src/mds/MDSTableServer.cc b/src/mds/MDSTableServer.cc index 4f86ff1..07c7d26 100644 --- a/src/mds/MDSTableServer.cc +++ b/src/mds/MDSTableServer.cc @@ -159,7 +159,8 @@ void MDSTableServer::handle_mds_recovery(int who) for (map::iterator p = pending_for_mds.begin(); p != pending_for_mds.end(); ++p) { - if (who >= 0 && p->second.mds != who) + if ((who >= 0 && p->second.mds != who) || + mds->mdsmap->get_state(p->second.mds) < MDSMap::STATE_CLIENTREPLAY) continue; MMDSTableRequest *reply = new MMDSTableRequest(table, TABLESERVER_OP_AGREE, p->second.reqid, p->second.tid); mds->send_message_mds(reply, p->second.mds);