o-dsync · shipping · also synchronized I/O data integrity completion

O_DSYNC

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.

Related Observatory article: Read on hesela.com

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. [1] Handle a short write using its returned byte count; the flag does not promise that one call transfers the entire requested application record. [2] Like fdatasync, it is not a replacement for the containing directory's synchronization when name persistence matters. [3]

Configuration: 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. [5] [6]

Per-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. [8]

Relations

related
O_SYNC, fdatasync, fsync, Directory fsync, Direct I/O, Short write, RWF_ATOMIC, Open file description, RWF_DSYNC, O_RSYNC

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.

Citations

  1. Linux man-pages 6.19: open(2), O_SYNC and O_DSYNC (accessed 2026-10-15)
  2. POSIX.1-2024: write(), synchronized I/O and partial writes (accessed 2026-10-15)
  3. Linux man-pages 6.19: fsync(2), metadata and directory synchronization (accessed 2026-10-15)
  4. Linux man-pages 6.19: F_GETFL and F_SETFL, unchanged synchronization flags (accessed 2026-11-05)
  5. Linux v6.12: fs/fcntl.c, SETFL_MASK and setfl() (accessed 2026-11-05)
  6. Linux man-pages 6.19: pwritev2(), per-write synchronization flags (accessed 2026-11-05)

Further reading

  1. Hesela: Why retrying a failed fsync does not prove durability (accessed 2026-10-15)
  2. Hesela: Linux atomic writes and synchronization configuration (accessed 2026-11-05)

JSON: /data/terms/o-dsync.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. O_DSYNC. Hesela. 2026-11-12. https://hesela.dev/terms/o-dsync/