﻿# A later successful fsync does not erase an earlier writeback error

Linux tracks writeback errors with per-file-description cursors. Preserve the first failure and checkpoint state instead of treating a later zero result as repair.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/linux-writeback-error-file-description-cursor/
Language: en

## The second synchronization returns success

A checkpoint writer receives a writeback error from synchronization, immediately retries and receives success. Accepting the checkpoint solely from the second result loses the evidence that the first synchronization reported failed storage work. Success can reflect error-reporting state rather than repaired bytes.

The [VFS writeback documentation](https://docs.kernel.org/filesystems/vfs.html) explains that, after an error has been reported, later synchronization requests on the same file description can return success unless further writeback errors occur. Repetition is not the contract for preserving the original failure.

## Understand the cursor, not just the errno

The [errseq reference](https://docs.kernel.org/core-api/errseq.html) describes watchers that sample an error sequence and later check and advance their cursor. They can learn that an error occurred since the sample, but not reconstruct a complete count or history of every failure.

Advancing the cursor does not repeat the failed application write. It changes what error state has already been observed. A retry loop that stops at the first success must therefore keep the checkpoint generation marked uncertain until a separate recovery action establishes its contents.

## Keep file descriptions and writers visible

The generic VFS machinery does not track which file description dirtied every individual page. It reports writeback errors to file descriptions open when the error occurred. A reader or writer receiving an error is not automatically the unique origin of the failed data.

Preserve which processes and open file descriptions participated, including shared descriptors where relevant. Do not count repeated reports from different descriptions as independent device incidents or use the absence of a repeated report as proof that another writer's data is safe.

## Define recovery after the first failure

Stop publication of the affected checkpoint and retain the first error with its generation identity. Decide whether the application can reconstruct and rewrite a complete new generation or must fall back to an earlier verified one. Reopening the file merely to obtain a fresh synchronization result is not data recovery.

A controlled negative fixture can verify that the application's error path does not publish an uncertain generation. Such testing belongs in an isolated environment; the review itself need not damage storage or inject errors into live checkpoint files.

## Acceptance requires content evidence

After an approved rewrite or restore, validate the intended component set and application state. Preserve the relationship between the original failure, the chosen corrective action and the newly accepted generation. A later successful fsync contributes to that record but cannot replace it.

[File and directory synchronization](/journal/guide-storage-fsync-directory/) explains the separate publication-ordering requirements. [Checkpoint consistency](/journal/guide-storage-filesystem-snapshot/) explains why apparently present files are insufficient evidence of a coherent recovery state.

## Preserve uncertainty rather than clearing the symptom

An error cursor is a reporting mechanism, not a storage-health certificate. Filesystem-specific implementations can also differ from the generic mechanism described here. Record the actual filesystem and kernel behavior and retain unresolved uncertainty. The useful endpoint is a verified checkpoint selected by an explicit recovery decision, with the first writeback failure still visible in the incident history.
