mirror of
https://github.com/torvalds/linux.git
synced 2024-11-16 00:52:01 +00:00
Fix remove_and_add_spares removes drive added as spare in slot_store
Commit2910ff17d1
introduced a regression which would remove a recently added spare via slot_store. Revert part of the patch which touches slot_store() and add the disk directly using pers->hot_add_disk() Fixes:2910ff17d1
("md: remove_and_add_spares() to activate specific rdev") Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com> Signed-off-by: NeilBrown <neilb@suse.com>
This commit is contained in:
parent
0dc10e50f2
commit
cb01c5496d
@ -2774,6 +2774,7 @@ slot_store(struct md_rdev *rdev, const char *buf, size_t len)
|
||||
/* Activating a spare .. or possibly reactivating
|
||||
* if we ever get bitmaps working here.
|
||||
*/
|
||||
int err;
|
||||
|
||||
if (rdev->raid_disk != -1)
|
||||
return -EBUSY;
|
||||
@ -2795,9 +2796,15 @@ slot_store(struct md_rdev *rdev, const char *buf, size_t len)
|
||||
rdev->saved_raid_disk = -1;
|
||||
clear_bit(In_sync, &rdev->flags);
|
||||
clear_bit(Bitmap_sync, &rdev->flags);
|
||||
remove_and_add_spares(rdev->mddev, rdev);
|
||||
if (rdev->raid_disk == -1)
|
||||
return -EBUSY;
|
||||
err = rdev->mddev->pers->
|
||||
hot_add_disk(rdev->mddev, rdev);
|
||||
if (err) {
|
||||
rdev->raid_disk = -1;
|
||||
return err;
|
||||
} else
|
||||
sysfs_notify_dirent_safe(rdev->sysfs_state);
|
||||
if (sysfs_link_rdev(rdev->mddev, rdev))
|
||||
/* failure here is OK */;
|
||||
/* don't wakeup anyone, leave that to userspace. */
|
||||
} else {
|
||||
if (slot >= rdev->mddev->raid_disks &&
|
||||
|
Loading…
Reference in New Issue
Block a user