Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1235196rwe; Thu, 25 Aug 2022 19:21:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR4BWAbTrE1nNTVVfdLOjaQWATukC3Mq4YLljIb+oQZG4Cf5VUeK2UMSyAuRjZrgz0WTdMKI X-Received: by 2002:a17:906:974f:b0:73d:716a:7d98 with SMTP id o15-20020a170906974f00b0073d716a7d98mr4163955ejy.208.1661480506792; Thu, 25 Aug 2022 19:21:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661480506; cv=none; d=google.com; s=arc-20160816; b=NMBqH0gcHnOCAYaatLbeWyQYJH8a+ZdPkRkX7sv4Ut5GVqp9GZ/PCDORE1jBxnJ7cR KXLmiaQ33U8v3awURCADyB3kXPCXJgEymiurTGZBr1/QOJKnEIBKG1v6vJXbnIJrahdn khS1nrwTtzzhxkmHd9mvGYgtCod0x40ulvZ5ZeXlaixGjQgCLXwbldyFBhwEVvioTt0V 0P9U2is9IdyWyjpvTreOfrfTezvPQrhO5VOqFVcHSGdxqkuyI0eClosxMHefMFBBE02T XzrGuT2CR8aC4BPFuCUUbVC/fOSDIs2hsKyjgEsVc4hKP+fV3bDTH7q2g/cBLIXzv3ju 9TwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature:dkim-signature; bh=zX1J6cQNA1PNLcbJb0A3ip/on9dJ42qAkxah5LchdGc=; b=ObY0z66I3cEKOauC/xWniWJVsUi94RTCuhEREsmVIuw9NgOM5i2IqMgVAtEf4RCEBP VuBDVFGruhd+uAlxLGBsoZqdSxLGyQ89Ok7G0XMZQDrIMa23W3cuukWKQ8/sgzizW+W7 /ToeO6E/Jqu0eFQwhCiu0U0QW4F8/m1SvJjKmFXxMhBBplFSxC0XkZlreDgOwacUPsB8 ycGPwzzmcaFh++CnfYmC9LyHsCPxLkVhN2Sn9J6E3S/5oI5vgmd7GriBFDdchHA0yRBW BPNs/hlycNh7tx8KVnoRK65ZLueFllTFqQHgsgefSiKvJZwYC8reYQneiCMo5dFYG9QS Zpfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=ZMrYY+B+; dkim=neutral (no key) header.i=@suse.de header.b=repLqx9C; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd35-20020a1709076e2300b00734b2821879si445905ejc.898.2022.08.25.19.21.21; Thu, 25 Aug 2022 19:21:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=ZMrYY+B+; dkim=neutral (no key) header.i=@suse.de header.b=repLqx9C; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244739AbiHZCRe (ORCPT + 99 others); Thu, 25 Aug 2022 22:17:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244762AbiHZCR3 (ORCPT ); Thu, 25 Aug 2022 22:17:29 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 807C9CAC92; Thu, 25 Aug 2022 19:17:28 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 2D466205B5; Fri, 26 Aug 2022 02:17:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1661480247; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zX1J6cQNA1PNLcbJb0A3ip/on9dJ42qAkxah5LchdGc=; b=ZMrYY+B+4FbMMl74JGtpR8KBHV10aX6Pl3/aWU4ILDlNGEfxh18N+y9wj6oqgbV7G5SXUi jW/w+7+2MtyBCIPHBkQaJCNGRSdFp/AO1diIhOAGmzMACAd0rezrxfpDtM0tbLdP6IYwC7 1SKuagjidoYpY4ahMfO7JvL7s206Ogg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1661480247; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zX1J6cQNA1PNLcbJb0A3ip/on9dJ42qAkxah5LchdGc=; b=repLqx9CgqqKBvMLIzvMWpUVrKAFvZCRNtRMpv8QTE+BahyB8jr3JcSStdoBWP8ZQi4GIo QXzlI0Yuxhg8eVDw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A66F313A65; Fri, 26 Aug 2022 02:17:24 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 4sQ4GDQtCGN8MQAAMHmgww (envelope-from ); Fri, 26 Aug 2022 02:17:24 +0000 Subject: [PATCH 04/10] VFS: move dput() and mnt_drop_write() into done_path_update() From: NeilBrown To: Al Viro , Linus Torvalds , Daire Byrne , Trond Myklebust , Chuck Lever Cc: Linux NFS Mailing List , linux-fsdevel@vger.kernel.org, LKML Date: Fri, 26 Aug 2022 12:10:43 +1000 Message-ID: <166147984374.25420.5286418066446165003.stgit@noble.brown> In-Reply-To: <166147828344.25420.13834885828450967910.stgit@noble.brown> References: <166147828344.25420.13834885828450967910.stgit@noble.brown> User-Agent: StGit/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org All calls to done_path_update() are followed by the same two calls, so merge them in. Signed-off-by: NeilBrown --- fs/namei.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 73c3319a1703..8df09c19f2b0 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1734,6 +1734,8 @@ static void done_path_update(struct path *path, struct dentry *dentry, inode_unlock_shared(dir); else inode_unlock(dir); + dput(dentry); + mnt_drop_write(path->mnt); } static struct dentry *lookup_fast(struct nameidata *nd) @@ -3988,8 +3990,6 @@ EXPORT_SYMBOL(kern_path_create); void done_path_create_wq(struct path *path, struct dentry *dentry, bool with_wq) { done_path_update(path, dentry, with_wq); - dput(dentry); - mnt_drop_write(path->mnt); path_put(path); } EXPORT_SYMBOL(done_path_create_wq); @@ -4310,8 +4310,6 @@ int do_rmdir(int dfd, struct filename *name) error = vfs_rmdir(mnt_userns, path.dentry->d_inode, dentry); exit3: done_path_update(&path, dentry, true); - dput(dentry); - mnt_drop_write(path.mnt); exit2: path_put(&path); if (retry_estale(error, lookup_flags)) { @@ -4446,8 +4444,6 @@ int do_unlinkat(int dfd, struct filename *name) &delegated_inode); exit3: done_path_update(&path, dentry, true); - dput(dentry); - mnt_drop_write(path.mnt); } if (inode) iput(inode); /* truncate the inode here */