From nobody Sat Jan 24 10:06:32 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dyr6x1MZSz6PYPR for ; Sat, 24 Jan 2026 10:06:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dyr6x07Bxz3FZK for ; Sat, 24 Jan 2026 10:06:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1769249193; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Dudhl9qHpo3FL5/LhAsw9keIeIiP5rEWDH8+HsyeIJ8=; b=eI9THe1PkNJ9RzNkteDkY7fF9uXea9tWYARiqGHrQSj5SpeOPB7/0E3r3lK18DtPMN4iib r+GeNV62HQwoEscZWklLLeYy5bcsyrqwzXDKq2IVJsU4lvGmLazrk9HAIyxdTDs4Ygzw/F NrrSFtC3opMce3d3W/KcymZOuA58YKjbWblecnlZlULSlTekhfnwftkmoH/RWTvIFWgzJ0 5fyfaftQlOJ5KO7u4Vuv1i+Ge42Mq/Pa/HB0TED3+QxJzaDgjH0UZNGYwRd0uHGCHXsxFf BESyNTwFhc5fHYVM5ch/dg2ZH618cxrEJu64ALqD+9CKK9k6I5rxLyWxOpsUMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1769249193; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Dudhl9qHpo3FL5/LhAsw9keIeIiP5rEWDH8+HsyeIJ8=; b=qBCdiSQH7yye6L/aG8ddNOBCKSRs9M/qWyolr3l0u44sBXpT3r2h2/Ej8KcZrQLTJG0pw7 ivUOeDKIurIBCGzVaNDjvzxEU0C1vIccOy/bdkdDCxUdphU0o/6RFI8TI+sm42CsMQniIG U1bHjIAQ9ivZzn6DtCbKm/GsaB56PS1JwHC1k0NrA6N8tUNHnNzllPznaxngdw1UlUnMib AFYtk5HgBdabjo5KOGB4LjSzomX3FtC/UqsgpAsAZeg51dryMtFlDER+QzlUyKIxsp6szv O2IETXW9LhL8Gk7Fw5IiRwNAcj2vkRkKNMegO5Wn/NVn4cEhchBTHEdB2rSBWw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1769249193; a=rsa-sha256; cv=none; b=mMXAaTyLzChBut42jK30U77Q1j6sJobsS/+KR0w8Zw7NibBMlPt9h89X43y1VuqZsUOQWJ EEq06czm3K3lzd+eHwrGT9BLk1Ffd/9YOR5snZpKhTNJh80Ku2B9tbNrMFwckC+ld3QpE2 cC03wBxaVb9AKzy/YP5ory8gvPCj/6atrKHOXPpIgWI6FUHA1mor+cSDHjPQPcp5GM6xAg KUx+TAt3RokVOXkpJJT9SFEFjc14DI2jRtV1x9Y0Dioyb21NW/EODlDGGT0AWJuBtUht1w y84bzLBzKpkUdT1f3w/fsOREhsuSPc3rDoNBXNk7xasCXDj8Lg4nBwguF3m4/w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dyr6w6l2Wz119w for ; Sat, 24 Jan 2026 10:06:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 335a0 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 24 Jan 2026 10:06:32 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Popov Subject: git: 10037d0978f8 - main - fusefs: Implement support for the auto_unmount option kernel-side List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 10037d0978f8b16dc6746b0b942788e5edc6e84f Auto-Submitted: auto-generated Date: Sat, 24 Jan 2026 10:06:32 +0000 Message-Id: <697499a8.335a0.2e12eda1@gitrepo.freebsd.org> The branch main has been updated by arrowd: URL: https://cgit.FreeBSD.org/src/commit/?id=10037d0978f8b16dc6746b0b942788e5edc6e84f commit 10037d0978f8b16dc6746b0b942788e5edc6e84f Author: Gleb Popov AuthorDate: 2025-10-14 16:15:50 +0000 Commit: Gleb Popov CommitDate: 2026-01-24 10:06:16 +0000 fusefs: Implement support for the auto_unmount option kernel-side libfuse clients may pass the "-o auto_unmount" flag to ensure that the mountpoint will get unmounted even if the server terminate abnormally. Without this flag sending KILL to a FUSE daemon leaves its mountpoint mounted. Approved by: asomers Differential Revision: https://reviews.freebsd.org/D53086 --- sbin/mount_fusefs/mount_fusefs.8 | 5 ++++- sbin/mount_fusefs/mount_fusefs.c | 2 ++ sys/fs/fuse/fuse_device.c | 6 +++++- sys/fs/fuse/fuse_ipc.h | 3 ++- sys/fs/fuse/fuse_vfsops.c | 1 + 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/sbin/mount_fusefs/mount_fusefs.8 b/sbin/mount_fusefs/mount_fusefs.8 index 44f7e029dec6..a463f6463a29 100644 --- a/sbin/mount_fusefs/mount_fusefs.8 +++ b/sbin/mount_fusefs/mount_fusefs.8 @@ -32,7 +32,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 9, 2021 +.Dd January 24, 2026 .Dt MOUNT_FUSEFS 8 .Os .Sh NAME @@ -171,6 +171,9 @@ to the file system name as reported by .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 index 2d65494421ef..a4e33ad6878e 100644 --- a/sbin/mount_fusefs/mount_fusefs.c +++ b/sbin/mount_fusefs/mount_fusefs.c @@ -84,6 +84,8 @@ static struct mntopt mopts[] = { { "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 index 41387de3ce71..2c1e19953dfd 100644 --- a/sys/fs/fuse/fuse_device.c +++ b/sys/fs/fuse/fuse_device.c @@ -65,7 +65,6 @@ #include #include #include -#include #include #include #include @@ -177,6 +176,11 @@ fdata_dtor(void *arg) 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 index d9d79f38c269..98af84951561 100644 --- a/sys/fs/fuse/fuse_ipc.h +++ b/sys/fs/fuse/fuse_ipc.h @@ -242,8 +242,9 @@ struct fuse_data { #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 index 0ff79913128a..a5118aa7675f 100644 --- a/sys/fs/fuse/fuse_vfsops.c +++ b/sys/fs/fuse/fuse_vfsops.c @@ -337,6 +337,7 @@ fuse_vfsop_mount(struct mount *mp) 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);