All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] init: fix name of root device in /proc/mounts
@ 2013-02-05 20:07 William Hubbs
  2013-02-05 20:10 ` William Hubbs
  0 siblings, 1 reply; 22+ messages in thread
From: William Hubbs @ 2013-02-05 20:07 UTC (permalink / raw)
  To: linux-next; +Cc: mpagano, William Hubbs

On a system that does not use an initramfs, /dev/root is 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@gmail.com>
---
 init/do_mounts.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/init/do_mounts.c b/init/do_mounts.c
index 1d1b634..efc37d2 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -480,7 +480,10 @@ void __init change_floppy(char *fmt, ...)
 	va_start(args, fmt);
 	vsprintf(buf, fmt, args);
 	va_end(args);
-	fd = sys_open("/dev/root", O_RDWR | O_NDELAY, 0);
+	if (saved_root_name[0])
+		fd = sys_open(saved_root_name, O_RDWR | O_NDELAY, 0);
+	else
+		fd = sys_open("/dev/root", O_RDWR | O_NDELAY, 0);
 	if (fd >= 0) {
 		sys_ioctl(fd, FDEJECT, 0);
 		sys_close(fd);
@@ -523,8 +526,13 @@ void __init mount_root(void)
 	}
 #endif
 #ifdef CONFIG_BLOCK
-	create_dev("/dev/root", ROOT_DEV);
-	mount_block_root("/dev/root", root_mountflags);
+	if (saved_root_name[0]) {
+		create_dev(saved_root_name, ROOT_DEV);
+		mount_block_root(saved_root_name, root_mountflags);
+	} else {
+		create_dev("/dev/root", ROOT_DEV);
+		mount_block_root("/dev/root", root_mountflags);
+	}
 #endif
 }
 
-- 
1.7.12.4

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

* Re: [PATCH] init: fix name of root device in /proc/mounts
  2013-02-05 20:07 [PATCH] init: fix name of root device in /proc/mounts William Hubbs
@ 2013-02-05 20:10 ` William Hubbs
  2013-02-05 21:45   ` Stephen Rothwell
  0 siblings, 1 reply; 22+ messages in thread
From: William Hubbs @ 2013-02-05 20:10 UTC (permalink / raw)
  To: linux-next; +Cc: mpagano, w.d.hubbs

[-- Attachment #1: Type: text/plain, Size: 200 bytes --]

All,

this patch was originally sent to linux-kernel, but I was told it might
be better to send it to this list since this section of the kernel does
not have a specific maintainer.

Thanks,

William

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH] init: fix name of root device in /proc/mounts
  2013-02-05 20:10 ` William Hubbs
@ 2013-02-05 21:45   ` Stephen Rothwell
  2013-02-05 23:36     ` William Hubbs
  0 siblings, 1 reply; 22+ messages in thread
From: Stephen Rothwell @ 2013-02-05 21:45 UTC (permalink / raw)
  To: William Hubbs; +Cc: linux-next, mpagano

[-- Attachment #1: Type: text/plain, Size: 526 bytes --]

Hi William,

On Tue, 5 Feb 2013 14:10:35 -0600 William Hubbs <w.d.hubbs@gmail.com> wrote:
>
> this patch was originally sent to linux-kernel, but I was told it might
> be better to send it to this list since this section of the kernel does
> not have a specific maintainer.

You were misinformed.  The linux-next list is for discussion of things
about the linux-next releases and not for general development.
linux-kernel was the right place.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH] init: fix name of root device in /proc/mounts
  2013-02-05 21:45   ` Stephen Rothwell
@ 2013-02-05 23:36     ` William Hubbs
  0 siblings, 0 replies; 22+ messages in thread
From: William Hubbs @ 2013-02-05 23:36 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linux-next, mpagano

[-- Attachment #1: Type: text/plain, Size: 653 bytes --]

On Wed, Feb 06, 2013 at 08:45:46AM +1100, Stephen Rothwell wrote:
> Hi William,
> 
> On Tue, 5 Feb 2013 14:10:35 -0600 William Hubbs <w.d.hubbs@gmail.com> wrote:
> >
> > this patch was originally sent to linux-kernel, but I was told it might
> > be better to send it to this list since this section of the kernel does
> > not have a specific maintainer.
> 
> You were misinformed.  The linux-next list is for discussion of things
> about the linux-next releases and not for general development.
> linux-kernel was the right place.

Ok, no problem, I'll just wait for responses from there. Sorry about the
noise on this list.

William


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH] init: fix name of root device in /proc/mounts
  2013-03-20 21:11               ` William Hubbs
  2013-03-20 21:46                 ` Kay Sievers
@ 2013-03-22  3:00                 ` Rob Landley
  1 sibling, 0 replies; 22+ messages in thread
From: Rob Landley @ 2013-03-22  3:00 UTC (permalink / raw)
  To: William Hubbs
  Cc: H. Peter Anvin, linux-kernel, mpagano, ryao, gregkh, torvalds, w.d.hubbs

On 03/20/2013 04:11:25 PM, William Hubbs wrote:
> On Wed, Mar 20, 2013 at 02:03:20AM -0500, Rob Landley wrote:
> > On 03/19/2013 07:20:17 PM, William Hubbs wrote:
> > > On Tue, Mar 19, 2013 at 04:17:11PM -0700, H. Peter Anvin wrote:
> > > > On 03/19/2013 03:28 PM, William Hubbs wrote:
> > > > > The issue is that /dev/root appears in /proc/mounts if you do  
> not
> > > > > boot with an initramfs, but /dev/root is not a device node.  
> In the
> > > > > past, udev created a symbolic link from /dev/root to the
> > > > > appropriate block device, but it does not do this any longer.
> > > Also,
> > > > > devtmpfs does not create this symbolic link.
> > > > >
> > > > > This is causing bugs with software that depends on the  
> existence
> > > > > of /dev/root [2] for example.
> > > >
> > > > Seems okay to me, although even better would be to use the udev  
> name
> > > > of the device in question.
> > >
> > > I'm not following what you mean.
> > >
> > > The problem is that "/dev/root" should not be in /proc/mounts,
> > > since there is always another entry that points to the root
> > > file system.
> >
> > What gave you that idea?
> >
> > wget http://landley.net/aboriginal/bin/system-image-i686.tar.bz2
> > extract it and ./run-emulator.sh and in there:
> >
> > (i686:1) /home # cat /proc/mounts
> > rootfs / rootfs rw 0 0
> > /dev/root / squashfs ro,relatime 0 0
> > proc /proc proc rw,relatime 0 0
> > sys /sys sysfs rw,relatime 0 0
> > dev /dev devtmpfs rw,relatime,size=63072k,nr_inodes=15768,mode=755  
> 0 0
> > dev/pts /dev/pts devpts rw,relatime,mode=600 0 0
> > /tmp /tmp tmpfs rw,relatime 0 0
> > /home /home tmpfs rw,relatime 0 0
> >
> > Userspace can totally determine what /dev/root points to, I made  
> mdev
> > do it in 2006 (udev started doing so shortly thereafter). Busybox  
> git
> > commit a7e3d052.:4
> 
> There are situations where it doesn't work though -- suppose that root
> is btrfs for example.

So you're saying there's a bug in btrfs?

> Also, the other message that answered you is correct, the udev
> maintainers say we should not be relying on /dev/root at all so to  
> make
> it work distro packagers have to add a rule themselves.

These udev maintainers?

   http://lkml.indiana.edu/hypermail/linux/kernel/1210.0/01889.html

This is the udev that got Katamari'd into systemd, not one of the forks  
that ran screaming trying not to get sucked into the latest escapade of  
King of All Cosmos?

Look, if you want to add /dev/root to devtmpfs, that makes a certain  
amount of sense. But your patch seems to have missed do_mounts.c doing:

   if (strncmp(root_device_name, "/dev/", 5) == 0)
     root_device_name += 5;

Which means that if the user does "root=sda1" on the kernel command  
line you're not passing an absolute path to create_dev():

-	create_dev("/dev/root", ROOT_DEV);
-	mount_block_root("/dev/root", root_mountflags);
+	if (saved_root_name[0]) {
+		create_dev(saved_root_name, ROOT_DEV);

And last I checked that means /proc/mounts will have a relative path in  
it...

I.E. you're modifying kernel code you're not familiar with to fix a  
non-problem caused by your unfamiliarity with the corresponding  
userspace code. I'm really not seeing the upside here.

Rob

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

* Re: [PATCH] init: fix name of root device in /proc/mounts
  2013-03-20 21:11               ` William Hubbs
@ 2013-03-20 21:46                 ` Kay Sievers
  2013-03-22  3:00                 ` Rob Landley
  1 sibling, 0 replies; 22+ messages in thread
From: Kay Sievers @ 2013-03-20 21:46 UTC (permalink / raw)
  To: William Hubbs
  Cc: Rob Landley, H. Peter Anvin, linux-kernel, mpagano, ryao, gregkh,
	torvalds, w.d.hubbs

On Wed, Mar 20, 2013 at 10:11 PM, William Hubbs <williamh@gentoo.org> wrote:
> On Wed, Mar 20, 2013 at 02:03:20AM -0500, Rob Landley wrote:
>> On 03/19/2013 07:20:17 PM, William Hubbs wrote:
>> > On Tue, Mar 19, 2013 at 04:17:11PM -0700, H. Peter Anvin wrote:
>> > > On 03/19/2013 03:28 PM, William Hubbs wrote:
>> > > > The issue is that /dev/root appears in /proc/mounts if you do not
>> > > > boot with an initramfs, but /dev/root is not a device node. In the
>> > > > past, udev created a symbolic link from /dev/root to the
>> > > > appropriate block device, but it does not do this any longer.
>> > Also,
>> > > > devtmpfs does not create this symbolic link.
>> > > >
>> > > > This is causing bugs with software that depends on the existence
>> > > > of /dev/root [2] for example.
>> > >
>> > > Seems okay to me, although even better would be to use the udev name
>> > > of the device in question.
>> >
>> > I'm not following what you mean.
>> >
>> > The problem is that "/dev/root" should not be in /proc/mounts,
>> > since there is always another entry that points to the root
>> > file system.
>>
>> What gave you that idea?
>>
>> wget http://landley.net/aboriginal/bin/system-image-i686.tar.bz2
>> extract it and ./run-emulator.sh and in there:
>>
>> (i686:1) /home # cat /proc/mounts
>> rootfs / rootfs rw 0 0
>> /dev/root / squashfs ro,relatime 0 0
>> proc /proc proc rw,relatime 0 0
>> sys /sys sysfs rw,relatime 0 0
>> dev /dev devtmpfs rw,relatime,size=63072k,nr_inodes=15768,mode=755 0 0
>> dev/pts /dev/pts devpts rw,relatime,mode=600 0 0
>> /tmp /tmp tmpfs rw,relatime 0 0
>> /home /home tmpfs rw,relatime 0 0
>>
>> Userspace can totally determine what /dev/root points to, I made mdev
>> do it in 2006 (udev started doing so shortly thereafter). Busybox git
>> commit a7e3d052.:4
>
> There are situations where it doesn't work though -- suppose that root
> is btrfs for example.
>
> Also, the other message that answered you is correct, the udev
> maintainers say we should not be relying on /dev/root at all so to make
> it work distro packagers have to add a rule themselves.
>
> Kay,
>
> if you are reading, can you jump in and explain why /dev/root is a bad
> idea?

stat("/") is just the better approach for tools to find out what
"root" is, there is not much point in doing symlinks here just because
the kernel uses that name to mount internally.

/dev/root was never part of the default udev setup, it happened in the
distros init scripts, and only some distributions added that.

Newer filesystems like btrfs do not have an 1:1 fs:device relation
anyway, there cannot be a /dev/root symlink anymore, so tools need to
catch up here anyway, and the sooner the better. /dev/root is a
concept that will probably no longer exist in the future, because
filesystems will work differently than they used to.

As Peter said, the kernel should internally just use the name of the
kernel block device instead of inventing and exporting the name of an
artificial /dev/root node, which does not exist later in the real
system.

Kay

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

* Re: [PATCH] init: fix name of root device in /proc/mounts
  2013-03-20  7:03             ` Rob Landley
  2013-03-20 15:02               ` H. Peter Anvin
@ 2013-03-20 21:11               ` William Hubbs
  2013-03-20 21:46                 ` Kay Sievers
  2013-03-22  3:00                 ` Rob Landley
  1 sibling, 2 replies; 22+ messages in thread
From: William Hubbs @ 2013-03-20 21:11 UTC (permalink / raw)
  To: Rob Landley
  Cc: H. Peter Anvin, linux-kernel, mpagano, ryao, gregkh, torvalds,
	w.d.hubbs, kay

[-- Attachment #1: Type: text/plain, Size: 2138 bytes --]

On Wed, Mar 20, 2013 at 02:03:20AM -0500, Rob Landley wrote:
> On 03/19/2013 07:20:17 PM, William Hubbs wrote:
> > On Tue, Mar 19, 2013 at 04:17:11PM -0700, H. Peter Anvin wrote:
> > > On 03/19/2013 03:28 PM, William Hubbs wrote:
> > > > The issue is that /dev/root appears in /proc/mounts if you do not
> > > > boot with an initramfs, but /dev/root is not a device node. In the
> > > > past, udev created a symbolic link from /dev/root to the
> > > > appropriate block device, but it does not do this any longer.  
> > Also,
> > > > devtmpfs does not create this symbolic link.
> > > >
> > > > This is causing bugs with software that depends on the existence
> > > > of /dev/root [2] for example.
> > >
> > > Seems okay to me, although even better would be to use the udev name
> > > of the device in question.
> > 
> > I'm not following what you mean.
> > 
> > The problem is that "/dev/root" should not be in /proc/mounts,
> > since there is always another entry that points to the root
> > file system.
> 
> What gave you that idea?
> 
> wget http://landley.net/aboriginal/bin/system-image-i686.tar.bz2
> extract it and ./run-emulator.sh and in there:
> 
> (i686:1) /home # cat /proc/mounts
> rootfs / rootfs rw 0 0
> /dev/root / squashfs ro,relatime 0 0
> proc /proc proc rw,relatime 0 0
> sys /sys sysfs rw,relatime 0 0
> dev /dev devtmpfs rw,relatime,size=63072k,nr_inodes=15768,mode=755 0 0
> dev/pts /dev/pts devpts rw,relatime,mode=600 0 0
> /tmp /tmp tmpfs rw,relatime 0 0
> /home /home tmpfs rw,relatime 0 0
> 
> Userspace can totally determine what /dev/root points to, I made mdev  
> do it in 2006 (udev started doing so shortly thereafter). Busybox git  
> commit a7e3d052.:4

There are situations where it doesn't work though -- suppose that root
is btrfs for example.

Also, the other message that answered you is correct, the udev
maintainers say we should not be relying on /dev/root at all so to make
it work distro packagers have to add a rule themselves.

Kay,

if you are reading, canyou jump in and explain why /dev/root is a bad
idea?

Thanks,

William


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH] init: fix name of root device in /proc/mounts
  2013-03-20  7:03             ` Rob Landley
@ 2013-03-20 15:02               ` H. Peter Anvin
  2013-03-20 21:11               ` William Hubbs
  1 sibling, 0 replies; 22+ messages in thread
From: H. Peter Anvin @ 2013-03-20 15:02 UTC (permalink / raw)
  To: Rob Landley, William Hubbs; +Cc: linux-kernel, mpagano, ryao, gregkh, torvalds

Yes, but the current udev maintainer refuses to.

Rob Landley <rob@landley.net> wrote:

>On 03/19/2013 07:20:17 PM, William Hubbs wrote:
>> On Tue, Mar 19, 2013 at 04:17:11PM -0700, H. Peter Anvin wrote:
>> > On 03/19/2013 03:28 PM, William Hubbs wrote:
>> > > The issue is that /dev/root appears in /proc/mounts if you do not
>> > > boot with an initramfs, but /dev/root is not a device node. In
>the
>> > > past, udev created a symbolic link from /dev/root to the
>> > > appropriate block device, but it does not do this any longer.  
>> Also,
>> > > devtmpfs does not create this symbolic link.
>> > >
>> > > This is causing bugs with software that depends on the existence
>> > > of /dev/root [2] for example.
>> >
>> > Seems okay to me, although even better would be to use the udev
>name
>> > of the device in question.
>> 
>> I'm not following what you mean.
>> 
>> The problem is that "/dev/root" should not be in /proc/mounts,
>> since there is always another entry that points to the root
>> file system.
>
>What gave you that idea?
>
>wget http://landley.net/aboriginal/bin/system-image-i686.tar.bz2
>extract it and ./run-emulator.sh and in there:
>
>(i686:1) /home # cat /proc/mounts
>rootfs / rootfs rw 0 0
>/dev/root / squashfs ro,relatime 0 0
>proc /proc proc rw,relatime 0 0
>sys /sys sysfs rw,relatime 0 0
>dev /dev devtmpfs rw,relatime,size=63072k,nr_inodes=15768,mode=755 0 0
>dev/pts /dev/pts devpts rw,relatime,mode=600 0 0
>/tmp /tmp tmpfs rw,relatime 0 0
>/home /home tmpfs rw,relatime 0 0
>
>Userspace can totally determine what /dev/root points to, I made mdev  
>do it in 2006 (udev started doing so shortly thereafter). Busybox git  
>commit a7e3d052.
>
>Heck, the userspace "stat /" command says "Device: 801h" and /dev/sda1 
>
>is 08:01 on my netbook.
>
>Rob

-- 
Sent from my mobile phone. Please excuse brevity and lack of formatting.

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

* Re: [PATCH] init: fix name of root device in /proc/mounts
  2013-03-20  0:20           ` William Hubbs
  2013-03-20  0:24             ` H. Peter Anvin
@ 2013-03-20  7:03             ` Rob Landley
  2013-03-20 15:02               ` H. Peter Anvin
  2013-03-20 21:11               ` William Hubbs
  1 sibling, 2 replies; 22+ messages in thread
From: Rob Landley @ 2013-03-20  7:03 UTC (permalink / raw)
  To: William Hubbs
  Cc: H. Peter Anvin, linux-kernel, mpagano, ryao, gregkh, torvalds

On 03/19/2013 07:20:17 PM, William Hubbs wrote:
> On Tue, Mar 19, 2013 at 04:17:11PM -0700, H. Peter Anvin wrote:
> > On 03/19/2013 03:28 PM, William Hubbs wrote:
> > > The issue is that /dev/root appears in /proc/mounts if you do not
> > > boot with an initramfs, but /dev/root is not a device node. In the
> > > past, udev created a symbolic link from /dev/root to the
> > > appropriate block device, but it does not do this any longer.  
> Also,
> > > devtmpfs does not create this symbolic link.
> > >
> > > This is causing bugs with software that depends on the existence
> > > of /dev/root [2] for example.
> >
> > Seems okay to me, although even better would be to use the udev name
> > of the device in question.
> 
> I'm not following what you mean.
> 
> The problem is that "/dev/root" should not be in /proc/mounts,
> since there is always another entry that points to the root
> file system.

What gave you that idea?

wget http://landley.net/aboriginal/bin/system-image-i686.tar.bz2
extract it and ./run-emulator.sh and in there:

(i686:1) /home # cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / squashfs ro,relatime 0 0
proc /proc proc rw,relatime 0 0
sys /sys sysfs rw,relatime 0 0
dev /dev devtmpfs rw,relatime,size=63072k,nr_inodes=15768,mode=755 0 0
dev/pts /dev/pts devpts rw,relatime,mode=600 0 0
/tmp /tmp tmpfs rw,relatime 0 0
/home /home tmpfs rw,relatime 0 0

Userspace can totally determine what /dev/root points to, I made mdev  
do it in 2006 (udev started doing so shortly thereafter). Busybox git  
commit a7e3d052.

Heck, the userspace "stat /" command says "Device: 801h" and /dev/sda1  
is 08:01 on my netbook.

Rob

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

* Re: [PATCH] init: fix name of root device in /proc/mounts
  2013-03-20  0:20           ` William Hubbs
@ 2013-03-20  0:24             ` H. Peter Anvin
  2013-03-20  7:03             ` Rob Landley
  1 sibling, 0 replies; 22+ messages in thread
From: H. Peter Anvin @ 2013-03-20  0:24 UTC (permalink / raw)
  To: William Hubbs; +Cc: linux-kernel, rob, mpagano, ryao, gregkh, torvalds

On 03/19/2013 05:20 PM, William Hubbs wrote:
> 
> I'm not following what you mean.
> 
> The problem is that "/dev/root" should not be in /proc/mounts, 
> since there is always another entry that points to the root file
> system.
> 

You are getting the name from the root= command line option.

The other option is to take the name from the mounted device number,
and look up the udev name (which is known by the kernel).  That way it
works even if the user specifies a numeric device, or the default
device is used.

	-hpa


-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


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

* Re: [PATCH] init: fix name of root device in /proc/mounts
  2013-03-19 23:17         ` H. Peter Anvin
@ 2013-03-20  0:20           ` William Hubbs
  2013-03-20  0:24             ` H. Peter Anvin
  2013-03-20  7:03             ` Rob Landley
  0 siblings, 2 replies; 22+ messages in thread
From: William Hubbs @ 2013-03-20  0:20 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: linux-kernel, rob, mpagano, ryao, gregkh, torvalds

[-- Attachment #1: Type: text/plain, Size: 848 bytes --]

On Tue, Mar 19, 2013 at 04:17:11PM -0700, H. Peter Anvin wrote:
> On 03/19/2013 03:28 PM, William Hubbs wrote:
> > The issue is that /dev/root appears in /proc/mounts if you do not
> > boot with an initramfs, but /dev/root is not a device node. In the
> > past, udev created a symbolic link from /dev/root to the
> > appropriate block device, but it does not do this any longer. Also,
> > devtmpfs does not create this symbolic link.
> > 
> > This is causing bugs with software that depends on the existence
> > of /dev/root [2] for example.
> 
> Seems okay to me, although even better would be to use the udev name
> of the device in question.

I'm not following what you mean.

The problem is that "/dev/root" should not be in /proc/mounts,
since there is always another entry that points to the root
file system.

William


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH] init: fix name of root device in /proc/mounts
  2013-03-19 22:28       ` William Hubbs
@ 2013-03-19 23:17         ` H. Peter Anvin
  2013-03-20  0:20           ` William Hubbs
  0 siblings, 1 reply; 22+ messages in thread
From: H. Peter Anvin @ 2013-03-19 23:17 UTC (permalink / raw)
  To: William Hubbs
  Cc: linux-kernel, w.d.hubbs, rob, mpagano, ryao, gregkh, torvalds

On 03/19/2013 03:28 PM, William Hubbs wrote:
> All,
> 
> I haven't heard any more on this patch, so I wanted to ping the
> thread again and find out the status.
> 
> The original message is linked below[1].
> 
> The issue is that /dev/root appears in /proc/mounts if you do not
> boot with an initramfs, but /dev/root is not a device node. In the
> past, udev created a symbolic link from /dev/root to the
> appropriate block device, but it does not do this any longer. Also,
> devtmpfs does not create this symbolic link.
> 
> This is causing bugs with software that depends on the existence
> of /dev/root [2] for example.
> 
> Do you need any more information on this patch, or is there some
> reason it can't go in?
> 

Seems okay to me, although even better would be to use the udev name
of the device in question.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


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

* Re: [PATCH] init: fix name of root device in /proc/mounts
  2013-02-05  2:54     ` H. Peter Anvin
  2013-02-05  4:19       ` William Hubbs
  2013-03-17 22:23       ` William Hubbs
@ 2013-03-19 22:28       ` William Hubbs
  2013-03-19 23:17         ` H. Peter Anvin
  2 siblings, 1 reply; 22+ messages in thread
From: William Hubbs @ 2013-03-19 22:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: w.d.hubbs, hpa, rob, mpagano, ryao, gregkh, torvalds

[-- Attachment #1: Type: text/plain, Size: 754 bytes --]

All,

I haven't heard any more on this patch, so I wanted to ping the thread
again and find out the status.

The original message is linked below[1].

The issue is that /dev/root appears in /proc/mounts if you do not boot
with an initramfs, but /dev/root is not a device node. In the past, udev
created a symbolic link from /dev/root to the appropriate block device,
but it does not do this any longer. Also, devtmpfs does not create this
symbolic link.

This is causing bugs with software that depends on the existence of
/dev/root [2] for example.

Do you need any more information on this patch, or is there some reason
it can't go in?

Thanks much,

William

[1] https://lkml.org/lkml/2013/1/31/574
[2] https://bugs.gentoo.org/show_bug.cgi?id=438028

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH] init: fix name of root device in /proc/mounts
  2013-02-05  2:54     ` H. Peter Anvin
  2013-02-05  4:19       ` William Hubbs
@ 2013-03-17 22:23       ` William Hubbs
  2013-03-19 22:28       ` William Hubbs
  2 siblings, 0 replies; 22+ messages in thread
From: William Hubbs @ 2013-03-17 22:23 UTC (permalink / raw)
  To: linux-kernel
  Cc: w.d.hubbs, H. Peter Anvin, Rob Landley, mpagano, ryao,
	gregkh@gentoo.org Linus Torvalds

[-- Attachment #1: Type: text/plain, Size: 754 bytes --]

All,

I haven't heard any more on this patch, so I wanted to ping the thread
again and find out the status.

The original message is linked below[1].

The issue is that /dev/root appears in /proc/mounts if you do not boot
with an initramfs, but /dev/root is not a device node. In the past, udev
created a symbolic link from /dev/root to the appropriate block device,
but it does not do this any longer. Also, devtmpfs does not create this
symbolic link.

This is causing bugs with software that depends on the existence of
/dev/root [2] for example.

Do you need any more information on this patch, or is there some reason
it can't go in?

Thanks much,

William

[1] https://lkml.org/lkml/2013/1/31/574
[2] https://bugs.gentoo.org/show_bug.cgi?id=438028

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH] init: fix name of root device in /proc/mounts
  2013-01-31 22:51 William Hubbs
  2013-01-31 23:22 ` H. Peter Anvin
@ 2013-02-09 21:32 ` William Hubbs
  1 sibling, 0 replies; 22+ messages in thread
From: William Hubbs @ 2013-02-09 21:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: mpagano, w.d.hubbs

[-- Attachment #1: Type: text/plain, Size: 1024 bytes --]

On Thu, Jan 31, 2013 at 04:51:39PM -0600, 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.

I want to follow up on this patch since I haven't heard anything for a
while.

Again, the basic problem I am trying to address is that /dev/root is not
a valid device (there isn't a device node for it in devtmpfs and udev
doesn't create a symlink for it), so it should not appear in
/proc/mounts, but currently it does if you boot a system without an
initramfs.

Are there any more questions or concerns about this patch? If not, what
is the status for getting it, or another fix for this issue, committed?

Thanks much,

William


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH] init: fix name of root device in /proc/mounts
  2013-02-05  2:54     ` H. Peter Anvin
@ 2013-02-05  4:19       ` William Hubbs
  2013-03-17 22:23       ` William Hubbs
  2013-03-19 22:28       ` William Hubbs
  2 siblings, 0 replies; 22+ messages in thread
From: William Hubbs @ 2013-02-05  4:19 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Rob Landley, linux-kernel, mpagano

[-- Attachment #1: Type: text/plain, Size: 2094 bytes --]

On Mon, Feb 04, 2013 at 06:54:32PM -0800, H. Peter Anvin wrote:
> The difference is that it used to be customary to have a /dev/root symlink; iirc udev created one.  Devtmpfs does not (for largely valid reasons, but it does break some userspaces.)

Correct. The /dev/root symlink is not created any longer. If you boot
with an initramfs this path does not show up in /proc/mounts. If you
boot without one, however, it does.

This patch just makes the /dev/root path not show up at all in
/proc/mounts, regardless of whether an initramfs is used.

Thanks,

William

> Rob Landley <rob@landley.net> wrote:
> 
> >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@gmail.com>
> >> 
> >> 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
> 
> -- 
> Sent from my mobile phone. Please excuse brevity and lack of formatting.

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH] init: fix name of root device in /proc/mounts
  2013-02-05  2:42   ` Rob Landley
@ 2013-02-05  2:54     ` H. Peter Anvin
  2013-02-05  4:19       ` William Hubbs
                         ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: H. Peter Anvin @ 2013-02-05  2:54 UTC (permalink / raw)
  To: Rob Landley; +Cc: William Hubbs, linux-kernel, mpagano

The difference is that it used to be customary to have a /dev/root symlink; iirc udev created one.  Devtmpfs does not (for largely valid reasons, but it does break some userspaces.)

Rob Landley <rob@landley.net> wrote:

>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@gmail.com>
>> 
>> 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

-- 
Sent from my mobile phone. Please excuse brevity and lack of formatting.

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

* Re: [PATCH] init: fix name of root device in /proc/mounts
  2013-01-31 23:22 ` H. Peter Anvin
  2013-02-01 17:14   ` William Hubbs
@ 2013-02-05  2:42   ` Rob Landley
  2013-02-05  2:54     ` H. Peter Anvin
  1 sibling, 1 reply; 22+ messages in thread
From: Rob Landley @ 2013-02-05  2:42 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: William Hubbs, linux-kernel, mpagano

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@gmail.com>
> 
> 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

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

* Re: [PATCH] init: fix name of root device in /proc/mounts
  2013-02-01 17:14   ` William Hubbs
@ 2013-02-01 19:03     ` H. Peter Anvin
  0 siblings, 0 replies; 22+ messages in thread
From: H. Peter Anvin @ 2013-02-01 19:03 UTC (permalink / raw)
  To: William Hubbs; +Cc: linux-kernel, mpagano

On 02/01/2013 09:14 AM, William Hubbs wrote:
> On Thu, Jan 31, 2013 at 03:22:09PM -0800, 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@gmail.com>
>>
>> Let me also point out that most of the time, the kernel actually has a
>> udev device name for an actual device...
>
> I'm not sure what you mean. If you mean /dev/root is not an actual
> device and should not be listed in /proc/mounts, that is correct and
> that is why I am proposing this patch.
>

What I meant is that even if you *don't* specify a root= device the 
modern kernel will generally have a usable name.

	-hpa


-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


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

* Re: [PATCH] init: fix name of root device in /proc/mounts
  2013-01-31 23:22 ` H. Peter Anvin
@ 2013-02-01 17:14   ` William Hubbs
  2013-02-01 19:03     ` H. Peter Anvin
  2013-02-05  2:42   ` Rob Landley
  1 sibling, 1 reply; 22+ messages in thread
From: William Hubbs @ 2013-02-01 17:14 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: linux-kernel, mpagano

[-- Attachment #1: Type: text/plain, Size: 917 bytes --]

On Thu, Jan 31, 2013 at 03:22:09PM -0800, 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@gmail.com>
> 
> Let me also point out that most of the time, the kernel actually has a
> udev device name for an actual device...

I'm not sure what you mean. If you mean /dev/root is not an actual
device and should not be listed in /proc/mounts, that is correct and
that is why I am proposing this patch.

William


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH] init: fix name of root device in /proc/mounts
  2013-01-31 22:51 William Hubbs
@ 2013-01-31 23:22 ` H. Peter Anvin
  2013-02-01 17:14   ` William Hubbs
  2013-02-05  2:42   ` Rob Landley
  2013-02-09 21:32 ` William Hubbs
  1 sibling, 2 replies; 22+ messages in thread
From: H. Peter Anvin @ 2013-01-31 23:22 UTC (permalink / raw)
  To: William Hubbs; +Cc: linux-kernel, mpagano

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@gmail.com>

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

	-hpa



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

* [PATCH] init: fix name of root device in /proc/mounts
@ 2013-01-31 22:51 William Hubbs
  2013-01-31 23:22 ` H. Peter Anvin
  2013-02-09 21:32 ` William Hubbs
  0 siblings, 2 replies; 22+ messages in thread
From: William Hubbs @ 2013-01-31 22:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: mpagano, William Hubbs

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@gmail.com>
---
 init/do_mounts.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/init/do_mounts.c b/init/do_mounts.c
index 1d1b634..efc37d2 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -480,7 +480,10 @@ void __init change_floppy(char *fmt, ...)
 	va_start(args, fmt);
 	vsprintf(buf, fmt, args);
 	va_end(args);
-	fd = sys_open("/dev/root", O_RDWR | O_NDELAY, 0);
+	if (saved_root_name[0])
+		fd = sys_open(saved_root_name, O_RDWR | O_NDELAY, 0);
+	else
+		fd = sys_open("/dev/root", O_RDWR | O_NDELAY, 0);
 	if (fd >= 0) {
 		sys_ioctl(fd, FDEJECT, 0);
 		sys_close(fd);
@@ -523,8 +526,13 @@ void __init mount_root(void)
 	}
 #endif
 #ifdef CONFIG_BLOCK
-	create_dev("/dev/root", ROOT_DEV);
-	mount_block_root("/dev/root", root_mountflags);
+	if (saved_root_name[0]) {
+		create_dev(saved_root_name, ROOT_DEV);
+		mount_block_root(saved_root_name, root_mountflags);
+	} else {
+		create_dev("/dev/root", ROOT_DEV);
+		mount_block_root("/dev/root", root_mountflags);
+	}
 #endif
 }
 
-- 
1.7.12.4


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

end of thread, other threads:[~2013-03-22  3:00 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-05 20:07 [PATCH] init: fix name of root device in /proc/mounts William Hubbs
2013-02-05 20:10 ` William Hubbs
2013-02-05 21:45   ` Stephen Rothwell
2013-02-05 23:36     ` William Hubbs
  -- strict thread matches above, loose matches on Subject: below --
2013-01-31 22:51 William Hubbs
2013-01-31 23:22 ` H. Peter Anvin
2013-02-01 17:14   ` William Hubbs
2013-02-01 19:03     ` H. Peter Anvin
2013-02-05  2:42   ` Rob Landley
2013-02-05  2:54     ` H. Peter Anvin
2013-02-05  4:19       ` William Hubbs
2013-03-17 22:23       ` William Hubbs
2013-03-19 22:28       ` William Hubbs
2013-03-19 23:17         ` H. Peter Anvin
2013-03-20  0:20           ` William Hubbs
2013-03-20  0:24             ` H. Peter Anvin
2013-03-20  7:03             ` Rob Landley
2013-03-20 15:02               ` H. Peter Anvin
2013-03-20 21:11               ` William Hubbs
2013-03-20 21:46                 ` Kay Sievers
2013-03-22  3:00                 ` Rob Landley
2013-02-09 21:32 ` William Hubbs

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.