]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
md/raid10: reset the 'first' at the end of loop
authorGuoqing Jiang <gqjiang@suse.com>
Thu, 6 Apr 2017 01:12:18 +0000 (09:12 +0800)
committerSasha Levin <alexander.levin@microsoft.com>
Wed, 23 May 2018 01:33:58 +0000 (21:33 -0400)
[ Upstream commit 6f287ca6046edd34ed83aafb7f9033c9c2e809e2 ]

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.

Suggested-by: NeilBrown <neilb@suse.com>
Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
Reviewed-by: NeilBrown <neilb@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
drivers/md/raid10.c

index f23f56b178019d74b55adc868b1f699169f3f0c2..641259fe891be7f4b8afde24ddb64a9e833bbdb3 100644 (file)
@@ -3702,6 +3702,7 @@ static int run(struct mddev *mddev)
 
                if (blk_queue_discard(bdev_get_queue(rdev->bdev)))
                        discard_supported = true;
+               first = 0;
        }
 
        if (mddev->queue) {