Richard W.M. Jones
2016-Jan-18 16:18 UTC
[Libguestfs] [PATCH] resize: fsync the output file before closing the libvirt connection.
Libvirt has a fixed 15 second timeout for qemu to exit. If qemu is writing to a slow USB key, it can hang (in D state) for much longer than this - many minutes usually. To work around this, fsync the output file before closing the libvirt connection so that qemu shouldn't have anything (much) to write. We have to do this in two places in the code since we can reopen the connection (if using --expand for example). See also the description here: https://www.redhat.com/archives/libvir-list/2016-January/msg00767.html --- resize/resize.ml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resize/resize.ml b/resize/resize.ml index d6dd9a5..5e9f108 100644 --- a/resize/resize.ml +++ b/resize/resize.ml @@ -1283,6 +1283,9 @@ read the man page virt-resize(1). let g if to_be_expanded then ( + g#sync (); + Fsync.file outfile; + g#shutdown (); g#close (); @@ -1354,6 +1357,9 @@ read the man page virt-resize(1). ) lvs ); + g#sync (); + Fsync.file outfile; + (* Finished. Unmount disks and exit. *) g#shutdown (); g#close (); -- 2.5.0
Maybe Matching Threads
- [PATCH v2] resize, builder: fsync the output file before closing the libvirt connection.
- [PATCH] resize: support non-local output disks (RHBZ#1404182)
- [PATCH v3] resize: support non-local output disks (RHBZ#1404182)
- Re: [PATCH v2] resize: support non-local output disks (RHBZ#1404182)
- [PATCH v2] resize: support non-local output disks (RHBZ#1404182)