From: "Darrick J. Wong" <djwong@kernel.org>
To: bernd@bsbernd.com
Cc: fuse-devel@lists.linux.dev, Miklos Szeredi <miklos@szeredi.hu>
Subject: Re: [PATCH 10/10] highlevel: Switch fuse_main_real_versioned() to fuse_daemonize_early()
Date: Fri, 8 May 2026 17:38:49 -0700 [thread overview]
Message-ID: <20260509003849.GO2241589@frogsfrogsfrogs> (raw)
In-Reply-To: <20260508-new-mount-fixes-and-tests-v1-10-c67a0893ddbc@bsbernd.com>
On Fri, May 08, 2026 at 06:39:13PM +0200, Bernd Schubert via B4 Relay wrote:
> From: Bernd Schubert <bernd@bsbernd.com>
>
> For high level we can switch directly in that function to the new daemonize
> API. Additionally we need to check if the daemon has already acticated
> daemonization to avoid warning messages.
>
> Suggested-by: Miklos Szeredi <miklos@szeredi.hu>
> Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
> ---
> lib/helper.c | 30 +++++++++++++++++++-----------
> 1 file changed, 19 insertions(+), 11 deletions(-)
>
> diff --git a/lib/helper.c b/lib/helper.c
> index 4d7c2b7f..15de3fbf 100644
> --- a/lib/helper.c
> +++ b/lib/helper.c
> @@ -260,6 +260,7 @@ int fuse_main_real_versioned(int argc, char *argv[],
> struct fuse_cmdline_opts opts;
> int res;
> struct fuse_loop_config *loop_config = NULL;
> + bool self_daemonize = false;
>
> if (fuse_parse_cmdline(&args, &opts) != 0)
> return 1;
> @@ -289,6 +290,21 @@ int fuse_main_real_versioned(int argc, char *argv[],
> goto out1;
> }
>
> + /* The application might have already started daemonization itself */
> + if (!fuse_daemonize_early_is_active()) {
> + int daemonize_early_flags = 0;
> +
> + if (opts.foreground)
> + daemonize_early_flags |= FUSE_DAEMONIZE_NO_BACKGROUND;
> +
> + self_daemonize = true;
Technically speaking you don't have to set self_daemonize until after
the _early_start succeeds, right?
That doesn't bother me all that much, so
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> + res = fuse_daemonize_early_start(daemonize_early_flags);
> + if (res != 0) {
> + fuse_log(FUSE_LOG_ERR, "fuse: daemonize_early_start failed\n");
> + goto out1;
> + }
> + }
> +
> struct fuse *_fuse_new_31(struct fuse_args *args,
> const struct fuse_operations *op, size_t op_size,
> struct libfuse_version *version,
> @@ -305,22 +321,14 @@ int fuse_main_real_versioned(int argc, char *argv[],
> goto out2;
> }
>
> - /*
> - * fuse_daemonize() already checks and fails then, but we need to
> - * handle it gracefully here, as this is done libfuse internal
> - * and caller didn't ask to daemonize with old API.
> - */
> - if (!fuse_daemonize_early_is_active()) {
> - if (fuse_daemonize(opts.foreground) != 0) {
> - res = 5;
> - goto out3;
> - }
> - }
> if (fuse_set_signal_handlers(se) != 0) {
> res = 6;
> goto out3;
> }
>
> + if (self_daemonize)
> + fuse_daemonize_early_success();
> +
> if (opts.singlethread)
> res = fuse_loop(fuse);
> else {
>
> --
> 2.53.0
>
>
next prev parent reply other threads:[~2026-05-09 0:38 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-08 16:39 [PATCH 00/10] libfuse: new mount API and SYNC_INIT fixes and tests Bernd Schubert via B4 Relay
2026-05-08 16:39 ` [PATCH 01/10] test: register pytest run as a meson test Bernd Schubert via B4 Relay
2026-05-08 23:53 ` Darrick J. Wong
2026-05-08 16:39 ` [PATCH 02/10] Add tests to verify that mountinfo matches requested options Bernd Schubert via B4 Relay
2026-05-08 23:59 ` Darrick J. Wong
2026-05-08 16:39 ` [PATCH 03/10] test: assert ro/rw, nosuid/suid, nodev/dev round-trip via fsmount Bernd Schubert via B4 Relay
2026-05-09 0:04 ` Darrick J. Wong
2026-05-08 16:39 ` [PATCH 04/10] New mount API: read-only option is for fsmount() and fsconfig() Bernd Schubert via B4 Relay
2026-05-09 0:17 ` Darrick J. Wong
2026-05-08 16:39 ` [PATCH 05/10] libfuse: don't use SYNC_INIT unless asked for Bernd Schubert via B4 Relay
2026-05-08 16:39 ` [PATCH 06/10] example: silence add_languages warning by setting 'native: false' Bernd Schubert via B4 Relay
2026-05-09 0:23 ` Darrick J. Wong
2026-05-08 16:39 ` [PATCH 07/10] mount: clarify kernel_opts vs mnt_opts vs flags in fuse_kern_fsmount Bernd Schubert via B4 Relay
2026-05-09 0:27 ` Darrick J. Wong
2026-05-10 17:21 ` Bernd Schubert
2026-05-08 16:39 ` [PATCH 08/10] fuse_daemonize_early_start: Disallow daemonization when already active Bernd Schubert via B4 Relay
2026-05-09 0:30 ` Darrick J. Wong
2026-05-10 16:53 ` Bernd Schubert
2026-05-10 17:01 ` Bernd Schubert
2026-05-08 16:39 ` [PATCH 09/10] fuse mount: Do not set sync_init when sync_init was not used Bernd Schubert via B4 Relay
2026-05-09 0:35 ` Darrick J. Wong
2026-05-10 17:04 ` Bernd Schubert
2026-05-08 16:39 ` [PATCH 10/10] highlevel: Switch fuse_main_real_versioned() to fuse_daemonize_early() Bernd Schubert via B4 Relay
2026-05-09 0:38 ` Darrick J. Wong [this message]
2026-05-10 17:19 ` Bernd Schubert
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=20260509003849.GO2241589@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=bernd@bsbernd.com \
--cc=fuse-devel@lists.linux.dev \
--cc=miklos@szeredi.hu \
/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