[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 1/1] quorum: Change vote rules for 64 bits hash
From: |
Changlong Xie |
Subject: |
[Qemu-devel] [PATCH v2 1/1] quorum: Change vote rules for 64 bits hash |
Date: |
Tue, 16 Feb 2016 10:15:44 +0800 |
If quorum has two children(A, B). A do flush sucessfully, but B flush failed.
We MUST choice A as winner rather than just pick anyone of them. Otherwise
the filesystem of guest will 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 <address@hidden>
Signed-off-by: Changlong Xie <address@hidden>
---
block/quorum.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/block/quorum.c b/block/quorum.c
index 11cc60b..f094208 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -447,7 +447,8 @@ static int quorum_compute_hash(QuorumAIOCB *acb, int i,
QuorumVoteValue *hash)
return 0;
}
-static QuorumVoteVersion *quorum_get_vote_winner(QuorumVotes *votes)
+static QuorumVoteVersion *quorum_get_vote_winner(QuorumVotes *votes,
+ bool vote_error)
{
int max = 0;
QuorumVoteVersion *candidate, *winner = NULL;
@@ -456,6 +457,12 @@ static QuorumVoteVersion
*quorum_get_vote_winner(QuorumVotes *votes)
if (candidate->vote_count > max) {
max = candidate->vote_count;
winner = candidate;
+ continue;
+ }
+ /* For 64 bit hash */
+ if (vote_error && candidate->vote_count == max
+ && candidate->value.l == 0) {
+ winner = candidate;
}
}
@@ -545,7 +552,7 @@ static int quorum_vote_error(QuorumAIOCB *acb)
}
if (error) {
- winner = quorum_get_vote_winner(&error_votes);
+ winner = quorum_get_vote_winner(&error_votes, false);
ret = winner->value.l;
}
@@ -610,7 +617,7 @@ static bool quorum_vote(QuorumAIOCB *acb)
}
/* vote to select the most represented version */
- winner = quorum_get_vote_winner(&acb->votes);
+ winner = quorum_get_vote_winner(&acb->votes, false);
/* if the winner count is smaller than threshold the read fails */
if (winner->vote_count < s->threshold) {
@@ -770,7 +777,7 @@ static coroutine_fn int quorum_co_flush(BlockDriverState
*bs)
quorum_count_vote(&error_votes, &result_value, i);
}
- winner = quorum_get_vote_winner(&error_votes);
+ winner = quorum_get_vote_winner(&error_votes, true);
result = winner->value.l;
quorum_free_vote_list(&error_votes);
--
1.9.3
- [Qemu-devel] [PATCH v2 0/1] change quorum vote rules for 64-bits hash, Changlong Xie, 2016/02/15
- [Qemu-devel] [PATCH v2 1/1] quorum: Change vote rules for 64 bits hash,
Changlong Xie <=
- Re: [Qemu-devel] [PATCH v2 1/1] quorum: Change vote rules for 64 bits hash, Dr. David Alan Gilbert, 2016/02/18
- Re: [Qemu-devel] [PATCH v2 1/1] quorum: Change vote rules for 64 bits hash, Alberto Garcia, 2016/02/18
- Re: [Qemu-devel] [PATCH v2 1/1] quorum: Change vote rules for 64 bits hash, Wen Congyang, 2016/02/19
- Re: [Qemu-devel] [PATCH v2 1/1] quorum: Change vote rules for 64 bits hash, Alberto Garcia, 2016/02/19
- Re: [Qemu-devel] [PATCH v2 1/1] quorum: Change vote rules for 64 bits hash, Max Reitz, 2016/02/20
- Re: [Qemu-devel] [PATCH v2 1/1] quorum: Change vote rules for 64 bits hash, Changlong Xie, 2016/02/21
- Re: [Qemu-devel] [PATCH v2 1/1] quorum: Change vote rules for 64 bits hash, Dr. David Alan Gilbert, 2016/02/22
- Re: [Qemu-devel] [PATCH v2 1/1] quorum: Change vote rules for 64 bits hash, Changlong Xie, 2016/02/22
- Re: [Qemu-devel] [PATCH v2 1/1] quorum: Change vote rules for 64 bits hash, Dr. David Alan Gilbert, 2016/02/22
- Re: [Qemu-devel] [PATCH v2 1/1] quorum: Change vote rules for 64 bits hash, Kevin Wolf, 2016/02/22