Commit 8d9387d1 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] md: Always allow a half-built md array to be stopped.

When starting an array fails, we have to tear it down, but
in some circumstances (particularly autostart_array) the
reference count will be 3, so do_md_stop will fail.

With this patch we only worry about the number of users
is the array has been fully started.
parent 26502e95
......@@ -1669,13 +1669,12 @@ static int do_md_stop(mddev_t * mddev, int ro)
int err = 0;
struct gendisk *disk = disks[mdidx(mddev)];
if (atomic_read(&mddev->active)>2) {
printk("md: md%d still in use.\n",mdidx(mddev));
err = -EBUSY;
goto out;
}
if (mddev->pers) {
if (atomic_read(&mddev->active)>2) {
printk("md: md%d still in use.\n",mdidx(mddev));
return -EBUSY;
}
if (mddev->sync_thread) {
set_bit(MD_RECOVERY_INTR, &mddev->recovery);
md_unregister_thread(mddev->sync_thread);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment