[PATCH v5 07/14] VFS: introduce start_removing_dentry()
Namjae Jeon
linkinjeon at kernel.org
Thu Nov 6 01:56:01 UTC 2025
On Thu, Nov 6, 2025 at 9:55 AM NeilBrown <neilb at ownmail.net> wrote:
>
> From: NeilBrown <neil at brown.name>
>
> start_removing_dentry() is similar to start_removing() but instead of
> providing a name for lookup, the target dentry is given.
>
> start_removing_dentry() checks that the dentry is still hashed and in
> the parent, and if so it locks and increases the refcount so that
> end_removing() can be used to finish the operation.
>
> This is used in cachefiles, overlayfs, smb/server, and apparmor.
>
> There will be other users including ecryptfs.
>
> As start_removing_dentry() takes an extra reference to the dentry (to be
> put by end_removing()), there is no need to explicitly take an extra
> reference to stop d_delete() from using dentry_unlink_inode() to negate
> the dentry - as in cachefiles_delete_object(), and ksmbd_vfs_unlink().
>
> cachefiles_bury_object() now gets an extra ref to the victim, which is
> drops. As it includes the needed end_removing() calls, the caller
> doesn't need them.
>
> Reviewed-by: Amir Goldstein <amir73il at gmail.com>
> Signed-off-by: NeilBrown <neil at brown.name>
For ksmbd part,
Reviewed-by: Namjae Jeon <linkinjeon at kernel.org>
Thanks!
More information about the Linux-security-module-archive
mailing list