Skip to content

feat: the FUSE options a config file names reach the kernel (#180) - #261

Merged
scttfrdmn merged 1 commit into
mainfrom
v0.11.0-fuse-options
Aug 3, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
v0.11.0-fuse-options

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

Closes #180.

Nine fields on internal/fuse.MountOptions and internal/fuse.Config carried yaml tags for a whole release and were decoded by nothing, because config.Configuration had no fuse key at all. Three of them name real go-fuse capabilities and are back, plumbed end to end: direct_io, keep_cache, sync_read.

What reaches what

YAML key plumbing where it lands
fuse.direct_io Configuration.FUSE → Adapter.buildMountOptions → CreatePlatformMountManager → FileSystem.openFlags FOPEN_DIRECT_IO in every Open's and Create's returned fuseFlags
fuse.keep_cache same chain FOPEN_KEEP_CACHE, unless direct_io is also set — see below
fuse.sync_read Configuration.FUSE → buildMountOptions → MountManager.buildFUSEOptions fuse.MountOptions.SyncRead, which go-fuse ORs into DisabledCapabilities as CAP_ASYNC_READ at INIT

direct_io takes precedence over keep_cache rather than the two being OR'd. They are contradictory instructions — one says do not cache this file's data, the other says keep the cache you have across open(2) — and the kernel's behavior when handed both is not something to leave to the kernel.

Why each seam is tested, and how each test was checked

Every one of the nine dead fields was correct at the layer that declared it and died at a boundary no test crossed. So the assertions are on the four boundaries, and each was verified by mutation — the mapping deleted or reverted to v0.10.0's actual code, and the intended test watched to fail with its intended message:

mutation result
openFlags() → the literal 0, 0 that shipped through v0.10.0 4 subtests fail
the three assignment lines deleted from Adapter.buildMountOptions 3 subtests fail — and passed the whole package before this test existed
the platform.go copy deleted 2 subtests fail
yaml:"fuse" → yaml:"-" TestLoadFromFileReadsTheFUSESection fails

The adapter mapping is the one that makes the case for the extraction: internal/adapter's entire suite passed with those lines removed, because the literal lived inside Start, between initializing the write path and constructing the mount manager, where nothing short of a live mount could observe it.

The kernel-facing assertions go through fs.NewNodeFS, which returns a RawFileSystem whose Lookup/Open/Create can be called without a mount. rawBridge.Open copies the node's returned fuseFlags into out.OpenFlags byte for byte, so what the test reads is what the kernel receives.

sync_read, not async_read

The issue proposed async_read. AsyncRead is the negation of the field go-fuse actually has, and a negated key makes async_read: false — the value a half-filled config file produces — the one that serializes every read. Naming the field that exists makes the dangerous value the one an operator has to type on purpose.

Consequence worth stating: all three fields default false, false is the kernel's own behavior for each, and NewDefault therefore names no fuse section at all. The zero value is the default, and a second place for a default to live is how the last set drifted. TestFUSEZeroValueIsTheDefault pins the property that omission depends on.

Two of the four are not plumbable

Recorded at the field that would have carried each, rather than dropped in silence:

  • Splice. go-fuse's trySplice type-asserts the ReadResult to a seekable or stateful result and bails otherwise. FileHandle.Read returns fuse.ReadResultData at all four of its return sites, because the bytes come from S3 or from an in-memory cache and there is no fd. DisableSplice would disable a path this filesystem never takes — a config key whose effect is provably nothing.
  • The writeback cache. It maps to fuse.MountOptions.ExplicitDataCacheControl, which per go-fuse's own documentation makes the filesystem "fully responsible for invalidating data cache." Grepping NotifyContent|NotifyEntry|NotifyInval across the repository returns zero hits. Enabling it would convert bounded staleness into permanent staleness. (There is no WritebackCache field on fuse.MountOptions at all; CAP_WRITEBACK_CACHE appears only in go-fuse's own types and printer.)

The kernel's half

Whether a second read(2) at the same offset reaches the filesystem, and whether cached pages survive open(2), cannot be observed without /dev/fuse — absent on ubuntu-latest and on a macOS host without macFUSE. Those tests live in kernel_options_live_test.go behind a fuse_mount build tag, with a make test-fuse-mount target. They fail rather than skip when the device is missing: a test that skips itself reports success.

CI compiles the tag it cannot run (go vet -tags=fuse_mount ./internal/fuse/), because a build tag nothing compiles is exactly how four others in this repo came to carry code that does not build (#240). This is a down-payment on that issue, not a substitute for it.

Coverage floor

internal/fuse goes 59 → 67. Seven of those points are a correction rather than a raise: the package measured 66.2% on the previous commit while the floor said 59, so the gate had drifted into eight points of slack that would have permitted a real regression silently. The remaining 1.3 points are this change's four seam tests.

Gates

  • go build ./..., go vet ./..., go vet -tags=fuse_mount ./internal/fuse/ — clean
  • go test -race -timeout 20m ./... — 0 failures
  • golangci-lint run --new-from-merge-base=origin/main — 0 issues
  • ./scripts/coverage-gate.sh — 30 packages at or above floor
  • markdownlint on CHANGELOG.md — no findings in the added range

Nine fields on internal/fuse.MountOptions and internal/fuse.Config carried yaml
tags for a whole release and were decoded by nothing, because
config.Configuration had no `fuse` key at all. Three of them name real go-fuse
capabilities and are back, plumbed end to end: direct_io, keep_cache, sync_read.

Every one of the nine was correct at the layer that declared it and died at a
boundary no test crossed, so each of the four seams between the YAML key and the
value the kernel receives is now asserted, and each assertion was verified by
mutation — the mapping deleted or reverted to v0.10.0's code, and the intended
test watched to fail with its intended message. The adapter mapping is the one
that makes the case: its package's whole suite passed with the three assignment
lines removed, which is why the literal was extracted into a method callable
without a mount.

sync_read rather than async_read, which is what the issue proposed. AsyncRead is
the negation of the field go-fuse actually has, and a negated key makes
`async_read: false` — the value a half-filled config file produces — the one that
serializes every read. All three fields therefore default false, false is the
kernel's own behavior for each, and NewDefault names no `fuse` section at all:
the zero value is the default, and a second place for it to live is how the last
set drifted.

Two of the four flags #180 nominated are not plumbable, and the evidence is
recorded at the field that would have carried each rather than dropped in
silence. Splice: go-fuse only splices a ReadResult backed by a file descriptor,
and reads here come from S3 or memory and return fuse.ReadResultData at all four
return sites, so DisableSplice would disable a path never taken. The writeback
cache: it maps to ExplicitDataCacheControl, which makes the filesystem
responsible for invalidating the kernel's data cache, and the repository contains
no NotifyContent, NotifyEntry, or NotifyInvalInode call — it would convert
bounded staleness into permanent staleness.

What the flags do to the kernel needs /dev/fuse, so it is behind a fuse_mount
build tag with a `make test-fuse-mount` target; those tests fail rather than skip
when the device is absent, because a test that skips itself reports success. CI
compiles the tag it cannot run, since a build tag nothing compiles is how four
others came to carry code that does not build (#240).

The internal/fuse coverage floor goes 59 → 67. Seven of those points are a
correction: the package measured 66.2% on the previous commit, so the gate had
drifted into slack that permitted a real regression silently.
@scttfrdmn
scttfrdmn merged commit eb9d584 into main Aug 3, 2026
23 checks passed
@scttfrdmn
scttfrdmn deleted the v0.11.0-fuse-options branch September 20, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nine inert FUSE mount options were removed; plumb the four that name real go-fuse capabilities

1 participant