Skip to contentSkip to conversation

init: fix name of root device in /proc/mounts

PATCH In review William Hubbs 2 participants 4 messages Feb 5, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 init: fix name of root device in /proc/mounts

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.

---
 init/do_mounts.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
init/do_mounts.c +11 -3
index 1d1b634..efc37d2 100644
@@ -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
 }
 
Signature · 1 line
1.7.12.4
#1 lore raw

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

#2 lore raw

Hi William,

Quoted 4 lines · On Tue, 5 Feb 2013 14:10:35 -0600 William Hubbs <[email protected]> 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.

Signature · 2 lines
Cheers,
Stephen Rothwell                    [email protected]
#3 lore raw
Quoted 11 lines · Stephen Rothwell

Hi William,

Quoted 4 lines · On Tue, 5 Feb 2013 14:10:35 -0600 William Hubbs <[email protected]> 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