[PATCH 01/17] MTD: create lockless versions of {get,put}_mtd_device This will be used to resolve deadlock in block translation layer.

Maxim Levitsky maximlevitsky at gmail.com
Wed Feb 10 16:22:33 EST 2010

On Tue, 2010-02-09 at 19:46 +0200, Maxim Levitsky wrote: 
> On Tue, 2010-02-09 at 19:23 +0200, Maxim Levitsky wrote: 
> > On Tue, 2010-02-09 at 18:14 +0100, Peter Zijlstra wrote: 
> > > On Tue, 2010-02-09 at 18:57 +0200, Maxim Levitsky wrote:
> > > > These functions can be used as long as we don't need access to global mtd table, but have
> > > > a pointer to the mtd device.
> > > > 
> > > > Signed-off-by: Maxim Levitsky <maximlevitsky at gmail.com>
> > > > ---

David, I just got a great idea how to resolve the same issue in much
cleaner way.

Why not to drop the mtd table lock before calling the add notifers?
If we assume no add_mtd_device/del_mtd_device running concurrently this
should be ok. After all mtd table lock should protect only the mtd
And the table only purpose it to locate an mtd device by number or name.
This purpose will always be useful, be it a static table or not.

I also remove all that mtd table junk from mtd_blktrans.c

Best regards,
Maxim Levitsky

More information about the linux-mtd mailing list