[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210528143802.78635-4-dong.menglong@zte.com.cn>
Date: Fri, 28 May 2021 22:38:02 +0800
From: menglong8.dong@...il.com
To: mhiramat@...nel.org, mcgrof@...nel.org, josh@...htriplett.org
Cc: viro@...iv.linux.org.uk, keescook@...omium.org,
samitolvanen@...gle.com, ojeda@...nel.org, johan@...nel.org,
jeyu@...nel.org, masahiroy@...nel.org, dong.menglong@....com.cn,
joe@...ches.com, axboe@...nel.dk, jack@...e.cz, hare@...e.de,
tj@...nel.org, gregkh@...uxfoundation.org, song@...nel.org,
neilb@...e.de, akpm@...ux-foundation.org, f.fainelli@...il.com,
wangkefeng.wang@...wei.com, arnd@...db.de,
linux@...musvillemoes.dk, brho@...gle.com, rostedt@...dmis.org,
vbabka@...e.cz, pmladek@...e.com, glider@...gle.com,
chris@...isdown.name, jojing64@...il.com, ebiederm@...ssion.com,
mingo@...nel.org, terrelln@...com, geert@...ux-m68k.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
bhelgaas@...gle.com
Subject: [PATCH v3 3/3] init/do_mounts.c: fix rootfs_fs_type with ramfs
From: Menglong Dong <dong.menglong@....com.cn>
As for the existence of 'user root' which is introduced in previous
patch, 'rootfs_fs_type', which is used as the root of mount tree,
is not used directly any more. So it make no sense to make it tmpfs
while 'INITRAMFS_USER_ROOT' is enabled.
Make 'rootfs_fs_type' ramfs when 'INITRAMFS_USER_ROOT' enabled.
Signed-off-by: Menglong Dong <dong.menglong@....com.cn>
---
include/linux/init.h | 5 +++++
init/do_mounts.c | 10 +++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/include/linux/init.h b/include/linux/init.h
index 045ad1650ed1..d65b12fe438c 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -148,7 +148,12 @@ extern unsigned int reset_devices;
/* used by init/main.c */
void setup_arch(char **);
void prepare_namespace(void);
+#ifndef CONFIG_INITRAMFS_USER_ROOT
void __init init_rootfs(void);
+#else
+static inline void __init init_rootfs(void) { }
+#endif
+
extern struct file_system_type rootfs_fs_type;
#if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX)
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 2fd168cca480..74f5b0fc8bdf 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -716,7 +716,14 @@ void __init init_user_rootfs(void)
}
}
}
-#endif
+
+struct file_system_type rootfs_fs_type = {
+ .name = "rootfs",
+ .init_fs_context = ramfs_init_fs_context,
+ .kill_sb = kill_litter_super,
+};
+
+#else
static bool is_tmpfs;
static int rootfs_init_fs_context(struct fs_context *fc)
@@ -739,3 +746,4 @@ void __init init_rootfs(void)
(!root_fs_names || strstr(root_fs_names, "tmpfs")))
is_tmpfs = true;
}
+#endif
--
2.32.0.rc0
Powered by blists - more mailing lists