aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2011-05-11 00:26:20 -0400
committerNeilBrown <neilb@suse.de>2011-05-11 00:26:20 -0400
commitbedd86b7773fd97f0d708cc0c371c8963ba7ba9a (patch)
treeacc508209cdc418fcfe9a1493915dfa88c22bc29 /drivers
parentb0140891a8cea36469f58d23859e599b1122bd37 (diff)
md: reject a re-add request that cannot be honoured.
The 'add_new_disk' ioctl can be used to add a device either as a spare, or as an active disk that just needs to be resynced based on write-intent-bitmap information (re-add) Currently if a re-add is requested but fails we add as a spare instead. This makes it impossible for user-space to check for failure. So change to require that a re-add attempt will either succeed or completely fail. User-space can then decide what to do next. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/md.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 4a4c0f80bdeb..5469ae35ee15 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5216,6 +5216,16 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info)
5216 } else 5216 } else
5217 super_types[mddev->major_version]. 5217 super_types[mddev->major_version].
5218 validate_super(mddev, rdev); 5218 validate_super(mddev, rdev);
5219 if ((info->state & (1<<MD_DISK_SYNC)) &&
5220 (!test_bit(In_sync, &rdev->flags) ||
5221 rdev->raid_disk != info->raid_disk)) {
5222 /* This was a hot-add request, but events doesn't
5223 * match, so reject it.
5224 */
5225 export_rdev(rdev);
5226 return -EINVAL;
5227 }
5228
5219 if (test_bit(In_sync, &rdev->flags)) 5229 if (test_bit(In_sync, &rdev->flags))
5220 rdev->saved_raid_disk = rdev->raid_disk; 5230 rdev->saved_raid_disk = rdev->raid_disk;
5221 else 5231 else