From nobody Thu Apr 2 01:48:15 2026 Received: from flow-a2-smtp.messagingengine.com (flow-a2-smtp.messagingengine.com [103.168.172.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F215B33A9C4; Tue, 24 Feb 2026 22:26:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.137 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771971968; cv=none; b=GrKhi4G6S1TsEDEcY4eheqOBVYxDi3EmI6VJpw1apCbbhLWWmb3+t9jX4sUYkekyskVQCzyxC0DPwbHQQ7ykrn15aDfO7WxdNiimOJA5vZ0aVilbUuGl9P0ybkxlH2pM5mKzVNd9KdAeWbFZw1Jo+XOh1qLOBIvFDxpo95s95Mw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771971968; c=relaxed/simple; bh=8pfwM/oiJ7V1Xu1rcLqhbbFwuMvNN87UDEvkhe3kSJk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BT+7BYWB1lmhs2wbKEc+3ycHPgUlFQMedaYgxlmcW8OAdKItcxKzmRtU6FYlkBitk8rTwytx4pv335pdu3XQySK3L4toZH3GqE9fnFnA1pwKxnqdF14ut21EqYDWX/BrVdBo7FrnoSalcjof88PAzSwYyqm7CzOD02TSVGixjGY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net; spf=pass smtp.mailfrom=ownmail.net; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b=SASpB0jn; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=HkUvYZy2; arc=none smtp.client-ip=103.168.172.137 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ownmail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b="SASpB0jn"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="HkUvYZy2" Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailflow.phl.internal (Postfix) with ESMTP id 645B9138052C; Tue, 24 Feb 2026 17:26:06 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Tue, 24 Feb 2026 17:26:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ownmail.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to; s=fm3; t=1771971966; x=1771979166; bh=bc9azlh/VG6ae6PkDsWsI4XhYvmFw1STenuoUYZ/MBs=; b= SASpB0jnygHPumGAlWS91bgfQg5zVUOVMHKOq00zAYqspcXFZUx++8j5Hyoq/V9Q WNdWgMStsw9ANiYmzA7M3hNAS3fajikRG71Ds+45ffN+sPaj4NcnlwGzxEt10udz ns2nO1tlPzw4vFYEmZGJjelVSMf/Brv43bJZ/BxF2YzDBbfs9Wt7Z9rcraW4UaKU waRkVw8ZqH9j4XRXgPW+T/Xrw0kNsC1HgwMzato61qaky2k7CGGtgZIgZRiRZOmL b5geKeh9nRq1D94XwELilFtZKQtbPcv/VjmRR1ao3z+MUB/HjdO7mYBLgroHWNvI bHL1JyrEHpW5QIqszOvl+g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1771971966; x=1771979166; bh=b c9azlh/VG6ae6PkDsWsI4XhYvmFw1STenuoUYZ/MBs=; b=HkUvYZy25Jt1baGUe y+N7jaWMDyzl16a97dbnGlyoya0pq0RMyJWNFHRfeyGiahB1YCSgP2dZqyPBXnrj //JjdCMdIc1Gc80UI5/smG0EfUrXqxRxeIiGbpmdrQQu8kRhuf9vPWv5z47MKYf+ GBfMklXEPmTX9loCgJ9bLF4te9SL+L93IgIRkLPh4SoNrU2zkEX88jRLrOxTKGzf xl+01llOci5Br22sgxJUNpKZmsjd+Lcvu0f8qiOR2opMbJ/6nJMaKdYlVvgb3XVP MOTvzrs2DuS4LMiIYDmhIzBLDaOJCeVP5eJlfsqvs6GW9OzNYa1/Ye2qBq3UqI1B YXCjg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvgedufeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epgfevjeduvdeufeeileefteegudetheetffdtjeegvdfgtdetjeeihfeigeffffehnecu ffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpehnvghilhgssehofihnmhgrihhlrdhnvghtpdhnsggp rhgtphhtthhopedvvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepvhhirhhose iivghnihhvrdhlihhnuhigrdhorhhgrdhukhdprhgtphhtthhopehsvghlihhnuhigsehv ghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidquhhnihhonhhfsh esvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhsvggtuhhr ihhthidqmhhoughulhgvsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplh hinhhugidqnhhfshesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhn uhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlih hnuhigqdhfshguvghvvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohep mhhikhhlohhssehsiigvrhgvughirdhhuhdprhgtphhtthhopehjrggtkhesshhushgvrd gtii X-ME-Proxy: Feedback-ID: i9d664b8f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Feb 2026 17:26:00 -0500 (EST) From: NeilBrown To: Christian Brauner , Alexander Viro , David Howells , Jan Kara , Chuck Lever , Jeff Layton , Miklos Szeredi , Amir Goldstein , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Stephen Smalley , "Darrick J. Wong" Cc: linux-kernel@vger.kernel.org, netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-unionfs@vger.kernel.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, selinux@vger.kernel.org Subject: [PATCH v3 01/15] VFS: note error returns in documentation for various lookup functions Date: Wed, 25 Feb 2026 09:16:46 +1100 Message-ID: <20260224222542.3458677-2-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260224222542.3458677-1-neilb@ownmail.net> References: <20260224222542.3458677-1-neilb@ownmail.net> Reply-To: NeilBrown Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: NeilBrown Darrick recently noted that try_lookup_noperm() is documented as "Look up a dentry by name in the dcache, returning NULL if it does not currently exist." but it can in fact return an error. So update the documentation for that and related functions. Link: https://lore.kernel.org/all/20260218234917.GA6490@frogsfrogsfrogs/ Cc: "Darrick J. Wong" Signed-off-by: NeilBrown Reviewed-by: Jeff Layton --- fs/namei.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/fs/namei.c b/fs/namei.c index 58f715f7657e..6f595f58acfe 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3124,7 +3124,8 @@ static int lookup_one_common(struct mnt_idmap *idmap, * @base: base directory to lookup from * * Look up a dentry by name in the dcache, returning NULL if it does not - * currently exist. The function does not try to create a dentry and if o= ne + * currently exist or an error if there is a problem with the name. + * The function does not try to create a dentry and if one * is found it doesn't try to revalidate it. * * Note that this routine is purely a helper for filesystem usage and shou= ld @@ -3132,6 +3133,11 @@ static int lookup_one_common(struct mnt_idmap *idmap, * * No locks need be held - only a counted reference to @base is needed. * + * Returns: + * - ref-counted dentry on success, or + * - %NULL if name could not be found, or + * - ERR_PTR(-EACCES) if name is dot or dotdot or contains a slash or nu= l, or + * - ERR_PTR() if fs provide ->d_hash, and this returned an error. */ struct dentry *try_lookup_noperm(struct qstr *name, struct dentry *base) { @@ -3208,6 +3214,11 @@ EXPORT_SYMBOL(lookup_one); * * Unlike lookup_one, it should be called without the parent * i_rwsem held, and will take the i_rwsem itself if necessary. + * + * Returns: - A dentry, possibly negative, or + * - same errors as try_lookup_noperm() or + * - ERR_PTR(-ENOENT) if parent has been removed, or + * - ERR_PTR(-EACCES) if parent directory is not searchable. */ struct dentry *lookup_one_unlocked(struct mnt_idmap *idmap, struct qstr *n= ame, struct dentry *base) @@ -3244,6 +3255,10 @@ EXPORT_SYMBOL(lookup_one_unlocked); * It should be called without the parent i_rwsem held, and will take * the i_rwsem itself if necessary. If a fatal signal is pending or * delivered, it will return %-EINTR if the lock is needed. + * + * Returns: A dentry, possibly negative, or + * - same errors as lookup_one_unlocked() or + * - ERR_PTR(-EINTR) if a fatal signal is pending. */ struct dentry *lookup_one_positive_killable(struct mnt_idmap *idmap, struct qstr *name, @@ -3283,6 +3298,10 @@ EXPORT_SYMBOL(lookup_one_positive_killable); * This can be used for in-kernel filesystem clients such as file servers. * * The helper should be called without i_rwsem held. + * + * Returns: A positive dentry, or + * - ERR_PTR(-ENOENT) if the name could not be found, or + * - same errors as lookup_one_unlocked(). */ struct dentry *lookup_one_positive_unlocked(struct mnt_idmap *idmap, struct qstr *name, @@ -3311,6 +3330,10 @@ EXPORT_SYMBOL(lookup_one_positive_unlocked); * * Unlike try_lookup_noperm() it *does* revalidate the dentry if it already * existed. + * + * Returns: A dentry, possibly negative, or + * - ERR_PTR(-ENOENT) if parent has been removed, or + * - same errors as try_lookup_noperm() */ struct dentry *lookup_noperm_unlocked(struct qstr *name, struct dentry *ba= se) { @@ -3335,6 +3358,10 @@ EXPORT_SYMBOL(lookup_noperm_unlocked); * _can_ become positive at any time, so callers of lookup_noperm_unlocked= () * need to be very careful; pinned positives have ->d_inode stable, so * this one avoids such problems. + * + * Returns: A positive dentry, or + * - ERR_PTR(-ENOENT) if name cannot be found or parent has been remove= d, or + * - same errors as try_lookup_noperm() */ struct dentry *lookup_noperm_positive_unlocked(struct qstr *name, struct dentry *base) --=20 2.50.0.107.gf914562f5916.dirty From nobody Thu Apr 2 01:48:15 2026 Received: from flow-a2-smtp.messagingengine.com (flow-a2-smtp.messagingengine.com [103.168.172.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 580D233C1B7; Tue, 24 Feb 2026 22:26:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.137 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771971977; cv=none; b=DvzhyJkhBG/mX6utGdtL0AS6Y0uait3d9nSlrolq7SYAeSEqyxkSfvf8TOx5I8Tv4fqriazrzySFlFsvyYjwxtCq4sMSktXx+feedE2jyWh3DGleurZ8QsrnSWt632pa46eu2IdRHUMPgd+yg+/PZKTnCKn/WpqgxQPSPbB3nuI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771971977; c=relaxed/simple; bh=EWcvGbpStxBrKNDwCaNU/qsj2uNCtRG9uAAL8HCuTAg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bip3gv8WQem5c3lvMEn/40MftJVq/IcO5M2sIAOl4A8VUztDelGxXr56GppFtQhgizhUT/3BxwGGdyFrL7D4mzjg3mDI5PAn9r/kk1rkVrFyw/rHC+Vddr4EIQD2WXq3bndUmxsgMZGsldT0CPElxkOnAdq90s+/rihuvnh2Zdw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net; spf=pass smtp.mailfrom=ownmail.net; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b=GBOmuITS; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=ji6BHf6a; arc=none smtp.client-ip=103.168.172.137 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ownmail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b="GBOmuITS"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="ji6BHf6a" Received: from phl-compute-12.internal (phl-compute-12.internal [10.202.2.52]) by mailflow.phl.internal (Postfix) with ESMTP id C491D13802AD; Tue, 24 Feb 2026 17:26:15 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Tue, 24 Feb 2026 17:26:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ownmail.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to; s=fm3; t=1771971975; x=1771979175; bh=tPobfa0i3jHvv1Dk9y6zx4amsTjnJAZYw4PN6GvcHrM=; b= GBOmuITSxnJ0zBVJ+LVfhDX24n3oxRgOKWRz0aHEofjwaEv0YNuaedYRJ95TGwAd RYQ0aT8EVoXoOYakO8/SJ2QWzdzf7u9RtKyGUxl9eJcw7D1Y2mJuqRqvS+mDs3IE vFCaoptFxzMkHzPCRyvfBEDVLWYUU23dnKMYBiynw02k0CtWISG3guFyIgnirdm0 zddj8N+H7cLy+O0p+kmddNH+zBTC2lLY5rEDBYikyqtFC96vM36VCq75W4DxP1Na 55A99XpQYaomtAKsptlrssepaxWJir8G86kpidVKKJwfkmhmcSLYFBu2puzqK/aC C77yncxWTkVZ0GDj+n9gzA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1771971975; x=1771979175; bh=t Pobfa0i3jHvv1Dk9y6zx4amsTjnJAZYw4PN6GvcHrM=; b=ji6BHf6ag+iUvrc9d ti0YI3wi2DWW8jNzZyWp7fqtOBGrwcJIgaBqidIciiHfIEtCOFaH6DJYCy4IIZif 74JGqmMn+bl+bBLM0vZr0XYO2dIqdD6k76nSM+4861sB7clcrLOB5cqT0lOFTj0c hYFXQ1gWl3xdh0Z6fqItxNV6dXbtZ3qR1RqGoocQwZK6rfGYeHQvIs3yqZOELygu N3Z6eOT4BQUyyRkiTd0Y9m30UQz2N5PHzcm8YHhem1ZpTe0BAevq5afIN0Vdk2PU P7paQ1+yfyfGySjhJP/M0Jq2s20yQpxEC1+FfJTkEOVBnj3g7zTNX3UE8em8QAv+ X5vWA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvgedufeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddvpdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: i9d664b8f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Feb 2026 17:26:09 -0500 (EST) From: NeilBrown To: Christian Brauner , Alexander Viro , David Howells , Jan Kara , Chuck Lever , Jeff Layton , Miklos Szeredi , Amir Goldstein , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Stephen Smalley , "Darrick J. Wong" Cc: linux-kernel@vger.kernel.org, netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-unionfs@vger.kernel.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, selinux@vger.kernel.org Subject: [PATCH v3 02/15] fs/proc: Don't lock root inode when creating "self" and "thread-self" Date: Wed, 25 Feb 2026 09:16:47 +1100 Message-ID: <20260224222542.3458677-3-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260224222542.3458677-1-neilb@ownmail.net> References: <20260224222542.3458677-1-neilb@ownmail.net> Reply-To: NeilBrown Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: NeilBrown proc_setup_self() and proc_setup_thread_self() are only called from proc_fill_super() which is before the filesystem is "live". So there is no need to lock the root directory when adding "self" and "thread-self". This is clear from simple_fill_super() which provides similar functionality for other filesystems and does not lock anything. The locking is not harmful, except that it may be confusing to a reader. As part of an effort to centralise all locking for directories for name-based operations (prior to changing some locking rules), it is simplest to remove the locking here. Reviewed-by: Jeff Layton Signed-off-by: NeilBrown --- fs/proc/self.c | 3 --- fs/proc/thread_self.c | 3 --- 2 files changed, 6 deletions(-) diff --git a/fs/proc/self.c b/fs/proc/self.c index 62d2c0cfe35c..56adf1c68f7a 100644 --- a/fs/proc/self.c +++ b/fs/proc/self.c @@ -35,11 +35,9 @@ unsigned self_inum __ro_after_init; =20 int proc_setup_self(struct super_block *s) { - struct inode *root_inode =3D d_inode(s->s_root); struct dentry *self; int ret =3D -ENOMEM; =20 - inode_lock(root_inode); self =3D d_alloc_name(s->s_root, "self"); if (self) { struct inode *inode =3D new_inode(s); @@ -55,7 +53,6 @@ int proc_setup_self(struct super_block *s) } dput(self); } - inode_unlock(root_inode); =20 if (ret) pr_err("proc_fill_super: can't allocate /proc/self\n"); diff --git a/fs/proc/thread_self.c b/fs/proc/thread_self.c index d6113dbe58e0..61ac62c3fd9f 100644 --- a/fs/proc/thread_self.c +++ b/fs/proc/thread_self.c @@ -35,11 +35,9 @@ unsigned thread_self_inum __ro_after_init; =20 int proc_setup_thread_self(struct super_block *s) { - struct inode *root_inode =3D d_inode(s->s_root); struct dentry *thread_self; int ret =3D -ENOMEM; =20 - inode_lock(root_inode); thread_self =3D d_alloc_name(s->s_root, "thread-self"); if (thread_self) { struct inode *inode =3D new_inode(s); @@ -55,7 +53,6 @@ int proc_setup_thread_self(struct super_block *s) } dput(thread_self); } - inode_unlock(root_inode); =20 if (ret) pr_err("proc_fill_super: can't allocate /proc/thread-self\n"); --=20 2.50.0.107.gf914562f5916.dirty From nobody Thu Apr 2 01:48:15 2026 Received: from flow-a2-smtp.messagingengine.com (flow-a2-smtp.messagingengine.com [103.168.172.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60F7833A9C4; Tue, 24 Feb 2026 22:26:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.137 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771971985; cv=none; b=AvifmwYx6oAzvSEh/hXR+WmKYsJNjruHiJpuVNOjV7PYXJNGb5oy3sr1Rh+niI6KKHDr0qSdiDJCDOnr3xFOe/EEDgSUojL+cHZm2aGUsQ7zRABfq5DiWybD/x9jdNI/0pvQKt11Zsim8PwfuPZ0WxoewOrG4sCPmsINI/G9AhE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771971985; c=relaxed/simple; bh=OIzbQUjzzrfzG2AR3C+81QVfuL+PWhXQpta3pAbRqyc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=f3H42quSDLgd0zY4okNCfe3H0tipcmY/OqR6knwpujgKlS1m2cW+dWsvkGtmBNuIiLTMAxRbvkDqUQqC7ezGEk7BlHXuUvHksqsKAVPGKm6xJg7HQVanAVlromGT4ygFV1SPsw/EJQFU32PMIVcWFW4cILXjbUZ0h2/jqQhqdIU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net; spf=pass smtp.mailfrom=ownmail.net; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b=evYF/qXJ; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=cdt6E8pE; arc=none smtp.client-ip=103.168.172.137 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ownmail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b="evYF/qXJ"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="cdt6E8pE" Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailflow.phl.internal (Postfix) with ESMTP id CF4A5138052C; Tue, 24 Feb 2026 17:26:23 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Tue, 24 Feb 2026 17:26:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ownmail.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to; s=fm3; t=1771971983; x=1771979183; bh=5Q3jCmGh6Jb3Gjy9NudY+872UTbORvggbK9OGnafF7A=; b= evYF/qXJrvbeSkmRxelWl90RX65c2IF72hU1n9xzwLX5JwSjdqGtNZf7C599IiwF DV6SR/d2JC8EWNogO4lOFIT0zYJzecAlRYPtbRahrqqX0hbO7E+7CJBklCGQpnus WBWqvWkr8VXvuBv8rtjdGTHJF7X//bOLk4bVwBacItg3Kk1jGpihXHUhp1gw9TZq zRxl0pQEI9IvRqhkB9HoOyQsY114IiInFx32YbcnlMPURtG1pNuSDso9JFDjf/6F MvqUvSWgiZYZYIIQeUoKa7yBJGqaH7Sj03Qm+5k6mOfFJCEPNxaF9iW+35cHa/bV 4WJT703PWIcSNjsiCbJXMw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1771971983; x=1771979183; bh=5 Q3jCmGh6Jb3Gjy9NudY+872UTbORvggbK9OGnafF7A=; b=cdt6E8pER3vWa0h8n gL13z5rBUmIu4c3dgieu76uILJFzG9DnB8Ly77oleUrTRkVUJcuQR6+Kr/XcFy5F i+B5XEFYG2zocYYwODjd9zLhMklvpvYJYYJ9hok9Ralaoyq8LLukxcs1QLygHaDP AYIBX0XHwm28nQVHC6OEo5BYc8R/VZq8vcb34dWeQTlhpIc1WMqBeyWZwTBcRbuT 31dxRddY4vrQJaTa/msdTOTl7YD/Cz6MrLaPR9xqxgGJcEicklbMP8iMlDtEC0ly B7TElwxykmAHtX9XuhAunOfj+8ttr6QmTXpliit0q1+5Tw17Wv+bYk52AxTZxBVK IUp5g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvgedufeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddvpdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: i9d664b8f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Feb 2026 17:26:17 -0500 (EST) From: NeilBrown To: Christian Brauner , Alexander Viro , David Howells , Jan Kara , Chuck Lever , Jeff Layton , Miklos Szeredi , Amir Goldstein , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Stephen Smalley , "Darrick J. Wong" Cc: linux-kernel@vger.kernel.org, netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-unionfs@vger.kernel.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, selinux@vger.kernel.org Subject: [PATCH v3 03/15] VFS: move the start_dirop() kerndoc comment to before start_dirop() Date: Wed, 25 Feb 2026 09:16:48 +1100 Message-ID: <20260224222542.3458677-4-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260224222542.3458677-1-neilb@ownmail.net> References: <20260224222542.3458677-1-neilb@ownmail.net> Reply-To: NeilBrown Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: NeilBrown This kerneldoc comment was always meant for start_dirop(), not for __start_dirop() which is a static function and doesn't need documentation. It was in the wrong place and was then incorrectly renamed (instead of moved) and useless "documentation" was added for "@state" was provided. This patch reverts the name, removes the mention of @state, and moves the comment to where it belongs. Reviewed-by: Jeff Layton Signed-off-by: NeilBrown --- fs/namei.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 6f595f58acfe..11c9a4a6c396 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2893,20 +2893,6 @@ static int filename_parentat(int dfd, struct filenam= e *name, return __filename_parentat(dfd, name, flags, parent, last, type, NULL); } =20 -/** - * __start_dirop - begin a create or remove dirop, performing locking and = lookup - * @parent: the dentry of the parent in which the operation will occ= ur - * @name: a qstr holding the name within that parent - * @lookup_flags: intent and other lookup flags. - * @state: task state bitmask - * - * The lookup is performed and necessary locks are taken so that, on succe= ss, - * the returned dentry can be operated on safely. - * The qstr must already have the hash value calculated. - * - * Returns: a locked dentry, or an error. - * - */ static struct dentry *__start_dirop(struct dentry *parent, struct qstr *na= me, unsigned int lookup_flags, unsigned int state) @@ -2928,6 +2914,19 @@ static struct dentry *__start_dirop(struct dentry *p= arent, struct qstr *name, return dentry; } =20 +/** + * start_dirop - begin a create or remove dirop, performing locking and lo= okup + * @parent: the dentry of the parent in which the operation will occ= ur + * @name: a qstr holding the name within that parent + * @lookup_flags: intent and other lookup flags. + * + * The lookup is performed and necessary locks are taken so that, on succe= ss, + * the returned dentry can be operated on safely. + * The qstr must already have the hash value calculated. + * + * Returns: a locked dentry, or an error. + * + */ struct dentry *start_dirop(struct dentry *parent, struct qstr *name, unsigned int lookup_flags) { --=20 2.50.0.107.gf914562f5916.dirty From nobody Thu Apr 2 01:48:15 2026 Received: from flow-a2-smtp.messagingengine.com (flow-a2-smtp.messagingengine.com [103.168.172.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB162344D81; Tue, 24 Feb 2026 22:26:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.137 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771971993; cv=none; b=N56z02hPB2S7edaFV0G8aCtdYwSvwN1EobTd5UZjXY4o5UZgKrce2KIZnsz44aTLx5wHDMGPbu0WfTdQzCFWX1dxsL46v0eumlcmtNnM6EBCR9siLQHeY8HXpfCzKZ+eRanrmEroyH5RiJ3w9DZyRu/7oa82hiWkA80Q4rvJqow= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771971993; c=relaxed/simple; bh=KuROo3JMGIM8j5aDxLYEHHUTuMsukyM2SLM5WpxIkqk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mf/2dhBtWXRHYdFyyqpE8PO1LPgKZV1EEiLr2GksTNtmI0hzKB+cnAIRrz7jqIf1ppHx/i3iGMMFUQ+Ez0nuhBtCpXFuctERymDV7W1SOUC1B84a4RL72Z+fMtg+6dNw8GSdApPZNK9RBuE9kvxi4PGcTiovbbyTl0T1Dn661Zo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net; spf=pass smtp.mailfrom=ownmail.net; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b=Ai/u2HwO; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Xu6mjPIb; arc=none smtp.client-ip=103.168.172.137 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ownmail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b="Ai/u2HwO"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Xu6mjPIb" Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailflow.phl.internal (Postfix) with ESMTP id 2E8AE138052C; Tue, 24 Feb 2026 17:26:32 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Tue, 24 Feb 2026 17:26:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ownmail.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to; s=fm3; t=1771971992; x=1771979192; bh=tmfYUs18u0P/igCXZvtuab+4hhfHHoKRLjZ+0PQIG4w=; b= Ai/u2HwOUqLnIdnD5V+zLmPuoVjGNlXD81MbBpc7z1PHgBnvG7Ymiv5m5uaDlWWF +lwJuPiWhG61HCuVeSHHnx68u+fv1Wf8TRz72p9gjCtj3Yvjw7gPJ9zGQY8x7nW8 3l/8dt9BukfR6xWzkBOtVA4MQ2PqWTN9extp92bo+Lk6uhrpZOzSDX/yiSGJGiyi PawVsXiKoGfeUBHEkYFXJRQbGeFOEXOLwjMpbgH20/TuYwzYWasq97Q7lVwDPkTK L2mylnq8p/nTHbxmHJVQXmbG2Pidy1W2D4mBDtZ79LzPIf6Tvy2F9CoaGxJwKyVD iLijKtdtSWM9wzQwAxDKFg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1771971992; x=1771979192; bh=t mfYUs18u0P/igCXZvtuab+4hhfHHoKRLjZ+0PQIG4w=; b=Xu6mjPIbk6OseLsUO EpB+RqSqof1NkfiLM6333Bf2X97bTET8Gs/4CVyrC/czTP5h3fWkqxyH9/1tD3XY Ly/BsVT+XWkn33C9vbBzkfVJ4CwyOhl3RXGGAe3WI+mJb/fEgozhC83BgwDkwfbq a7nRqRlJ9RV5oPjJy/ON3ZjIgumjMADOc4j51bZx1tpocRT+jmqTp0GAYuv7QxNA grxI0eRebNu5eR0Z+KC3uKRwJNNIyHceODx/eTPoMCBiV+Fe1HAUaUIgmgs5qQNQ mqTrpNHci+3lh9w18ISkVPVLHojbFeB1BvlS0rqOqI4o3hhBFWLbUnCoVtitD7HR YMRrQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvgedufeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddvpdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: i9d664b8f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Feb 2026 17:26:25 -0500 (EST) From: NeilBrown To: Christian Brauner , Alexander Viro , David Howells , Jan Kara , Chuck Lever , Jeff Layton , Miklos Szeredi , Amir Goldstein , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Stephen Smalley , "Darrick J. Wong" Cc: linux-kernel@vger.kernel.org, netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-unionfs@vger.kernel.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, selinux@vger.kernel.org Subject: [PATCH v3 04/15] libfs: change simple_done_creating() to use end_creating() Date: Wed, 25 Feb 2026 09:16:49 +1100 Message-ID: <20260224222542.3458677-5-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260224222542.3458677-1-neilb@ownmail.net> References: <20260224222542.3458677-1-neilb@ownmail.net> Reply-To: NeilBrown Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: NeilBrown simple_done_creating() and end_creating() are identical. So change the former to use the latter. This further centralises unlocking of directories. Signed-off-by: NeilBrown Reviewed-by: Jeff Layton --- fs/libfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/libfs.c b/fs/libfs.c index 74134ba2e8d1..63b4fb082435 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -2318,7 +2318,6 @@ EXPORT_SYMBOL(simple_start_creating); /* parent must have been held exclusive since simple_start_creating() */ void simple_done_creating(struct dentry *child) { - inode_unlock(child->d_parent->d_inode); - dput(child); + end_creating(child); } EXPORT_SYMBOL(simple_done_creating); --=20 2.50.0.107.gf914562f5916.dirty From nobody Thu Apr 2 01:48:15 2026 Received: from flow-a2-smtp.messagingengine.com (flow-a2-smtp.messagingengine.com [103.168.172.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22CEE33A9ED; Tue, 24 Feb 2026 22:26:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.137 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771972003; cv=none; b=sApitzGbrKvdFpiXLHAjJbrjpoqEP7Z/9slaJHJHq03OY4obDZ1MHj8IgzjYrhwNWJE/defycYuNrwFOgYE+pBsSVa+9CdDlsCOgqsE6mKZWsAuOmC5dVhQzPtAxWblpYAzeayUwzc/4uqzBsculOzq1SYa3fpOuneHtci17wBU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771972003; c=relaxed/simple; bh=vlxskyEUB0dnx8Tl8FcZiAX25ptet1IjxeqP5VrcfUI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bjd+kaJGAQBhqwxtrrjMz731qA4XT8wwK1PyglA9wdR6z6OZMN3bZEC4RWFU4LI3IF7/V0LoSr3QraZgmXeZeK21qBSsHTqi4+xTtJ4Vv5JCxH8XTjO6aiop/I/UQ3Fbf/P7lcJbWvBxN+UaMsbxcJ4zI7NaGccAV2DD6cfCzm4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net; spf=pass smtp.mailfrom=ownmail.net; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b=IeWHMqZU; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=FEopHGyM; arc=none smtp.client-ip=103.168.172.137 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ownmail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b="IeWHMqZU"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="FEopHGyM" Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailflow.phl.internal (Postfix) with ESMTP id 64C88138052C; Tue, 24 Feb 2026 17:26:40 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Tue, 24 Feb 2026 17:26:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ownmail.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to; s=fm3; t=1771972000; x=1771979200; bh=O4F49usif+OP5XD8k3JzmeUE/gWUb/ClWD4S6e21APM=; b= IeWHMqZUGKoTBpMl0ugzK4xq2wS2PMSDjK0GEN0Q+DNcwjSPaIHOd2yEa1OrwTzG jQeK5X7QjA7FP4gDPXtMprXzD2WJeH8bhZqR2Vbu+LSkyV/r+imfLlu7LqMmu7ic 9UWOx0p6NT6Y9CbrBjRJrisPY6Q7wOmS67lNk18gM4bCbCSLj9s6BXmFausJ6woa cJNEbMriw4/1F0upRMHXvvmusWCUu+Svdkrw6JwxqaJOzbBSTDR/zbX5okaVIvWG R4RrvoFvvZVl85xInOWS58mwYY4uuQSY91VY6A/3wTHm4sYLVlGx/pnBnVinp7/T FyBYSB57KKfOdfbQKHq/Ng== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1771972000; x=1771979200; bh=O 4F49usif+OP5XD8k3JzmeUE/gWUb/ClWD4S6e21APM=; b=FEopHGyM2D1CKq+4X 3g8EZ/fUrIzIWNiOT/hQKgHo13UiqDf5cNt2a1T1TFDP4iNPL5LbL1sQ8K5KNNR9 SAQdGlUl1sKge1hy3rJPPuahT5RcHC8MHbkKr/4QPL6EeLyQIzkvEqlqu+MODhK+ 43NwebESY/CvhG6XFqibBLTxRPaJ7oSyG4n5pQ0TA1CZP/YRhFnWq+LpqC4zxlHX rvTi6Yj4K90oxCEy86PDl2mCI7ZdRlbkPwmvUb1re0IW3iWIOcRIgchYsY9R86jX jnUnjp4/JI76ceU/1XqJdPelX8clNEf3ca94saSjeUhZkRlzEZD7cowTd0e7ICb9 mUkmg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvgedufeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddvpdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: i9d664b8f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Feb 2026 17:26:34 -0500 (EST) From: NeilBrown To: Christian Brauner , Alexander Viro , David Howells , Jan Kara , Chuck Lever , Jeff Layton , Miklos Szeredi , Amir Goldstein , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Stephen Smalley , "Darrick J. Wong" Cc: linux-kernel@vger.kernel.org, netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-unionfs@vger.kernel.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, selinux@vger.kernel.org Subject: [PATCH v3 05/15] Apparmor: Use simple_start_creating() / simple_done_creating() Date: Wed, 25 Feb 2026 09:16:50 +1100 Message-ID: <20260224222542.3458677-6-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260224222542.3458677-1-neilb@ownmail.net> References: <20260224222542.3458677-1-neilb@ownmail.net> Reply-To: NeilBrown Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: NeilBrown Instead of explicitly locking the parent and performing a look up in apparmor, use simple_start_creating(), and then simple_done_creating() to unlock and drop the dentry. This removes the need to check for an existing entry (as simple_start_creating() acts like an exclusive create and can return -EEXIST), simplifies error paths, and keeps dir locking code centralised. Reviewed-by: Jeff Layton Signed-off-by: NeilBrown --- security/apparmor/apparmorfs.c | 35 ++++++++-------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c index 2f84bd23edb6..f93c4f31d02a 100644 --- a/security/apparmor/apparmorfs.c +++ b/security/apparmor/apparmorfs.c @@ -282,32 +282,20 @@ static struct dentry *aafs_create(const char *name, u= mode_t mode, =20 dir =3D d_inode(parent); =20 - inode_lock(dir); - dentry =3D lookup_noperm(&QSTR(name), parent); + dentry =3D simple_start_creating(parent, name); if (IS_ERR(dentry)) { error =3D PTR_ERR(dentry); - goto fail_lock; - } - - if (d_really_is_positive(dentry)) { - error =3D -EEXIST; - goto fail_dentry; + goto fail; } =20 error =3D __aafs_setup_d_inode(dir, dentry, mode, data, link, fops, iops); + simple_done_creating(dentry); if (error) - goto fail_dentry; - inode_unlock(dir); - + goto fail; return dentry; =20 -fail_dentry: - dput(dentry); - -fail_lock: - inode_unlock(dir); +fail: simple_release_fs(&aafs_mnt, &aafs_count); - return ERR_PTR(error); } =20 @@ -2585,8 +2573,7 @@ static int aa_mk_null_file(struct dentry *parent) if (error) return error; =20 - inode_lock(d_inode(parent)); - dentry =3D lookup_noperm(&QSTR(NULL_FILE_NAME), parent); + dentry =3D simple_start_creating(parent, NULL_FILE_NAME); if (IS_ERR(dentry)) { error =3D PTR_ERR(dentry); goto out; @@ -2594,7 +2581,7 @@ static int aa_mk_null_file(struct dentry *parent) inode =3D new_inode(parent->d_inode->i_sb); if (!inode) { error =3D -ENOMEM; - goto out1; + goto out; } =20 inode->i_ino =3D get_next_ino(); @@ -2606,18 +2593,12 @@ static int aa_mk_null_file(struct dentry *parent) aa_null.dentry =3D dget(dentry); aa_null.mnt =3D mntget(mount); =20 - error =3D 0; - -out1: - dput(dentry); out: - inode_unlock(d_inode(parent)); + simple_done_creating(dentry); simple_release_fs(&mount, &count); return error; } =20 - - static const char *policy_get_link(struct dentry *dentry, struct inode *inode, struct delayed_call *done) --=20 2.50.0.107.gf914562f5916.dirty From nobody Thu Apr 2 01:48:15 2026 Received: from flow-a2-smtp.messagingengine.com (flow-a2-smtp.messagingengine.com [103.168.172.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46E20344D98; Tue, 24 Feb 2026 22:26:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.137 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771972011; cv=none; b=aOMVrgqLWNa3a3tUvUemUo/8qClE0iWea/A/t3kGvTBEJwKAOAI/1klxusjz4/EZ5bUm9o11kY1ZYRrCMTXyYthgcf8R/aRv8fB8RKOSmDpl1pZiAAj8Vt5ELqc4YMQij3cUxXxRzIufo47qNGNa4GhgQJlF4NxQxiuezENjRaU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771972011; c=relaxed/simple; bh=XdH95tiFrQ/sKORHCrxucIV+VvmedwyPT7NUDj0XhsU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oqPUMAB+4JkJZCfM00MZSr1yOa41JG5pDnk/V78xqHZo04clQ63LX3n/4ZDbDb4mw6pX6hGRjIbXc3gdUVvAXgJk+bbeiFVYgFoIvgwQ4OkcDSjcEc/Y1eepTWmlI1veGvB0iAZRUwFJikwGPTqNRLaylbe+KNYMfJri39RxAZw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net; spf=pass smtp.mailfrom=ownmail.net; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b=Dxxendxg; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=fW+7qVBm; arc=none smtp.client-ip=103.168.172.137 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ownmail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b="Dxxendxg"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="fW+7qVBm" Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailflow.phl.internal (Postfix) with ESMTP id A3CA213805A6; Tue, 24 Feb 2026 17:26:48 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Tue, 24 Feb 2026 17:26:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ownmail.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to; s=fm3; t=1771972008; x=1771979208; bh=uXMU6tWLxH62oiHRDx59UoQh2FcFUEj9XaKWMgxDywE=; b= DxxendxgyK6rTiqG/fxumh1kOC6ytof4U4niPIav51NX7ee/mCUy0bU+TUm+/0Mm rFj2T38yPbTdz9PP3+zc+ovcdQXWWs/Dd5/r2DA0CLQy6p4a6DvvBx6FDbv+CVXL uDjQuYQvf5ea1y9rg2MrEzKlaEEZCht9eSHlLCMx3AkrdMwxU+aN7fBkpoek9xTR 4PVF+NCj1EPeG7h/0P9DsB77rKWQnnchfa7OErS6boEFK0f1NfQAD+lrFjz9Asgc HrAkn3QmXAQteBcAckwenqh5ufmzzshcWB1aKTyHJ+xzE4IHeYTh/CIvXHa9CGg3 3gAB0KwqmPs7v3X3LpnZBA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1771972008; x=1771979208; bh=u XMU6tWLxH62oiHRDx59UoQh2FcFUEj9XaKWMgxDywE=; b=fW+7qVBmtWMZCbjyx hnRlX0IaoiA7RThWcfCR03kI9XQ2zX8Khs3d/poMc4rqnMGdv1tfcfF6tWtGGgJ1 duI9rVPkdEpp/HjFy/BXyhblmTBTS5ML+2s9HqJ/S1RathJXRQP4FKvtpM/KTLsT 8c4FAq5J2neZoaWMwkcEetoH1+FfPadcHWq+L0E0IBNjkulXWQSJJi0+NbKBQXF4 Yyzhasq874CLbWLTM6lr47KRLYE51Ru9oVY4i4rIDpZFr28ntAjnC+zFAiqonBAh m7WOlInrlEOnf99F0tljLcn3JbSLPx73PnRrj6toPcnwq8rhagPp7ttw+bvyvLyl Luvdw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvgedufeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddvpdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: i9d664b8f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Feb 2026 17:26:42 -0500 (EST) From: NeilBrown To: Christian Brauner , Alexander Viro , David Howells , Jan Kara , Chuck Lever , Jeff Layton , Miklos Szeredi , Amir Goldstein , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Stephen Smalley , "Darrick J. Wong" Cc: linux-kernel@vger.kernel.org, netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-unionfs@vger.kernel.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, selinux@vger.kernel.org Subject: [PATCH v3 06/15] selinux: Use simple_start_creating() / simple_done_creating() Date: Wed, 25 Feb 2026 09:16:51 +1100 Message-ID: <20260224222542.3458677-7-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260224222542.3458677-1-neilb@ownmail.net> References: <20260224222542.3458677-1-neilb@ownmail.net> Reply-To: NeilBrown Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: NeilBrown Instead of explicitly locking the parent and performing a lookup in selinux, use simple_start_creating(), and then use simple_done_creating() to unlock. This extends the region that the directory is locked for, and also performs a lookup. The lock extension is of no real consequence. The lookup uses simple_lookup() and so always succeeds. Thus when d_make_persistent() is called the dentry will already be hashed. d_make_persistent() handles this case. Reviewed-by: Jeff Layton Acked-by: Paul Moore Signed-off-by: NeilBrown --- security/selinux/selinuxfs.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index 3245cc531555..83aa765a09f9 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c @@ -1931,27 +1931,26 @@ static const struct inode_operations swapover_dir_i= node_operations =3D { static struct dentry *sel_make_swapover_dir(struct super_block *sb, unsigned long *ino) { - struct dentry *dentry =3D d_alloc_name(sb->s_root, ".swapover"); + struct dentry *dentry; struct inode *inode; =20 - if (!dentry) - return ERR_PTR(-ENOMEM); - inode =3D sel_make_inode(sb, S_IFDIR); - if (!inode) { - dput(dentry); + if (!inode) return ERR_PTR(-ENOMEM); + + dentry =3D simple_start_creating(sb->s_root, ".swapover"); + if (IS_ERR(dentry)) { + iput(inode); + return dentry; } =20 inode->i_op =3D &swapover_dir_inode_operations; inode->i_ino =3D ++(*ino); /* directory inodes start off with i_nlink =3D=3D 2 (for "." entry) */ inc_nlink(inode); - inode_lock(sb->s_root->d_inode); d_make_persistent(dentry, inode); inc_nlink(sb->s_root->d_inode); - inode_unlock(sb->s_root->d_inode); - dput(dentry); + simple_done_creating(dentry); return dentry; // borrowed } =20 --=20 2.50.0.107.gf914562f5916.dirty From nobody Thu Apr 2 01:48:15 2026 Received: from flow-a2-smtp.messagingengine.com (flow-a2-smtp.messagingengine.com [103.168.172.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 609093451B5; Tue, 24 Feb 2026 22:26:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.137 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771972018; cv=none; b=oPro89XsMTi3V/pUVQ9WjVxxqVnMv6NjGRI5r9mcl5B9EbXdzNkoynScPI1YQllIAxVcecKU572H5Yuu2AtI4k/lkmaqj2bLmGDui/W9AENy9S4mJQidwaebHXX3fVRmd92PwvoVhHkK6L6Y3ghFPqfI+mrQ9iRJNNAXNrtQeQI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771972018; c=relaxed/simple; bh=KfiYIcpQGDA7CCeuR5+khe3o6J1hGjpGeg4/kbtzg8U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ipyhC6/49v4rGh2RsN/8N8IiE8bxHbUA1im6QHgh5pSeoE6nhzDMGtRaV968hE6aplfSp2I2k2dlAHXwfuT2X8ePQA+xPNhqDVNk2Uo5lx1r4Q9Ak2AiQcvV+E5djWy6MEmCfPF54tptcHrtttutfRQWZc7/opkepG3/oNxDMq4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net; spf=pass smtp.mailfrom=ownmail.net; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b=NtFrFE2Q; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=FPYcK4wA; arc=none smtp.client-ip=103.168.172.137 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ownmail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b="NtFrFE2Q"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="FPYcK4wA" Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailflow.phl.internal (Postfix) with ESMTP id C3727138052C; Tue, 24 Feb 2026 17:26:56 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Tue, 24 Feb 2026 17:26:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ownmail.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to; s=fm3; t=1771972016; x=1771979216; bh=rVzESsgVzPWBQDwiGwCUvziOL/TfwILm1t61in7kI2M=; b= NtFrFE2QVE+2ipr34uM+dRqKe3r3yLSuEPRUk+aYDIljPIYgY7ZfqwUFuXqzCNJo tVXrahJnvkYjxPmVezqczcfaQYbpJhcyl04KBH+2H0E7QqUVchPu2hRjiWq7IxPi qkZDpnBPu95f/t5XllvkNWBvsN7JXzRieMeUXTwYOabIQcgkhtdy1CgxqlIIGury LnqOLWomEzWCkMmHxbLdDEWt/RGB0c5usWNRAGGsUzrXFAzKIOZPIztMP2GOEpW8 hcqidRHW+zWmSepLdUYcRMUbEbfzBZ80bY8Zr5n+P/kpBw5S7zzNSV/Kp3rDEOhB m2VQONs9b+WZxEApQ+Dk8g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1771972016; x=1771979216; bh=r VzESsgVzPWBQDwiGwCUvziOL/TfwILm1t61in7kI2M=; b=FPYcK4wAdpHOQpMy0 MDzN3mz8EVFuGNUjJhfFtFZd7hs8sHCL2JfMdhQ/xvOGleGZNmojqwUwBmoicAEf IpsbcDoIyJGAD+O2yuLEYwZ8b0Xk5Lqir7PTlRPpFF+XHbB5m07n+BzYSWW0+cfQ +7OEjYAEFuHw3wEtaROVsFegYjCrMtEExbYuGopVGmTSfJN0MCaYTIk/1JrefPA/ qUKJNwAN1+f2qwDSDUhhhpu1WwXmj75W2O7ZogP/vIdQaP6gkcRJdvWUTexZdHf/ 1ZcCoqE70b+ixg7cEwY4Z6fLOwPNoYL3XCbKl4yXdOil49B5Kk1KwB0xtssZCYpE 6foog== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvgedufeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddvpdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: i9d664b8f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Feb 2026 17:26:50 -0500 (EST) From: NeilBrown To: Christian Brauner , Alexander Viro , David Howells , Jan Kara , Chuck Lever , Jeff Layton , Miklos Szeredi , Amir Goldstein , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Stephen Smalley , "Darrick J. Wong" Cc: linux-kernel@vger.kernel.org, netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-unionfs@vger.kernel.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, selinux@vger.kernel.org Subject: [PATCH v3 07/15] nfsd: switch purge_old() to use start_removing_noperm() Date: Wed, 25 Feb 2026 09:16:52 +1100 Message-ID: <20260224222542.3458677-8-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260224222542.3458677-1-neilb@ownmail.net> References: <20260224222542.3458677-1-neilb@ownmail.net> Reply-To: NeilBrown Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: NeilBrown Rather than explicit locking, use the start_removing_noperm() and end_removing() wrappers. This was not done with other start_removing changes due to conflicting in-flight patches. Reviewed-by: Jeff Layton Signed-off-by: NeilBrown --- fs/nfsd/nfs4recover.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c index b4bf85f96f6e..b338473d6e52 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c @@ -352,16 +352,14 @@ purge_old(struct dentry *parent, char *cname, struct = nfsd_net *nn) if (nfs4_has_reclaimed_state(name, nn)) goto out_free; =20 - inode_lock_nested(d_inode(parent), I_MUTEX_PARENT); - child =3D lookup_one(&nop_mnt_idmap, &QSTR(cname), parent); + child =3D start_removing_noperm(parent, &QSTR(cname)); if (!IS_ERR(child)) { status =3D vfs_rmdir(&nop_mnt_idmap, d_inode(parent), child, NULL); if (status) printk("failed to remove client recovery directory %pd\n", child); - dput(child); } - inode_unlock(d_inode(parent)); + end_removing(child); =20 out_free: kfree(name.data); --=20 2.50.0.107.gf914562f5916.dirty From nobody Thu Apr 2 01:48:15 2026 Received: from flow-a2-smtp.messagingengine.com (flow-a2-smtp.messagingengine.com [103.168.172.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9DFD43446DA; Tue, 24 Feb 2026 22:27:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.137 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771972026; cv=none; b=I0XRHzS7Q6D1GP6GNuadocXqIFYJJVGVa8LrXV0cV4OWRnqfnxwwhbAdhPbyhrZ10R03JElMa3iweNO7Anqj//WGPlppsnO6MJxmp/6+aG9Q//VLVG7RPDWmEBJNHI49PpHfVjhKItmTrQ6ZUZ/vb6727id9t2m5ae6UqiAHRmE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771972026; c=relaxed/simple; bh=ojKvC9TV5lLHEchjVZ+jGT9aO+3WC+YXqxZ4cm0jL2U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ttc4ydse/K4/nTlDQJpJBzWaDgqHp0txvS0yw1NC/u+d0AfqRxR7wZGBaLE7CprWvyeioMmtSH1M1COenCr3G1Y/JBcaR1YkS5Qn8czFpZs/qCsaKU6jOXXVvTW4UjGRqkHw+6Dzf5vQf47Tl0yGtXxyTHZWjwBKie3yDINhEdg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net; spf=pass smtp.mailfrom=ownmail.net; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b=DHCrV62+; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=S4SHo91X; arc=none smtp.client-ip=103.168.172.137 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ownmail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b="DHCrV62+"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="S4SHo91X" Received: from phl-compute-07.internal (phl-compute-07.internal [10.202.2.47]) by mailflow.phl.internal (Postfix) with ESMTP id 1883D138052C; Tue, 24 Feb 2026 17:27:05 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-07.internal (MEProxy); Tue, 24 Feb 2026 17:27:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ownmail.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to; s=fm3; t=1771972025; x=1771979225; bh=7mZv59/XBHyrbXM2e8385B3rlZeYZjJwl/wrmf7v+4o=; b= DHCrV62+FVQSKKY9oPA5I9UMEE9pC/8WEvW9kUHBtA3frmmP/cPBf0zd6bJbIqbC vN5knIKY45dLrV5XJHCjsfef/l9dWsv86b5HD6hgOTiUThfLND+2pic44c6BUycP jXtyYZfcm7lGlO64UbkAq2ExoRXoKUuQlEWQn0+ZMzy6eIXv5O8G5fQ5z1xyZIV7 8uQLN9ckPvBNjC9O3XaYvG+R9Mfn/pPZ2eh/4nfsLBB0/xGbcH09yL3qW+uTTNFe k9DTNOyKWyS2VWdTrAIqNPKPwGhj5dNQi0vWyZ0rjK1xZuOZCnCWfEHMF0a0/yr4 28g4CInm6Bzvmd4QsW7rJQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1771972025; x=1771979225; bh=7 mZv59/XBHyrbXM2e8385B3rlZeYZjJwl/wrmf7v+4o=; b=S4SHo91XvY7j79cy/ WD7j/EIok8aqeOa0BdQBWd3+PAk0+opZiEQ0fmdJ/s48/8lo6yX2834cVkUmQR7l ajXFnqoFYiOed1A6cXIDwMYnkUueynatL3IWxytkEqRWL8GixYl5+bkFhAohu42r g/5Yr/YbCPOUUyCb7OMB2znUuY6eFTLcT9mXNgtJZ93LMl73N1enpxu94/2f87U9 yI5AXgorYVBZwJtgIuYDfX+zTelz5ydj/xW1HHRgU75QPK0m7elj2A27UDDGauT0 K4iql0+Z59N7bNch+sMKIjepH5qgV12o9TlaBvg4J76NH41YOV+cH3YyBf5J/0eD P9UaQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvgedufeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddvpdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: i9d664b8f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Feb 2026 17:26:58 -0500 (EST) From: NeilBrown To: Christian Brauner , Alexander Viro , David Howells , Jan Kara , Chuck Lever , Jeff Layton , Miklos Szeredi , Amir Goldstein , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Stephen Smalley , "Darrick J. Wong" Cc: linux-kernel@vger.kernel.org, netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-unionfs@vger.kernel.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, selinux@vger.kernel.org Subject: [PATCH v3 08/15] VFS: make lookup_one_qstr_excl() static. Date: Wed, 25 Feb 2026 09:16:53 +1100 Message-ID: <20260224222542.3458677-9-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260224222542.3458677-1-neilb@ownmail.net> References: <20260224222542.3458677-1-neilb@ownmail.net> Reply-To: NeilBrown Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: NeilBrown lookup_one_qstr_excl() is no longer used outside of namei.c, so make it static. Reviewed-by: Jeff Layton Signed-off-by: NeilBrown --- Documentation/filesystems/porting.rst | 7 +++++++ fs/namei.c | 5 ++--- include/linux/namei.h | 3 --- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Documentation/filesystems/porting.rst b/Documentation/filesyst= ems/porting.rst index 52ff1d19405b..1dd31ab417a2 100644 --- a/Documentation/filesystems/porting.rst +++ b/Documentation/filesystems/porting.rst @@ -1361,3 +1361,10 @@ to match what strlen() would return if it was ran on= the string. =20 However, if the string is freely accessible for the duration of inode's lifetime, consider using inode_set_cached_link() instead. + +--- + +**mandatory** + +lookup_one_qstr_excl() is no longer exported - use start_creating() or +similar. diff --git a/fs/namei.c b/fs/namei.c index 11c9a4a6c396..a5daa62399d7 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1782,8 +1782,8 @@ static struct dentry *lookup_dcache(const struct qstr= *name, * Will return -ENOENT if name isn't found and LOOKUP_CREATE wasn't passed. * Will return -EEXIST if name is found and LOOKUP_EXCL was passed. */ -struct dentry *lookup_one_qstr_excl(const struct qstr *name, - struct dentry *base, unsigned int flags) +static struct dentry *lookup_one_qstr_excl(const struct qstr *name, + struct dentry *base, unsigned int flags) { struct dentry *dentry; struct dentry *old; @@ -1820,7 +1820,6 @@ struct dentry *lookup_one_qstr_excl(const struct qstr= *name, } return dentry; } -EXPORT_SYMBOL(lookup_one_qstr_excl); =20 /** * lookup_fast - do fast lockless (but racy) lookup of a dentry diff --git a/include/linux/namei.h b/include/linux/namei.h index 58600cf234bc..c7a7288cdd25 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h @@ -54,9 +54,6 @@ extern int path_pts(struct path *path); =20 extern int user_path_at(int, const char __user *, unsigned, struct path *); =20 -struct dentry *lookup_one_qstr_excl(const struct qstr *name, - struct dentry *base, - unsigned int flags); extern int kern_path(const char *, unsigned, struct path *); struct dentry *kern_path_parent(const char *name, struct path *parent); =20 --=20 2.50.0.107.gf914562f5916.dirty From nobody Thu Apr 2 01:48:15 2026 Received: from flow-a2-smtp.messagingengine.com (flow-a2-smtp.messagingengine.com [103.168.172.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1098344DA5; Tue, 24 Feb 2026 22:27:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.137 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771972035; cv=none; b=icoxPuurzL1U0HDwrLekVqkzJ2K8xwAppf94DqqajYg4czuXsiYOoEyfJWS4Wp7zh/FGo9BnzdcOTsdvgo3yP/qRw+53PorjP19Yhbpn8cevz56y/rYeeHwkywEs+N+oMnY1HnLi1kFwkN4tCI6scLBTOBGIS7Tzq99WKPQm93A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771972035; c=relaxed/simple; bh=C5XGhxzXvy6Mo0q6KYiYOqWKvpBY4Hkc7vhmgZMdIks=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X7XO3/lmi8v+3meusTGOT/OOx3LWECvrjqc52esRANAHwyqm76ne8SU3F9bUaIE/6H18hbLbOmaxTJuV5fUUjIfnA8l+rZmR/lJ/mXuUd/WQDSL3pQyNMM8I7Mylheso7G1PM8GcOnWOjJHPk4+EDw9FD/BuGq5fhAcfIJfwu30= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net; spf=pass smtp.mailfrom=ownmail.net; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b=E4VKyLrB; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=ninVMiSe; arc=none smtp.client-ip=103.168.172.137 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ownmail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b="E4VKyLrB"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="ninVMiSe" Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailflow.phl.internal (Postfix) with ESMTP id 42B0D138052C; Tue, 24 Feb 2026 17:27:13 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Tue, 24 Feb 2026 17:27:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ownmail.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to; s=fm3; t=1771972033; x=1771979233; bh=2jTTlW9RZgdA98OhmzS3Zb4kiDI7eopW2MuhMcIKiog=; b= E4VKyLrBtcvWb+ODOPq2rc6tFxLCMK8m26Ih5MitN6DWndAAHwui2T9PD+3sjVL/ B3aJXBbn1RxehizMelPZSPiEGWA2FDGSPKfspQ+pQ1/pLQEY2CKcP1IXh8lYDfJP bLpqZ80kotSCmvWb0y8EkAInZrWx8NQ6sIEC6tzNVSvla/GCVbI8MlLH9e0OOFiL OKDTC7MfIQaXpsrvAP2Xbwgt0TtB4PzI+5fjNaOlq8lYKdKw3ZjmxYfCuG+V+QYT 9bbVcddgBaCe280l282lSsl33IPfYKnUdZ7923+CM+hZYKISNy6WIJwr94jXCVmf aQ6vtGsnxRZn9MyQxb86kA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1771972033; x=1771979233; bh=2 jTTlW9RZgdA98OhmzS3Zb4kiDI7eopW2MuhMcIKiog=; b=ninVMiSehwVBOUDCe zLwwgL9e+RdytBF5LKwUjdzgugEI93NT+RPXLtWlc/l1fWltKXxibgCKHsCD2qO9 Ko3/Pj2bzdSXZGgb12i+/D7Pb7ga+5w9U8chL5R9bZ+q9ByRdKCcVpNR7FUYUAEA X7xwowMF7ZiwLXFMfo3m5gZRLpdJHGWuPgm9hQeRtpmvXFnO0PltsfcUoVo4jraq AsLc1SinKbM6hM55DqdvtiWfuBrXB9lsDAPKBMyBrkn+x3MfPr+GRpDO4fkqBDKK io5ROcckvfoQGJjEPPvfcsiyg4WZ9PS8T5qt4TcnG1T6yJZ7ozovR6GHbHEb2jAD X71rA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvgedufeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgepfeenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddvpdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: i9d664b8f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Feb 2026 17:27:07 -0500 (EST) From: NeilBrown To: Christian Brauner , Alexander Viro , David Howells , Jan Kara , Chuck Lever , Jeff Layton , Miklos Szeredi , Amir Goldstein , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Stephen Smalley , "Darrick J. Wong" Cc: linux-kernel@vger.kernel.org, netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-unionfs@vger.kernel.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, selinux@vger.kernel.org Subject: [PATCH v3 09/15] ovl: Simplify ovl_lookup_real_one() Date: Wed, 25 Feb 2026 09:16:54 +1100 Message-ID: <20260224222542.3458677-10-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260224222542.3458677-1-neilb@ownmail.net> References: <20260224222542.3458677-1-neilb@ownmail.net> Reply-To: NeilBrown Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: NeilBrown The primary purpose of this patch is to remove the locking from ovl_lookup_real_one() as part of centralising all locking of directories for name operations. The locking here isn't needed. By performing consistency tests after the lookup we can be sure that the result of the lookup was valid at least for a moment, which is all the original code promised. lookup_noperm_unlocked() is used for the lookup and it will take the lock if needed only where it is needed. Also: - don't take a reference to real->d_parent. The parent is only use for a pointer comparison, and no reference is needed for that. - Several "if" statements have a "goto" followed by "else" - the else isn't needed: the following statement can directly follow the "if" as a new statement - Use a consistent pattern of setting "err" before performing a test and possibly going to "fail". - remove the "out" label (now that we don't need to dput(parent) or unlock) and simply return from fail:. Reviewed-by: Jeff Layton Reviewed-by: Amir Goldstein Signed-off-by: NeilBrown --- fs/overlayfs/export.c | 71 ++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 38 deletions(-) diff --git a/fs/overlayfs/export.c b/fs/overlayfs/export.c index 83f80fdb1567..896f2e9af2e2 100644 --- a/fs/overlayfs/export.c +++ b/fs/overlayfs/export.c @@ -349,69 +349,64 @@ static struct dentry *ovl_dentry_real_at(struct dentr= y *dentry, int idx) return NULL; } =20 -/* - * Lookup a child overlay dentry to get a connected overlay dentry whose r= eal - * dentry is @real. If @real is on upper layer, we lookup a child overlay - * dentry with the same name as the real dentry. Otherwise, we need to con= sult - * index for lookup. +/** + * ovl_lookup_real_one - Lookup a child overlay dentry to get an overlay = dentry whose real dentry is given + * @connected: parent overlay dentry + * @real: given child real dentry + * @layer: layer in which @real exists + * + * + * Lookup a child overlay dentry in @connected with the same name as the @= real + * dentry. Then check that the parent of the result is the real dentry for + * @connected, and @real is the real dentry for the result. + * + * Returns: + * %-ECHILD if the parent of @real is no longer the real dentry for @con= nected. + * %-ESTALE if @real is not the real dentry of the found dentry. + * Otherwise the found dentry is returned. */ static struct dentry *ovl_lookup_real_one(struct dentry *connected, struct dentry *real, const struct ovl_layer *layer) { - struct inode *dir =3D d_inode(connected); - struct dentry *this, *parent =3D NULL; + struct dentry *this; struct name_snapshot name; int err; =20 /* - * Lookup child overlay dentry by real name. The dir mutex protects us - * from racing with overlay rename. If the overlay dentry that is above - * real has already been moved to a parent that is not under the - * connected overlay dir, we return -ECHILD and restart the lookup of - * connected real path from the top. - */ - inode_lock_nested(dir, I_MUTEX_PARENT); - err =3D -ECHILD; - parent =3D dget_parent(real); - if (ovl_dentry_real_at(connected, layer->idx) !=3D parent) - goto fail; - - /* - * We also need to take a snapshot of real dentry name to protect us + * We need to take a snapshot of real dentry name to protect us * from racing with underlying layer rename. In this case, we don't * care about returning ESTALE, only from dereferencing a free name * pointer because we hold no lock on the real dentry. */ take_dentry_name_snapshot(&name, real); - /* - * No idmap handling here: it's an internal lookup. - */ - this =3D lookup_noperm(&name.name, connected); + this =3D lookup_noperm_unlocked(&name.name, connected); release_dentry_name_snapshot(&name); + + err =3D -ECHILD; + if (ovl_dentry_real_at(connected, layer->idx) !=3D real->d_parent) + goto fail; + err =3D PTR_ERR(this); - if (IS_ERR(this)) { + if (IS_ERR(this)) goto fail; - } else if (!this || !this->d_inode) { - dput(this); - err =3D -ENOENT; + + err =3D -ENOENT; + if (!this || !this->d_inode) goto fail; - } else if (ovl_dentry_real_at(this, layer->idx) !=3D real) { - dput(this); - err =3D -ESTALE; + + err =3D -ESTALE; + if (ovl_dentry_real_at(this, layer->idx) !=3D real) goto fail; - } =20 -out: - dput(parent); - inode_unlock(dir); return this; =20 fail: pr_warn_ratelimited("failed to lookup one by real (%pd2, layer=3D%d, conn= ected=3D%pd2, err=3D%i)\n", real, layer->idx, connected, err); - this =3D ERR_PTR(err); - goto out; + if (!IS_ERR(this)) + dput(this); + return ERR_PTR(err); } =20 static struct dentry *ovl_lookup_real(struct super_block *sb, --=20 2.50.0.107.gf914562f5916.dirty From nobody Thu Apr 2 01:48:15 2026 Received: from flow-a2-smtp.messagingengine.com (flow-a2-smtp.messagingengine.com [103.168.172.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2276E33A9C4; Tue, 24 Feb 2026 22:27:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.137 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771972043; cv=none; b=LMeJOWpIk9NLCmQReAvdYpwLyc5kQ18rv+2I4vGRhm7QiptuZ6jYlW0soJHoDYG2jVemhexdWCpBmJSpKlWc33Q7iltStLdY2X6gFqUF0u2HTasJJxYZ8tPLhaSbZaCxw31WMwPrHunD1A/qrOfAxLhQA3csVAVKofT7pssRADQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771972043; c=relaxed/simple; bh=jlJ9DWdOy/WeR7QWrpmvr1QyEtCF9bsrk1spWZE7J5Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=untUMevZ59suF8PyoHFpRwbo8ntR+sQjtFS096TSnpm4J2mkw8kPVR3EUQcCMeajZ9mI21ajnw8LqiQXwWD4krUPHM/Qwey7fWon5GlJKlNVo5ugGCwf4Se99bFuUC08ZDaGXx12YnKgmeVZsR3P9wTsENcnw51v7CeqVdURZKE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net; spf=pass smtp.mailfrom=ownmail.net; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b=ac7NN+mS; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=jypiJw/C; arc=none smtp.client-ip=103.168.172.137 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ownmail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b="ac7NN+mS"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="jypiJw/C" Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailflow.phl.internal (Postfix) with ESMTP id 916FE138052C; Tue, 24 Feb 2026 17:27:21 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Tue, 24 Feb 2026 17:27:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ownmail.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to; s=fm3; t=1771972041; x=1771979241; bh=Vj23dTx8hYfvjWUpL8KmWQGYvEI277aBCAy+9LFoa/c=; b= ac7NN+mS0EFDNPiwo8c907vK2y43OM8r/UqvyTneeok+wx5FRLRj5S5ME/gTb2q9 rOgeRuvFPd/YBkvTtgtIN9g/YNVSthdjHTXH1CXV4m1hCjK2Ih0x5hr/wBQsri9D sv35ybqI2JJz9bjbVtyPYGgAfwZ0oLGDA/1bP2KBODyCemS4m3YiJtZc2t2RGjRc J95k8sMNiltNfqtINj6Yfv7ap9xGF2QpmDPtheE5p/9BArMglMMWU6GBq0loiVW/ yp4K0D9rx9U4BAMPc79xwJUtT1SKg6jvviHif7GIVhdRyEBRcVEVoBOIhbTLDxN2 ORt0tzWprp366sHlIq7m3A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1771972041; x=1771979241; bh=V j23dTx8hYfvjWUpL8KmWQGYvEI277aBCAy+9LFoa/c=; b=jypiJw/CZ95Rcl/y3 0NqKjvCvJ5capr659QfzFe+Lx3zRg9R5LmtT22t1tLEbomCDyDfquLkNXSxHMr6+ 7GgORgvf4WHNEZN7WLZTE07hyB+GSX+/2kZyxzduA8zY9jh4l9QLDaeObtOTr/Ti XPWLoYkNG/q26UVRUxGUbVwEu3NZr3YIjsZE1Yyo58UJGjhVrp4d+3R6XhsrQOJC R86kYOmWCwp8xTD15fGfk53eYxGpnLHCcAELQPwWrGg2R9rN0RHFVkmhFHgPN3Ji XKZ9N5qE5kjzNcz4aIXyoVi12aoHadXqz0oCGd7V3sQhIc6FZt0Au3IRQX5NoCWI oKZDA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvgedufeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddvpdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: i9d664b8f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Feb 2026 17:27:15 -0500 (EST) From: NeilBrown To: Christian Brauner , Alexander Viro , David Howells , Jan Kara , Chuck Lever , Jeff Layton , Miklos Szeredi , Amir Goldstein , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Stephen Smalley , "Darrick J. Wong" Cc: linux-kernel@vger.kernel.org, netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-unionfs@vger.kernel.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, selinux@vger.kernel.org Subject: [PATCH v3 10/15] cachefiles: change cachefiles_bury_object to use start_renaming_dentry() Date: Wed, 25 Feb 2026 09:16:55 +1100 Message-ID: <20260224222542.3458677-11-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260224222542.3458677-1-neilb@ownmail.net> References: <20260224222542.3458677-1-neilb@ownmail.net> Reply-To: NeilBrown Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: NeilBrown Rather then using lock_rename() and lookup_one() etc we can use the new start_renaming_dentry(). This is part of centralising dir locking and lookup so that locking rules can be changed. Some error check are removed as not necessary. Checks for rep being a non-dir or IS_DEADDIR and the check that ->graveyard is still a directory only provide slightly more informative errors and have been dropped. Reviewed-by: Jeff Layton Signed-off-by: NeilBrown --- fs/cachefiles/namei.c | 76 ++++++++----------------------------------- 1 file changed, 14 insertions(+), 62 deletions(-) diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index e5ec90dccc27..3af42ec78411 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c @@ -270,7 +270,8 @@ int cachefiles_bury_object(struct cachefiles_cache *cac= he, struct dentry *rep, enum fscache_why_object_killed why) { - struct dentry *grave, *trap; + struct dentry *grave; + struct renamedata rd =3D {}; struct path path, path_to_graveyard; char nbuffer[8 + 8 + 1]; int ret; @@ -302,77 +303,36 @@ int cachefiles_bury_object(struct cachefiles_cache *c= ache, (uint32_t) ktime_get_real_seconds(), (uint32_t) atomic_inc_return(&cache->gravecounter)); =20 - /* do the multiway lock magic */ - trap =3D lock_rename(cache->graveyard, dir); - if (IS_ERR(trap)) - return PTR_ERR(trap); - - /* do some checks before getting the grave dentry */ - if (rep->d_parent !=3D dir || IS_DEADDIR(d_inode(rep))) { - /* the entry was probably culled when we dropped the parent dir - * lock */ - unlock_rename(cache->graveyard, dir); - _leave(" =3D 0 [culled?]"); - return 0; - } - - if (!d_can_lookup(cache->graveyard)) { - unlock_rename(cache->graveyard, dir); - cachefiles_io_error(cache, "Graveyard no longer a directory"); - return -EIO; - } - - if (trap =3D=3D rep) { - unlock_rename(cache->graveyard, dir); - cachefiles_io_error(cache, "May not make directory loop"); + rd.mnt_idmap =3D &nop_mnt_idmap; + rd.old_parent =3D dir; + rd.new_parent =3D cache->graveyard; + rd.flags =3D 0; + ret =3D start_renaming_dentry(&rd, 0, rep, &QSTR(nbuffer)); + if (ret) { + cachefiles_io_error(cache, "Cannot lock/lookup in graveyard"); return -EIO; } =20 if (d_mountpoint(rep)) { - unlock_rename(cache->graveyard, dir); + end_renaming(&rd); cachefiles_io_error(cache, "Mountpoint in cache"); return -EIO; } =20 - grave =3D lookup_one(&nop_mnt_idmap, &QSTR(nbuffer), cache->graveyard); - if (IS_ERR(grave)) { - unlock_rename(cache->graveyard, dir); - trace_cachefiles_vfs_error(object, d_inode(cache->graveyard), - PTR_ERR(grave), - cachefiles_trace_lookup_error); - - if (PTR_ERR(grave) =3D=3D -ENOMEM) { - _leave(" =3D -ENOMEM"); - return -ENOMEM; - } - - cachefiles_io_error(cache, "Lookup error %ld", PTR_ERR(grave)); - return -EIO; - } - + grave =3D rd.new_dentry; if (d_is_positive(grave)) { - unlock_rename(cache->graveyard, dir); - dput(grave); + end_renaming(&rd); grave =3D NULL; cond_resched(); goto try_again; } =20 if (d_mountpoint(grave)) { - unlock_rename(cache->graveyard, dir); - dput(grave); + end_renaming(&rd); cachefiles_io_error(cache, "Mountpoint in graveyard"); return -EIO; } =20 - /* target should not be an ancestor of source */ - if (trap =3D=3D grave) { - unlock_rename(cache->graveyard, dir); - dput(grave); - cachefiles_io_error(cache, "May not make directory loop"); - return -EIO; - } - /* attempt the rename */ path.mnt =3D cache->mnt; path.dentry =3D dir; @@ -382,13 +342,6 @@ int cachefiles_bury_object(struct cachefiles_cache *ca= che, if (ret < 0) { cachefiles_io_error(cache, "Rename security error %d", ret); } else { - struct renamedata rd =3D { - .mnt_idmap =3D &nop_mnt_idmap, - .old_parent =3D dir, - .old_dentry =3D rep, - .new_parent =3D cache->graveyard, - .new_dentry =3D grave, - }; trace_cachefiles_rename(object, d_inode(rep)->i_ino, why); ret =3D cachefiles_inject_read_error(); if (ret =3D=3D 0) @@ -402,8 +355,7 @@ int cachefiles_bury_object(struct cachefiles_cache *cac= he, } =20 __cachefiles_unmark_inode_in_use(object, d_inode(rep)); - unlock_rename(cache->graveyard, dir); - dput(grave); + end_renaming(&rd); _leave(" =3D 0"); return 0; } --=20 2.50.0.107.gf914562f5916.dirty From nobody Thu Apr 2 01:48:15 2026 Received: from flow-a2-smtp.messagingengine.com (flow-a2-smtp.messagingengine.com [103.168.172.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 646A13446DA; Tue, 24 Feb 2026 22:27:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.137 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771972051; cv=none; b=R4iSJY9qst7zKN7R1s3jf4DMjl/va1fciR8X2O/ftw46ZcCIBQlouUm6OfF+UTOmUnUe/6AJym8XwV1PNQawGIWnsKQ8meGYarsBnXraDSdkvt/3LzMCnchGZsVMk4GbQSiAFY+a6UNquKuGvS5pLNVQXWoxf2slDTgoD3WlePM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771972051; c=relaxed/simple; bh=Ud6UMjR5slj5om3VuWv4NgZ/iI9BwzOPv899jPc7cKM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ANyRdaCpMkhxU40M1Ry115RFFcBuPVo+0dd2g0DnqbGFbEYWFx97TTvqQG1TOPxONFBixWul2Tev+Y0A9txAnWxN5CdNX3lL2UxO2AsH9f5KR95vOsjdKiDuS8JJgg81M+lcOPdizgLWi9rZTPz15WH5OdFrWnen8ikL3uWn3Ro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net; spf=pass smtp.mailfrom=ownmail.net; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b=NebVhl4U; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Fdd69+d/; arc=none smtp.client-ip=103.168.172.137 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ownmail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b="NebVhl4U"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Fdd69+d/" Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailflow.phl.internal (Postfix) with ESMTP id B446513805A6; Tue, 24 Feb 2026 17:27:29 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Tue, 24 Feb 2026 17:27:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ownmail.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to; s=fm3; t=1771972049; x=1771979249; bh=vIMZKjfxmKkyu011y6KfL+N7g881UsmJU+U6+HLmMTM=; b= NebVhl4Uf0rQN6394D508zLVskPRA5kGJQqYtRAomfY3tJEG/4rasGHfTSOQlFW2 WYW6BfxyHAvW/qQwxEumP0R5MCvRDhPpu9AQXj2AnNolzy3Ns4w3Qp4xuHt4rp8Q I06NaoDbmb7beCZ9P9gbf43WiOocoR91ywAFr4d6z/a2T71UrVG06faOxckf5MUE qsAxeIDt9S3qbq24h6OpAhKXm73qOHK6fW3hmyqPZ7aRN06ZuUJ6kegrpCuQQyjy 1eFPRLI2Ipo+3CDUNp6upNbj/utD+G2SfrT48EEPjRhkeZnMwAa756C5B/8Nj1y2 XJM81OYuELL69EX+3EAzFw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1771972049; x=1771979249; bh=v IMZKjfxmKkyu011y6KfL+N7g881UsmJU+U6+HLmMTM=; b=Fdd69+d/T013npC8h 52Nt0SQ4HswdfJ5xjrIYiPjnQ2MDsau2C5CUT14zXzgT0dq8pXaGGo7Fhp17T7TB 6yYDrW9oIFE0QRMnBsDBlea/pmF7yOrJ/VzKxmAAURgQafKsfdWaGuZ/CwWVfO97 tHZewOpTmP0m9Ar0XChtj6RLLPf8GZEQ58EuHWdzZiIIqeY2E6k2NfyCdKVU4DHJ WfgxLcrxIU/nf0FvAcHwfexPQ0PTmrIX9LUb7Ldx/D4lFZGGORySIU8+6dYO1dfq 2zpbyhjoFF5S5jsiEWBywRGPd74v8ISQr9eEeJC8nP/DmZtDPtO6xcHVU1DXIlwG J4ivw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvgedufeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgepgeenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddvpdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: i9d664b8f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Feb 2026 17:27:23 -0500 (EST) From: NeilBrown To: Christian Brauner , Alexander Viro , David Howells , Jan Kara , Chuck Lever , Jeff Layton , Miklos Szeredi , Amir Goldstein , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Stephen Smalley , "Darrick J. Wong" Cc: linux-kernel@vger.kernel.org, netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-unionfs@vger.kernel.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, selinux@vger.kernel.org Subject: [PATCH v3 11/15] ovl: pass name buffer to ovl_start_creating_temp() Date: Wed, 25 Feb 2026 09:16:56 +1100 Message-ID: <20260224222542.3458677-12-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260224222542.3458677-1-neilb@ownmail.net> References: <20260224222542.3458677-1-neilb@ownmail.net> Reply-To: NeilBrown Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: NeilBrown Now ovl_start_creating_temp() is passed a buffer in which to store the temp name. This will be useful in a future patch were ovl_create_real() will need access to that name. Reviewed-by: Amir Goldstein Signed-off-by: NeilBrown --- fs/overlayfs/dir.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c index ff3dbd1ca61f..c4feb89ad1e3 100644 --- a/fs/overlayfs/dir.c +++ b/fs/overlayfs/dir.c @@ -66,10 +66,9 @@ void ovl_tempname(char name[OVL_TEMPNAME_SIZE]) } =20 static struct dentry *ovl_start_creating_temp(struct ovl_fs *ofs, - struct dentry *workdir) + struct dentry *workdir, + char name[OVL_TEMPNAME_SIZE]) { - char name[OVL_TEMPNAME_SIZE]; - ovl_tempname(name); return start_creating(ovl_upper_mnt_idmap(ofs), workdir, &QSTR(name)); @@ -81,11 +80,12 @@ static struct dentry *ovl_whiteout(struct ovl_fs *ofs) struct dentry *whiteout, *link; struct dentry *workdir =3D ofs->workdir; struct inode *wdir =3D workdir->d_inode; + char name[OVL_TEMPNAME_SIZE]; =20 guard(mutex)(&ofs->whiteout_lock); =20 if (!ofs->whiteout) { - whiteout =3D ovl_start_creating_temp(ofs, workdir); + whiteout =3D ovl_start_creating_temp(ofs, workdir, name); if (IS_ERR(whiteout)) return whiteout; err =3D ovl_do_whiteout(ofs, wdir, whiteout); @@ -97,7 +97,7 @@ static struct dentry *ovl_whiteout(struct ovl_fs *ofs) } =20 if (!ofs->no_shared_whiteout) { - link =3D ovl_start_creating_temp(ofs, workdir); + link =3D ovl_start_creating_temp(ofs, workdir, name); if (IS_ERR(link)) return link; err =3D ovl_do_link(ofs, ofs->whiteout, wdir, link); @@ -247,7 +247,9 @@ struct dentry *ovl_create_temp(struct ovl_fs *ofs, stru= ct dentry *workdir, struct ovl_cattr *attr) { struct dentry *ret; - ret =3D ovl_start_creating_temp(ofs, workdir); + char name[OVL_TEMPNAME_SIZE]; + + ret =3D ovl_start_creating_temp(ofs, workdir, name); if (IS_ERR(ret)) return ret; ret =3D ovl_create_real(ofs, workdir, ret, attr); --=20 2.50.0.107.gf914562f5916.dirty From nobody Thu Apr 2 01:48:15 2026 Received: from flow-a2-smtp.messagingengine.com (flow-a2-smtp.messagingengine.com [103.168.172.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 030C4330641; Tue, 24 Feb 2026 22:27:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.137 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771972060; cv=none; b=ly5urAeoSmYz3h2s10TgTy7zAOVKXjeuLFARkNNaNhx6E6eja7ywo+nQhczX9VI9sxun20SfO4VI9Z4QET/1qtUD3KQUdwrJU1tDP2NuEPSv16usd4Eq055DT/MqoRO6EtDb+jvtoItR05evSXshJTtLNPv62jbyJFQy4G1AXGY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771972060; c=relaxed/simple; bh=xM7SAoZXwXzQ5TEGYKXSSmvOr/UxYWiOr0Yv0fzVzrQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UbkaiLadrzLj+SyZZELwC9wEo3DfIRDIlrtOfjq4/U6GBu57fMAKdKUt/Zq9S4hjrdlx8dNq+uz4V9n16ndOU3/XHaM9VP0HnFu+9iyGxQz8Ov0HFd4Bc8s1oU93GFniJvAlzQKExwVyj2FICG6bE4MrcJfXsf3dnqjP4FpJzkQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net; spf=pass smtp.mailfrom=ownmail.net; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b=KAE+Cx8K; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=TOUwpW+T; arc=none smtp.client-ip=103.168.172.137 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ownmail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b="KAE+Cx8K"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="TOUwpW+T" Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailflow.phl.internal (Postfix) with ESMTP id 52966138052C; Tue, 24 Feb 2026 17:27:38 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Tue, 24 Feb 2026 17:27:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ownmail.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to; s=fm3; t=1771972058; x=1771979258; bh=+n/TdNDWt0YGfbs3tUCUsBBqqY8Ht+jCITPiyVgI6RU=; b= KAE+Cx8KQQbP885GNTbuAul7FA9qjVN7lT8hINyLuxP9Qg0MObojudF5zU7fzTSV R6PcHD8qNIftJq+qt0KpO/PyawHBxnCxjiP2cGcDWMezbjsuYX4T0J4E+cM0Aj+0 XyiKCjtpqjMCcJksd+WG+LVyrJwXYqbCKglNoV5kB0yHO7yvvo/g7zJTw9wcF1US kICdc4KjC7m5q8QJRvnIQKHK+osKj2jLfC85q9lt/iXDRVTX619EomNjJz+aKcGe HGVDofOSCtj7ifgDW+WuRG/b1LPlLNA7C5/NgDiFu8UxNr+QvfiOtsEzXZsYhaVN cnQEXsb0q5LJV9aENuJPdQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1771972058; x=1771979258; bh=+ n/TdNDWt0YGfbs3tUCUsBBqqY8Ht+jCITPiyVgI6RU=; b=TOUwpW+T4OdE92Y2P 2tnlKVavGx6kUdGEzSgdSQf13DXhfLnDXhBDe+XndeX8jVp3iM5MJbL4U2iJocoK nBBrVH3hF9gjBPpIyZig+IQpLOsWiyVS72zfBfsM0JmwcFt1SywrFNserBJR+fFX SZY41v1zFZWSiR+pVz/bpLtH7NrT8W0tYRKfeetkqesJHXpGRBsD5qYAjsDZV34M TsMqfxz5f6CpB7wZnewmutz+8eT5tXaEIwuy5gqJS/msxbaW2FB5qWVyPTLar0bC akZin1PFpK0cYraooH71uUUxsGNeAMXoHePhg3sVIDFdXsP2VUEtUE0uAQYCd4PT WuCMg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvgedufeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddvpdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: i9d664b8f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Feb 2026 17:27:31 -0500 (EST) From: NeilBrown To: Christian Brauner , Alexander Viro , David Howells , Jan Kara , Chuck Lever , Jeff Layton , Miklos Szeredi , Amir Goldstein , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Stephen Smalley , "Darrick J. Wong" Cc: linux-kernel@vger.kernel.org, netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-unionfs@vger.kernel.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, selinux@vger.kernel.org Subject: [PATCH v3 12/15] ovl: change ovl_create_real() to get a new lock when re-opening created file. Date: Wed, 25 Feb 2026 09:16:57 +1100 Message-ID: <20260224222542.3458677-13-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260224222542.3458677-1-neilb@ownmail.net> References: <20260224222542.3458677-1-neilb@ownmail.net> Reply-To: NeilBrown Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: NeilBrown When ovl_create_real() is used to create a file on the upper filesystem it needs to return the resulting dentry - positive and hashed. It is usually the case the that dentry passed to the create function (e.g. vfs_create()) will be suitable but this is not guaranteed. The filesystem may unhash that dentry forcing a repeat lookup next time the name is wanted. So ovl_create_real() must be (and is) aware of this and prepared to perform that lookup to get a hash positive dentry. This is currently done under that same directory lock that provided exclusion for the create. Proposed changes to locking will make this not possible - as the name, rather than the directory, will be locked. The new APIs provided for lookup and locking do not and cannot support this pattern. The lock isn't needed. ovl_create_real() can drop the lock and then get a new lock for the lookup - then check that the lookup returned the correct inode. In a well-behaved configuration where the upper filesystem is not being modified by a third party, this will always work reliably, and if there are separate modification it will fail cleanly. So change ovl_create_real() to drop the lock and call ovl_start_creating_upper() to find the correct dentry. Note that start_creating doesn't fail if the name already exists. The lookup previously used the name from newdentry which was guaranteed to be stable because the parent directory was locked. As we now drop the lock we lose that guarantee. As newdentry is unhashed it is unlikely for the name to change, but safest not to depend on that. So the expected name is now passed in to ovl_create_real() and that is used. This removes the only remaining use of ovl_lookup_upper, so it is removed. Reviewed-by: Amir Goldstein Signed-off-by: NeilBrown --- fs/overlayfs/dir.c | 37 +++++++++++++++++++++++++------------ fs/overlayfs/overlayfs.h | 8 +------- fs/overlayfs/super.c | 1 + 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c index c4feb89ad1e3..8c0a3d876fef 100644 --- a/fs/overlayfs/dir.c +++ b/fs/overlayfs/dir.c @@ -159,7 +159,8 @@ int ovl_cleanup_and_whiteout(struct ovl_fs *ofs, struct= dentry *dir, } =20 struct dentry *ovl_create_real(struct ovl_fs *ofs, struct dentry *parent, - struct dentry *newdentry, struct ovl_cattr *attr) + struct dentry *newdentry, struct qstr *qname, + struct ovl_cattr *attr) { struct inode *dir =3D parent->d_inode; int err; @@ -221,19 +222,30 @@ struct dentry *ovl_create_real(struct ovl_fs *ofs, st= ruct dentry *parent, struct dentry *d; /* * Some filesystems (i.e. casefolded) may return an unhashed - * negative dentry from the ovl_lookup_upper() call before + * negative dentry from the ovl_start_creating_upper() call before * ovl_create_real(). * In that case, lookup again after making the newdentry * positive, so ovl_create_upper() always returns a hashed - * positive dentry. + * positive dentry. We lookup using qname which should be + * the same name as newentry, but is certain not to change. + * As we have to drop the lock before the lookup a race + * could result in a lookup failure. In that case we return + * an error. */ - d =3D ovl_lookup_upper(ofs, newdentry->d_name.name, parent, - newdentry->d_name.len); - dput(newdentry); - if (IS_ERR_OR_NULL(d)) + end_creating_keep(newdentry); + d =3D ovl_start_creating_upper(ofs, parent, qname); + + if (IS_ERR_OR_NULL(d)) { err =3D d ? PTR_ERR(d) : -ENOENT; - else + } else if (d->d_inode !=3D newdentry->d_inode) { + err =3D -EIO; + } else { + dput(newdentry); return d; + } + end_creating(d); + dput(newdentry); + return ERR_PTR(err); } out: if (err) { @@ -252,7 +264,7 @@ struct dentry *ovl_create_temp(struct ovl_fs *ofs, stru= ct dentry *workdir, ret =3D ovl_start_creating_temp(ofs, workdir, name); if (IS_ERR(ret)) return ret; - ret =3D ovl_create_real(ofs, workdir, ret, attr); + ret =3D ovl_create_real(ofs, workdir, ret, &QSTR(name), attr); return end_creating_keep(ret); } =20 @@ -352,14 +364,15 @@ static int ovl_create_upper(struct dentry *dentry, st= ruct inode *inode, struct ovl_fs *ofs =3D OVL_FS(dentry->d_sb); struct dentry *upperdir =3D ovl_dentry_upper(dentry->d_parent); struct dentry *newdentry; + struct qstr qname =3D QSTR_LEN(dentry->d_name.name, + dentry->d_name.len); int err; =20 newdentry =3D ovl_start_creating_upper(ofs, upperdir, - &QSTR_LEN(dentry->d_name.name, - dentry->d_name.len)); + &qname); if (IS_ERR(newdentry)) return PTR_ERR(newdentry); - newdentry =3D ovl_create_real(ofs, upperdir, newdentry, attr); + newdentry =3D ovl_create_real(ofs, upperdir, newdentry, &qname, attr); if (IS_ERR(newdentry)) return PTR_ERR(newdentry); =20 diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h index cad2055ebf18..714a1cec3709 100644 --- a/fs/overlayfs/overlayfs.h +++ b/fs/overlayfs/overlayfs.h @@ -406,13 +406,6 @@ static inline struct file *ovl_do_tmpfile(struct ovl_f= s *ofs, return file; } =20 -static inline struct dentry *ovl_lookup_upper(struct ovl_fs *ofs, - const char *name, - struct dentry *base, int len) -{ - return lookup_one(ovl_upper_mnt_idmap(ofs), &QSTR_LEN(name, len), base); -} - static inline struct dentry *ovl_lookup_upper_unlocked(struct ovl_fs *ofs, const char *name, struct dentry *base, @@ -888,6 +881,7 @@ struct ovl_cattr { =20 struct dentry *ovl_create_real(struct ovl_fs *ofs, struct dentry *parent, struct dentry *newdentry, + struct qstr *qname, struct ovl_cattr *attr); int ovl_cleanup(struct ovl_fs *ofs, struct dentry *workdir, struct dentry = *dentry); #define OVL_TEMPNAME_SIZE 20 diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index d4c12feec039..109643930b9f 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -634,6 +634,7 @@ static struct dentry *ovl_lookup_or_create(struct ovl_f= s *ofs, if (!IS_ERR(child)) { if (!child->d_inode) child =3D ovl_create_real(ofs, parent, child, + &QSTR(name), OVL_CATTR(mode)); end_creating_keep(child); } --=20 2.50.0.107.gf914562f5916.dirty From nobody Thu Apr 2 01:48:15 2026 Received: from flow-a2-smtp.messagingengine.com (flow-a2-smtp.messagingengine.com [103.168.172.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52DC6349AF5; Tue, 24 Feb 2026 22:27:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.137 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771972069; cv=none; b=Ou+11k0fWpLuyduWTa2w0Vwqt+BjMuLsNyWm03tT9H9zYkvYEUWRv5BhplFHTiiv8r41RvqqrIzBee4O/X8qmlGDHUk5G/uipsho5uUAaxXlTWMWg1oFiPkLEWkAz3amp7NPOPPyn5YkDkH+i/mVFZEx8ieeb/3ftQGFEXYsg20= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771972069; c=relaxed/simple; bh=8npN8lDUKLB/B/vi6olsXCscd/grdMnQXyTSElVQCIQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nyY/PNOhlOQnqg5ehihYfnisCylprj3kJ6LFxdw1//4T4EX2oOZ2Pt7zya95AuG7tc4VGb3KRo8NySL3u9aO+ruwGubikxi4M3K68ewo+DpDqTtJabGT04i86XHsHJkvdB7uheI54zLN/PGWHZzZTUex2HwG9lWzBM/FwVkqpos= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net; spf=pass smtp.mailfrom=ownmail.net; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b=eunBjtdv; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=DFvVp2g0; arc=none smtp.client-ip=103.168.172.137 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ownmail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b="eunBjtdv"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="DFvVp2g0" Received: from phl-compute-11.internal (phl-compute-11.internal [10.202.2.51]) by mailflow.phl.internal (Postfix) with ESMTP id A16B0138052C; Tue, 24 Feb 2026 17:27:46 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Tue, 24 Feb 2026 17:27:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ownmail.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to; s=fm3; t=1771972066; x=1771979266; bh=zoLaKvUIcq0LBSrvSvYdTrZyLAsLuraYZU3vedQYf7U=; b= eunBjtdvb7py65uKkhmWny3U0yrgkknbEzMVQWKR+94mqZBtzVxNG5UcQZeTXet1 f+sFFa1H7+k0RQ3dGy17Q8a4likxcrMxwnAG/xA499ylO5Abt49a3ZDk85O9WQr9 Cz0DTv8sPh8sqCI+a9KXs/NaCZ1kJGNLh1MCaj4Ag5LoDF8GCMewVz6BNuXdz1tL +WSGeeV8W7HNwadLfkZJdMj/b2WxWBMSME2ppKQ28WbR+H/+ugCmHg7deoZiiZWv PSfz9SjKvntrtb6Z8/ba/hoFi1Y2tsfv6rq+4AW6LMiMsxHzAAoG6skhYXbrIjXN +c2A0Ea/Sv+A43yHxjYu/g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1771972066; x=1771979266; bh=z oLaKvUIcq0LBSrvSvYdTrZyLAsLuraYZU3vedQYf7U=; b=DFvVp2g0aej3dNXGt WHFp/uzE8GtGq2WoHKtqHDsKXVgQ6Q7svrfudc4BRLDYwF3ZxQ0DcNnh7bJ0Y7Ly 3PBvs8vIjLmWL76cuGp601c+1oOwQnel/RaE9da0J5l0iuMTeDVpRRV8O11455SG kNCkqICmXWzTkaZN1demnwZvrZgKHrTVekon1VvKRJQDackfFkM51A2Wa+Iqkxu0 CBd6pi8lMlBSrn3VIs141ef66gGoy81xRjSb4mnmuxyWUNvIERuuYIIVgzuUEkon oSxZJSRGrdBIrQSE7yMPTqlbVdZotyhWZzEONFfP4J6acQyOTW0v/5FTIm6ZBB/o vViKw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvgedufeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddvpdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: i9d664b8f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Feb 2026 17:27:40 -0500 (EST) From: NeilBrown To: Christian Brauner , Alexander Viro , David Howells , Jan Kara , Chuck Lever , Jeff Layton , Miklos Szeredi , Amir Goldstein , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Stephen Smalley , "Darrick J. Wong" Cc: linux-kernel@vger.kernel.org, netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-unionfs@vger.kernel.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, selinux@vger.kernel.org Subject: [PATCH v3 13/15] ovl: use is_subdir() for testing if one thing is a subdir of another Date: Wed, 25 Feb 2026 09:16:58 +1100 Message-ID: <20260224222542.3458677-14-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260224222542.3458677-1-neilb@ownmail.net> References: <20260224222542.3458677-1-neilb@ownmail.net> Reply-To: NeilBrown Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: NeilBrown Rather than using lock_rename(), use the more obvious is_subdir() for ensuring that neither upper nor workdir contain the other. Also be explicit in the comment that the two directories cannot be the same. As this is a point-it-time sanity check and does not provide any on-going guarantees, the removal of locking does not introduce any interesting races. Reviewed-by: Amir Goldstein Reviewed-by: Jeff Layton Signed-off-by: NeilBrown --- fs/overlayfs/super.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 109643930b9f..58adefb1c5b8 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -451,18 +451,13 @@ static int ovl_lower_dir(const char *name, const stru= ct path *path, return 0; } =20 -/* Workdir should not be subdir of upperdir and vice versa */ +/* + * Workdir should not be subdir of upperdir and vice versa, and + * they should not be the same. + */ static bool ovl_workdir_ok(struct dentry *workdir, struct dentry *upperdir) { - bool ok =3D false; - - if (workdir !=3D upperdir) { - struct dentry *trap =3D lock_rename(workdir, upperdir); - if (!IS_ERR(trap)) - unlock_rename(workdir, upperdir); - ok =3D (trap =3D=3D NULL); - } - return ok; + return !is_subdir(workdir, upperdir) && !is_subdir(upperdir, workdir); } =20 static int ovl_setup_trap(struct super_block *sb, struct dentry *dir, --=20 2.50.0.107.gf914562f5916.dirty From nobody Thu Apr 2 01:48:15 2026 Received: from flow-a2-smtp.messagingengine.com (flow-a2-smtp.messagingengine.com [103.168.172.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 074C0350A08; Tue, 24 Feb 2026 22:27:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.137 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771972077; cv=none; b=rBhLwEL5ukfSHnm9w12AvCAHQ2iB7yS1cR8Tr2oF5TbAc4VlkxCWfDQRejNAdagC4kgPVSz53nrA1fB+mXL1u9y3Cw5FeHKlsdIeFabZB5e1BoQwYT/0Aav7Jor5sT90l7BSBNiK7dj6O2zg42DaQfNjPwuNxsTHUJU9PF8v1dc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771972077; c=relaxed/simple; bh=SohgNuLUXSQSkgtDnRyuTdAQDh9isNIABR5R5Yifjlo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oeU0xjkw3aqLiJae7VGtDpR+drVAsDEe3NeKYC1dkMUIVO68Qp468YRnkvsojrgIf39AQf/CEy3QnmTc/n7RdvLhigDkdbBOpL/427mjzKBicKDPis80LgOaytfjL6UZwl8FrsZn8dy1BAPm7i45qErG0PpdwkOHGXhZzklO5O8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net; spf=pass smtp.mailfrom=ownmail.net; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b=hy7u65I+; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=ChwCLTxk; arc=none smtp.client-ip=103.168.172.137 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ownmail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b="hy7u65I+"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="ChwCLTxk" Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailflow.phl.internal (Postfix) with ESMTP id 3D3A1138052C; Tue, 24 Feb 2026 17:27:55 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Tue, 24 Feb 2026 17:27:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ownmail.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to; s=fm3; t=1771972074; x=1771979274; bh=bIUlSuwFKeFIuLZj8rOB/AbskaH/BxVOAKu2PHwCVKQ=; b= hy7u65I+Q9tpvbtcV5WQpUFJvQgpsRwv2rvP+I7kvnfDA2SHObxNGtFreHDTOSpg 09z5WCa/28GuKNBjXyppssw8J3Uj1ZOsoC2eGUwFjpwUIWUgfIT4JJLNTK0hpsd1 zxUbyQbXhfWzRKrmAQu8x9zmGv/ZfgfbNGFvmC6BaloDTtBfY5R29PQfmXaV0gNk trMCyaOl7XwljFqdU53OxnkUFmdtLoA/vRTpRsha+Ms+jfYYr3n+68C6FJkCUc1j 1fCICJdAnXvQuuxISxUUEI88SC9G/7WxaiGqvMgSdpfPetdheLPfbciehBmpb4Pb d/j8SR622VN3qhsTWP5PdA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1771972074; x=1771979274; bh=b IUlSuwFKeFIuLZj8rOB/AbskaH/BxVOAKu2PHwCVKQ=; b=ChwCLTxk1c0zImyBL o1kANErg77ogwCm8US7Si3pa7+uAi2BjF1NsmTVx3inbCEynTVl8WEWS5fZtkU3E +OTBB6d7aLRGIZyoZawqFkFwK7a+MXQGmKlrEdkl5rnr++KLM9EX1OxzNaDO2lUK GRUNm7ZTjM6l9ww9i2GH8rxX9lRdyf9JwFBo3ghiv4aijGzJx2YDOab042LFVSRK GrDV8MaV2eIFCSiUpJoqKE0Y/DqGGDDYsrWNeBsgVrOzgiLLJjYFNhzAUVGq4MB/ VNt0nmx6+E4H/n7tMX/4MDGaSiw9olL3vcDDbKfFzfFURKIKzbFQ+0qVESQIhMM5 kn+Ww== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvgedufeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddvpdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: i9d664b8f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Feb 2026 17:27:48 -0500 (EST) From: NeilBrown To: Christian Brauner , Alexander Viro , David Howells , Jan Kara , Chuck Lever , Jeff Layton , Miklos Szeredi , Amir Goldstein , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Stephen Smalley , "Darrick J. Wong" Cc: linux-kernel@vger.kernel.org, netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-unionfs@vger.kernel.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, selinux@vger.kernel.org Subject: [PATCH v3 14/15] ovl: remove ovl_lock_rename_workdir() Date: Wed, 25 Feb 2026 09:16:59 +1100 Message-ID: <20260224222542.3458677-15-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260224222542.3458677-1-neilb@ownmail.net> References: <20260224222542.3458677-1-neilb@ownmail.net> Reply-To: NeilBrown Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: NeilBrown This function is unused since Commit 833d2b3a072f ("Add start_renaming_two_dentries()") Reviewed-by: Amir Goldstein Reviewed-by: Jeff Layton Signed-off-by: NeilBrown --- fs/overlayfs/overlayfs.h | 2 -- fs/overlayfs/util.c | 25 ------------------------- 2 files changed, 27 deletions(-) diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h index 714a1cec3709..6fb99c583c31 100644 --- a/fs/overlayfs/overlayfs.h +++ b/fs/overlayfs/overlayfs.h @@ -569,8 +569,6 @@ bool ovl_is_inuse(struct dentry *dentry); bool ovl_need_index(struct dentry *dentry); int ovl_nlink_start(struct dentry *dentry); void ovl_nlink_end(struct dentry *dentry); -int ovl_lock_rename_workdir(struct dentry *workdir, struct dentry *work, - struct dentry *upperdir, struct dentry *upper); int ovl_check_metacopy_xattr(struct ovl_fs *ofs, const struct path *path, struct ovl_metacopy *data); int ovl_set_metacopy_xattr(struct ovl_fs *ofs, struct dentry *d, diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c index 3f1b763a8bb4..aa2a32793c2f 100644 --- a/fs/overlayfs/util.c +++ b/fs/overlayfs/util.c @@ -1213,31 +1213,6 @@ void ovl_nlink_end(struct dentry *dentry) ovl_inode_unlock(inode); } =20 -int ovl_lock_rename_workdir(struct dentry *workdir, struct dentry *work, - struct dentry *upperdir, struct dentry *upper) -{ - struct dentry *trap; - - /* Workdir should not be subdir of upperdir and vice versa */ - trap =3D lock_rename(workdir, upperdir); - if (IS_ERR(trap)) - goto err; - if (trap) - goto err_unlock; - if (work && (work->d_parent !=3D workdir || d_unhashed(work))) - goto err_unlock; - if (upper && (upper->d_parent !=3D upperdir || d_unhashed(upper))) - goto err_unlock; - - return 0; - -err_unlock: - unlock_rename(workdir, upperdir); -err: - pr_err("failed to lock workdir+upperdir\n"); - return -EIO; -} - /* * err < 0, 0 if no metacopy xattr, metacopy data size if xattr found. * an empty xattr returns OVL_METACOPY_MIN_SIZE to distinguish from no xat= tr value. --=20 2.50.0.107.gf914562f5916.dirty From nobody Thu Apr 2 01:48:15 2026 Received: from flow-a2-smtp.messagingengine.com (flow-a2-smtp.messagingengine.com [103.168.172.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68D5934E769; Tue, 24 Feb 2026 22:28:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.137 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771972085; cv=none; b=jKgKQJaP/XNr3vZFyEKgktXUNvFmDhmvXVcuMPssGO3rboPJ78XziQRCpnIUir8Ix6d6bYoQnaJPZmP3w79lbxfgEJ9FEt25SED1KUxzpv6kgvdZeg052jUtz7AEOPF1slH43kLBJhR/HWW45GcAc4rA60uv25pleEHPXm70yrM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771972085; c=relaxed/simple; bh=ZN5XFPn7tUkfMGc5iwQB3ZTfDKP5sgGwhooynf+keDc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Pt+buVsZVublxOsMOYAUoEHbflAvNSuvyz0HYwK3Z8bn0bwQhJFrt2QyxwKCb2m+leNjh/5BbhF33cSHg2gC8TGkLP4Nmmrw9Xr1+v/E5LKjhXq3zGAJTaMf3xXvUuAuOgB8jnRIepDI6LPvR6viCsnSi8jIkB51Srm/9glubaI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net; spf=pass smtp.mailfrom=ownmail.net; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b=Qsc1ePeS; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=JJyeWTwq; arc=none smtp.client-ip=103.168.172.137 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ownmail.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ownmail.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ownmail.net header.i=@ownmail.net header.b="Qsc1ePeS"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="JJyeWTwq" Received: from phl-compute-09.internal (phl-compute-09.internal [10.202.2.49]) by mailflow.phl.internal (Postfix) with ESMTP id B1B5F138052C; Tue, 24 Feb 2026 17:28:03 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-09.internal (MEProxy); Tue, 24 Feb 2026 17:28:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ownmail.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to; s=fm3; t=1771972083; x=1771979283; bh=wijvxZQWm9lKy/h3JSFEVjiYfslMBA04IhCaGLEm+aw=; b= Qsc1ePeSEaLWi8BDrsD9vY2ogxq/J/OJ+6DtZSsY4kpbC630IqfzW2ELvRLbF0xH n4n/hLKHJSnJiMVp1uNGG9Rlxq7ptH66Wbkf+bBs6qm42CnmQkbjQ5NXMMEBGMoH h7PMEuKXYCi19HURgYdLP3S9jxRjkCqwMchfscEqtL3c4vBlqOlEUBAK97192xNf 6Ov/iwuTkTMx0yjx6vpVUsTSbCOyIXhOBPbDM6okDqghjBNbm+nEGNs8MDP1Uf7d 1ID2SjWug65BTZe73wsuY9EGSugYjl9IlHJ1k+IknPOIaYGQr90i6+2nvRg7L+0x 0cVwg5VLWo1u+dJo7qF0DQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1771972083; x=1771979283; bh=w ijvxZQWm9lKy/h3JSFEVjiYfslMBA04IhCaGLEm+aw=; b=JJyeWTwqbNVQ7ik2z 5xdf8bbM5zDUFVdjfpi/zzOa4qnkq62FeoQ/DA5Z+vQmEJZ3al1E1urqxtv4d0Ld bE1ikLaQU7vA7bjRcHCKFDcGsJm16dhB6MypAhLDUFS4hyxWokG7yCbDgvKL9Q4e 05Tz8O9CuryBcvGdj330lyokQejeynz5uXNSrCFgFmWDYFqg9CSSPo8XTTnnC5iK qWAUDw+Qd/WvQhLieYeLl20fh1gs7DZndVW7Ou9sCisHuObLPHB2NuZ2SkbwWMBb zCtwpOmP25+0KbHOPRdBmp+0GApQWThdjOdVsVn+3Bu+0AordG3i6cFHx7kw67Rj DiUcQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvgedufeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddvpdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: i9d664b8f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Feb 2026 17:27:57 -0500 (EST) From: NeilBrown To: Christian Brauner , Alexander Viro , David Howells , Jan Kara , Chuck Lever , Jeff Layton , Miklos Szeredi , Amir Goldstein , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Stephen Smalley , "Darrick J. Wong" Cc: linux-kernel@vger.kernel.org, netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-unionfs@vger.kernel.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org, selinux@vger.kernel.org Subject: [PATCH v3 15/15] VFS: unexport lock_rename(), lock_rename_child(), unlock_rename() Date: Wed, 25 Feb 2026 09:17:00 +1100 Message-ID: <20260224222542.3458677-16-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260224222542.3458677-1-neilb@ownmail.net> References: <20260224222542.3458677-1-neilb@ownmail.net> Reply-To: NeilBrown Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: NeilBrown These three function are now only used in namei.c, so they don't need to be exported. Reviewed-by: Jeff Layton Signed-off-by: NeilBrown --- Documentation/filesystems/porting.rst | 7 +++++++ fs/namei.c | 9 +++------ include/linux/namei.h | 3 --- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Documentation/filesystems/porting.rst b/Documentation/filesyst= ems/porting.rst index 1dd31ab417a2..d02aa57e4477 100644 --- a/Documentation/filesystems/porting.rst +++ b/Documentation/filesystems/porting.rst @@ -1368,3 +1368,10 @@ lifetime, consider using inode_set_cached_link() ins= tead. =20 lookup_one_qstr_excl() is no longer exported - use start_creating() or similar. +--- + +** mandatory** + +lock_rename(), lock_rename_child(), unlock_rename() are no +longer available. Use start_renaming() or similar. + diff --git a/fs/namei.c b/fs/namei.c index a5daa62399d7..77189335bbcc 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3775,7 +3775,7 @@ static struct dentry *lock_two_directories(struct den= try *p1, struct dentry *p2) /* * p1 and p2 should be directories on the same fs. */ -struct dentry *lock_rename(struct dentry *p1, struct dentry *p2) +static struct dentry *lock_rename(struct dentry *p1, struct dentry *p2) { if (p1 =3D=3D p2) { inode_lock_nested(p1->d_inode, I_MUTEX_PARENT); @@ -3785,12 +3785,11 @@ struct dentry *lock_rename(struct dentry *p1, struc= t dentry *p2) mutex_lock(&p1->d_sb->s_vfs_rename_mutex); return lock_two_directories(p1, p2); } -EXPORT_SYMBOL(lock_rename); =20 /* * c1 and p2 should be on the same fs. */ -struct dentry *lock_rename_child(struct dentry *c1, struct dentry *p2) +static struct dentry *lock_rename_child(struct dentry *c1, struct dentry *= p2) { if (READ_ONCE(c1->d_parent) =3D=3D p2) { /* @@ -3827,9 +3826,8 @@ struct dentry *lock_rename_child(struct dentry *c1, s= truct dentry *p2) mutex_unlock(&c1->d_sb->s_vfs_rename_mutex); return NULL; } -EXPORT_SYMBOL(lock_rename_child); =20 -void unlock_rename(struct dentry *p1, struct dentry *p2) +static void unlock_rename(struct dentry *p1, struct dentry *p2) { inode_unlock(p1->d_inode); if (p1 !=3D p2) { @@ -3837,7 +3835,6 @@ void unlock_rename(struct dentry *p1, struct dentry *= p2) mutex_unlock(&p1->d_sb->s_vfs_rename_mutex); } } -EXPORT_SYMBOL(unlock_rename); =20 /** * __start_renaming - lookup and lock names for rename diff --git a/include/linux/namei.h b/include/linux/namei.h index c7a7288cdd25..2ad6dd9987b9 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h @@ -165,9 +165,6 @@ extern int follow_down_one(struct path *); extern int follow_down(struct path *path, unsigned int flags); extern int follow_up(struct path *); =20 -extern struct dentry *lock_rename(struct dentry *, struct dentry *); -extern struct dentry *lock_rename_child(struct dentry *, struct dentry *); -extern void unlock_rename(struct dentry *, struct dentry *); int start_renaming(struct renamedata *rd, int lookup_flags, struct qstr *old_last, struct qstr *new_last); int start_renaming_dentry(struct renamedata *rd, int lookup_flags, --=20 2.50.0.107.gf914562f5916.dirty