Skip to content

Commit

Permalink
md: Fix skipping recovery for read-only arrays.
Browse files Browse the repository at this point in the history
Since:
        commit 7ceb17e
        md: Allow devices to be re-added to a read-only array.

spares are activated on a read-only array. In case of raid1 and raid10
personalities it causes that not-in-sync devices are marked in-sync
without checking if recovery has been finished.

If a read-only array is degraded and one of its devices is not in-sync
(because the array has been only partially recovered) recovery will be skipped.

This patch adds checking if recovery has been finished before marking a device
in-sync for raid1 and raid10 personalities. In case of raid5 personality
such condition is already present (at raid5.c:6029).

Bug was introduced in 3.10 and causes data corruption.

Cc: [email protected]
Signed-off-by: Pawel Baldysiak <[email protected]>
Signed-off-by: Lukasz Dorau <[email protected]>
Signed-off-by: NeilBrown <[email protected]>
  • Loading branch information
ldorau authored and neilbrown committed Oct 24, 2013
1 parent 320437a commit 61e4947
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/md/raid1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,7 @@ static int raid1_spare_active(struct mddev *mddev)
}
}
if (rdev
&& rdev->recovery_offset == MaxSector
&& !test_bit(Faulty, &rdev->flags)
&& !test_and_set_bit(In_sync, &rdev->flags)) {
count++;
Expand Down
1 change: 1 addition & 0 deletions drivers/md/raid10.c
Original file line number Diff line number Diff line change
Expand Up @@ -1782,6 +1782,7 @@ static int raid10_spare_active(struct mddev *mddev)
}
sysfs_notify_dirent_safe(tmp->replacement->sysfs_state);
} else if (tmp->rdev
&& tmp->rdev->recovery_offset == MaxSector
&& !test_bit(Faulty, &tmp->rdev->flags)
&& !test_and_set_bit(In_sync, &tmp->rdev->flags)) {
count++;
Expand Down

0 comments on commit 61e4947

Please sign in to comment.