mirror of
https://github.com/libfuse/libfuse.git
synced 2026-07-07 14:47:41 +08:00
3e1101057a
Add synchronous FUSE_INIT processing during mount() to enable early daemonization with proper error reporting to the parent process. A new mount thread is needed that handles FUSE_INIT and possible other requests at mount time (like getxattr for selinux). The kernel sends FUSE_INIT during the mount() syscall. Without a thread to process it, mount() blocks forever. Mount thread lifetime: Created before mount() syscall in fuse_start_sync_init_worker() Processes requests until se->mount_finished is set (after mount() returns) Joined after successful mount in fuse_wait_sync_init_completion() Cancelled if mount fails (direct → fusermount3 fallback) Key changes: Add init_thread, init_error, mount_finished to struct fuse_session Use FUSE_DEV_IOC_SYNC_INIT ioctl for kernel support Fall back to async FUSE_INIT if unsupported Auto-enabled when fuse_daemonize_active() or via fuse_session_want_sync_init() Allows parent to report mount/init failures instead of exiting immediately after fork. Note: For now synchronous FUSE_INIT is only supported for privileged mounts. Signed-off-by: Bernd Schubert <bschubert@ddn.com>