Re: 2.1.50 and initrd

Florian La Roche (florian@knorke.saar.de)
Sat, 16 Aug 1997 10:16:55 +0200


On Fri, Aug 15, 1997 at 10:29:44PM -0400, Bill Hawes wrote:
> Florian La Roche wrote:
> >
> > I have my scsi-module loaded from initrd. With 2.1.50, this currently
> > does not work:
> >
> > do_change_root: old root d_count=17
> > Trying to unmount old root... Negative d_count (-1) for ///
> > Unabe to handle kernel NULL pointer dereference at virtual address 000000000
>
> Hi Florian,

Hello Bill,

your patch works fine. I can boot now 2.1.50 with all drivers as loadable
modules. Though there might still be some quirks, as your diagnostic warning
message is not triggered with my setup.

>
> At first I was very puzzled by your report, but I think I understand
> now. You must have already changed roots before getting to this point
> in your boot sequence, because if you tried to unmount the dentry with
> d_count 17, it wouldn't give the negative d_count message.

I have a initrd image with a shell, insmod and the scsi modules. linuxrc
is just the following shell-script:
#! /bin/sh
PATH=/bin:/sbin:/usr/bin
export PATH
test -n "$debug" && /bin/sh
test -z "$scsi_host" && exit 0
insmod scsi_mod
insmod sd_mod
insmod $scsi_host
exit 0

Once the scsi-driver is loaded and linuxrc is finished, initrd should
be unmounted and the real root-device on my scsi-disk is opened.
I don't think I change the root device twice... (??)

Here are my messages at bootup:
scsi : 1 host.
scsi0: Scanning channel A for devices.
Vendor: Quantum Model: VP32170 Rev: 89TC
Type: Direct-Access ANSI SCSI revision: 02
Detected scsi disk sda at scsi0, channel 0, id 0, lun 0
SCSI device sda: hdwr sector= 512 bytes. Sectors= 4238640 [2069 MB] [2.1 GB]
Partition check:
sda: sda1 sda2 sda3 < sda5 sda6 sda7 >
VFS: Mounted root (ext2 filesystem) readonly.
do_change_root: old root d_count=17
Trying to unmount old root ... okay
Freeing unused kernel memory: 20k freed
INIT: version 2.66f booting

>
> There does appear to be a bug in d_umount because it now assumes that
> there will always be a mounted dentry, and so dputs both dentries.

This sounds to be the real problem. And your patch fixes it for me.

>
> The attached patch should fix the problem, and the diagnostic printk
> should indicate that old_root_dev and the root inode device aren't the
> same.

This is not triggered.

> @@ -1120,6 +1121,11 @@
> old_root = current->fs->root;
> old_pwd = current->fs->pwd;
> old_root_dev = ROOT_DEV;
> + if (old_root_dev != old_root->d_inode->i_dev)
> + printk("Root device %s doesn't match inode device %s\n",
> + kdevname(old_root_dev),
> + kdevname(old_root->d_inode->i_dev);

You forgot a closing ')':
kdevname(old_root->d_inode->i_dev));

Thanks a lot for your help,

Florian La Roche