Repository navigation
Open
Description
Summary
smolfs tracks mount state as a single mountpoint + read_only pair per volume record ($SMOLFS_HOME/volumes/NAME.toml). This means a single registry cannot represent more than one concurrent mount of the same named volume. JuiceFS itself supports concurrent mounts of the same volume (including one read-only and one read-write) just fine — so smolfs's bookkeeping is the limiting factor, and it fails silently in ways that can leave orphaned mounts.
This surfaced while implementing read-only mounts (#14 / #15), but it is a pre-existing limitation independent of that feature.
Reproduction
Two smolfs invocations (separate processes), same SMOLFS_HOME, same --dev volume:
smolfs init demo --dev
smolfs mount --readonly demo /tmp/ro # process 1
smolfs mount demo /tmp/rw # process 2 (same volume)Observed:
- Both mounts physically succeed —
mountshows bothJuiceFS:demo on …/roand…/rw. The read-only one correctly rejects writes (read-only file system); the read-write one accepts them; files written via/rware visible via/ro(same filesystem, independent access modes). This works even for a dev/SQLite volume on one machine. mount()has no guard against an already-mounted volume — the second mount overwritesmountpoint/read_onlyin the one record.smolfs status demothen shows only the last mount (…/rw rw); the read-only mount is no longer tracked.smolfs unmount demounmounts only the recorded (last) mountpoint — the first mount is left orphaned: still mounted at the OS level, butstatusreports the volume as unmounted (- -). It has to beumounted manually.
Impact
- Silent loss of tracking when the same volume name is mounted more than once in a registry.
- Orphaned mounts that
smolfsno longer knows about and won't clean up. flush/unmount/status NAMEare ambiguous when more than one mount exists.
Possible direction
Model multiple concurrent mounts per volume rather than a single mountpoint:
- Store a list of mounts (e.g.
Vec<MountRecord>), each with its ownmountpointandread_only. - Have
flush/unmounttake (or disambiguate by) a mountpoint, and error clearly when the target is ambiguous. - Optionally,
mountcould warn/refuse when the exact mountpoint is already recorded, andstatuscould list all live mounts with their modes.
Notes
- Relevant code:
SmolFs::mount/flush/unmountand theVolumerecord incrates/smolfs-juicefs/src/service.rsandcrates/smolfs-core/src/models.rs. - Cross-machine concurrent access already works for cloud volumes because each client has its own
SMOLFS_HOME/registry; this issue is specifically about multiple mounts sharing one registry.
Metadata
Metadata
Assignees
Labels
No labels
Activity