summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2016-06-02 16:19:52 +1000
committerShaohua Li <shli@fb.com>2016-06-13 11:54:12 -0700
commit8430e7e0af9a15063b90343e3beebc164c8e90f3 (patch)
tree4facf6ea5e596b014ceff1792de6006b3cb6bb27 /drivers/md
parent7ac504472263180745ac94242f1d253eb7284e48 (diff)
downloadop-kernel-dev-8430e7e0af9a15063b90343e3beebc164c8e90f3.zip
op-kernel-dev-8430e7e0af9a15063b90343e3beebc164c8e90f3.tar.gz
md: disconnect device from personality before trying to remove it.
When the HOT_REMOVE_DISK ioctl is used to remove a device, we call remove_and_add_spares() which will remove it from the personality if possible. This improves the chances that the removal will succeed. When writing "remove" to dev-XX/state, we don't. So that can fail more easily. So add the remove_and_add_spares() into "remove" handling. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index d0c1e79..0793754 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2595,6 +2595,8 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len)
else
err = -EBUSY;
} else if (cmd_match(buf, "remove")) {
+ clear_bit(Blocked, &rdev->flags);
+ remove_and_add_spares(rdev->mddev, rdev);
if (rdev->raid_disk >= 0)
err = -EBUSY;
else {
OpenPOWER on IntegriCloud