On 06/01/2017 11:47 AM, Xiao Ni wrote:
Hi all I tried with the latest linux stable kernel and latest mdadm. After stopping a raid device, the dev node directory can't be released at once. I did a simple test, the script is: #!/bin/sh while [ 1 ]; do mdadm -CR /dev/md0 -l1 -n2 /dev/loop0 /dev/loop1 sleep 5 mdadm -S /dev/md0 ls /dev/md0 sleep 1 ls /dev/md0 done mdadm: stopped /dev/md0 /dev/md0 ls: cannot access /dev/md0: No such file or directory It usually detects dev node /dev/md0 isn't released after stopping raid. I'm not sure whether it's a bug or not. Do we need to do some job to make sure that the node should be released before command mdadm -S return?
it's waiting for processing the udev events. we can monitor it via to "# udevadm monitor".
For mdadm -S /dev/md0, Manage_stop() has already did the errno checking, cut piece of code from Manage.c .. .. .. .. done: /* As we have an O_EXCL open, any use of the device * which blocks STOP_ARRAY is probably a transient use, * so it is reasonable to retry for a while - 5 seconds. */ count = 25; err = 0; while (count && fd >= 0 && (err = ioctl(fd, STOP_ARRAY, NULL)) < 0 && errno == EBUSY) { usleep(200000); count --; } Best regards, -Zhilong
Best Regards Xiao -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
-- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html