md/raid10: skip spare disk as 'first' disk
authorShaohua Li <shli@fb.com>
Mon, 1 May 2017 19:15:07 +0000 (12:15 -0700)
committerShaohua Li <shli@fb.com>
Mon, 1 May 2017 19:24:10 +0000 (12:24 -0700)
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@suse.com>
Cc: NeilBrown <neilb@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
drivers/md/raid10.c

index 2883b720a265d86aa8fe0474e48e07acec42389d..cce23be9cc930c4fb8683e046d4df50eaacd9d28 100644 (file)
@@ -4079,8 +4079,8 @@ static int raid10_start_reshape(struct mddev *mddev)
                                diff = 0;
                        if (first || diff < min_offset_diff)
                                min_offset_diff = diff;
+                       first = 0;
                }
-               first = 0;
        }
 
        if (max(before_length, after_length) > min_offset_diff)