Re: Fuse issue with attr caching expecting write lock

From: Alan Somers <asomers_at_freebsd.org>
Date: Sun, 07 Sep 2025 17:21:54 UTC
On Thu, Sep 4, 2025 at 6:15 PM Konstantin Belousov <kostikbel@gmail.com>
wrote:

> On Fri, Sep 05, 2025 at 01:36:39AM +0200, obiwac wrote:
> > Hi!
> >
> > When trying to access a large file with sshfs (on fuse), I get a
> > kernel panic because fuse_internal_cache_attrs is asserting a write
> > lock when it is sometimes being called from fuse_internal_do_getattr,
> > which only asserts a read lock.
> >
> > To me (i.e. someone who has never touched VFS or fuse code) this code
> > looks wrong, and fuse_internal_do_getattr should be acquiring a write
> > lock around its call to fuse_internal_cache_attrs, but clearly it has
> > been working just fine for a while now as this code hasn't changed
> > super recently so I could be missing something.
> It is only the assertions that were enabled recently.
>
> Mark merged DEBUG_VFS_LOCKS option into INVARIANTS.
>

 I'm not surprised to see bugs like this one, for the reason Kib stated.  I
suspect that there are many more, because DEBUG_VFS_LOCKS was historically
rarely used.  If you can come up with an easy reproduction case, please
open a ticket on bugzilla and CC me.  And BTW, my FreeBSD user name is
"asomers", not "alan.somers".