syncfs · shipping · also syncfs()

syncfs

syncfs is a Linux system call that synchronizes pending file data and metadata for the filesystem selected by an open file descriptor.

Related Observatory article: Read on hesela.com

Linux waits for I/O completion; the descriptor selects a filesystem, not just one file. Unlike the void sync() interface, syncfs returns an error indication. Since Linux 5.8 it also reports filesystem writeback failures, which can concern another file or filesystem metadata. [1] In the pinned Linux v6.12 implementation, syncfs checks the superblock error sequence against the open file description's f_sb_err cursor, separate from its file-level f_wb_err cursor. The cursor check still runs when sync_filesystem() fails; that immediate failure takes precedence in the returned result. The sequence is not a queue of errors to drain by retrying. This is a source-code observation, not a portable API rule. [2] Advancing an error cursor records observation, not repair; a later success alone cannot establish that previously lost data was reconstructed. [3]

Relations

related
fsync, Writeback error, errseq_t, Open file description

Advantages

  • Provides an error-reporting synchronization operation scoped to one filesystem.

Limitations

  • Does not enumerate failed files or identify damaged byte ranges.
  • Does not turn a multi-file update into an atomic application transaction.
  • Linux-specific; do not assume its error-reporting behavior on old kernels.

Citations

  1. Linux man-pages 6.19: sync(2), filesystem scope and Linux 5.8 error reporting (accessed 2026-10-15)
  2. Linux v6.12: syncfs and sync_filesystem in fs/sync.c (accessed 2026-10-16)
  3. Linux kernel: The errseq_t datatype (accessed 2026-10-15)

Further reading

  1. Hesela: Why retrying a failed fsync does not prove durability (accessed 2026-10-15)

JSON: /data/terms/syncfs.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. syncfs. Hesela. 2026-10-16. https://hesela.dev/terms/syncfs/