Commit 528ed1e3 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] md: Don't setup make_request_fn for md array until *after* it has been started

Also revert to md_fail_request before stopping an array.

The ->stop method can never fail, so there is not point checking it.
parent 93e76fbc
...@@ -1607,9 +1607,6 @@ static int do_md_run(mddev_t * mddev) ...@@ -1607,9 +1607,6 @@ static int do_md_run(mddev_t * mddev)
mddev->pers = pers[pnum]; mddev->pers = pers[pnum];
spin_unlock(&pers_lock); spin_unlock(&pers_lock);
blk_queue_make_request(mddev->queue, mddev->pers->make_request);
mddev->queue->queuedata = mddev;
err = mddev->pers->run(mddev); err = mddev->pers->run(mddev);
if (err) { if (err) {
printk(KERN_ERR "md: pers->run() failed ...\n"); printk(KERN_ERR "md: pers->run() failed ...\n");
...@@ -1627,6 +1624,10 @@ static int do_md_run(mddev_t * mddev) ...@@ -1627,6 +1624,10 @@ static int do_md_run(mddev_t * mddev)
set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
md_wakeup_thread(mddev->thread); md_wakeup_thread(mddev->thread);
set_capacity(disk, mddev->array_size<<1); set_capacity(disk, mddev->array_size<<1);
blk_queue_make_request(mddev->queue, mddev->pers->make_request);
mddev->queue->queuedata = mddev;
return 0; return 0;
} }
...@@ -1698,12 +1699,8 @@ static int do_md_stop(mddev_t * mddev, int ro) ...@@ -1698,12 +1699,8 @@ static int do_md_stop(mddev_t * mddev, int ro)
} else { } else {
if (mddev->ro) if (mddev->ro)
set_disk_ro(disk, 0); set_disk_ro(disk, 0);
if (mddev->pers->stop(mddev)) { blk_queue_make_request(mddev->queue, md_fail_request);
err = -EBUSY; mddev->pers->stop(mddev);
if (mddev->ro)
set_disk_ro(disk, 1);
goto out;
}
module_put(mddev->pers->owner); module_put(mddev->pers->owner);
mddev->pers = NULL; mddev->pers = NULL;
if (mddev->ro) if (mddev->ro)
......
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