It guarantees that a write reached the device. It does not guarantee that the device told the truth, that the filesystem kept your ordering, or that the replica ever saw it.
On a fleet of 40 nodes running the same image, we injected power loss during a write-heavy workload and compared what survived against what the application believed had been acknowledged. Three failure modes showed up, in decreasing order of frequency:
| Mode | Share | What the app believed |
|---|---|---|
| Device write cache discarded | 61% | Committed (fsync returned) |
| Directory entry lost, file intact | 27% | Committed |
| Replica had not received the entry | 12% | Committed locally, unknown remotely |
fsync returns when the kernel has handed the write to the device and the device has acknowledged the flush. If the device's write cache is volatile and its flush command is a no-op — a real and not-rare firmware behaviour — the acknowledgement is decorative. Nothing in the filesystem can detect this.
The only reliable check is empirical: write, flush, cut power, verify. We now run that as a qualification step for every disk model before it enters a pool, and the results are stored alongside the hardware inventory.
# qualification, not a benchmark: does the flush actually flush?
for i in $(seq 1 200); do
dd if=/dev/urandom of=/data/q/$i bs=4k count=1 conv=fsync
done
# then physically remove power, boot, count files
# anything other than 200/200 fails qualification
Creating a file writes the inode and the directory entry. fsync on the file descriptor covers the inode; the directory needs its own fsync on the containing directory. Miss that and you get a perfectly valid file that no longer has a name — recoverable with a filesystem check, invisible to your application.
Local durability is not replication. An entry can be on disk here and absent there for as long as your replication lag allows. If the acknowledgement to the client is issued before the replica confirms, the window is not theoretical — it is exactly your replication lag.
We measured p99 replication lag at 340 ms under normal load and 2.1 s during compaction. Every one of those seconds was a window where “committed” meant “committed here, maybe nowhere else”.
fsync the directory after creating or renaming, always.After the change, our injected-failure test showed zero acknowledged-but-lost writes across 200 runs. The cost was 1.7 ms of added median write latency, which we paid willingly.