Commit 97ec3212 authored by NeilBrown's avatar NeilBrown Committed by Greg Kroah-Hartman

md/raid5: Fix livelock when array is both resyncing and degraded.

commit 26ac1073 upstream.

Commit a7854487:
  md: When RAID5 is dirty, force reconstruct-write instead of read-modify-write.

Causes an RCW cycle to be forced even when the array is degraded.
A degraded array cannot support RCW as that requires reading all data
blocks, and one may be missing.

Forcing an RCW when it is not possible causes a live-lock and the code
spins, repeatedly deciding to do something that cannot succeed.

So change the condition to only force RCW on non-degraded arrays.
Reported-by: default avatarManibalan P <pmanibalan@amiindia.co.in>
Bisected-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Tested-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
Fixes: a7854487Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1a15e64c
...@@ -3102,7 +3102,8 @@ static void handle_stripe_dirtying(struct r5conf *conf, ...@@ -3102,7 +3102,8 @@ static void handle_stripe_dirtying(struct r5conf *conf,
* generate correct data from the parity. * generate correct data from the parity.
*/ */
if (conf->max_degraded == 2 || if (conf->max_degraded == 2 ||
(recovery_cp < MaxSector && sh->sector >= recovery_cp)) { (recovery_cp < MaxSector && sh->sector >= recovery_cp &&
s->failed == 0)) {
/* Calculate the real rcw later - for now make it /* Calculate the real rcw later - for now make it
* look like rcw is cheaper * look like rcw is cheaper
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment