Skip to contentSkip to conversation

NFS: Make NFS root work again

PATCH In review David Howells 6 participants 8 messages Jun 7, 2007 – Jun 18, 2007 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFS: Make NFS root work again

Make NFS root work by creating a "/root" directory to satisfy the mount, otherwise the path lookup for the mount fails with ENOENT.

---

 init/do_mounts.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
init/do_mounts.c +4 -1
index 46fe407..967b852 100644
@@ -270,7 +270,10 @@ static void __init get_fs_names(char *page)
 
 static int __init do_mount_root(char *name, char *fs, int flags, void *data)
 {
-	int err = sys_mount(name, "/root", fs, flags, data);
+	int err;
+
+	sys_mkdir("/root", 0755);
+	err = sys_mount(name, "/root", fs, flags, data);
 	if (err)
 		return err;
 
#1 lore raw
Quoted 14 lines · David Howells

Make NFS root work by creating a "/root" directory to satisfy the mount, otherwise the path lookup for the mount fails with ENOENT.

---

 init/do_mounts.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
init/do_mounts.c +0 -0
index 46fe407..967b852 100644

init/do_mounts.c static void __init get_fs_names(char *page) · line 278

Quoted 10 lines
init/do_mounts.c +4 -1
@@ -270,7 +270,10 @@ static void __init get_fs_names(char *page)
 
 static int __init do_mount_root(char *name, char *fs, int flags, void *data)
 {
-	int err = sys_mount(name, "/root", fs, flags, data);
+	int err;
+
+	sys_mkdir("/root", 0755);
+	err = sys_mount(name, "/root", fs, flags, data);
 	if (err)
 		return err;

It seems to me that if sys_mkdir() fails with anything other other than EEXISTS, then sys_mount() will continue to fail. Is this something that we care about?

ps

#2 lore raw
In reply to David Howells
Quoted 3 lines · On Thu, 07 Jun 2007 17:40:03 +0100 David Howells <[email protected]> wrote:

Make NFS root work by creating a "/root" directory to satisfy the mount, otherwise the path lookup for the mount fails with ENOENT.

What did we do to make it stop working, and when did we do it??

Quoted 17 lines
init/do_mounts.c +4 -1
index 46fe407..967b852 100644
@@ -270,7 +270,10 @@ static void __init get_fs_names(char *page)
 
 static int __init do_mount_root(char *name, char *fs, int flags, void *data)
 {
-	int err = sys_mount(name, "/root", fs, flags, data);
+	int err;
+
+	sys_mkdir("/root", 0755);
+	err = sys_mount(name, "/root", fs, flags, data);
 	if (err)
 		return err;
 
#3 lore raw
In reply to David Howells
Quoted 14 lines · On Thu, 07 Jun 2007 17:40:03 +0100 David Howells <[email protected]> wrote:

Make NFS root work by creating a "/root" directory to satisfy the mount, otherwise the path lookup for the mount fails with ENOENT.

---

 init/do_mounts.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
init/do_mounts.c +0 -0
index 46fe407..967b852 100644

init/do_mounts.c static void __init get_fs_names(char *page) · line 278

Quoted 10 lines
init/do_mounts.c +4 -1
@@ -270,7 +270,10 @@ static void __init get_fs_names(char *page)
 
 static int __init do_mount_root(char *name, char *fs, int flags, void *data)
 {
-	int err = sys_mount(name, "/root", fs, flags, data);
+	int err;
+
+	sys_mkdir("/root", 0755);
+	err = sys_mount(name, "/root", fs, flags, data);
 	if (err)
 		return err;

Am still awaiting a proper description of this patch, please.

What is not working, and how does this patch fix it?

I am unaware of any open bug reports against NFS root.

#4 lore raw
Quoted 29 lines · Andrew Morton
Quoted 14 lines · On Thu, 07 Jun 2007 17:40:03 +0100 David Howells <[email protected]> wrote:

Make NFS root work by creating a "/root" directory to satisfy the mount, otherwise the path lookup for the mount fails with ENOENT.

---

 init/do_mounts.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
init/do_mounts.c +0 -0
index 46fe407..967b852 100644

init/do_mounts.c static void __init get_fs_names(char *page) · line 278

Quoted 10 lines
init/do_mounts.c +4 -1
@@ -270,7 +270,10 @@ static void __init get_fs_names(char *page)
 
 static int __init do_mount_root(char *name, char *fs, int flags, void *data)
 {
-	int err = sys_mount(name, "/root", fs, flags, data);
+	int err;
+
+	sys_mkdir("/root", 0755);
+	err = sys_mount(name, "/root", fs, flags, data);
 	if (err)
 		return err;

Am still awaiting a proper description of this patch, please.

Quoted 3 lines

What is not working, and how does this patch fix it?

I am unaware of any open bug reports against NFS root.

I'm confused too. We never used to require that the kernel create a special /root directory. What changed, and when?

Trond

#5 lore raw
In reply to Andrew Morton
Quoted 10 lines · Andrew Morton
Quoted 3 lines · On Thu, 07 Jun 2007 17:40:03 +0100 David Howells <[email protected]> wrote:

Make NFS root work by creating a "/root" directory to satisfy the mount, otherwise the path lookup for the mount fails with ENOENT.

Am still awaiting a proper description of this patch, please.

What is not working, and how does this patch fix it?

I am unaware of any open bug reports against NFS root.

I've not had any problems with it during any of the -rc periods, for what it's worth.

#6 lore raw
In reply to Andrew Morton
Quoted 2 lines · Andrew Morton

What is not working, and how does this patch fix it?

FWIW i use nfs root regularly for testing kernels and it works for me.

-Andi

#7 lore raw
In reply to Andrew Morton
Quoted 1 line · Andrew Morton

What is not working, and how does this patch fix it?

It turns out that this patch is unnecessary. The problem had to do with the initcalling of default_rootfs() (or lack of initcalling in this case). I fixed vmlinux.lds.S and it works now.

David