From: Guoqing Jiang Date: Thu, 6 Apr 2017 01:12:18 +0000 (+0800) Subject: md/raid10: reset the 'first' at the end of loop X-Git-Tag: v4.9.93~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4e4321c232c75230bd1579eba6c5b3f54571328d;p=platform%2Fkernel%2Flinux-amlogic.git md/raid10: reset the 'first' at the end of loop commit 6f287ca6046edd34ed83aafb7f9033c9c2e809e2 upstream. We need to set "first = 0' at the end of rdev_for_each loop, so we can get the array's min_offset_diff correctly otherwise min_offset_diff just means the last rdev's offset diff. [only the first chunk, due to b506335e5d2b ("md/raid10: skip spare disk as 'first' disk") being already applied - gregkh] Suggested-by: NeilBrown Signed-off-by: Guoqing Jiang Reviewed-by: NeilBrown Signed-off-by: Shaohua Li Cc: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 18a4271..6a7b9b1 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -3681,6 +3681,7 @@ static int raid10_run(struct mddev *mddev) if (blk_queue_discard(bdev_get_queue(rdev->bdev))) discard_supported = true; + first = 0; } if (mddev->queue) {