Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177579512
D53086.1794791756.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D53086.1794791756.diff
View Options
diff --git a/sbin/mount_fusefs/mount_fusefs.8 b/sbin/mount_fusefs/mount_fusefs.8
--- a/sbin/mount_fusefs/mount_fusefs.8
+++ b/sbin/mount_fusefs/mount_fusefs.8
@@ -171,6 +171,9 @@
.Xr statfs 2 .
This option can be used to identify the file system implemented by
.Ar fuse_daemon .
+.It Cm auto_unmount
+Instructs the kernel to unmount the mount point when the FUSE device gets closed.
+This ensures a proper cleanup if the FUSE daemon exits abnormally.
.El
.El
.Pp
diff --git a/sbin/mount_fusefs/mount_fusefs.c b/sbin/mount_fusefs/mount_fusefs.c
--- a/sbin/mount_fusefs/mount_fusefs.c
+++ b/sbin/mount_fusefs/mount_fusefs.c
@@ -84,6 +84,8 @@
{ "automounted", 0, ALTF_AUTOMOUNTED, 1 },
#define ALTF_INTR 0x200
{ "intr", 0, ALTF_INTR, 1 },
+ #define ALTF_AUTOUNMOUNT 0x400
+ { "auto_unmount", 0, ALTF_AUTOUNMOUNT, 1 },
/* Linux specific options, we silently ignore them */
{ "fd=", 0, 0x00, 1 },
{ "rootmode=", 0, 0x00, 1 },
diff --git a/sys/fs/fuse/fuse_device.c b/sys/fs/fuse/fuse_device.c
--- a/sys/fs/fuse/fuse_device.c
+++ b/sys/fs/fuse/fuse_device.c
@@ -65,7 +65,6 @@
#include <sys/module.h>
#include <sys/systm.h>
#include <sys/errno.h>
-#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/conf.h>
#include <sys/uio.h>
@@ -177,6 +176,11 @@
fuse_lck_mtx_unlock(fdata->ms_mtx);
FUSE_UNLOCK();
+ if (fdata->mp && fdata->dataflags & FSESS_AUTO_UNMOUNT) {
+ vfs_ref(fdata->mp);
+ dounmount(fdata->mp, MNT_FORCE, curthread);
+ }
+
fdata_trydestroy(fdata);
}
diff --git a/sys/fs/fuse/fuse_ipc.h b/sys/fs/fuse/fuse_ipc.h
--- a/sys/fs/fuse/fuse_ipc.h
+++ b/sys/fs/fuse/fuse_ipc.h
@@ -242,8 +242,9 @@
#define FSESS_WARN_INODE_MISMATCH 0x4000000 /* ino != nodeid */
#define FSESS_MNTOPTS_MASK ( \
FSESS_DAEMON_CAN_SPY | FSESS_PUSH_SYMLINKS_IN | \
- FSESS_DEFAULT_PERMISSIONS | FSESS_INTR)
+ FSESS_DEFAULT_PERMISSIONS | FSESS_INTR | FSESS_AUTO_UNMOUNT)
#define FSESS_SETXATTR_EXT 0x8000000 /* extended fuse_setxattr_in */
+#define FSESS_AUTO_UNMOUNT 0x10000000 /* perform unmount when server dies */
extern int fuse_data_cache_mode;
diff --git a/sys/fs/fuse/fuse_vfsops.c b/sys/fs/fuse/fuse_vfsops.c
--- a/sys/fs/fuse/fuse_vfsops.c
+++ b/sys/fs/fuse/fuse_vfsops.c
@@ -337,6 +337,7 @@
FUSE_FLAGOPT(push_symlinks_in, FSESS_PUSH_SYMLINKS_IN);
FUSE_FLAGOPT(default_permissions, FSESS_DEFAULT_PERMISSIONS);
FUSE_FLAGOPT(intr, FSESS_INTR);
+ FUSE_FLAGOPT(auto_unmount, FSESS_AUTO_UNMOUNT);
(void)vfs_scanopt(opts, "max_read=", "%u", &max_read);
(void)vfs_scanopt(opts, "linux_errnos", "%d", &linux_errnos);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 16, 1:15 AM (20 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41753600
Default Alt Text
D53086.1794791756.diff (2 KB)
Attached To
Mode
D53086: fusefs: kernel-based implementation of auto_unmount
Attached
Detach File
Event Timeline