From: Bernd Schubert <bernd@bsbernd.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: joannelkoong@gmail.com, neal@gompa.dev,
fuse-devel@lists.linux.dev, linux-fsdevel@vger.kernel.org,
miklos@szeredi.hu
Subject: Re: [PATCH v1.1 1/2] libfuse: don't use SYNC_INIT unless asked for
Date: Tue, 5 May 2026 22:02:18 +0200 [thread overview]
Message-ID: <0de919e0-7d90-4fad-bf93-656bfd28ad7d@bsbernd.com> (raw)
In-Reply-To: <20260505164428.GC7739@frogsfrogsfrogs>
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
next prev parent reply other threads:[~2026-05-05 20:02 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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=0de919e0-7d90-4fad-bf93-656bfd28ad7d@bsbernd.com \
--to=bernd@bsbernd.com \
--cc=djwong@kernel.org \
--cc=fuse-devel@lists.linux.dev \
--cc=joannelkoong@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=neal@gompa.dev \
/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