[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 11/40] quorum: modify vote rules for flush operation
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 11/40] quorum: modify vote rules for flush operation |
Date: |
Mon, 14 Mar 2016 18:37:12 +0100 |
From: Changlong Xie <address@hidden>
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
Cc: Dr. David Alan Gilbert <address@hidden>
Cc: Wen Congyang <address@hidden>
Signed-off-by: Wen Congyang <address@hidden>
Signed-off-by: Changlong Xie <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/quorum.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/block/quorum.c b/block/quorum.c
index 8f83574..b16171b 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -767,19 +767,30 @@ 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_report_bad(QUORUM_OP_TYPE_FLUSH, 0,
+ bdrv_nb_sectors(s->children[i]->bs),
+ s->children[i]->bs->node_name, result);
+ 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.8.3.1
- [Qemu-devel] [PULL 00/40] Block patches, Kevin Wolf, 2016/03/14
- [Qemu-devel] [PULL 03/40] block/qapi: Factor out bdrv_query_bds_stats(), Kevin Wolf, 2016/03/14
- [Qemu-devel] [PULL 01/40] qemu-img: eliminate memory leak, Kevin Wolf, 2016/03/14
- [Qemu-devel] [PULL 02/40] block/qapi: Factor out bdrv_query_blk_stats(), Kevin Wolf, 2016/03/14
- [Qemu-devel] [PULL 04/40] block/qapi: Include empty drives in query-blockstats, Kevin Wolf, 2016/03/14
- [Qemu-devel] [PULL 05/40] block/vpc: choose size calculation method based on creator_app field, Kevin Wolf, 2016/03/14
- [Qemu-devel] [PULL 09/40] docs: fix invalid node name in qmp event, Kevin Wolf, 2016/03/14
- [Qemu-devel] [PULL 11/40] quorum: modify vote rules for flush operation,
Kevin Wolf <=
- [Qemu-devel] [PULL 06/40] block/vpc: tests for auto-detecting VPC and Hyper-V VHD images, Kevin Wolf, 2016/03/14
- [Qemu-devel] [PULL 10/40] qmp event: Refactor QUORUM_REPORT_BAD, Kevin Wolf, 2016/03/14
- [Qemu-devel] [PULL 08/40] block/vpc: add tests for image creation force_size parameter, Kevin Wolf, 2016/03/14
- [Qemu-devel] [PULL 07/40] block/vpc: give option to force the current_size field in .bdrv_create, Kevin Wolf, 2016/03/14
- [Qemu-devel] [PULL 12/40] blockdev: Snapshotting must not open second instance of old top, Kevin Wolf, 2016/03/14
- [Qemu-devel] [PULL 15/40] vmdk: Switch to heap arrays for vmdk_write_cid, Kevin Wolf, 2016/03/14
- [Qemu-devel] [PULL 13/40] block: Fix snapshot=on cache modes, Kevin Wolf, 2016/03/14
- [Qemu-devel] [PULL 14/40] block: Fix cache mode defaults in bds_tree_init(), Kevin Wolf, 2016/03/14
- [Qemu-devel] [PULL 16/40] vmdk: Switch to heap arrays for vmdk_read_cid, Kevin Wolf, 2016/03/14
- [Qemu-devel] [PULL 17/40] vmdk: Switch to heap arrays for vmdk_parent_open, Kevin Wolf, 2016/03/14