diff mbox series

[kvmtool,3/9] guest: sync disk before shutting down

Message ID 20190218130702.32575-4-jean-philippe.brucker@arm.com (mailing list archive)
State New, archived
Headers show
Series Disk fixes and AIO reset | expand

Commit Message

Jean-Philippe Brucker Feb. 18, 2019, 1:06 p.m. UTC
sync() should be called before reboot(RB_AUTOBOOT), otherwise data written
to disks might be lost.

Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
---
 guest/init.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/guest/init.c b/guest/init.c
index 1f9cd048a..52f6567da 100644
--- a/guest/init.c
+++ b/guest/init.c
@@ -72,6 +72,7 @@  int main(int argc, char *argv[])
 		} while (corpse != child);
 	}
 
+	sync();
 	reboot(RB_AUTOBOOT);
 
 	printf("Init failed: %s\n", strerror(errno));