From: "Darrick J. Wong" <djwong@kernel.org>
To: bernd@bsbernd.com
Cc: fuse-devel@lists.linux.dev, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 3/3] mount_service: call the new fsmount ms_flags helpers in the right order
Date: Tue, 2 Jun 2026 09:29:46 -0700 [thread overview]
Message-ID: <20260602162946.GH6070@frogsfrogsfrogs> (raw)
In-Reply-To: <178036512194.432362.255954133278562428.stgit@frogsfrogsfrogs>
On Mon, Jun 01, 2026 at 06:53:25PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Codex noticed a discrepancy between the new fsmount code that Bernd
> wrote and my port of the even newer mount service code to use the
> helpers that Bernd wrote. Specifically, set_fsconfig_ms_flags only
> clears bits from MS_FLAGS if there's no corresponding MOUNT_ATTR_ flag,
> whereas ms_flags_to_mount_attrs always clears them.
>
> In other words, set_fsconfig_ms_flags MUST be called before
> ms_flags_to_mount_attrs or we can lose the 'ro' option. Fix this.
>
> Fixes: 7211953256526f ("mount_service: use the fsmount API helpers from mount_fsmount.c")
> Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> ---
> lib/mount_fsmount.c | 1 +
> util/mount_service.c | 12 +++++++++---
> 2 files changed, 10 insertions(+), 3 deletions(-)
>
>
> diff --git a/lib/mount_fsmount.c b/lib/mount_fsmount.c
> index 83768f0b8d193b..7bd772d139808e 100644
> --- a/lib/mount_fsmount.c
> +++ b/lib/mount_fsmount.c
> @@ -35,6 +35,7 @@
> #define MOUNT_ATTR_NOSYMFOLLOW 0x00200000
> #endif
>
> +/* Must be called after set_fsconfig_ms_flags */
> unsigned long ms_flags_to_mount_attrs(unsigned long ms_flags,
> unsigned int *mount_attrs)
> {
> diff --git a/util/mount_service.c b/util/mount_service.c
> index 360a78bab3bd3d..f1b61ace526275 100644
> --- a/util/mount_service.c
> +++ b/util/mount_service.c
> @@ -1410,14 +1410,12 @@ static int mount_service_fsopen_mount(struct mount_service *mo,
> const struct stat *stbuf)
> {
> char tmp[64];
> - unsigned long ms_flags;
> + unsigned long ms_flags = ntohl(oc->ms_flags);
> unsigned int attr_flags;
> int mfd;
> int error;
> int ret;
>
> - ms_flags = ms_flags_to_mount_attrs(ntohl(oc->ms_flags), &attr_flags);
> -
> ret = set_fsconfig_ms_flags(mo->fsopenfd, &ms_flags);
> if (ret) {
> error = errno;
> @@ -1478,6 +1476,14 @@ static int mount_service_fsopen_mount(struct mount_service *mo,
> goto fail_fsconfig;
> }
>
> + ms_flags = ms_flags_to_mount_attrs(ms_flags, &attr_flags);
NAK, this call should have been moved only to the other side of
set_fsconfig_ms_flags, otherwise the fallback is triggered for any MS_*
flags that could easily be translated into MOUNT_ATTR_* flags.
--D
> + if (ms_flags != 0) {
> + error = ENOTSUP;
> + fprintf(stderr, "%s: unsupported mount flags encountered\n",
> + mo->msgtag);
> + goto fail_fsconfig;
> + }
> +
> mfd = fsmount(mo->fsopenfd, FSMOUNT_CLOEXEC, attr_flags);
> if (mfd < 0) {
> error = errno;
>
>
prev parent reply other threads:[~2026-06-02 16:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 1:52 [PATCHSET] libfuse: more random fixes for fuse service containers Darrick J. Wong
2026-06-02 1:52 ` [PATCH 1/3] fsmount: don't truncate ms_flags in set_fsconfig_ms_flags Darrick J. Wong
2026-06-02 1:53 ` [PATCH 2/3] mount_service: don't pass the chopped buffer to apply_fsconfig_mount_opts Darrick J. Wong
2026-06-02 1:53 ` [PATCH 3/3] mount_service: call the new fsmount ms_flags helpers in the right order Darrick J. Wong
2026-06-02 16:29 ` Darrick J. Wong [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260602162946.GH6070@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=bernd@bsbernd.com \
--cc=fuse-devel@lists.linux.dev \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox