Re: Loop device bug #2

From: Andries Brouwer (aeb@veritas.com)
Date: Fri Jun 09 2000 - 03:13:25 EST


On Fri, Jun 09, 2000 at 12:26:45AM -0500, David Marshall wrote:

> Thanks for the help with the write access locking, Andries.
> It works like a charm.

Good.

> I've run into another bug, though. It occurs both in my
> crypto-enabled kernel and the pristine no-crypto mainline kernel.
>
> The loopback devices, even with the "none" transform, are hosing out
> quite horribly. After a rather trivial amount of data write activity
> across a loop device, the system locks on disk activity.

Yes, this is a well-known problem, but one I have not
looked at so far. People have advertized several things
that should help, but I have not yet spent time to see
whether I understand why this should help, and what particular
problem is fixed. So, below I am only repeating what others
have said.

Pavel Machek tells us to use a dummy plugging function:

diff -u --recursive --new-file ../linux-2.3.99p9/linux/drivers/block/loop.c ./linux/drivers/block/loop.c
--- ../linux-2.3.99p9/linux/drivers/block/loop.c Wed May 24 15:18:10 2000
+++ ./linux/drivers/block/loop.c Sat May 20 14:21:47 2000
@@ -761,6 +761,10 @@
 EXPORT_SYMBOL(loop_register_transfer);
 EXPORT_SYMBOL(loop_unregister_transfer);
 
+static void no_plug_device(void)
+{
+}
+
 int __init loop_init(void)
 {
        int i;
@@ -806,6 +810,7 @@
        }
 
        blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST);
+ ((request_queue_t *) BLK_DEFAULT_QUEUE(MAJOR_NR))->plug_device_fn = no_plug_device;
        blk_queue_headactive(BLK_DEFAULT_QUEUE(MAJOR_NR), 0);
        for (i=0; i < max_loop; i++) {
                memset(&loop_dev[i], 0, sizeof(struct loop_device));

and someone else, I forgot who, reports success with reserving
more requests:

diff -u --recursive --new-file ../linux-2.3.99p9/linux/drivers/block/ll_rw_blk.c ./linux/drivers/block/ll_rw_blk.c
--- ../linux-2.3.99p9/linux/drivers/block/ll_rw_blk.c Sat May 13 03:19:46 2000
+++ ./linux/drivers/block/ll_rw_blk.c Sun May 21 17:01:21 2000
@@ -586,7 +586,7 @@
         * Cut max_req in half to avoid running out and deadlocking.
         */
         if ((major == LOOP_MAJOR) || (major == NBD_MAJOR))
- max_req >>= 1;
+ max_req >>= 2;
 
        /*
         * Try to coalesce the new request with old requests

You may try and report on whether these things improve your situation.

Andries

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Jun 15 2000 - 21:00:17 EST