block2mtd and ubi are initialized too early when compiled in on 2.6.31-rc2

Artem Bityutskiy dedekind at infradead.org
Sun Jul 19 02:00:59 EDT 2009


On Thu, 2009-07-16 at 16:28 +0200, Tobias Diedrich wrote:
> Artem Bityutskiy wrote:
> > Hi,
> > 
> > On Wed, 2009-07-15 at 13:52 +0200, Tobias Diedrich wrote:
> > > On 2.6.31-rc2 the block2mtd drivers module_init is called before any
> > > block devices have been registered.
> > 
> > Hmm, ok. Is this because block devices are registered asynchronously?
> > Could you please point to the code where it is done, just for reference.
> 
> AFAICS yes.
> All module_init()s are called asynchronously from init/main.c:do_initcalls()

They are done in a kernel thread, but sequentially, one after the other.
So there is no real synchronicity there.

I think the real problem is that block-devices are probed/initialized
asynchronously. E.g., see 'ata_host_register()'. They call
'async_schedule()' which is doing the slow initialization in a separate
thread.

Thus, you probably should to try to add something like
'async_synchronize_full()' to the blk2mtd driver and wait for block
devices to initialize. Or indeed 'wait_for_device_probe()' may be what
you need.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)




More information about the linux-mtd mailing list