From: Kevin Wolf <kwolf@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, pbonzini@redhat.com, stefanha@redhat.com,
quintela@redhat.com
Subject: [Qemu-devel] [PATCH 1/3] block: Add return value for bdrv_flush_all()
Date: Fri, 5 Jul 2013 14:03:51 +0200 [thread overview]
Message-ID: <1373025833-22859-2-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1373025833-22859-1-git-send-email-kwolf@redhat.com>
bdrv_flush() can fail, and bdrv_flush_all() should return an error as
well if this happens for a block device. It returns the first error
return now, but still at least tries to flush the remaining devices even
in error cases.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block.c | 10 ++++++++--
include/block/block.h | 2 +-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/block.c b/block.c
index 6c493ad..6abdd99 100644
--- a/block.c
+++ b/block.c
@@ -2902,13 +2902,19 @@ int bdrv_get_flags(BlockDriverState *bs)
return bs->open_flags;
}
-void bdrv_flush_all(void)
+int bdrv_flush_all(void)
{
BlockDriverState *bs;
+ int result = 0;
QTAILQ_FOREACH(bs, &bdrv_states, list) {
- bdrv_flush(bs);
+ int ret = bdrv_flush(bs);
+ if (ret < 0 && !result) {
+ result = ret;
+ }
}
+
+ return result;
}
int bdrv_has_zero_init_1(BlockDriverState *bs)
diff --git a/include/block/block.h b/include/block/block.h
index dd8eca1..31c1bbc 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -266,7 +266,7 @@ void bdrv_clear_incoming_migration_all(void);
/* Ensure contents are flushed to disk. */
int bdrv_flush(BlockDriverState *bs);
int coroutine_fn bdrv_co_flush(BlockDriverState *bs);
-void bdrv_flush_all(void);
+int bdrv_flush_all(void);
void bdrv_close_all(void);
void bdrv_drain_all(void);
--
1.8.1.4
next prev parent reply other threads:[~2013-07-05 12:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-05 12:03 [Qemu-devel] [PATCH 0/3] Fail migration on bdrv_flush_all() error Kevin Wolf
2013-07-05 12:03 ` Kevin Wolf [this message]
2013-07-05 12:03 ` [Qemu-devel] [PATCH 2/3] cpus: Add return value for vm_stop() Kevin Wolf
2013-07-05 12:40 ` Paolo Bonzini
2013-07-05 12:03 ` [Qemu-devel] [PATCH 3/3] migration: Fail migration on bdrv_flush_all() error Kevin Wolf
2013-07-15 7:00 ` [Qemu-devel] [PATCH 0/3] " Stefan Hajnoczi
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=1373025833-22859-2-git-send-email-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@redhat.com \
/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).