Re: [v3 PATCH 1/1] init: fix race between rootfs mount and firmware loading

2014-09-19 Thread Oleg Nesterov
On 09/19, Roman Peniaev wrote: > > On Fri, Sep 19, 2014 at 2:41 AM, Oleg Nesterov wrote: > > On 09/18, Roman Pen wrote: > >> > >> +EXPORT_SYMBOL(wait_for_rootfs); > > > > Why? > > CONFIG_FW_LOADER (which includes firmware_class.c to compilation > sequence) is declared as tristate, Ah, I didn't kn

Re: [v3 PATCH 1/1] init: fix race between rootfs mount and firmware loading

2014-09-19 Thread Roman Peniaev
On Fri, Sep 19, 2014 at 2:41 AM, Oleg Nesterov wrote: > On 09/18, Roman Pen wrote: >> >> +void wait_for_rootfs(void) >> +{ >> + /* Avoid waiting for ourselves */ >> + if (WARN_ON(is_global_init(current))) >> + return; >> + else >> + wait_event(rootfs_waitq, root

Re: [v3 PATCH 1/1] init: fix race between rootfs mount and firmware loading

2014-09-18 Thread Oleg Nesterov
On 09/18, Roman Pen wrote: > > +void wait_for_rootfs(void) > +{ > + /* Avoid waiting for ourselves */ > + if (WARN_ON(is_global_init(current))) > + return; > + else > + wait_event(rootfs_waitq, rootfs_mounted); > +} Ah, wait, the is_global_init() check doesn't l

[v3 PATCH 1/1] init: fix race between rootfs mount and firmware loading

2014-09-18 Thread Roman Pen
The thing is that built-in modules are being inited before rootfs mount. Some of the modules can request firmware loading from another thread using async 'request_firmware_nowait' call on inition, so we can catch this kind of race: rootfs does not exist yet, but we are going to open and load