[PATCH 2/2] erofs-utils: mount: add --worker-log for detached workers

Gao Xiang hsiangkao at linux.alibaba.com
Thu Apr 9 14:21:24 AEST 2026



On 2026/4/3 14:42, Yifan Zhao wrote:
> Detached NBD and fanotify workers currently redirect stdout and stderr
> to /dev/null after fork(), which makes their runtime logs invisible once
> mount.erofs returns.
> 
> Add a `--worker-log=PATH` option so detached workers can append logs to
> a caller-provided file for better observability.
> 
> Assisted-by: Codex:GPT-5.4
> Signed-off-by: Yifan Zhao <zhaoyifan28 at huawei.com>
> ---
>   mount/main.c | 58 ++++++++++++++++++++++++++++++++++++++--------------
>   1 file changed, 43 insertions(+), 15 deletions(-)
> 
> diff --git a/mount/main.c b/mount/main.c
> index 45ac32e..40175e3 100644
> --- a/mount/main.c
> +++ b/mount/main.c
> @@ -75,6 +75,7 @@ static struct erofsmount_cfg {
>   	char *options;
>   	char *full_options;		/* used for erofsfuse */
>   	char *fstype;
> +	char *worker_log_path;
>   	long flags;
>   	enum erofs_backend_drv backend;
>   	enum erofsmount_mode mountmode;
> @@ -119,10 +120,10 @@ static int erofsmount_worker_set_signal(int signum, sighandler_t handler)
>   	return 0;
>   }
>   
> -static int erofsmount_worker_detach(void)
> +static int erofsmount_worker_detach(const char *log_path)

how qemu-nbd works? Does it use the same option `--worker-log`?

Thanks,
Gao Xiang


More information about the Linux-erofs mailing list