Quantcast

[patch] functional prototype of root mount enhancement

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[patch] functional prototype of root mount enhancement

Marcel Moolenaar-4
All,

I prototyped the root mount enhancement previously discussed.
I would appreciate feedback and suggestions and bug reports
of course.

See:
http://docs.freebsd.org/cgi/getmsg.cgi?fetch=5942+0+current/freebsd-arch
http://docs.freebsd.org/cgi/getmsg.cgi?fetch=120899+0+archive/2010/freebsd-arch/20100829.freebsd-arch

The prototype supports all boot options that affect the root
mount. Those are: -a, -C, -r
When present, the initial root mount directives get adjusted
accordingly.

The prototype adds better support for mount options. Both the
interactive, as well has the compiled-in root mount option
(i.e. ROOTDEVNAME) can contain mount options.

Not implemented yet is the .onfail handling, as well as the
.timeout handling (previously called .wait). Also, the .init
directive is not implemented.

There's 1 bug under investigation: when a 2nd (non-devfs)
file system is mounted as root, the 1st (non-devfs) gets
moved under /.mount or /mnt under the new (=2nd) file
system. However, trying to access the file system results in
a WITNESS panic caused by a syscall leaving with the ufs
lock held.

The code has some debug output still, which is helpful to
see what's going on internally. From a boot (with a
/.mount.conf present on ufs:/dev/ad0s1a):

        :
WARNING: WITNESS option enabled, expect reduced performance.
Root mount waiting for: usbus1
Root mount waiting for: usbus1
uhub1: 6 ports with 6 removable, self powered
Root mount waiting for: usbus1
Root mount waiting for: usbus1
ugen1.2: <Apple Inc.> at usbus1
========
.onfail panic
.timeout 1
ufs:/dev/ad0s1a rw
.ask
========
Trying to mount root from ufs:/dev/ad0s1a [rw]...
XXX: vfs_mountroot_parse: error = 0, mpdevfs=0xc3fa3000, mp=0xc3fa2c94
========
.onfail continue
#ufs:/dev/da0a
.ask
========

Loader variables:
  vfs.root.mountfrom=ufs:/dev/ad0s1a
  vfs.root.mountfrom.options=rw

Manual root filesystem specification:
  <fstype>:<device> [options]
      Mount <device> using filesystem <fstype>
      and with the specified (optional) option list.

    eg. ufs:/dev/da0s1a
        cd9660:/dev/acd0 ro
          (which is equivalent to: mount -t cd9660 -o ro /dev/acd0 /

  ?                  List valid disk boot devices
  <empty line>       Abort manual input

mountroot>
XXX: vfs_mountroot_parse: error = -1, mpdevfs=0xc3fa3000, mp=0
        :

In case the attachment gets eaten:
        http://www.xcllnt.net/~marcel/rootmount.diff

--
Marcel Moolenaar
[hidden email]



_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"

rootmount.diff (42K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [patch] functional prototype of root mount enhancement

Marcel Moolenaar-4

On Sep 27, 2010, at 11:22 PM, Marcel Moolenaar wrote:
>
> The code has some debug output still, which is helpful to
> see what's going on internally. From a boot (with a
> /.mount.conf present on ufs:/dev/ad0s1a):

A more interesting example is using an ISO image as root that
lives on UFS file system (in this case FreeBSD 8.1 livefs):

        :
Root mount waiting for: usbus1
ugen1.2: <Apple Inc.> at usbus1
========
.onfail panic
.timeout 1
ufs:/dev/ad0s1a rw
.ask
========
Trying to mount root from ufs:/dev/ad0s1a [rw]...
XXX: vfs_mountroot_parse: error = 0, mpdevfs=0xc3fa4000, mp=0xc3fa3c94
========
.onfail continue
.md /livefs.iso
#ufs:/dev/da0a
.ask
========
md0 attached to /livefs.iso

Loader variables:
  vfs.root.mountfrom=ufs:/dev/ad0s1a
  vfs.root.mountfrom.options=rw

Manual root filesystem specification:
  <fstype>:<device> [options]
      Mount <device> using filesystem <fstype>
      and with the specified (optional) option list.

    eg. ufs:/dev/da0s1a
        cd9660:/dev/acd0 ro
          (which is equivalent to: mount -t cd9660 -o ro /dev/acd0 /)

  ?                  List valid disk boot devices
  <empty line>       Abort manual input

mountroot> ?

List of GEOM managed disk devices:
  da0p2 da0p1 da0 acd0 ad0s1a ad0s1 ad0

mountroot> .

mountroot> ?

List of GEOM managed disk devices:
  md0 da0p2 da0p1 da0 acd0 ad0s1a ad0s1 ad0

mountroot> cd9660:/dev/md#
Trying to mount root from cd9660:/dev/md0 []...
XXX: vfs_mountroot_parse: error = 0, mpdevfs=0xc3fa4000, mp=0xc3fa3a10
lock order reversal:
 1st 0xc3e95270 isofs (isofs) @ /usr/src/sys/fs/cd9660/cd9660_vfsops.c:694
 2nd 0xc3e959c4 ufs (ufs) @ /usr/src/sys/kern/vfs_subr.c:2221
KDB: stack backtrace:
        :

# mount
/dev/md0 on / (cd9660, local, read-only)
/dev/ad0s1a on /mnt (ufs, local, read-only)
devfs on /dev (devfs, local)
/dev/md1 on /var (ufs, local)
/dev/md2 on /tmp (ufs, local)

(md1 & md2 are created by /etc/rc)

--
Marcel Moolenaar
[hidden email]



_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [patch] functional prototype of root mount enhancement

Warner Losh
In reply to this post by Marcel Moolenaar-4
Hey Marcel,

haven't had a chance to look through this in detail yet.  One item
that has always bugged me is why when we hit the prompt that has to be
the end of discovery...  Why can't we have a method to listen to new
geom providers being advertised and then 'short circuit' the ask
prompt if /dev/da0s1a or /dev/ufs/rootfs or whatever it originally
wanted appears.

Maybe this isn't .ask, but some other verb in your language?

Warner
_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [patch] functional prototype of root mount enhancement

Marcel Moolenaar-4

On Sep 28, 2010, at 10:27 AM, M. Warner Losh wrote:

> Hey Marcel,
>
> haven't had a chance to look through this in detail yet.  One item
> that has always bugged me is why when we hit the prompt that has to be
> the end of discovery...  Why can't we have a method to listen to new
> geom providers being advertised and then 'short circuit' the ask
> prompt if /dev/da0s1a or /dev/ufs/rootfs or whatever it originally
> wanted appears.
>
> Maybe this isn't .ask, but some other verb in your language?

Hmmm... I think we should give .ask an option so that it can be
made conditional upon a key press then. I don't think it's nice
to print all that stuff, present a prompt, wait for input and
then shortly after continue booting anyway because some device
showed up.

Say we have ".ask on-key-press", which basically nullifies the
.ask directive (by implicitly failing to mount) unless a key was
pressed. At that time we actually print the help, show a prompt
and wait for input. This in combination with ".onfail retry"
allows us to cycle through the alternatives until 1) a key was
pressed and we'll drop at the interactive mount prompt or 2) a
device we've been waiting for appears and we can mount root.

Would that address your case?

Another feature we may need is the alternative: if you boot
with -C, we'll try cd9660:/dev/cd0 and cd9660:/dev/acd0. What
we really want to do is:
        .select /dev/cd0 /dev/acd0
        cd9660:%selected%

...

--
Marcel Moolenaar
[hidden email]



_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Loading...