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

NeilBrown neilb at ownmail.net
Thu Jun 25 20:17:07 PDT 2026


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 at redhat.com>
> cc: Paulo Alcantara <pc at manguebit.org>
> cc: NeilBrown <neil at brown.name>
> cc: netfs at lists.linux.dev
> cc: linux-fsdevel at vger.kernel.org
> ---
>  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;
> 
> 
> 




More information about the linux-afs mailing list