Bug 509687

Summary: Boot (still) fails if initrd/init mkrootdev has norelatime option.
Product: [Fedora] Fedora Reporter: Bruce Jerrick <bmj001>
Component: mkinitrdAssignee: Peter Jones <pjones>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 11CC: hdegoede, katzj, pjones, wtogami
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-07-06 09:06:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Steps to reproduce nash/norelatime bug, with results. none

Description Bruce Jerrick 2009-07-05 05:49:16 UTC
Created attachment 350526 [details]
Steps to reproduce nash/norelatime bug, with results.

Description of problem:
Boot fails if the mkrootdev entry in initrd/init has the norelatime
option (as it will after a mkinitrd if the root filesystem entry in
/etc/fstab includes it).
This is deja vu all over again -- nash 'mount' was fixed to handle
"relatime", but still fails for "norelatime".
The good news: The reason (and fix) is fairly simple; read on.

Version-Release number of selected component (if applicable):
nash-6.0.86-2.fc11  (mkinitrd-6.0.86-2.fc11.src.rpm)

How reproducible:
100%

I've put "Steps to Reproduce", etc., into an attachment because it's
all been gone over before, when the problem was caused by "relatime"
(e.g., bz# 296361, 430280, 475495, 478598).

The problem is that nash/nash.c mountCommand() uses MS_MGC_VAL in the
flags arg of mount().  But that's not compatible with the newer mount(2)
flags, which are in the high-order 16 bits.  So when nash.c sees
"norelatime" and clears MS_RELATIME, that clobbers MS_MGC_VAL, and the
mount fails with "Invalid argument".  "relatime" didn't have that
problem, since it set a bit in MS_MGC_VAL that was already set.

The fix is simply to stop using MS_MGC_VAL -- as mount(2) says, it's
no longer required:

--- mkinitrd-6.0.86.orig/nash/nash.c	2009-05-21 12:14:01.000000000 -0700
+++ mkinitrd-6.0.86/nash/nash.c	2009-07-03 04:24:14.000000000 -0700
@@ -314,7 +314,7 @@ mountCommand(char * cmd, char * end)
     char * mntPoint;
     char * opts = NULL;
     int rc = 0;
-    int flags = MS_MGC_VAL;
+    int flags = 0;
     char * newOpts;
 
     if (!(cmd = getArg(cmd, end, &spec))) {

Additional info:
Note that 'man 8 mount' shows norelatime as a legit option, even though
it is broken (relatime is now (ill-advisedly) the default, with no way
to turn that kludge/misfeature/hack off, due to the way the default is
mis-implemented in the kernel).  See Fedora bugzilla #501350 ("no way
to turn off the relatime filesystem mount misfeature").

Comment 1 Hans de Goede 2009-07-06 09:06:38 UTC
Thanks for the patch. I've applied it and it is part of
mkinitrd-6.0.91 which will hit rawhide soon.

Notice that mkinitrd will be replaced with dracut in F-12, and your
time is thus probably better spend testing that and submitting patches
for it, see:
http://fedoraproject.org/wiki/Dracut
http://fedoraproject.org/wiki/Features/Dracut
http://www.harald-hoyer.de/personal/blog/dracut-0.3