Forráskód Böngészése

block: complete all IOs before resizing a device

this patch ensures that all pending IOs are completed
before a device is resized. this is especially important
if a device is shrinked as it the bdrv_check_request()
result is invalidated.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 92b7a08d64e5e3129fa885f9d180e5bddcb76b42)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Peter Lieven 12 éve
szülő
commit
2b92aa36d1
1 módosított fájl, 3 hozzáadás és 0 törlés
  1. 3 0
      blockdev.c

+ 3 - 0
blockdev.c

@@ -1043,6 +1043,9 @@ void qmp_block_resize(const char *device, int64_t size, Error **errp)
         return;
         return;
     }
     }
 
 
+    /* complete all in-flight operations before resizing the device */
+    bdrv_drain_all();
+
     switch (bdrv_truncate(bs, size)) {
     switch (bdrv_truncate(bs, size)) {
     case 0:
     case 0:
         break;
         break;