Commit e9b22b65 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] Fix up initialisation of md devices

Previously, we called blk_queue_make_request(q,mddev->pers->make_request)
*before* calling mddev->pers->run(), but this left a hole in which the
device could be accessed before it was initialised.

So we moved blk_queue_make_request to *after* ->pers->run(), but now some
of the initialisation done in ->run is over-written by blk_queue_make_request(), 
particularly limits like ->max_sectors.

So now, we just open-code the one line of blk_queue_make_request that we
need at this point.

All the rest has been done by a separate called to blk_queue_make_request, 
either when the mddev was first allocated, or when a previous incarnation
of the device was stopped.

This fixes "bio too big" error that occured due to max_sectors being too large.
parent 662c8869
...@@ -1627,8 +1627,15 @@ static int do_md_run(mddev_t * mddev) ...@@ -1627,8 +1627,15 @@ static int do_md_run(mddev_t * mddev)
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); /* If we call blk_queue_make_request here, it will
* re-initialise max_sectors etc which may have been
* refined inside -> run. So just set the bits we need to set.
* Most initialisation happended when we called
* blk_queue_make_request(..., md_fail_request)
* earlier.
*/
mddev->queue->queuedata = mddev; mddev->queue->queuedata = mddev;
mddev->queue->make_request_fn = mddev->pers->make_request;
return 0; return 0;
} }
......
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