diff options
author | Lukasz Dorau <lukasz.dorau@intel.com> | 2013-10-23 21:55:17 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2013-10-23 21:55:17 -0400 |
commit | 61e4947c99c4494336254ec540c50186d186150b (patch) | |
tree | 046af42492e82ad69c397b02dbb51ee0361022fc | |
parent | 320437af954cbe66478f1f5e8b34cb5a8d072191 (diff) |
md: Fix skipping recovery for read-only arrays.
Since:
commit 7ceb17e87bde79d285a8b988cfed9eaeebe60b86
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: stable@vger.kernel.org
Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r-- | drivers/md/raid1.c | 1 | ||||
-rw-r--r-- | drivers/md/raid10.c | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index d60412c7f995..aacf6bf352d8 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1479,6 +1479,7 @@ static int raid1_spare_active(struct mddev *mddev) | |||
1479 | } | 1479 | } |
1480 | } | 1480 | } |
1481 | if (rdev | 1481 | if (rdev |
1482 | && rdev->recovery_offset == MaxSector | ||
1482 | && !test_bit(Faulty, &rdev->flags) | 1483 | && !test_bit(Faulty, &rdev->flags) |
1483 | && !test_and_set_bit(In_sync, &rdev->flags)) { | 1484 | && !test_and_set_bit(In_sync, &rdev->flags)) { |
1484 | count++; | 1485 | count++; |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index df7b0a06b0ea..73dc8a377522 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1782,6 +1782,7 @@ static int raid10_spare_active(struct mddev *mddev) | |||
1782 | } | 1782 | } |
1783 | sysfs_notify_dirent_safe(tmp->replacement->sysfs_state); | 1783 | sysfs_notify_dirent_safe(tmp->replacement->sysfs_state); |
1784 | } else if (tmp->rdev | 1784 | } else if (tmp->rdev |
1785 | && tmp->rdev->recovery_offset == MaxSector | ||
1785 | && !test_bit(Faulty, &tmp->rdev->flags) | 1786 | && !test_bit(Faulty, &tmp->rdev->flags) |
1786 | && !test_and_set_bit(In_sync, &tmp->rdev->flags)) { | 1787 | && !test_and_set_bit(In_sync, &tmp->rdev->flags)) { |
1787 | count++; | 1788 | count++; |