Repository navigation
feat: the FUSE options a config file names reach the kernel (#180) - #261
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #180.
Nine fields on
internal/fuse.MountOptionsandinternal/fuse.Configcarried yaml tags for a whole release and were decoded by nothing, becauseconfig.Configurationhad nofusekey 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
fuse.direct_ioConfiguration.FUSE→Adapter.buildMountOptions→CreatePlatformMountManager→FileSystem.openFlagsFOPEN_DIRECT_IOin everyOpen's andCreate's returnedfuseFlagsfuse.keep_cacheFOPEN_KEEP_CACHE, unlessdirect_iois also set — see belowfuse.sync_readConfiguration.FUSE→buildMountOptions→MountManager.buildFUSEOptionsfuse.MountOptions.SyncRead, which go-fuse ORs intoDisabledCapabilitiesasCAP_ASYNC_READat INITdirect_iotakes precedence overkeep_cacherather 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 acrossopen(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:
openFlags()→ the literal0, 0that shipped through v0.10.0Adapter.buildMountOptionsplatform.gocopy deletedyaml:"fuse"→yaml:"-"TestLoadFromFileReadsTheFUSESectionfailsThe 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 insideStart, 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 aRawFileSystemwhoseLookup/Open/Createcan be called without a mount.rawBridge.Opencopies the node's returnedfuseFlagsintoout.OpenFlagsbyte for byte, so what the test reads is what the kernel receives.sync_read, notasync_readThe issue proposed
async_read.AsyncReadis the negation of the field go-fuse actually has, and a negated key makesasync_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
NewDefaulttherefore names nofusesection at all. The zero value is the default, and a second place for a default to live is how the last set drifted.TestFUSEZeroValueIsTheDefaultpins 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:
trySplicetype-asserts theReadResultto a seekable or stateful result and bails otherwise.FileHandle.Readreturnsfuse.ReadResultDataat all four of its return sites, because the bytes come from S3 or from an in-memory cache and there is no fd.DisableSplicewould disable a path this filesystem never takes — a config key whose effect is provably nothing.fuse.MountOptions.ExplicitDataCacheControl, which per go-fuse's own documentation makes the filesystem "fully responsible for invalidating data cache." GreppingNotifyContent|NotifyEntry|NotifyInvalacross the repository returns zero hits. Enabling it would convert bounded staleness into permanent staleness. (There is noWritebackCachefield onfuse.MountOptionsat all;CAP_WRITEBACK_CACHEappears 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 surviveopen(2), cannot be observed without/dev/fuse— absent onubuntu-latestand on a macOS host without macFUSE. Those tests live inkernel_options_live_test.gobehind afuse_mountbuild tag, with amake test-fuse-mounttarget. 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/fusegoes 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/— cleango test -race -timeout 20m ./...— 0 failuresgolangci-lint run --new-from-merge-base=origin/main— 0 issues./scripts/coverage-gate.sh— 30 packages at or above floormarkdownlintonCHANGELOG.md— no findings in the added range