Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 614190 - >=sys-kernel/gentoo-sources-3.10: dev-root-proc-mount-fix patch breaks root on HP cciss controllers
Summary: >=sys-kernel/gentoo-sources-3.10: dev-root-proc-mount-fix patch breaks root o...
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-29 08:23 UTC by Hector Martin
Modified: 2018-06-14 12:23 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hector Martin 2017-03-29 08:23:13 UTC
This patch (present in all branches of gentoo-sources since at least 3.10) attempts to change the root device node from /dev/root to the device specified in the root= kernel commandline option:

https://dev.gentoo.org/~mpagano/genpatches/trunk/4.11/2900_dev-root-proc-mount-fix.patch

This breaks if the root device is in a subdirectory, e.g. /dev/<dir>/<node>, as the directory does not exist and create_dev() fails. This is the case with older HP RAID controllers using the cciss driver, which creates device nodes of the form /dev/cciss/*. This breaks direct root boot on servers with those controllers.

If I may ask, what is the rationale for this patch? I understand that /proc/mounts will list the rootfs as /dev/root if booting directly without an initramfs; this is clearly intended upstream behavior. udev creates /dev/root as a symlink to the proper device. /bin/mount knows how to deal with /dev/root and shows the true device. Why patch the kernel? If userspace tools don't know how to deal with /dev/root then that's clearly a bug in those tools that also would affect other distros; changing kernel behavior is just bound to create obscure bugs like this (and bug 467266, and probably other obscure corner cases).
Comment 1 BobbyK 2017-04-02 15:11:33 UTC
bug 438380 looks like a good candidate for the origin of the patch. bug 467266 appears to be a tweak restoring default kernel behaviour (int err = create_dev("/dev/root", ROOT_DEV);) for systems without an initramfs using root=PARTUUID type syntax on the kernel commandline.  

Perhaps cciss users are another case where default behaviour would be advantageous.  While it might not be elegant, something like:

if (saved_root_name[0] == '/' && 
    ((int)(strrchr(saved_root_name, '/') - saved_root_name)) == 4
    ) {

should do the trick.

An alternative could be creating intermediate directories between /dev and the root "node".
Comment 2 Hector Martin 2017-04-02 18:45:38 UTC
Well, it doesn't make much sense to force the change except for some drivers. Ultimately, either the patch makes sense -in which case it should be upstreamed, and fixed to work for all drivers including creating subdirectories- or it doesn't -in which case it should be dropped.

In general I have a bad vibe about patching such core parts of the kernel without a *very* good excuse. The discussion is several years old; userspace these days seems to work with /dev/root fine. I don't think Gentoo should patch the kernel unless it is to fix bugs that do not change the userspace interface, or to add features useful to Gentoo. This change is something that affects every distro; there shouldn't be a need to have a one-off patch in Gentoo if other distros don't need it.
Comment 3 Mike Pagano gentoo-dev 2017-04-12 11:28:01 UTC
bug #438380 is the origin of this patch.  The question is, will the affected packages in that bug break without this patch, will ones we don't know about break or are we so far in the future these packages have since handled this?

If someone wants to submit a fix for this patch, I will review and commit.
Comment 4 Hector Martin 2017-04-26 22:59:53 UTC
Honestly, it's not at all clear to me from that old bug (and associated ones) what kinds of breakage we're looking for without the patch. There were some mentions of quota, but I'm not sure exactly what to test. Either way, since /dev/root *does* actually get created by udev, nothing should be breaking if it just naively opens /dev/root.

I'll be happy to test any specific issues that were previously problematic with /dev/root. If we can't find anything broken I think the logical course of action would be to just remove the patch.
Comment 5 Mike Pagano gentoo-dev 2018-06-14 12:23:11 UTC
This patch is no longer part of gentoo-sources as of kernels >= 4.17.