From patchwork Mon Nov 19 02:43:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 1762211 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 4D0723FCF7 for ; Mon, 19 Nov 2012 02:44:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753017Ab2KSCoJ (ORCPT ); Sun, 18 Nov 2012 21:44:09 -0500 Received: from mga11.intel.com ([192.55.52.93]:57821 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752932Ab2KSCoH (ORCPT ); Sun, 18 Nov 2012 21:44:07 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 18 Nov 2012 18:44:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.83,275,1352102400"; d="scan'208";a="251134145" Received: from zyan5-mobl.sh.intel.com ([10.239.36.18]) by fmsmga002.fm.intel.com with ESMTP; 18 Nov 2012 18:44:06 -0800 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org, sage@inktank.com Cc: "Yan, Zheng" Subject: [PATCH 16/16] mds: use rdlock_try() when checking NULL dentry Date: Mon, 19 Nov 2012 10:43:48 +0800 Message-Id: <1353293028-15238-17-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1353293028-15238-1-git-send-email-zheng.z.yan@intel.com> References: <1353293028-15238-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" Use rdlock_try() instead can_read() when path_traverse encounters a NULL dentry. This can partly avoid infinitely waiting for the dentry to become readable when the dentry is replica. Strictly speaking, use rdlock_try() is still enough because auth MDS may drop the REQRDLOCK message in some cases. Signed-off-by: Yan, Zheng --- src/mds/MDCache.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 9cddfeb..7152b5e 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -6707,11 +6707,11 @@ int MDCache::path_traverse(MDRequest *mdr, Message *req, Context *fin, // wh // can we conclude ENOENT? if (dnl && dnl->is_null()) { - if (dn->lock.can_read(client)) { - dout(12) << "traverse: miss on null+readable dentry " << path[depth] << " " << *dn << dendl; + if (mds->locker->rdlock_try(&dn->lock, client, NULL)) { + dout(10) << "traverse: miss on null+readable dentry " << path[depth] << " " << *dn << dendl; return -ENOENT; } else { - dout(12) << "miss on dentry " << *dn << ", can't read due to lock" << dendl; + dout(10) << "miss on dentry " << *dn << ", can't read due to lock" << dendl; dn->lock.add_waiter(SimpleLock::WAIT_RD, _get_waiter(mdr, req, fin)); return 1; }