summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2011-02-02 01:57:13 +0100
committerNeilBrown <neilb@suse.de>2011-02-02 01:57:13 +0100
commitc6751b2bde477f56ceef67aa1d298ce44e8e2e23 (patch)
tree59916ec74802396ec4b3f871d27232550848bc8c /drivers/md
parentmd: don't clear curr_resync_completed at end of resync. (diff)
downloadlinux-c6751b2bde477f56ceef67aa1d298ce44e8e2e23.tar.xz
linux-c6751b2bde477f56ceef67aa1d298ce44e8e2e23.zip
md: Don't allow slot_store while resync/recovery is happening.
Activating a spare in an array while resync/recovery is already happening can lead the that spare being marked in-sync when it isn't really. So don't allow the 'slot' to be set (this activating the device) while resync/recovery is happening. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index f2d5628d51cb..1138d1053e9a 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2463,6 +2463,9 @@ slot_store(mdk_rdev_t *rdev, const char *buf, size_t len)
if (rdev->raid_disk != -1)
return -EBUSY;
+ if (test_bit(MD_RECOVERY_RUNNING, &rdev->mddev->recovery))
+ return -EBUSY;
+
if (rdev->mddev->pers->hot_add_disk == NULL)
return -EINVAL;