[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 23/56] block: fix bdrv_flush() ordering in bdrv_clos
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 23/56] block: fix bdrv_flush() ordering in bdrv_close() |
Date: |
Tue, 13 Aug 2013 10:10:47 -0500 |
From: Stefan Hajnoczi <address@hidden>
Since 80ccf93b we flush the block device during close. The
bdrv_drain_all() call should come before bdrv_flush() to ensure guest
write requests have completed. Otherwise we may miss pending writes
when flushing.
Call bdrv_drain_all() again for safety as the final step after
bdrv_flush(). This should not be necessary but we can be paranoid here
in case bdrv_flush() left I/O pending.
Cc: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
(cherry picked from commit 58fda173e1156d24e5ff62361774715152188a07)
Signed-off-by: Michael Roth <address@hidden>
---
block.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/block.c b/block.c
index 3f87489..c7c3e06 100644
--- a/block.c
+++ b/block.c
@@ -1349,11 +1349,12 @@ void bdrv_reopen_abort(BDRVReopenState *reopen_state)
void bdrv_close(BlockDriverState *bs)
{
- bdrv_flush(bs);
if (bs->job) {
block_job_cancel_sync(bs->job);
}
- bdrv_drain_all();
+ bdrv_drain_all(); /* complete I/O */
+ bdrv_flush(bs);
+ bdrv_drain_all(); /* in case flush left pending I/O */
notifier_list_notify(&bs->close_notifiers, bs);
if (bs->drv) {
--
1.7.9.5
- [Qemu-devel] [PATCH 12/56] vmdk: remove wrong calculation of relative path, (continued)
- [Qemu-devel] [PATCH 12/56] vmdk: remove wrong calculation of relative path, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 14/56] migration: do not overwrite zero pages, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 15/56] raw-posix: Fix /dev/cdrom magic on OS X, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 16/56] kvmclock: clock should count only if vm is running, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 17/56] qemu-char: Fix ID reuse after chardev-remove for qapi-based init, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 19/56] target-lm32: gen_intermediate_code_internal() should be inlined, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 20/56] target-microblaze: gen_intermediate_code_internal() should be inlined, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 18/56] target-cris: gen_intermediate_code_internal() should be inlined, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 21/56] target-moxie: gen_intermediate_code_internal() should be inlined, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 22/56] target-xtensa: gen_intermediate_code_internal() should be inlined, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 23/56] block: fix bdrv_flush() ordering in bdrv_close(),
Michael Roth <=
- [Qemu-devel] [PATCH 24/56] target-openrisc: Fix typename in openrisc_cpu_class_by_name(), Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 25/56] qom: Fix class cast of NULL classes, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 29/56] iscsi: fix -ENOSPC in iscsi_create(), Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 26/56] seccomp: add the asynchronous I/O syscalls to the whitelist, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 27/56] qapi: qapi-commands: fix possible leaks on visitor dealloc, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 30/56] iscsi: remove support for misaligned nb_sectors in aio_readv, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 28/56] ahci: Fix FLUSH command, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 31/56] iscsi: assert that sectors are aligned to LUN blocksize, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 35/56] megasas: Legacy command line handling fix, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 39/56] xhci: handle USB_RET_IOERROR, Michael Roth, 2013/08/13