{
  "slug": "rwf-sync",
  "term": "RWF_SYNC",
  "aliases": [
    "per-write file-integrity completion"
  ],
  "definition": "RWF_SYNC is a Linux per-write flag that requests synchronized file-integrity completion for the range written by pwritev2().",
  "note": "Documented since Linux 4.7, this is the per-call counterpart of O_SYNC, and does not change the synchronization mode stored in the open file description. Within the preadv2/pwritev2 pair, the flag affects writes, not reads; check the returned byte count for a short transfer. [rwf-api]\n\nFile-integrity completion includes associated file metadata as well as data. It does not require cache bypass or turn several writes into one failure-atomic transaction. [open-api]\n\nLinux v6.12 combines per-call synchronization bits with inherited open-mode bits: flags=0 does not disable O_SYNC or O_DSYNC. This is source inspection, not a power-loss test. [linux-sync-flags]",
  "advantages": [
    "Requests file-integrity completion for a selected write without changing the open mode."
  ],
  "limitations": [
    "Does not provide torn-write protection or a multi-file transaction.",
    "Does not establish persistence of a new directory entry.",
    "Does not promise a smaller physical flush or lower latency."
  ],
  "related": [
    "rwf-dsync",
    "o-sync",
    "fsync",
    "directory-fsync",
    "short-write",
    "rwf-atomic",
    "open-file-description"
  ],
  "citations": [
    {
      "id": "rwf-api",
      "title": "Linux man-pages: readv(2), per-write flags and short transfers",
      "url": "https://man7.org/linux/man-pages/man2/readv.2.html",
      "accessed": "2026-11-12"
    },
    {
      "id": "open-api",
      "title": "Linux man-pages: open(2), synchronized I/O completion",
      "url": "https://man7.org/linux/man-pages/man2/open.2.html",
      "accessed": "2026-11-12"
    },
    {
      "id": "linux-sync-flags",
      "title": "Linux v6.12: init_sync_kiocb, iocb_flags, kiocb_set_rw_flags and generic_write_sync",
      "url": "https://github.com/torvalds/linux/blob/adc218676eef25575469234709c2d87185ca223a/include/linux/fs.h",
      "accessed": "2026-11-12"
    },
    {
      "id": "hesela-sync-range",
      "title": "Hesela: Per-write flags add requirements; they do not downgrade the open mode",
      "url": "https://hesela.com/analyses/linux-atomic-writes-durability/#per-write-sync",
      "accessed": "2026-11-12"
    },
    {
      "id": "fsync-api",
      "title": "Linux man-pages: fsync(2), file and directory persistence",
      "url": "https://man7.org/linux/man-pages/man2/fsync.2.html",
      "accessed": "2026-11-12"
    }
  ],
  "status": "shipping",
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-12"
}
