Skip to content

Commit 1e2c1af

Browse files
Miklos Szeredibrauner
authored andcommitted
fuse: make sure dentry is evicted if stale
d_dispose_if_unused() may find the dentry with a positive refcount, in which case it won't be put on the dispose list even though it has already timed out. "Reinstall" the d_delete() callback, which was optimized out in fuse_dentry_settime(). This will result in the dentry being evicted as soon as the refcount hits zero. Fixes: ab84ad5 ("fuse: new work queue to periodically invalidate expired dentries") Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Link: https://patch.msgid.link/20260114145344.468856-3-mszeredi@redhat.com Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent cb8d2bd commit 1e2c1af

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

fs/fuse/dir.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ static void fuse_dentry_tree_work(struct work_struct *work)
172172
if (time_after64(get_jiffies_64(), fd->time)) {
173173
rb_erase(&fd->node, &dentry_hash[i].tree);
174174
RB_CLEAR_NODE(&fd->node);
175+
spin_lock(&fd->dentry->d_lock);
176+
/* If dentry is still referenced, let next dput release it */
177+
fd->dentry->d_flags |= DCACHE_OP_DELETE;
178+
spin_unlock(&fd->dentry->d_lock);
175179
d_dispose_if_unused(fd->dentry, &dispose);
176180
spin_unlock(&dentry_hash[i].lock);
177181
cond_resched();

0 commit comments

Comments
 (0)