From patchwork Fri Jan 4 09:01:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 1931721 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 799DDDFABD for ; Fri, 4 Jan 2013 09:02:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753389Ab3ADJCf (ORCPT ); Fri, 4 Jan 2013 04:02:35 -0500 Received: from mga01.intel.com ([192.55.52.88]:51114 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752605Ab3ADJC3 (ORCPT ); Fri, 4 Jan 2013 04:02:29 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 04 Jan 2013 01:02:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,409,1355126400"; d="scan'208";a="272789951" Received: from zyan5-mobl.sh.intel.com ([10.239.36.28]) by fmsmga002.fm.intel.com with ESMTP; 04 Jan 2013 01:02:26 -0800 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org, sage@inktank.com Cc: "Yan, Zheng" Subject: [PATCH 03/29] mds: don't trigger assertion when discover races with rename Date: Fri, 4 Jan 2013 17:01:54 +0800 Message-Id: <1357290140-17044-4-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1357290140-17044-1-git-send-email-zheng.z.yan@intel.com> References: <1357290140-17044-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" Discover reply that adds replica dentry and inode can race with rename if slave request for rename sends discover and waits, but waked up by reply for different discover. Signed-off-by: Yan, Zheng --- src/mds/CDentry.cc | 17 ++++++----------- src/mds/MDCache.cc | 5 ++--- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/mds/CDentry.cc b/src/mds/CDentry.cc index 7dd88ac..5ff6e61 100644 --- a/src/mds/CDentry.cc +++ b/src/mds/CDentry.cc @@ -439,23 +439,18 @@ void CDentry::decode_replica(bufferlist::iterator& p, bool is_new) inodeno_t rino; unsigned char rdtype; + __s32 ls; ::decode(rino, p); ::decode(rdtype, p); - if (rino) { - if (linkage.is_null()) - dir->link_remote_inode(this, rino, rdtype); - else - assert(linkage.is_remote() && linkage.remote_ino == rino); - } - - __s32 ls; ::decode(ls, p); - if (is_new) + + if (is_new) { + if (rino) + dir->link_remote_inode(this, rino, rdtype); lock.set_state(ls); + } } - - // ---------------------------- // locking diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 0a88714..5014b5d 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -9150,12 +9150,11 @@ CInode *MDCache::add_replica_inode(bufferlist::iterator& p, CDentry *dn, listdecode_replica(p, false); dout(10) << "add_replica_inode had " << *in << dendl; - assert(!dn || dn->get_linkage()->get_inode() == in); } if (dn) { - assert(dn->get_linkage()->is_primary()); - assert(dn->get_linkage()->get_inode() == in); + if (!dn->get_linkage()->is_primary() || dn->get_linkage()->get_inode() != in) + dout(10) << "add_replica_inode different linkage in dentry " << *dn << dendl; dn->get_dir()->take_ino_waiting(in->ino(), finished); }