pub fn sync_all(file: &File) -> Result<()>Expand description
File::sync_all, with the fallback Apple targets need and std does not do.
On an Apple target both sync_all and sync_data compile to
fcntl(F_FULLFSYNC) — std’s os_fsync/os_datasync in sys/fs/unix.rs,
with no error handling around the fcntl beyond cvt_r. That is the
correct barrier and it is why an ack is not an fsync (section 4), but not
every filesystem implements it: a Docker Desktop bind mount is FUSE and
answers ENOTSUP, and some network volumes answer EINVAL. std turns
either into an error, so a publish that a plain fsync(2) would have
satisfied fails instead, and the node goes unready over a volume that works.
So: try the barrier, and on exactly those two errnos degrade to fsync and
count it. Counting is the whole point — a fallback nobody can see is silent
durability loss, which is worse than the failure it replaces.