Page MenuHomeFreeBSD

fusefs: Fix vnode lock mismatch in fuse_internal_do_getattr()
AbandonedPublic

Authored by guest-seuros on Fri, Feb 6, 3:57 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Feb 11, 5:58 PM
Unknown Object (File)
Tue, Feb 10, 1:17 PM
Unknown Object (File)
Tue, Feb 10, 12:32 AM
Unknown Object (File)
Mon, Feb 9, 9:01 PM
Unknown Object (File)
Mon, Feb 9, 6:16 PM
Unknown Object (File)
Mon, Feb 9, 4:36 PM
Subscribers

Details

Reviewers
None
Summary

fuse_internal_cache_attrs() requires an exclusive vnode lock
(ASSERT_VOP_ELOCKED), but fuse_internal_do_getattr() can be called
with only a shared lock from the read path:

fuse_read_biobackend() [LK_SHARED]
 => fuse_vnode_size()
    -> fuse_internal_do_getattr()
      => fuse_internal_cache_attrs() [needs LK_EXCLUSIVE]

This caused lock assertion panics during read operations.

Test Plan

The panic was happening when i tried to write files to an usb exfat.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 70471
Build 67354: arc lint + arc unit

Event Timeline

guest-seuros held this revision as a draft.
guest-seuros edited the test plan for this revision. (Show Details)

Thanks for your attention in this area. As a matter of fact, I've been working on this exact same problem. My first attempt at a solution was close to this one, but ultimately it won't work. Today I'm going to try a different solution, based on mutex protection rather than the vnode lock. I'll update Bugzilla when I have a working patch, so you can subscribe to this bug to find out.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=283391

Sure i can close this diff.

But can you tell me what won't work ? I use 16-Current and have INVARIANTS

after this patch, i could transfer 50GB without any issue to the usb, checked checksum and all.

The system is stable for many days now.

Sure i can close this diff.

But can you tell me what won't work ? I use 16-Current and have INVARIANTS

There are other code paths that also need to modify the cached attributes, but where it isn't possible to upgrade the vnode lock to exclusive.