Skip to contentSkip to conversation

init: don't try mounting device as nfs root unless type fully matches

PATCH In review Sasha Levin 2 participants 5 messages May 5, 2012 – May 7, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 init: don't try mounting device as nfs root unless type fully matches

Currently, we'll try mounting any device who's major device number is UNNAMED_MAJOR as NFS root. This would happen for non-NFS devices as well (such as 9p devices) but it wouldn't cause any issues since mounting the device as NFS would fail quickly and the code proceeded to doing the proper mount:

       [  101.522716] VFS: Unable to mount root fs via NFS, trying floppy.
       [  101.534499] VFS: Mounted root (9p filesystem) on device 0:18.

Commit 6829a048 ("NFS: Retry mounting NFSROOT") has introduced retries when mounting NFS root, which means that now we don't immediately fail and instead it takes an additional 90+ seconds until we stop retrying, which has revealed the issue this patch fixes.

This meant that it would take an additional 90 seconds to boot when we're not using a device type which gets detected in order before NFS.

This patch modifies the NFS type check to require device type to be 'Root_NFS' instead of requiring the device to have an UNNAMED_MAJOR major. This makes boot process cleaner since we now won't go through the NFS mounting code at all when the device isn't an NFS root ("/dev/nfs").

---
 init/do_mounts.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
init/do_mounts.c +1 -1
index 8dfa0de..d3f0aee 100644
@@ -482,7 +482,7 @@ void __init change_floppy(char *fmt, ...)
 void __init mount_root(void)
 {
 #ifdef CONFIG_ROOT_NFS
-	if (MAJOR(ROOT_DEV) == UNNAMED_MAJOR) {
+	if (ROOT_DEV == Root_NFS) {
 		if (mount_nfs_root())
 			return;
 
Signature · 1 line
1.7.8.5
#1 lore raw
Quoted 5 lines · Sasha Levin

Currently, we'll try mounting any device who's major device number is UNNAMED_MAJOR as NFS root. This would happen for non-NFS devices as well (such as 9p devices) but it wouldn't cause any issues since mounting the device as NFS would fail quickly and the code proceeded to doing the proper mount:

Quoted 7 lines
       [  101.522716] VFS: Unable to mount root fs via NFS, trying floppy.
       [  101.534499] VFS: Mounted root (9p filesystem) on device 0:18.

Commit 6829a048 ("NFS: Retry mounting NFSROOT") has introduced retries when mounting NFS root, which means that now we don't immediately fail and instead it takes an additional 90+ seconds until we stop retrying, which has revealed the issue this patch fixes.

Just wondering, which tree is commit 6829a048 included in? It does not appear to be mainline AFAICS.

Thanks,

Ingo

#2 lore raw
Quoted 11 lines · Ingo Molnar
Quoted 8 lines · Sasha Levin

Currently, we'll try mounting any device who's major device number is UNNAMED_MAJOR as NFS root. This would happen for non-NFS devices as well (such as 9p devices) but it wouldn't cause any issues since mounting the device as NFS would fail quickly and the code proceeded to doing the proper mount:

       [  101.522716] VFS: Unable to mount root fs via NFS, trying floppy.
       [  101.534499] VFS: Mounted root (9p filesystem) on device 0:18.
Quoted 7 lines
Quoted 4 lines

Commit 6829a048 ("NFS: Retry mounting NFSROOT") has introduced retries when mounting NFS root, which means that now we don't immediately fail and instead it takes an additional 90+ seconds until we stop retrying, which has revealed the issue this patch fixes.

Just wondering, which tree is commit 6829a048 included in? It does not appear to be mainline AFAICS.

appears to be:

43717c7daebf NFS: Retry mounting NFSROOT

The commit ID you cited is apparently one that got exposed to linux-next but got rebased subsequently, before it went upstream, or so.

Thanks,

Ingo

#3 lore raw
In reply to Ingo Molnar
Quoted 11 lines · Ingo Molnar
Quoted 8 lines · Sasha Levin

Currently, we'll try mounting any device who's major device number is UNNAMED_MAJOR as NFS root. This would happen for non-NFS devices as well (such as 9p devices) but it wouldn't cause any issues since mounting the device as NFS would fail quickly and the code proceeded to doing the proper mount:

       [  101.522716] VFS: Unable to mount root fs via NFS, trying floppy. [  101.534499] VFS: Mounted root (9p filesystem) on device 0:18.

Quoted 7 lines
Quoted 4 lines

Commit 6829a048 ("NFS: Retry mounting NFSROOT") has introduced retries when mounting NFS root, which means that now we don't immediately fail and instead it takes an additional 90+ seconds until we stop retrying, which has revealed the issue this patch fixes.

Just wondering, which tree is commit 6829a048 included in? It does not appear to be mainline AFAICS.

It's 43717c7daebf10b43f12e68512484b3095bb1ba5 in mainline now.

Commit 6829a048 was from the -next tree (not sure which one of the -next trees, but if you grab -next you'll see it there). I've prepared this patch a while ago when it wasn't in mainline yet.

Acked-by on v1 1/1
#4 lore raw
In reply to Sasha Levin
Quoted 31 lines · Sasha Levin

Currently, we'll try mounting any device who's major device number is UNNAMED_MAJOR as NFS root. This would happen for non-NFS devices as well (such as 9p devices) but it wouldn't cause any issues since mounting the device as NFS would fail quickly and the code proceeded to doing the proper mount:

       [  101.522716] VFS: Unable to mount root fs via NFS, trying floppy.
       [  101.534499] VFS: Mounted root (9p filesystem) on device 0:18.

Commit 6829a048 ("NFS: Retry mounting NFSROOT") has introduced retries when mounting NFS root, which means that now we don't immediately fail and instead it takes an additional 90+ seconds until we stop retrying, which has revealed the issue this patch fixes.

This meant that it would take an additional 90 seconds to boot when we're not using a device type which gets detected in order before NFS.

This patch modifies the NFS type check to require device type to be 'Root_NFS' instead of requiring the device to have an UNNAMED_MAJOR major. This makes boot process cleaner since we now won't go through the NFS mounting code at all when the device isn't an NFS root ("/dev/nfs").

---
 init/do_mounts.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
init/do_mounts.c +0 -0
index 8dfa0de..d3f0aee 100644

init/do_mounts.c void __init change_floppy(char *fmt, ...) · line 487

Quoted 7 lines
init/do_mounts.c +1 -1
@@ -482,7 +482,7 @@ void __init change_floppy(char *fmt, ...)
 void __init mount_root(void)
 {
 #ifdef CONFIG_ROOT_NFS
-	if (MAJOR(ROOT_DEV) == UNNAMED_MAJOR) {
+	if (ROOT_DEV == Root_NFS) {
 		if (mount_nfs_root())
 			return;

This bug actively broke my KVM bootup, it gave the impression that the bootup was hung, while it was just retrying for a looong time.

Thanks,

Ingo