summaryrefslogtreecommitdiffstats
path: root/Manage.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2008-09-15 20:58:42 -0700
committerDan Williams <dan.j.williams@intel.com>2008-09-15 20:58:42 -0700
commitc94709e83f662c4780aa9c6917b03c774747eca5 (patch)
tree46d8a1c6e4ecd5dbca24d092af28910f92b01547 /Manage.c
parent0c0c44db5ae98452c9c69bffc35b031c9fd7acea (diff)
downloadmdadm-c94709e83f662c4780aa9c6917b03c774747eca5.tar.gz
mdadm-c94709e83f662c4780aa9c6917b03c774747eca5.tar.xz
mdadm-c94709e83f662c4780aa9c6917b03c774747eca5.zip
Add ping_monitor() to mdadm --wait
The action we are waiting for may not be complete until the monitor has had a chance to take action on the result. The following script can now remove the device on the first attempt, versus a few attempts with the original Wait(): #!/bin/bash #export MDADM_NO_MDMON=1 export IMSM_DEVNAME_AS_SERIAL=1 ./mdadm -Ss ./mdadm --zero-superblock /dev/loop[0-3] echo 2 > /proc/sys/dev/raid/speed_limit_max ./mdadm --create /dev/imsm /dev/loop[0-3] -n 4 -e imsm -a md ./mdadm --create /dev/md/r1 /dev/loop[0-3] -n 4 -l 5 --force -a mdp ./mdadm --fail /dev/md/r1 /dev/loop3 ./mdadm --wait /dev/md/r1 x=0 while ! ./mdadm --remove /dev/imsm /dev/loop3 > /dev/null 2>&1 do x=$((x+1)) done echo "removed after $x attempts" ./mdadm --add /dev/imsm /dev/loop3 Include 2 small cleanups: * remove the almost open coded fd2devnum() in Wait() by introducing a new utility routine stat2devnum() * teach connect_monitor() to parse the container device from a subarray string Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'Manage.c')
-rw-r--r--Manage.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/Manage.c b/Manage.c
index 56bc2c3..76447ed 100644
--- a/Manage.c
+++ b/Manage.c
@@ -167,8 +167,6 @@ int Manage_runstop(char *devname, int fd, int runstop, int quiet)
if (mdi &&
mdi->array.level > 0 &&
is_subarray(mdi->text_version)) {
- char *cp;
-
/* This is mdmon managed. */
close(fd);
if (sysfs_set_str(mdi, NULL,
@@ -181,10 +179,7 @@ int Manage_runstop(char *devname, int fd, int runstop, int quiet)
}
/* Give monitor a chance to act */
- cp = strchr(mdi->text_version+1, '/');
- if (*cp)
- *cp = 0;
- ping_monitor(mdi->text_version+1);
+ ping_monitor(mdi->text_version);
fd = open(devname, O_RDONLY);
} else if (mdi &&