Re: kernel BUG at include/linux/dcache.h:271!

Maneesh Soni (maneesh@in.ibm.com)
Fri, 23 May 2003 18:13:24 +0530


On Fri, May 23, 2003 at 08:25:08AM +0200, Jens Axboe wrote:
> On Thu, May 22 2003, Andrew Morton wrote:
> > Maneesh Soni <maneesh@in.ibm.com> wrote:
> > >
> > > ramdisk
> > > - should have separate queues on for each ramdisk
> > >
> > > elevator
> > > - should not re-register already registered queue in elv_register_queue
> > >
> > > sysfs
> > > - should handle kobject with multiple parent kobjects
> >
> > I can't think of anywhere else where we are likely to want to support
> > multiple devices from a single queue in this manner, so perhaps the best
> > solution is to remove the exceptional case: allocate a separate queue for
> > each ramdisk instance.
> >
> > Jens, do you agree?
>
> Completely and utterly agree :)
>
> --
> Jens Axboe

Hi,

The following patch provides a separate queue for each ramdisk instance
and the BUG is not seen now.

Please check whether it is ok or not.

Thanks,
Maneesh

drivers/block/rd.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)

diff -puN drivers/block/rd.c~multiqueue_ramdisk drivers/block/rd.c
--- linux-2.5.69/drivers/block/rd.c~multiqueue_ramdisk 2003-05-23 16:04:38.000000000 +0530
+++ linux-2.5.69-maneesh/drivers/block/rd.c 2003-05-23 17:45:24.000000000 +0530
@@ -67,6 +67,7 @@

static struct gendisk *rd_disks[NUM_RAMDISKS];
static struct block_device *rd_bdev[NUM_RAMDISKS];/* Protected device data */
+static struct request_queue *rd_queue;

/*
* Parameters for the boot-loading of the RAM disk. These are set by
@@ -308,12 +309,11 @@ static void __exit rd_cleanup (void)
del_gendisk(rd_disks[i]);
put_disk(rd_disks[i]);
}
-
+ kfree(rd_queue);
devfs_remove("rd");
unregister_blkdev(RAMDISK_MAJOR, "ramdisk" );
}

-static struct request_queue rd_queue;
/* This is the registration and initialization section of the RAM disk driver */
static int __init rd_init (void)
{
@@ -333,23 +333,28 @@ static int __init rd_init (void)
goto out;
}

+ rd_queue = kmalloc(NUM_RAMDISKS * sizeof(struct request_queue),
+ GFP_KERNEL);
+ if (!rd_queue)
+ goto out;
+
if (register_blkdev(RAMDISK_MAJOR, "ramdisk")) {
err = -EIO;
- goto out;
+ goto out_queue;
}

- blk_queue_make_request(&rd_queue, &rd_make_request);
-
devfs_mk_dir("rd");

for (i = 0; i < NUM_RAMDISKS; i++) {
struct gendisk *disk = rd_disks[i];

+ blk_queue_make_request(&rd_queue[i], &rd_make_request);
+
/* rd_size is given in kB */
disk->major = RAMDISK_MAJOR;
disk->first_minor = i;
disk->fops = &rd_bd_op;
- disk->queue = &rd_queue;
+ disk->queue = &rd_queue[i];
sprintf(disk->disk_name, "ram%d", i);
sprintf(disk->devfs_name, "rd/%d", i);
set_capacity(disk, rd_size * 2);
@@ -362,6 +367,8 @@ static int __init rd_init (void)
NUM_RAMDISKS, rd_size, rd_blocksize);

return 0;
+out_queue:
+ kfree(rd_queue);
out:
while (i--)
put_disk(rd_disks[i]);

_


-- 
Maneesh Soni
IBM Linux Technology Center, 
IBM India Software Lab, Bangalore.
Phone: +91-80-5044999 email: maneesh@in.ibm.com
http://lse.sourceforge.net/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/