diff options
author | Neil Brown <neilb@suse.de> | 2008-07-12 20:27:40 +1000 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2008-07-12 20:27:40 +1000 |
commit | f94d52f43ea70665f0293de0fe8940d64931e893 (patch) | |
tree | 935d0b7e1ace033e64d2f276175e15373268a5fc /monitor.c | |
parent | d4da74fc9c5b9f63bb6e4c8e00d1d871ea7174a3 (diff) | |
download | mdadm-f94d52f43ea70665f0293de0fe8940d64931e893.tar.gz mdadm-f94d52f43ea70665f0293de0fe8940d64931e893.tar.xz mdadm-f94d52f43ea70665f0293de0fe8940d64931e893.zip |
Handle device removal from container
This really should be done in mdadm, not mdmon.
We ensure the device won't be suddenly commited as a hot-spare
using O_EXCL, then check the 'holders' sysfs directory
to make sure it is only in use once.
Diffstat (limited to 'monitor.c')
-rw-r--r-- | monitor.c | 43 |
1 files changed, 0 insertions, 43 deletions
@@ -367,54 +367,11 @@ static void reconcile_failed(struct active_array *aa, struct mdinfo *failed) } } -static int handle_remove_device(struct md_remove_device_cmd *cmd, struct active_array *aa) -{ - struct active_array *a; - struct mdinfo *victim; - int rv; - - /* scan all arrays for the given device, if ->state_fd is closed (-1) - * in all cases then mark the disk as removed in the metadata. - * Otherwise reply that it is busy. - */ - - /* pass1 check that it is not in use anywhere */ - /* note: we are safe from re-adds as long as the device exists in the - * container - */ - for (a = aa; a; a = a->next) { - if (!a->container) - continue; - victim = find_device(a, major(cmd->rdev), minor(cmd->rdev)); - if (!victim) - continue; - if (victim->state_fd > 0) - return -EBUSY; - } - - /* pass2 schedule and process removal per array */ - for (a = aa; a; a = a->next) { - if (!a->container) - continue; - victim = find_device(a, major(cmd->rdev), minor(cmd->rdev)); - if (!victim) - continue; - victim->curr_state |= DS_REMOVE; - rv = read_and_act(a); - if (rv < 0) - return rv; - } - - return 0; -} - static int handle_pipe(struct md_generic_cmd *cmd, struct active_array *aa) { switch (cmd->action) { case md_action_ping_monitor: return 0; - case md_action_remove_device: - return handle_remove_device((void *) cmd, aa); } return -1; |