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.
md_wakeup_thread(mddev->thread);
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->make_request_fn = mddev->pers->make_request;
return 0;
}