lkml.org 
[lkml]   [2021]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH v3 1/2] init/initramfs.c: do unpacking asynchronously
From
Date
On 28/07/2021 12.36, Alexander Egorenkov wrote:
> Rasmus Villemoes <linux@rasmusvillemoes.dk> writes:
>
>> On 24/07/2021 09.46, Alexander Egorenkov wrote:
>>> Hello,
>>>
>>> since e7cb072eb988 ("init/initramfs.c: do unpacking asynchronously"), we
>>> started seeing the following problem on s390 arch regularly:
>>>
>>> [ 5.039734] wait_for_initramfs() called before rootfs_initcalls
>>
>> While that message was added as part of the same patch, it's a red
>> herring: It merely means that something ends up calling usermodehelper
>> (perhaps a request_module) before the init sequence has come around to
>> rootfs_initcalls. At that point, the rootfs is (with or without my async
>> patch) entirely empty, so those usermodehelper calls have always failed
>> with -ENOENT.
>>
>> If you have CONFIG_UEVENT_HELPER=y and CONFIG_UEVENT_HELPER_PATH set to
>> a non-empty string, you can try setting the latter to the empty string.
>> But the message won't go away if it's really a request_module() and not
>> a uevent notification.
>>
>
> Thanks for the helpful explanation. I disabled UEVENT on my test machine and
> as you said, the message is being triggered by request_module() now.

Yes. But as I've said, the "called before rootfs_initcalls" message is
entirely harmless and not in any way related to whatever problems is
later encountered when the initramfs is actually being decompressed and
extracted.

I have this so far untested patch that I plan on sending, which should
remove that message

diff --git a/init/initramfs.c b/init/initramfs.c
index af27abc59643..51a686a8c929 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -727,6 +727,7 @@ static int __init populate_rootfs(void)
{
initramfs_cookie = async_schedule_domain(do_populate_rootfs, NULL,
&initramfs_domain);
+ usermodehelper_enable();
if (!initramfs_async)
wait_for_initramfs();
return 0;
diff --git a/init/main.c b/init/main.c
index f5b8246e8aa1..d5c5542fe142 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1387,7 +1387,6 @@ static void __init do_basic_setup(void)
driver_init();
init_irq_proc();
do_ctors();
- usermodehelper_enable();
do_initcalls();
}

diff --git a/init/noinitramfs.c b/init/noinitramfs.c
index 3d62b07f3bb9..f1d9e5495cc1 100644
--- a/init/noinitramfs.c
+++ b/init/noinitramfs.c
@@ -18,6 +18,7 @@ static int __init default_rootfs(void)
{
int err;

+ usermodehelper_enable();
err = init_mkdir("/dev", 0755);
if (err < 0)
goto out;
because any call of a usermodehelper (be it a uevent hotplug
notification or a request_module) would just return -EBUSY during all
pure_, core_, postcore_, arch_, subsys_ and fs_ initcalls. (It is really
beyond me why rootfs_ initcalls are hidden between fs_ and device_
initcalls).

Currently (with or without my async patch) umh calls from those
initcalls probably return -ENOENT or whatever kernel_execve() returns
when there's no such binary. So if something actually looks at the
return value, the change from -ENOENT to -EBUSY might cause a
regression. But I doubt it.

Rasmus

\
 
 \ /
  Last update: 2021-07-28 13:50    [W:0.076 / U:3.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site