[bug tracking hint] ramdisk bug in 2.3.42

From: Daniel Marmier (daniel.marmier@lightning.ch)
Date: Wed Feb 09 2000 - 09:54:50 EST


I tried the ramdisk driver on a 2.3.42 kernel and found out that it was
still broken (it has been for some time now). I wrote a test program
that makes writes/reads/verifies on the raw /dev/ram0 device and saw
that it was OK from userspace. The problem seems to be related to the
vfs layer, as I am unable to mount a mkfs'ed ramdisk (whatever the fs
type, minix or ext2). In drivers/block/rd.c (function rd_request, line
250), I changed

        sbh = CURRENT->bh;
        rbh = get_hash_table(sbh->b_dev, sbh->b_blocknr, sbh->b_size);
        if (sbh == rbh) {
                if (CURRENT->cmd == READ)
                                memset(CURRENT->buffer, 1, len);
        } else if (rbh) {

to

        sbh = CURRENT->bh;
        rbh = get_hash_table(sbh->b_dev, sbh->b_blocknr, sbh->b_size);
        if (sbh == rbh) {
                if (CURRENT->cmd == READ) {
                                printk("1");
                                memset(CURRENT->buffer, 1, len);
                }
        } else if (rbh) {

and got the following error while mounting a minix formatted ramdisk
(note the "11") :

11VFS: Can't find a Minix or Minix V2 filesystem on device 01:01.
mount: wrong fs type, bad option, bad superblock on /dev/ram1,
       or too many mounted file systems

So I tried to change the abovementioned code to

        sbh = CURRENT->bh;
        rbh = get_hash_table(sbh->b_dev, sbh->b_blocknr, sbh->b_size);
        if (sbh == rbh) {
                if (CURRENT->cmd == READ) {
                        if (rbh)
                                memcpy(CURRENT->buffer, rbh->b_data, rbh->b_size);
                        else
                                memset(CURRENT->buffer, 1, len);
                }
        } else if (rbh) {

and now I am able to mount my ramdisk and it _apparently_ works.

IMPORTANT NOTE
--------------

I did not post this as a patch, as it is not a fix but just a hack, so
use it at your own risk !!!
I really know _nothing_ to ramdisk, VFS, the buffer cache and the page
cache. I post in the hope that it will help someone who knows these
parts of the kernel to locate the bug and fix it properly.

                                Daniel Marmier

-
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 : Tue Feb 15 2000 - 21:00:15 EST