Re: [PATCH v3 04/15] cachefiles: Fix file burial to take lock when unsetting S_KERNEL_FILE

NeilBrown <[email protected]>
Newsgroups org.kernel.vger.ceph-devel,dev.linux.lists.netfs,org.kernel.vger.linux-cifs,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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 <[email protected]>
> cc: Paulo Alcantara <[email protected]>
> cc: NeilBrown <[email protected]>
> cc: [email protected]
> cc: [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 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;
> 
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.