Re: PROBLEM: FUSE_NOTIFY_INVAL_ENTRY leaves stale negative dentry after c9ba789dad15
From: Miklos Szeredi
Date: Wed Jun 03 2026 - 05:43:37 EST
On Tue, 2 Jun 2026 at 01:43, NeilBrown <neilb@xxxxxxxxxxx> wrote:
> diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
> index b658b6baf72f..3f16ecbc358e 100644
> --- a/fs/fuse/dir.c
> +++ b/fs/fuse/dir.c
> @@ -1605,13 +1605,29 @@ int fuse_reverse_inval_entry(struct fuse_conn *fc, u64 parent_nodeid,
> struct dentry *child = try_lookup_noperm(name, dir);
> if (!child || IS_ERR(child))
> goto put_parent;
> - entry = start_removing_dentry(dir, child);
> - dput(child);
> - if (IS_ERR(entry))
> - goto put_parent;
> - if (!d_same_name(entry, dir, name)) {
> - end_removing(entry);
> - entry = NULL;
> + if (d_really_is_negative(child)) {
> + spin_lock(&child->d_lock);
> + if (d_really_is_negative(child)) {
> + fuse_dir_changed(parent);
> + if (!(flags & FUSE_EXPIRE_ONLY))
> + __d_drop(entry);
> + fuse_invalidate_entry_cache(entry);
s/entry/child/ for the above two lines
Otherwise looks good and tests OK.
Agree about the need for comments.
Thanks,
Miklos