Re: [PATCH v3 04/15] cachefiles: Fix file burial to take lock when unsetting S_KERNEL_FILE
From: NeilBrown
Date: Thu Jun 25 2026 - 23:17:23 EST
On Fri, 26 Jun 2026, David Howells wrote:
> Fix cachefiles_bury_object() to lock the inode of the file being buried
> whilst it unsets the S_KERNEL_FILE flag.
It might be worth adding
lockdep_assert_held(&inode->i_rwsem);
in __cachefiles_unmark_inode_in_use()
and __cachefiles_mark_inode_in_use()
though all uses look safe after this patch.
Thanks,
NeilBrown
>
> Fixes: 07a90e97400c ("cachefiles: Implement culling daemon commands")
> Closes: https://sashiko.dev/#/patchset/20260616100821.2062304-1-dhowells%40redhat.com
> Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
> cc: Paulo Alcantara <pc@xxxxxxxxxxxxx>
> cc: NeilBrown <neil@xxxxxxxxxx>
> cc: netfs@xxxxxxxxxxxxxxx
> cc: linux-fsdevel@xxxxxxxxxxxxxxx
> ---
> 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 a464c4646c04..d4309dfb55df 100644
> --- a/fs/cachefiles/namei.c
> +++ b/fs/cachefiles/namei.c
> @@ -375,7 +375,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;
>
>
>