Re: [BUG] deadlock upon 'mv' on NFSROOT in 2.2.7

Alexander Viro (viro@math.psu.edu)
Sun, 9 May 1999 13:28:17 -0400 (EDT)


On Sun, 9 May 1999, Oren Laadan wrote:

> Hi,
>
> There appears to be a bug in 2.2.6 and 2.2.7 using NFSROOT - a deadlock
> when trying to rename a directory within the NFSROOT filesystem. For
> example:
> cd /lib
> mv modules modules-bug
> ...... [hang] ......
>
> I found out that: sys_rename() calls vfs_rename(), which tries to
> "down" a lock but fails, so it calls "__down_failed" which calls
> "__down". There it waits forever !!

Arrrrgh. Yup, with NFSROOT we create a root superblock not via
read_super(), so we have to initialize semaphore by hands.
The following should help:

--- fs/super.c Sun May 9 05:16:28 1999
+++ fs/super.c.new Sun May 9 13:39:08 1999
@@ -1131,6 +1131,7 @@
sb = get_empty_super(); /* "can't fail" */
sb->s_dev = get_unnamed_dev();
sb->s_flags = root_mountflags;
+ sema_init(&sb->s_vfs_rename_sem,1);
vfsmnt = add_vfsmnt(sb, "/dev/root", "/");
if (vfsmnt) {
if (nfs_root_mount(sb) >= 0) {

Linus, could you apply it?
TIA,
Al

-
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/