diff mbox series

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

Message ID 20190404132050.37309-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 April 4, 2019, 1:20 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));