[3.13.y-ckt stable] Patch "md/raid5: Fix livelock when array is both resyncing and degraded." has been added to staging queue

Kamal Mostafa kamal at canonical.com
Tue Mar 31 18:46:37 UTC 2015

This is a note to let you know that I have just added a patch titled

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

to the linux-3.13.y-queue branch of the 3.13.y-ckt extended stable tree 
which can be found at:


This patch is scheduled to be released in version 3.13.11-ckt18.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.13.y-ckt tree, see



>From 1f4e90b1ec78ec65d94ddad5d487ac9852cfc5ea Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb at suse.de>
Date: Wed, 18 Feb 2015 11:35:14 +1100
Subject: md/raid5: Fix livelock when array is both resyncing and degraded.

commit 26ac107378c4742978216be1005b7291b799c7b2 upstream.

Commit a7854487cd7128a30a7f4f5259de9f67d5efb95f:
  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: Manibalan P <pmanibalan at amiindia.co.in>
Bisected-by: Jes Sorensen <Jes.Sorensen at redhat.com>
Tested-by: Jes Sorensen <Jes.Sorensen at redhat.com>
Signed-off-by: NeilBrown <neilb at suse.de>
Fixes: a7854487cd7128a30a7f4f5259de9f67d5efb95f
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
 drivers/md/raid5.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 3782c2f..dcdc327 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -3079,7 +3079,8 @@ static void handle_stripe_dirtying(struct r5conf *conf,
 	 * generate correct data from the parity.
 	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
 		 * look like rcw is cheaper

More information about the kernel-team mailing list