Merge "snapshotctl: fsync after writing every 1MB buffer" into main

This commit is contained in:
Akilesh Kailash 2023-11-29 20:37:55 +00:00 committed by Gerrit Code Review
commit 37e7498fc0

View file

@ -227,8 +227,12 @@ bool MapSnapshots::WriteSnapshotPatch(std::string cow_device, std::string patch)
if (file_offset >= dev_sz) {
break;
}
if (fsync(cfd.get()) < 0) {
PLOG(ERROR) << "Fsync failed at offset: " << file_offset << " size: " << to_read;
return false;
}
}
fsync(cfd.get());
return true;
}