{
  "slug": "syncfs",
  "term": "syncfs",
  "aliases": [
    "syncfs()"
  ],
  "definition": "syncfs is a Linux system call that synchronizes pending file data and metadata for the filesystem selected by an open file descriptor.",
  "note": "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. [sync-api] 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. [sync-source] Advancing an error cursor records observation, not repair; a later success alone cannot establish that previously lost data was reconstructed. [errseq-doc]",
  "status": "shipping",
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-10-16",
  "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."
  ],
  "related": [
    "fsync",
    "writeback-error",
    "errseq-t",
    "open-file-description"
  ],
  "citations": [
    {
      "id": "sync-api",
      "title": "Linux man-pages 6.19: sync(2), filesystem scope and Linux 5.8 error reporting",
      "url": "https://man7.org/linux/man-pages/man2/sync.2.html",
      "accessed": "2026-10-15"
    },
    {
      "id": "sync-source",
      "title": "Linux v6.12: syncfs and sync_filesystem in fs/sync.c",
      "url": "https://github.com/torvalds/linux/blob/v6.12/fs/sync.c",
      "accessed": "2026-10-16"
    },
    {
      "id": "errseq-doc",
      "title": "Linux kernel: The errseq_t datatype",
      "url": "https://docs.kernel.org/core-api/errseq.html",
      "accessed": "2026-10-15"
    },
    {
      "id": "hesela-fsync",
      "title": "Hesela: Why retrying a failed fsync does not prove durability",
      "url": "https://hesela.com/analyses/fsync-failure-retry-durability/",
      "accessed": "2026-10-15"
    }
  ]
}
