{
  "slug": "fsync",
  "term": "fsync",
  "aliases": [
    "fsync()"
  ],
  "definition": "fsync is a file-synchronization operation that requests persistence of a file's modified data and associated metadata before reporting completion.",
  "note": "On Linux, syncing the file does not necessarily persist its containing directory entry; the directory needs its own sync. fdatasync may omit metadata unnecessary for retrieving the data, but must include required file-size changes. A failed sync must be treated as an unresolved durability event, not silently replaced by a later successful return.\n\nOpenZFS sync=disabled ignores application synchronous requests, whereas logbias=throughput changes the storage path without disabling synchronous semantics. [zfs-props]\n\nFor an asynchronous io_uring sync, establish dependencies on the intended writes before treating its completion as their persistence boundary. [uring-fsync] In F2FS with checkpointing disabled, the audited regular-file fsync path can return successful data-writeback status before recovery metadata; inspect the effective configuration. [f2fs-sync]\n\nFUSE: Linux v6.12 converts an ENOSYS reply to FUSE_FSYNC into success and suppresses later daemon FSYNC requests on that connection, while retaining preceding writeback checks. Backend persistence still depends on the daemon. [fuse-sync-source]\n\nFor descriptor-backed C output streams, check fflush before fsync. Pending library-buffer bytes are outside the file synchronization request. The separate stream and file completion boundaries must both be checked. [linux-fflush]\n\nDarwin F_FULLFSYNC adds a drive-cache flush request to file synchronization. [apple-fcntl] In SQLite, synchronous=FULL controls synchronization timing, not selection of the fullfsync method. [sqlite-sync-flags]",
  "status": "shipping",
  "advantages": [],
  "limitations": [],
  "related": [
    "crash-consistency",
    "writeback-error",
    "write-back-cache",
    "directory-fsync",
    "persistence-ordering",
    "direct-io",
    "fdatasync",
    "msync",
    "sync-file-range",
    "open-file-description",
    "zfs-intent-log",
    "io-uring",
    "io-uring-drain",
    "f2fs-checkpoint",
    "syncfs",
    "o-sync",
    "o-dsync",
    "close",
    "fuse",
    "fflush",
    "fclose",
    "fwrite",
    "f-fullfsync"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "citations": [
    {
      "id": "linux-fsync",
      "title": "Linux man-pages 6.19: fsync(2)",
      "url": "https://man7.org/linux/man-pages/man2/fsync.2.html",
      "accessed": "2026-10-10"
    },
    {
      "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-10"
    },
    {
      "id": "hesela-rename",
      "title": "Hesela: Atomic rename is not a durable commit",
      "url": "https://hesela.com/analyses/atomic-rename-directory-durability/",
      "accessed": "2026-10-11"
    },
    {
      "id": "zfs-props",
      "title": "OpenZFS 2.3: zfsprops(7), sync and logbias",
      "url": "https://openzfs.github.io/openzfs-docs/man/v2.3/7/zfsprops.7.html",
      "accessed": "2026-10-14"
    },
    {
      "id": "uring-fsync",
      "title": "liburing: io_uring_enter(2), IORING_OP_FSYNC ordering",
      "url": "https://man7.org/linux/man-pages/man2/io_uring_enter.2.html",
      "accessed": "2026-10-14"
    },
    {
      "id": "f2fs-sync",
      "title": "Linux v6.16 fs/f2fs/file.c: regular-file writeback and SBI_CP_DISABLED return.",
      "url": "https://github.com/torvalds/linux/blob/v6.16/fs/f2fs/file.c",
      "accessed": "2026-10-15"
    },
    {
      "id": "hesela-f2fs",
      "title": "F2FS: when a successful fsync is not a recovery promise",
      "url": "https://hesela.com/analyses/f2fs-checkpoint-fsync-recovery/",
      "accessed": "2026-10-15"
    },
    {
      "id": "fuse-sync-source",
      "title": "Linux v6.12: fuse_fsync and connection-scoped no_fsync handling",
      "url": "https://github.com/torvalds/linux/blob/v6.12/fs/fuse/file.c#L540-L585",
      "accessed": "2026-10-18"
    },
    {
      "id": "linux-fflush",
      "title": "Linux man-pages 6.19: fflush(3)",
      "url": "https://man7.org/linux/man-pages/man3/fflush.3.html",
      "accessed": "2026-10-21"
    },
    {
      "id": "apple-fcntl",
      "title": "Apple archived fcntl(2): F_FULLFSYNC",
      "url": "https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html",
      "accessed": "2026-11-13"
    },
    {
      "id": "sqlite-sync-flags",
      "title": "SQLite: Synchronization Type Flags",
      "url": "https://www.sqlite.org/c3ref/c_sync_dataonly.html",
      "accessed": "2026-11-13"
    }
  ],
  "updated": "2026-11-13"
}
