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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 8 Apr 2018 10:12:59 +0000 (12:12 +0200)
commit4e4321c232c75230bd1579eba6c5b3f54571328d
treedccf97ad7135f2c62aa72b8d333c880ce000e164
parentafda607daa76f3991ca256b9e10ee4a3727ca8cd
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 <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>
Cc: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/raid10.c