Skip to contentSkip to conversation

Patch "md:raid1: fix a dead loop when read from a WriteMostly disk" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Apr 30, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

md:raid1: fix a dead loop when read from a WriteMostly disk

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
md-raid1-fix-a-dead-loop-when-read-from-a-writemostly-disk.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 816b0acf3deb6d6be5d0519b286fdd4bafade905 Mon Sep 17 00:00:00 2001

From: Wei Fang <[email protected]>
Date: Mon, 21 Mar 2016 19:18:32 +0800
Subject: md:raid1: fix a dead loop when read from a WriteMostly disk

From: Wei Fang <[email protected]>

commit 816b0acf3deb6d6be5d0519b286fdd4bafade905 upstream.

If first_bad == this_sector when we get the WriteMostly disk in read_balance(), valid disk will be returned with zero max_sectors. It'll lead to a dead loop in make_request(), and OOM will happen because of endless allocation of struct bio.

Since we can't get data from this disk in this case, so continue for another disk.

---
 drivers/md/raid1.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid1.c +1 -1
@@ -570,7 +570,7 @@ static int read_balance(struct r1conf *c
 			if (best_dist_disk < 0) {
 				if (is_badblock(rdev, this_sector, sectors,
 						&first_bad, &bad_sectors)) {
-					if (first_bad < this_sector)
+					if (first_bad <= this_sector)
 						/* Cannot use this */
 						continue;
 					best_good_sectors = first_bad - this_sector;

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/md-raid1-fix-a-dead-loop-when-read-from-a-writemostly-disk.patch