Linux filesystem development
 help / color / mirror / Atom feed
* [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 ` Darrick J. Wong
  2026-05-06 21:27   ` Bernd Schubert
  0 siblings, 1 reply; 16+ 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] 16+ 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
@ 2026-05-06 21:27   ` Bernd Schubert
  2026-05-06 21:36     ` Bernd Schubert
  0 siblings, 1 reply; 16+ 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] 16+ messages in thread

* Re: [PATCHSET 2/2] libfuse: new mount service container fixes
  2026-05-06 21:27   ` Bernd Schubert
@ 2026-05-06 21:36     ` Bernd Schubert
  0 siblings, 0 replies; 16+ 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] 16+ messages in thread

* [PATCHSET 2/2] libfuse: new mount service container fixes
@ 2026-05-07 22:13 Darrick J. Wong
  2026-05-07 22:14 ` [PATCH 1/1] mount_service: use the mount_flags table instead of declaring our own Darrick J. Wong
  2026-05-08 17:05 ` [PATCHSET 2/2] libfuse: new mount service container fixes Bernd Schubert
  0 siblings, 2 replies; 16+ 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] 16+ messages in thread

* [PATCH 1/1] mount_service: use the mount_flags table instead of declaring our own
  2026-05-07 22:13 [PATCHSET 2/2] libfuse: new mount service container fixes Darrick J. Wong
@ 2026-05-07 22:14 ` Darrick J. Wong
  2026-05-08 16:51   ` Bernd Schubert
  2026-05-08 17:05 ` [PATCHSET 2/2] libfuse: new mount service container fixes Bernd Schubert
  1 sibling, 1 reply; 16+ messages in thread
From: Darrick J. Wong @ 2026-05-07 22:14 UTC (permalink / raw)
  To: bernd, djwong; +Cc: miklos, joannelkoong, fuse-devel, neal, linux-fsdevel

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

Use the canonical mount flags table in mount_util.c instead of
opencoding our own version in mount_service.c.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
 util/mount_service.c |   51 +++++++++++++-------------------------------------
 1 file changed, 13 insertions(+), 38 deletions(-)


diff --git a/util/mount_service.c b/util/mount_service.c
index 8c9747b3928a51..79e5b060ba3356 100644
--- a/util/mount_service.c
+++ b/util/mount_service.c
@@ -1457,73 +1457,48 @@ struct ms_to_mount_map {
 	unsigned int mount_attr_flag;
 };
 
-static const struct ms_to_mount_map attrs[] = {
-	{ MS_RDONLY,		MOUNT_ATTR_RDONLY },
-	{ MS_NOSUID,		MOUNT_ATTR_NOSUID },
-	{ MS_NODEV,		MOUNT_ATTR_NODEV },
-	{ MS_NOEXEC,		MOUNT_ATTR_NOEXEC },
-	{ MS_RELATIME,		MOUNT_ATTR_RELATIME },
-	{ MS_NOATIME,		MOUNT_ATTR_NOATIME },
-	{ MS_STRICTATIME,	MOUNT_ATTR_STRICTATIME },
-	{ MS_NODIRATIME,	MOUNT_ATTR_NODIRATIME },
-#ifdef MOUNT_ATTR_NOSYMFOLLOW
-	{ MS_NOSYMFOLLOW,	MOUNT_ATTR_NOSYMFOLLOW },
-#endif
-	{ 0, 0 },
-};
-
 static void get_mount_attr_flags(const struct fuse_service_mount_command *oc,
 				 unsigned int *attr_flags,
 				 unsigned long *leftover_ms_flags)
 {
-	const struct ms_to_mount_map *i;
+	const struct mount_flags *i;
 	unsigned int ms_flags = ntohl(oc->ms_flags);
 	unsigned int mount_attr_flags = 0;
 
-	for (i = attrs; i->ms_flag != 0; i++) {
-		if (ms_flags & i->ms_flag)
-			mount_attr_flags |= i->mount_attr_flag;
-		ms_flags &= ~i->ms_flag;
+	for (i = mount_flags; i->opt != NULL; i++) {
+		if (!i->on || !(ms_flags & i->flag))
+			continue;
+
+		mount_attr_flags |= i->mount_attr;
+		ms_flags &= ~i->flag;
 	}
 
 	*leftover_ms_flags = ms_flags;
 	*attr_flags = mount_attr_flags;
 }
 
-struct ms_to_str_map {
-	unsigned long ms_flag;
-	const char *string;
-};
-
-static const struct ms_to_str_map strflags[] = {
-	{ MS_SYNCHRONOUS,	"sync" },
-	{ MS_DIRSYNC,		"dirsync" },
-	{ MS_LAZYTIME,		"lazytime" },
-	{ 0, 0 },
-};
-
 static int set_ms_flags(struct mount_service *mo, unsigned long ms_flags)
 {
-	const struct ms_to_str_map *i;
+	const struct mount_flags *i;
 	int ret;
 
-	for (i = strflags; i->ms_flag != 0; i++) {
-		if (!(ms_flags & i->ms_flag))
+	for (i = mount_flags; i->opt != NULL; i++) {
+		if (!i->on || !(ms_flags & i->flag))
 			continue;
 
-		ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_FLAG, i->string,
+		ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_FLAG, i->opt,
 			       NULL, 0);
 		if (ret) {
 			int error = errno;
 
 			fprintf(stderr, "%s: set %s option: %s\n",
-				mo->msgtag, i->string, strerror(error));
+				mo->msgtag, i->opt, strerror(error));
 			emit_fsconfig_messages(mo);
 
 			errno = error;
 			return -1;
 		}
-		ms_flags &= ~i->ms_flag;
+		ms_flags &= ~i->flag;
 	}
 
 	/*


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

* Re: [PATCH 1/1] mount_service: use the mount_flags table instead of declaring our own
  2026-05-07 22:14 ` [PATCH 1/1] mount_service: use the mount_flags table instead of declaring our own Darrick J. Wong
@ 2026-05-08 16:51   ` Bernd Schubert
  2026-05-08 17:59     ` Darrick J. Wong
  0 siblings, 1 reply; 16+ messages in thread
From: Bernd Schubert @ 2026-05-08 16:51 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: miklos, joannelkoong, fuse-devel, neal, linux-fsdevel



On 5/8/26 00:14, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Use the canonical mount flags table in mount_util.c instead of
> opencoding our own version in mount_service.c.
> 
> Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> ---
>  util/mount_service.c |   51 +++++++++++++-------------------------------------
>  1 file changed, 13 insertions(+), 38 deletions(-)
> 
> 
> diff --git a/util/mount_service.c b/util/mount_service.c
> index 8c9747b3928a51..79e5b060ba3356 100644
> --- a/util/mount_service.c
> +++ b/util/mount_service.c
> @@ -1457,73 +1457,48 @@ struct ms_to_mount_map {
>  	unsigned int mount_attr_flag;
>  };
>  
> -static const struct ms_to_mount_map attrs[] = {
> -	{ MS_RDONLY,		MOUNT_ATTR_RDONLY },
> -	{ MS_NOSUID,		MOUNT_ATTR_NOSUID },
> -	{ MS_NODEV,		MOUNT_ATTR_NODEV },
> -	{ MS_NOEXEC,		MOUNT_ATTR_NOEXEC },
> -	{ MS_RELATIME,		MOUNT_ATTR_RELATIME },
> -	{ MS_NOATIME,		MOUNT_ATTR_NOATIME },
> -	{ MS_STRICTATIME,	MOUNT_ATTR_STRICTATIME },
> -	{ MS_NODIRATIME,	MOUNT_ATTR_NODIRATIME },
> -#ifdef MOUNT_ATTR_NOSYMFOLLOW
> -	{ MS_NOSYMFOLLOW,	MOUNT_ATTR_NOSYMFOLLOW },
> -#endif
> -	{ 0, 0 },
> -};
> -
>  static void get_mount_attr_flags(const struct fuse_service_mount_command *oc,
>  				 unsigned int *attr_flags,
>  				 unsigned long *leftover_ms_flags)
>  {
> -	const struct ms_to_mount_map *i;
> +	const struct mount_flags *i;
>  	unsigned int ms_flags = ntohl(oc->ms_flags);
>  	unsigned int mount_attr_flags = 0;
>  
> -	for (i = attrs; i->ms_flag != 0; i++) {
> -		if (ms_flags & i->ms_flag)
> -			mount_attr_flags |= i->mount_attr_flag;
> -		ms_flags &= ~i->ms_flag;
> +	for (i = mount_flags; i->opt != NULL; i++) {
> +		if (!i->on || !(ms_flags & i->flag))
> +			continue;
> +
> +		mount_attr_flags |= i->mount_attr;
> +		ms_flags &= ~i->flag;
>  	}
>  
>  	*leftover_ms_flags = ms_flags;
>  	*attr_flags = mount_attr_flags;
>  }
>  
> -struct ms_to_str_map {
> -	unsigned long ms_flag;
> -	const char *string;
> -};
> -
> -static const struct ms_to_str_map strflags[] = {
> -	{ MS_SYNCHRONOUS,	"sync" },
> -	{ MS_DIRSYNC,		"dirsync" },
> -	{ MS_LAZYTIME,		"lazytime" },
> -	{ 0, 0 },
> -};
> -
>  static int set_ms_flags(struct mount_service *mo, unsigned long ms_flags)
>  {
> -	const struct ms_to_str_map *i;
> +	const struct mount_flags *i;
>  	int ret;
>  
> -	for (i = strflags; i->ms_flag != 0; i++) {
> -		if (!(ms_flags & i->ms_flag))
> +	for (i = mount_flags; i->opt != NULL; i++) {
> +		if (!i->on || !(ms_flags & i->flag))
>  			continue;
>  
> -		ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_FLAG, i->string,
> +		ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_FLAG, i->opt,
>  			       NULL, 0);
>  		if (ret) {
>  			int error = errno;
>  
>  			fprintf(stderr, "%s: set %s option: %s\n",
> -				mo->msgtag, i->string, strerror(error));
> +				mo->msgtag, i->opt, strerror(error));
>  			emit_fsconfig_messages(mo);
>  
>  			errno = error;
>  			return -1;
>  		}
> -		ms_flags &= ~i->ms_flag;
> +		ms_flags &= ~i->flag;
>  	}
>  
>  	/*
> 
> 


Hi Darrick,

wouldn't it make sense to use the functions from mount_fsmount.c? I can
also clean this up later if you want.
I guess this doesn't handle the case for "ro" going into fsmount() and
fsconfig() yet - update now or later?


Thanks,
Bernd





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

* Re: [PATCHSET 2/2] libfuse: new mount service container fixes
  2026-05-07 22:13 [PATCHSET 2/2] libfuse: new mount service container fixes Darrick J. Wong
  2026-05-07 22:14 ` [PATCH 1/1] mount_service: use the mount_flags table instead of declaring our own 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
  1 sibling, 2 replies; 16+ 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] 16+ messages in thread

* Re: [PATCHSET 2/2] libfuse: new mount service container fixes
  2026-05-08 17:05 ` [PATCHSET 2/2] libfuse: new mount service container fixes 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; 16+ 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] 16+ 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; 16+ 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] 16+ messages in thread

* Re: [PATCH 1/1] mount_service: use the mount_flags table instead of declaring our own
  2026-05-08 16:51   ` Bernd Schubert
@ 2026-05-08 17:59     ` Darrick J. Wong
  2026-05-09  0:48       ` Darrick J. Wong
  0 siblings, 1 reply; 16+ messages in thread
From: Darrick J. Wong @ 2026-05-08 17:59 UTC (permalink / raw)
  To: Bernd Schubert; +Cc: miklos, joannelkoong, fuse-devel, neal, linux-fsdevel

On Fri, May 08, 2026 at 06:51:45PM +0200, Bernd Schubert wrote:
> 
> 
> On 5/8/26 00:14, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > Use the canonical mount flags table in mount_util.c instead of
> > opencoding our own version in mount_service.c.
> > 
> > Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> > ---
> >  util/mount_service.c |   51 +++++++++++++-------------------------------------
> >  1 file changed, 13 insertions(+), 38 deletions(-)
> > 
> > 
> > diff --git a/util/mount_service.c b/util/mount_service.c
> > index 8c9747b3928a51..79e5b060ba3356 100644
> > --- a/util/mount_service.c
> > +++ b/util/mount_service.c
> > @@ -1457,73 +1457,48 @@ struct ms_to_mount_map {
> >  	unsigned int mount_attr_flag;
> >  };
> >  
> > -static const struct ms_to_mount_map attrs[] = {
> > -	{ MS_RDONLY,		MOUNT_ATTR_RDONLY },
> > -	{ MS_NOSUID,		MOUNT_ATTR_NOSUID },
> > -	{ MS_NODEV,		MOUNT_ATTR_NODEV },
> > -	{ MS_NOEXEC,		MOUNT_ATTR_NOEXEC },
> > -	{ MS_RELATIME,		MOUNT_ATTR_RELATIME },
> > -	{ MS_NOATIME,		MOUNT_ATTR_NOATIME },
> > -	{ MS_STRICTATIME,	MOUNT_ATTR_STRICTATIME },
> > -	{ MS_NODIRATIME,	MOUNT_ATTR_NODIRATIME },
> > -#ifdef MOUNT_ATTR_NOSYMFOLLOW
> > -	{ MS_NOSYMFOLLOW,	MOUNT_ATTR_NOSYMFOLLOW },
> > -#endif
> > -	{ 0, 0 },
> > -};
> > -
> >  static void get_mount_attr_flags(const struct fuse_service_mount_command *oc,
> >  				 unsigned int *attr_flags,
> >  				 unsigned long *leftover_ms_flags)
> >  {
> > -	const struct ms_to_mount_map *i;
> > +	const struct mount_flags *i;
> >  	unsigned int ms_flags = ntohl(oc->ms_flags);
> >  	unsigned int mount_attr_flags = 0;
> >  
> > -	for (i = attrs; i->ms_flag != 0; i++) {
> > -		if (ms_flags & i->ms_flag)
> > -			mount_attr_flags |= i->mount_attr_flag;
> > -		ms_flags &= ~i->ms_flag;
> > +	for (i = mount_flags; i->opt != NULL; i++) {
> > +		if (!i->on || !(ms_flags & i->flag))
> > +			continue;
> > +
> > +		mount_attr_flags |= i->mount_attr;
> > +		ms_flags &= ~i->flag;
> >  	}
> >  
> >  	*leftover_ms_flags = ms_flags;
> >  	*attr_flags = mount_attr_flags;
> >  }
> >  
> > -struct ms_to_str_map {
> > -	unsigned long ms_flag;
> > -	const char *string;
> > -};
> > -
> > -static const struct ms_to_str_map strflags[] = {
> > -	{ MS_SYNCHRONOUS,	"sync" },
> > -	{ MS_DIRSYNC,		"dirsync" },
> > -	{ MS_LAZYTIME,		"lazytime" },
> > -	{ 0, 0 },
> > -};
> > -
> >  static int set_ms_flags(struct mount_service *mo, unsigned long ms_flags)
> >  {
> > -	const struct ms_to_str_map *i;
> > +	const struct mount_flags *i;
> >  	int ret;
> >  
> > -	for (i = strflags; i->ms_flag != 0; i++) {
> > -		if (!(ms_flags & i->ms_flag))
> > +	for (i = mount_flags; i->opt != NULL; i++) {
> > +		if (!i->on || !(ms_flags & i->flag))
> >  			continue;
> >  
> > -		ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_FLAG, i->string,
> > +		ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_FLAG, i->opt,
> >  			       NULL, 0);
> >  		if (ret) {
> >  			int error = errno;
> >  
> >  			fprintf(stderr, "%s: set %s option: %s\n",
> > -				mo->msgtag, i->string, strerror(error));
> > +				mo->msgtag, i->opt, strerror(error));
> >  			emit_fsconfig_messages(mo);
> >  
> >  			errno = error;
> >  			return -1;
> >  		}
> > -		ms_flags &= ~i->ms_flag;
> > +		ms_flags &= ~i->flag;
> >  	}
> >  
> >  	/*
> > 
> > 
> 
> 
> Hi Darrick,
> 
> wouldn't it make sense to use the functions from mount_fsmount.c? I can
> also clean this up later if you want.

Oh, hah!  Yes, I'll revise this patch to use them.

> I guess this doesn't handle the case for "ro" going into fsmount() and
> fsconfig() yet - update now or later?

That'll become another fix patch for mount_service.c.

--D

> 
> Thanks,
> Bernd
> 
> 
> 
> 

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

* Re: [PATCHSET 2/2] libfuse: new mount service container fixes
  2026-05-08 17:05 ` [PATCHSET 2/2] libfuse: new mount service container fixes Bernd Schubert
  2026-05-08 17:12   ` Bernd Schubert
@ 2026-05-09  0:43   ` Darrick J. Wong
  1 sibling, 0 replies; 16+ 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] 16+ messages in thread

* Re: [PATCH 1/1] mount_service: use the mount_flags table instead of declaring our own
  2026-05-08 17:59     ` Darrick J. Wong
@ 2026-05-09  0:48       ` Darrick J. Wong
  2026-05-09  7:42         ` Bernd Schubert
  0 siblings, 1 reply; 16+ messages in thread
From: Darrick J. Wong @ 2026-05-09  0:48 UTC (permalink / raw)
  To: Bernd Schubert; +Cc: miklos, joannelkoong, fuse-devel, neal, linux-fsdevel

On Fri, May 08, 2026 at 10:59:45AM -0700, Darrick J. Wong wrote:
> On Fri, May 08, 2026 at 06:51:45PM +0200, Bernd Schubert wrote:
> > 
> > 
> > On 5/8/26 00:14, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <djwong@kernel.org>
> > > 
> > > Use the canonical mount flags table in mount_util.c instead of
> > > opencoding our own version in mount_service.c.
> > > 
> > > Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> > > ---
> > >  util/mount_service.c |   51 +++++++++++++-------------------------------------
> > >  1 file changed, 13 insertions(+), 38 deletions(-)
> > > 
> > > 
> > > diff --git a/util/mount_service.c b/util/mount_service.c
> > > index 8c9747b3928a51..79e5b060ba3356 100644
> > > --- a/util/mount_service.c
> > > +++ b/util/mount_service.c
> > > @@ -1457,73 +1457,48 @@ struct ms_to_mount_map {
> > >  	unsigned int mount_attr_flag;
> > >  };
> > >  
> > > -static const struct ms_to_mount_map attrs[] = {
> > > -	{ MS_RDONLY,		MOUNT_ATTR_RDONLY },
> > > -	{ MS_NOSUID,		MOUNT_ATTR_NOSUID },
> > > -	{ MS_NODEV,		MOUNT_ATTR_NODEV },
> > > -	{ MS_NOEXEC,		MOUNT_ATTR_NOEXEC },
> > > -	{ MS_RELATIME,		MOUNT_ATTR_RELATIME },
> > > -	{ MS_NOATIME,		MOUNT_ATTR_NOATIME },
> > > -	{ MS_STRICTATIME,	MOUNT_ATTR_STRICTATIME },
> > > -	{ MS_NODIRATIME,	MOUNT_ATTR_NODIRATIME },
> > > -#ifdef MOUNT_ATTR_NOSYMFOLLOW
> > > -	{ MS_NOSYMFOLLOW,	MOUNT_ATTR_NOSYMFOLLOW },
> > > -#endif
> > > -	{ 0, 0 },
> > > -};
> > > -
> > >  static void get_mount_attr_flags(const struct fuse_service_mount_command *oc,
> > >  				 unsigned int *attr_flags,
> > >  				 unsigned long *leftover_ms_flags)
> > >  {
> > > -	const struct ms_to_mount_map *i;
> > > +	const struct mount_flags *i;
> > >  	unsigned int ms_flags = ntohl(oc->ms_flags);
> > >  	unsigned int mount_attr_flags = 0;
> > >  
> > > -	for (i = attrs; i->ms_flag != 0; i++) {
> > > -		if (ms_flags & i->ms_flag)
> > > -			mount_attr_flags |= i->mount_attr_flag;
> > > -		ms_flags &= ~i->ms_flag;
> > > +	for (i = mount_flags; i->opt != NULL; i++) {
> > > +		if (!i->on || !(ms_flags & i->flag))
> > > +			continue;
> > > +
> > > +		mount_attr_flags |= i->mount_attr;
> > > +		ms_flags &= ~i->flag;
> > >  	}
> > >  
> > >  	*leftover_ms_flags = ms_flags;
> > >  	*attr_flags = mount_attr_flags;
> > >  }
> > >  
> > > -struct ms_to_str_map {
> > > -	unsigned long ms_flag;
> > > -	const char *string;
> > > -};
> > > -
> > > -static const struct ms_to_str_map strflags[] = {
> > > -	{ MS_SYNCHRONOUS,	"sync" },
> > > -	{ MS_DIRSYNC,		"dirsync" },
> > > -	{ MS_LAZYTIME,		"lazytime" },
> > > -	{ 0, 0 },
> > > -};
> > > -
> > >  static int set_ms_flags(struct mount_service *mo, unsigned long ms_flags)
> > >  {
> > > -	const struct ms_to_str_map *i;
> > > +	const struct mount_flags *i;
> > >  	int ret;
> > >  
> > > -	for (i = strflags; i->ms_flag != 0; i++) {
> > > -		if (!(ms_flags & i->ms_flag))
> > > +	for (i = mount_flags; i->opt != NULL; i++) {
> > > +		if (!i->on || !(ms_flags & i->flag))
> > >  			continue;
> > >  
> > > -		ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_FLAG, i->string,
> > > +		ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_FLAG, i->opt,
> > >  			       NULL, 0);
> > >  		if (ret) {
> > >  			int error = errno;
> > >  
> > >  			fprintf(stderr, "%s: set %s option: %s\n",
> > > -				mo->msgtag, i->string, strerror(error));
> > > +				mo->msgtag, i->opt, strerror(error));
> > >  			emit_fsconfig_messages(mo);
> > >  
> > >  			errno = error;
> > >  			return -1;
> > >  		}
> > > -		ms_flags &= ~i->ms_flag;
> > > +		ms_flags &= ~i->flag;
> > >  	}
> > >  
> > >  	/*
> > > 
> > > 
> > 
> > 
> > Hi Darrick,
> > 
> > wouldn't it make sense to use the functions from mount_fsmount.c? I can
> > also clean this up later if you want.
> 
> Oh, hah!  Yes, I'll revise this patch to use them.

Update: I tried this, but ran into a problem: the two helpers are in
lib/mount_fsmount.c, which means the object code ends up in libfuse.so.
Unfortunately, that means that util/mount_service.c can't use them
unless they're exported from the .so.

I don't mind doing that, but I feel that I should check with you if it's
ok to add that to the public libfuse API before doing that?

Though I think a better solution is to move ms_flags_to_mount_attrs and
set_ms_flags to mount_util.c because that's compiled into the util/
programs.

How about I do that second thing on Monday?

--D

> > I guess this doesn't handle the case for "ro" going into fsmount() and
> > fsconfig() yet - update now or later?
> 
> That'll become another fix patch for mount_service.c.
> 
> --D
> 
> > 
> > Thanks,
> > Bernd
> > 
> > 
> > 
> > 

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

* Re: [PATCH 1/1] mount_service: use the mount_flags table instead of declaring our own
  2026-05-09  0:48       ` Darrick J. Wong
@ 2026-05-09  7:42         ` Bernd Schubert
  2026-05-11 15:22           ` Darrick J. Wong
  0 siblings, 1 reply; 16+ messages in thread
From: Bernd Schubert @ 2026-05-09  7:42 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: miklos, joannelkoong, fuse-devel, neal, linux-fsdevel



On 5/9/26 02:48, Darrick J. Wong wrote:
> On Fri, May 08, 2026 at 10:59:45AM -0700, Darrick J. Wong wrote:
>> On Fri, May 08, 2026 at 06:51:45PM +0200, Bernd Schubert wrote:
>>>
>>>
>>> On 5/8/26 00:14, Darrick J. Wong wrote:
>>>> From: Darrick J. Wong <djwong@kernel.org>
>>>>
>>>> Use the canonical mount flags table in mount_util.c instead of
>>>> opencoding our own version in mount_service.c.
>>>>
>>>> Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
>>>> ---
>>>>  util/mount_service.c |   51 +++++++++++++-------------------------------------
>>>>  1 file changed, 13 insertions(+), 38 deletions(-)
>>>>
>>>>
>>>> diff --git a/util/mount_service.c b/util/mount_service.c
>>>> index 8c9747b3928a51..79e5b060ba3356 100644
>>>> --- a/util/mount_service.c
>>>> +++ b/util/mount_service.c
>>>> @@ -1457,73 +1457,48 @@ struct ms_to_mount_map {
>>>>  	unsigned int mount_attr_flag;
>>>>  };
>>>>  
>>>> -static const struct ms_to_mount_map attrs[] = {
>>>> -	{ MS_RDONLY,		MOUNT_ATTR_RDONLY },
>>>> -	{ MS_NOSUID,		MOUNT_ATTR_NOSUID },
>>>> -	{ MS_NODEV,		MOUNT_ATTR_NODEV },
>>>> -	{ MS_NOEXEC,		MOUNT_ATTR_NOEXEC },
>>>> -	{ MS_RELATIME,		MOUNT_ATTR_RELATIME },
>>>> -	{ MS_NOATIME,		MOUNT_ATTR_NOATIME },
>>>> -	{ MS_STRICTATIME,	MOUNT_ATTR_STRICTATIME },
>>>> -	{ MS_NODIRATIME,	MOUNT_ATTR_NODIRATIME },
>>>> -#ifdef MOUNT_ATTR_NOSYMFOLLOW
>>>> -	{ MS_NOSYMFOLLOW,	MOUNT_ATTR_NOSYMFOLLOW },
>>>> -#endif
>>>> -	{ 0, 0 },
>>>> -};
>>>> -
>>>>  static void get_mount_attr_flags(const struct fuse_service_mount_command *oc,
>>>>  				 unsigned int *attr_flags,
>>>>  				 unsigned long *leftover_ms_flags)
>>>>  {
>>>> -	const struct ms_to_mount_map *i;
>>>> +	const struct mount_flags *i;
>>>>  	unsigned int ms_flags = ntohl(oc->ms_flags);
>>>>  	unsigned int mount_attr_flags = 0;
>>>>  
>>>> -	for (i = attrs; i->ms_flag != 0; i++) {
>>>> -		if (ms_flags & i->ms_flag)
>>>> -			mount_attr_flags |= i->mount_attr_flag;
>>>> -		ms_flags &= ~i->ms_flag;
>>>> +	for (i = mount_flags; i->opt != NULL; i++) {
>>>> +		if (!i->on || !(ms_flags & i->flag))
>>>> +			continue;
>>>> +
>>>> +		mount_attr_flags |= i->mount_attr;
>>>> +		ms_flags &= ~i->flag;
>>>>  	}
>>>>  
>>>>  	*leftover_ms_flags = ms_flags;
>>>>  	*attr_flags = mount_attr_flags;
>>>>  }
>>>>  
>>>> -struct ms_to_str_map {
>>>> -	unsigned long ms_flag;
>>>> -	const char *string;
>>>> -};
>>>> -
>>>> -static const struct ms_to_str_map strflags[] = {
>>>> -	{ MS_SYNCHRONOUS,	"sync" },
>>>> -	{ MS_DIRSYNC,		"dirsync" },
>>>> -	{ MS_LAZYTIME,		"lazytime" },
>>>> -	{ 0, 0 },
>>>> -};
>>>> -
>>>>  static int set_ms_flags(struct mount_service *mo, unsigned long ms_flags)
>>>>  {
>>>> -	const struct ms_to_str_map *i;
>>>> +	const struct mount_flags *i;
>>>>  	int ret;
>>>>  
>>>> -	for (i = strflags; i->ms_flag != 0; i++) {
>>>> -		if (!(ms_flags & i->ms_flag))
>>>> +	for (i = mount_flags; i->opt != NULL; i++) {
>>>> +		if (!i->on || !(ms_flags & i->flag))
>>>>  			continue;
>>>>  
>>>> -		ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_FLAG, i->string,
>>>> +		ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_FLAG, i->opt,
>>>>  			       NULL, 0);
>>>>  		if (ret) {
>>>>  			int error = errno;
>>>>  
>>>>  			fprintf(stderr, "%s: set %s option: %s\n",
>>>> -				mo->msgtag, i->string, strerror(error));
>>>> +				mo->msgtag, i->opt, strerror(error));
>>>>  			emit_fsconfig_messages(mo);
>>>>  
>>>>  			errno = error;
>>>>  			return -1;
>>>>  		}
>>>> -		ms_flags &= ~i->ms_flag;
>>>> +		ms_flags &= ~i->flag;
>>>>  	}
>>>>  
>>>>  	/*
>>>>
>>>>
>>>
>>>
>>> Hi Darrick,
>>>
>>> wouldn't it make sense to use the functions from mount_fsmount.c? I can
>>> also clean this up later if you want.
>>
>> Oh, hah!  Yes, I'll revise this patch to use them.
> 
> Update: I tried this, but ran into a problem: the two helpers are in
> lib/mount_fsmount.c, which means the object code ends up in libfuse.so.
> Unfortunately, that means that util/mount_service.c can't use them
> unless they're exported from the .so.
> 
> I don't mind doing that, but I feel that I should check with you if it's
> ok to add that to the public libfuse API before doing that?
> 
> Though I think a better solution is to move ms_flags_to_mount_attrs and
> set_ms_flags to mount_util.c because that's compiled into the util/
> programs.
> 
> How about I do that second thing on Monday?


I would prefer the 3rd option, like for fusermount3

executable('fusermount3', ['fusermount.c', '../lib/mount_util.c',
'../lib/mount_fsmount.c', '../lib/util.c'],


I.e. add lib/mount_fsmount.c to mount_service_sources.


Thanks,
Bernd

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

* Re: [PATCH 1/1] mount_service: use the mount_flags table instead of declaring our own
  2026-05-09  7:42         ` Bernd Schubert
@ 2026-05-11 15:22           ` Darrick J. Wong
  2026-05-11 15:58             ` Bernd Schubert
  0 siblings, 1 reply; 16+ messages in thread
From: Darrick J. Wong @ 2026-05-11 15:22 UTC (permalink / raw)
  To: Bernd Schubert; +Cc: miklos, joannelkoong, fuse-devel, neal, linux-fsdevel

On Sat, May 09, 2026 at 09:42:12AM +0200, Bernd Schubert wrote:
> 
> 
> On 5/9/26 02:48, Darrick J. Wong wrote:
> > On Fri, May 08, 2026 at 10:59:45AM -0700, Darrick J. Wong wrote:
> >> On Fri, May 08, 2026 at 06:51:45PM +0200, Bernd Schubert wrote:
> >>>
> >>>
> >>> On 5/8/26 00:14, Darrick J. Wong wrote:
> >>>> From: Darrick J. Wong <djwong@kernel.org>
> >>>>
> >>>> Use the canonical mount flags table in mount_util.c instead of
> >>>> opencoding our own version in mount_service.c.
> >>>>
> >>>> Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> >>>> ---
> >>>>  util/mount_service.c |   51 +++++++++++++-------------------------------------
> >>>>  1 file changed, 13 insertions(+), 38 deletions(-)
> >>>>
> >>>>
> >>>> diff --git a/util/mount_service.c b/util/mount_service.c
> >>>> index 8c9747b3928a51..79e5b060ba3356 100644
> >>>> --- a/util/mount_service.c
> >>>> +++ b/util/mount_service.c
> >>>> @@ -1457,73 +1457,48 @@ struct ms_to_mount_map {
> >>>>  	unsigned int mount_attr_flag;
> >>>>  };
> >>>>  
> >>>> -static const struct ms_to_mount_map attrs[] = {
> >>>> -	{ MS_RDONLY,		MOUNT_ATTR_RDONLY },
> >>>> -	{ MS_NOSUID,		MOUNT_ATTR_NOSUID },
> >>>> -	{ MS_NODEV,		MOUNT_ATTR_NODEV },
> >>>> -	{ MS_NOEXEC,		MOUNT_ATTR_NOEXEC },
> >>>> -	{ MS_RELATIME,		MOUNT_ATTR_RELATIME },
> >>>> -	{ MS_NOATIME,		MOUNT_ATTR_NOATIME },
> >>>> -	{ MS_STRICTATIME,	MOUNT_ATTR_STRICTATIME },
> >>>> -	{ MS_NODIRATIME,	MOUNT_ATTR_NODIRATIME },
> >>>> -#ifdef MOUNT_ATTR_NOSYMFOLLOW
> >>>> -	{ MS_NOSYMFOLLOW,	MOUNT_ATTR_NOSYMFOLLOW },
> >>>> -#endif
> >>>> -	{ 0, 0 },
> >>>> -};
> >>>> -
> >>>>  static void get_mount_attr_flags(const struct fuse_service_mount_command *oc,
> >>>>  				 unsigned int *attr_flags,
> >>>>  				 unsigned long *leftover_ms_flags)
> >>>>  {
> >>>> -	const struct ms_to_mount_map *i;
> >>>> +	const struct mount_flags *i;
> >>>>  	unsigned int ms_flags = ntohl(oc->ms_flags);
> >>>>  	unsigned int mount_attr_flags = 0;
> >>>>  
> >>>> -	for (i = attrs; i->ms_flag != 0; i++) {
> >>>> -		if (ms_flags & i->ms_flag)
> >>>> -			mount_attr_flags |= i->mount_attr_flag;
> >>>> -		ms_flags &= ~i->ms_flag;
> >>>> +	for (i = mount_flags; i->opt != NULL; i++) {
> >>>> +		if (!i->on || !(ms_flags & i->flag))
> >>>> +			continue;
> >>>> +
> >>>> +		mount_attr_flags |= i->mount_attr;
> >>>> +		ms_flags &= ~i->flag;
> >>>>  	}
> >>>>  
> >>>>  	*leftover_ms_flags = ms_flags;
> >>>>  	*attr_flags = mount_attr_flags;
> >>>>  }
> >>>>  
> >>>> -struct ms_to_str_map {
> >>>> -	unsigned long ms_flag;
> >>>> -	const char *string;
> >>>> -};
> >>>> -
> >>>> -static const struct ms_to_str_map strflags[] = {
> >>>> -	{ MS_SYNCHRONOUS,	"sync" },
> >>>> -	{ MS_DIRSYNC,		"dirsync" },
> >>>> -	{ MS_LAZYTIME,		"lazytime" },
> >>>> -	{ 0, 0 },
> >>>> -};
> >>>> -
> >>>>  static int set_ms_flags(struct mount_service *mo, unsigned long ms_flags)
> >>>>  {
> >>>> -	const struct ms_to_str_map *i;
> >>>> +	const struct mount_flags *i;
> >>>>  	int ret;
> >>>>  
> >>>> -	for (i = strflags; i->ms_flag != 0; i++) {
> >>>> -		if (!(ms_flags & i->ms_flag))
> >>>> +	for (i = mount_flags; i->opt != NULL; i++) {
> >>>> +		if (!i->on || !(ms_flags & i->flag))
> >>>>  			continue;
> >>>>  
> >>>> -		ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_FLAG, i->string,
> >>>> +		ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_FLAG, i->opt,
> >>>>  			       NULL, 0);
> >>>>  		if (ret) {
> >>>>  			int error = errno;
> >>>>  
> >>>>  			fprintf(stderr, "%s: set %s option: %s\n",
> >>>> -				mo->msgtag, i->string, strerror(error));
> >>>> +				mo->msgtag, i->opt, strerror(error));
> >>>>  			emit_fsconfig_messages(mo);
> >>>>  
> >>>>  			errno = error;
> >>>>  			return -1;
> >>>>  		}
> >>>> -		ms_flags &= ~i->ms_flag;
> >>>> +		ms_flags &= ~i->flag;
> >>>>  	}
> >>>>  
> >>>>  	/*
> >>>>
> >>>>
> >>>
> >>>
> >>> Hi Darrick,
> >>>
> >>> wouldn't it make sense to use the functions from mount_fsmount.c? I can
> >>> also clean this up later if you want.
> >>
> >> Oh, hah!  Yes, I'll revise this patch to use them.
> > 
> > Update: I tried this, but ran into a problem: the two helpers are in
> > lib/mount_fsmount.c, which means the object code ends up in libfuse.so.
> > Unfortunately, that means that util/mount_service.c can't use them
> > unless they're exported from the .so.
> > 
> > I don't mind doing that, but I feel that I should check with you if it's
> > ok to add that to the public libfuse API before doing that?
> > 
> > Though I think a better solution is to move ms_flags_to_mount_attrs and
> > set_ms_flags to mount_util.c because that's compiled into the util/
> > programs.
> > 
> > How about I do that second thing on Monday?
> 
> 
> I would prefer the 3rd option, like for fusermount3
> 
> executable('fusermount3', ['fusermount.c', '../lib/mount_util.c',
> '../lib/mount_fsmount.c', '../lib/util.c'],
> 
> 
> I.e. add lib/mount_fsmount.c to mount_service_sources.

That works, will put together a patch to do that. :)

--D

> 
> Thanks,
> Bernd
> 

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

* Re: [PATCH 1/1] mount_service: use the mount_flags table instead of declaring our own
  2026-05-11 15:22           ` Darrick J. Wong
@ 2026-05-11 15:58             ` Bernd Schubert
  2026-05-11 16:24               ` Darrick J. Wong
  0 siblings, 1 reply; 16+ messages in thread
From: Bernd Schubert @ 2026-05-11 15:58 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: miklos, joannelkoong, fuse-devel, neal, linux-fsdevel



On 5/11/26 17:22, Darrick J. Wong wrote:
> On Sat, May 09, 2026 at 09:42:12AM +0200, Bernd Schubert wrote:
>>
>>
>> On 5/9/26 02:48, Darrick J. Wong wrote:
>>> On Fri, May 08, 2026 at 10:59:45AM -0700, Darrick J. Wong wrote:
>>>> On Fri, May 08, 2026 at 06:51:45PM +0200, Bernd Schubert wrote:
>>>>>
>>>>>
>>>>> On 5/8/26 00:14, Darrick J. Wong wrote:
>>>>>> From: Darrick J. Wong <djwong@kernel.org>
>>>>>>
>>>>>> Use the canonical mount flags table in mount_util.c instead of
>>>>>> opencoding our own version in mount_service.c.
>>>>>>
>>>>>> Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
>>>>>> ---
>>>>>>  util/mount_service.c |   51 +++++++++++++-------------------------------------
>>>>>>  1 file changed, 13 insertions(+), 38 deletions(-)
>>>>>>
>>>>>>
>>>>>> diff --git a/util/mount_service.c b/util/mount_service.c
>>>>>> index 8c9747b3928a51..79e5b060ba3356 100644
>>>>>> --- a/util/mount_service.c
>>>>>> +++ b/util/mount_service.c
>>>>>> @@ -1457,73 +1457,48 @@ struct ms_to_mount_map {
>>>>>>  	unsigned int mount_attr_flag;
>>>>>>  };
>>>>>>  
>>>>>> -static const struct ms_to_mount_map attrs[] = {
>>>>>> -	{ MS_RDONLY,		MOUNT_ATTR_RDONLY },
>>>>>> -	{ MS_NOSUID,		MOUNT_ATTR_NOSUID },
>>>>>> -	{ MS_NODEV,		MOUNT_ATTR_NODEV },
>>>>>> -	{ MS_NOEXEC,		MOUNT_ATTR_NOEXEC },
>>>>>> -	{ MS_RELATIME,		MOUNT_ATTR_RELATIME },
>>>>>> -	{ MS_NOATIME,		MOUNT_ATTR_NOATIME },
>>>>>> -	{ MS_STRICTATIME,	MOUNT_ATTR_STRICTATIME },
>>>>>> -	{ MS_NODIRATIME,	MOUNT_ATTR_NODIRATIME },
>>>>>> -#ifdef MOUNT_ATTR_NOSYMFOLLOW
>>>>>> -	{ MS_NOSYMFOLLOW,	MOUNT_ATTR_NOSYMFOLLOW },
>>>>>> -#endif
>>>>>> -	{ 0, 0 },
>>>>>> -};
>>>>>> -
>>>>>>  static void get_mount_attr_flags(const struct fuse_service_mount_command *oc,
>>>>>>  				 unsigned int *attr_flags,
>>>>>>  				 unsigned long *leftover_ms_flags)
>>>>>>  {
>>>>>> -	const struct ms_to_mount_map *i;
>>>>>> +	const struct mount_flags *i;
>>>>>>  	unsigned int ms_flags = ntohl(oc->ms_flags);
>>>>>>  	unsigned int mount_attr_flags = 0;
>>>>>>  
>>>>>> -	for (i = attrs; i->ms_flag != 0; i++) {
>>>>>> -		if (ms_flags & i->ms_flag)
>>>>>> -			mount_attr_flags |= i->mount_attr_flag;
>>>>>> -		ms_flags &= ~i->ms_flag;
>>>>>> +	for (i = mount_flags; i->opt != NULL; i++) {
>>>>>> +		if (!i->on || !(ms_flags & i->flag))
>>>>>> +			continue;
>>>>>> +
>>>>>> +		mount_attr_flags |= i->mount_attr;
>>>>>> +		ms_flags &= ~i->flag;
>>>>>>  	}
>>>>>>  
>>>>>>  	*leftover_ms_flags = ms_flags;
>>>>>>  	*attr_flags = mount_attr_flags;
>>>>>>  }
>>>>>>  
>>>>>> -struct ms_to_str_map {
>>>>>> -	unsigned long ms_flag;
>>>>>> -	const char *string;
>>>>>> -};
>>>>>> -
>>>>>> -static const struct ms_to_str_map strflags[] = {
>>>>>> -	{ MS_SYNCHRONOUS,	"sync" },
>>>>>> -	{ MS_DIRSYNC,		"dirsync" },
>>>>>> -	{ MS_LAZYTIME,		"lazytime" },
>>>>>> -	{ 0, 0 },
>>>>>> -};
>>>>>> -
>>>>>>  static int set_ms_flags(struct mount_service *mo, unsigned long ms_flags)
>>>>>>  {
>>>>>> -	const struct ms_to_str_map *i;
>>>>>> +	const struct mount_flags *i;
>>>>>>  	int ret;
>>>>>>  
>>>>>> -	for (i = strflags; i->ms_flag != 0; i++) {
>>>>>> -		if (!(ms_flags & i->ms_flag))
>>>>>> +	for (i = mount_flags; i->opt != NULL; i++) {
>>>>>> +		if (!i->on || !(ms_flags & i->flag))
>>>>>>  			continue;
>>>>>>  
>>>>>> -		ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_FLAG, i->string,
>>>>>> +		ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_FLAG, i->opt,
>>>>>>  			       NULL, 0);
>>>>>>  		if (ret) {
>>>>>>  			int error = errno;
>>>>>>  
>>>>>>  			fprintf(stderr, "%s: set %s option: %s\n",
>>>>>> -				mo->msgtag, i->string, strerror(error));
>>>>>> +				mo->msgtag, i->opt, strerror(error));
>>>>>>  			emit_fsconfig_messages(mo);
>>>>>>  
>>>>>>  			errno = error;
>>>>>>  			return -1;
>>>>>>  		}
>>>>>> -		ms_flags &= ~i->ms_flag;
>>>>>> +		ms_flags &= ~i->flag;
>>>>>>  	}
>>>>>>  
>>>>>>  	/*
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> Hi Darrick,
>>>>>
>>>>> wouldn't it make sense to use the functions from mount_fsmount.c? I can
>>>>> also clean this up later if you want.
>>>>
>>>> Oh, hah!  Yes, I'll revise this patch to use them.
>>>
>>> Update: I tried this, but ran into a problem: the two helpers are in
>>> lib/mount_fsmount.c, which means the object code ends up in libfuse.so.
>>> Unfortunately, that means that util/mount_service.c can't use them
>>> unless they're exported from the .so.
>>>
>>> I don't mind doing that, but I feel that I should check with you if it's
>>> ok to add that to the public libfuse API before doing that?
>>>
>>> Though I think a better solution is to move ms_flags_to_mount_attrs and
>>> set_ms_flags to mount_util.c because that's compiled into the util/
>>> programs.
>>>
>>> How about I do that second thing on Monday?
>>
>>
>> I would prefer the 3rd option, like for fusermount3
>>
>> executable('fusermount3', ['fusermount.c', '../lib/mount_util.c',
>> '../lib/mount_fsmount.c', '../lib/util.c'],
>>
>>
>> I.e. add lib/mount_fsmount.c to mount_service_sources.
> 
> That works, will put together a patch to do that. :)

Hi Darrick,

I didn't manage yesterday anymore to work on that, the container branch
is in a total merge conflict with libfuse master. If you want you could
continue on the iomap and I would solve the merge conflicts. Though,
probably not today or tomorrow.


Cheers,
Bernd

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

* Re: [PATCH 1/1] mount_service: use the mount_flags table instead of declaring our own
  2026-05-11 15:58             ` Bernd Schubert
@ 2026-05-11 16:24               ` Darrick J. Wong
  0 siblings, 0 replies; 16+ messages in thread
From: Darrick J. Wong @ 2026-05-11 16:24 UTC (permalink / raw)
  To: Bernd Schubert; +Cc: miklos, joannelkoong, fuse-devel, neal, linux-fsdevel

On Mon, May 11, 2026 at 05:58:36PM +0200, Bernd Schubert wrote:
> 
> 
> On 5/11/26 17:22, Darrick J. Wong wrote:
> > On Sat, May 09, 2026 at 09:42:12AM +0200, Bernd Schubert wrote:
> >>
> >>
> >> On 5/9/26 02:48, Darrick J. Wong wrote:
> >>> On Fri, May 08, 2026 at 10:59:45AM -0700, Darrick J. Wong wrote:
> >>>> On Fri, May 08, 2026 at 06:51:45PM +0200, Bernd Schubert wrote:
> >>>>>
> >>>>>
> >>>>> On 5/8/26 00:14, Darrick J. Wong wrote:
> >>>>>> From: Darrick J. Wong <djwong@kernel.org>
> >>>>>>
> >>>>>> Use the canonical mount flags table in mount_util.c instead of
> >>>>>> opencoding our own version in mount_service.c.
> >>>>>>
> >>>>>> Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> >>>>>> ---
> >>>>>>  util/mount_service.c |   51 +++++++++++++-------------------------------------
> >>>>>>  1 file changed, 13 insertions(+), 38 deletions(-)
> >>>>>>
> >>>>>>
> >>>>>> diff --git a/util/mount_service.c b/util/mount_service.c
> >>>>>> index 8c9747b3928a51..79e5b060ba3356 100644
> >>>>>> --- a/util/mount_service.c
> >>>>>> +++ b/util/mount_service.c
> >>>>>> @@ -1457,73 +1457,48 @@ struct ms_to_mount_map {
> >>>>>>  	unsigned int mount_attr_flag;
> >>>>>>  };
> >>>>>>  
> >>>>>> -static const struct ms_to_mount_map attrs[] = {
> >>>>>> -	{ MS_RDONLY,		MOUNT_ATTR_RDONLY },
> >>>>>> -	{ MS_NOSUID,		MOUNT_ATTR_NOSUID },
> >>>>>> -	{ MS_NODEV,		MOUNT_ATTR_NODEV },
> >>>>>> -	{ MS_NOEXEC,		MOUNT_ATTR_NOEXEC },
> >>>>>> -	{ MS_RELATIME,		MOUNT_ATTR_RELATIME },
> >>>>>> -	{ MS_NOATIME,		MOUNT_ATTR_NOATIME },
> >>>>>> -	{ MS_STRICTATIME,	MOUNT_ATTR_STRICTATIME },
> >>>>>> -	{ MS_NODIRATIME,	MOUNT_ATTR_NODIRATIME },
> >>>>>> -#ifdef MOUNT_ATTR_NOSYMFOLLOW
> >>>>>> -	{ MS_NOSYMFOLLOW,	MOUNT_ATTR_NOSYMFOLLOW },
> >>>>>> -#endif
> >>>>>> -	{ 0, 0 },
> >>>>>> -};
> >>>>>> -
> >>>>>>  static void get_mount_attr_flags(const struct fuse_service_mount_command *oc,
> >>>>>>  				 unsigned int *attr_flags,
> >>>>>>  				 unsigned long *leftover_ms_flags)
> >>>>>>  {
> >>>>>> -	const struct ms_to_mount_map *i;
> >>>>>> +	const struct mount_flags *i;
> >>>>>>  	unsigned int ms_flags = ntohl(oc->ms_flags);
> >>>>>>  	unsigned int mount_attr_flags = 0;
> >>>>>>  
> >>>>>> -	for (i = attrs; i->ms_flag != 0; i++) {
> >>>>>> -		if (ms_flags & i->ms_flag)
> >>>>>> -			mount_attr_flags |= i->mount_attr_flag;
> >>>>>> -		ms_flags &= ~i->ms_flag;
> >>>>>> +	for (i = mount_flags; i->opt != NULL; i++) {
> >>>>>> +		if (!i->on || !(ms_flags & i->flag))
> >>>>>> +			continue;
> >>>>>> +
> >>>>>> +		mount_attr_flags |= i->mount_attr;
> >>>>>> +		ms_flags &= ~i->flag;
> >>>>>>  	}
> >>>>>>  
> >>>>>>  	*leftover_ms_flags = ms_flags;
> >>>>>>  	*attr_flags = mount_attr_flags;
> >>>>>>  }
> >>>>>>  
> >>>>>> -struct ms_to_str_map {
> >>>>>> -	unsigned long ms_flag;
> >>>>>> -	const char *string;
> >>>>>> -};
> >>>>>> -
> >>>>>> -static const struct ms_to_str_map strflags[] = {
> >>>>>> -	{ MS_SYNCHRONOUS,	"sync" },
> >>>>>> -	{ MS_DIRSYNC,		"dirsync" },
> >>>>>> -	{ MS_LAZYTIME,		"lazytime" },
> >>>>>> -	{ 0, 0 },
> >>>>>> -};
> >>>>>> -
> >>>>>>  static int set_ms_flags(struct mount_service *mo, unsigned long ms_flags)
> >>>>>>  {
> >>>>>> -	const struct ms_to_str_map *i;
> >>>>>> +	const struct mount_flags *i;
> >>>>>>  	int ret;
> >>>>>>  
> >>>>>> -	for (i = strflags; i->ms_flag != 0; i++) {
> >>>>>> -		if (!(ms_flags & i->ms_flag))
> >>>>>> +	for (i = mount_flags; i->opt != NULL; i++) {
> >>>>>> +		if (!i->on || !(ms_flags & i->flag))
> >>>>>>  			continue;
> >>>>>>  
> >>>>>> -		ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_FLAG, i->string,
> >>>>>> +		ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_FLAG, i->opt,
> >>>>>>  			       NULL, 0);
> >>>>>>  		if (ret) {
> >>>>>>  			int error = errno;
> >>>>>>  
> >>>>>>  			fprintf(stderr, "%s: set %s option: %s\n",
> >>>>>> -				mo->msgtag, i->string, strerror(error));
> >>>>>> +				mo->msgtag, i->opt, strerror(error));
> >>>>>>  			emit_fsconfig_messages(mo);
> >>>>>>  
> >>>>>>  			errno = error;
> >>>>>>  			return -1;
> >>>>>>  		}
> >>>>>> -		ms_flags &= ~i->ms_flag;
> >>>>>> +		ms_flags &= ~i->flag;
> >>>>>>  	}
> >>>>>>  
> >>>>>>  	/*
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>> Hi Darrick,
> >>>>>
> >>>>> wouldn't it make sense to use the functions from mount_fsmount.c? I can
> >>>>> also clean this up later if you want.
> >>>>
> >>>> Oh, hah!  Yes, I'll revise this patch to use them.
> >>>
> >>> Update: I tried this, but ran into a problem: the two helpers are in
> >>> lib/mount_fsmount.c, which means the object code ends up in libfuse.so.
> >>> Unfortunately, that means that util/mount_service.c can't use them
> >>> unless they're exported from the .so.
> >>>
> >>> I don't mind doing that, but I feel that I should check with you if it's
> >>> ok to add that to the public libfuse API before doing that?
> >>>
> >>> Though I think a better solution is to move ms_flags_to_mount_attrs and
> >>> set_ms_flags to mount_util.c because that's compiled into the util/
> >>> programs.
> >>>
> >>> How about I do that second thing on Monday?
> >>
> >>
> >> I would prefer the 3rd option, like for fusermount3
> >>
> >> executable('fusermount3', ['fusermount.c', '../lib/mount_util.c',
> >> '../lib/mount_fsmount.c', '../lib/util.c'],
> >>
> >>
> >> I.e. add lib/mount_fsmount.c to mount_service_sources.
> > 
> > That works, will put together a patch to do that. :)
> 
> Hi Darrick,
> 
> I didn't manage yesterday anymore to work on that, the container branch
> is in a total merge conflict with libfuse master. If you want you could
> continue on the iomap and I would solve the merge conflicts. Though,
> probably not today or tomorrow.

I don't mind trying to resolving the conflict, and will work on that
this afternoon.  I'll report back whatever the outcome of that is.

--D

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

end of thread, other threads:[~2026-05-11 16:24 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-07 22:13 [PATCHSET 2/2] libfuse: new mount service container fixes Darrick J. Wong
2026-05-07 22:14 ` [PATCH 1/1] mount_service: use the mount_flags table instead of declaring our own Darrick J. Wong
2026-05-08 16:51   ` Bernd Schubert
2026-05-08 17:59     ` Darrick J. Wong
2026-05-09  0:48       ` Darrick J. Wong
2026-05-09  7:42         ` Bernd Schubert
2026-05-11 15:22           ` Darrick J. Wong
2026-05-11 15:58             ` Bernd Schubert
2026-05-11 16:24               ` Darrick J. Wong
2026-05-08 17:05 ` [PATCHSET 2/2] libfuse: new mount service container fixes Bernd Schubert
2026-05-08 17:12   ` Bernd Schubert
2026-05-08 17:50     ` Bernd Schubert
2026-05-09  0:43   ` Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2026-05-05  5:21 [PATCHBOMB] libfuse: various fixes for new mount code Darrick J. Wong
2026-05-05  5:23 ` [PATCHSET 2/2] libfuse: new mount service container fixes Darrick J. Wong
2026-05-06 21:27   ` Bernd Schubert
2026-05-06 21:36     ` Bernd Schubert

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