From patchwork Sun Mar 17 14:51:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 2283651 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 4C40AE0172 for ; Sun, 17 Mar 2013 15:06:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932495Ab3CQOwE (ORCPT ); Sun, 17 Mar 2013 10:52:04 -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 S932476Ab3CQOwC (ORCPT ); Sun, 17 Mar 2013 10:52:02 -0400 Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga101.ch.intel.com with ESMTP; 17 Mar 2013 07:52:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,859,1355126400"; d="scan'208";a="215704201" 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:51:58 -0700 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org Cc: sage@inktank.com, greg@inktank.com, "Yan, Zheng" Subject: [PATCH 04/39] mds: make sure table request id unique Date: Sun, 17 Mar 2013 22:51:07 +0800 Message-Id: <1363531902-24909-5-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" When a MDS becomes active, the table server re-sends 'agree' messages for old prepared request. If the recoverd MDS starts a new table request at the same time, The new request's ID can happen to be the same as old prepared request's ID, because current table client assigns request ID from zero after MDS restarts. Signed-off-by: Yan, Zheng --- src/mds/MDS.cc | 3 +++ src/mds/MDSTableClient.cc | 5 +++++ src/mds/MDSTableClient.h | 2 ++ 3 files changed, 10 insertions(+) diff --git a/src/mds/MDS.cc b/src/mds/MDS.cc index bb1c833..859782a 100644 --- a/src/mds/MDS.cc +++ b/src/mds/MDS.cc @@ -1212,6 +1212,9 @@ void MDS::boot_start(int step, int r) dout(2) << "boot_start " << step << ": opening snap table" << dendl; snapserver->load(gather.new_sub()); } + + anchorclient->init(); + snapclient->init(); dout(2) << "boot_start " << step << ": opening mds log" << dendl; mdlog->open(gather.new_sub()); diff --git a/src/mds/MDSTableClient.cc b/src/mds/MDSTableClient.cc index ea021f5..beba0a3 100644 --- a/src/mds/MDSTableClient.cc +++ b/src/mds/MDSTableClient.cc @@ -34,6 +34,11 @@ #undef dout_prefix #define dout_prefix *_dout << "mds." << mds->get_nodeid() << ".tableclient(" << get_mdstable_name(table) << ") " +void MDSTableClient::init() +{ + // make reqid unique between MDS restarts + last_reqid = (uint64_t)mds->mdsmap->get_epoch() << 32; +} void MDSTableClient::handle_request(class MMDSTableRequest *m) { diff --git a/src/mds/MDSTableClient.h b/src/mds/MDSTableClient.h index e15837f..78035db 100644 --- a/src/mds/MDSTableClient.h +++ b/src/mds/MDSTableClient.h @@ -63,6 +63,8 @@ public: MDSTableClient(MDS *m, int tab) : mds(m), table(tab), last_reqid(0) {} virtual ~MDSTableClient() {} + void init(); + void handle_request(MMDSTableRequest *m); void _prepare(bufferlist& mutation, version_t *ptid, bufferlist *pbl, Context *onfinish);