mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* 2.4.21 Floppy Fallback with NFS root ...
@ 2003-06-16 14:18 Herbert Poetzl
  2003-06-17 15:11 ` Pavel Machek
  2003-06-19 16:03 ` Herbert Poetzl
  0 siblings, 2 replies; 6+ messages in thread
From: Herbert Poetzl @ 2003-06-16 14:18 UTC (permalink / raw)
  To: linux-kernel; +Cc: Rusty Russell


Hi!

I'm curious, is it intentional that, if you select
NFS support and NFS Root support, that the fact, that
no nfs is available, or selected via boot options,
automatically leads to a floppy boot?

I would suggest the following trivial patch, to give
the kernel compiler a chance to disable this 'feature'.

please correct me if I'm talking nonsense ...

best,
Herbert



diff -NurbP --minimal linux-2.4.21/fs/Config.in linux-2.4.21-ffb/fs/Config.in
--- linux-2.4.21/fs/Config.in   Tue Dec 10 03:25:19 2002
+++ linux-2.4.21-ffb/fs/Config.in       Mon Jun 16 15:05:09 2003
@@ -103,6 +103,7 @@
    dep_tristate 'NFS file system support' CONFIG_NFS_FS $CONFIG_INET
    dep_mbool '  Provide NFSv3 client support' CONFIG_NFS_V3 $CONFIG_NFS_FS
    dep_bool '  Root file system on NFS' CONFIG_ROOT_NFS $CONFIG_NFS_FS $CONFIG_IP_PNP
+   dep_bool '    Floppy Fallback' CONFIG_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
diff -NurbP --minimal linux-2.4.21/init/do_mounts.c linux-2.4.21-ffb/init/do_mounts.c
--- linux-2.4.21/init/do_mounts.c       Fri Jun 13 17:49:28 2003
+++ linux-2.4.21-ffb/init/do_mounts.c   Mon Jun 16 15:00:23 2003
@@ -754,8 +754,10 @@
                        printk("VFS: Mounted root (nfs filesystem).\n");
                        return;
                }
+# ifdef CONFIG_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);


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 2.4.21 Floppy Fallback with NFS root ...
  2003-06-16 14:18 2.4.21 Floppy Fallback with NFS root Herbert Poetzl
@ 2003-06-17 15:11 ` Pavel Machek
  2003-06-17 15:40   ` Herbert Poetzl
  2003-06-17 16:58   ` Bernd Eckenfels
  2003-06-19 16:03 ` Herbert Poetzl
  1 sibling, 2 replies; 6+ messages in thread
From: Pavel Machek @ 2003-06-17 15:11 UTC (permalink / raw)
  To: Herbert Poetzl; +Cc: linux-kernel, Rusty Russell

Hi!

> I'm curious, is it intentional that, if you select
> NFS support and NFS Root support, that the fact, that
> no nfs is available, or selected via boot options,
> automatically leads to a floppy boot?
> 
> I would suggest the following trivial patch, to give
> the kernel compiler a chance to disable this 'feature'.
> 
> please correct me if I'm talking nonsense ...

This might be okay for 2.5.X, but its definitely bad idea for
2.4.X. (User visible change without good reason).

> diff -NurbP --minimal linux-2.4.21/fs/Config.in linux-2.4.21-ffb/fs/Config.in
> --- linux-2.4.21/fs/Config.in   Tue Dec 10 03:25:19 2002
> +++ linux-2.4.21-ffb/fs/Config.in       Mon Jun 16 15:05:09 2003
> @@ -103,6 +103,7 @@
>     dep_tristate 'NFS file system support' CONFIG_NFS_FS $CONFIG_INET
>     dep_mbool '  Provide NFSv3 client support' CONFIG_NFS_V3 $CONFIG_NFS_FS
>     dep_bool '  Root file system on NFS' CONFIG_ROOT_NFS $CONFIG_NFS_FS $CONFIG_IP_PNP
> +   dep_bool '    Floppy Fallback' CONFIG_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
> diff -NurbP --minimal linux-2.4.21/init/do_mounts.c linux-2.4.21-ffb/init/do_mounts.c
> --- linux-2.4.21/init/do_mounts.c       Fri Jun 13 17:49:28 2003
> +++ linux-2.4.21-ffb/init/do_mounts.c   Mon Jun 16 15:00:23 2003
> @@ -754,8 +754,10 @@
>                         printk("VFS: Mounted root (nfs filesystem).\n");
>                         return;
>                 }
> +# ifdef CONFIG_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);
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 2.4.21 Floppy Fallback with NFS root ...
  2003-06-17 15:11 ` Pavel Machek
@ 2003-06-17 15:40   ` Herbert Poetzl
  2003-06-17 16:58   ` Bernd Eckenfels
  1 sibling, 0 replies; 6+ messages in thread
From: Herbert Poetzl @ 2003-06-17 15:40 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-kernel, Rusty Russell

On Tue, Jun 17, 2003 at 05:11:14PM +0200, Pavel Machek wrote:
> Hi!
> 
> > I'm curious, is it intentional that, if you select
> > NFS support and NFS Root support, that the fact, that
> > no nfs is available, or selected via boot options,
> > automatically leads to a floppy boot?
> > 
> > I would suggest the following trivial patch, to give
> > the kernel compiler a chance to disable this 'feature'.
> > 
> > please correct me if I'm talking nonsense ...
> 
> This might be okay for 2.5.X, but its definitely bad idea for
> 2.4.X. (User visible change without good reason).

okay, first the good reason :)

 currently it is not possible to compile a kernel with 
 root NFS support, which in case of NFS failure, (or
 missing NFS/network options) boots from HD, instead
 it asks you to insert a Floppy ...

and now ad 'user visible change' ...

what if I make it CONFIG_NOFLOPPY_FALLBACK and
change the #ifdef to #ifndef ? This would give
the same (strange?) behaviour as now, but an option
to disable the fallback (to floppy) ...

please comment,
Herbert

> > diff -NurbP --minimal linux-2.4.21/fs/Config.in linux-2.4.21-ffb/fs/Config.in
> > --- linux-2.4.21/fs/Config.in   Tue Dec 10 03:25:19 2002
> > +++ linux-2.4.21-ffb/fs/Config.in       Mon Jun 16 15:05:09 2003
> > @@ -103,6 +103,7 @@
> >     dep_tristate 'NFS file system support' CONFIG_NFS_FS $CONFIG_INET
> >     dep_mbool '  Provide NFSv3 client support' CONFIG_NFS_V3 $CONFIG_NFS_FS
> >     dep_bool '  Root file system on NFS' CONFIG_ROOT_NFS $CONFIG_NFS_FS $CONFIG_IP_PNP
> > +   dep_bool '    Floppy Fallback' CONFIG_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
> > diff -NurbP --minimal linux-2.4.21/init/do_mounts.c linux-2.4.21-ffb/init/do_mounts.c
> > --- linux-2.4.21/init/do_mounts.c       Fri Jun 13 17:49:28 2003
> > +++ linux-2.4.21-ffb/init/do_mounts.c   Mon Jun 16 15:00:23 2003
> > @@ -754,8 +754,10 @@
> >                         printk("VFS: Mounted root (nfs filesystem).\n");
> >                         return;
> >                 }
> > +# ifdef CONFIG_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);
> > 
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at  http://www.tux.org/lkml/
> 
> -- 
> When do you have a heart between your knees?
> [Johanka's followup: and *two* hearts?]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 2.4.21 Floppy Fallback with NFS root ...
  2003-06-17 15:11 ` Pavel Machek
  2003-06-17 15:40   ` Herbert Poetzl
@ 2003-06-17 16:58   ` Bernd Eckenfels
  1 sibling, 0 replies; 6+ messages in thread
From: Bernd Eckenfels @ 2003-06-17 16:58 UTC (permalink / raw)
  To: linux-kernel

In article <20030617151114.GA910@elf.ucw.cz> you wrote:
> This might be okay for 2.5.X, but its definitely bad idea for
> 2.4.X. (User visible change without good reason).

there is a good reason, it is security. But maybe the default should be
compatible.

Greetings
Bernd
-- 
eckes privat - http://www.eckes.org/
Project Freefire - http://www.freefire.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 2.4.21 Floppy Fallback with NFS root ...
  2003-06-16 14:18 2.4.21 Floppy Fallback with NFS root Herbert Poetzl
  2003-06-17 15:11 ` Pavel Machek
@ 2003-06-19 16:03 ` Herbert Poetzl
  1 sibling, 0 replies; 6+ messages in thread
From: Herbert Poetzl @ 2003-06-19 16:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: Rusty Russell, Bernd Eckenfels, Pavel Machek


on a deeper look at this issue, another astounding
(read confusing, erroneous) detail was revealed ...

consider a kernel boot cmdline like

  "root=/dev/vg/slash ro"

which could be used to boot from a LVM LV named slash
or, if you prefer a physical device (using devfs)

  "root=/dev/ide//host0/bus0/target0/lun0/part1 ro"


now what happens on boot is:

root_dev_setup() is called with "root=" and, in turn
calls name_to_kdev_t() which searches root_dev_names[]
for the given device names, which of course, can not
be found, because they are not listed, so ROOT_DEV
becomes (0:0)
 
if you have CONFIG_ROOT_NFS enabled, then mount_root()
will check if MAJOR(ROOT_DEV) == UNNAMED_MAJOR, which
will be true, although root=/dev/nfs (0:ff) wasn't 
specified, leading directly to "Unable to mount root 
fs via NFS, trying floppy." and the Floppy Fallback, 
instead of booting from your specified root device.

  "root=/dev/hda1 ro"

will work as expected, because it will be found in
root_dev_names[] ...


I suggest to do one fix, and one improvement ...

and of course this _will_ break the current behaviour
you won't be able to use root=tux (or your favorite
pet name) to have root on nfs ...

what do you think?

best,
Herbert


------------------ FIX

diff -NurbP --minimal linux-2.4.21/init/do_mounts.c linux-2.4.21-ffb/init/do_mounts.c
--- linux-2.4.21/init/do_mounts.c	Fri Jun 13 17:49:28 2003
+++ linux-2.4.21-ffb/init/do_mounts.c	Thu Jun 19 17:41:35 2003
@@ -747,7 +747,8 @@
 static void __init mount_root(void)
 {
 #ifdef CONFIG_ROOT_NFS
-	if (MAJOR(ROOT_DEV) == UNNAMED_MAJOR) {
+	if (MAJOR(ROOT_DEV) == UNNAMED_MAJOR
+	    && MINOR(ROOT_DEV) == 255) {
 		if (mount_nfs_root()) {
 			sys_chdir("/root");
 			ROOT_DEV = current->fs->pwdmnt->mnt_sb->s_dev;


maybe a NFS_MAJOR, NFS_MINOR would be more descriptive here ...


------------------ SECURITY IMPROVEMENT ;)

diff -NurbP --minimal linux-2.4.21/fs/Config.in linux-2.4.21-ffb/fs/Config.in
--- linux-2.4.21/fs/Config.in	Tue Dec 10 03:25:19 2002
+++ linux-2.4.21-ffb/fs/Config.in	Thu Jun 19 17:42:35 2003
@@ -103,6 +103,7 @@
    dep_tristate 'NFS file system support' CONFIG_NFS_FS $CONFIG_INET
    dep_mbool '  Provide NFSv3 client support' CONFIG_NFS_V3 $CONFIG_NFS_FS
    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
diff -NurbP --minimal linux-2.4.21/init/do_mounts.c linux-2.4.21-ffb/init/do_mounts.c
--- linux-2.4.21/init/do_mounts.c	Fri Jun 13 17:49:28 2003
+++ linux-2.4.21-ffb/init/do_mounts.c	Thu Jun 19 17:41:35 2003
@@ -754,8 +754,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);




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: 2.4.21 Floppy Fallback with NFS root ...
@ 2003-06-17 16:29 John Bradford
  0 siblings, 0 replies; 6+ messages in thread
From: John Bradford @ 2003-06-17 16:29 UTC (permalink / raw)
  To: herbert; +Cc: linux-kernel, pavel, rusty

> > > I'm curious, is it intentional that, if you select
> > > NFS support and NFS Root support, that the fact, that
> > > no nfs is available, or selected via boot options,
> > > automatically leads to a floppy boot?
> > > 
> > > I would suggest the following trivial patch, to give
> > > the kernel compiler a chance to disable this 'feature'.
> > > 
> > > please correct me if I'm talking nonsense ...
> > 
> > This might be okay for 2.5.X, but its definitely bad idea for
> > 2.4.X. (User visible change without good reason).

If it defaults to off, it shouldn't be a problem.

> okay, first the good reason :)

>  currently it is not possible to compile a kernel with 
>  root NFS support, which in case of NFS failure, (or
>  missing NFS/network options) boots from HD, instead
>  it asks you to insert a Floppy ...

For 2.5, it might be more useful if the default NFS-on-root
configuration is to wait for 60 seconds, and retry, if there is an
error.  If a machine is re-booted remotely, and it can't contact the
server for any reason, it's not really very desirable to have it wait
for you to insert a floppy :-)

> and now ad 'user visible change' ...

> what if I make it CONFIG_NOFLOPPY_FALLBACK and
> change the #ifdef to #ifndef ? This would give
> the same (strange?) behaviour as now, but an option
> to disable the fallback (to floppy) ...

I'm not really sure how useful the root filesystem on floppy option
is.  I'd imagine that it is probably a relic from the times when a lot
of people booted the kernel image directly, instead of using a
bootloader.  It would be quite useful in those circumstances, as you
wouldn't have a bootloader prompt to override the default for the root
filesystem.

Since 2.6 will no longer have the in-kernel bootloader, I suggest we
remove this functionality as well, and replace it with the wait 60
seconds and retry functionalily I described above.

It would be worth putting this in to 2.4, though.

Oh, and it would be even better if it tried the second floppy drive in
the case that the first one didn't contain a disk, (in case somebody
wants to mount a 5.25" floppy as the root filesystem, and their 5.25"
drive is the secondary one).

John.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-06-19 15:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-16 14:18 2.4.21 Floppy Fallback with NFS root Herbert Poetzl
2003-06-17 15:11 ` Pavel Machek
2003-06-17 15:40   ` Herbert Poetzl
2003-06-17 16:58   ` Bernd Eckenfels
2003-06-19 16:03 ` Herbert Poetzl
2003-06-17 16:29 John Bradford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®