commit | 37e7498fc0114b118cb410eaafab4335348c3ded | [log] [tgz] |
---|---|---|
author | Akilesh Kailash <akailash@google.com> | Wed Nov 29 20:37:55 2023 +0000 |
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | Wed Nov 29 20:37:55 2023 +0000 |
tree | aa1972a4150840560530a99e912515ee1cf7baa8 | |
parent | 54702a79f92f66541613e7f3a58844296a790daa [diff] | |
parent | b78d0e2856c5401d77839f95d9ae7d829abfa010 [diff] |
Merge "snapshotctl: fsync after writing every 1MB buffer" into main
diff --git a/fs_mgr/libsnapshot/snapshotctl.cpp b/fs_mgr/libsnapshot/snapshotctl.cpp index ebaca2d..0396a55 100644 --- a/fs_mgr/libsnapshot/snapshotctl.cpp +++ b/fs_mgr/libsnapshot/snapshotctl.cpp
@@ -227,8 +227,12 @@ 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; }