* sbp2: modprobe -r fails, module allegedly in use
@ 2005-07-10 14:42 Stefan Richter
2005-07-10 15:07 ` Stefan Richter
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Stefan Richter @ 2005-07-10 14:42 UTC (permalink / raw)
To: linux-scsi, linux1394-devel; +Cc: Ben Collins
Hi all,
it seems the sbp2 driver module can never be unloaded because the
module "is in use" even though all SBP-2 devices were physically removed
(after umount etc.). I believe it is an old problem of the last few 2.6
kernels but am not sure when it was really introduced.
One thing can easily be spotted by "ps x": The scsi_error_handler of an
SBP-2 device does not exit. The /sys/bus/scsi/devices/$a:$b:$c:$d
vanished, the /sys/bus/ieee1394/devices/$guid-$unit too, but the
scsi_eh_# daemon is still there. It seems shost->shost_gendev.release
was never called.
So I just added a few more scsi_host_put() to sbp2_remove_device().
scsi_eh_# now goes away when I disconnect the device. Still, modprobe -r
sbp2 fails with "FATAL: Module sbp2 is in use.".
--
Stefan Richter
-=====-=-=-= -=== -=-=-
http://arcgraph.de/sr/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sbp2: modprobe -r fails, module allegedly in use
2005-07-10 14:42 sbp2: modprobe -r fails, module allegedly in use Stefan Richter
@ 2005-07-10 15:07 ` Stefan Richter
2005-07-10 15:31 ` Ben Collins
2005-07-10 17:29 ` James Bottomley
2 siblings, 0 replies; 10+ messages in thread
From: Stefan Richter @ 2005-07-10 15:07 UTC (permalink / raw)
To: linux-scsi, linux1394-devel; +Cc: Ben Collins
I wrote:
> So I just added a few more scsi_host_put() to sbp2_remove_device().
> scsi_eh_# now goes away when I disconnect the device. Still, modprobe -r
> sbp2 fails with "FATAL: Module sbp2 is in use.".
I also added printks and according to them, shost_gendev.release is
called after scsi_host_put is entered for the fourth time in
sbp2_remove_device.
--
Stefan Richter
-=====-=-=-= -=== -=-=-
http://arcgraph.de/sr/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sbp2: modprobe -r fails, module allegedly in use
2005-07-10 14:42 sbp2: modprobe -r fails, module allegedly in use Stefan Richter
2005-07-10 15:07 ` Stefan Richter
@ 2005-07-10 15:31 ` Ben Collins
2005-07-10 17:40 ` Christoph Hellwig
2005-07-10 17:29 ` James Bottomley
2 siblings, 1 reply; 10+ messages in thread
From: Ben Collins @ 2005-07-10 15:31 UTC (permalink / raw)
To: Stefan Richter; +Cc: linux-scsi, linux1394-devel
Yeah, seems like every two months we have to change sbp2 to accomodate
changes to the scsi layers whole reference scheme which never seems
simple, and never stays the same.
Any of the scsi guys care to comment on any changes in the reference
counting to scsi over the last couple of months? Seriously, I've been
having to go through tracking these sorts of changes every month or so
ever since scsi switched to using the driver model. Usually I just take a
peek at the usb storage module, since it somehow seems to stay up with
whatever changes are needed to keep working with the scsi callbacks.
On Sun, Jul 10, 2005 at 04:42:54PM +0200, Stefan Richter wrote:
> Hi all,
>
> it seems the sbp2 driver module can never be unloaded because the
> module "is in use" even though all SBP-2 devices were physically removed
> (after umount etc.). I believe it is an old problem of the last few 2.6
> kernels but am not sure when it was really introduced.
>
> One thing can easily be spotted by "ps x": The scsi_error_handler of an
> SBP-2 device does not exit. The /sys/bus/scsi/devices/$a:$b:$c:$d
> vanished, the /sys/bus/ieee1394/devices/$guid-$unit too, but the
> scsi_eh_# daemon is still there. It seems shost->shost_gendev.release
> was never called.
>
> So I just added a few more scsi_host_put() to sbp2_remove_device().
> scsi_eh_# now goes away when I disconnect the device. Still, modprobe -r
> sbp2 fails with "FATAL: Module sbp2 is in use.".
> --
> Stefan Richter
> -=====-=-=-= -=== -=-=-
> http://arcgraph.de/sr/
>
--
Debian - http://www.debian.org/
Linux 1394 - http://www.linux1394.org/
Subversion - http://subversion.tigris.org/
SwissDisk - http://www.swissdisk.com/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sbp2: modprobe -r fails, module allegedly in use
2005-07-10 14:42 sbp2: modprobe -r fails, module allegedly in use Stefan Richter
2005-07-10 15:07 ` Stefan Richter
2005-07-10 15:31 ` Ben Collins
@ 2005-07-10 17:29 ` James Bottomley
2005-07-10 17:37 ` Ben Collins
2 siblings, 1 reply; 10+ messages in thread
From: James Bottomley @ 2005-07-10 17:29 UTC (permalink / raw)
To: Stefan Richter; +Cc: SCSI Mailing List, linux1394-devel, Ben Collins
On Sun, 2005-07-10 at 16:42 +0200, Stefan Richter wrote:
> it seems the sbp2 driver module can never be unloaded because the
> module "is in use" even though all SBP-2 devices were physically removed
> (after umount etc.). I believe it is an old problem of the last few 2.6
> kernels but am not sure when it was really introduced.
>
> One thing can easily be spotted by "ps x": The scsi_error_handler of an
> SBP-2 device does not exit. The /sys/bus/scsi/devices/$a:$b:$c:$d
> vanished, the /sys/bus/ieee1394/devices/$guid-$unit too, but the
> scsi_eh_# daemon is still there. It seems shost->shost_gendev.release
> was never called.
>
> So I just added a few more scsi_host_put() to sbp2_remove_device().
> scsi_eh_# now goes away when I disconnect the device. Still, modprobe -r
> sbp2 fails with "FATAL: Module sbp2 is in use.".
Actually, I think your error is the opposite of this: you should never
have to do a scsi_host_put() unless you did a corresponding
scsi_host_get(), which, as far as I can see, sbp2 never does, so the
extra put should be meaningless.
Except, I notice that you don't do a scsi_device_put() after
scsi_add_device(). I think this is probably the source of the
refcounting errors: scsi_add_device returns an sdev with the refcount
incremented by one, so you need to decrement the count after you've
finished with it (in your case, you do nothing with it, so just
decrement after you've checked it's not an error pointer).
James
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sbp2: modprobe -r fails, module allegedly in use
2005-07-10 17:29 ` James Bottomley
@ 2005-07-10 17:37 ` Ben Collins
2005-07-10 17:51 ` Stefan Richter
0 siblings, 1 reply; 10+ messages in thread
From: Ben Collins @ 2005-07-10 17:37 UTC (permalink / raw)
To: James Bottomley
Cc: Stefan Richter, SCSI Mailing List, linux1394-devel, Ben Collins
> Actually, I think your error is the opposite of this: you should never
> have to do a scsi_host_put() unless you did a corresponding
> scsi_host_get(), which, as far as I can see, sbp2 never does, so the
> extra put should be meaningless.
>
> Except, I notice that you don't do a scsi_device_put() after
> scsi_add_device(). I think this is probably the source of the
> refcounting errors: scsi_add_device returns an sdev with the refcount
> incremented by one, so you need to decrement the count after you've
> finished with it (in your case, you do nothing with it, so just
> decrement after you've checked it's not an error pointer).
Thanks. Stefan, can you test with that change? I've already put it in the
repo.
--
Debian - http://www.debian.org/
Linux 1394 - http://www.linux1394.org/
Subversion - http://subversion.tigris.org/
SwissDisk - http://www.swissdisk.com/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sbp2: modprobe -r fails, module allegedly in use
2005-07-10 15:31 ` Ben Collins
@ 2005-07-10 17:40 ` Christoph Hellwig
2005-07-10 17:46 ` Ben Collins
0 siblings, 1 reply; 10+ messages in thread
From: Christoph Hellwig @ 2005-07-10 17:40 UTC (permalink / raw)
To: Ben Collins; +Cc: Stefan Richter, linux-scsi, linux1394-devel
On Sun, Jul 10, 2005 at 11:31:26AM -0400, Ben Collins wrote:
> Yeah, seems like every two months we have to change sbp2 to accomodate
> changes to the scsi layers whole reference scheme which never seems
> simple, and never stays the same.
While the implementation has changed a little the exposed interface
never changed at all since before 2.6.0.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sbp2: modprobe -r fails, module allegedly in use
2005-07-10 17:40 ` Christoph Hellwig
@ 2005-07-10 17:46 ` Ben Collins
2005-07-10 17:49 ` Christoph Hellwig
0 siblings, 1 reply; 10+ messages in thread
From: Ben Collins @ 2005-07-10 17:46 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Stefan Richter, linux-scsi, linux1394-devel
On Sun, Jul 10, 2005 at 06:40:54PM +0100, Christoph Hellwig wrote:
> On Sun, Jul 10, 2005 at 11:31:26AM -0400, Ben Collins wrote:
> > Yeah, seems like every two months we have to change sbp2 to accomodate
> > changes to the scsi layers whole reference scheme which never seems
> > simple, and never stays the same.
>
> While the implementation has changed a little the exposed interface
> never changed at all since before 2.6.0.
The exposed implementation might not have, but atleast 3 times now, since
the driver model started being used, I've had to change the way I use the
exposed implementation in order to get bean counting right with the device
and host devices.
Prior, we were using one scsi host per ieee1394 host, with each sbp2
device being one device and even supporting real LUN's to make things as
close to looking like a real scsi host as possible.
Had to ditch all that and do one-host-per-device like USB does in order
save myself all the headache involved. This kind of sucks because the
plug/unplug can quickly increment the scsi-host counter to a point where
things like cdrecord don't work with firewire cd/dvd/rw devices anymore
(until a reboot or the scsi module is removed/inserted). But that's a
whole different issue :)
--
Debian - http://www.debian.org/
Linux 1394 - http://www.linux1394.org/
Subversion - http://subversion.tigris.org/
SwissDisk - http://www.swissdisk.com/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sbp2: modprobe -r fails, module allegedly in use
2005-07-10 17:46 ` Ben Collins
@ 2005-07-10 17:49 ` Christoph Hellwig
2005-07-10 17:52 ` Ben Collins
0 siblings, 1 reply; 10+ messages in thread
From: Christoph Hellwig @ 2005-07-10 17:49 UTC (permalink / raw)
To: Ben Collins
Cc: Christoph Hellwig, Stefan Richter, linux-scsi, linux1394-devel
On Sun, Jul 10, 2005 at 01:46:43PM -0400, Ben Collins wrote:
> The exposed implementation might not have, but atleast 3 times now, since
> the driver model started being used, I've had to change the way I use the
> exposed implementation in order to get bean counting right with the device
> and host devices.
What about reporting your problems to linux-scsi instead of all this
silly bitching?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sbp2: modprobe -r fails, module allegedly in use
2005-07-10 17:37 ` Ben Collins
@ 2005-07-10 17:51 ` Stefan Richter
0 siblings, 0 replies; 10+ messages in thread
From: Stefan Richter @ 2005-07-10 17:51 UTC (permalink / raw)
Cc: Ben Collins, James Bottomley, SCSI Mailing List, linux1394-devel
Ben Collins wrote:
[James Bottomley wrote]
>>I notice that you don't do a scsi_device_put() after
>>scsi_add_device(). I think this is probably the source of the
>>refcounting errors: scsi_add_device returns an sdev with the refcount
>>incremented by one, so you need to decrement the count after you've
>>finished with it (in your case, you do nothing with it, so just
>>decrement after you've checked it's not an error pointer).
>
> Thanks. Stefan, can you test with that change? I've already put it in the
> repo.
That fixes it. The error handler commits suicide when he should, and the
sbp2 module can be unloaded.
Thanks James.
--
Stefan Richter
-=====-=-=-= -=== -=-=-
http://arcgraph.de/sr/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sbp2: modprobe -r fails, module allegedly in use
2005-07-10 17:49 ` Christoph Hellwig
@ 2005-07-10 17:52 ` Ben Collins
0 siblings, 0 replies; 10+ messages in thread
From: Ben Collins @ 2005-07-10 17:52 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Stefan Richter, linux-scsi, linux1394-devel
On Sun, Jul 10, 2005 at 06:49:13PM +0100, Christoph Hellwig wrote:
> On Sun, Jul 10, 2005 at 01:46:43PM -0400, Ben Collins wrote:
> > The exposed implementation might not have, but atleast 3 times now, since
> > the driver model started being used, I've had to change the way I use the
> > exposed implementation in order to get bean counting right with the device
> > and host devices.
>
> What about reporting your problems to linux-scsi instead of all this
> silly bitching?
I just did, and I have. Never got a reply before. Plus the fact that
generally the fix I needed was in the USB storage driver led me to believe
"yes, we know it changed", so why bother?
--
Debian - http://www.debian.org/
Linux 1394 - http://www.linux1394.org/
Subversion - http://subversion.tigris.org/
SwissDisk - http://www.swissdisk.com/
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2005-07-10 17:52 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-10 14:42 sbp2: modprobe -r fails, module allegedly in use Stefan Richter
2005-07-10 15:07 ` Stefan Richter
2005-07-10 15:31 ` Ben Collins
2005-07-10 17:40 ` Christoph Hellwig
2005-07-10 17:46 ` Ben Collins
2005-07-10 17:49 ` Christoph Hellwig
2005-07-10 17:52 ` Ben Collins
2005-07-10 17:29 ` James Bottomley
2005-07-10 17:37 ` Ben Collins
2005-07-10 17:51 ` Stefan Richter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox