fsync
fsync is a file-synchronization operation that requests persistence of a file's modified data and associated metadata before reporting completion.
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.
OpenZFS sync=disabled ignores application synchronous requests, whereas logbias=throughput changes the storage path without disabling synchronous semantics. [4]
For an asynchronous io_uring sync, establish dependencies on the intended writes before treating its completion as their persistence boundary. [5] In F2FS with checkpointing disabled, the audited regular-file fsync path can return successful data-writeback status before recovery metadata; inspect the effective configuration. [6]
FUSE: 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. [8]
For 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. [9]
Darwin F_FULLFSYNC adds a drive-cache flush request to file synchronization. [10] In SQLite, synchronous=FULL controls synchronization timing, not selection of the fullfsync method. [11]
Relations
- related
- Crash consistency, Writeback error, Write-back cache, Directory fsync, Persistence ordering, Direct I/O, 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
Citations
- OpenZFS 2.3: zfsprops(7), sync and logbias
- liburing: io_uring_enter(2), IORING_OP_FSYNC ordering
- Linux v6.16 fs/f2fs/file.c: regular-file writeback and SBI_CP_DISABLED return.
- Linux v6.12: fuse_fsync and connection-scoped no_fsync handling
- Linux man-pages 6.19: fflush(3)
- Apple archived fcntl(2): F_FULLFSYNC
- SQLite: Synchronization Type Flags