FUSE: umount2 detach does not wake blocked readers while another mount namespace holds the superblock
Hello,
We are writing with a FUSE behavior question and userspace evidence. We are not claiming a kernel bug or proposing a patch; we would like to know whether the behavior is intended and whether there is a supported way for userspace to detect the state.
Setup. A userspace FUSE daemon runs inside a Docker container (LayerFS, an agent Workspace filesystem). The daemon mounts one FUSE filesystem and serves it with two workers blocked in read(/dev/fuse). On a normal stop it calls a plain umount2(mountpoint, 0), then joins the workers, drains requests, revokes and closes the connection.
Observed on macOS 26.5.1 / OrbStack 7.2.9 / Docker 29.8.2 (API 1.54), kernel 7.2.9-orbstack-00391-g2b298d05fbd4:
- umount2 removes the mount from the container's mount namespace and returns success; the mount row is gone from the namespace's mountinfo.
- The two read() workers remain blocked and do not return. The connection stays alive after the detach. Our unmount path gives up at its 5 s deadline with both readers still not joined.
- Writing "1" to /sys/fs/fuse/connections/<n>/abort wakes the readers immediately. Drain + revoke + close then completes in p50 75 ms (max 558 ms over the measured tail). With a 1 s join grace in the daemon, the stall ends at about 1.08 s instead of about 5.1 s.
- It is deterministic for this shape of run: 6/6 at one LayerFS commit (582bc786) and 1/1 at the v1.1.0 release, when the mount is created immediately after the container starts and lives about 1.5 s.
Timing. Delay before mount / delay before unmount, two runs each, unmount wall time:
before mount before unmount unmount 0 ms 300 ms 22 / 19 ms 2500 ms 1500 ms 43 / 15 ms 0 ms 1500 ms 5066 / 5029 ms <- stall 2500 ms 300 ms 12 / 9 ms
So the stall is a window: the mount must be created immediately after the container starts and live about 1.5 s. A 2.5 s delay before mounting, or a 300 ms lifetime, avoids it.
Control. If the daemon calls unshare(CLONE_NEWNS) and makes / private before mounting, so the mount is created only in the daemon's own mount namespace and never appears in the container's initial mount namespace, the stall does not
occur: early-mount unmount p50 15 ms (n=10, range 7.2-35.0 ms). The same mount with the flag off stalls about 5.0 s.
What we could not determine. At 250 ms into a stalled unmount the mount row is already gone from the container's namespace, yet the readers are still blocked. Separately, a privileged --pid=host scan of all mount namespaces found the FUSE mount only in the container's PID-1/daemon mount namespace, not in an additional holder, and no process fd or cwd pointed into the mount. We cannot identify what keeps the superblock referenced.
From the source we can read, fuse_sb_destroy() calls fuse_conn_destroy() (which aborts the connection and wakes readers) only when fuse_mount_remove() reports the last mount for that connection. A plain umount2 that is not the last reference therefore leaves the connection and its readers alone.
Questions:
1. Is that intended when the caller's namespace no longer has the mount at all? Should a detach that leaves the superblock referenced only elsewhere wake or abort the blocked readers, or must the last reference drop first?
2. Is there a supported, race-free way for userspace to learn that no mount or user remains -- for example a per-connection mount reference count or a "detached" state -- so that it can abort deterministically instead of using a timeout? We could not find one in fusectl or elsewhere.
3. Does mainline fs/fuse behave the same as 7.2.9-orbstack-00391? We cannot test mainline on this host. We have also asked OrbStack whether their kernel carries a change in this area.
We can provide a standalone userspace FUSE reproducer (two readers on one /dev/fuse fd, plain umount2, join timeout) and thread/mount traces on request. The LayerFS reproducer is deterministic 6/6 on the affected kernel. The full evidence and the open questions are also at
https://github.com/Ephemeral-AI-Lab/layerfs/issues/460
Thank you,
The LayerFS team
https://github.com/Ephemeral-AI-Lab/layerfs