mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 04:04:43 +01:00
vfs: document d_dispose_if_unused()
Add a warning about the danger of using this function without proper locking preventing eviction. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Link: https://patch.msgid.link/20260114145344.468856-7-mszeredi@redhat.com Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
fa79401a9c
commit
79d11311f6
1 changed files with 10 additions and 0 deletions
10
fs/dcache.c
10
fs/dcache.c
|
|
@ -1104,6 +1104,16 @@ struct dentry *d_find_alias_rcu(struct inode *inode)
|
|||
return de;
|
||||
}
|
||||
|
||||
/**
|
||||
* d_dispose_if_unused - move unreferenced dentries to shrink list
|
||||
* @dentry: dentry in question
|
||||
* @dispose: head of shrink list
|
||||
*
|
||||
* If dentry has no external references, move it to shrink list.
|
||||
*
|
||||
* NOTE!!! The caller is responsible for preventing eviction of the dentry by
|
||||
* holding dentry->d_inode->i_lock or equivalent.
|
||||
*/
|
||||
void d_dispose_if_unused(struct dentry *dentry, struct list_head *dispose)
|
||||
{
|
||||
spin_lock(&dentry->d_lock);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue