]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] Fix up initialisation of md devices
authorNeil Brown <neilb@cse.unsw.edu.au>
Thu, 25 Sep 2003 14:33:45 +0000 (07:33 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Thu, 25 Sep 2003 14:33:45 +0000 (07:33 -0700)
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.

drivers/md/md.c

index 9e67989ceebe8633eed808a417687cf9c84b1524..4ccff7e03c4b975441fb61e66c8f4b461a894e7c 100644 (file)
@@ -1627,8 +1627,15 @@ static int do_md_run(mddev_t * mddev)
        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;
 }