From nobody Sun Feb 8 16:35:50 2026 Received: from flow-a6-smtp.messagingengine.com (flow-a6-smtp.messagingengine.com [103.168.172.141]) (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 A335B1632E7; Wed, 4 Feb 2026 05:08:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181695; cv=none; b=i2gPW6BIWWDbUWrqnxY/Tl/JcB7IsxhMirjflJ91sDIW6XMajinMOWn4X27IlHGRoiabC/d2z1ISn2AA5/GCyNJpFkbL3zo5sapBqW9j7hdtLnYcoNYvPaT+FhqGjiqYj5GM92Bvl0jNd4ReGwmznJC3/ZakSOoaag+3jXMPDHM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181695; c=relaxed/simple; bh=FB/uc3IA68XJYpoaP3UA2p1FkWkGkzu0EoP3vo0ZfU8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W7ZdYMflYHA0UCfsLai6FkkPnM6IH34h5QkOqZfiHyK4JCWZKu5GdbDvYWSqqYKCz4BbimdyjgNOgZ1epIBSvpLYxHSxt5ngpR2j50PJofftavMVh8tWHFVb9R878IZ+Er/QszgGRXNVESGLI2orE9K0112Six+G7noJY/T9XKA= 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=DhtD8bzC; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=w89hP2rE; arc=none smtp.client-ip=103.168.172.141 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="DhtD8bzC"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="w89hP2rE" Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailflow.phl.internal (Postfix) with ESMTP id EA7B0138077B; Wed, 4 Feb 2026 00:08:14 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Wed, 04 Feb 2026 00:08:14 -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=1770181694; x=1770188894; bh=3vylP70Td4gLvBkKBkP+NDaQ107NjHxVZqjmkf4RPM4=; b= DhtD8bzCE/oNQIkGTTjyqSX4LQFUqFhjVSWKj/iXxrgRLl9NMJgIFm1xZ4/+udL+ /9QWvwMQV6geJ18mtU4+cgzDERVj1ReQO2ExjsJaVPBAVXtasGRepSdMNCEs3Cen CSHYUma0vbM4ukuPPL8Z+pOn/nj6EBbbHKgw+8Uy+6hKfGk7XO7tQ6p6EyhH6c8C 6p87VF0V5HVZ3l4zZJvwKWrqJ1tuJ4YK8Vb4OGfaZgK4ZEwkYmQGCwmBQcSAAb+W YTqNDXuE4QXcuT2g5nwtYr+JVfmjJkqqHAoAEzlxhbyx6v3JmJad53Gh8DcrsokT ZZ8ubTAUQbE5Utbhr9g6Ng== 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=1770181694; x=1770188894; bh=3 vylP70Td4gLvBkKBkP+NDaQ107NjHxVZqjmkf4RPM4=; b=w89hP2rEFqQl9e3q2 g2FP5CWLzoLxvBPctBENFDxM58CxydFLvse3FHdP6d0+csiZVe2ZvqhGTbwvpjLN 8RZExjMi7fsXAsrW2rNHsW8myHB3LnaOhRbyUB74IWtr8/qkS7dOTCDnbVKBtB1o TkoG0g9EuxvgI28XT+UnTGzKof8yNAjVTmIBkM2hvmtfEnwcacSmkVx000eCS3VM GKno6xlQSBDJjHWqV8Jzuvr5kjZ3q7qpw40XTCPMFdJu7SnRFt3E98DL/BqeNVEF P+RWyaXoyUXGMz2W7fIKHBAtXLUjLtTMg1lzqsBu+G8WvZ+9okCIlHHVcJNQBI95 IeHAQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedukeeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddupdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: iab3e480c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 00:08: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 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 01/13] fs/proc: Don't lock root inode when creating "self" and "thread-self" Date: Wed, 4 Feb 2026 15:57:45 +1100 Message-ID: <20260204050726.177283-2-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260204050726.177283-1-neilb@ownmail.net> References: <20260204050726.177283-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 a 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. Signed-off-by: NeilBrown Reviewed-by: Jeff Layton --- 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 Sun Feb 8 16:35:50 2026 Received: from flow-a6-smtp.messagingengine.com (flow-a6-smtp.messagingengine.com [103.168.172.141]) (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 414DD32F759; Wed, 4 Feb 2026 05:08:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181703; cv=none; b=Ql9joq8I4PnLUP3BOMXRK20NDt8xfo/9lgOKR4POidl7JqBy+j06f6+KMxVZ/aKMDdls+mxL6rujoDTPudoPZYoHV3MW1BGqwN4KAbtPbL1bhAqTevbvSWN0f2/l3HBNI3WabPl3P+y+xr4JAWHonSNGrKmcMSBNIbDQUqpVvn4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181703; c=relaxed/simple; bh=WcuGfAaU+Z2+KHqcZEi7NR4U2jlWhd5mTxC/d64/YfY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XKlzqlJxIG/7Hfe2cnz/wqKQaa3XZI6TzzHBDMqwWwnyXM1m8hKmtnGHBKuLnof68YqjV2lwLAmzda+phCStG4o29DcTY6QqbKSmFmalis5jssjs0eucYVol5ww0HD7TNf4kHB086q3Q4dTXdrByi+/GcimUmz47gT37Wa+GAxU= 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=KiIPM8T+; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=RvJkWztt; arc=none smtp.client-ip=103.168.172.141 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="KiIPM8T+"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="RvJkWztt" Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailflow.phl.internal (Postfix) with ESMTP id 863B21380781; Wed, 4 Feb 2026 00:08:22 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Wed, 04 Feb 2026 00:08:22 -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=1770181702; x=1770188902; bh=czLckKBE0Hyt9Dd+uhzinS1Ik9k72RW9/tiMvXjH9ZE=; b= KiIPM8T+9Qs7OMViXU2ryPo92F7MQmvanDSVUIjj5kC57ZcpVQaFnv4rQ1NMLi4B +0RV73AC3r13JN5qIK1EhD+Tu70qyQCgvG1EHuvV5EPBAXYRAVPdX8jol3tDjUl+ xCuDDT+BHlg+nhgNj7Q16RBLeutN55zpthaytVCWQGcbSeQxYiM4BYvrGKScCx3J ZdcE5j4rU3uZZYWzLeOdqIF+ZKUo3CNqxDFnJaQTY3nVKvxowyR9+UkPlD+N5g+F NdWf52di24JGw/l9PriGoDD7z/vEmDmWIwFDlbPXl2AazB1bGjPw9gG2E3Nmypf4 xBdB1ZxRbTl2gKxhSjEUjQ== 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=1770181702; x=1770188902; bh=c zLckKBE0Hyt9Dd+uhzinS1Ik9k72RW9/tiMvXjH9ZE=; b=RvJkWztt3XeqOopzq Z3hLdDpnoBpjoznAYPP7N0yKlbOsq5EXH1Bszoir1vuBAX48a9NgeogyHQ73wHEo z/oizouEHIODIXBpnV33EA61RMDPTbwj+rAepzhBlc4VLCUYJ1uI7KRdrHOs6hw1 JTLepBfzI+42m6l5+4R8v1tBuvf1ywnQauoadNBniqZM39DAExI68jtT1Qxyko5U d82AM3QiOyxyn/v9u3WQ4Tt8iHhnjHFIZKeWhGRK27Ns1sIjLIcma7JtZgJS/ygA pq5sgU4k8HHaFdrU4XtoAZdA37ixRm5dktHh7MMsltzrp/PAW5dkeo2C3XPrwUmw RwEZw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedukeeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddupdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: iab3e480c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 00:08:16 -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 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 02/13] VFS: move the start_dirop() kerndoc comment to before start_dirop() Date: Wed, 4 Feb 2026 15:57:46 +1100 Message-ID: <20260204050726.177283-3-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260204050726.177283-1-neilb@ownmail.net> References: <20260204050726.177283-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. Signed-off-by: NeilBrown Reviewed-by: Jeff Layton --- fs/namei.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index b28ecb699f32..40af78ddfb1b 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2841,20 +2841,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) @@ -2876,6 +2862,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 Sun Feb 8 16:35:50 2026 Received: from flow-a6-smtp.messagingengine.com (flow-a6-smtp.messagingengine.com [103.168.172.141]) (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 ECC3932F759; Wed, 4 Feb 2026 05:08:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181711; cv=none; b=SKqtFursdJXBnTsccWrShbr1pqLtgS8/MQgfKSt1E2TV2WjIjrLJCHG08KtB/c5MZzsBMCN04UkcL2OCeO4zUgCKC4K9N7tVwmZDgkvecyzeAANaVKAAkRoba3fYPHJqPKzMTGbctnJ9U2oLptt6VfAzkwcWrtknKXmQyNU90nY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181711; c=relaxed/simple; bh=X3yURENEupz4CUecqxn/1nXh1M8n3fSd3Ij96hU/uvY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BYLw82n439CiMldgUQYQJUHiD0LzB8JkDKu/wJlSzeGfy0gJ6GU9vi24XZ2vGowyiIq/wtaDibcyHsyVuUAtvUKjPGRtekYlMAJr2BKG17pNoSQm+u/wcdBSInTCFfzxo6SD4xyFJbyf4ZRIlFropFsMbZtWTBTqZ5zp2BmoGMU= 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=VWDBgqqS; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=rpyLh5/y; arc=none smtp.client-ip=103.168.172.141 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="VWDBgqqS"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="rpyLh5/y" Received: from phl-compute-12.internal (phl-compute-12.internal [10.202.2.52]) by mailflow.phl.internal (Postfix) with ESMTP id 59BA01380783; Wed, 4 Feb 2026 00:08:30 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Wed, 04 Feb 2026 00:08:30 -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=1770181710; x=1770188910; bh=nbu6leitHLk/a+LhHhFGF+M+ZAOtaZT49soxaSpp/w4=; b= VWDBgqqSFRCwbTr47z3pCBaPLI4Yy770051CjDEfiEaUIdEaPJGP4024DX+gErZy W2512BJG4dCqUd419LPFfzbiLsBf35lQnSg4TRTRk8QX9ao2rKVKkbxH35I5PhVJ B+Rw//Zu0JVY+RNtDJMO+7atD3m5NUZK0WNVidT05e/CC+3GlxvD3JwBQUu7t3nl ro79mi+zNkWbKafKoP0tZ3/Ju6j8Iroq24BqlOcaXMa8EnrKBR3jiTwMfGPyTVpX KoZT168soFmyp/HEMxDBgZIwB6TSW2QylXPyweEuX3bMtC5ezm4PrROHQl80uSoH 8sRpJxPJXk9R+3iAuFMVZg== 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=1770181710; x=1770188910; bh=n bu6leitHLk/a+LhHhFGF+M+ZAOtaZT49soxaSpp/w4=; b=rpyLh5/ysnp0C/Vxh 9xfg9K1SRqftlsE/R2+1mXgaOCn6cydz40zGRMEf8TN+tuy9gVCcdyjRSzeNPSNf HMTnayYqD/UGOtSYHt8JWvX7X4c01jXx3lVRlXKFMozz5pcciI5e1uv5etCJu8uf Zugkloczv4zJS5cVT8TTqYVRuL4iGerwHwJgbTwetUtGl90IbR89XjHUt/V5yCxi tRY+yYG5Ob2q6SVKzXXTn/vCGvNF3QJl9Ykr1q9LxwirZ0t6rSJYS9Nn7NfUU+zh Uhpz0/IYSbMNfGQ2Bz3Lbdy7SROh1GZmgR2AjcsT9Njb6CFt1aUfsK6nA5V/Y+dh 1TrVA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedukeeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddupdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: iab3e480c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 00:08:24 -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 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 03/13] libfs: change simple_done_creating() to use end_creating() Date: Wed, 4 Feb 2026 15:57:47 +1100 Message-ID: <20260204050726.177283-4-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260204050726.177283-1-neilb@ownmail.net> References: <20260204050726.177283-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 --- fs/libfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/libfs.c b/fs/libfs.c index f1860dff86f2..db18b53fc189 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 Sun Feb 8 16:35:50 2026 Received: from flow-a6-smtp.messagingengine.com (flow-a6-smtp.messagingengine.com [103.168.172.141]) (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 AEABE352F8A; Wed, 4 Feb 2026 05:08:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181718; cv=none; b=bjcwf3G6eI2aONgMdLDNaooXc9tAbbeydDX7NNTLq8yRwm+qOmPzMm+2El/Zq/VC+9lpN6OK1lP7qOhLwEKs73F4XEq/h02SI5VLHSzJsiXYr7HNAeqqGGNzgUq0CmQ8ngdIJGsot4+rgwk+t8cW72TWxk8gEAUQuxoM7bz7JsU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181718; c=relaxed/simple; bh=pNnjOc5fmEcwQUqR2kkDoAOFhmAX4yVyKqWdqZOoepM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ejMcLljjBbCudebFWVZqODxeDmtRFAPoA2FbNNMisstCYABhUMMgyB+8LltZrqJm0Hk77gFSHt3WbKB4tsaTulkUBGmG3fMH09zb7g3fSjg2Ij2BMbpQPdkUeWhjl3SDNmrRBjav8/5PIvbU8T9hClaffHUU+BlouH4fx0ufFgc= 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=MXE/qyXA; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=fb6DeRDI; arc=none smtp.client-ip=103.168.172.141 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="MXE/qyXA"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="fb6DeRDI" Received: from phl-compute-07.internal (phl-compute-07.internal [10.202.2.47]) by mailflow.phl.internal (Postfix) with ESMTP id 26B801380785; Wed, 4 Feb 2026 00:08:38 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-07.internal (MEProxy); Wed, 04 Feb 2026 00:08: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=1770181718; x=1770188918; bh=8wI2eoS5Ti0e8e9a5OXGf4ICfst25BignuwQVay1myA=; b= MXE/qyXAO0SlibBo/pe9gHtfQbldudp4yLTK4aISviPikND1RrYRXxvbI1j/RajE yJ+x8Y6R49TL9etkHnQLkdFi5B7eRU+tBZFHwfZhUmfJQ+2CBVyWg/elDu/RfJPv Wekfj7kHXKYQh5k0uYFczMMMYaSRdikAfeV7E4U0Q7l4BscWYDjA+0aWRoyaqEPa RXU2UKxtNIpC3AmNBTcoGO7eQvtttO4GPmfSa4YSbWagFkkPHObAMmjCR2fx2sYm TxWXSWke9uqBqM9A8zDle/FguWenrQs0whblpMFI0jao0xMeNY9DrLNKSR9bM3YI xUTyJp/H++0pCUMlwi4ZsA== 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=1770181718; x=1770188918; bh=8 wI2eoS5Ti0e8e9a5OXGf4ICfst25BignuwQVay1myA=; b=fb6DeRDItfriYices U725N5r6W1CZEi9lKyh2eHtQ5QPZhuyxFRJklTnkZ/5p4ygYhmm32OwOmRsNzT9B xezOFIhjwBGHRR3HcienKwgx1r4+ri7pQ49HAeAjyuqBvpHJorToPTFdTIWkVXqs xCxyeaL8trBKh2wUnaCrf+gQkneQZd2Zj10wwwaS2ya2BwxfnfrlcZaRugr8BnkL WyASw4Y3xSsTcoPhVH9AdWOgmKForQPcyTnNyyj5MDJSrB5BHc9afYWV2ZmvRIDu P5vsrCUyTPCHv24TLe4Ob7bJ3tlrKc0RJ59sBZFg7bZhn26xTQl5gLZEiC3s2ErA tgyLw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedukeeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddupdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: iab3e480c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 00:08:32 -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 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 04/13] Apparmor: Use simple_start_creating() / simple_done_creating() Date: Wed, 4 Feb 2026 15:57:48 +1100 Message-ID: <20260204050726.177283-5-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260204050726.177283-1-neilb@ownmail.net> References: <20260204050726.177283-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. Signed-off-by: NeilBrown Reviewed-by: Jeff Layton --- security/apparmor/apparmorfs.c | 38 ++++++++-------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c index 907bd2667e28..7f78c36e6e50 100644 --- a/security/apparmor/apparmorfs.c +++ b/security/apparmor/apparmorfs.c @@ -282,32 +282,19 @@ 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); - - return dentry; - -fail_dentry: - dput(dentry); - -fail_lock: - inode_unlock(dir); + goto fail; + return 0; +fail: simple_release_fs(&aafs_mnt, &aafs_count); - return ERR_PTR(error); } =20 @@ -2572,8 +2559,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; @@ -2581,7 +2567,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(); @@ -2593,18 +2579,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 Sun Feb 8 16:35:50 2026 Received: from flow-a6-smtp.messagingengine.com (flow-a6-smtp.messagingengine.com [103.168.172.141]) (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 76B1E353ED1; Wed, 4 Feb 2026 05:08:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181726; cv=none; b=MSskCHvHVacmFz9rxoIW+tTxRHcun4Gq8eO7GZG2ZrP0pEh117km7cHdMchs5Gkz80hQOUDiOizgLewePACzYoSyFpGU0IRlFM5+b2hLiBx9Fh//zjZMYKcgQju78qprS6VwIFlNcDXs8Ih6LYa3Eihg8lKl/kvLM63NlBFcJh8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181726; c=relaxed/simple; bh=4G2dvZDHtKO1ROuLl6tcnJdY+EMaZh/hy2e8eYdHCi4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=smogZFnQXVlutHeLQ+yi1WcRxD9LtNmxl4PUK9Sq9bjA9ZlUhF1gk9ezzQrGnK7LKIYqFI49cItsNWE2tbK+eadfHUhN6KRH2t0mrcX9OoFQ80lDlAvKH4tri5UbiLRu0v9zWJvbi0ysftRXbL088Ih31KVWT4l1hyT2N8cF6kk= 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=OSIwwhCE; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=IckxQb5e; arc=none smtp.client-ip=103.168.172.141 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="OSIwwhCE"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="IckxQb5e" Received: from phl-compute-12.internal (phl-compute-12.internal [10.202.2.52]) by mailflow.phl.internal (Postfix) with ESMTP id A26ED1380787; Wed, 4 Feb 2026 00:08:45 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Wed, 04 Feb 2026 00:08:45 -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=1770181725; x=1770188925; bh=Xtl8I0VkwBbZNObKLjoeIAfJSZzFqP3UknI7fOZwH+Q=; b= OSIwwhCEIjbM7LfTzPSJhSef5BBZmE0JkVyVx8l1KZYiVpsDnn8K8qnCgjCtUOaJ 1Pnh+pZiP/QcXciClhvqrLQFzLMPKbeoBnE3g5YQbQwerqhiws1FDQ4chBNhkbN/ 2lDaZNN6gNBt+MnpXZYJWqkAyYNq7lNd83ZjcUASBD+tA3wS1rkcfhkbO0+GAfh0 lhE3cvfuuWY5eNpY2Le9uVITGvStkAYDSKcBLNSIaIcyiwdWUK+ayeJPisbkvXcC PiZhs0+4jHUpt5g0NJZDcHizH/NsBlNAlDfdgwt9HyUSXWMC2u5fRthtBesiYAGo bd5WKG+KnYWB8PKlEkgc2g== 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=1770181725; x=1770188925; bh=X tl8I0VkwBbZNObKLjoeIAfJSZzFqP3UknI7fOZwH+Q=; b=IckxQb5eQ1teD/JC2 2C6z4aLlWpOTXy+n37BxxAqbOsLUj5xcRzP18ybcP3MRqFT/MLZNgdepc46XyL73 g85vy9/StufIHnLyOqaq/camuvYgVNST4xUFhb4+pEifAy6L/rxaifEfcctnW+iA dHgmFs1KGK7kMNPQRh3YS6wAFPj+7xYatkzBkd/MRhHvS1P71IULuYQs3HzkwOBb dT0PwfrWQleQdyKJOBwHM/6OnoX8ohPLx8/L4haPzwFCp33oEByj49+nyRpymIZu erYAXlHSL9+fnRNWKOPb336GZdqXNLeureCB1uQyQs1e277cOfDhM9rMJ+4YB1qb u07iQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedukeeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddupdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: iab3e480c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 00:08: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 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 05/13] selinux: Use simple_start_creating() / simple_done_creating() Date: Wed, 4 Feb 2026 15:57:49 +1100 Message-ID: <20260204050726.177283-6-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260204050726.177283-1-neilb@ownmail.net> References: <20260204050726.177283-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. Signed-off-by: NeilBrown Reviewed-by: Jeff Layton --- security/selinux/selinuxfs.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index 896acad1f5f7..97e02cd5a9dc 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c @@ -1930,15 +1930,16 @@ 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) + inode =3D sel_make_inode(sb, S_IFDIR); + if (!inode) return ERR_PTR(-ENOMEM); =20 - inode =3D sel_make_inode(sb, S_IFDIR); - if (!inode) { - dput(dentry); + dentry =3D simple_start_creating(sb->s_root, ".swapover"); + if (!dentry) { + iput(inode); return ERR_PTR(-ENOMEM); } =20 @@ -1946,11 +1947,9 @@ static struct dentry *sel_make_swapover_dir(struct s= uper_block *sb, 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 Sun Feb 8 16:35:50 2026 Received: from flow-a6-smtp.messagingengine.com (flow-a6-smtp.messagingengine.com [103.168.172.141]) (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 02AF6352C48; Wed, 4 Feb 2026 05:08:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181734; cv=none; b=SXbM8YQ0+n+cnnymRzle9DbYpy9Cm540NJXeXWvrKVTFgwTJ1Vq5e4FyFqrlfiwrn/RsRVAq5pNmuVeAlOQUOk5DsmkvIBlmVlMAaXxqcE9XuwXXlI0Z7wW6kuK6kNYdmCxdJWM34wHiU1Pn4EJdUs9a4CYSt+WaWQT81IGKnYw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181734; c=relaxed/simple; bh=qplDwUllsW2g+2INEuHLvBwHd3Fd/OhHhjHp2RMiR8E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QUd1X1mK0GDRlWGj2fT5gUylRQZn/XLA9h1pKPVPjdKfGYBsPiNkb7YpQT61HCiaxpq4x10EHNrcRkEOSrKJX+FUlfviY6UHq9lpg4u9DixF3cxPySYmBwkcHaebppcDcqJkaJXFKNeXXZz9O42jY0zcg1uuLXE9i30MB9h1I/c= 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=OM3atnOE; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=NsdEeoqn; arc=none smtp.client-ip=103.168.172.141 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="OM3atnOE"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="NsdEeoqn" Received: from phl-compute-11.internal (phl-compute-11.internal [10.202.2.51]) by mailflow.phl.internal (Postfix) with ESMTP id 4795D138078E; Wed, 4 Feb 2026 00:08:53 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Wed, 04 Feb 2026 00:08:53 -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=1770181733; x=1770188933; bh=dlJn5fjDHHJoTWsI4P2Q723YQf/tI/C5cM/SmaJ+5tY=; b= OM3atnOEau3pjHPWUS+XNXAPWU0+DV5lW/4kD8G68mLyz/jBiyKMW8654CvgrsQu Ijpet03LuJBeR55yOqREIAsWOxI9GQaW7t+8u6Qmu5RxeyGozk/Qyb5xPcO0CVcA P65B30oW14XFWXyRseJkx4GgizLj9a3MviH8mX8Tho+baH/UtwIuQJGl4pVDJ9MS tjPEnhIOboaLjurukC5XbQkanfCBYf/J9Q2T7jbcTK8BImTMgk0rDzTY9HPW31Ph IkBM5emdXLol0waOIhNv2DPN9co1TDkKlj1AXt8uwBnq0Du+FbYLtU0Ubz4E/uh9 D8kBSXMnhsFiP+T/0usRQw== 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=1770181733; x=1770188933; bh=d lJn5fjDHHJoTWsI4P2Q723YQf/tI/C5cM/SmaJ+5tY=; b=NsdEeoqnXG043UXih 3duarZcI3Q0aOWXv42GjSOOhBCMB57FsVmsHwlxXxSfmCVDHUrAt9r9T4MNY503h qIGcw/Gy/oir7FqqmTI0PdYx6bgpriKzQ+T7F+gao2JFP93fgWjkGDTin0hOLZHn CufXI7zEq+57hVdZ3nBoUAlJM5Je7RTiYlSeLpK8Hz5Wp7AVTOmZ1kZYXobHQpyk OHMfcpC/KMA6+JYGw7hIK8hZg40uYxgIjxQWLPaUnuwc1mg2wRYJMeL6bgaX57bK cAW+yKyHR+B6IIKIW0N2FV5yfh23VDXScApj/g4yceUzHB1WROEO8tqMTU33qRDC VRpPg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedukeeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddupdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: iab3e480c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 00:08:47 -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 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 06/13] nfsd: switch purge_old() to use start_removing_noperm() Date: Wed, 4 Feb 2026 15:57:50 +1100 Message-ID: <20260204050726.177283-7-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260204050726.177283-1-neilb@ownmail.net> References: <20260204050726.177283-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. Signed-off-by: NeilBrown Reviewed-by: Jeff Layton --- 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 441dfbfe2d2b..52fbe723a3c8 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c @@ -351,16 +351,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 Sun Feb 8 16:35:50 2026 Received: from flow-a6-smtp.messagingengine.com (flow-a6-smtp.messagingengine.com [103.168.172.141]) (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 8D33D353EE9; Wed, 4 Feb 2026 05:09:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181742; cv=none; b=BpTiDzBF74qHcV2Eg3frSgIbDHljnRta38FHJqCTUo1AdCtAttj9A7q8260y5iL4KNVE5tdQhKMbvuTbrxKTnQT4Kp7mDYM4cN9+ymuBkQzXj6UfNdXt9W0g2RACT+KvvQruQiQ3QNxmPKSSBV8VdceaPSdYxjKU2iKovedwkvA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181742; c=relaxed/simple; bh=szaegCj6EuoIzcSxYsl3y37lh1EU/+GDN4Dj+hHqAMA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uzlimoPAGHWX/uGzJ740RKih0jPOGXLoNSWYYJ6W+GBXcmuq9V8eIDCgkptN/lQjm0fOZm9WvaMnaIRfY9iIh4Hsotq1/5yOIEIk/d8ACQS71gIduTZU6CiPu0CHOLzYD+4P3RVSbwiKpkFJiJRUkFTZKPUaqltdrXL5iy6q22s= 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=PfzG4VfU; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=vI1bsTE0; arc=none smtp.client-ip=103.168.172.141 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="PfzG4VfU"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="vI1bsTE0" Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailflow.phl.internal (Postfix) with ESMTP id 0596B1380791; Wed, 4 Feb 2026 00:09:02 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Wed, 04 Feb 2026 00:09:02 -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=1770181742; x=1770188942; bh=1n4lIAxtUgYajLCifkhNHQVF/GnsaAGGAoPUyk9Rs5w=; b= PfzG4VfUoa4kqnybFWiRirIn8E+3tUu2xcunk30foo2e06HIR48ujZB8b3xxusgm WVSM0gMq9sTgfuG3YaZVBrji7gcfCV35aznQOyzvdfUO7hRo9/cj5uXa2WWBKE8M HT1TxjSqBPOtlgke9WjuSUhuqTDK0WsjpXm8BERnV4C+LkNKrpACwAm0u/7blDQ8 AlQPu5DSJk+OLJ4UNsVDg+cE4bIbEmQwPj2VUu6ZUEk30mI9k7HIkcQoOwOIyAZw qkaXLSDZC/49EtfMmNKrMuQw8F5ql63HYMn8/w9Obblbi4GpXok73xz/1ftFOzaZ 7MBxMYrPzWzkse+wJgk90Q== 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=1770181742; x=1770188942; bh=1 n4lIAxtUgYajLCifkhNHQVF/GnsaAGGAoPUyk9Rs5w=; b=vI1bsTE0ScZ4pS5tu ze1uWD8qTwq+UFYud0AFiKMwMUfHP0HFyyQEY5bG7tZrySF5/f2E0HX1Xw2t3t7v hA6en9hIxsCU+xJ1GmqAw2rRvw1DhJ42LRkph6rd7h7wUZOGMvIA89hmA8xz02NO juE/pmHjikSChuPMt2koSlhPlCChASZ41Wx5yJsTLl9KrQ24RvB8L5ca8nz+mqr+ +zp7A05Wp38hlZSAFyivv2FvSaXO7YhAC3gbAV5ltP5MR0k6cqyenDDAQlZtkRW/ kjF5JievC7DbFWZIp5mGy3dKMjxG1unQaf4A5nrue6+1h5pPnj2GZnxYOtI3Qk0k aUgtw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedukeeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddupdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: iab3e480c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 00:08:56 -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 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 07/13] VFS: make lookup_one_qstr_excl() static. Date: Wed, 4 Feb 2026 15:57:51 +1100 Message-ID: <20260204050726.177283-8-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260204050726.177283-1-neilb@ownmail.net> References: <20260204050726.177283-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. Signed-off-by: NeilBrown Reviewed-by: Jeff Layton --- 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 ed3ac56e3c76..ed86c95d9d01 100644 --- a/Documentation/filesystems/porting.rst +++ b/Documentation/filesystems/porting.rst @@ -1340,3 +1340,10 @@ The ->setlease() file_operation must now be explicit= ly set in order to provide support for leases. When set to NULL, the kernel will now return -EINVAL to attempts to set a lease. Filesystems that wish to use the kernel-internal = lease implementation should set it to generic_setlease(). + +--- + +**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 40af78ddfb1b..307b4d0866b8 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1730,8 +1730,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; @@ -1768,7 +1768,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 Sun Feb 8 16:35:50 2026 Received: from flow-a6-smtp.messagingengine.com (flow-a6-smtp.messagingengine.com [103.168.172.141]) (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 9A59B352FA7; Wed, 4 Feb 2026 05:09:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181750; cv=none; b=GBVADWyTH2eQt/X5/euuDOHEsSXxN1E+tFDlsnNpzPcx7RkEbRsO0DO68SaFQ1K1Dmvp2giezNyihyGFS2iNR3kwT3u+/ZhyCXwfkW+mBXEufEVhTSQZyQEgEDunG6dnFHaDSXe3Qqkg3b18n4Gglca4cM+DJyWIuvCn6mIqWwM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181750; c=relaxed/simple; bh=UiKhd6cRVvyAPZpBDZyoF+ZxPC2lzBSUG/oEH68lhts=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F0/uv2ycIIkox5/aNga2jbaf5WnDGfSph7dynNybzlnpuNfZd24owNunl/JnLmOAc5297D96P5adNW4FTi2eAE42FeBCL5iZYpp7ph8SynFlPhXIQ2SFmUzyHZO3YBDL8VEPqa5ypkT8GideyFjxd5XXa87sKon3lsP+ty0Gxj4= 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=OQOjItrC; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=J9yqRo5O; arc=none smtp.client-ip=103.168.172.141 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="OQOjItrC"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="J9yqRo5O" Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailflow.phl.internal (Postfix) with ESMTP id D49981380795; Wed, 4 Feb 2026 00:09:09 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Wed, 04 Feb 2026 00:09:09 -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=1770181749; x=1770188949; bh=5s0iIT+XNExhLX4EVMTlOFY6+XLlXqu70qn6dIJpSIM=; b= OQOjItrCfoqOTOO9ryHcjEe4QYUAhupdEzR6GH1O63/IqBzDPntxEPnrjmI3h+5F IfhyBW/7htevNA4G1WLpw0Kb0j4MU/BL0ePnzTX23vdbEAdVXeq+0J2TmjngZauA dwgN96K/M9BMFJkHiX+uHpK3K5VfZpuCPb+HBSbvywq1b5xy+7+dSzY8NZf6DqZc rgPSEbbfAe9DOS5X2S1Sw2hF2ty4itbad6DPCExZ00B1Qcjy38WZGeXKCkZ193cy dyLgLaBTRcknE9RQJUJRlWV4rV9WLbN4L1YshKJoSitlb5bm5PY702X9TDLiQiJH J6WJzEBbij31dMK/t4n1Lw== 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=1770181749; x=1770188949; bh=5 s0iIT+XNExhLX4EVMTlOFY6+XLlXqu70qn6dIJpSIM=; b=J9yqRo5OJYO4ZfZ+T 7Gf4ML/54iRezOXns/GN8Uxk0PsbmYknQwxZn7DXedfLmhQwbc8Zpuj6mF8Mh6Dy sjJRL9wilM2OIFEvcqz7iKZnfdAIWxNnisOvMt2E37BHJkiB9tjpKUzNmzkvTobY jzftr8sSkxXThzHJIGYNQ17C76kxJA8cUCGDDqmb3byTIsgXNowQok3Nn+2o+wj7 AYgPaxwD0g8QE/c5pzNHRh5sqQT/rCEXdqBj8BYtWaYvvgeIkVcqMPGv4yx2i8Ug NkjcH1kGHHDQBn73lZc4sPUIcZupFCsm1sXUBroYtz0xAhhj3nRqPToJ8rXK93oY AyKzw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedukeeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddupdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: iab3e480c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 00:09:04 -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 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 08/13] ovl: Simplify ovl_lookup_real_one() Date: Wed, 4 Feb 2026 15:57:52 +1100 Message-ID: <20260204050726.177283-9-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260204050726.177283-1-neilb@ownmail.net> References: <20260204050726.177283-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:. Signed-off-by: NeilBrown Reviewed-by: Jeff Layton --- fs/overlayfs/export.c | 61 ++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 35 deletions(-) diff --git a/fs/overlayfs/export.c b/fs/overlayfs/export.c index 83f80fdb1567..dcd28ffc4705 100644 --- a/fs/overlayfs/export.c +++ b/fs/overlayfs/export.c @@ -359,59 +359,50 @@ static struct dentry *ovl_lookup_real_one(struct dent= ry *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. + * @connected is a directory in the overlay and @real is an object + * on @layer which is expected to be a child of @connected. + * The goal is to return a dentry from the overlay which corresponds + * to @real. This is done by looking up the name from @real in + * @connected and checking that the result meets expectations. + * + * Return %-ECHILD if the parent of @real no-longer corresponds to + * @connected, and %-ESTALE if the dentry found by lookup doesn't + * correspond to @real. */ - 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; =20 - /* - * We also 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 Sun Feb 8 16:35:50 2026 Received: from flow-a6-smtp.messagingengine.com (flow-a6-smtp.messagingengine.com [103.168.172.141]) (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 2DB30353EF6; Wed, 4 Feb 2026 05:09:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181758; cv=none; b=Xw7A3RbYigVU1cZmlxVd88uaVYtzWhdBYvISiRZzKLSP86ZATw/agYWGekNLTIo6u/sWH/ohaTQqYlMaDMeSOds3rr6ssW835cLX/pcF/25UM+FJPs/s+NHQ8xrkbiz4peiIBU2LZFv2PEOv6sIyIqTHAjiiK7/tx/820j7t/Nc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181758; c=relaxed/simple; bh=rH5ToO3KgPItJ2E1apkxbcYKMkFVXEoaa92XHEKaQxM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tQ1xRqbQ6TRn4owcta2vIA3n5Vh3iSv0Q3W4q4G6KvR+WkRDaaQ2UuYrnYE8t2wGECRaW9IVRavRoOjJqVRrdzBdM81KCrodpKPPclEYVOS71ZyYH2cc3uFylEMICWFU57aZKp9/XQYsl5e5zPM6frQf/OJqpdZwusiodVwLCVM= 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=nCx5KwkU; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=A3i3ZoJq; arc=none smtp.client-ip=103.168.172.141 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="nCx5KwkU"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="A3i3ZoJq" Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailflow.phl.internal (Postfix) with ESMTP id 6BE721380795; Wed, 4 Feb 2026 00:09:17 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Wed, 04 Feb 2026 00:09:17 -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=1770181757; x=1770188957; bh=pN+yLpO/IC8bNZZqLlpN4OtI3NJ62DZfY8eOdtW8yW4=; b= nCx5KwkUvmOY2D+QWH/GTtAR4AsL/vjdDV+XleINbfEAk2Mlpe+XWaJLmCYXPgfw h1jfsrIZxighrad8sQB2zkKaQZ+XvpR3vUPyR2AQ/EINNlTC14yV8ljs82jDF8zY h55ztsImqG81i9MkG5T00sTYYS+FLyXDQnTGok49TiaflaCT9jkiXv+Y0Huy4dUI Qo5/OhlhAk62AIXd9vMdKS1lXwkd9JXays+ao+ATq2Y6G40VMdIqcwlaUvK8jIwT UNpIvlOHk8qegoUJVbmV+7IxW4Lsr3Ulk7HeG8ijr1LcW/WfY3SdO7zkn9uXauUT r5hRyq26yjoS4rdI0WQuWQ== 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=1770181757; x=1770188957; bh=p N+yLpO/IC8bNZZqLlpN4OtI3NJ62DZfY8eOdtW8yW4=; b=A3i3ZoJqkXJfDI1EQ JoXgeaBcZtTKsdMVLXUPPte9p4pifxnptHhaRHsz5gMZ7lHOXOYCW5siPKDs+hTi uC+auPjuM9uI1tzaN25+BcHHVaupOtOWW+8RLwXz7o2lYgYKZEzL30uOpBSX34X0 C7Rml1qF5MzgA2hg008FKfAgMPYYJM04YYBUEosOVcT5mQzdCWTJBCes80x+Hwka VthYG/fHgYkskpZ9dTk7j4e84MV/pu2aJ0pz8cOPMzYArYV38+faN3yMU1Ztqwsa fEzldh7JcohcdK/0UntB4lRWXljH3/JOMPhkAxdHXAgxhdC9TXX7+5ymB3NIptcN q0C9A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedukeeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddupdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: iab3e480c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 00:09:11 -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 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 09/13] cachefiles: change cachefiles_bury_object to use start_renaming_dentry() Date: Wed, 4 Feb 2026 15:57:53 +1100 Message-ID: <20260204050726.177283-10-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260204050726.177283-1-neilb@ownmail.net> References: <20260204050726.177283-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. Signed-off-by: NeilBrown Reviewed-by: Jeff Layton --- 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 Sun Feb 8 16:35:50 2026 Received: from flow-a6-smtp.messagingengine.com (flow-a6-smtp.messagingengine.com [103.168.172.141]) (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 9DB5B3542CC; Wed, 4 Feb 2026 05:09:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181765; cv=none; b=EufonnjQyYeyZD0JPTn/JVXMkk/BSvM+9yZ1SW1ua0ckpdfai437N1pXGnq/YLg7KBiiXJKVLD2TOTMA7AZo8mN2K6AbKve7R+bambMhKfzljaltVCiGWkAuRgMMDPAcg/TeTfdrzRWPY637jJ1yreQ35D6VGigu9mD/1EGQQYw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181765; c=relaxed/simple; bh=sEo96npQHfrM9Xw+dAcfcpavn/0Ov4UeSJyaPDDxEFM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WzjxWjrPLyc/hdVVcUAlYBcLsk/h1OcfTjyRToms5VLJQ0eirFhicrGbe5Ltv2lBNWNpYj/Evq6c8GlE54/vTayMFCNz7jDIVI+80wJrPSiGl+3aGCeFGWVCNbNWBOe7Z6fd+EUXQqEBvuV/n38hu8gfYNTf2/CO/P5pAWoaEs4= 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=E/sOgPKT; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=ZOvcqmcB; arc=none smtp.client-ip=103.168.172.141 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="E/sOgPKT"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="ZOvcqmcB" Received: from phl-compute-12.internal (phl-compute-12.internal [10.202.2.52]) by mailflow.phl.internal (Postfix) with ESMTP id 167271380795; Wed, 4 Feb 2026 00:09:25 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-12.internal (MEProxy); Wed, 04 Feb 2026 00:09:25 -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=1770181765; x=1770188965; bh=nJtSWChYFVufGICSrThoSoHlrNw9bn4Yse/vvvU70+A=; b= E/sOgPKToHWjYxZ6WIVxtMg9YuDoZQP0lcZ2muf991rjavLEhG+pl/gFz02ICbaP L/M17TOEmg2crZrRhARRBq5ukpFeBmgnqMQvU5G6WgQhvwJbxCDawutyFhC6Nlhe vobCn5z4kz4T6jHgcHv7teaPSFfnAu7Ay9VUI5SUA1rH/Uj78x6YGNcFHiODfLal PEro/Kgiy8kZls/H7Qn1t31kk0zWU4jUqdamK2Fm3svwKOVzyHoxEb5Mbph5LqDD YP722hFWE190uElSrRDc7Z8kesz4Fu/KUldnGz37+mwg3+6uxyQ/fJf3fameixJE MecIUqq88RblWsIofUCYNA== 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=1770181765; x=1770188965; bh=n JtSWChYFVufGICSrThoSoHlrNw9bn4Yse/vvvU70+A=; b=ZOvcqmcBE67ozty1S rVttn8hUDMPFlNtD7/lhG4wDoHsZmqTdmz8T82HxnxvlslRWWQdOXdkZT5/wrodS 7Fz8rnQCPhzj4PoFF50jwGWQ2wPqiRBQ/DJE7XviD0+iwL22XN2y5H4xWbQ0vHFq NodUgFjKZJsg0sFtZOtPD9i6eiHbd9VobQAUA/bQDU941rwF/50JkT+6twrspaan uS0Y0gzLjHRVad5RH6NNUtTy2FKunqV4+gvX7sbBF1tjajLaDPLhCXcUID/l/14D NVU5cXGi3YnIhdJHVyCQf28d6R2RF/JiMDshKLxAGjFZVAwXNfBGgnwLz8VLpqno MUXVg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedukeeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddupdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: iab3e480c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 00:09:19 -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 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 10/13] ovl: change ovl_create_real() to get a new lock when re-opening created file. Date: Wed, 4 Feb 2026 15:57:54 +1100 Message-ID: <20260204050726.177283-11-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260204050726.177283-1-neilb@ownmail.net> References: <20260204050726.177283-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. This removes the only remaining use of ovl_lookup_upper, so it is removed. Signed-off-by: NeilBrown --- fs/overlayfs/dir.c | 24 ++++++++++++++++++------ fs/overlayfs/overlayfs.h | 7 ------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c index ff3dbd1ca61f..ec08904d084d 100644 --- a/fs/overlayfs/dir.c +++ b/fs/overlayfs/dir.c @@ -219,21 +219,33 @@ struct dentry *ovl_create_real(struct ovl_fs *ofs, st= ruct dentry *parent, err =3D -EIO; } else if (d_unhashed(newdentry)) { struct dentry *d; + struct name_snapshot name; /* * 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. + * 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)) + take_dentry_name_snapshot(&name, newdentry); + end_creating_keep(newdentry); + d =3D ovl_start_creating_upper(ofs, parent, &name.name); + release_dentry_name_snapshot(&name); + + 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; + dput(newdentry); + } else { + dput(newdentry); return d; + } + return ERR_PTR(err); } out: if (err) { diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h index 315882a360ce..4fb4750a83e4 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, --=20 2.50.0.107.gf914562f5916.dirty From nobody Sun Feb 8 16:35:50 2026 Received: from flow-a6-smtp.messagingengine.com (flow-a6-smtp.messagingengine.com [103.168.172.141]) (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 4BF5A3557F6; Wed, 4 Feb 2026 05:09:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181773; cv=none; b=cn70DPAXw3NSOGL1jSR8IyFZuwIod33PL1v6aR5hmxRYNj6oWxPaXxK0w+txTeZ4M/+PJheen4ieDmOl2P7Md4WSyEWdZZ1N6Qp7OTkkuVJ5qE+8xJd3Lu321mcj2K8kk1x/nlQTXIKSMQ7UjeAvNeNulclEcbGcVFiOzCsEACE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181773; c=relaxed/simple; bh=YqnWdgl+BCgKKNsdBVG/vaKwe9vRryUA+Go53D9kPVQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lbQVRkjQek1qJk6z1fCW1NvjCWToQFoeq+vwinLlxt7MI0VpxXFgwF3IjH000kpdPMM2KIjUfot4vLIam3yrtKAMW+FHA/RCssPEIhPpVVbsBUhCe4baoumFDtvHwbuU52lKsPtm25orL68257nu07VT8LzIODPyxVGenzuxULE= 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=RqZMQe4W; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=itXUm3c3; arc=none smtp.client-ip=103.168.172.141 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="RqZMQe4W"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="itXUm3c3" Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailflow.phl.internal (Postfix) with ESMTP id B6E671380795; Wed, 4 Feb 2026 00:09:32 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Wed, 04 Feb 2026 00:09: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=1770181772; x=1770188972; bh=9U7bJknmYXYCA1dkmsoUlWkn0IRUITK1b1AZf1IzOUM=; b= RqZMQe4WnaihO+TWsj+gd7Ixiw0mbJ4BhG6QYZQDl28w/G7to6z2Kndv/bnsazjv ajyTccbCXciqla7nf/Cy66upnAQ7PwKH7j7UyNlSqRgM2068MAUDazTgucqF29H/ JtskH1hwDGJUCvjohGf1QWG/WrhQsdXx/xeB/vMaKagllaytn0zgfYYaSiGD1anJ NoKjThPVYSt6ucv5kuoqq/VacF6CEkN1Jm75ZzSuyixBBCMPjI7NulYyvl1aKhpj VoGxFdM872tb3NLpmRma0NQnnTIUWn2xDU+XhMXN/Px/5+1/d0bX7PkS1/ZlE+tS Dkaq4V7mZbi8EYCwVWqY+Q== 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=1770181772; x=1770188972; bh=9 U7bJknmYXYCA1dkmsoUlWkn0IRUITK1b1AZf1IzOUM=; b=itXUm3c3OeaQByV6J ECwwF2r+B+6H0ntCq8vLw0JfBSVwK1MdJVAetWwZwLOHyd5yvAmM6N6bPlmgKXAp HakA6/V3ET0r12K4hI9QCi31A/7kw7UiMP5z0TUh8OAsum+lScV1AOweiFYG+dh8 SGlbJd5XAmW/AJ+t3wXz03fDlc1Glm24haprX86ikXMVwC+6LbP9//3Zz6ZgqoIL NMIs0nmK2FSlzA55qbII4SJbkBJdTbFtmfmmBFGbnJdcCOomYJewWHp4+dGPIO24 uBEfcBOSSsBvSvfVX/fe2vitlNwnEUD3v6GvR8lqNgysh5FeGTK0Eq/ja3QmAmir hyPAg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedukeeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddupdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: iab3e480c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 00:09:27 -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 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 11/13] ovl: use is_subdir() for testing if one thing is a subdir of another Date: Wed, 4 Feb 2026 15:57:55 +1100 Message-ID: <20260204050726.177283-12-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260204050726.177283-1-neilb@ownmail.net> References: <20260204050726.177283-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. Signed-off-by: NeilBrown Reviewed-by: Amir Goldstein Reviewed-by: Jeff Layton --- 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 ba9146f22a2c..2fd3e0aee50e 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 Sun Feb 8 16:35:50 2026 Received: from flow-a6-smtp.messagingengine.com (flow-a6-smtp.messagingengine.com [103.168.172.141]) (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 003743542D4; Wed, 4 Feb 2026 05:09:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181781; cv=none; b=nGzTN5lMRUfRPU3CVS25x+cwYqWREo1DnZXWLyzi/b/FSHA+LRqVNV1LH43Y1r3atyYw6Tyfra+4tr/iuDuvc3W/GvXqcsMyJ22ePSFgQvEhStRW6Au4PJGxJGMMsakwC14WC3MY6DAAJphd9rtQWu6+u7QV8cPuJW8rekl+gIM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181781; c=relaxed/simple; bh=nqWal0iOV1tfqu1iiBXDGnrZqyugYCtEuXBL3nFrC9M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=s2TF5rhWfDctAaYLtq2jhbrmkbNL+8RnE5aR6TVJDQSbdB88/+BLEAbSEz0bkrNhk9xK1EP4ypjHgQAvbsmq7fhw2bF9XnMwZEzOPbbMXT2h2ZQRHAv1B++1qdSwBGizTpmS6hlwgoyzaZceDV5mNk+hUu6+R5ttu4wwkY4m1xA= 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=X6NQdBUW; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=kmB+ot27; arc=none smtp.client-ip=103.168.172.141 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="X6NQdBUW"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="kmB+ot27" Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailflow.phl.internal (Postfix) with ESMTP id 4099F1380795; Wed, 4 Feb 2026 00:09:40 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Wed, 04 Feb 2026 00:09: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=1770181780; x=1770188980; bh=8uvFxwZx470aImGVKlG0uaaAm+xyg6DFqB4tuvF9Ezc=; b= X6NQdBUWgv9UAfWXzK36C8w6nTRgTe0N5Z1gJvzM7DoG6VAuIZku11+m9hcSC/ZB aXmrlSfdDvDZS2SmrHomjEjDLoAkT8Uq3jau2H9dzWwcHwtzpzdWk+2NE+52+v5h zsxOwTsy93vCnnsXnNLsxPeikb/9IpQ7v8C9GVWepGp59Na98ypFSUEoye89WJC0 5CSgMh28x6lqapknOxx3AdHOiG8qXXTxBeXjCHRDfr11qfc8p59PqRqB0i97pYIw DJMCB0SZgzHSH69zxksTi56OMZSkna58XtCRmfNHnvSqHJ/XmYBa56CaApY0rwhk Mqlax1kLntLtkzG4xh4Qvw== 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=1770181780; x=1770188980; bh=8 uvFxwZx470aImGVKlG0uaaAm+xyg6DFqB4tuvF9Ezc=; b=kmB+ot27SP14nRc3Z ExPswFqN3VilfHWndDFQ6rvtgXowfuRBGj2WbnZiuzvRMypLthjxQR5eIYSI425k QFNCsHUt7piO42NFv8jXjEucTrpD4+IB+MEqx1o7fL7w3pUvciWSopZL9AeNHsCO +YpHhHGTKuvM1bwldq0VVCXBIW99BoOxpIXFzBSg6gSBvDmW8oRn9029PN46PdmC U0eG3+7Jjpp3FyYZM57sq6htOJJEVNBsUHuUMmA/8YA12DW/PkiDqTE8uE1XyqAr Ron7Q2ikWLhSnc2+x18eAVSwnrRbB8SZx9RQNGy9UqUDHFmsol3+XnTeE01Jx6ev H5+nQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedukeeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddupdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: iab3e480c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 00:09: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 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 12/13] ovl: remove ovl_lock_rename_workdir() Date: Wed, 4 Feb 2026 15:57:56 +1100 Message-ID: <20260204050726.177283-13-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260204050726.177283-1-neilb@ownmail.net> References: <20260204050726.177283-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. Signed-off-by: NeilBrown Reviewed-by: Amir Goldstein Reviewed-by: Jeff Layton --- 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 4fb4750a83e4..3eedc2684c23 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 94986d11a166..810c8752b4f7 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 Sun Feb 8 16:35:50 2026 Received: from flow-a6-smtp.messagingengine.com (flow-a6-smtp.messagingengine.com [103.168.172.141]) (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 9733235503B; Wed, 4 Feb 2026 05:09:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.141 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181788; cv=none; b=CjB0s7cfL9OvLGfgheDcMovh69Txv5i5QIuneFIc09tqQz/BI48W8KZG0upBxg0AmIVHpvIzdv/cMH2QJG1E6YHlxjiPsNlID5LlHipo/083ngST1Wm80ITxFPirLY8AyzT0xhc8su/1H1DKmzjb47e2zJqvGRkmPRrWCV7fHXI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770181788; c=relaxed/simple; bh=EcuUci3NrafWHA9mqFebcPpgK+jW1TgeLPfYj6hWJgo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Cqd8zYgwRIS3Q7LC7HhU9SIc2FFLxrpaBZZiQOWY0cyLUL52JEf5gH49Bn2sKojAPICLIRUuN7UydqWDK0vn/G+RvXZnhlqTa2PPqStHdHtH8Svo+KjdVUA1T+Du1T2gYVMWViBoCnt/IkKuolMMPpXZirXAKjg55L2G8GE9rt8= 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=IA/OH9nB; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=VvpC2+sx; arc=none smtp.client-ip=103.168.172.141 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="IA/OH9nB"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="VvpC2+sx" Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailflow.phl.internal (Postfix) with ESMTP id C45231380795; Wed, 4 Feb 2026 00:09:47 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Wed, 04 Feb 2026 00:09:47 -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=1770181787; x=1770188987; bh=FodiWxTGOrcO4kqPhH8V5J2d81hZRju7CaAdC0kBghU=; b= IA/OH9nBkl0L/V4jFP0mIYu5PuKIWyyOkTV1eMHW4QZ7laA9FwSl+rvwQD8LUZIp unDzrnaePoojghi7bR9bhXeZN06pX2dwTMqHCe9tI2g/fRs+DQIix/0+kn6nxe9T hsMLoe0UHc3+8Vy+XcMCdLkvasUKBJ7HwwMkdy8dFVFW/QTWdqwOtPjAe32LnlbH HQiWbqoxnPWmxAgTymOh89AME4UI3S9tm9r+x6bDau0zH6ZV8haZEJ0Xf2lZIOlU Gyp9nLt58dFVVQMHoXoGcNmfvQagYknwlVX8k7P9hbOdpFiGdxL6JXqayrorAjmG +L3C6kyZ83Yk/IpCvuiFGA== 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=1770181787; x=1770188987; bh=F odiWxTGOrcO4kqPhH8V5J2d81hZRju7CaAdC0kBghU=; b=VvpC2+sxldBw2tIOW 77AL6W0NTYq6ye2ZXiZ6qd6fJui28cxi+I6rws1ykZaKi8AO5OrEWElgFhEZrjW0 DNHvITXcnfTkgCsX6s6duFifX3jwG8J5XNp1iGHv0fFCAiLwqn3c7jmhrt+GhSZY cmh4lZmKT0BIAZBJqjxaYyuf53nTkzqLtPRTbnmxMDndi6K3W7OU9B6eHmueuARz 7g5vX6ai8jIhDKtxb/CqwfxGxnNY2FNSxW0H0img3B+L8yvltu+hOkXcCHsIWzsI PPDD37WzgTyV7h/3LSwqo+hU6AcUKoUNXOVsA2Hv9E6PXTzKf4e7DrjTfKRASpSy NpyOg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedukeeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpefpvghilheu rhhofihnuceonhgvihhlsgesohifnhhmrghilhdrnhgvtheqnecuggftrfgrthhtvghrnh epveevkeffudeuvefhieeghffgudektdelkeejiedtjedugfeukedvkeffvdefvddunecu vehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmrghilhhfrhhomhepnhgvihhlsg esohifnhhmrghilhdrnhgvthdpnhgspghrtghpthhtohepvddupdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehvihhrohesiigvnhhivhdrlhhinhhugidrohhrghdruhhkpd hrtghpthhtohepshgvlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphht thhopehlihhnuhigqdhunhhiohhnfhhssehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtg hpthhtoheplhhinhhugidqshgvtghurhhithihqdhmohguuhhlvgesvhhgvghrrdhkvghr nhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhnfhhssehvghgvrhdrkhgvrhhnvg hlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhn vghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvg hrnhgvlhdrohhrghdprhgtphhtthhopehmihhklhhoshesshiivghrvgguihdrhhhupdhr tghpthhtohepjhgrtghksehsuhhsvgdrtgii X-ME-Proxy: Feedback-ID: iab3e480c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Feb 2026 00:09: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 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 13/13] VFS: unexport lock_rename(), lock_rename_child(), unlock_rename() Date: Wed, 4 Feb 2026 15:57:57 +1100 Message-ID: <20260204050726.177283-14-neilb@ownmail.net> X-Mailer: git-send-email 2.50.0.107.gf914562f5916.dirty In-Reply-To: <20260204050726.177283-1-neilb@ownmail.net> References: <20260204050726.177283-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. Signed-off-by: NeilBrown Reviewed-by: Jeff Layton --- 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 ed86c95d9d01..5f7008172f14 100644 --- a/Documentation/filesystems/porting.rst +++ b/Documentation/filesystems/porting.rst @@ -1347,3 +1347,10 @@ implementation should set it to generic_setlease(). =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 307b4d0866b8..0bc82bf90adc 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3713,7 +3713,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); @@ -3723,12 +3723,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) { /* @@ -3765,9 +3764,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) { @@ -3775,7 +3773,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