Re: 2.1.49 oops.

Bill Hawes (whawes@star.net)
Wed, 13 Aug 1997 17:28:53 -0400


This is a multi-part message in MIME format.
--------------942005E788643ACBB7F7FBA5
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Edward Welbon wrote:
>
> Two oopses, the first occurs durring boot in rc.S. I use initrd
> and one of the first actions of rc.S is to unmount the initial
> ram disk. This oopses with a negative d_count.

OK, now I see what's going on ... do_change_root is unmounting something
that doesn't need unmounting, and doing the mount twice.

I'll bet all of the kswapd etc. oops are on kernels using initrd ...

The attached patch should fix the problem. The first printk should
report d_count=2, we do one dput, then mount the old root on the new
directory.

>
> The second occurs randomly when starting a new shell. Couldn't
> see any pattern, the oops is:

This is probably just remaining corruption from the first problem.

Regards,
Bill
--------------942005E788643ACBB7F7FBA5
Content-Type: text/plain; charset=us-ascii; name="super_49-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="super_49-patch"

--- fs/super.c.old Tue Aug 12 07:49:18 1997
+++ fs/super.c Wed Aug 13 17:17:46 1997
@@ -1118,6 +1134,8 @@
dput(dir_d);
error = -ENOTDIR;
}
+ printk("do_change_root: old root d_count=%d\n", old_root->d_count);
+ dput(old_root);
dput(old_pwd);
if (error) {
int umount_error;
@@ -1133,15 +1151,15 @@
}
remove_vfsmnt(old_root_dev);
vfsmnt = add_vfsmnt(old_root_dev,"/dev/root.old",put_old);
- if (!vfsmnt) printk(KERN_CRIT "Trouble: add_vfsmnt failed\n");
- else {
+ if (vfsmnt) {
vfsmnt->mnt_sb = old_root->d_inode->i_sb;
- d_mount(dir_d,vfsmnt->mnt_sb->s_root);
vfsmnt->mnt_flags = vfsmnt->mnt_sb->s_flags;
+ d_mount(dir_d,old_root);
+ return 0;
}
- d_umount(old_root);
- d_mount(dir_d,old_root);
- return 0;
+ printk(KERN_CRIT "Trouble: add_vfsmnt failed\n");
+ dput(old_root);
+ return -ENOMEM;
}

int change_root(kdev_t new_root_dev,const char *put_old)

--------------942005E788643ACBB7F7FBA5--