{
  "slug": "o-sync",
  "term": "O_SYNC",
  "aliases": [
    "synchronized I/O file integrity completion"
  ],
  "definition": "O_SYNC is an open-file status flag requiring write operations to complete with synchronized I/O file integrity, covering data and associated file metadata.",
  "note": "On Linux this provides the completion semantics of a write followed by fsync, whereas O_DSYNC requires only the metadata needed to retrieve the data. Neither flag requires O_DIRECT or means the page cache is bypassed. [open-api] A positive write result can be shorter than requested: check the returned byte count as well as errors before declaring the application record complete. [write-api] File synchronization does not by itself establish persistence of a newly created directory entry. [fsync-api]",
  "status": "shipping",
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-10-15",
  "advantages": [
    "Requests file-integrity completion as part of each write operation."
  ],
  "limitations": [
    "Does not make multiple writes or files one atomic transaction.",
    "Does not repair earlier failed writes.",
    "Metadata synchronization can add work; no universal latency benefit is implied."
  ],
  "related": [
    "o-dsync",
    "fdatasync",
    "fsync",
    "directory-fsync",
    "direct-io",
    "open-file-description"
  ],
  "citations": [
    {
      "id": "open-api",
      "title": "Linux man-pages 6.19: open(2), O_SYNC and O_DSYNC",
      "url": "https://man7.org/linux/man-pages/man2/open.2.html",
      "accessed": "2026-10-15"
    },
    {
      "id": "write-api",
      "title": "POSIX.1-2024: write(), synchronized I/O and partial writes",
      "url": "https://pubs.opengroup.org/onlinepubs/9799919799/functions/write.html",
      "accessed": "2026-10-15"
    },
    {
      "id": "fsync-api",
      "title": "Linux man-pages 6.19: fsync(2), metadata and directory synchronization",
      "url": "https://man7.org/linux/man-pages/man2/fsync.2.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"
    }
  ]
}
