Re: [PATCH] init: fix name of root device in /proc/mounts

From: Rob Landley
Date: Mon Feb 04 2013 - 21:42:30 EST


On 01/31/2013 05:22:09 PM, H. Peter Anvin wrote:
On 01/31/2013 02:51 PM, William Hubbs wrote:
> On a system that does not use an initramfs, /dev/root was always
> listed in /proc/mounts. This breaks software which scans /proc/mounts to
> determine which file systems are mounted since /dev/root is not a valid
> device name.
>
> This changes that processing so that "/dev/root" is only added to
> /proc/mounts if a root device is not specified with the root= option on
> the kernel command line.
>
> Signed-off-by: William Hubbs <w.d.hubbs@xxxxxxxxx>

Let me also point out that most of the time, the kernel actually has a
udev device name for an actual device...

So your software is broken by overmounts? /dev/root is just one example of this. (And you can specify a root= on the kernel command line and have that be parsed by initramfs. I vaguely recall klibc does this...)

For an example of how to parse this stuff, how about:

http://landley.net/hg/toybox/file/4ffb735aea59/toys/posix/df.c

I.E. parse from the end of the list (most recent match is the overmount), and eliminate synthetic filesystems. Note that code is from 2006, other people have managed to cope all this time...

Rob--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/