mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 16:37:50 +00:00
Don't unconditionally set in_sync on newly added device in raid5_reshape
When a reshape finds that it can add spare devices into the array, those devices might already be 'in_sync' if they are beyond the old size of the array, or they might not if they are within the array. The first case happens when we change an N-drive RAID5 to an N+1-drive RAID5. The second happens when we convert an N-drive RAID5 to an N+1-drive RAID6. So set the flag more carefully. Also, ->recovery_offset is only meaningful when the flag is clear, so only set it in that case. This change needs the preceding two to ensure that the non-in_sync device doesn't get evicted from the array when it is stopped, in the case where v0.90 metadata is used. Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
0261cd9f1c
commit
7ef90146a1
1 changed files with 4 additions and 2 deletions
|
@ -5361,9 +5361,11 @@ static int raid5_start_reshape(mddev_t *mddev)
|
||||||
!test_bit(Faulty, &rdev->flags)) {
|
!test_bit(Faulty, &rdev->flags)) {
|
||||||
if (raid5_add_disk(mddev, rdev) == 0) {
|
if (raid5_add_disk(mddev, rdev) == 0) {
|
||||||
char nm[20];
|
char nm[20];
|
||||||
set_bit(In_sync, &rdev->flags);
|
if (rdev->raid_disk >= conf->previous_raid_disks)
|
||||||
|
set_bit(In_sync, &rdev->flags);
|
||||||
|
else
|
||||||
|
rdev->recovery_offset = 0;
|
||||||
added_devices++;
|
added_devices++;
|
||||||
rdev->recovery_offset = 0;
|
|
||||||
sprintf(nm, "rd%d", rdev->raid_disk);
|
sprintf(nm, "rd%d", rdev->raid_disk);
|
||||||
if (sysfs_create_link(&mddev->kobj,
|
if (sysfs_create_link(&mddev->kobj,
|
||||||
&rdev->kobj, nm))
|
&rdev->kobj, nm))
|
||||||
|
|
Loading…
Reference in a new issue