From patchwork Mon Jun 17 12:10:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 2733011 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D6510C0AB1 for ; Mon, 17 Jun 2013 12:11:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 378022025B for ; Mon, 17 Jun 2013 12:11:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EBCD020262 for ; Mon, 17 Jun 2013 12:11:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932807Ab3FQMLE (ORCPT ); Mon, 17 Jun 2013 08:11:04 -0400 Received: from mga09.intel.com ([134.134.136.24]:50572 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932725Ab3FQMLC (ORCPT ); Mon, 17 Jun 2013 08:11:02 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 17 Jun 2013 05:08:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,880,1363158000"; d="scan'208";a="354856755" Received: from unknown (HELO zyan5-mobl.ccr.corp.intel.com) ([10.255.20.93]) by orsmga002.jf.intel.com with ESMTP; 17 Jun 2013 05:10:42 -0700 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org Cc: sage@inktank.com, "Yan, Zheng" Subject: [PATCH 1/8] mds: don't update migrate_seq when importing non-auth cap Date: Mon, 17 Jun 2013 20:10:22 +0800 Message-Id: <1371471029-10589-2-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1371471029-10589-1-git-send-email-zheng.z.yan@intel.com> References: <1371471029-10589-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 X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Yan, Zheng" We use migrate_seq to distinguish old and new auth MDS. So we should not change migrate_seq when importing non-auth cap. Signed-off-by: Yan, Zheng --- src/mds/Capability.h | 5 +++-- src/mds/Migrator.cc | 8 ++++---- src/mds/Migrator.h | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/mds/Capability.h b/src/mds/Capability.h index 54d2312..fdecb90 100644 --- a/src/mds/Capability.h +++ b/src/mds/Capability.h @@ -273,7 +273,7 @@ public: return Export(_wanted, issued(), pending(), client_follows, mseq+1, last_issue_stamp); } void rejoin_import() { mseq++; } - void merge(Export& other) { + void merge(Export& other, bool auth_cap) { // issued + pending int newpending = other.pending | pending(); if (other.issued & ~newpending) @@ -286,7 +286,8 @@ public: // wanted _wanted = _wanted | other.wanted; - mseq = other.mseq; + if (auth_cap) + mseq = other.mseq; } void merge(int otherwanted, int otherissued) { // issued + pending diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index 6ea28c9..0647448 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -2223,7 +2223,7 @@ void Migrator::import_logged_start(dirfrag_t df, CDir *dir, int from, for (map >::iterator p = import_caps[dir].begin(); p != import_caps[dir].end(); ++p) { - finish_import_inode_caps(p->first, from, p->second); + finish_import_inode_caps(p->first, true, p->second); } // send notify's etc. @@ -2398,7 +2398,7 @@ void Migrator::decode_import_inode_caps(CInode *in, } } -void Migrator::finish_import_inode_caps(CInode *in, int from, +void Migrator::finish_import_inode_caps(CInode *in, bool auth_cap, map &cap_map) { for (map::iterator it = cap_map.begin(); @@ -2412,7 +2412,7 @@ void Migrator::finish_import_inode_caps(CInode *in, int from, if (!cap) { cap = in->add_client_cap(it->first, session); } - cap->merge(it->second); + cap->merge(it->second, auth_cap); mds->mdcache->do_cap_import(session, in, cap); } @@ -2688,7 +2688,7 @@ void Migrator::logged_import_caps(CInode *in, mds->server->finish_force_open_sessions(client_map, sseqmap); assert(cap_imports.count(in)); - finish_import_inode_caps(in, from, cap_imports[in]); + finish_import_inode_caps(in, false, cap_imports[in]); mds->locker->eval(in, CEPH_CAP_LOCKS, true); mds->send_message_mds(new MExportCapsAck(in->ino()), from); diff --git a/src/mds/Migrator.h b/src/mds/Migrator.h index 70b59bc..afe2e6c 100644 --- a/src/mds/Migrator.h +++ b/src/mds/Migrator.h @@ -256,7 +256,8 @@ public: void decode_import_inode_caps(CInode *in, bufferlist::iterator &blp, map >& cap_imports); - void finish_import_inode_caps(CInode *in, int from, map &cap_map); + void finish_import_inode_caps(CInode *in, bool auth_cap, + map &cap_map); int decode_import_dir(bufferlist::iterator& blp, int oldauth, CDir *import_root,