From: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
To: qemu devel <qemu-devel@nongnu.org>,
Alberto Garcia <berto@igalia.com>, Eric Blake <eblake@redhat.com>,
Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: [Qemu-devel] [PATCH v4 2/2] quorum: modify vote rules for flush operation
Date: Tue, 23 Feb 2016 17:01:39 +0800 [thread overview]
Message-ID: <1456218099-386-3-git-send-email-xiecl.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1456218099-386-1-git-send-email-xiecl.fnst@cn.fujitsu.com>
Keep flush interface the same logic as quorum read/write, Otherwise in
following scenario, we'll encounter unexpected errors.
Quorum has two children(A, B). A do flush sucessfully, but B flush failed.
This cause the filesystem of guest become read-only with following errors:
end_request: I/O error, dev vda, sector 11159960
Aborting journal on device vda3-8
EXT4-fs error (device vda3): ext4_journal_start_sb:327: Detected abort journal
EXT4-fs (vda3): Remounting filesystem read-only
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
---
block/quorum.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/block/quorum.c b/block/quorum.c
index d3c3958..6048208 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -768,19 +768,28 @@ static coroutine_fn int quorum_co_flush(BlockDriverState *bs)
QuorumVoteValue result_value;
int i;
int result = 0;
+ int success_count = 0;
QLIST_INIT(&error_votes.vote_list);
error_votes.compare = quorum_64bits_compare;
for (i = 0; i < s->num_children; i++) {
result = bdrv_co_flush(s->children[i]->bs);
- result_value.l = result;
- quorum_count_vote(&error_votes, &result_value, i);
+ if (result) {
+ quorum_flush_error(s->children[i]->bs->node_name, "Flush failed");
+ result_value.l = result;
+ quorum_count_vote(&error_votes, &result_value, i);
+ } else {
+ success_count++;
+ }
}
- winner = quorum_get_vote_winner(&error_votes);
- result = winner->value.l;
-
+ if (success_count >= s->threshold) {
+ result = 0;
+ } else {
+ winner = quorum_get_vote_winner(&error_votes);
+ result = winner->value.l;
+ }
quorum_free_vote_list(&error_votes);
return result;
--
1.9.3
next prev parent reply other threads:[~2016-02-23 9:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-23 9:01 [Qemu-devel] [PATCH v4 0/2] modify vote rules for flush operation Changlong Xie
2016-02-23 9:01 ` [Qemu-devel] [PATCH v4 1/2] qmp event: Add QUORUM_FLUSH_ERROR Changlong Xie
2016-02-23 9:07 ` Changlong Xie
2016-02-23 12:53 ` Alberto Garcia
2016-02-23 13:17 ` Eric Blake
2016-02-23 13:24 ` Alberto Garcia
2016-02-23 13:45 ` Eric Blake
2016-02-23 14:05 ` Alberto Garcia
2016-02-24 2:49 ` Changlong Xie
2016-02-23 9:01 ` Changlong Xie [this message]
2016-02-23 12:56 ` [Qemu-devel] [PATCH v4 2/2] quorum: modify vote rules for flush operation Alberto Garcia
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=1456218099-386-3-git-send-email-xiecl.fnst@cn.fujitsu.com \
--to=xiecl.fnst@cn.fujitsu.com \
--cc=berto@igalia.com \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@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).