* 2.6.0-test3-mm1 and rootflags
@ 2003-08-12 18:55 Valdis.Kletnieks
2003-08-12 21:25 ` Andrew Morton
0 siblings, 1 reply; 8+ messages in thread
From: Valdis.Kletnieks @ 2003-08-12 18:55 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 756 bytes --]
OK.. I'm stumped..
While testing something, I tried to boot with 'rootflags=noatime', and
found the system wouldn't boot, as ext3, ext2, and reiserfs all failed to
recognize the option. Looking at the code in fs/ext3/super.c:parse_options()
and init/do_mounts.c:root_data_setup(), it appears to be impossible
to set any of the filesystem-independent flags via rootflags, which explains
the special-case code for the 'ro' and 'rw' flags. However, there doesn't
seem to be any way to pass nodev, noatime, nodiratime, or any of the other
flags. (And yes, all 3 of those make sense in my environment - it's a laptop
and I don't need atime, and I use devfs so nodev on the root makes sense too).
Am I missing something? Or in fact, is this an non-doable?
[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 2.6.0-test3-mm1 and rootflags
2003-08-12 18:55 2.6.0-test3-mm1 and rootflags Valdis.Kletnieks
@ 2003-08-12 21:25 ` Andrew Morton
2003-08-13 3:41 ` Valdis.Kletnieks
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Morton @ 2003-08-12 21:25 UTC (permalink / raw)
To: Valdis.Kletnieks; +Cc: linux-kernel
Valdis.Kletnieks@vt.edu wrote:
>
> OK.. I'm stumped..
>
> While testing something, I tried to boot with 'rootflags=noatime', and
> found the system wouldn't boot, as ext3, ext2, and reiserfs all failed to
> recognize the option. Looking at the code in fs/ext3/super.c:parse_options()
> and init/do_mounts.c:root_data_setup(), it appears to be impossible
> to set any of the filesystem-independent flags via rootflags, which explains
> the special-case code for the 'ro' and 'rw' flags. However, there doesn't
> seem to be any way to pass nodev, noatime, nodiratime, or any of the other
> flags. (And yes, all 3 of those make sense in my environment - it's a laptop
> and I don't need atime, and I use devfs so nodev on the root makes sense too).
>
The fs-independent options are parsed in user space by mount(8), and are
passed into the kernel as individual bits in a `flags' argument.
So we'd need a new `rootopts=0x0040' thingy to support this. But given
that most things can be set after boot with `mount / -o remount,noatime',
it may not be necessary.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 2.6.0-test3-mm1 and rootflags
2003-08-12 21:25 ` Andrew Morton
@ 2003-08-13 3:41 ` Valdis.Kletnieks
2003-08-13 19:44 ` Valdis.Kletnieks
0 siblings, 1 reply; 8+ messages in thread
From: Valdis.Kletnieks @ 2003-08-13 3:41 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1098 bytes --]
On Tue, 12 Aug 2003 14:25:19 PDT, Andrew Morton said:
> The fs-independent options are parsed in user space by mount(8), and are
> passed into the kernel as individual bits in a `flags' argument.
OK.. that's what I *thought* the code was doing.. ;)
> So we'd need a new `rootopts=0x0040' thingy to support this. But given
> that most things can be set after boot with `mount / -o remount,noatime',
> it may not be necessary.
Can be reset with remount: rdonly, sync, mandlock, atime, diratime.
Can't be reset: nosuid, nodev, noexec, dirsync, and a few others. Of those,
nosuid and noexec seem pointless for a root file system (though they may make
sense if you have a *really* minimal / and separate /bin /sbin /etc filesystems
- I seem to remember one minimalist config trying to get a r/o / so /etc was a
separate mount...), so at least for my current application, nodev is the only
thing I can't get with remounting....
If there's a consensus that a 'rootopts=' would be a Good Thing, I'll write a
patch. If not, I'll just fix the initial value of root_mountflags in init/do_mount.c ;)
[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 2.6.0-test3-mm1 and rootflags
2003-08-13 3:41 ` Valdis.Kletnieks
@ 2003-08-13 19:44 ` Valdis.Kletnieks
2021-06-29 17:20 ` Greg Depoire--Ferrer
2021-06-29 17:20 ` [PATCH] init: add rootopts=%d for rootfs mount flags Greg Depoire--Ferrer
0 siblings, 2 replies; 8+ messages in thread
From: Valdis.Kletnieks @ 2003-08-13 19:44 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 572 bytes --]
On Tue, 12 Aug 2003 23:41:37 EDT, Valdis.Kletnieks@vt.edu said:
> If there's a consensus that a 'rootopts=' would be a Good Thing, I'll write a
> patch. If not, I'll just fix the initial value of root_mountflags in init/do_mount.c ;)
OK.. I'm a dork. ;)
Turns out that root_mountflags (at least in *my* config) ends up applying to
the initrd root - so to do what I *wanted* to do I needed to fix the 'mount'
command in /linuxrc:
echo Mounting root filesystem
mount -o noatime,nodev --ro -t ext3 /dev/rootvg/root /sysroot
pivot_root /sysroot /sysroot/initrd
D'oh! :)
[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 2.6.0-test3-mm1 and rootflags
2003-08-13 19:44 ` Valdis.Kletnieks
@ 2021-06-29 17:20 ` Greg Depoire--Ferrer
2021-06-29 19:23 ` Randy Dunlap
2021-06-29 17:20 ` [PATCH] init: add rootopts=%d for rootfs mount flags Greg Depoire--Ferrer
1 sibling, 1 reply; 8+ messages in thread
From: Greg Depoire--Ferrer @ 2021-06-29 17:20 UTC (permalink / raw)
To: linux-kernel
Hello.
I configure my kernel to boot without an initrd, with "rw root=PARTUUID=...
rootflags=...". I would like the kernel to mount my root partition with
MS_NOATIME but it is currently not possible without using an initrd that
remounts the root partition with the new flags, as was described in this
thread.
Because the kernel already supports setting filesystem dependent flags, I think
it would make sense for it to also support setting filesystem independent flags.
Also, there is the issue of flags that can't be reset later by initrd (see the
previous messages).
In reply to this message, there is a patch that implements what was suggested,
adding a 'rootopts=' parameter that takes a bitmap value for the mount flags.
It's my first time using a mailing list. I'm not sure if you're supposed to
reply to very old messages like this one or create a new thread instead. Sorry
if I did something wrong.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: 2.6.0-test3-mm1 and rootflags
2021-06-29 17:20 ` Greg Depoire--Ferrer
@ 2021-06-29 19:23 ` Randy Dunlap
0 siblings, 0 replies; 8+ messages in thread
From: Randy Dunlap @ 2021-06-29 19:23 UTC (permalink / raw)
To: Greg Depoire--Ferrer, linux-kernel
On 6/29/21 10:20 AM, Greg Depoire--Ferrer wrote:
> Hello.
>
> I configure my kernel to boot without an initrd, with "rw root=PARTUUID=...
> rootflags=...". I would like the kernel to mount my root partition with
> MS_NOATIME but it is currently not possible without using an initrd that
> remounts the root partition with the new flags, as was described in this
> thread.
>
> Because the kernel already supports setting filesystem dependent flags, I think
> it would make sense for it to also support setting filesystem independent flags.
> Also, there is the issue of flags that can't be reset later by initrd (see the
> previous messages).
>
> In reply to this message, there is a patch that implements what was suggested,
> adding a 'rootopts=' parameter that takes a bitmap value for the mount flags.
>
> It's my first time using a mailing list. I'm not sure if you're supposed to
> reply to very old messages like this one or create a new thread instead. Sorry
> if I did something wrong.
Hi,
It would be better to start a new email thread and include a link to
the previous discussion. E.g.:
Reference: or Link: https://lore.kernel.org/lkml/200308121855.h7CIt6St002437@turing-police.cc.vt.edu/
and also Cc: any interested parties.
thanks.
--
~Randy
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] init: add rootopts=%d for rootfs mount flags
2003-08-13 19:44 ` Valdis.Kletnieks
2021-06-29 17:20 ` Greg Depoire--Ferrer
@ 2021-06-29 17:20 ` Greg Depoire--Ferrer
1 sibling, 0 replies; 8+ messages in thread
From: Greg Depoire--Ferrer @ 2021-06-29 17:20 UTC (permalink / raw)
To: linux-kernel; +Cc: Greg Depoire--Ferrer
Add the rootopts command line parameter to specify mount flags for the
root filesystem.
The kernel provides the rootflags parameter to specify filesystem
dependent options when mouting the root filesystem but did not provide
any way to set the filesystem independent flags.
This is not an issue on systems using an initrd because on these
systems, the rootflags parameter is passed to the /sbin/mount binary
which understands filesystem independent flags in the option string,
such as noatime (MS_NOATIME) or nodev (MS_NODEV).
Signed-off-by: Greg Depoire--Ferrer <greg.depoire@gmail.com>
---
Documentation/admin-guide/kernel-parameters.txt | 2 ++
init/do_mounts.c | 11 +++++++++++
2 files changed, 13 insertions(+)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 26453f250683..01e1217583f5 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -4851,6 +4851,8 @@
rootfstype= [KNL] Set root filesystem type
+ rootopts= [KNL] Set root filesystem mount flags bitmap
+
rootwait [KNL] Wait (indefinitely) for root device to show up.
Useful for devices that are detected asynchronously
(e.g. USB and MMC devices).
diff --git a/init/do_mounts.c b/init/do_mounts.c
index a78e44ee6adb..ebe51fc7cf86 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -326,6 +326,16 @@ static int __init root_data_setup(char *str)
return 1;
}
+static int __init root_flags_setup(char *str)
+{
+ int flags;
+
+ if (kstrtoint(str, 0, &flags))
+ return 0;
+ root_mountflags |= flags;
+ return 1;
+}
+
static char * __initdata root_fs_names;
static int __init fs_names_setup(char *str)
{
@@ -341,6 +351,7 @@ static int __init root_delay_setup(char *str)
}
__setup("rootflags=", root_data_setup);
+__setup("rootopts=", root_flags_setup);
__setup("rootfstype=", fs_names_setup);
__setup("rootdelay=", root_delay_setup);
--
2.31.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* No way to set FS independent mount flags for rootfs
@ 2021-06-30 11:51 Greg Depoire--Ferrer
2021-06-30 11:51 ` [PATCH] init: add rootopts=%d for rootfs mount flags Greg Depoire--Ferrer
0 siblings, 1 reply; 8+ messages in thread
From: Greg Depoire--Ferrer @ 2021-06-30 11:51 UTC (permalink / raw)
To: linux-kernel
This old thread[1] describes the issue:
* The kernel already supports setting filesystem dependent mount data using
rootflags=... but it doesn't support setting the filesystem independent mount
flags (the fourth parameter in mount(2)).
* Fortunately, most initrds have custom parsing for rootflags= and understand
additional flags: for instance they convert noatime into MS_NOATIME.
* But even then there is the issue of flags that can't be reset later by initrd
like MS_NODEV or MS_NOSUID (not sure if this changed since then).
It seems like it would make sense for the kernel to add a command line parameter
for this because for those that don't use an initrd, it seems arbitrary that the
kernel already supports setting one type of flags (the fifth parameter in
mount(2)) for rootfs but not the other.
In reply to this message, there is a patch that implements what was suggested
in that thread: adding a 'rootopts=' parameter that takes a bitmap value for
the mount flags. The name is not ideal: it would make more sense for it to be
named rootflags= and the actual rootflags= to be named rootdata= according to
mount(2). It works for me but I don't know if this is the right solution.
[1]: https://lkml.org/lkml/2003/8/12/203
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] init: add rootopts=%d for rootfs mount flags
2021-06-30 11:51 No way to set FS independent mount flags for rootfs Greg Depoire--Ferrer
@ 2021-06-30 11:51 ` Greg Depoire--Ferrer
0 siblings, 0 replies; 8+ messages in thread
From: Greg Depoire--Ferrer @ 2021-06-30 11:51 UTC (permalink / raw)
To: linux-kernel; +Cc: Greg Depoire--Ferrer
Add the rootopts command line parameter to specify mount flags for the
root filesystem.
The kernel provides the rootflags parameter to specify filesystem
dependent options when mouting the root filesystem but did not provide
any way to set the filesystem independent flags.
This is not an issue on systems using an initrd because on these
systems, the rootflags parameter is passed to the /sbin/mount binary
which understands filesystem independent flags in the option string,
such as noatime (MS_NOATIME) or nodev (MS_NODEV).
Signed-off-by: Greg Depoire--Ferrer <greg.depoire@gmail.com>
---
Documentation/admin-guide/kernel-parameters.txt | 2 ++
init/do_mounts.c | 11 +++++++++++
2 files changed, 13 insertions(+)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 26453f250683..01e1217583f5 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -4851,6 +4851,8 @@
rootfstype= [KNL] Set root filesystem type
+ rootopts= [KNL] Set root filesystem mount flags bitmap
+
rootwait [KNL] Wait (indefinitely) for root device to show up.
Useful for devices that are detected asynchronously
(e.g. USB and MMC devices).
diff --git a/init/do_mounts.c b/init/do_mounts.c
index a78e44ee6adb..ebe51fc7cf86 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -326,6 +326,16 @@ static int __init root_data_setup(char *str)
return 1;
}
+static int __init root_flags_setup(char *str)
+{
+ int flags;
+
+ if (kstrtoint(str, 0, &flags))
+ return 0;
+ root_mountflags |= flags;
+ return 1;
+}
+
static char * __initdata root_fs_names;
static int __init fs_names_setup(char *str)
{
@@ -341,6 +351,7 @@ static int __init root_delay_setup(char *str)
}
__setup("rootflags=", root_data_setup);
+__setup("rootopts=", root_flags_setup);
__setup("rootfstype=", fs_names_setup);
__setup("rootdelay=", root_delay_setup);
--
2.31.1
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-06-30 11:51 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-12 18:55 2.6.0-test3-mm1 and rootflags Valdis.Kletnieks
2003-08-12 21:25 ` Andrew Morton
2003-08-13 3:41 ` Valdis.Kletnieks
2003-08-13 19:44 ` Valdis.Kletnieks
2021-06-29 17:20 ` Greg Depoire--Ferrer
2021-06-29 19:23 ` Randy Dunlap
2021-06-29 17:20 ` [PATCH] init: add rootopts=%d for rootfs mount flags Greg Depoire--Ferrer
2021-06-30 11:51 No way to set FS independent mount flags for rootfs Greg Depoire--Ferrer
2021-06-30 11:51 ` [PATCH] init: add rootopts=%d for rootfs mount flags Greg Depoire--Ferrer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®