[PATCH 7.1 1394/2077] cachefiles: Fix file burial to take lock when unsetting S_KERNEL_FILE

Greg Kroah-Hartman <[email protected]> Tue, 21 Jul 2026 17:17:47 +0200
Newsgroups dev.linux.lists.netfs,dev.linux.lists.patches,org.kernel.vger.linux-fsdevel,org.kernel.vger.stable
Message-ID <[email protected]>
7.1-stable review patch.  If anyone has any objections, please let me know.

------------------

From: David Howells <[email protected]>

[ Upstream commit 511a018ed2afd8d415edd307ce7ad2048506f6a1 ]

Fix cachefiles_bury_object() to lock the inode of the file being buried
whilst it unsets the S_KERNEL_FILE flag.

Fixes: 07a90e97400c ("cachefiles: Implement culling daemon commands")
Closes: https://sashiko.dev/#/patchset/20260616100821.2062304-1-dhowells%40redhat.com
Signed-off-by: David Howells <[email protected]>
Link: https://patch.msgid.link/[email protected]
cc: Paulo Alcantara <[email protected]>
cc: NeilBrown <[email protected]>
cc: [email protected]
cc: [email protected]
Signed-off-by: Christian Brauner (Amutable) <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
 fs/cachefiles/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c
index 2c46f0decb02e4..90200410dcfd40 100644
--- a/fs/cachefiles/namei.c
+++ b/fs/cachefiles/namei.c
@@ -374,7 +374,7 @@ int cachefiles_bury_object(struct cachefiles_cache *cache,
 					    "Rename failed with error %d", ret);
 	}
 
-	__cachefiles_unmark_inode_in_use(object, d_inode(rep));
+	cachefiles_do_unmark_inode_in_use(object, d_inode(rep));
 	end_renaming(&rd);
 	_leave(" = 0");
 	return 0;
-- 
2.53.0