Skip to contentSkip to conversation

Re: [[email protected]: NFS root and Floppy Fallback ...]

[email protected]: NFS root and Floppy Fallback ... Herbert Pötzl 1 participant 1 message Jul 16, 2003 4 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 12 lines · Marcelo Tosatti
Quoted 11 lines · Herbert Pötzl
Quoted 3 lines · Marcelo Tosatti

Herbert,
Does Trond know about this patch?

yes, I sent him a mail describing the issues on Thu, 3 Jul 2003 16:37:50 +0200, but did never receive any reply ...

Quoted 1 line

What he thinks about it?

Quoted 8 lines
Quoted 4 lines

I don't know ... but the first part (the fix) should be obvious anyway ...

please advice how to proceed ...

Resend the patch to me AND trond, CC lkml.

OK?

here they are, rediffed for 2.4.22-pre6 ...

first patch fixes NFS root issue, second adds
the Disable Floppy Fallback config option ...

best,
Herbert

include/linux/nfs.h +3 -0
diff -NurbP --minimal linux-2.4.22-pre3/include/linux/nfs.h linux-2.4.22-pre3-fix/include/linux/nfs.h
@@ -30,6 +30,9 @@
 #define NFS_MNT_PROGRAM	100005
 #define NFS_MNT_PORT	627
 
+#define NFS_MAJOR   	UNNAMED_MAJOR
+#define NFS_MINOR   	0xff
+
 /*
  * NFS stats. The good thing with these values is that NFSv3 errors are
  * a superset of NFSv2 errors (with the exception of NFSERR_WFLUSH which
init/do_mounts.c +3 -2
diff -NurbP --minimal linux-2.4.22-pre3/init/do_mounts.c linux-2.4.22-pre3-fix/init/do_mounts.c
@@ -88,7 +88,7 @@
 	const char *name;
 	const int num;
 } root_dev_names[] __initdata = {
-	{ "nfs",     0x00ff },
+	{ "nfs",     MKDEV(NFS_MAJOR, NFS_MINOR) },
 	{ "hda",     0x0300 },
 	{ "hdb",     0x0340 },
 	{ "loop",    0x0700 },
@@ -759,7 +759,8 @@
 static void __init mount_root(void)
 {
 #ifdef CONFIG_ROOT_NFS
-	if (MAJOR(ROOT_DEV) == UNNAMED_MAJOR) {
+       if (MAJOR(ROOT_DEV) == NFS_MAJOR
+           && MINOR(ROOT_DEV) == NFS_MINOR) {
 		if (mount_nfs_root()) {
 			sys_chdir("/root");
 			ROOT_DEV = current->fs->pwdmnt->mnt_sb->s_dev;
Documentation/Configure.help +12 -0
diff -NurbP --minimal linux-2.4.22-pre6-fix/Documentation/Configure.help linux-2.4.22-pre6-fix-ffb/Documentation/Configure.help
@@ -15983,6 +15983,18 @@
 
   Most people say N here.
 
+Disable Fallback to Floppy
+CONFIG_NO_FLOPPY_FALLBACK
+  If root file system on NFS is enabled but the root device isn't
+  /dev/nfs (or the NFS root can not be mounted for any other reason)
+  the kernel usually falls back to a floppy boot.
+  
+  This option will disable the default behaviour, which could be a
+  security risk, allowing either to boot from a specified root device 
+  or not at all. 
+
+  If unsure say N here.
+
 NFS server support
 CONFIG_NFSD
   If you want your Linux box to act as an NFS *server*, so that other
fs/Config.in +1 -0
diff -NurbP --minimal linux-2.4.22-pre6-fix/fs/Config.in linux-2.4.22-pre6-fix-ffb/fs/Config.in
@@ -108,6 +108,7 @@
    dep_mbool '  Provide NFSv3 client support' CONFIG_NFS_V3 $CONFIG_NFS_FS
    dep_mbool '  Allow direct I/O on NFS files (EXPERIMENTAL)' CONFIG_NFS_DIRECTIO $CONFIG_NFS_FS $CONFIG_EXPERIMENTAL
    dep_bool '  Root file system on NFS' CONFIG_ROOT_NFS $CONFIG_NFS_FS $CONFIG_IP_PNP
+   dep_bool '    Disable Floppy Fallback' CONFIG_NO_FLOPPY_FALLBACK $CONFIG_ROOT_NFS
 
    dep_tristate 'NFS server support' CONFIG_NFSD $CONFIG_INET
    dep_mbool '  Provide NFSv3 server support' CONFIG_NFSD_V3 $CONFIG_NFSD
init/do_mounts.c +2 -0
diff -NurbP --minimal linux-2.4.22-pre6-fix/init/do_mounts.c linux-2.4.22-pre6-fix-ffb/init/do_mounts.c
@@ -767,8 +767,10 @@
 			printk("VFS: Mounted root (nfs filesystem).\n");
 			return;
 		}
+# ifndef CONFIG_NO_FLOPPY_FALLBACK
 		printk(KERN_ERR "VFS: Unable to mount root fs via NFS, trying floppy.\n");
 		ROOT_DEV = MKDEV(FLOPPY_MAJOR, 0);
+# endif
 	}
 #endif
 	devfs_make_root(root_device_name);