{
  "slug": "o-dsync",
  "term": "O_DSYNC",
  "aliases": [
    "synchronized I/O data integrity completion"
  ],
  "definition": "O_DSYNC is an open-file status flag requiring write operations to complete with synchronized I/O data integrity, covering data and the metadata needed to retrieve it.",
  "note": "A file-length extension is retrieval-critical; a timestamp-only update is not. Linux compares O_DSYNC write completion to a write followed by fdatasync, not to a metadata-free write. [open-api] Handle a short write using its returned byte count; the flag does not promise that one call transfers the entire requested application record. [write-api] Like fdatasync, it is not a replacement for the containing directory's synchronization when name persistence matters. [fsync-api]\n\nConfiguration: Linux F_SETFL leaves O_SYNC and O_DSYNC unchanged, even when fcntl returns success. Choose the required mode when opening the file, then inspect it with F_GETFL. The Linux v6.12 setfl implementation preserves these bits outside its mutable-flag mask. [setfl-api] [setfl-linux]\n\nPer-write option: pwritev2 RWF_SYNC and RWF_DSYNC request the corresponding synchronized completion for the written range, without changing the descriptor's mode. Check returned bytes and errors; neither flag supplies failure atomicity. [pwritev2-api]",
  "status": "shipping",
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-12",
  "advantages": [
    "Can avoid synchronization of metadata not required for data retrieval."
  ],
  "limitations": [
    "Does not guarantee lower latency than O_SYNC on every filesystem.",
    "Does not provide crash-atomic writes or a multi-file transaction.",
    "Does not imply direct I/O or page-cache bypass."
  ],
  "related": [
    "o-sync",
    "fdatasync",
    "fsync",
    "directory-fsync",
    "direct-io",
    "short-write",
    "rwf-atomic",
    "open-file-description",
    "rwf-dsync",
    "o-rsync"
  ],
  "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"
    },
    {
      "id": "setfl-api",
      "title": "Linux man-pages 6.19: F_GETFL and F_SETFL, unchanged synchronization flags",
      "url": "https://man7.org/linux/man-pages/man2/F_SETFL.2const.html",
      "accessed": "2026-11-05"
    },
    {
      "id": "setfl-linux",
      "title": "Linux v6.12: fs/fcntl.c, SETFL_MASK and setfl()",
      "url": "https://github.com/torvalds/linux/blob/v6.12/fs/fcntl.c#L35-L83",
      "accessed": "2026-11-05"
    },
    {
      "id": "hesela-atomic",
      "title": "Hesela: Linux atomic writes and synchronization configuration",
      "url": "https://hesela.com/analyses/linux-atomic-writes-durability/#sync-configuration",
      "accessed": "2026-11-05"
    },
    {
      "id": "pwritev2-api",
      "title": "Linux man-pages 6.19: pwritev2(), per-write synchronization flags",
      "url": "https://man7.org/linux/man-pages/man2/pwritev2.2.html",
      "accessed": "2026-11-05"
    }
  ]
}
