From patchwork Tue Dec 11 08:30:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 1861181 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 22FDA3FCA5 for ; Tue, 11 Dec 2012 08:31:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752528Ab2LKIbM (ORCPT ); Tue, 11 Dec 2012 03:31:12 -0500 Received: from mga11.intel.com ([192.55.52.93]:16602 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752173Ab2LKIbL (ORCPT ); Tue, 11 Dec 2012 03:31:11 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 11 Dec 2012 00:31:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,256,1355126400"; d="scan'208";a="262275471" Received: from zyan5-mobl.sh.intel.com ([10.239.36.25]) by fmsmga002.fm.intel.com with ESMTP; 11 Dec 2012 00:31:09 -0800 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org, sage@inktank.com Cc: "Yan, Zheng" Subject: [PATCH 07/14] mds: always send discover if want_xlocked is true Date: Tue, 11 Dec 2012 16:30:53 +0800 Message-Id: <1355214660-26354-8-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1355214660-26354-1-git-send-email-zheng.z.yan@intel.com> References: <1355214660-26354-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" If want_xlocked is true, we can not rely on previously sent discover because it's likely the previous discover is blocking on the xlocked dentry. Signed-off-by: Yan, Zheng --- src/mds/MDCache.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index eb18eeb..326e9d7 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -8449,7 +8449,8 @@ void MDCache::discover_path(CInode *base, return; } - if (!base->is_waiter_for(CInode::WAIT_DIR) || !onfinish) { // FIXME: weak! + if ((want_xlocked && want_path.depth() == 1) || + !base->is_waiter_for(CInode::WAIT_DIR) || !onfinish) { // FIXME: weak! discover_info_t& d = _create_discover(from); d.ino = base->ino(); d.snap = snap; @@ -8496,7 +8497,8 @@ void MDCache::discover_path(CDir *base, return; } - if (!base->is_waiting_for_dentry(want_path[0].c_str(), snap) || !onfinish) { + if ((want_xlocked && want_path.depth() == 1) || + !base->is_waiting_for_dentry(want_path[0].c_str(), snap) || !onfinish) { discover_info_t& d = _create_discover(from); d.ino = base->ino(); d.frag = base->get_frag(); @@ -8542,7 +8544,7 @@ void MDCache::discover_ino(CDir *base, return; } - if (!base->is_waiting_for_ino(want_ino)) { + if (want_xlocked || !base->is_waiting_for_ino(want_ino) || !onfinish) { discover_info_t& d = _create_discover(from); d.ino = base->ino(); d.frag = base->get_frag(); @@ -8801,11 +8803,14 @@ void MDCache::handle_discover(MDiscover *dis) // is this the last (tail) item in the discover traversal? if (tailitem && dis->wants_xlocked()) { dout(7) << "handle_discover allowing discovery of xlocked tail " << *dn << dendl; - } else { + } else if (reply->is_empty()) { dout(7) << "handle_discover blocking on xlocked " << *dn << dendl; dn->lock.add_waiter(SimpleLock::WAIT_RD, new C_MDS_RetryMessage(mds, dis)); reply->put(); return; + } else { + dout(7) << "handle_discover non-empty reply, xlocked tail " << *dn << dendl; + break; } }