qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	Jeff Cody <jcody@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH 9/9] block: for HMP commit() operations on 'all', skip non-COW drives
Date: Mon,  4 Mar 2013 10:15:31 +0100	[thread overview]
Message-ID: <1362388531-32305-10-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1362388531-32305-1-git-send-email-stefanha@redhat.com>

From: Jeff Cody <jcody@redhat.com>

During a commit of 'all' using the HMP non-live commit, the operation
is aborted and returns error on the first error enountered.  When
non-COW drives are in use (e.g. ejected floppy, cdrom, or drives without
a backing parent), that means a commit all will return an error of either
-ENOMEDIUM or -ENOTSUP.  This is not desirable, so for the 'all' commit
case, only attempt the commit if both bs->drv and bs->backing_hd are
present.

More succinctly: 'commit all' now means a commit on all COW drives.

This means an individual commit to a specific non-COW drive will still
return the appropriate error (-ENOMEDIUM if eject / not present, -ENOTSUP
if no backing file).

Reported-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 block.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/block.c b/block.c
index 4582961..124a9eb 100644
--- a/block.c
+++ b/block.c
@@ -1640,9 +1640,11 @@ int bdrv_commit_all(void)
     BlockDriverState *bs;
 
     QTAILQ_FOREACH(bs, &bdrv_states, list) {
-        int ret = bdrv_commit(bs);
-        if (ret < 0) {
-            return ret;
+        if (bs->drv && bs->backing_hd) {
+            int ret = bdrv_commit(bs);
+            if (ret < 0) {
+                return ret;
+            }
         }
     }
     return 0;
-- 
1.8.1.4

      parent reply	other threads:[~2013-03-04  9:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-04  9:15 [Qemu-devel] [PULL 0/9] Block patches Stefan Hajnoczi
2013-03-04  9:15 ` [Qemu-devel] [PATCH 1/9] ide/macio: Fix macio DMA initialisation Stefan Hajnoczi
2013-03-04  9:15 ` [Qemu-devel] [PATCH 2/9] virtio-blk: fix unplug + virsh reboot Stefan Hajnoczi
2013-03-04  9:15 ` [Qemu-devel] [PATCH 3/9] dataplane: remove EventPoll in favor of AioContext Stefan Hajnoczi
2013-03-08  8:37   ` Christian Borntraeger
2013-03-08  9:22     ` Paolo Bonzini
2013-03-08 12:44       ` Cornelia Huck
2013-03-08 13:51         ` Paolo Bonzini
2013-03-04  9:15 ` [Qemu-devel] [PATCH 4/9] slirp/tcp_subr.c: fix coding style in tcp_connect Stefan Hajnoczi
2013-03-04  9:15 ` [Qemu-devel] [PATCH 5/9] move socket_set_nodelay to osdep.c Stefan Hajnoczi
2013-03-04  9:15 ` [Qemu-devel] [PATCH 6/9] sheepdog: accept URIs Stefan Hajnoczi
2013-03-04  9:15 ` [Qemu-devel] [PATCH 7/9] sheepdog: use inet_connect to simplify connect code Stefan Hajnoczi
2013-03-04  9:15 ` [Qemu-devel] [PATCH 8/9] sheepdog: add support for connecting to unix domain socket Stefan Hajnoczi
2013-03-04  9:15 ` Stefan Hajnoczi [this message]

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=1362388531-32305-10-git-send-email-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=jcody@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).