Linux filesystem development
 help / color / mirror / Atom feed
* [PATCHBOMB] libfuse: various fixes for new mount code
@ 2026-05-05  5:21 Darrick J. Wong
  2026-05-05  5:23 ` [PATCHSET 1/2] libfuse: new mount API and SYNC_INIT fixes Darrick J. Wong
                   ` (3 more replies)
  0 siblings, 4 replies; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05  5:21 UTC (permalink / raw)
  To: bernd; +Cc: linux-fsdevel, fuse-devel, miklos, neal, joannelkoong

Hi Bernd,

The two patchsets under this message try to fix various bugs in both
yours and my new fuse filesystem mounting code.

The first patchset branches off the "fuse-service-container" branch on
your private github account and fixes a couple of problems I noticed in
the new SYNC_INIT + fsmount code.  I think they should be applied to
libfuse master sooner than later since all that stuff is in master now.

https://git.kernel.org/pub/scm/linux/kernel/git/djwong/libfuse.git/log/?h=fuse-mount-api-fixes_2026-05-04

The second patchset contains some latent bugfixes that I put into my
branch after you pulled my series *and* what I hope are sufficient
corrections to resolve all the new cppcheck complaints that you sent me.
I have now managed to (I think) replicate your setup exactly enough that
I can run it here independently.

https://git.kernel.org/pub/scm/linux/kernel/git/djwong/libfuse.git/log/?h=fuse-service-container-fixes_2026-05-04

--D

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCHSET 1/2] libfuse: new mount API and SYNC_INIT fixes
  2026-05-05  5:21 [PATCHBOMB] libfuse: various fixes for new mount code Darrick J. Wong
@ 2026-05-05  5:23 ` Darrick J. Wong
  2026-05-05  5:23   ` [PATCH 1/2] libfuse: don't use SYNC_INIT unless asked for Darrick J. Wong
                     ` (2 more replies)
  2026-05-05  5:23 ` [PATCHSET 2/2] libfuse: new mount service container fixes Darrick J. Wong
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05  5:23 UTC (permalink / raw)
  To: djwong, bernd; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos

Hi all,

Here's a collection of bug fixes and cppcheck cleanups for the new mount
API code and the new SYNC_INIT code that landed in main recently.

With a bit of luck, this should all go splendidly.
Comments and questions are, as always, welcome.

--D
---
Commits in this patchset:
 * libfuse: don't use SYNC_INIT unless asked for
 * libfuse: always send the subtype to the kernel when using fsconfig()
---
 lib/fuse_lowlevel.c  |    6 +++---
 lib/mount_fsmount.c  |   13 +++++++++++++
 util/mount_service.c |    3 ++-
 3 files changed, 18 insertions(+), 4 deletions(-)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCHSET 2/2] libfuse: new mount service container fixes
  2026-05-05  5:21 [PATCHBOMB] libfuse: various fixes for new mount code Darrick J. Wong
  2026-05-05  5:23 ` [PATCHSET 1/2] libfuse: new mount API and SYNC_INIT fixes Darrick J. Wong
@ 2026-05-05  5:23 ` Darrick J. Wong
  2026-05-05  5:24   ` [PATCH 01/10] util/mount.fuse.c: loop in waitpid Darrick J. Wong
                     ` (10 more replies)
  2026-05-05  5:26 ` [GIT PULL 1/2] libfuse: new mount API and SYNC_INIT fixes Darrick J. Wong
  2026-05-05  5:26 ` [GIT PULL 2/2] libfuse: new mount service container fixes Darrick J. Wong
  3 siblings, 11 replies; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05  5:23 UTC (permalink / raw)
  To: djwong, bernd; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos

Hi all,

This is a collection of bug fixes and cppcheck cleanups for the new fuse
service container code.

With a bit of luck, this should all go splendidly.
Comments and questions are, as always, welcome.

--D
---
Commits in this patchset:
 * util/mount.fuse.c: loop in waitpid
 * fuse_service: handle weird behavior during SCM_RIGHTS fd transfers
 * examples: improve documentation of the new systemd service fuse servers
 * example/single_file: sync backing fd when statx wants us to fsync
 * example/single_file: fix ctime handling
 * libfuse: fix cppcheck complaints about constifying pointers
 * libfuse: fix cppcheck complaints about constifying pointers in user-visible ABI
 * util: fix cppcheck complaints about constifying pointers
 * fuser_conf: fix cppcheck complaints
 * example: fix cppcheck complaints about constifying pointers
---
 example/single_file.h   |    6 +++-
 include/fuse_service.h  |   18 ++++++-----
 example/service_hl.c    |   20 +++++++++++-
 example/service_ll.c    |   20 +++++++++++-
 example/single_file.c   |   31 ++++++++++++++++---
 lib/fuse_service.c      |   76 ++++++++++++++++++++++++++++++++---------------
 lib/fuse_service_stub.c |   17 ++++++-----
 util/fuser_conf.c       |    9 +++---
 util/fuservicemount.c   |    2 +
 util/mount.fuse.c       |    4 ++
 util/mount_service.c    |   68 ++++++++++++++++++++++--------------------
 11 files changed, 183 insertions(+), 88 deletions(-)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 1/2] libfuse: don't use SYNC_INIT unless asked for
  2026-05-05  5:23 ` [PATCHSET 1/2] libfuse: new mount API and SYNC_INIT fixes Darrick J. Wong
@ 2026-05-05  5:23   ` Darrick J. Wong
  2026-05-05  7:30     ` Bernd Schubert
                       ` (2 more replies)
  2026-05-05  5:23   ` [PATCH 2/2] libfuse: always send the subtype to the kernel when using fsconfig() Darrick J. Wong
  2026-05-05 23:09   ` [PATCH 3/2] mount_util: fix mount_flags entries for MS_RDONLY Darrick J. Wong
  2 siblings, 3 replies; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05  5:23 UTC (permalink / raw)
  To: djwong, bernd; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos

From: Darrick J. Wong <djwong@kernel.org>

If we didn't ask for SYNC_INIT, don't enable it.  This is needed to
maintain compatibility with older fuse servers that only support
asynchronous FUSE_INIT.

Fixes: 3e1101057aea57 ("fuse mount: Support synchronous FUSE_INIT (privileged daemon)")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 lib/fuse_lowlevel.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index 0e16845d2f14ff..0a801132590079 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -4475,9 +4475,9 @@ static int session_start_sync_init(struct fuse_session *se, int fd)
 {
 	int err, res;
 
-	if (!se->want_sync_init &&
-		(se->uring.enable && !fuse_daemonize_is_used())) {
-		if (se->debug)
+	if (!se->want_sync_init) {
+		/* SYNC_INIT is required for io_uring(?) */
+		if ((se->uring.enable && !fuse_daemonize_is_used()) || se->debug)
 			fuse_log(FUSE_LOG_DEBUG,
 					"fuse: sync init not enabled\n");
 		return 0;


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 2/2] libfuse: always send the subtype to the kernel when using fsconfig()
  2026-05-05  5:23 ` [PATCHSET 1/2] libfuse: new mount API and SYNC_INIT fixes Darrick J. Wong
  2026-05-05  5:23   ` [PATCH 1/2] libfuse: don't use SYNC_INIT unless asked for Darrick J. Wong
@ 2026-05-05  5:23   ` Darrick J. Wong
  2026-05-05  7:41     ` Bernd Schubert
  2026-05-05 23:09   ` [PATCH 3/2] mount_util: fix mount_flags entries for MS_RDONLY Darrick J. Wong
  2 siblings, 1 reply; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05  5:23 UTC (permalink / raw)
  To: djwong, bernd; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos

From: Darrick J. Wong <djwong@kernel.org>

Although it's possible to supply a filesystem subtype when calling
fsopen(), it does not pass the stuff after the dot to the mount option
parsing mechanism like the legacy mount() call does.  Therefore, it's
necessary to pass the subtype explicitly via fsconfig() or else the
subtype will be missing from the /proc/mounts output.

For example, fuse4fs with the old mount API produces this:

/dev/sda /mnt fuse.ext4 rw,nosuid,nodev,relatime,user_id=0,group_id=0 0 0

But with the new mount API, we only get:

/dev/sda /mnt fuse rw,nosuid,nodev,relatime,user_id=0,group_id=0 0 0

...which breaks fstests, which requires the fsname to match the string
that it passes to mount -t.  Update the comment in mount_service.c to
match this requirement.

Fixes: 14cb7b93bb9688 ("Add support for the new linux mount API")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
 lib/mount_fsmount.c  |   13 +++++++++++++
 util/mount_service.c |    3 ++-
 2 files changed, 15 insertions(+), 1 deletion(-)


diff --git a/lib/mount_fsmount.c b/lib/mount_fsmount.c
index 615271b09758c3..5e13b34ccfc610 100644
--- a/lib/mount_fsmount.c
+++ b/lib/mount_fsmount.c
@@ -359,6 +359,19 @@ int fuse_kern_fsmount(const char *mnt, unsigned long flags, int blkdev,
 		goto out_free;
 	}
 
+	/* Configure subtype */
+	if (subtype) {
+		res = fsconfig(fsfd, FSCONFIG_SET_STRING, "subtype",
+			       subtype, 0);
+		if (res) {
+			err = -errno;
+			log_fsconfig_kmsg(fsfd);
+			fprintf(stderr, "fuse: fsconfig subtype failed: %s\n",
+				strerror(-err));
+			goto out_free;
+		}
+	}
+
 	/* Configure source */
 	res = fsconfig(fsfd, FSCONFIG_SET_STRING, "source", source, 0);
 	if (res == -1) {
diff --git a/util/mount_service.c b/util/mount_service.c
index bc5940bc900dad..3fbabfdd69300d 100644
--- a/util/mount_service.c
+++ b/util/mount_service.c
@@ -821,7 +821,8 @@ static void try_fsopen(struct mount_service *mo)
 	/*
 	 * As of Linux 7.0 you can pass subtypes to fsopen, but the manpage for
 	 * fsopen only says that you can pass any value of the second column of
-	 * /proc/filesystems into fsopen.
+	 * /proc/filesystems into fsopen.  You must still call fsconfig() for
+	 * the subtype separately, however.
 	 */
 	mo->fsopenfd = fsopen(fsname(mo), FSOPEN_CLOEXEC);
 }


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 01/10] util/mount.fuse.c: loop in waitpid
  2026-05-05  5:23 ` [PATCHSET 2/2] libfuse: new mount service container fixes Darrick J. Wong
@ 2026-05-05  5:24   ` Darrick J. Wong
  2026-05-05  5:24   ` [PATCH 02/10] fuse_service: handle weird behavior during SCM_RIGHTS fd transfers Darrick J. Wong
                     ` (9 subsequent siblings)
  10 siblings, 0 replies; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05  5:24 UTC (permalink / raw)
  To: djwong, bernd; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos

From: Darrick J. Wong <djwong@kernel.org>

waitpid can return EINTR if interrupted by a signal; don't abort when
this happens.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
 util/mount.fuse.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)


diff --git a/util/mount.fuse.c b/util/mount.fuse.c
index 085c88835e6c9a..802d7f99fe7815 100644
--- a/util/mount.fuse.c
+++ b/util/mount.fuse.c
@@ -267,7 +267,9 @@ static int mount_service_child(char **argv)
 		return MOUNT_SERVICE_FALLBACK_NEEDED;
 	}
 
-	ret = waitpid(child_pid, &child_status, 0);
+	do {
+		ret = waitpid(child_pid, &child_status, 0);
+	} while (ret < 0 && errno == EINTR);
 	if (ret < 0) {
 		fprintf(stderr, "%s: could not wait for %s helper: %s\n",
 			argv[0], FUSERVICEMOUNT_PROG, strerror(errno));


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 02/10] fuse_service: handle weird behavior during SCM_RIGHTS fd transfers
  2026-05-05  5:23 ` [PATCHSET 2/2] libfuse: new mount service container fixes Darrick J. Wong
  2026-05-05  5:24   ` [PATCH 01/10] util/mount.fuse.c: loop in waitpid Darrick J. Wong
@ 2026-05-05  5:24   ` Darrick J. Wong
  2026-05-05  5:24   ` [PATCH 03/10] examples: improve documentation of the new systemd service fuse servers Darrick J. Wong
                     ` (8 subsequent siblings)
  10 siblings, 0 replies; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05  5:24 UTC (permalink / raw)
  To: djwong, bernd; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos

From: Darrick J. Wong <djwong@kernel.org>

Fix a few problems in the code that tries to receive an fd from the
mount service helper: MSG_CTRUNC must be handled if an LSM denies us the
fd transfer; and protect ourselves against the kernel never actually
writing to the fd array.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
 lib/fuse_service.c |   33 +++++++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)


diff --git a/lib/fuse_service.c b/lib/fuse_service.c
index e9a8ddc0912362..240b1107296849 100644
--- a/lib/fuse_service.c
+++ b/lib/fuse_service.c
@@ -64,17 +64,28 @@ static int __recv_fd(struct fuse_service *sf,
 	union {
 		struct cmsghdr cmsghdr;
 		char control[CMSG_SPACE(sizeof(int))];
-	} cmsgu;
+	} cmsgu = { };
 	struct msghdr msg = {
 		.msg_iov = &iov,
 		.msg_iovlen = 1,
 		.msg_control = cmsgu.control,
-		.msg_controllen = sizeof(cmsgu.control),
+
+		/*
+		 * Do not include padding at the end of the control buffer,
+		 * because we don't want to receive fds that we weren't
+		 * expecting.
+		 */
+		.msg_controllen = CMSG_LEN(sizeof(int)),
 	};
 	struct cmsghdr *cmsg;
 	ssize_t size;
 
-	memset(&cmsgu, 0, sizeof(cmsgu));
+	/*
+	 * Set the initial fd value to -1 to signal an invalid fd in case the
+	 * kernel doesn't write to the cmsg buffer and doesn't return an error.
+	 * It shouldn't do that, but we absolutely don't want a zero here.
+	 */
+	memset(cmsgu.control, -1, sizeof(cmsgu.control));
 
 	size = recvmsg(sf->sockfd, &msg, MSG_TRUNC | MSG_CMSG_CLOEXEC);
 	if (size < 0) {
@@ -91,6 +102,13 @@ static int __recv_fd(struct fuse_service *sf,
 		return -EBADMSG;
 	}
 
+	if (msg.msg_flags & MSG_CTRUNC) {
+		/* SMACK does this */
+		fuse_log(FUSE_LOG_ERR,
+"fuse: service file reply control data truncated; did an LSM deny SCM_RIGHTS?\n");
+		return -EBADMSG;
+	}
+
 	cmsg = CMSG_FIRSTHDR(&msg);
 	if (!cmsg) {
 		/* no control message means mount.service sent us an error */
@@ -147,7 +165,7 @@ int fuse_service_receive_file(struct fuse_service *sf, const char *path,
 {
 	struct fuse_service_requested_file *req;
 	const size_t req_sz = sizeof_fuse_service_requested_file(strlen(path));
-	int fd = -ENOENT;
+	int fd = -1;
 	int ret;
 
 	*fdp = -ENOENT;
@@ -182,9 +200,12 @@ int fuse_service_receive_file(struct fuse_service *sf, const char *path,
 		goto out_close;
 	}
 
-	if (fd == -ENOENT)
-		fuse_log(FUSE_LOG_ERR, "fuse: did not receive `%s' but no error?\n",
+	if (fd < 0) {
+		fuse_log(FUSE_LOG_ERR,
+			 "fuse: did not receive valid fd for `%s' but no error?\n",
 			 path);
+		goto out_req;
+	}
 
 	*fdp = fd;
 	goto out_req;


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 03/10] examples: improve documentation of the new systemd service fuse servers
  2026-05-05  5:23 ` [PATCHSET 2/2] libfuse: new mount service container fixes Darrick J. Wong
  2026-05-05  5:24   ` [PATCH 01/10] util/mount.fuse.c: loop in waitpid Darrick J. Wong
  2026-05-05  5:24   ` [PATCH 02/10] fuse_service: handle weird behavior during SCM_RIGHTS fd transfers Darrick J. Wong
@ 2026-05-05  5:24   ` Darrick J. Wong
  2026-05-05  5:24   ` [PATCH 04/10] example/single_file: sync backing fd when statx wants us to fsync Darrick J. Wong
                     ` (7 subsequent siblings)
  10 siblings, 0 replies; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05  5:24 UTC (permalink / raw)
  To: djwong, bernd; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos

From: Darrick J. Wong <djwong@kernel.org>

Say a bit more about what the sample files are actually trying to do.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
 example/single_file.h |    4 ++++
 example/service_hl.c  |   20 ++++++++++++++++++--
 example/service_ll.c  |   20 ++++++++++++++++++--
 example/single_file.c |    4 ++++
 4 files changed, 44 insertions(+), 4 deletions(-)


diff --git a/example/single_file.h b/example/single_file.h
index 86edb51afb3384..290dd6051ed6f5 100644
--- a/example/single_file.h
+++ b/example/single_file.h
@@ -4,6 +4,10 @@
  *
  * This program can be distributed under the terms of the GNU GPLv2.
  * See the file GPL2.txt.
+ *
+ * This file is shared library code for example fuse servers that want to
+ * expose a single regular file that wraps another file in a manner that goes
+ * beyond simple passthrough.  It is not itself a fuse server.
  */
 #ifndef FUSE_SINGLE_FILE_H_
 #define FUSE_SINGLE_FILE_H_
diff --git a/example/service_hl.c b/example/service_hl.c
index 9c4f3ae7a6cf3c..ea041f670f2ec5 100644
--- a/example/service_hl.c
+++ b/example/service_hl.c
@@ -8,7 +8,15 @@
 
 /** @file
  *
- * minimal example filesystem using high-level API and systemd service api
+ * Minimal example filesystem using high-level API and systemd service API.
+ *
+ * - Shows how to build a high level FUSE filesystem server that can be managed
+ *   by systemd
+ * - Enables on-demand filesystem mounting via socket activation
+ * - Demonstrates requesting resources from the mount-caller's environment
+ * - Allows running FUSE servers with minimal privileges; isolated mount,
+ *   network, and pid namespaces; and a separate uid/gid (unlike traditional
+ *   FUSE which needs mount permissions and runs in the caller's environment)
  *
  * Compile with:
  *
@@ -25,7 +33,15 @@
  * to point to the actual path of the service_hl binary.
  *
  * Finally, install the service_hl@.service and service_hl.socket files to the
- * systemd service directory, usually /run/systemd/system.
+ * systemd service directory, usually /run/systemd/system.  Run these commands
+ * to activate:
+ *
+ *     systemctl daemon-reload
+ *     systemctl start service_hl.socket
+ *
+ * Then mount with:
+ *
+ *     mount -t fuse.service_hl /dev/sda /mnt
  *
  * ## Source code ##
  * \include service_hl.c
diff --git a/example/service_ll.c b/example/service_ll.c
index 8958a221e09a66..33a8bd48bc1215 100644
--- a/example/service_ll.c
+++ b/example/service_ll.c
@@ -8,7 +8,15 @@
 
 /** @file
  *
- * minimal example filesystem using low-level API and systemd service api
+ * Minimal example filesystem using low-level API and systemd service API.
+ *
+ * - Shows how to build a low level FUSE filesystem server that can be managed
+ *   by systemd
+ * - Enables on-demand filesystem mounting via socket activation
+ * - Demonstrates requesting resources from the mount-caller's environment
+ * - Allows running FUSE servers with minimal privileges; isolated mount,
+ *   network, and pid namespaces; and a separate uid/gid (unlike traditional
+ *   FUSE which needs mount permissions and runs in the caller's environment)
  *
  * Compile with:
  *
@@ -25,7 +33,15 @@
  * to point to the actual path of the service_ll binary.
  *
  * Finally, install the service_ll@.service and service_ll.socket files to the
- * systemd service directory, usually /run/systemd/system.
+ * systemd service directory, usually /run/systemd/system.  Run these commands
+ * to activate:
+ *
+ *     systemctl daemon-reload
+ *     systemctl start service_ll.socket
+ *
+ * Then mount with:
+ *
+ *     mount -t fuse.service_ll /dev/sda /mnt
  *
  * ## Source code ##
  * \include service_ll.c
diff --git a/example/single_file.c b/example/single_file.c
index 6932eac3a2f276..aeceac83c517c1 100644
--- a/example/single_file.c
+++ b/example/single_file.c
@@ -4,6 +4,10 @@
  *
  * This program can be distributed under the terms of the GNU GPLv2.
  * See the file GPL2.txt.
+ *
+ * This file is shared library code for example fuse servers that want to
+ * expose a single regular file that wraps another file in a manner that goes
+ * beyond simple passthrough.  It is not itself a fuse server.
  */
 #define _GNU_SOURCE
 #include <pthread.h>


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 04/10] example/single_file: sync backing fd when statx wants us to fsync
  2026-05-05  5:23 ` [PATCHSET 2/2] libfuse: new mount service container fixes Darrick J. Wong
                     ` (2 preceding siblings ...)
  2026-05-05  5:24   ` [PATCH 03/10] examples: improve documentation of the new systemd service fuse servers Darrick J. Wong
@ 2026-05-05  5:24   ` Darrick J. Wong
  2026-05-05  5:25   ` [PATCH 05/10] example/single_file: fix ctime handling Darrick J. Wong
                     ` (6 subsequent siblings)
  10 siblings, 0 replies; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05  5:24 UTC (permalink / raw)
  To: djwong, bernd; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos

From: Darrick J. Wong <djwong@kernel.org>

statx callers can tell the filesystem to fsync the file, so let's pass
that through to the backing fd.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
 example/single_file.c |   20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)


diff --git a/example/single_file.c b/example/single_file.c
index aeceac83c517c1..e7da1f2933fc81 100644
--- a/example/single_file.c
+++ b/example/single_file.c
@@ -286,9 +286,18 @@ void single_file_ll_statx(fuse_req_t req, fuse_ino_t ino, int flags, int mask,
 	struct statx stx = { };
 	bool filled;
 
-	(void)flags;
 	(void)fi;
 
+	if ((flags & AT_STATX_FORCE_SYNC) && is_single_file_ino(ino) &&
+	    single_file.backing_fd >= 0) {
+		int ret = fsync(single_file.backing_fd);
+
+		if (ret) {
+			fuse_reply_err(req, errno);
+			return;
+		}
+	}
+
 	pthread_mutex_lock(&single_file.lock);
 	filled = sf_statx(ino, mask, &stx);
 	pthread_mutex_unlock(&single_file.lock);
@@ -301,13 +310,20 @@ void single_file_ll_statx(fuse_req_t req, fuse_ino_t ino, int flags, int mask,
 int single_file_hl_statx(const char *path, int statx_flags, int statx_mask,
 			 struct statx *stx, struct fuse_file_info *fi)
 {
-	(void)statx_flags;
 	fuse_ino_t ino = single_open_file_path_to_ino(fi, path);
 	bool filled;
 
 	if (!ino)
 		return -ENOENT;
 
+	if ((statx_flags & AT_STATX_FORCE_SYNC) && is_single_file_ino(ino) &&
+	    single_file.backing_fd >= 0) {
+		int ret = fsync(single_file.backing_fd);
+
+		if (ret)
+			return -errno;
+	}
+
 	pthread_mutex_lock(&single_file.lock);
 	filled = sf_statx(ino, statx_mask, stx);
 	pthread_mutex_unlock(&single_file.lock);


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 05/10] example/single_file: fix ctime handling
  2026-05-05  5:23 ` [PATCHSET 2/2] libfuse: new mount service container fixes Darrick J. Wong
                     ` (3 preceding siblings ...)
  2026-05-05  5:24   ` [PATCH 04/10] example/single_file: sync backing fd when statx wants us to fsync Darrick J. Wong
@ 2026-05-05  5:25   ` Darrick J. Wong
  2026-05-05  5:25   ` [PATCH 06/10] libfuse: fix cppcheck complaints about constifying pointers Darrick J. Wong
                     ` (5 subsequent siblings)
  10 siblings, 0 replies; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05  5:25 UTC (permalink / raw)
  To: djwong, bernd; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos

From: Darrick J. Wong <djwong@kernel.org>

Fix the ctime initialization and updates so that it behaves like ctime
is supposed to.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
 example/single_file.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)


diff --git a/example/single_file.c b/example/single_file.c
index e7da1f2933fc81..a962232d576e17 100644
--- a/example/single_file.c
+++ b/example/single_file.c
@@ -466,8 +466,6 @@ void single_file_ll_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
 			single_file.mtime = attr->st_mtim;
 	}
 	if (to_set & FUSE_SET_ATTR_CTIME)
-		single_file.ctime = attr->st_mtim;
-	else
 		single_file.ctime = now;
 	pthread_mutex_unlock(&single_file.lock);
 
@@ -491,6 +489,7 @@ int single_file_hl_chmod(const char *path, mode_t mode,
 
 	pthread_mutex_lock(&single_file.lock);
 	single_file.mode = (single_file.mode & S_IFMT) | (mode & ~S_IFMT);
+	get_now(&single_file.ctime);
 	pthread_mutex_unlock(&single_file.lock);
 
 	return 0;
@@ -844,6 +843,7 @@ ssize_t single_file_pwrite(const char *buf, size_t count, off_t pos)
 		get_now(&now);
 
 		pthread_mutex_lock(&single_file.lock);
+		single_file.mtime = now;
 		single_file.ctime = now;
 		pthread_mutex_unlock(&single_file.lock);
 
@@ -973,6 +973,7 @@ int single_file_configure_simple(const char *filename)
 	get_now(&startup_time);
 	single_file.atime = startup_time;
 	single_file.mtime = startup_time;
+	single_file.ctime = startup_time;
 
 	if (!single_file.ro)
 		single_file.mode |= 0220;


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 06/10] libfuse: fix cppcheck complaints about constifying pointers
  2026-05-05  5:23 ` [PATCHSET 2/2] libfuse: new mount service container fixes Darrick J. Wong
                     ` (4 preceding siblings ...)
  2026-05-05  5:25   ` [PATCH 05/10] example/single_file: fix ctime handling Darrick J. Wong
@ 2026-05-05  5:25   ` Darrick J. Wong
  2026-05-05  5:25   ` [PATCH 07/10] libfuse: fix cppcheck complaints about constifying pointers in user-visible ABI Darrick J. Wong
                     ` (4 subsequent siblings)
  10 siblings, 0 replies; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05  5:25 UTC (permalink / raw)
  To: djwong, bernd; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos

From: Darrick J. Wong <djwong@kernel.org>

Fix various cppcheck complaints about pointers that could be const
pointers instead.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 include/fuse_service.h  |    7 ++++---
 lib/fuse_service.c      |   30 +++++++++++++++++-------------
 lib/fuse_service_stub.c |    6 ++++--
 3 files changed, 25 insertions(+), 18 deletions(-)


diff --git a/include/fuse_service.h b/include/fuse_service.h
index 7e4c204e7a70bf..399830fcf142fe 100644
--- a/include/fuse_service.h
+++ b/include/fuse_service.h
@@ -48,7 +48,7 @@ int fuse_service_accept(struct fuse_service **sfp);
  * @param sf service context
  * @return true if it has, false if not
  */
-static inline bool fuse_service_accepted(struct fuse_service *sf)
+static inline bool fuse_service_accepted(const struct fuse_service *sf)
 {
 	return sf != NULL;
 }
@@ -59,7 +59,7 @@ static inline bool fuse_service_accepted(struct fuse_service *sf)
  * @param sf service context
  * @return true if it has, false if not
  */
-bool fuse_service_can_allow_other(struct fuse_service *sf);
+bool fuse_service_can_allow_other(const struct fuse_service *sf);
 
 /**
  * Release all resources associated with the service context.
@@ -97,7 +97,8 @@ int fuse_service_append_args(struct fuse_service *sf, struct fuse_args *args);
  * @param args fuse args structure
  * @return effective command line string, or NULL
  */
-char *fuse_service_cmdline(int argc, char *argv[], struct fuse_args *args);
+char *fuse_service_cmdline(int argc, const char * const *argv,
+			   struct fuse_args *args);
 
 struct fuse_cmdline_opts;
 
diff --git a/lib/fuse_service.c b/lib/fuse_service.c
index 240b1107296849..5831e2131e9cbf 100644
--- a/lib/fuse_service.c
+++ b/lib/fuse_service.c
@@ -53,7 +53,7 @@ struct fuse_service {
 	bool allow_other;
 };
 
-static int __recv_fd(struct fuse_service *sf,
+static int __recv_fd(const struct fuse_service *sf,
 		     struct fuse_service_requested_file *buf,
 		     ssize_t bufsize, int *fdp)
 {
@@ -132,7 +132,8 @@ static int __recv_fd(struct fuse_service *sf,
 	return 0;
 }
 
-static ssize_t __send_packet(struct fuse_service *sf, void *ptr, size_t len)
+static ssize_t __send_packet(const struct fuse_service *sf, void *ptr,
+			     size_t len)
 {
 	struct iovec iov = {
 		.iov_base = ptr,
@@ -146,7 +147,8 @@ static ssize_t __send_packet(struct fuse_service *sf, void *ptr, size_t len)
 	return sendmsg(sf->sockfd, &msg, MSG_EOR | MSG_NOSIGNAL);
 }
 
-static ssize_t __recv_packet(struct fuse_service *sf, void *ptr, size_t len)
+static ssize_t __recv_packet(const struct fuse_service *sf, void *ptr,
+			     size_t len)
 {
 	struct iovec iov = {
 		.iov_base = ptr,
@@ -219,7 +221,8 @@ int fuse_service_receive_file(struct fuse_service *sf, const char *path,
 
 #define FUSE_SERVICE_REQUEST_FILE_FLAGS	(FUSE_SERVICE_REQUEST_FILE_QUIET)
 
-static int fuse_service_request_path(struct fuse_service *sf, const char *path,
+static int fuse_service_request_path(const struct fuse_service *sf,
+				     const char *path,
 				     mode_t expected_fmt, int open_flags,
 				     mode_t create_mode,
 				     unsigned int request_flags,
@@ -322,8 +325,8 @@ int fuse_service_send_goodbye(struct fuse_service *sf, int exitcode)
 
 static int count_listen_fds(void)
 {
-	char *listen_fds;
-	char *listen_pid;
+	const char *listen_fds;
+	const char *listen_pid;
 	char *p;
 	long l;
 
@@ -589,7 +592,7 @@ int fuse_service_accept(struct fuse_service **sfp)
 	return ret;
 }
 
-bool fuse_service_can_allow_other(struct fuse_service *sf)
+bool fuse_service_can_allow_other(const struct fuse_service *sf)
 {
 	return sf->allow_other;
 }
@@ -781,7 +784,7 @@ int fuse_service_finish_file_requests(struct fuse_service *sf)
 }
 #endif
 
-static int send_fsopen(struct fuse_service *sf, const char *fstype,
+static int send_fsopen(const struct fuse_service *sf, const char *fstype,
 		       int *errorp)
 {
 	struct fuse_service_simple_reply reply = { };
@@ -825,7 +828,7 @@ static int send_fsopen(struct fuse_service *sf, const char *fstype,
 	return 0;
 }
 
-static int send_string(struct fuse_service *sf, uint32_t command,
+static int send_string(const struct fuse_service *sf, uint32_t command,
 		       const char *value, int *errorp)
 {
 	struct fuse_service_simple_reply reply = { };
@@ -877,7 +880,7 @@ static int send_string(struct fuse_service *sf, uint32_t command,
 	return 0;
 }
 
-static int send_mountpoint(struct fuse_service *sf, mode_t expected_fmt,
+static int send_mountpoint(const struct fuse_service *sf, mode_t expected_fmt,
 			   const char *value, int *errorp)
 {
 	struct fuse_service_simple_reply reply = { };
@@ -932,7 +935,7 @@ static int send_mountpoint(struct fuse_service *sf, mode_t expected_fmt,
 	return 0;
 }
 
-static int send_mount(struct fuse_service *sf, unsigned int ms_flags,
+static int send_mount(const struct fuse_service *sf, unsigned int ms_flags,
 		      int *errorp)
 {
 	struct fuse_service_simple_reply reply = { };
@@ -1175,12 +1178,13 @@ void fuse_service_destroy(struct fuse_service **sfp)
 	*sfp = NULL;
 }
 
-char *fuse_service_cmdline(int argc, char *argv[], struct fuse_args *args)
+char *fuse_service_cmdline(int argc, const char * const *argv,
+			   struct fuse_args *args)
 {
 	char *p, *dst;
 	size_t len = 1;
 	ssize_t ret;
-	char *argv0;
+	const char *argv0;
 	unsigned int i;
 
 	/* Try to preserve argv[0] */
diff --git a/lib/fuse_service_stub.c b/lib/fuse_service_stub.c
index 231b98423df628..83f749bc15c0cc 100644
--- a/lib/fuse_service_stub.c
+++ b/lib/fuse_service_stub.c
@@ -23,6 +23,7 @@
 int fuse_service_receive_file(struct fuse_service *sf, const char *path,
 			      int *fdp)
 {
+	*fdp = -1;
 	return -EOPNOTSUPP;
 }
 
@@ -52,7 +53,7 @@ int fuse_service_accept(struct fuse_service **sfp)
 	return 0;
 }
 
-bool fuse_service_can_allow_other(struct fuse_service *sf)
+bool fuse_service_can_allow_other(const struct fuse_service *sf)
 {
 	return false;
 }
@@ -63,7 +64,8 @@ int fuse_service_append_args(struct fuse_service *sf,
 	return -EOPNOTSUPP;
 }
 
-char *fuse_service_cmdline(int argc, char *argv[], struct fuse_args *args)
+char *fuse_service_cmdline(int argc, const char * const *argv,
+			   struct fuse_args *args)
 {
 	return NULL;
 }


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 07/10] libfuse: fix cppcheck complaints about constifying pointers in user-visible ABI
  2026-05-05  5:23 ` [PATCHSET 2/2] libfuse: new mount service container fixes Darrick J. Wong
                     ` (5 preceding siblings ...)
  2026-05-05  5:25   ` [PATCH 06/10] libfuse: fix cppcheck complaints about constifying pointers Darrick J. Wong
@ 2026-05-05  5:25   ` Darrick J. Wong
  2026-05-05  5:25   ` [PATCH 08/10] util: fix cppcheck complaints about constifying pointers Darrick J. Wong
                     ` (3 subsequent siblings)
  10 siblings, 0 replies; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05  5:25 UTC (permalink / raw)
  To: djwong, bernd; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos

From: Darrick J. Wong <djwong@kernel.org>

Fix various cppcheck complaints about pointers that could be const
pointers instead.

I am not sure you ought to take this patch, because this affects the
client program ABI by limiting what the library can do in the future
with the passed in struct fuse_service object.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 include/fuse_service.h  |   11 ++++++-----
 lib/fuse_service.c      |   13 +++++++------
 lib/fuse_service_stub.c |   11 ++++++-----
 3 files changed, 19 insertions(+), 16 deletions(-)


diff --git a/include/fuse_service.h b/include/fuse_service.h
index 399830fcf142fe..bd89189cfe5d5b 100644
--- a/include/fuse_service.h
+++ b/include/fuse_service.h
@@ -139,7 +139,7 @@ int fuse_service_parse_cmdline_opts(struct fuse_args *args,
  * @param request_flags set of FUSE_SERVICE_REQUEST_* flags
  * @return 0 on success, or negative errno on failure
  */
-int fuse_service_request_file(struct fuse_service *sf, const char *path,
+int fuse_service_request_file(const struct fuse_service *sf, const char *path,
 			      int open_flags, mode_t create_mode,
 			      unsigned int request_flags);
 
@@ -155,7 +155,8 @@ int fuse_service_request_file(struct fuse_service *sf, const char *path,
  * @param block_size set the block device block size to this value
  * @return 0 on success, or negative errno on failure
  */
-int fuse_service_request_blockdev(struct fuse_service *sf, const char *path,
+int fuse_service_request_blockdev(const struct fuse_service *sf,
+				  const char *path,
 				  int open_flags, mode_t create_mode,
 				  unsigned int request_flags,
 				  unsigned int block_size);
@@ -169,7 +170,7 @@ int fuse_service_request_blockdev(struct fuse_service *sf, const char *path,
  *      descriptor value on success, or negative errno on failure
  * @return 0 on success, or negative errno on socket communication failure
  */
-int fuse_service_receive_file(struct fuse_service *sf,
+int fuse_service_receive_file(const struct fuse_service *sf,
 			      const char *path, int *fdp);
 
 /**
@@ -178,7 +179,7 @@ int fuse_service_receive_file(struct fuse_service *sf,
  * @param sf service context
  * @return 0 on success, or negative errno on failure
  */
-int fuse_service_finish_file_requests(struct fuse_service *sf);
+int fuse_service_finish_file_requests(const struct fuse_service *sf);
 
 /**
  * Require that the filesystem mount point have the expected file format
@@ -215,7 +216,7 @@ int fuse_service_session_mount(struct fuse_service *sf, struct fuse_session *se,
  * @param sf service context
  * @return 0 on success, or negative errno on failure
  */
-int fuse_service_session_unmount(struct fuse_service *sf);
+int fuse_service_session_unmount(const struct fuse_service *sf);
 
 /**
  * Bid farewell to the mount.service helper.  It is still necessary to call
diff --git a/lib/fuse_service.c b/lib/fuse_service.c
index 5831e2131e9cbf..d14aced29e8268 100644
--- a/lib/fuse_service.c
+++ b/lib/fuse_service.c
@@ -162,7 +162,7 @@ static ssize_t __recv_packet(const struct fuse_service *sf, void *ptr,
 	return recvmsg(sf->sockfd, &msg, MSG_TRUNC);
 }
 
-int fuse_service_receive_file(struct fuse_service *sf, const char *path,
+int fuse_service_receive_file(const struct fuse_service *sf, const char *path,
 			      int *fdp)
 {
 	struct fuse_service_requested_file *req;
@@ -278,7 +278,7 @@ static int fuse_service_request_path(const struct fuse_service *sf,
 	return ret;
 }
 
-int fuse_service_request_file(struct fuse_service *sf, const char *path,
+int fuse_service_request_file(const struct fuse_service *sf, const char *path,
 			      int open_flags, mode_t create_mode,
 			      unsigned int request_flags)
 {
@@ -286,7 +286,8 @@ int fuse_service_request_file(struct fuse_service *sf, const char *path,
 					 create_mode, request_flags, 0);
 }
 
-int fuse_service_request_blockdev(struct fuse_service *sf, const char *path,
+int fuse_service_request_blockdev(const struct fuse_service *sf,
+				  const char *path,
 				  int open_flags, mode_t create_mode,
 				  unsigned int request_flags,
 				  unsigned int block_size)
@@ -752,7 +753,7 @@ int fuse_service_append_args(struct fuse_service *sf,
 }
 
 #ifdef SO_PASSRIGHTS
-int fuse_service_finish_file_requests(struct fuse_service *sf)
+int fuse_service_finish_file_requests(const struct fuse_service *sf)
 {
 	int zero = 0;
 	int ret;
@@ -777,7 +778,7 @@ int fuse_service_finish_file_requests(struct fuse_service *sf)
 	return 0;
 }
 #else
-int fuse_service_finish_file_requests(struct fuse_service *sf)
+int fuse_service_finish_file_requests(const struct fuse_service *sf)
 {
 	(void)sf;
 	return 0;
@@ -1102,7 +1103,7 @@ int fuse_service_session_mount(struct fuse_service *sf, struct fuse_session *se,
 	return ret;
 }
 
-int fuse_service_session_unmount(struct fuse_service *sf)
+int fuse_service_session_unmount(const struct fuse_service *sf)
 {
 	struct fuse_service_simple_reply reply = { };
 	struct fuse_service_unmount_command c = {
diff --git a/lib/fuse_service_stub.c b/lib/fuse_service_stub.c
index 83f749bc15c0cc..1e27f5ea0c6b57 100644
--- a/lib/fuse_service_stub.c
+++ b/lib/fuse_service_stub.c
@@ -20,21 +20,22 @@
 #include "fuse_i.h"
 #include "fuse_service.h"
 
-int fuse_service_receive_file(struct fuse_service *sf, const char *path,
+int fuse_service_receive_file(const struct fuse_service *sf, const char *path,
 			      int *fdp)
 {
 	*fdp = -1;
 	return -EOPNOTSUPP;
 }
 
-int fuse_service_request_file(struct fuse_service *sf, const char *path,
+int fuse_service_request_file(const struct fuse_service *sf, const char *path,
 			      int open_flags, mode_t create_mode,
 			      unsigned int request_flags)
 {
 	return -EOPNOTSUPP;
 }
 
-int fuse_service_request_blockdev(struct fuse_service *sf, const char *path,
+int fuse_service_request_blockdev(const struct fuse_service *sf,
+				  const char *path,
 				  int open_flags, mode_t create_mode,
 				  unsigned int request_flags,
 				  unsigned int block_size)
@@ -70,7 +71,7 @@ char *fuse_service_cmdline(int argc, const char * const *argv,
 	return NULL;
 }
 
-int fuse_service_finish_file_requests(struct fuse_service *sf)
+int fuse_service_finish_file_requests(const struct fuse_service *sf)
 {
 	return -EOPNOTSUPP;
 }
@@ -87,7 +88,7 @@ int fuse_service_session_mount(struct fuse_service *sf, struct fuse_session *se,
 	return -EOPNOTSUPP;
 }
 
-int fuse_service_session_unmount(struct fuse_service *sf)
+int fuse_service_session_unmount(const struct fuse_service *sf)
 {
 	return -EOPNOTSUPP;
 }


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 08/10] util: fix cppcheck complaints about constifying pointers
  2026-05-05  5:23 ` [PATCHSET 2/2] libfuse: new mount service container fixes Darrick J. Wong
                     ` (6 preceding siblings ...)
  2026-05-05  5:25   ` [PATCH 07/10] libfuse: fix cppcheck complaints about constifying pointers in user-visible ABI Darrick J. Wong
@ 2026-05-05  5:25   ` Darrick J. Wong
  2026-05-05  5:26   ` [PATCH 09/10] fuser_conf: fix cppcheck complaints Darrick J. Wong
                     ` (2 subsequent siblings)
  10 siblings, 0 replies; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05  5:25 UTC (permalink / raw)
  To: djwong, bernd; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos

From: Darrick J. Wong <djwong@kernel.org>

Fix various cppcheck complaints about pointers that could be const
pointers instead.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 util/fuservicemount.c |    2 +
 util/mount_service.c  |   68 ++++++++++++++++++++++++++-----------------------
 2 files changed, 37 insertions(+), 33 deletions(-)


diff --git a/util/fuservicemount.c b/util/fuservicemount.c
index 4d4cad6cb9253c..a17ae0be290794 100644
--- a/util/fuservicemount.c
+++ b/util/fuservicemount.c
@@ -29,7 +29,7 @@ static int check_service(const char *fstype)
 
 int main(int argc, char *argv[])
 {
-	char *fstype = NULL;
+	const char *fstype = NULL;
 	bool check = false;
 	int i;
 
diff --git a/util/mount_service.c b/util/mount_service.c
index 3fbabfdd69300d..8c9747b3928a51 100644
--- a/util/mount_service.c
+++ b/util/mount_service.c
@@ -97,7 +97,7 @@ static inline bool have_real_mtabopts(const struct mount_service *mo)
 	return mo->mtabopts && mo->mtabopts != &IGNORE_MTAB;
 }
 
-static ssize_t __send_fd(struct mount_service *mo,
+static ssize_t __send_fd(const struct mount_service *mo,
 			 struct fuse_service_requested_file *req,
 			 size_t req_sz, int fd)
 {
@@ -132,7 +132,8 @@ static ssize_t __send_fd(struct mount_service *mo,
 	return sendmsg(mo->sockfd, &msg, MSG_EOR | MSG_NOSIGNAL);
 }
 
-static ssize_t __send_packet(struct mount_service *mo, void *ptr, size_t len)
+static ssize_t __send_packet(const struct mount_service *mo, void *ptr,
+			     size_t len)
 {
 	struct iovec iov = {
 		.iov_base = ptr,
@@ -146,7 +147,7 @@ static ssize_t __send_packet(struct mount_service *mo, void *ptr, size_t len)
 	return sendmsg(mo->sockfd, &msg, MSG_EOR | MSG_NOSIGNAL);
 }
 
-static ssize_t __recv_packet_size(struct mount_service *mo)
+static ssize_t __recv_packet_size(const struct mount_service *mo)
 {
 	struct iovec iov = { };
 	struct msghdr msg = {
@@ -156,7 +157,8 @@ static ssize_t __recv_packet_size(struct mount_service *mo)
 	return recvmsg(mo->sockfd, &msg, MSG_PEEK | MSG_TRUNC);
 }
 
-static ssize_t __recv_packet(struct mount_service *mo, void *ptr, size_t len)
+static ssize_t __recv_packet(const struct mount_service *mo, void *ptr,
+			     size_t len)
 {
 	struct iovec iov = {
 		.iov_base = ptr,
@@ -198,7 +200,7 @@ const char *mount_service_subtype(const char *fstype)
 
 static int mount_service_init(struct mount_service *mo, int argc, char *argv[])
 {
-	char *fstype = NULL;
+	const char *fstype = NULL;
 	const char *subtype;
 	int i;
 
@@ -237,7 +239,7 @@ static int mount_service_init(struct mount_service *mo, int argc, char *argv[])
 }
 
 #ifdef SO_PASSRIGHTS
-static int try_drop_passrights(struct mount_service *mo, int sockfd)
+static int try_drop_passrights(const struct mount_service *mo, int sockfd)
 {
 	int zero = 0;
 	int ret;
@@ -260,7 +262,7 @@ static int try_drop_passrights(struct mount_service *mo, int sockfd)
 # define try_drop_passrights(...)	(0)
 #endif
 
-static int check_sendbuf_size(struct mount_service *mo, int sockfd)
+static int check_sendbuf_size(const struct mount_service *mo, int sockfd)
 {
 	const size_t min_size = sizeof_fuse_service_open_command(PATH_MAX);
 	int sendbuf_size = -1;
@@ -344,7 +346,7 @@ static int mount_service_connect(struct mount_service *mo)
 	return -1;
 }
 
-static int mount_service_send_hello(struct mount_service *mo)
+static int mount_service_send_hello(const struct mount_service *mo)
 {
 	struct fuse_service_hello hello = {
 		.p.magic = htonl(FUSE_SERVICE_HELLO_CMD),
@@ -398,7 +400,7 @@ static int mount_service_send_hello(struct mount_service *mo)
 	return 0;
 }
 
-static int mount_service_capture_arg(struct mount_service *mo,
+static int mount_service_capture_arg(const struct mount_service *mo,
 				     struct fuse_service_memfd_argv *args,
 				     const char *string, off_t *array_pos,
 				     off_t *string_pos)
@@ -510,7 +512,7 @@ static int mount_service_capture_args(struct mount_service *mo, int argc,
 	return 0;
 }
 
-static int mount_service_send_file(struct mount_service *mo,
+static int mount_service_send_file(const struct mount_service *mo,
 				   const char *path, int fd)
 {
 	struct fuse_service_requested_file *req;
@@ -548,8 +550,8 @@ static int mount_service_send_file(struct mount_service *mo,
 	return ret;
 }
 
-static int mount_service_send_file_error(struct mount_service *mo, int error,
-					 const char *path)
+static int mount_service_send_file_error(const struct mount_service *mo,
+					 int error, const char *path)
 {
 	struct fuse_service_requested_file *req;
 	const size_t req_sz =
@@ -619,7 +621,7 @@ static int mount_service_send_required_files(struct mount_service *mo,
 	return ret;
 }
 
-static int mount_service_receive_command(struct mount_service *mo,
+static int mount_service_receive_command(const struct mount_service *mo,
 					 struct fuse_service_packet **commandp,
 					 size_t *commandsz)
 {
@@ -676,7 +678,7 @@ static int mount_service_receive_command(struct mount_service *mo,
 	return 0;
 }
 
-static int mount_service_send_reply(struct mount_service *mo, int error)
+static int mount_service_send_reply(const struct mount_service *mo, int error)
 {
 	struct fuse_service_simple_reply reply = {
 		.p.magic = htonl(FUSE_SERVICE_SIMPLE_REPLY),
@@ -694,8 +696,8 @@ static int mount_service_send_reply(struct mount_service *mo, int error)
 	return 0;
 }
 
-static int prepare_bdev(struct mount_service *mo,
-			struct fuse_service_open_command *oc, int fd)
+static int prepare_bdev(const struct mount_service *mo,
+			const struct fuse_service_open_command *oc, int fd)
 {
 	struct stat stbuf;
 	int ret;
@@ -734,11 +736,11 @@ static int prepare_bdev(struct mount_service *mo,
 	return 0;
 }
 
-static int mount_service_open_path(struct mount_service *mo,
+static int mount_service_open_path(const struct mount_service *mo,
 				   mode_t expected_fmt,
 				   struct fuse_service_packet *p, size_t psz)
 {
-	struct fuse_service_open_command *oc =
+	const struct fuse_service_open_command *oc =
 			container_of(p, struct fuse_service_open_command, p);
 	uint32_t request_flags;
 	int open_flags;
@@ -796,14 +798,14 @@ static int mount_service_open_path(struct mount_service *mo,
 	return ret;
 }
 
-static int mount_service_handle_open_cmd(struct mount_service *mo,
+static int mount_service_handle_open_cmd(const struct mount_service *mo,
 					 struct fuse_service_packet *p,
 					 size_t psz)
 {
 	return mount_service_open_path(mo, 0, p, psz);
 }
 
-static int mount_service_handle_open_bdev_cmd(struct mount_service *mo,
+static int mount_service_handle_open_bdev_cmd(const struct mount_service *mo,
 					      struct fuse_service_packet *p,
 					      size_t psz)
 {
@@ -834,7 +836,7 @@ static int mount_service_handle_fsopen_cmd(struct mount_service *mo,
 					   const struct fuse_service_packet *p,
 					   size_t psz)
 {
-	struct fuse_service_fsopen_command *oc =
+	const struct fuse_service_fsopen_command *oc =
 			container_of(p, struct fuse_service_fsopen_command, p);
 	uint32_t fsopen_flags;
 
@@ -1059,7 +1061,8 @@ static int mount_service_handle_mtabopts_cmd(struct mount_service *mo,
 	struct fuse_service_string_command *oc =
 			container_of(p, struct fuse_service_string_command, p);
 	char *tokstr = oc->value;
-	char *tok, *savetok;
+	const char *tok;
+	char *savetok;
 
 	if (psz < sizeof_fuse_service_string_command(1)) {
 		fprintf(stderr, "%s: mtab options command too small\n",
@@ -1284,9 +1287,10 @@ static int attach_to_mountpoint(struct mount_service *mo, mode_t expected_fmt,
 
 static int mount_service_handle_mountpoint_cmd(struct mount_service *mo,
 					       const struct fuse_service_packet *p,
-					       size_t psz, int argc, char *argv[])
+					       size_t psz, int argc,
+					       const char * const argv[])
 {
-	struct fuse_service_mountpoint_command *oc =
+	const struct fuse_service_mountpoint_command *oc =
 			container_of(p, struct fuse_service_mountpoint_command, p);
 	char *mntpt;
 	mode_t expected_fmt;
@@ -1373,8 +1377,8 @@ static inline int format_libfuse_mntopts(char *buf, size_t bufsz,
 }
 
 static int mount_service_regular_mount(struct mount_service *mo,
-				       struct fuse_service_mount_command *oc,
-				       struct stat *stbuf)
+				       const struct fuse_service_mount_command *oc,
+				       const struct stat *stbuf)
 {
 	char *fstype = NULL;
 	char *realmopts;
@@ -1534,8 +1538,8 @@ static int set_ms_flags(struct mount_service *mo, unsigned long ms_flags)
 }
 
 static int mount_service_fsopen_mount(struct mount_service *mo,
-				      struct fuse_service_mount_command *oc,
-				      struct stat *stbuf)
+				      const struct fuse_service_mount_command *oc,
+				      const struct stat *stbuf)
 {
 	char tmp[64];
 	unsigned long ms_flags;
@@ -1729,7 +1733,7 @@ static int check_nonroot_file_access(struct mount_service *mo)
 	return ret;
 }
 
-static void adjust_nonroot_mount_flags(struct mount_service *mo,
+static void adjust_nonroot_mount_flags(const struct mount_service *mo,
 				       struct fuse_service_mount_command *oc)
 {
 	const struct mount_flags *mf;
@@ -1905,11 +1909,11 @@ static int mount_service_handle_unmount_cmd(struct mount_service *mo,
 	return mount_service_send_reply(mo, 0);
 }
 
-static int mount_service_handle_bye_cmd(struct mount_service *mo,
+static int mount_service_handle_bye_cmd(const struct mount_service *mo,
 					struct fuse_service_packet *p,
 					size_t psz)
 {
-	struct fuse_service_bye_command *bc =
+	const struct fuse_service_bye_command *bc =
 			container_of(p, struct fuse_service_bye_command, p);
 	int ret;
 
@@ -2033,7 +2037,7 @@ int mount_service_main(int argc, char *argv[])
 			break;
 		case FUSE_SERVICE_MNTPT_CMD:
 			ret = mount_service_handle_mountpoint_cmd(&mo, p, sz,
-								  argc, argv);
+					argc, (const char * const *)argv);
 			break;
 		case FUSE_SERVICE_MTABOPTS_CMD:
 			ret = mount_service_handle_mtabopts_cmd(&mo, p, sz);


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 09/10] fuser_conf: fix cppcheck complaints
  2026-05-05  5:23 ` [PATCHSET 2/2] libfuse: new mount service container fixes Darrick J. Wong
                     ` (7 preceding siblings ...)
  2026-05-05  5:25   ` [PATCH 08/10] util: fix cppcheck complaints about constifying pointers Darrick J. Wong
@ 2026-05-05  5:26   ` Darrick J. Wong
  2026-05-05  5:26   ` [PATCH 10/10] example: fix cppcheck complaints about constifying pointers Darrick J. Wong
  2026-05-06 21:27   ` [PATCHSET 2/2] libfuse: new mount service container fixes Bernd Schubert
  10 siblings, 0 replies; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05  5:26 UTC (permalink / raw)
  To: djwong, bernd; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos

From: Darrick J. Wong <djwong@kernel.org>

Since I touched this file recently, let's fix the cppcheck complaints.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
 util/fuser_conf.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)


diff --git a/util/fuser_conf.c b/util/fuser_conf.c
index 2ce149cee38dcb..8203b145cceaca 100644
--- a/util/fuser_conf.c
+++ b/util/fuser_conf.c
@@ -103,16 +103,15 @@ static int count_fuse_fs_ls_mnt(const char *progname)
 	#define MNT_ID_LEN 128
 
 	int fuse_count = 0;
-	int n_mounts = 0;
-	int ret = 0;
 	uint64_t mnt_ids[MNT_ID_LEN];
 	unsigned char smbuf[SMBUF_SIZE];
 	struct mnt_id_req req = {
 		.size = sizeof(struct mnt_id_req),
 	};
-	struct statmount *sm;
 
 	for (;;) {
+		int n_mounts;
+
 		req.mnt_id = LSMT_ROOT;
 
 		n_mounts = syscall(SYS_listmount, &req, &mnt_ids, MNT_ID_LEN, 0);
@@ -125,6 +124,8 @@ static int count_fuse_fs_ls_mnt(const char *progname)
 		}
 
 		for (int i = 0; i < n_mounts; i++) {
+			int ret;
+
 			req.mnt_id = mnt_ids[i];
 			req.param = STATMOUNT_FS_TYPE;
 			ret = syscall(SYS_statmount, &req, &smbuf, SMBUF_SIZE, 0);
@@ -137,7 +138,7 @@ static int count_fuse_fs_ls_mnt(const char *progname)
 				return -1;
 			}
 
-			sm = (struct statmount *)smbuf;
+			const struct statmount *sm = (struct statmount *)smbuf;
 			if (sm->mask & STATMOUNT_FS_TYPE &&
 			    strcmp(&sm->str[sm->fs_type], "fuse") == 0)
 				fuse_count++;


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 10/10] example: fix cppcheck complaints about constifying pointers
  2026-05-05  5:23 ` [PATCHSET 2/2] libfuse: new mount service container fixes Darrick J. Wong
                     ` (8 preceding siblings ...)
  2026-05-05  5:26   ` [PATCH 09/10] fuser_conf: fix cppcheck complaints Darrick J. Wong
@ 2026-05-05  5:26   ` Darrick J. Wong
  2026-05-06 21:27   ` [PATCHSET 2/2] libfuse: new mount service container fixes Bernd Schubert
  10 siblings, 0 replies; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05  5:26 UTC (permalink / raw)
  To: djwong, bernd; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos

From: Darrick J. Wong <djwong@kernel.org>

Fix various cppcheck complaints about pointers that could be const
pointers instead.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 example/single_file.h |    2 +-
 example/single_file.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/example/single_file.h b/example/single_file.h
index 290dd6051ed6f5..6ca536a70cf682 100644
--- a/example/single_file.h
+++ b/example/single_file.h
@@ -114,7 +114,7 @@ int single_file_opt_proc(void *data, const char *arg, int key,
 unsigned long long parse_num_blocks(const char *arg, int log_block_size);
 
 struct fuse_service;
-int single_file_service_open(struct fuse_service *sf, const char *path);
+int single_file_service_open(const struct fuse_service *sf, const char *path);
 
 void single_file_check_read(off_t pos, size_t *count);
 int single_file_check_write(off_t pos, size_t *count);
diff --git a/example/single_file.c b/example/single_file.c
index a962232d576e17..59dbc6bbac5e77 100644
--- a/example/single_file.c
+++ b/example/single_file.c
@@ -756,7 +756,7 @@ int single_file_opt_proc(void *data, const char *arg, int key,
 	return 1;
 }
 
-int single_file_service_open(struct fuse_service *sf, const char *path)
+int single_file_service_open(const struct fuse_service *sf, const char *path)
 {
 	int open_flags = single_file.ro ? O_RDONLY : O_RDWR;
 	int fd;


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [GIT PULL 1/2] libfuse: new mount API and SYNC_INIT fixes
  2026-05-05  5:21 [PATCHBOMB] libfuse: various fixes for new mount code Darrick J. Wong
  2026-05-05  5:23 ` [PATCHSET 1/2] libfuse: new mount API and SYNC_INIT fixes Darrick J. Wong
  2026-05-05  5:23 ` [PATCHSET 2/2] libfuse: new mount service container fixes Darrick J. Wong
@ 2026-05-05  5:26 ` Darrick J. Wong
  2026-05-05  5:26 ` [GIT PULL 2/2] libfuse: new mount service container fixes Darrick J. Wong
  3 siblings, 0 replies; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05  5:26 UTC (permalink / raw)
  To: bernd, djwong; +Cc: fuse-devel, joannelkoong, linux-fsdevel, miklos, neal

Hi Bernd,

Please pull this branch with changes for libfuse.

As usual, I did a test-merge with the main upstream branch as of a few
minutes ago, and didn't see any conflicts.  Please let me know if you
encounter any problems.

--D

The following changes since commit d454f681fdd0e31217261d1656071a3d5c87d61e:

Show a feature config summary the end of meson setup --reconfigure (2026-05-04 17:29:41 +0200)

are available in the Git repository at:

https://git.kernel.org/pub/scm/linux/kernel/git/djwong/libfuse.git tags/fuse-mount-api-fixes_2026-05-04

for you to fetch changes up to ce2feba31ef7ab81807dcba3ae8f64d314ffd14a:

libfuse: always send the subtype to the kernel when using fsconfig() (2026-05-04 16:22:43 -0700)

----------------------------------------------------------------
libfuse: new mount API and SYNC_INIT fixes [01/10]

Here's a collection of bug fixes and cppcheck cleanups for the new mount
API code and the new SYNC_INIT code that landed in main recently.

With a bit of luck, this should all go splendidly.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>

----------------------------------------------------------------
Darrick J. Wong (2):
libfuse: don't use SYNC_INIT unless asked for
libfuse: always send the subtype to the kernel when using fsconfig()

lib/fuse_lowlevel.c  |  6 +++---
lib/mount_fsmount.c  | 13 +++++++++++++
util/mount_service.c |  3 ++-
3 files changed, 18 insertions(+), 4 deletions(-)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [GIT PULL 2/2] libfuse: new mount service container fixes
  2026-05-05  5:21 [PATCHBOMB] libfuse: various fixes for new mount code Darrick J. Wong
                   ` (2 preceding siblings ...)
  2026-05-05  5:26 ` [GIT PULL 1/2] libfuse: new mount API and SYNC_INIT fixes Darrick J. Wong
@ 2026-05-05  5:26 ` Darrick J. Wong
  3 siblings, 0 replies; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05  5:26 UTC (permalink / raw)
  To: bernd, djwong; +Cc: fuse-devel, joannelkoong, linux-fsdevel, miklos, neal

Hi Bernd,

Please pull this branch with changes for libfuse.

As usual, I did a test-merge with the main upstream branch as of a few
minutes ago, and didn't see any conflicts.  Please let me know if you
encounter any problems.

--D

The following changes since commit ce2feba31ef7ab81807dcba3ae8f64d314ffd14a:

libfuse: always send the subtype to the kernel when using fsconfig() (2026-05-04 16:22:43 -0700)

are available in the Git repository at:

https://git.kernel.org/pub/scm/linux/kernel/git/djwong/libfuse.git tags/fuse-service-container-fixes_2026-05-04

for you to fetch changes up to e3db9d31953fc5640999adcc8b74a54dfde0e651:

example: fix cppcheck complaints about constifying pointers (2026-05-04 16:22:44 -0700)

----------------------------------------------------------------
libfuse: new mount service container fixes [02/10]

This is a collection of bug fixes and cppcheck cleanups for the new fuse
service container code.

With a bit of luck, this should all go splendidly.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>

----------------------------------------------------------------
Darrick J. Wong (10):
util/mount.fuse.c: loop in waitpid
fuse_service: handle weird behavior during SCM_RIGHTS fd transfers
examples: improve documentation of the new systemd service fuse servers
example/single_file: sync backing fd when statx wants us to fsync
example/single_file: fix ctime handling
libfuse: fix cppcheck complaints about constifying pointers
libfuse: fix cppcheck complaints about constifying pointers in user-visible ABI
util: fix cppcheck complaints about constifying pointers
fuser_conf: fix cppcheck complaints
example: fix cppcheck complaints about constifying pointers

example/single_file.h   |  6 +++-
include/fuse_service.h  | 18 ++++++------
example/service_hl.c    | 20 +++++++++++--
example/service_ll.c    | 20 +++++++++++--
example/single_file.c   | 31 ++++++++++++++++----
lib/fuse_service.c      | 76 +++++++++++++++++++++++++++++++++----------------
lib/fuse_service_stub.c | 17 ++++++-----
util/fuser_conf.c       |  9 +++---
util/fuservicemount.c   |  2 +-
util/mount.fuse.c       |  4 ++-
util/mount_service.c    | 68 ++++++++++++++++++++++---------------------
11 files changed, 183 insertions(+), 88 deletions(-)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 1/2] libfuse: don't use SYNC_INIT unless asked for
  2026-05-05  5:23   ` [PATCH 1/2] libfuse: don't use SYNC_INIT unless asked for Darrick J. Wong
@ 2026-05-05  7:30     ` Bernd Schubert
  2026-05-05  8:17       ` Bernd Schubert
  2026-05-05 16:44     ` [PATCH v1.1 " Darrick J. Wong
  2026-05-05 23:10     ` [PATCH v1.2 " Darrick J. Wong
  2 siblings, 1 reply; 36+ messages in thread
From: Bernd Schubert @ 2026-05-05  7:30 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos



On 5/5/26 07:23, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> If we didn't ask for SYNC_INIT, don't enable it.  This is needed to
> maintain compatibility with older fuse servers that only support
> asynchronous FUSE_INIT.
> 
> Fixes: 3e1101057aea57 ("fuse mount: Support synchronous FUSE_INIT (privileged daemon)")
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  lib/fuse_lowlevel.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> 
> diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
> index 0e16845d2f14ff..0a801132590079 100644
> --- a/lib/fuse_lowlevel.c
> +++ b/lib/fuse_lowlevel.c
> @@ -4475,9 +4475,9 @@ static int session_start_sync_init(struct fuse_session *se, int fd)
>  {
>  	int err, res;
>  
> -	if (!se->want_sync_init &&
> -		(se->uring.enable && !fuse_daemonize_is_used())) {
> -		if (se->debug)
> +	if (!se->want_sync_init) {
> +		/* SYNC_INIT is required for io_uring(?) */
> +		if ((se->uring.enable && !fuse_daemonize_is_used()) || se->debug)
>  			fuse_log(FUSE_LOG_DEBUG,
>  					"fuse: sync init not enabled\n");
>  		return 0;
> 

Hmm, but mounting is kind of a libuse internal part? If this is really
needed the commit message should mention the exact reason - what is the
issue with old fuse servers and sync init?


Thanks,
Bernd

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 2/2] libfuse: always send the subtype to the kernel when using fsconfig()
  2026-05-05  5:23   ` [PATCH 2/2] libfuse: always send the subtype to the kernel when using fsconfig() Darrick J. Wong
@ 2026-05-05  7:41     ` Bernd Schubert
  2026-05-05 16:38       ` Darrick J. Wong
  0 siblings, 1 reply; 36+ messages in thread
From: Bernd Schubert @ 2026-05-05  7:41 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos



On 5/5/26 07:23, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Although it's possible to supply a filesystem subtype when calling
> fsopen(), it does not pass the stuff after the dot to the mount option
> parsing mechanism like the legacy mount() call does.  Therefore, it's
> necessary to pass the subtype explicitly via fsconfig() or else the
> subtype will be missing from the /proc/mounts output.
> 
> For example, fuse4fs with the old mount API produces this:
> 
> /dev/sda /mnt fuse.ext4 rw,nosuid,nodev,relatime,user_id=0,group_id=0 0 0
> 
> But with the new mount API, we only get:
> 
> /dev/sda /mnt fuse rw,nosuid,nodev,relatime,user_id=0,group_id=0 0 0
> 
> ...which breaks fstests, which requires the fsname to match the string
> that it passes to mount -t.  Update the comment in mount_service.c to
> match this requirement.
> 
> Fixes: 14cb7b93bb9688 ("Add support for the new linux mount API")
> Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> ---
>  lib/mount_fsmount.c  |   13 +++++++++++++
>  util/mount_service.c |    3 ++-
>  2 files changed, 15 insertions(+), 1 deletion(-)
> 
> 
> diff --git a/lib/mount_fsmount.c b/lib/mount_fsmount.c
> index 615271b09758c3..5e13b34ccfc610 100644
> --- a/lib/mount_fsmount.c
> +++ b/lib/mount_fsmount.c
> @@ -359,6 +359,19 @@ int fuse_kern_fsmount(const char *mnt, unsigned long flags, int blkdev,
>  		goto out_free;
>  	}
>  
> +	/* Configure subtype */
> +	if (subtype) {
> +		res = fsconfig(fsfd, FSCONFIG_SET_STRING, "subtype",
> +			       subtype, 0);
> +		if (res) {
> +			err = -errno;
> +			log_fsconfig_kmsg(fsfd);
> +			fprintf(stderr, "fuse: fsconfig subtype failed: %s\n",
> +				strerror(-err));
> +			goto out_free;
> +		}
> +	}
> +
>  	/* Configure source */
>  	res = fsconfig(fsfd, FSCONFIG_SET_STRING, "source", source, 0);
>  	if (res == -1) {

Oh yes, that had slipped through. Going to apply this.

> diff --git a/util/mount_service.c b/util/mount_service.c
> index bc5940bc900dad..3fbabfdd69300d 100644
> --- a/util/mount_service.c
> +++ b/util/mount_service.c
> @@ -821,7 +821,8 @@ static void try_fsopen(struct mount_service *mo)
>  	/*
>  	 * As of Linux 7.0 you can pass subtypes to fsopen, but the manpage for
>  	 * fsopen only says that you can pass any value of the second column of
> -	 * /proc/filesystems into fsopen.
> +	 * /proc/filesystems into fsopen.  You must still call fsconfig() for
> +	 * the subtype separately, however.
>  	 */
>  	mo->fsopenfd = fsopen(fsname(mo), FSOPEN_CLOEXEC);
>  }
> 

Can we integrate that into you series separately, as it is not merged yet?


Thanks,
Bernd

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 1/2] libfuse: don't use SYNC_INIT unless asked for
  2026-05-05  7:30     ` Bernd Schubert
@ 2026-05-05  8:17       ` Bernd Schubert
  2026-05-05 16:27         ` Darrick J. Wong
  0 siblings, 1 reply; 36+ messages in thread
From: Bernd Schubert @ 2026-05-05  8:17 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos



On 5/5/26 09:30, Bernd Schubert wrote:
> 
> 
> On 5/5/26 07:23, Darrick J. Wong wrote:
>> From: Darrick J. Wong <djwong@kernel.org>
>>
>> If we didn't ask for SYNC_INIT, don't enable it.  This is needed to
>> maintain compatibility with older fuse servers that only support
>> asynchronous FUSE_INIT.
>>
>> Fixes: 3e1101057aea57 ("fuse mount: Support synchronous FUSE_INIT (privileged daemon)")
>> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
>> ---
>>  lib/fuse_lowlevel.c |    6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>>
>> diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
>> index 0e16845d2f14ff..0a801132590079 100644
>> --- a/lib/fuse_lowlevel.c
>> +++ b/lib/fuse_lowlevel.c
>> @@ -4475,9 +4475,9 @@ static int session_start_sync_init(struct fuse_session *se, int fd)
>>  {
>>  	int err, res;
>>  
>> -	if (!se->want_sync_init &&
>> -		(se->uring.enable && !fuse_daemonize_is_used())) {
>> -		if (se->debug)
>> +	if (!se->want_sync_init) {
>> +		/* SYNC_INIT is required for io_uring(?) */
>> +		if ((se->uring.enable && !fuse_daemonize_is_used()) || se->debug)
>>  			fuse_log(FUSE_LOG_DEBUG,
>>  					"fuse: sync init not enabled\n");
>>  		return 0;
>>
> 
> Hmm, but mounting is kind of a libuse internal part? If this is really
> needed the commit message should mention the exact reason - what is the
> issue with old fuse servers and sync init?
> 

One reason I can think off is if the ->init() method starts new threads.
In that case we could still do allow the new mount API when the new
daemonize API is used.



^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 1/2] libfuse: don't use SYNC_INIT unless asked for
  2026-05-05  8:17       ` Bernd Schubert
@ 2026-05-05 16:27         ` Darrick J. Wong
  0 siblings, 0 replies; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05 16:27 UTC (permalink / raw)
  To: Bernd Schubert; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos

On Tue, May 05, 2026 at 10:17:54AM +0200, Bernd Schubert wrote:
> 
> 
> On 5/5/26 09:30, Bernd Schubert wrote:
> > 
> > 
> > On 5/5/26 07:23, Darrick J. Wong wrote:
> >> From: Darrick J. Wong <djwong@kernel.org>
> >>
> >> If we didn't ask for SYNC_INIT, don't enable it.  This is needed to
> >> maintain compatibility with older fuse servers that only support
> >> asynchronous FUSE_INIT.
> >>
> >> Fixes: 3e1101057aea57 ("fuse mount: Support synchronous FUSE_INIT (privileged daemon)")
> >> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> >> ---
> >>  lib/fuse_lowlevel.c |    6 +++---
> >>  1 file changed, 3 insertions(+), 3 deletions(-)
> >>
> >>
> >> diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
> >> index 0e16845d2f14ff..0a801132590079 100644
> >> --- a/lib/fuse_lowlevel.c
> >> +++ b/lib/fuse_lowlevel.c
> >> @@ -4475,9 +4475,9 @@ static int session_start_sync_init(struct fuse_session *se, int fd)
> >>  {
> >>  	int err, res;
> >>  
> >> -	if (!se->want_sync_init &&
> >> -		(se->uring.enable && !fuse_daemonize_is_used())) {
> >> -		if (se->debug)
> >> +	if (!se->want_sync_init) {
> >> +		/* SYNC_INIT is required for io_uring(?) */
> >> +		if ((se->uring.enable && !fuse_daemonize_is_used()) || se->debug)
> >>  			fuse_log(FUSE_LOG_DEBUG,
> >>  					"fuse: sync init not enabled\n");
> >>  		return 0;
> >>
> > 
> > Hmm, but mounting is kind of a libuse internal part? If this is really
> > needed the commit message should mention the exact reason - what is the
> > issue with old fuse servers and sync init?

fuse2fs calls fuse_main, then starts threads from ->init.  It doesn't
call fuse_daemonize_early_start because I haven't ported it to use any
of the new APIs.  I don't have io_uring enabled for fuse on my dev box.

fuse_main calls fuse_session_mount calls fuse_session_mount_new_api
calls session_start_sync_init.  At the start of the function,
se->want_sync_init, se->uring.enable, and daemonize.active are all
false.  The first branch is not taken, so we call FUSE_DEV_IOC_SYNC_INIT
and enable sync_init even though the user didn't ask for that and didn't
prepare for it either.

FUSE_DEV_IOC_SYNC_INIT succeeds, so we send the synchronous FUSE_INIT
from mount, which calls fuse2fs' init() method.  That starts the
background threads and returns.  Upon return to the kernel, the mount()
now succeeds, and the next thing that fuse_main does is call
fuse_daemonize().  Since we didn't call fuse_daemonize_early_start, the
daemonize forks the process and the threads die with the parent.

Looking at that logic a little more, I /think/ you could enable sync
init for fuse servers if they've called fuse_daemonize_early_start even
if they haven't called fuse_session_want_sync_init:

	/*
	 * The fuse server didn't explicitly ask for SYNC_INIT and it
	 * didn't call fuse_daemonize_early_start.  Assume this server
	 * was written before SYNC_INIT and continue using async init.
	 */
	if (!se->want_sync_init && !fuse_daemonize_is_used()) {
		/*
		 * The io_uring backend requires SYNC_INIT because
		 * $reasons, so log a message if we're not enabling
		 * that.
		 */
		if (se->uring.enable)
			fuse_log(..., "io_uring broken with async init");
		else if (se->debug)
			fuse_log(..., "sync init not enabled");
		return 0;
	}

Since (to the extent that I'm familiar with what fuse servers really do
with libfuse) I haven't seen anything that would be a problem.  However
the more cautious thing to do would be to continue using async init
unless fuse_session_want_sync_init is called.

> One reason I can think off is if the ->init() method starts new threads.
> In that case we could still do allow the new mount API when the new
> daemonize API is used.

Yes.  The new mount api still works (modulo patch 2) even if the
SYNC_INIT stuff isn't used.

--D

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 2/2] libfuse: always send the subtype to the kernel when using fsconfig()
  2026-05-05  7:41     ` Bernd Schubert
@ 2026-05-05 16:38       ` Darrick J. Wong
  0 siblings, 0 replies; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05 16:38 UTC (permalink / raw)
  To: Bernd Schubert; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos

On Tue, May 05, 2026 at 09:41:59AM +0200, Bernd Schubert wrote:
> 
> 
> On 5/5/26 07:23, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > Although it's possible to supply a filesystem subtype when calling
> > fsopen(), it does not pass the stuff after the dot to the mount option
> > parsing mechanism like the legacy mount() call does.  Therefore, it's
> > necessary to pass the subtype explicitly via fsconfig() or else the
> > subtype will be missing from the /proc/mounts output.
> > 
> > For example, fuse4fs with the old mount API produces this:
> > 
> > /dev/sda /mnt fuse.ext4 rw,nosuid,nodev,relatime,user_id=0,group_id=0 0 0
> > 
> > But with the new mount API, we only get:
> > 
> > /dev/sda /mnt fuse rw,nosuid,nodev,relatime,user_id=0,group_id=0 0 0
> > 
> > ...which breaks fstests, which requires the fsname to match the string
> > that it passes to mount -t.  Update the comment in mount_service.c to
> > match this requirement.
> > 
> > Fixes: 14cb7b93bb9688 ("Add support for the new linux mount API")
> > Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> > ---
> >  lib/mount_fsmount.c  |   13 +++++++++++++
> >  util/mount_service.c |    3 ++-
> >  2 files changed, 15 insertions(+), 1 deletion(-)
> > 
> > 
> > diff --git a/lib/mount_fsmount.c b/lib/mount_fsmount.c
> > index 615271b09758c3..5e13b34ccfc610 100644
> > --- a/lib/mount_fsmount.c
> > +++ b/lib/mount_fsmount.c
> > @@ -359,6 +359,19 @@ int fuse_kern_fsmount(const char *mnt, unsigned long flags, int blkdev,
> >  		goto out_free;
> >  	}
> >  
> > +	/* Configure subtype */
> > +	if (subtype) {
> > +		res = fsconfig(fsfd, FSCONFIG_SET_STRING, "subtype",
> > +			       subtype, 0);
> > +		if (res) {
> > +			err = -errno;
> > +			log_fsconfig_kmsg(fsfd);
> > +			fprintf(stderr, "fuse: fsconfig subtype failed: %s\n",
> > +				strerror(-err));
> > +			goto out_free;
> > +		}
> > +	}
> > +
> >  	/* Configure source */
> >  	res = fsconfig(fsfd, FSCONFIG_SET_STRING, "source", source, 0);
> >  	if (res == -1) {
> 
> Oh yes, that had slipped through. Going to apply this.

Thanks!

> > diff --git a/util/mount_service.c b/util/mount_service.c
> > index bc5940bc900dad..3fbabfdd69300d 100644
> > --- a/util/mount_service.c
> > +++ b/util/mount_service.c
> > @@ -821,7 +821,8 @@ static void try_fsopen(struct mount_service *mo)
> >  	/*
> >  	 * As of Linux 7.0 you can pass subtypes to fsopen, but the manpage for
> >  	 * fsopen only says that you can pass any value of the second column of
> > -	 * /proc/filesystems into fsopen.
> > +	 * /proc/filesystems into fsopen.  You must still call fsconfig() for
> > +	 * the subtype separately, however.
> >  	 */
> >  	mo->fsopenfd = fsopen(fsname(mo), FSOPEN_CLOEXEC);
> >  }
> > 
> 
> Can we integrate that into you series separately, as it is not merged yet?

I'll separate this hunk into a separate patch.

--D

> 
> Thanks,
> Bernd
> 

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH v1.1 1/2] libfuse: don't use SYNC_INIT unless asked for
  2026-05-05  5:23   ` [PATCH 1/2] libfuse: don't use SYNC_INIT unless asked for Darrick J. Wong
  2026-05-05  7:30     ` Bernd Schubert
@ 2026-05-05 16:44     ` Darrick J. Wong
  2026-05-05 20:02       ` Bernd Schubert
  2026-05-05 23:10     ` [PATCH v1.2 " Darrick J. Wong
  2 siblings, 1 reply; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05 16:44 UTC (permalink / raw)
  To: bernd; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos

From: Darrick J. Wong <djwong@kernel.org>

fuse2fs calls fuse_main, then starts threads from ->init.  It doesn't
call fuse_daemonize_early_start because I haven't ported it to use any
of the new APIs.  I don't have io_uring enabled for fuse on my dev box.

fuse_main calls fuse_session_mount calls fuse_session_mount_new_api
calls session_start_sync_init.  At the start of the function,
se->want_sync_init, se->uring.enable, and daemonize.active are all
false.  The first branch is not taken, so we call FUSE_DEV_IOC_SYNC_INIT
and enable sync_init even though the user didn't ask for that and didn't
prepare for it either.

FUSE_DEV_IOC_SYNC_INIT succeeds, so we send the synchronous FUSE_INIT
from mount, which calls fuse2fs' init() method.  That starts the
background threads and returns.  Upon return to the kernel, the mount()
now succeeds, and the next thing that fuse_main does is call
fuse_daemonize().  Since we didn't call fuse_daemonize_early_start, the
daemonize forks the process and the threads die with the parent.

If we didn't ask for SYNC_INIT, don't enable it.  This is needed to
maintain compatibility with older fuse servers that only support
asynchronous FUSE_INIT.

Fixes: 3e1101057aea57 ("fuse mount: Support synchronous FUSE_INIT (privileged daemon)")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
v1.1: improve commit message, refine logging logic
---
 lib/fuse_lowlevel.c |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index 0e16845d2f14ff..83158d02bb8827 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -4475,9 +4475,21 @@ static int session_start_sync_init(struct fuse_session *se, int fd)
 {
 	int err, res;
 
-	if (!se->want_sync_init &&
-		(se->uring.enable && !fuse_daemonize_is_used())) {
-		if (se->debug)
+	if (!se->want_sync_init) {
+		/*
+		 * SYNC_INIT is required for io_uring to initialize without
+		 * deadlocking the kernel if the fuse server crashes.
+		 *
+		 * !fuse_daemonize_is_used implies the fuse server doesn't know
+		 * about any of the SYNC_INIT APIs, so we don't enable sync
+		 * init or generate log messages.
+		 */
+		if (se->uring.enable)
+			fuse_log(FUSE_LOG_DEBUG,
+					"fuse: io_uring broken with async init\n");
+		else if (!fuse_daemonize_is_used())
+			; /* empty */
+		else if (se->debug)
 			fuse_log(FUSE_LOG_DEBUG,
 					"fuse: sync init not enabled\n");
 		return 0;

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH v1.1 1/2] libfuse: don't use SYNC_INIT unless asked for
  2026-05-05 16:44     ` [PATCH v1.1 " Darrick J. Wong
@ 2026-05-05 20:02       ` Bernd Schubert
  2026-05-05 22:08         ` Darrick J. Wong
  0 siblings, 1 reply; 36+ messages in thread
From: Bernd Schubert @ 2026-05-05 20:02 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos



On 5/5/26 18:44, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> fuse2fs calls fuse_main, then starts threads from ->init.  It doesn't
> call fuse_daemonize_early_start because I haven't ported it to use any
> of the new APIs.  I don't have io_uring enabled for fuse on my dev box.
> 
> fuse_main calls fuse_session_mount calls fuse_session_mount_new_api
> calls session_start_sync_init.  At the start of the function,
> se->want_sync_init, se->uring.enable, and daemonize.active are all
> false.  The first branch is not taken, so we call FUSE_DEV_IOC_SYNC_INIT
> and enable sync_init even though the user didn't ask for that and didn't
> prepare for it either.
> 
> FUSE_DEV_IOC_SYNC_INIT succeeds, so we send the synchronous FUSE_INIT
> from mount, which calls fuse2fs' init() method.  That starts the
> background threads and returns.  Upon return to the kernel, the mount()
> now succeeds, and the next thing that fuse_main does is call
> fuse_daemonize().  Since we didn't call fuse_daemonize_early_start, the
> daemonize forks the process and the threads die with the parent.
> 
> If we didn't ask for SYNC_INIT, don't enable it.  This is needed to
> maintain compatibility with older fuse servers that only support
> asynchronous FUSE_INIT.
> 
> Fixes: 3e1101057aea57 ("fuse mount: Support synchronous FUSE_INIT (privileged daemon)")
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
> v1.1: improve commit message, refine logging logic
> ---
>  lib/fuse_lowlevel.c |   18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
> index 0e16845d2f14ff..83158d02bb8827 100644
> --- a/lib/fuse_lowlevel.c
> +++ b/lib/fuse_lowlevel.c
> @@ -4475,9 +4475,21 @@ static int session_start_sync_init(struct fuse_session *se, int fd)
>  {
>  	int err, res;
>  
> -	if (!se->want_sync_init &&
> -		(se->uring.enable && !fuse_daemonize_is_used())) {
> -		if (se->debug)
> +	if (!se->want_sync_init) {
> +		/*
> +		 * SYNC_INIT is required for io_uring to initialize without
> +		 * deadlocking the kernel if the fuse server crashes.
> +		 *
> +		 * !fuse_daemonize_is_used implies the fuse server doesn't know
> +		 * about any of the SYNC_INIT APIs, so we don't enable sync
> +		 * init or generate log messages.
> +		 */
> +		if (se->uring.enable)
> +			fuse_log(FUSE_LOG_DEBUG,
> +					"fuse: io_uring broken with async init\n");

So want_sync_init is not enabled and it still logs this? Note that
default libfuse does not have a way to set log levels.

> +		else if (!fuse_daemonize_is_used())
> +			; /* empty */

Unless I misread it, it would still go into the return 0?

> +		else if (se->debug)
>  			fuse_log(FUSE_LOG_DEBUG,
>  					"fuse: sync init not enabled\n");

And now every time a log message here.

>  		return 0;

Why can't we change it to

if (!fuse_daemonize_is_used() && !want_sync_init)
       return 0;


If someone uses then new mount API, that someone has also tested sync
init. At best we could change want_sync_init to an integer so that a
daemon could disable sync init.
For testing I'm probably also going to add an env variable that allows
to disable sync init.

Btw, during the meetings I had asked AI to write tests for sync init,
looks like "ro" doesn't work yet. AI had created patch to fix that, but
I don't apply either the test nor the fix yet, need to carefully read
through it, but need to do something else before going to bed.


Thanks,
Bernd


^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH v1.1 1/2] libfuse: don't use SYNC_INIT unless asked for
  2026-05-05 20:02       ` Bernd Schubert
@ 2026-05-05 22:08         ` Darrick J. Wong
  2026-05-05 22:29           ` Bernd Schubert
  0 siblings, 1 reply; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05 22:08 UTC (permalink / raw)
  To: Bernd Schubert; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos

On Tue, May 05, 2026 at 10:02:18PM +0200, Bernd Schubert wrote:
> 
> 
> On 5/5/26 18:44, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > fuse2fs calls fuse_main, then starts threads from ->init.  It doesn't
> > call fuse_daemonize_early_start because I haven't ported it to use any
> > of the new APIs.  I don't have io_uring enabled for fuse on my dev box.
> > 
> > fuse_main calls fuse_session_mount calls fuse_session_mount_new_api
> > calls session_start_sync_init.  At the start of the function,
> > se->want_sync_init, se->uring.enable, and daemonize.active are all
> > false.  The first branch is not taken, so we call FUSE_DEV_IOC_SYNC_INIT
> > and enable sync_init even though the user didn't ask for that and didn't
> > prepare for it either.
> > 
> > FUSE_DEV_IOC_SYNC_INIT succeeds, so we send the synchronous FUSE_INIT
> > from mount, which calls fuse2fs' init() method.  That starts the
> > background threads and returns.  Upon return to the kernel, the mount()
> > now succeeds, and the next thing that fuse_main does is call
> > fuse_daemonize().  Since we didn't call fuse_daemonize_early_start, the
> > daemonize forks the process and the threads die with the parent.
> > 
> > If we didn't ask for SYNC_INIT, don't enable it.  This is needed to
> > maintain compatibility with older fuse servers that only support
> > asynchronous FUSE_INIT.
> > 
> > Fixes: 3e1101057aea57 ("fuse mount: Support synchronous FUSE_INIT (privileged daemon)")
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> > v1.1: improve commit message, refine logging logic
> > ---
> >  lib/fuse_lowlevel.c |   18 +++++++++++++++---
> >  1 file changed, 15 insertions(+), 3 deletions(-)
> > 
> > diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
> > index 0e16845d2f14ff..83158d02bb8827 100644
> > --- a/lib/fuse_lowlevel.c
> > +++ b/lib/fuse_lowlevel.c
> > @@ -4475,9 +4475,21 @@ static int session_start_sync_init(struct fuse_session *se, int fd)
> >  {
> >  	int err, res;
> >  
> > -	if (!se->want_sync_init &&
> > -		(se->uring.enable && !fuse_daemonize_is_used())) {
> > -		if (se->debug)
> > +	if (!se->want_sync_init) {
> > +		/*
> > +		 * SYNC_INIT is required for io_uring to initialize without
> > +		 * deadlocking the kernel if the fuse server crashes.
> > +		 *
> > +		 * !fuse_daemonize_is_used implies the fuse server doesn't know
> > +		 * about any of the SYNC_INIT APIs, so we don't enable sync
> > +		 * init or generate log messages.
> > +		 */
> > +		if (se->uring.enable)
> > +			fuse_log(FUSE_LOG_DEBUG,
> > +					"fuse: io_uring broken with async init\n");
> 
> So want_sync_init is not enabled and it still logs this? Note that
> default libfuse does not have a way to set log levels.

I'm not 

> > +		else if (!fuse_daemonize_is_used())
> > +			; /* empty */
> 
> Unless I misread it, it would still go into the return 0?

Correct.

> > +		else if (se->debug)
> >  			fuse_log(FUSE_LOG_DEBUG,
> >  					"fuse: sync init not enabled\n");
> 
> And now every time a log message here.

Only if you enable debug mode.

> >  		return 0;
> 
> Why can't we change it to
> 
> if (!fuse_daemonize_is_used() && !want_sync_init)
>        return 0;

That works for me.

> If someone uses then new mount API, that someone has also tested sync
> init.

I'm confused by this statement.

In this early bailout case (fuse server did not call
fuse_daemonize_early_start or fuse_session_want_sync_init) we return 0
without actually setting SYNC_INIT, correct?

Next, fuse_session_mount_new_api calls fuse_kern_fsmount_mo and libfuse
proceeds to mount with the new mount API.  The kernel uses the old async
init code, because nobody told it to do a synchronous init.

That sequence works fine, and I can prove it by strace'ing fuse2fs
startup.  The new mount API is used, but FUSE_INIT isn't seen by fuse2fs
until after the fuse_daemonize() call and the event loop gets set up.

In other words, fuse2fs uses the new mount API and does not use sync
init.  I think the correct statement is the inverse:

    If someone uses sync_init, that someone has also tested the new
    mount API.

My understanding of where we are right now is:

1. If a fuse server starts up the new daemonize code or sets
   want_sync_init, it will get SYNC_INIT.

   (I'm not sure what it means if they set want_sync_init and try to
   use the old daemonize code)

2. If it does neither of those things, it will not get SYNC_INIT.

In both cases we try the new fsmount().  If the fsmount API fails, then
we fall back to the classic mount().

Is that correct?

> At best we could change want_sync_init to an integer so that a
> daemon could disable sync init.
> For testing I'm probably also going to add an env variable that allows
> to disable sync init.

<shrug> That sounds ok to me.

> Btw, during the meetings I had asked AI to write tests for sync init,
> looks like "ro" doesn't work yet. AI had created patch to fix that, but
> I don't apply either the test nor the fix yet, need to carefully read
> through it, but need to do something else before going to bed.

Oh, yeah, mount_flags[] needs to have:

{"rw",           MS_RDONLY,        0,  1,    MOUNT_ATTR_RDONLY},
{"ro",           MS_RDONLY,        1,  1,    MOUNT_ATTR_RDONLY},

Sorry I missed that in the review.  I also missed that mount_service.c
should be ported to use mount_flags[].

--D

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH v1.1 1/2] libfuse: don't use SYNC_INIT unless asked for
  2026-05-05 22:08         ` Darrick J. Wong
@ 2026-05-05 22:29           ` Bernd Schubert
  2026-05-05 23:03             ` Darrick J. Wong
  0 siblings, 1 reply; 36+ messages in thread
From: Bernd Schubert @ 2026-05-05 22:29 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos



On 5/6/26 00:08, Darrick J. Wong wrote:
> On Tue, May 05, 2026 at 10:02:18PM +0200, Bernd Schubert wrote:
>>
>>
>> On 5/5/26 18:44, Darrick J. Wong wrote:
>>> From: Darrick J. Wong <djwong@kernel.org>
>>>
>>> fuse2fs calls fuse_main, then starts threads from ->init.  It doesn't
>>> call fuse_daemonize_early_start because I haven't ported it to use any
>>> of the new APIs.  I don't have io_uring enabled for fuse on my dev box.
>>>
>>> fuse_main calls fuse_session_mount calls fuse_session_mount_new_api
>>> calls session_start_sync_init.  At the start of the function,
>>> se->want_sync_init, se->uring.enable, and daemonize.active are all
>>> false.  The first branch is not taken, so we call FUSE_DEV_IOC_SYNC_INIT
>>> and enable sync_init even though the user didn't ask for that and didn't
>>> prepare for it either.
>>>
>>> FUSE_DEV_IOC_SYNC_INIT succeeds, so we send the synchronous FUSE_INIT
>>> from mount, which calls fuse2fs' init() method.  That starts the
>>> background threads and returns.  Upon return to the kernel, the mount()
>>> now succeeds, and the next thing that fuse_main does is call
>>> fuse_daemonize().  Since we didn't call fuse_daemonize_early_start, the
>>> daemonize forks the process and the threads die with the parent.
>>>
>>> If we didn't ask for SYNC_INIT, don't enable it.  This is needed to
>>> maintain compatibility with older fuse servers that only support
>>> asynchronous FUSE_INIT.
>>>
>>> Fixes: 3e1101057aea57 ("fuse mount: Support synchronous FUSE_INIT (privileged daemon)")
>>> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
>>> ---
>>> v1.1: improve commit message, refine logging logic
>>> ---
>>>  lib/fuse_lowlevel.c |   18 +++++++++++++++---
>>>  1 file changed, 15 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
>>> index 0e16845d2f14ff..83158d02bb8827 100644
>>> --- a/lib/fuse_lowlevel.c
>>> +++ b/lib/fuse_lowlevel.c
>>> @@ -4475,9 +4475,21 @@ static int session_start_sync_init(struct fuse_session *se, int fd)
>>>  {
>>>  	int err, res;
>>>  
>>> -	if (!se->want_sync_init &&
>>> -		(se->uring.enable && !fuse_daemonize_is_used())) {
>>> -		if (se->debug)
>>> +	if (!se->want_sync_init) {
>>> +		/*
>>> +		 * SYNC_INIT is required for io_uring to initialize without
>>> +		 * deadlocking the kernel if the fuse server crashes.
>>> +		 *
>>> +		 * !fuse_daemonize_is_used implies the fuse server doesn't know
>>> +		 * about any of the SYNC_INIT APIs, so we don't enable sync
>>> +		 * init or generate log messages.
>>> +		 */
>>> +		if (se->uring.enable)
>>> +			fuse_log(FUSE_LOG_DEBUG,
>>> +					"fuse: io_uring broken with async init\n");
>>
>> So want_sync_init is not enabled and it still logs this? Note that
>> default libfuse does not have a way to set log levels.
> 
> I'm not 

I need to work on libfuse log level setting, the current way doesn't
distinguish between log levels. But given all the other things to do and
given daemons I had been working with have their own logging system,
this always had a very low prio for me.

> 
>>> +		else if (!fuse_daemonize_is_used())
>>> +			; /* empty */
>>
>> Unless I misread it, it would still go into the return 0?
> 
> Correct.
> 
>>> +		else if (se->debug)
>>>  			fuse_log(FUSE_LOG_DEBUG,
>>>  					"fuse: sync init not enabled\n");
>>
>> And now every time a log message here.
> 
> Only if you enable debug mode.

Ah right.

> 
>>>  		return 0;
>>
>> Why can't we change it to
>>
>> if (!fuse_daemonize_is_used() && !want_sync_init)
>>        return 0;
> 
> That works for me.

Let's do that with another variable and also env to disable sync init
and new mount api.

> 
>> If someone uses then new mount API, that someone has also tested sync
>> init.
> 
> I'm confused by this statement.

I'm deeply sorry, I wanted to write "If someone uses the new daemonize
API, that someone ...". Oh well, that wold only be true for kernels that
have sync init.


> 
> In this early bailout case (fuse server did not call
> fuse_daemonize_early_start or fuse_session_want_sync_init) we return 0
> without actually setting SYNC_INIT, correct?
> 
> Next, fuse_session_mount_new_api calls fuse_kern_fsmount_mo and libfuse
> proceeds to mount with the new mount API.  The kernel uses the old async
> init code, because nobody told it to do a synchronous init.
> 
> That sequence works fine, and I can prove it by strace'ing fuse2fs
> startup.  The new mount API is used, but FUSE_INIT isn't seen by fuse2fs
> until after the fuse_daemonize() call and the event loop gets set up.
> 
> In other words, fuse2fs uses the new mount API and does not use sync
> init.  I think the correct statement is the inverse:
> 
>     If someone uses sync_init, that someone has also tested the new
>     mount API.
> 
> My understanding of where we are right now is:
> 
> 1. If a fuse server starts up the new daemonize code or sets
>    want_sync_init, it will get SYNC_INIT.
> 
>    (I'm not sure what it means if they set want_sync_init and try to
>    use the old daemonize code)
> 
> 2. If it does neither of those things, it will not get SYNC_INIT.
> 
> In both cases we try the new fsmount().  If the fsmount API fails, then
> we fall back to the classic mount().
> 
> Is that correct?
> 
>> At best we could change want_sync_init to an integer so that a
>> daemon could disable sync init.
>> For testing I'm probably also going to add an env variable that allows
>> to disable sync init.
> 
> <shrug> That sounds ok to me.
> 
>> Btw, during the meetings I had asked AI to write tests for sync init,
>> looks like "ro" doesn't work yet. AI had created patch to fix that, but
>> I don't apply either the test nor the fix yet, need to carefully read
>> through it, but need to do something else before going to bed.
> 
> Oh, yeah, mount_flags[] needs to have:
> 
> {"rw",           MS_RDONLY,        0,  1,    MOUNT_ATTR_RDONLY},
> {"ro",           MS_RDONLY,        1,  1,    MOUNT_ATTR_RDONLY},
> 
> Sorry I missed that in the review.  I also missed that mount_service.c
> should be ported to use mount_flags[].

Thanks, I need to read through the docs again. I think we update
mount_service.c after merging your series.


Thanks,\Bernd


^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH v1.1 1/2] libfuse: don't use SYNC_INIT unless asked for
  2026-05-05 22:29           ` Bernd Schubert
@ 2026-05-05 23:03             ` Darrick J. Wong
  0 siblings, 0 replies; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05 23:03 UTC (permalink / raw)
  To: Bernd Schubert; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos

On Wed, May 06, 2026 at 12:29:22AM +0200, Bernd Schubert wrote:
> 
> 
> On 5/6/26 00:08, Darrick J. Wong wrote:
> > On Tue, May 05, 2026 at 10:02:18PM +0200, Bernd Schubert wrote:
> >>
> >>
> >> On 5/5/26 18:44, Darrick J. Wong wrote:
> >>> From: Darrick J. Wong <djwong@kernel.org>
> >>>
> >>> fuse2fs calls fuse_main, then starts threads from ->init.  It doesn't
> >>> call fuse_daemonize_early_start because I haven't ported it to use any
> >>> of the new APIs.  I don't have io_uring enabled for fuse on my dev box.
> >>>
> >>> fuse_main calls fuse_session_mount calls fuse_session_mount_new_api
> >>> calls session_start_sync_init.  At the start of the function,
> >>> se->want_sync_init, se->uring.enable, and daemonize.active are all
> >>> false.  The first branch is not taken, so we call FUSE_DEV_IOC_SYNC_INIT
> >>> and enable sync_init even though the user didn't ask for that and didn't
> >>> prepare for it either.
> >>>
> >>> FUSE_DEV_IOC_SYNC_INIT succeeds, so we send the synchronous FUSE_INIT
> >>> from mount, which calls fuse2fs' init() method.  That starts the
> >>> background threads and returns.  Upon return to the kernel, the mount()
> >>> now succeeds, and the next thing that fuse_main does is call
> >>> fuse_daemonize().  Since we didn't call fuse_daemonize_early_start, the
> >>> daemonize forks the process and the threads die with the parent.
> >>>
> >>> If we didn't ask for SYNC_INIT, don't enable it.  This is needed to
> >>> maintain compatibility with older fuse servers that only support
> >>> asynchronous FUSE_INIT.
> >>>
> >>> Fixes: 3e1101057aea57 ("fuse mount: Support synchronous FUSE_INIT (privileged daemon)")
> >>> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> >>> ---
> >>> v1.1: improve commit message, refine logging logic
> >>> ---
> >>>  lib/fuse_lowlevel.c |   18 +++++++++++++++---
> >>>  1 file changed, 15 insertions(+), 3 deletions(-)
> >>>
> >>> diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
> >>> index 0e16845d2f14ff..83158d02bb8827 100644
> >>> --- a/lib/fuse_lowlevel.c
> >>> +++ b/lib/fuse_lowlevel.c
> >>> @@ -4475,9 +4475,21 @@ static int session_start_sync_init(struct fuse_session *se, int fd)
> >>>  {
> >>>  	int err, res;
> >>>  
> >>> -	if (!se->want_sync_init &&
> >>> -		(se->uring.enable && !fuse_daemonize_is_used())) {
> >>> -		if (se->debug)
> >>> +	if (!se->want_sync_init) {
> >>> +		/*
> >>> +		 * SYNC_INIT is required for io_uring to initialize without
> >>> +		 * deadlocking the kernel if the fuse server crashes.
> >>> +		 *
> >>> +		 * !fuse_daemonize_is_used implies the fuse server doesn't know
> >>> +		 * about any of the SYNC_INIT APIs, so we don't enable sync
> >>> +		 * init or generate log messages.
> >>> +		 */
> >>> +		if (se->uring.enable)
> >>> +			fuse_log(FUSE_LOG_DEBUG,
> >>> +					"fuse: io_uring broken with async init\n");
> >>
> >> So want_sync_init is not enabled and it still logs this? Note that
> >> default libfuse does not have a way to set log levels.
> > 
> > I'm not 
> 
> I need to work on libfuse log level setting, the current way doesn't
> distinguish between log levels. But given all the other things to do and
> given daemons I had been working with have their own logging system,
> this always had a very low prio for me.

<nod>  I'll leave it at this:

	/*
	 * Older fuse servers do not set want_sync_init or start the new
	 * daemonize code, so they get async init.
	 */
	if (!fuse_daemonize_is_used() || !se->want_sync_init) {
		if (se->debug)
			fuse_log(FUSE_LOG_DEBUG,
					"fuse: sync init not enabled\n");
		return 0;
	}

and then we can work on another commit that adds the magic env variable
that disables sync_init and/or fsmount.

> > 
> >>> +		else if (!fuse_daemonize_is_used())
> >>> +			; /* empty */
> >>
> >> Unless I misread it, it would still go into the return 0?
> > 
> > Correct.
> > 
> >>> +		else if (se->debug)
> >>>  			fuse_log(FUSE_LOG_DEBUG,
> >>>  					"fuse: sync init not enabled\n");
> >>
> >> And now every time a log message here.
> > 
> > Only if you enable debug mode.
> 
> Ah right.
> 
> > 
> >>>  		return 0;
> >>
> >> Why can't we change it to
> >>
> >> if (!fuse_daemonize_is_used() && !want_sync_init)
> >>        return 0;
> > 
> > That works for me.
> 
> Let's do that with another variable and also env to disable sync init
> and new mount api.
> 
> > 
> >> If someone uses then new mount API, that someone has also tested sync
> >> init.
> > 
> > I'm confused by this statement.
> 
> I'm deeply sorry, I wanted to write "If someone uses the new daemonize
> API, that someone ...". Oh well, that wold only be true for kernels that
> have sync init.

Ah, I got it now. :)

> > In this early bailout case (fuse server did not call
> > fuse_daemonize_early_start or fuse_session_want_sync_init) we return 0
> > without actually setting SYNC_INIT, correct?
> > 
> > Next, fuse_session_mount_new_api calls fuse_kern_fsmount_mo and libfuse
> > proceeds to mount with the new mount API.  The kernel uses the old async
> > init code, because nobody told it to do a synchronous init.
> > 
> > That sequence works fine, and I can prove it by strace'ing fuse2fs
> > startup.  The new mount API is used, but FUSE_INIT isn't seen by fuse2fs
> > until after the fuse_daemonize() call and the event loop gets set up.
> > 
> > In other words, fuse2fs uses the new mount API and does not use sync
> > init.  I think the correct statement is the inverse:
> > 
> >     If someone uses sync_init, that someone has also tested the new
> >     mount API.
> > 
> > My understanding of where we are right now is:
> > 
> > 1. If a fuse server starts up the new daemonize code or sets
> >    want_sync_init, it will get SYNC_INIT.
> > 
> >    (I'm not sure what it means if they set want_sync_init and try to
> >    use the old daemonize code)
> > 
> > 2. If it does neither of those things, it will not get SYNC_INIT.
> > 
> > In both cases we try the new fsmount().  If the fsmount API fails, then
> > we fall back to the classic mount().
> > 
> > Is that correct?
> > 
> >> At best we could change want_sync_init to an integer so that a
> >> daemon could disable sync init.
> >> For testing I'm probably also going to add an env variable that allows
> >> to disable sync init.
> > 
> > <shrug> That sounds ok to me.
> > 
> >> Btw, during the meetings I had asked AI to write tests for sync init,
> >> looks like "ro" doesn't work yet. AI had created patch to fix that, but
> >> I don't apply either the test nor the fix yet, need to carefully read
> >> through it, but need to do something else before going to bed.
> > 
> > Oh, yeah, mount_flags[] needs to have:
> > 
> > {"rw",           MS_RDONLY,        0,  1,    MOUNT_ATTR_RDONLY},
> > {"ro",           MS_RDONLY,        1,  1,    MOUNT_ATTR_RDONLY},
> > 
> > Sorry I missed that in the review.  I also missed that mount_service.c
> > should be ported to use mount_flags[].
> 
> Thanks, I need to read through the docs again. I think we update
> mount_service.c after merging your series.

<nod>  I'll post the fix for mount_flags shortly, and the
mount_service.c port whenever I get to another round of patchset 2.

--D

> 
> Thanks,\Bernd
> 

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 3/2] mount_util: fix mount_flags entries for MS_RDONLY
  2026-05-05  5:23 ` [PATCHSET 1/2] libfuse: new mount API and SYNC_INIT fixes Darrick J. Wong
  2026-05-05  5:23   ` [PATCH 1/2] libfuse: don't use SYNC_INIT unless asked for Darrick J. Wong
  2026-05-05  5:23   ` [PATCH 2/2] libfuse: always send the subtype to the kernel when using fsconfig() Darrick J. Wong
@ 2026-05-05 23:09   ` Darrick J. Wong
  2 siblings, 0 replies; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05 23:09 UTC (permalink / raw)
  To: bernd; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos

From: Darrick J. Wong <djwong@kernel.org>

MS_RDONLY maps to MOUNT_ATTR_RDONLY in the new fsmount API, but the
table omitted that.  Fix that.

Fixes: 0d7e72541564a5 ("Unify mount flag structures and remove redundant is_mount_attr field")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 lib/mount_util.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/mount_util.c b/lib/mount_util.c
index 1a0aec9bfe1a70..7ab1dba91e28e3 100644
--- a/lib/mount_util.c
+++ b/lib/mount_util.c
@@ -110,8 +110,8 @@
 
 const struct mount_flags mount_flags[] = {
 /* opt            flag             on  safe  mount_attr */
-{"rw",           MS_RDONLY,        0,  1,    0},                      /* fsconfig */
-{"ro",           MS_RDONLY,        1,  1,    0},                      /* fsconfig */
+{"rw",           MS_RDONLY,        0,  1,    MOUNT_ATTR_RDONLY},     /* fsconfig */
+{"ro",           MS_RDONLY,        1,  1,    MOUNT_ATTR_RDONLY},     /* fsconfig */
 {"suid",         MS_NOSUID,        0,  0,    MOUNT_ATTR_NOSUID},     /* fsmount  */
 {"nosuid",       MS_NOSUID,        1,  1,    MOUNT_ATTR_NOSUID},     /* fsmount  */
 {"dev",          MS_NODEV,         0,  1,    MOUNT_ATTR_NODEV},      /* fsmount  */

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH v1.2 1/2] libfuse: don't use SYNC_INIT unless asked for
  2026-05-05  5:23   ` [PATCH 1/2] libfuse: don't use SYNC_INIT unless asked for Darrick J. Wong
  2026-05-05  7:30     ` Bernd Schubert
  2026-05-05 16:44     ` [PATCH v1.1 " Darrick J. Wong
@ 2026-05-05 23:10     ` Darrick J. Wong
  2 siblings, 0 replies; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-05 23:10 UTC (permalink / raw)
  To: bernd; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos

From: Darrick J. Wong <djwong@kernel.org>

fuse2fs calls fuse_main, then starts threads from ->init.  It doesn't
call fuse_daemonize_early_start because I haven't ported it to use any
of the new APIs.  I don't have io_uring enabled for fuse on my dev box.

fuse_main calls fuse_session_mount calls fuse_session_mount_new_api
calls session_start_sync_init.  At the start of the function,
se->want_sync_init, se->uring.enable, and daemonize.active are all
false.  The first branch is not taken, so we call FUSE_DEV_IOC_SYNC_INIT
and enable sync_init even though the user didn't ask for that and didn't
prepare for it either.

FUSE_DEV_IOC_SYNC_INIT succeeds, so we send the synchronous FUSE_INIT
from mount, which calls fuse2fs' init() method.  That starts the
background threads and returns.  Upon return to the kernel, the mount()
now succeeds, and the next thing that fuse_main does is call
fuse_daemonize().  Since we didn't call fuse_daemonize_early_start, the
daemonize forks the process and the threads die with the parent.

If we didn't ask for SYNC_INIT, don't enable it.  This is needed to
maintain compatibility with older fuse servers that only support
asynchronous FUSE_INIT.

Fixes: 3e1101057aea57 ("fuse mount: Support synchronous FUSE_INIT (privileged daemon)")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
--
v1.2: simplify the logic even more
v1.1: improve commit message, refine logging logic
---
 lib/fuse_lowlevel.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index 0e16845d2f14ff..6e078e820eddec 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -4475,8 +4475,11 @@ static int session_start_sync_init(struct fuse_session *se, int fd)
 {
 	int err, res;
 
-	if (!se->want_sync_init &&
-		(se->uring.enable && !fuse_daemonize_is_used())) {
+	/*
+	 * Older fuse servers do not set want_sync_init or start the new
+	 * daemonize code, so they get async init.
+	 */
+	if (!fuse_daemonize_is_used() || !se->want_sync_init) {
 		if (se->debug)
 			fuse_log(FUSE_LOG_DEBUG,
 					"fuse: sync init not enabled\n");

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCHSET 2/2] libfuse: new mount service container fixes
  2026-05-05  5:23 ` [PATCHSET 2/2] libfuse: new mount service container fixes Darrick J. Wong
                     ` (9 preceding siblings ...)
  2026-05-05  5:26   ` [PATCH 10/10] example: fix cppcheck complaints about constifying pointers Darrick J. Wong
@ 2026-05-06 21:27   ` Bernd Schubert
  2026-05-06 21:36     ` Bernd Schubert
  10 siblings, 1 reply; 36+ messages in thread
From: Bernd Schubert @ 2026-05-06 21:27 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos



On 5/5/26 07:23, Darrick J. Wong wrote:
> Hi all,
> 
> This is a collection of bug fixes and cppcheck cleanups for the new fuse
> service container code.
> 
> With a bit of luck, this should all go splendidly.
> Comments and questions are, as always, welcome.

Hi Darrick,

do you have by any chance a branch I could pull from? With PATCHSET 1 in
the same thread I don't know how to handle it with "b4 shazam".
Alternatively, I'm also open to learn new b4 or git am commands.

I will try to review it at airport or during the flight, but would
reallu help me, if I could just get the patches into a branch for
offline processing.

Thanks,
Bernd

> 
> --D
> ---
> Commits in this patchset:
>  * util/mount.fuse.c: loop in waitpid
>  * fuse_service: handle weird behavior during SCM_RIGHTS fd transfers
>  * examples: improve documentation of the new systemd service fuse servers
>  * example/single_file: sync backing fd when statx wants us to fsync
>  * example/single_file: fix ctime handling
>  * libfuse: fix cppcheck complaints about constifying pointers
>  * libfuse: fix cppcheck complaints about constifying pointers in user-visible ABI
>  * util: fix cppcheck complaints about constifying pointers
>  * fuser_conf: fix cppcheck complaints
>  * example: fix cppcheck complaints about constifying pointers
> ---
>  example/single_file.h   |    6 +++-
>  include/fuse_service.h  |   18 ++++++-----
>  example/service_hl.c    |   20 +++++++++++-
>  example/service_ll.c    |   20 +++++++++++-
>  example/single_file.c   |   31 ++++++++++++++++---
>  lib/fuse_service.c      |   76 ++++++++++++++++++++++++++++++++---------------
>  lib/fuse_service_stub.c |   17 ++++++-----
>  util/fuser_conf.c       |    9 +++---
>  util/fuservicemount.c   |    2 +
>  util/mount.fuse.c       |    4 ++
>  util/mount_service.c    |   68 ++++++++++++++++++++++--------------------
>  11 files changed, 183 insertions(+), 88 deletions(-)
> 


^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCHSET 2/2] libfuse: new mount service container fixes
  2026-05-06 21:27   ` [PATCHSET 2/2] libfuse: new mount service container fixes Bernd Schubert
@ 2026-05-06 21:36     ` Bernd Schubert
  0 siblings, 0 replies; 36+ messages in thread
From: Bernd Schubert @ 2026-05-06 21:36 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: joannelkoong, neal, fuse-devel, linux-fsdevel, miklos



On 5/6/26 23:27, Bernd Schubert wrote:
> 
> 
> On 5/5/26 07:23, Darrick J. Wong wrote:
>> Hi all,
>>
>> This is a collection of bug fixes and cppcheck cleanups for the new fuse
>> service container code.
>>
>> With a bit of luck, this should all go splendidly.
>> Comments and questions are, as always, welcome.
> 
> Hi Darrick,
> 
> do you have by any chance a branch I could pull from? With PATCHSET 1 in
> the same thread I don't know how to handle it with "b4 shazam".
> Alternatively, I'm also open to learn new b4 or git am commands.
> 
> I will try to review it at airport or during the flight, but would
> reallu help me, if I could just get the patches into a branch for
> offline processing.
> 

Sorry, never mind, just found the pull request mail. Thanks a lot for
that! Pull and pushed to my github repo. Let's see how tests go :)


Thanks,
Bernd




^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCHSET 2/2] libfuse: new mount service container fixes
@ 2026-05-07 22:13 Darrick J. Wong
  2026-05-08 17:05 ` Bernd Schubert
  0 siblings, 1 reply; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-07 22:13 UTC (permalink / raw)
  To: bernd, djwong; +Cc: miklos, joannelkoong, fuse-devel, neal, linux-fsdevel

Hi all,

This is a collection of bug fixes and cppcheck cleanups for the new fuse
service container code.

With a bit of luck, this should all go splendidly.
Comments and questions are, as always, welcome.

--D
---
Commits in this patchset:
 * mount_service: use the mount_flags table instead of declaring our own
---
 util/mount_service.c |   51 +++++++++++++-------------------------------------
 1 file changed, 13 insertions(+), 38 deletions(-)


^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCHSET 2/2] libfuse: new mount service container fixes
  2026-05-07 22:13 [PATCHSET " Darrick J. Wong
@ 2026-05-08 17:05 ` Bernd Schubert
  2026-05-08 17:12   ` Bernd Schubert
  2026-05-09  0:43   ` Darrick J. Wong
  0 siblings, 2 replies; 36+ messages in thread
From: Bernd Schubert @ 2026-05-08 17:05 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: miklos, joannelkoong, fuse-devel, neal, linux-fsdevel

Hi Darrick

On 5/8/26 00:13, Darrick J. Wong wrote:
> Hi all,
> 
> This is a collection of bug fixes and cppcheck cleanups for the new fuse
> service container code.
> 
> With a bit of luck, this should all go splendidly.
> Comments and questions are, as always, welcome.
> 
> --D
> ---
> Commits in this patchset:
>  * mount_service: use the mount_flags table instead of declaring our own
> ---
>  util/mount_service.c |   51 +++++++++++++-------------------------------------
>  1 file changed, 13 insertions(+), 38 deletions(-)
> 
> 

coud you please add this or or something similar to your series, to
silence gcc static checker warnings?

commit 670fb8f4a248cfd50af43510033b8b3167d75df6 (HEAD ->
fuse-service-container)
Author: Bernd Schubert <bernd@bsbernd.com>
Date:   Fri May 8 19:00:02 2026 +0200

    Fix deref-before-check in mount.fuse.c

diff --git a/util/mount.fuse.c b/util/mount.fuse.c
index 802d7f99fe78..00b133e62344 100644
--- a/util/mount.fuse.c
+++ b/util/mount.fuse.c
@@ -384,7 +384,7 @@ int main(int argc, char *argv[])
        }

        source = argv[1];
-       if (!source[0])
+       if (source && !source[0])
                source = NULL;

        mountpoint = argv[2];



All your "Fixes:" commit messages run into

bschubert2@imesrv6 libfuse.git>.github/workflows/run-checkpatch.sh &&
stg push
No typos will be found - file
'/home/bschubert2/src/libfuse/libfuse.git/spelling.txt': No such file or
directory
No structs that should be const will be found - file
'/home/bschubert2/src/libfuse/libfuse.git/const_structs.checkpatch': No
such file or directory
WARNING:BAD_FIXES_TAG: Please use correct Fixes: style 'Fixes: <12 chars
of sha1> ("<title line>")' - ie: 'Fixes: 3e1101057aea ("fuse mount:
Support synchronous FUSE_INIT (privileged daemon)")'
#10:
Fixes: 3e1101057aea57 ("fuse mount: Support synchronous FUSE_INIT
(privileged daemon)")

total: 0 errors, 1 warnings, 12 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or
--fix-inplace.

Commit a9e52715f595 ("libfuse: don't use SYNC_INIT unless asked for")
has style problems, please review.

NOTE: Ignored message types: AVOID_EXTERNS COMMIT_MESSAGE COMPLEX_MACRO
EMAIL_SUBJECT ENOSYS ENOSYS_SYSCALL FILE_PATH_CHANGES
FROM_SIGN_OFF_MISMATCH GIT_COMMIT_ID MAINTAINERS
PREFER_ATTRIBUTE_ALWAYS_UNUSED PREFER_DEFINED_ATTRIBUTE_MACRO
QUOTED_COMMIT_ID SPDX_LICENSE_TAG STRCPY STRNCPY

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.


Is does linux checkpatch use two chars more for the hash in the mean
time than what libfuse/checkpatch.pl has?


Thanks,
Bernd



^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCHSET 2/2] libfuse: new mount service container fixes
  2026-05-08 17:05 ` Bernd Schubert
@ 2026-05-08 17:12   ` Bernd Schubert
  2026-05-08 17:50     ` Bernd Schubert
  2026-05-09  0:43   ` Darrick J. Wong
  1 sibling, 1 reply; 36+ messages in thread
From: Bernd Schubert @ 2026-05-08 17:12 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: miklos, joannelkoong, fuse-devel, neal, linux-fsdevel

Hi Darrick,

could you please also look into the CodeQL reports?

https://github.com/libfuse/libfuse/pull/1444#discussion_r3144133589


Thanks,
Bernd

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCHSET 2/2] libfuse: new mount service container fixes
  2026-05-08 17:12   ` Bernd Schubert
@ 2026-05-08 17:50     ` Bernd Schubert
  0 siblings, 0 replies; 36+ messages in thread
From: Bernd Schubert @ 2026-05-08 17:50 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: miklos, joannelkoong, fuse-devel, neal, linux-fsdevel



On 5/8/26 19:12, Bernd Schubert wrote:
> Hi Darrick,
> 
> could you please also look into the CodeQL reports?
> 
> https://github.com/libfuse/libfuse/pull/1444#discussion_r3144133589

The GUI allows me to click away issues. However, would be good if I
wouldn't need to do all the decisions on my own :)


Thanks,
Bernd

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCHSET 2/2] libfuse: new mount service container fixes
  2026-05-08 17:05 ` Bernd Schubert
  2026-05-08 17:12   ` Bernd Schubert
@ 2026-05-09  0:43   ` Darrick J. Wong
  1 sibling, 0 replies; 36+ messages in thread
From: Darrick J. Wong @ 2026-05-09  0:43 UTC (permalink / raw)
  To: Bernd Schubert; +Cc: miklos, joannelkoong, fuse-devel, neal, linux-fsdevel

On Fri, May 08, 2026 at 07:05:52PM +0200, Bernd Schubert wrote:
> Hi Darrick
> 
> On 5/8/26 00:13, Darrick J. Wong wrote:
> > Hi all,
> > 
> > This is a collection of bug fixes and cppcheck cleanups for the new fuse
> > service container code.
> > 
> > With a bit of luck, this should all go splendidly.
> > Comments and questions are, as always, welcome.
> > 
> > --D
> > ---
> > Commits in this patchset:
> >  * mount_service: use the mount_flags table instead of declaring our own
> > ---
> >  util/mount_service.c |   51 +++++++++++++-------------------------------------
> >  1 file changed, 13 insertions(+), 38 deletions(-)
> > 
> > 
> 
> coud you please add this or or something similar to your series, to
> silence gcc static checker warnings?

Ok... though it appears to be in your fuse-service-container branch now
so I'll just rebase on that.

> commit 670fb8f4a248cfd50af43510033b8b3167d75df6 (HEAD ->
> fuse-service-container)
> Author: Bernd Schubert <bernd@bsbernd.com>
> Date:   Fri May 8 19:00:02 2026 +0200
> 
>     Fix deref-before-check in mount.fuse.c
> 
> diff --git a/util/mount.fuse.c b/util/mount.fuse.c
> index 802d7f99fe78..00b133e62344 100644
> --- a/util/mount.fuse.c
> +++ b/util/mount.fuse.c
> @@ -384,7 +384,7 @@ int main(int argc, char *argv[])
>         }
> 
>         source = argv[1];
> -       if (!source[0])
> +       if (source && !source[0])
>                 source = NULL;
> 
>         mountpoint = argv[2];
> 
> 
> 
> All your "Fixes:" commit messages run into
> 
> bschubert2@imesrv6 libfuse.git>.github/workflows/run-checkpatch.sh &&
> stg push
> No typos will be found - file
> '/home/bschubert2/src/libfuse/libfuse.git/spelling.txt': No such file or
> directory
> No structs that should be const will be found - file
> '/home/bschubert2/src/libfuse/libfuse.git/const_structs.checkpatch': No
> such file or directory
> WARNING:BAD_FIXES_TAG: Please use correct Fixes: style 'Fixes: <12 chars
> of sha1> ("<title line>")' - ie: 'Fixes: 3e1101057aea ("fuse mount:
> Support synchronous FUSE_INIT (privileged daemon)")'
> #10:
> Fixes: 3e1101057aea57 ("fuse mount: Support synchronous FUSE_INIT
> (privileged daemon)")
> 
> total: 0 errors, 1 warnings, 12 lines checked
> 
> NOTE: For some of the reported defects, checkpatch may be able to
>       mechanically convert to the typical style using --fix or
> --fix-inplace.
> 
> Commit a9e52715f595 ("libfuse: don't use SYNC_INIT unless asked for")
> has style problems, please review.
> 
> NOTE: Ignored message types: AVOID_EXTERNS COMMIT_MESSAGE COMPLEX_MACRO
> EMAIL_SUBJECT ENOSYS ENOSYS_SYSCALL FILE_PATH_CHANGES
> FROM_SIGN_OFF_MISMATCH GIT_COMMIT_ID MAINTAINERS
> PREFER_ATTRIBUTE_ALWAYS_UNUSED PREFER_DEFINED_ATTRIBUTE_MACRO
> QUOTED_COMMIT_ID SPDX_LICENSE_TAG STRCPY STRNCPY
> 
> NOTE: If any of the errors are false positives, please report
>       them to the maintainer, see CHECKPATCH in MAINTAINERS.
> 
> 
> Is does linux checkpatch use two chars more for the hash in the mean
> time than what libfuse/checkpatch.pl has?

Current Linux checkpatch.pl enforces 12 hex digits or more:

$ grep chars.*sha scripts/checkpatch.pl
3288:                                "Please use correct Fixes: style 'Fixes: <12+ chars of sha1> (\"<title line>\")' - ie: '$fixed'\n" . $herecurr) &&
3453:                                 "Please use git commit description style 'commit <12+ chars of sha1> (\"<title line>\")' - ie: '${init_char}ommit $id (\"$description\")'\n" . $herectx);

This was last amended in 6.14 with commit 6356f18f09dc07 ("Align git
commit ID abbreviation guidelines and checks").

I personally set it to 14 in gitconfig for future-proofing against hash
collisions.

--D

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2026-05-09  0:43 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05  5:21 [PATCHBOMB] libfuse: various fixes for new mount code Darrick J. Wong
2026-05-05  5:23 ` [PATCHSET 1/2] libfuse: new mount API and SYNC_INIT fixes Darrick J. Wong
2026-05-05  5:23   ` [PATCH 1/2] libfuse: don't use SYNC_INIT unless asked for Darrick J. Wong
2026-05-05  7:30     ` Bernd Schubert
2026-05-05  8:17       ` Bernd Schubert
2026-05-05 16:27         ` Darrick J. Wong
2026-05-05 16:44     ` [PATCH v1.1 " Darrick J. Wong
2026-05-05 20:02       ` Bernd Schubert
2026-05-05 22:08         ` Darrick J. Wong
2026-05-05 22:29           ` Bernd Schubert
2026-05-05 23:03             ` Darrick J. Wong
2026-05-05 23:10     ` [PATCH v1.2 " Darrick J. Wong
2026-05-05  5:23   ` [PATCH 2/2] libfuse: always send the subtype to the kernel when using fsconfig() Darrick J. Wong
2026-05-05  7:41     ` Bernd Schubert
2026-05-05 16:38       ` Darrick J. Wong
2026-05-05 23:09   ` [PATCH 3/2] mount_util: fix mount_flags entries for MS_RDONLY Darrick J. Wong
2026-05-05  5:23 ` [PATCHSET 2/2] libfuse: new mount service container fixes Darrick J. Wong
2026-05-05  5:24   ` [PATCH 01/10] util/mount.fuse.c: loop in waitpid Darrick J. Wong
2026-05-05  5:24   ` [PATCH 02/10] fuse_service: handle weird behavior during SCM_RIGHTS fd transfers Darrick J. Wong
2026-05-05  5:24   ` [PATCH 03/10] examples: improve documentation of the new systemd service fuse servers Darrick J. Wong
2026-05-05  5:24   ` [PATCH 04/10] example/single_file: sync backing fd when statx wants us to fsync Darrick J. Wong
2026-05-05  5:25   ` [PATCH 05/10] example/single_file: fix ctime handling Darrick J. Wong
2026-05-05  5:25   ` [PATCH 06/10] libfuse: fix cppcheck complaints about constifying pointers Darrick J. Wong
2026-05-05  5:25   ` [PATCH 07/10] libfuse: fix cppcheck complaints about constifying pointers in user-visible ABI Darrick J. Wong
2026-05-05  5:25   ` [PATCH 08/10] util: fix cppcheck complaints about constifying pointers Darrick J. Wong
2026-05-05  5:26   ` [PATCH 09/10] fuser_conf: fix cppcheck complaints Darrick J. Wong
2026-05-05  5:26   ` [PATCH 10/10] example: fix cppcheck complaints about constifying pointers Darrick J. Wong
2026-05-06 21:27   ` [PATCHSET 2/2] libfuse: new mount service container fixes Bernd Schubert
2026-05-06 21:36     ` Bernd Schubert
2026-05-05  5:26 ` [GIT PULL 1/2] libfuse: new mount API and SYNC_INIT fixes Darrick J. Wong
2026-05-05  5:26 ` [GIT PULL 2/2] libfuse: new mount service container fixes Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2026-05-07 22:13 [PATCHSET " Darrick J. Wong
2026-05-08 17:05 ` Bernd Schubert
2026-05-08 17:12   ` Bernd Schubert
2026-05-08 17:50     ` Bernd Schubert
2026-05-09  0:43   ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox