Bug 509687 - Boot (still) fails if initrd/init mkrootdev has norelatime option.
Boot (still) fails if initrd/init mkrootdev has norelatime option.
Product: Fedora
Classification: Fedora
Component: mkinitrd (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: Peter Jones
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2009-07-05 01:49 EDT by Bruce Jerrick
Modified: 2009-07-06 05:06 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-07-06 05:06:38 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Steps to reproduce nash/norelatime bug, with results. (1.34 KB, text/plain)
2009-07-05 01:49 EDT, Bruce Jerrick
no flags Details

  None (edit)
Description Bruce Jerrick 2009-07-05 01:49:16 EDT
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:

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 05:06:38 EDT
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:

Note You need to log in before you can comment on or make changes to this bug.