From patchwork Fri Jul 16 09:28:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Kent X-Patchwork-Id: 12381819 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F931C07E95 for ; Fri, 16 Jul 2021 09:38:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6910F613D8 for ; Fri, 16 Jul 2021 09:38:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234820AbhGPJk4 (ORCPT ); Fri, 16 Jul 2021 05:40:56 -0400 Received: from icp-osb-irony-out9.external.iinet.net.au ([203.59.1.226]:22642 "EHLO icp-osb-irony-out9.external.iinet.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234645AbhGPJkw (ORCPT ); Fri, 16 Jul 2021 05:40:52 -0400 X-SMTP-MATCH: 0 IronPort-HdrOrdr: A9a23:t7TAma1IrZHKw7M8QUCgYgqjBJkkLtp133Aq2lEZdPU1SKylfqWV98jzuiWftN98YhwdcLO7WZVoI0myyXcd2+B4AV7IZmfbUQWTQL2LbePZsl7d866XzJ8l6U9KGJIOauEZBzNB/L7HCI7RKadG/DEEmJrY49s3Th9WPGRXgyQJ1XYcNjqm X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2AZBwA6UPFg/y2ELHlaHgEBCxIMQAmBRQsCg3ZshAJGkBMBAQEBAQEGjCmFb1+KKYF8CwEBAQEBAQEBAUoEAQGEVAKCfAElNAkOAgQVAQEBBQEBAQEBBgMBgQ6FdUMBDAGFdQYjBFIQGA0CGA4CAkcQBgEShVMlp2d/MxoCZYpDgRAqAYcIgmiDeiccfYEQgRUzA4EFgiiHW4JkBIMYgQ4mWoFAlQwBRooZW50Mgy6eZBeVTwOQdS2VW6cOghRNLgqDJFAZjjgXjjo3LzgCBgoBAQMJgnKHIi2CGAEB X-IPAS-Result: A2AZBwA6UPFg/y2ELHlaHgEBCxIMQAmBRQsCg3ZshAJGkBMBAQEBAQEGjCmFb1+KKYF8CwEBAQEBAQEBAUoEAQGEVAKCfAElNAkOAgQVAQEBBQEBAQEBBgMBgQ6FdUMBDAGFdQYjBFIQGA0CGA4CAkcQBgEShVMlp2d/MxoCZYpDgRAqAYcIgmiDeiccfYEQgRUzA4EFgiiHW4JkBIMYgQ4mWoFAlQwBRooZW50Mgy6eZBeVTwOQdS2VW6cOghRNLgqDJFAZjjgXjjo3LzgCBgoBAQMJgnKHIi2CGAEB X-IronPort-AV: E=Sophos;i="5.84,244,1620662400"; d="scan'208";a="329873615" Received: from unknown (HELO web.messagingengine.com) ([121.44.132.45]) by icp-osb-irony-out9.iinet.net.au with ESMTP; 16 Jul 2021 17:28:40 +0800 Subject: [PATCH v8 5/5] kernfs: dont call d_splice_alias() under kernfs node lock From: Ian Kent To: Greg Kroah-Hartman , Tejun Heo Cc: Eric Sandeen , Fox Chen , Brice Goglin , Al Viro , Rick Lindsley , David Howells , Miklos Szeredi , Marcelo Tosatti , "Eric W. Biederman" , Carlos Maiolino , linux-fsdevel , Kernel Mailing List Date: Fri, 16 Jul 2021 17:28:40 +0800 Message-ID: <162642772000.63632.10672683419693513226.stgit@web.messagingengine.com> In-Reply-To: <162642752894.63632.5596341704463755308.stgit@web.messagingengine.com> References: <162642752894.63632.5596341704463755308.stgit@web.messagingengine.com> User-Agent: StGit/0.23 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org The call to d_splice_alias() in kernfs_iop_lookup() doesn't depend on any kernfs node so there's no reason to hold the kernfs node lock when calling it. Signed-off-by: Ian Kent Reviewed-by: Miklos Szeredi --- fs/kernfs/dir.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index 4994723d6cf7..ba581429bf7b 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c @@ -1100,7 +1100,6 @@ static struct dentry *kernfs_iop_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) { - struct dentry *ret; struct kernfs_node *parent = dir->i_private; struct kernfs_node *kn; struct inode *inode = NULL; @@ -1120,11 +1119,10 @@ static struct dentry *kernfs_iop_lookup(struct inode *dir, /* Needed only for negative dentry validation */ if (!inode) kernfs_set_rev(parent, dentry); - /* instantiate and hash (possibly negative) dentry */ - ret = d_splice_alias(inode, dentry); up_read(&kernfs_rwsem); - return ret; + /* instantiate and hash (possibly negative) dentry */ + return d_splice_alias(inode, dentry); } static int kernfs_iop_mkdir(struct user_namespace *mnt_userns,