mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-19 07:27:50 +00:00
md/raid5: allow removal for failed replacement devices.
Enhance raid5_remove_disk to be able to remove ->replacement as well as ->rdev. Reviewed-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
14a75d3e07
commit
657e3e4d88
@ -5086,36 +5086,42 @@ static int raid5_remove_disk(struct mddev *mddev, struct md_rdev *rdev)
|
|||||||
struct r5conf *conf = mddev->private;
|
struct r5conf *conf = mddev->private;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
int number = rdev->raid_disk;
|
int number = rdev->raid_disk;
|
||||||
|
struct md_rdev **rdevp;
|
||||||
struct disk_info *p = conf->disks + number;
|
struct disk_info *p = conf->disks + number;
|
||||||
|
|
||||||
print_raid5_conf(conf);
|
print_raid5_conf(conf);
|
||||||
if (rdev == p->rdev) {
|
if (rdev == p->rdev)
|
||||||
if (number >= conf->raid_disks &&
|
rdevp = &p->rdev;
|
||||||
conf->reshape_progress == MaxSector)
|
else if (rdev == p->replacement)
|
||||||
clear_bit(In_sync, &rdev->flags);
|
rdevp = &p->replacement;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (test_bit(In_sync, &rdev->flags) ||
|
if (number >= conf->raid_disks &&
|
||||||
atomic_read(&rdev->nr_pending)) {
|
conf->reshape_progress == MaxSector)
|
||||||
err = -EBUSY;
|
clear_bit(In_sync, &rdev->flags);
|
||||||
goto abort;
|
|
||||||
}
|
if (test_bit(In_sync, &rdev->flags) ||
|
||||||
/* Only remove non-faulty devices if recovery
|
atomic_read(&rdev->nr_pending)) {
|
||||||
* isn't possible.
|
err = -EBUSY;
|
||||||
*/
|
goto abort;
|
||||||
if (!test_bit(Faulty, &rdev->flags) &&
|
}
|
||||||
mddev->recovery_disabled != conf->recovery_disabled &&
|
/* Only remove non-faulty devices if recovery
|
||||||
!has_failed(conf) &&
|
* isn't possible.
|
||||||
number < conf->raid_disks) {
|
*/
|
||||||
err = -EBUSY;
|
if (!test_bit(Faulty, &rdev->flags) &&
|
||||||
goto abort;
|
mddev->recovery_disabled != conf->recovery_disabled &&
|
||||||
}
|
!has_failed(conf) &&
|
||||||
p->rdev = NULL;
|
number < conf->raid_disks) {
|
||||||
synchronize_rcu();
|
err = -EBUSY;
|
||||||
if (atomic_read(&rdev->nr_pending)) {
|
goto abort;
|
||||||
/* lost the race, try later */
|
}
|
||||||
err = -EBUSY;
|
*rdevp = NULL;
|
||||||
p->rdev = rdev;
|
synchronize_rcu();
|
||||||
}
|
if (atomic_read(&rdev->nr_pending)) {
|
||||||
|
/* lost the race, try later */
|
||||||
|
err = -EBUSY;
|
||||||
|
*rdevp = rdev;
|
||||||
}
|
}
|
||||||
abort:
|
abort:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user