On 18.08.2011 15:55, Eric Blake wrote: > On 08/18/2011 07:44 AM, Michal Privoznik wrote: >> Although we are flushing cache after some critical writes (e.g. >> volume creation), after some others we do not (e.g. volume cloning). >> This patch fix this issue. That is for volume cloning, writing >> header of logical volume, and storage wipe. >> --- >> src/storage/storage_backend.c | 8 ++++++++ >> src/storage/storage_backend_logical.c | 7 +++++++ >> src/storage/storage_driver.c | 8 ++++++++ >> 3 files changed, 23 insertions(+), 0 deletions(-) >> >> diff --git a/src/storage/storage_backend.c >> b/src/storage/storage_backend.c >> index 6243d1e..889f530 100644 >> --- a/src/storage/storage_backend.c >> +++ b/src/storage/storage_backend.c >> @@ -208,6 +208,14 @@ virStorageBackendCopyToFD(virStorageVolDefPtr vol, >> } while ((amtleft -= interval)> 0); >> } >> >> + if (fdatasync(fd)< 0) { > > Why fdatasync here, Here we need to flush data but not metadata. > > >> +++ b/src/storage/storage_backend_logical.c >> @@ -424,6 +424,13 @@ virStorageBackendLogicalBuildPool(virConnectPtr >> conn ATTRIBUTE_UNUSED, >> VIR_FORCE_CLOSE(fd); >> goto cleanup; >> } >> + if (fsync(fd)< 0) { > > but only fsync here? > Here we are accessing logical volume where we want to make sure anybody (including LVM) will read data & metadata. -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list