qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Lieven <pl@dlhnet.de>
To: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>, Jeff Cody <jcody@redhat.com>,
	Anthony Liguori <anthony@codemonkey.ws>
Subject: [Qemu-devel] [PATCH 2/3] block: complete all IOs before resizing a device
Date: Mon, 11 Mar 2013 11:04:24 +0100	[thread overview]
Message-ID: <513DAC28.8090303@dlhnet.de> (raw)

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>
---
  blockdev.c |    3 +++
  1 file changed, 3 insertions(+)

diff --git a/blockdev.c b/blockdev.c
index 0e67d06..be36ed7 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1062,6 +1062,9 @@ void qmp_block_resize(const char *device, int64_t size, Error **errp)
          return;
      }

+    /* complete all in-flight operations before resizing the device */
+    bdrv_drain_all();
+
      switch (bdrv_truncate(bs, size)) {
      case 0:
          break;
-- 
1.7.9.5

             reply	other threads:[~2013-03-11 10:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-11 10:04 Peter Lieven [this message]
2013-03-19 13:11 ` [Qemu-devel] [PATCH 2/3] block: complete all IOs before resizing a device Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=513DAC28.8090303@dlhnet.de \
    --to=pl@dlhnet.de \
    --cc=anthony@codemonkey.ws \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).