[PATCH 2.6.35] mtd: blktrans: Move device and module ref-counting back to open/release

Ben Hutchings bhutchings at solarflare.com
Sat Jul 24 13:03:28 EDT 2010


On Sat, 2010-07-24 at 19:07 +0300, Maxim Levitsky wrote:
> This is done on purpose.
> 
> Otherwise, as soon as someone registers mtd translation layer with partitions,
> the add_gendisk will scan partitions and thus call blktrans_open()
> and mtd_table_mutex is already held.

OK, I get it.  Maybe that should be deferred to a work item.

> Here I can unload both mtd and blktrans driver after mtd driver
> removes mtd device (that happens when I remove the xD card)
> While card is inserted its indeed not possible to remove nether mtd
> nor translation layer driver.

This only works if the MTD itself is hotplugged, and not if the MTD's
parent is hotplugged.  In fixing one case you have broken the other.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.




More information about the linux-mtd mailing list