mirror of
https://github.com/kopia/kopia.git
synced 2026-03-28 11:03:44 -04:00
Ensures the data is written to persistent storage before closing the file. - This prevents silently ignoring async I/O error that occur after the file handle has been closed, and thus not observed by the kopia process. - This prevents data loss cases of a client or server host crash where the file metadata was already persisted and the actual file data was not persisted yet. The actual behavior depends on the specific OS and file system implementation. For example, if no data has been written (flushed) to the device, the file size (metadata) may be 0, even after the subsequent rename. Either case above results in a potential repo corruption or data loss. These cases may occur more frequently with file systems accessed over the network, for example via NFS. Behavior change: a `Sync()` failure now aborts the write before close/ rename, so callers will see errors where previously the operation might have appeared successful, but risked silent data loss.