[PATCH AUTOSEL for 4.9 133/190] md/raid10: skip spare disk as 'first' disk

From: Sasha Levin
Date: Thu Mar 08 2018 - 00:03:27 EST


From: Shaohua Li <shli@xxxxxx>

[ Upstream commit b506335e5d2b4ec687dde392a3bdbf7601778f1d ]

Commit 6f287ca(md/raid10: reset the 'first' at the end of loop) ignores
a case in reshape, the first rdev could be a spare disk, which shouldn't
be accounted as the first disk since it doesn't include the offset info.

Fix: 6f287ca(md/raid10: reset the 'first' at the end of loop)
Cc: Guoqing Jiang <gqjiang@xxxxxxxx>
Cc: NeilBrown <neilb@xxxxxxxx>
Signed-off-by: Shaohua Li <shli@xxxxxx>
Signed-off-by: Sasha Levin <alexander.levin@xxxxxxxxxxxxx>
---
drivers/md/raid10.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index b1daff78f7b2..18a4271bf569 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -4089,6 +4089,7 @@ static int raid10_start_reshape(struct mddev *mddev)
diff = 0;
if (first || diff < min_offset_diff)
min_offset_diff = diff;
+ first = 0;
}
}

--
2.14.1