[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-stable] [PATCH 03/37] block: complete all IOs before .bdrv_truncat

From: Michael Roth
Subject: [Qemu-stable] [PATCH 03/37] block: complete all IOs before .bdrv_truncate
Date: Tue, 2 Apr 2013 16:45:08 -0500

From: Peter Lieven <address@hidden>

bdrv_truncate() invalidates the bdrv_check_request() result for
in-flight requests, so there should better be none.

Cc: address@hidden
Signed-off-by: Peter Lieven <address@hidden>
Reported-by: Kevin Wolf <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
(cherry picked from commit 9a665b2b8640e464f0a778216fc2dca8d02acf33)

Signed-off-by: Michael Roth <address@hidden>
 block.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/block.c b/block.c
index 50dab8e..11f162b 100644
--- a/block.c
+++ b/block.c
@@ -2427,6 +2427,10 @@ int bdrv_truncate(BlockDriverState *bs, int64_t offset)
         return -EACCES;
     if (bdrv_in_use(bs))
         return -EBUSY;
+    /* There better not be any in-flight IOs when we truncate the device. */
+    bdrv_drain_all();
     ret = drv->bdrv_truncate(bs, offset);
     if (ret == 0) {
         ret = refresh_total_sectors(bs, offset >> BDRV_SECTOR_BITS);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]