Re: [GIT PULL] fuse update for 6.19
From: Al Viro
Date: Fri Dec 05 2025 - 22:10:22 EST
On Sat, Dec 06, 2025 at 02:28:26AM +0000, Al Viro wrote:
> On Fri, Dec 05, 2025 at 05:52:51PM -0800, Linus Torvalds wrote:
> > On Fri, 5 Dec 2025 at 17:42, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
> > >
> > > Far more interesting question, IMO, is what's to prevent memory
> > > pressure from evicting the damn argument right under us.
> >
> > That was my first reaction, but look at the 'fuse_dentry_prune()' logic.
> >
> > So if the dentry is removed by the VFS layer, it should be removed here too.
>
> Sure, ->d_prune() would take it out of the rbtree, but what if it hits
> rb_erase(&fd->node, &dentry_hash[i].tree);
> RB_CLEAR_NODE(&fd->node);
> spin_unlock(&dentry_hash[i].lock);
> ... right here, when we are not holding any locks anymore?
> d_dispose_if_unused(fd->dentry, &dispose);
> cond_resched();
> spin_lock(&dentry_hash[i].lock);
... and with what fuse_dentry_prune() is doing, we can't grab ->d_lock
or bump ->d_count before dropping dentry_hash[...].lock. ->d_release()
is the one called outside of ->d_lock; ->d_prune() is under it, so we'd
get AB-BA deadlock if we tried to do that kind of stuff.
Moving the eviction to ->d_release() might be doable; then we'd have
fuse locks outside of ->d_lock and could call that thing under those.
I'll need to poke around some more, but TBH I don't like that primitive -
it's really easy to fuck up and conditions for its safe use are, AFAICS,
never spelled out.