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

Ben Hutchings bhutchings at solarflare.com
Tue Jul 27 13:40:01 EDT 2010


On Sun, 2010-07-25 at 10:41 +0300, Maxim Levitsky wrote:
> On Sat, Jul 24, 2010 at 8:03 PM, Ben Hutchings
> <bhutchings at solarflare.com> wrote:
> > OK, I get it.  Maybe that should be deferred to a work item.
> >
> 
> I thought about that too.
> It doesn't solve the races, because now the deferred work races with
> device removal, just like the function that adds new mtd device.
> Unless it takes mtd_table_mutex....

You can cancel it in device removal.

> > 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.
> 
> Why?
> 
> In my case the mtd device does have a parent, a pci device.
> If pci device is removed, I just remove the mtd device from the pci driver.
>  (although this codepath it untested)

OK, I have tested this and you are right.  But it is a pain to have to
unbind all devices before removing the module.

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