Page MenuHomeFreeBSD

fusefs: kernel-based implementation of auto_unmount
AcceptedPublic

Authored by arrowd on Oct 14 2025, 4:27 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jan 21, 9:56 PM
Unknown Object (File)
Wed, Jan 21, 6:50 PM
Unknown Object (File)
Tue, Jan 20, 8:08 AM
Unknown Object (File)
Thu, Jan 15, 12:49 PM
Unknown Object (File)
Mon, Jan 5, 5:18 PM
Unknown Object (File)
Sun, Jan 4, 6:06 PM
Unknown Object (File)
Sun, Jan 4, 11:48 AM
Unknown Object (File)
Wed, Dec 31, 1:46 AM
Subscribers

Details

Reviewers
asomers
Summary

As it was suggested in D51549 here goes an attempt to implement the auto_unmount feature from within the kernel.

Corresponding libfuse changes are there: https://github.com/libfuse/libfuse/compare/master...arrowd:libfuse:kernel-bsd-auto-unmount

Diff Detail

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

Event Timeline

  • Fix hang by marking fdata dead

I have fixed the hang, but the filesystem still does not get unmounted.

  • Replace VOP_UNMOUNT with dounmount
  • Plunk vfs_ref before to avoid deadlock

This implementation seems to work now

sys/fs/fuse/fuse_vfsops.c
421

It seems to be too late to arm this flag there. I guess I'll have to set it from userspace.

  • Use cdev destructor to clean up the mount point instead of a .d_close method

This seems to work now. The change turned out to be surprisingly small.

@asomers Could you take a look?

arrowd retitled this revision from fusefs: draft kernel-based implementation of auto_unmount to fusefs: kernel-based implementation of auto_unmount.Thu, Jan 8, 2:09 PM

Ping.

Wow! This looks much simpler than the original userspace-based implementation. I like it. I wrote some tests, too. I can commit those separately if you like, after you commit the main code. The only thing that's missing is a mention of the new option in mount_fusefs.8 . Could you please add that?

sys/fs/fuse/fuse_ipc.h
243

This is going to conflict with e8449c0e0fcb8a3eb5872cbee5c3dde4b05a5f50 . Easy to resolve.

This revision now requires changes to proceed.Tue, Jan 20, 12:20 AM
  • Rebase
  • Update the man page

I can commit those separately if you like, after you commit the main code.

Thank you for following up with tests! I trust you to push them.

Approved, but don't forget to bump the man page's .Dd date.

This revision is now accepted and ready to land.Wed, Jan 21, 4:45 PM