public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Cannot rmmod after call to add_mtd_blktrans_dev
@ 2010-09-08 12:20 Jarkko Lavinen
  2010-09-08 14:43 ` Maxim Levitsky
  0 siblings, 1 reply; 4+ messages in thread
From: Jarkko Lavinen @ 2010-09-08 12:20 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-mtd, Maxim Levitsky

I am working with mtdswap driver which uses
add_mtd_blktrans_dev().  Once I call add_mtd_blktrans_dev() the
driver module reference count is 1 and I cannot remove the
module.

Before commit 048d871 (mtd: blktrans: Hotplug fixes) the module
ref count was 0 after loading. Ref count was increased only when
thedevice was opened and it was possible to remove the module if
none was using it.

After the 048d871 it doesn't seem to be possible to remove
drivers which use add_mtd_blktrans_dev().  Many drivers similar
to ftl have ftl_remove_dev() which calls del_mtd_blktrans_dev()
that would put the module but cannot be called unless the ref
count is already 0.

Jarkko Lavinen

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Cannot rmmod after call to add_mtd_blktrans_dev
  2010-09-08 12:20 Cannot rmmod after call to add_mtd_blktrans_dev Jarkko Lavinen
@ 2010-09-08 14:43 ` Maxim Levitsky
  2010-09-18 23:17   ` Maxim Levitsky
  0 siblings, 1 reply; 4+ messages in thread
From: Maxim Levitsky @ 2010-09-08 14:43 UTC (permalink / raw)
  To: Jarkko Lavinen; +Cc: linux-mtd, David Woodhouse

On Wed, 2010-09-08 at 15:20 +0300, Jarkko Lavinen wrote: 
> I am working with mtdswap driver which uses
> add_mtd_blktrans_dev().  Once I call add_mtd_blktrans_dev() the
> driver module reference count is 1 and I cannot remove the
> module.
> 
> Before commit 048d871 (mtd: blktrans: Hotplug fixes) the module
> ref count was 0 after loading. Ref count was increased only when
> thedevice was opened and it was possible to remove the module if
> none was using it.
> 
> After the 048d871 it doesn't seem to be possible to remove
> drivers which use add_mtd_blktrans_dev().  Many drivers similar
> to ftl have ftl_remove_dev() which calls del_mtd_blktrans_dev()
> that would put the module but cannot be called unless the ref
> count is already 0.
> 
> Jarkko Lavinen

My fault, I take a good look at how to fix that differently.
Best regards,
Maxim Levitsky

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Cannot rmmod after call to add_mtd_blktrans_dev
  2010-09-08 14:43 ` Maxim Levitsky
@ 2010-09-18 23:17   ` Maxim Levitsky
  2010-09-28  8:24     ` Jarkko Lavinen
  0 siblings, 1 reply; 4+ messages in thread
From: Maxim Levitsky @ 2010-09-18 23:17 UTC (permalink / raw)
  To: Jarkko Lavinen; +Cc: linux-mtd, David Woodhouse

On Wed, 2010-09-08 at 17:43 +0300, Maxim Levitsky wrote: 
> On Wed, 2010-09-08 at 15:20 +0300, Jarkko Lavinen wrote: 
> > I am working with mtdswap driver which uses
> > add_mtd_blktrans_dev().  Once I call add_mtd_blktrans_dev() the
> > driver module reference count is 1 and I cannot remove the
> > module.
> > 
> > Before commit 048d871 (mtd: blktrans: Hotplug fixes) the module
> > ref count was 0 after loading. Ref count was increased only when
> > thedevice was opened and it was possible to remove the module if
> > none was using it.
> > 
> > After the 048d871 it doesn't seem to be possible to remove
> > drivers which use add_mtd_blktrans_dev().  Many drivers similar
> > to ftl have ftl_remove_dev() which calls del_mtd_blktrans_dev()
> > that would put the module but cannot be called unless the ref
> > count is already 0.
> > 
> > Jarkko Lavinen
> 
> My fault, I take a good look at how to fix that differently.
> Best regards,
> Maxim Levitsky

Please test the patch I have just posted on linux-mtd.

Best regards,
Maxim Levitsky

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Cannot rmmod after call to add_mtd_blktrans_dev
  2010-09-18 23:17   ` Maxim Levitsky
@ 2010-09-28  8:24     ` Jarkko Lavinen
  0 siblings, 0 replies; 4+ messages in thread
From: Jarkko Lavinen @ 2010-09-28  8:24 UTC (permalink / raw)
  To: Maxim Levitsky; +Cc: linux-mtd, David Woodhouse

On Sun, Sep 19, 2010 at 01:17:42AM +0200, ext Maxim Levitsky wrote:
> Please test the patch I have just posted on linux-mtd.

I tried the 1/3 patch sent on Sep 18 23:12 on top of 2.6.36-rc5.
Had some email problem and to pick the patch from web
archives. It didn't apply cleanly, but the merge conflict seemed
minor.

The patch seems to work. I am able to remove module but now
del_mtd_blktrans_dev(dev) relases my own device structure a bit
too early and have to protect it with extra kref_get() and
release it with blktrans_dev_put(dev).

Jarkko Lavinen

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-09-28  8:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-08 12:20 Cannot rmmod after call to add_mtd_blktrans_dev Jarkko Lavinen
2010-09-08 14:43 ` Maxim Levitsky
2010-09-18 23:17   ` Maxim Levitsky
2010-09-28  8:24     ` Jarkko Lavinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox