Repository navigation
Description
There is no read-only mount in ObjectFS. objectfs mount has no --read-only flag and the mount is
always read-write, so -o ro in /etc/fstab has nothing to translate into.
The mount helper added in #136 therefore refuses ro rather than accepting it, and refuses it even
under -s (mount's "sloppy" flag), because the alternative is worse than an error: an operator whose
fstab says ro would get a writable filesystem, and the first thing they would learn about it is a
write that succeeded. That refusal is a placeholder for this issue, not a position.
What a real implementation needs:
- A
--read-onlyflag onobjectfs mount, plumbed to a config field. internal/fusefailing the write paths withEROFS:Write,Create,Mkdir,Rmdir,Unlink,
Rename,Setattr(the size/mode/time arms),Link,Symlink,Setxattr,Removexattr, and
Open/OpenDirwith a write intent in the flags.EROFSspecifically —EACCESwould read to the
caller as a permissions problem on the object, which is a different thing to debug.- The kernel told as well, so it can refuse some of those without a round trip:
MS_RDONLYin the
mount options go-fuse passes. internal/vfsrefusing to create a dirty range at all, so the guarantee does not depend on every
FUSE entry point remembering to check. The interesting property is that a read-only mount cannot
produce a PUT, and the place to assert that is the backend: a differential test in
internal/difftestrunning a write-heavy sequence against a read-only mount and asserting the
substrate endpoint saw zero writes.- Then
-o roin the option table, which is a one-line change once the flag exists, and the removal of
the refusal and its test.
Worth doing for its own sake beyond the fstab case: a read-only mount is how a shared dataset gets
handed to a job that must not modify it, and it is the mount an operator reaches for when they suspect
something is writing to a bucket it should not be.
Activity
docs(mount): point the ro refusal at #532 (#136)
feat(mount): an /etc/fstab mount helper for -t objectfs (#136) (#530)
scttfrdmn commentedon Sep 19, 2026
Traced the current state before planning this, and it changes the shape of the issue: the enforcement
layer is already complete. It is just unreachable.
internal/fuseEROFS gatesfilesystem.go:653,696,789,854,944,1330(Mkdir, Create, Unlink, Rmdir, Open-with-write-intent, Write),rename.go:92,attributes.go:267,423(Setattr ×2),xattr.go:256,337,414,431(Set/Removexattr ×2 each)rooptioninternal/fuse/mount.go:523appends"ro"toopts.OptionswhenOptions.ReadOnlyMountOptions.ReadOnly→Config.ReadOnlyinternal/fuse/platform.go:93MountOptions.ReadOnlyinternal/adapter/adapter.go:204is the only productionfuse.MountConfig{}; itsOptions: a.buildMountOptions()(adapter.go:945) sets FSName, Subtype, MaxWrite, Debug, DirectIO, KeepCache, SyncRead — and neverReadOnlyinternal/configread_onlykey anywhere.grep -rn 'read_only|ReadOnly' internal/config/*.go configs/*.yaml→ emptyvfs.ErrReadOnlyinternal/vfs/errors.go:33, mapped to EROFS atinternal/fuse/errno.go:58; the only other reference in the tree iserrno_test.go:86The
yaml:"read_only"tag oninternal/fuse/mount.go:92is a red herring — nothing YAML-unmarshals intointernal/fuse's structs. A config file unmarshals intointernal/config.Configuration, which has nosuch key, and
config.go:974usesyaml.UnmarshalStrict, soread_only:in a config would berejected as unknown rather than silently honoured. Either way there is no path to a read-only mount.
This is the same defect class
internal/fuse/platform.go:43already records in the past tense — "Italso hardcoded ReadOnly to false, which meant
read_only: truemounted a writable filesystem" — and theclass #180 was about: nine
MountOptionsfields naming real FUSE capabilities and reaching nothing.So the EROFS half of the acceptance criteria is done, and what remains is plumbing plus proof:
ReadOnly booloninternal/config'sFUSEConfig(config.go:75). Its zero value being the defaultis already pinned by
TestFUSEZeroValueIsTheDefault, andfalse= writable is the right default.buildMountOptions()— whose doc comment already explains it exists as a method so themapping can be asserted without a mount, which is exactly the test this needs.
--read-onlyonnewMountFlagSet(cmd/objectfs/main.go:179) and an arm inapplyCommandLineOverrides(main.go:610), following the--dry-run/--debugpattern.internal/vfsbackstop this issue asks for: refuse to create a dirty range at all, returning theErrReadOnlythat already exists and has never had a caller. Construction-time field, not a per-callargument — the point is that the guarantee does not depend on every entry point remembering.
internal/testaws/recorder.go:710already exposes
TestServer.Writes(key) []Request(PUT, POST and attribute-storing requests) andtestaws.go:999exposesOperations(op) int.cmd/mount.objectfs/main.go:418turnsrofromkindRefuseinto a translation; the note atmain.go:38naming this issue goes away, along with the threemain_test.gocases asserting therefusal (
:149,:260,:569).Worth stating because of how the missing half hides: step 2's absence passes every presence check. The
mutation that has to fail is deleting that one line and watching the zero-writes assertion go red.
Milestoned for v0.17.0.
feat(mount): a read-only mount that can actually be turned on (#532) (#…