mirror of
https://github.com/borgbackup/borg.git
synced 2025-01-30 11:11:28 +00:00
make sure data hits disk before commit tag, fixes #1236
This commit is contained in:
parent
02c72b9925
commit
fde5a60549
1 changed files with 4 additions and 1 deletions
|
@ -727,8 +727,11 @@ def write_commit(self):
|
|||
fd = self.get_write_fd(no_new=True)
|
||||
header = self.header_no_crc_fmt.pack(self.header_fmt.size, TAG_COMMIT)
|
||||
crc = self.crc_fmt.pack(crc32(header) & 0xffffffff)
|
||||
# first fsync(fd) here (to ensure data supposedly hits the disk before the commit tag)
|
||||
fd.flush()
|
||||
os.fsync(fd.fileno())
|
||||
fd.write(b''.join((crc, header)))
|
||||
self.close_segment()
|
||||
self.close_segment() # after-commit fsync()
|
||||
|
||||
def close_segment(self):
|
||||
if self._write_fd:
|
||||
|
|
Loading…
Reference in a new issue