Research notes / Filesystem I/O
FUSE writeback caching: reads behind writes and the fsync contract
/ Updated / Source review and native experiment
Before enabling FUSE writeback caching, check who can change the backing data, whether the daemon can read partially overwritten pages, and what its synchronization callback actually does. Faster write completion and persistent storage are separate requirements.
On this page12 sections
A partial write can require a read
Linux v6.12 documents three paths. Direct I/O bypasses the FUSE page cache and readahead. Cached write-through forwards writes to the daemon immediately. Writeback-cache first dirties cached data, then sends it later. [1]
| Path | Write handling | Important condition |
|---|---|---|
| Direct I/O | Bypasses this page cache. | Does not describe the daemon's own buffering. |
| Write-through | Forwards each write as one or more requests. | No read requests generated for these writes. |
| Writeback-cache | Can defer and combine cached writes. | A partial-page update can require existing bytes first. |
Consequently, a daemon can receive READ for a file opened with O_WRONLY. This is a cache-maintenance request, not permission for the application to read through that descriptor. Writeback assumes changes pass through this kernel's FUSE path; the documentation therefore warns against treating it as a general network-filesystem setting. [1]
Engineering implication: test an overwrite inside an existing uncached page, not only a freshly created file. Establish how remote writers or direct changes to the backing store are coordinated before choosing a cache policy.
FLUSH, RELEASE and FSYNC have different jobs
In the libfuse 3.16.2 low-level contract, flush accompanies descriptor close and can occur more than once for a shared open file. Its name does not require pending data to become persistent. release ends the open-file lifetime; its returned error is not delivered to the closing application. fsync is the synchronization operation. [2]
For an incident trace, keep the application syscall, FUSE request and backing-store action separate. A log entry named “flush” is insufficient evidence of a media flush. See also stable writes and device flushes.
An unimplemented FSYNC can return success
Linux v6.12 first waits for file writeback, checks writeback errors and synchronizes inode metadata. It then issues FUSE_FSYNC unless the connection already records no_fsync. An ENOSYS reply sets that flag and is converted to success. Subsequent calls skip this daemon request, not the preceding writeback and error checks. [3]
The corresponding libfuse 3.16.2 low-level dispatcher sends ENOSYS when its fsync callback is absent. This is a source-level path through two pinned versions, not an experiment on every FUSE filesystem or a claim that every API wrapper has identical defaults. [4]
Hesela's conclusion: checking only the syscall's return value cannot establish what a particular daemon did to its backing store. Inspect the implementation and its persistence contract. A daemon may already persist each write; another may need a real backend synchronization operation. The protocol fallback alone distinguishes neither case.
Directory synchronization uses a separate request and connection flag; see the directory-sync support boundary.
This is separate from retrying fsync after a reported writeback failure: the case here is an unimplemented operation, not evidence that earlier damaged data was repaired.
A 32-page default is not a universal read ceiling
Linux v6.12 initializes a 32-page default request limit. If the daemon negotiates FUSE_MAX_PAGES, initialization clamps its proposed limit to at least one page and at most 256 pages. The connection's max_read is a separate byte limit. [6] [7]
In that version, fuse_readahead() uses the smaller of the connection's page limit and max_read / PAGE_SIZE. With 4 KiB pages, 256 pages represent 1 MiB, but a lower max_read still restricts the request; this is a capacity calculation, not a throughput prediction or a promise that each request fills the limit. Treat a blanket 32-page description as insufficient for this negotiated implementation. [8]
The FAST 2017 paper's sequential-read discussion shows why application read size and daemon request size must be recorded separately: readahead made different application sizes produce similar request counts in its tested setup. That Linux 4.1.13 result does not measure the later v6.12 negotiation path. No new read-size workload was run for that comparison. [5, section 5.2]
Which queue does the limit describe?
max_background, congestion_threshold and waiting describe different parts of a FUSE connection. None is a direct measurement of commands inside the storage device. The distinction matters when a daemon appears saturated.
| Control or counter | Meaning | Do not infer |
|---|---|---|
max_background | Governs background dispatch toward userspace. | A cap on all outstanding work. [10] |
congestion_threshold | Suppresses selected speculative or asynchronous work. | A second hard dispatch limit. [11] |
waiting | Observes the broader num_waiting population. | Active background requests or device occupancy. [12] |
The dispatch loop admits background work while active_background < max_background. Ordinary background allocation can block; foreground allocation does not use that background gate. Forced requests can bypass the allocation wait and join the queue. The sum of queued and active background work is therefore not strictly bounded by this setting. [10]
When num_background >= congestion_threshold, fuse_readahead() skips the remainder when only speculative pages remain, and fuse_writepages() skips a WB_SYNC_NONE invocation. This does not disable every read, write or fsync. [11]
A version trap: libfuse 3.16.2's header describes a kernel-4.8-era classification that excludes writeback from background requests. Linux v6.12's fuse_send_writepage() instead uses the forced background path. Use the implementation version when interpreting that label. [13] [11]
For diagnosis, record the connection ID, both settings and the sampling time. waiting includes foreground requests and callers waiting before allocation; it is not interchangeable with active_background. Read it alongside daemon progress and backend latency before changing a limit. A larger limit is not evidence of higher throughput or durable completion. [12] [10] See the FUSE background request limit definition.
An empty counter read is not a zero sample
Linux v6.12 samples num_waiting when the read callback receives offset zero, then retains that value for continuation reads. A collector that reads the file in pieces must not treat each piece as a new observation. Reaching end of file returns no more text; it does not report that the queue is empty. Start each sample at offset zero, for example by reopening the control file. [12]
The FAST 2017 study measured residence time separately in background, pending and processing queues, plus daemon execution time. Its processing interval already included userspace work: adding that interval to daemon time would double-count part of the path. A population counter alone cannot reconstruct those stage timings. [5, section 3.2]
What the FAST 2017 study can tell us
Vangoor, Tarasov and Zadok instrumented Stackfs over ext4, comparing basic and optimized FUSE configurations across 45 Filebench workloads on HDD and SSD. Their setup used Linux 4.1.13 and libfuse commit 386b1b. Work was fixed per run, with reported durations of 8-20 minutes; some SSD workloads used more work than HDD workloads. [5, sections 3-4]
The optimized configuration changed four things together: writeback caching, request size, threading and splicing. Its difference from the basic configuration therefore does not isolate writeback's causal effect. Some workloads remained close to native ext4 throughput; others lost roughly 83%. That is a workload-dependent historical range, not a slowdown constant for current FUSE implementations. [5, sections 4-5]
We reviewed the paper's methods and results, but did not rerun its benchmark or measure a production daemon. The useful transfer is its separation of workload and implementation costs, not a universal performance forecast.
Networked writeback needs a coherence protocol
The network-filesystem warning is not an impossibility result. DFUSE (SoCC 2025) uses a modified FUSE driver and libfuse to check distributed leases before cached access. Revocation blocks new operations, drains ongoing work and flushes dirty pages before relinquishing the lease. This changes the protocol, not merely a mount option. [9, sections 3-5]
Its evaluation uses a same-code write-through baseline with optimistic concurrency control, not a head-to-head benchmark against Ceph or GlusterFS. Hesela's interpretation: cache coherence is not a durability guarantee. A deployment still needs a separately checked backend persistence and recovery contract; the reported speedups do not establish power-loss survival. [9, section 6.1]
An interrupt is not a rollback receipt
Keep notification, completion and backend effects separate. Linux v6.12 permits the daemon to ignore an interrupt or reply to the original request with EINTR. A fatal signal before dispatch can instead remove the request. The FAST 2017 paper describes sequence-number matching for interruptions; it does not establish transactional undo. [14] [5, section 2.2]
There are two reply identities. In fuse_dev_do_write(), an EAGAIN reply to the interrupt takes the notification-requeue path, while ENOSYS disables further interrupt requests for that connection. These control replies do not complete the original operation or request another execution of its mutation. [15]
libfuse 3.16.2 also closes a registration race: fuse_req_interrupt_func() can call the supplied callback before registration returns if interruption was already recorded. Prepare callback state first. Its implementation holds the request mutex while invoking that callback; recursively registering or unregistering on the same request would attempt to acquire the mutex again. This is a source-level lock-order warning, not a reproduced daemon deadlock. [16] [17]
For incident analysis, log the original request identity, interrupt notification, original reply and backend action separately. Hesela's engineering inference: an interrupted flag alone cannot justify replaying a non-idempotent operation. Establish whether its effect happened and what the backend promises. A connection-wide abort is another recovery action, not an undo record. See the FUSE INTERRUPT contract. No mounted cancellation workload or crash test was run for this review; the following experiment isolates the native-library boundary.
A callback is not an exactly-once cancellation event
Two notifications can invoke a callback twice without repeating the backend write. Hesela exercised unmodified libfuse 3.16.2 and 3.17.4 through their real dispatcher with synthetic protocol 7.31 frames. Twelve designed schedules, two versions, two harness compiler modes and three repetitions produced 144 case executions. The traces matched across repetitions and versions, excluding the version label. These are 12 controlled scenarios, not 144 independent samples or a measured failure rate. [18]
Two injected interrupts for one pending write invoked the installed callback twice. Registering the callback twice after one interrupt also invoked it twice, both times before registration returned. Unregistration prevented notification but did not clear the interrupted flag. The source paths explain these observations; they do not establish how often a real kernel generates these schedules. [17] [19]
| Schedule | Callbacks | Synchronous | Final bytes | Write reply |
|---|---|---|---|---|
| No interrupt | 0 | 0 | DONE | success |
| Register, then interrupt | 1 | 0 | DONE | success |
| Unregister, then interrupt | 0 | 0 | DONE | success |
| Two injected interrupts | 2 | 0 | DONE | success |
| Register twice after interrupt | 2 | 2 | DONE | success |
| Return EINTR before write | 1 | 0 | SEED | EINTR |
| Return EINTR after write | 1 | 0 | DONE | EINTR |
The harness deliberately returned EINTR before versus after writing a temporary file. The same original-request error accompanied unchanged SEED bytes in one case and DONE in the other. This is a controlled counterexample to inferring backend state from that reply alone, not a libfuse rollback defect. The cancellation policy was chosen by the harness; the callback itself only recorded notification.
Engineering inference: initialize callback state before registration and guard non-idempotent cancellation actions. Keep original-request identity, interrupt identity, backend effect and original reply separate. Repeated notification need not mean repeated mutation: our two-interrupt schedule performed one backend write.
Scope: no filesystem was mounted and no kernel signals were generated. The experiment did not test concurrent callbacks, callback-triggered request freeing, production daemons, deadlock, latency or crash durability. Files were read back without fsync; DONE means observed bytes, not persistence after power loss. A fresh 30 November replay matched the retained 29 November traces.
Inspect the method and limits, complete observations, typed claim map and reproduction commands. The file manifest binds the original harness, runner, verifier and results with SHA-256 hashes. The historical FAST benchmark above was not reproduced.
Evaluate the contract before tuning
For a concrete deployment, use this review checklist:
- Record kernel, library, daemon and backend versions, plus negotiated cache settings.
- Trace cold partial overwrites and append behavior; compare daemon requests with application operations.
- Measure write-return latency and synchronization latency separately, with equal persistence requirements.
- Exercise backend write and sync errors in a disposable test environment; verify which failures reach the application.
- Validate recovery against known expected contents after the declared failure model. Process exit is not power loss.
These are proposed deployment checks, not tests performed for this article. The review adds documented request and callback distinctions to Hesela's latency measurement and durability guidance.
Corpus: FUSE, FUSE writeback-cache, and FUSE FLUSH. FUSE filesystems are unrelated to binary fuse filters.
Primary sources and scope
- Linux v6.12: FUSE I/O modes
- libfuse 3.16.2: low-level open, flush, release and fsync contracts
- Linux v6.12: fuse_fsync and connection-scoped no_fsync handling
- libfuse 3.16.2: do_fsync dispatch and missing low-level callback
- Vangoor, Tarasov and Zadok: To FUSE or Not to FUSE, FAST 2017, pp. 59-72, sections 3-5
- Linux v6.12: connection initialization and FUSE_MAX_PAGES negotiation
- Linux v6.12: FUSE_DEFAULT_MAX_PAGES_PER_REQ and FUSE_MAX_MAX_PAGES
- Linux v6.12: fuse_readahead page and byte limits
- Li et al.: DFUSE, SoCC 2025, sections 3-6; DOI 10.1145/3772052.3772208
- Linux v6.12: background allocation, dispatch and request accounting
- Linux v6.12: fuse_readahead, fuse_writepages and forced writeback requests
- Linux v6.12: FUSE connection waiting and queue controls
- libfuse 3.16.2: connection parameters and kernel-4.8-era background request classification
- Linux v6.12: interruption races and connection abort
- Linux v6.12: fuse_dev_do_write interrupt-reply handling
- libfuse 3.16.2: fuse_req_interrupt_func callback contract
- libfuse 3.16.2: callback registration and request locking
- Hesela: native libfuse interruption experiment, code and evidence
- libfuse 3.17.4: synchronous late callback registration
Native interruption experiment and source anchors rechecked 30 November 2026; connection queue accounting reviewed 29 November 2026; read-request limits and FAST 2017 section 5.2 rechecked 25 October 2026; earlier callback review retained from 18 October 2026. Kernel and libfuse behavior is version-scoped. This combines literature and implementation review with a bounded native-library experiment, not a new benchmark, crash test or vulnerability report.