From patchwork Fri Apr 5 16:57:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Waiman Long X-Patchwork-Id: 2399571 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 1EC32DF2E5 for ; Fri, 5 Apr 2013 16:58:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162264Ab3DEQ6T (ORCPT ); Fri, 5 Apr 2013 12:58:19 -0400 Received: from g4t0014.houston.hp.com ([15.201.24.17]:14631 "EHLO g4t0014.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162134Ab3DEQ6R (ORCPT ); Fri, 5 Apr 2013 12:58:17 -0400 Received: from g4t0018.houston.hp.com (g4t0018.houston.hp.com [16.234.32.27]) by g4t0014.houston.hp.com (Postfix) with ESMTP id AC33B2424B; Fri, 5 Apr 2013 16:58:16 +0000 (UTC) Received: from RHEL63.localdomain (unknown [16.99.86.2]) by g4t0018.houston.hp.com (Postfix) with ESMTP id AE273102C4; Fri, 5 Apr 2013 16:58:15 +0000 (UTC) From: Waiman Long Cc: Waiman Long , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, autofs@vger.kernel.org, ceph-devel@vger.kernel.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-nfs@vger.kernel.org, "Chandramouleeswaran, Aswin" , "Norton, Scott J" , Andi Kleen , Dave Chinner Subject: [PATCH v2 4/4] dcache: don't need to take d_lock in prepend_path() Date: Fri, 5 Apr 2013 12:57:41 -0400 Message-Id: <1365181061-30787-5-git-send-email-Waiman.Long@hp.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1365181061-30787-1-git-send-email-Waiman.Long@hp.com> References: <1365181061-30787-1-git-send-email-Waiman.Long@hp.com> To: Alexander Viro , Jeff Layton , Miklos Szeredi , Ian Kent , Sage Weil , Steve French , Trond Myklebust , Eric Paris Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org The d_lock was used in prepend_path() to protect dentry->d_name from being changed under the hood. As the caller of prepend_path() has to take the rename_lock before calling into it, there is no chance that d_name will be changed. The d_lock lock is only needed when the rename_lock is not taken. Signed-off-by: Waiman Long --- fs/dcache.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/fs/dcache.c b/fs/dcache.c index 9477d80..e3d6543 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -2529,6 +2529,7 @@ static int prepend_name(char **buffer, int *buflen, struct qstr *name) * @buflen: pointer to buffer length * * Caller holds the rename_lock. + * There is no need to lock the dentry as its name cannot be changed. */ static int prepend_path(const struct path *path, const struct path *root, @@ -2555,9 +2556,7 @@ static int prepend_path(const struct path *path, } parent = dentry->d_parent; prefetch(parent); - spin_lock(&dentry->d_lock); error = prepend_name(buffer, buflen, &dentry->d_name); - spin_unlock(&dentry->d_lock); if (!error) error = prepend(buffer, buflen, "/", 1); if (error)