Page MenuHomeFreeBSD

fusefs: support EVFILT_WRITE on /dev/fuse
ClosedPublic

Authored by asomers on Jun 16 2021, 12:59 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Oct 1, 5:02 PM
Unknown Object (File)
Sep 30 2024, 2:12 PM
Unknown Object (File)
Sep 25 2024, 7:29 PM
Unknown Object (File)
Aug 26 2024, 10:00 PM
Unknown Object (File)
Aug 19 2024, 8:09 AM
Unknown Object (File)
Aug 16 2024, 12:03 AM
Unknown Object (File)
Aug 12 2024, 4:01 AM
Unknown Object (File)
Jun 20 2024, 10:02 PM
Subscribers

Details

Summary

fusefs: support EVFILT_WRITE on /dev/fuse

/dev/fuse is always ready for writing, so it's kind of dumb to poll it.
But some applications do it anyway. Better to return ready than EINVAL.

MFC after: 2 weeks

Test Plan

Existing kqueue test modified to use kqueue for writing as well as for reading. Tested with a real file system from https://github.com/Sherlock-Holo/fuse3

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 39927
Build 36816: arc lint + arc unit

Event Timeline

tests/sys/fs/fusefs/mockfs.cc
870–871

Curious about this change

tests/sys/fs/fusefs/mockfs.cc
870–871

It's necessary to make the tests pass, though I could've done it a different way. The problem is that line 943 adds the EVFILT_WRITE filter to the same fd. When control comes back around to here, kevent() immediately returns because EVFILT_WRITE is still set, and and file descriptor is always writable. So adding EV_ONESHOT at 943 prevents kevent here from returning too soon. And I added EV_ONESHOT here for symmetry's sake, and because line 943 doesn't care about readability.

Alternatively, I could've added EV_ONESHOT at line 943 only; that would've worked. Or, I could've set EV_DISABLE on EVFILT_READ at line 946 or here.

This revision is now accepted and ready to land.Jun 16 2021, 5:06 PM
This revision was automatically updated to reflect the committed changes.