All of lore.kernel.org
 help / color / mirror / Atom feed
* rmmod st "hangs" - bad interaction with sg
@ 2004-07-10 15:31 Tim Wright
  2004-07-10 15:41 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Wright @ 2004-07-10 15:31 UTC (permalink / raw)
  To: linux-kernel

Hi,
I was working on the qlogicisp/isp1020 driver in 2.6, as I still have
one of these antiques and the driver is a bit out of date (a patch is
forthcoming). In the process of testing my changes, I came across the
following:

I have a single DDS-2 tape drive attached to the SCSI bus. qlogicisp
loads, and pulls and the tape is found. However, when I tried to unload
st, the unload "hung" unkillable. I use the quotes for a reason. After
much searching, I found that there is still a reference count on the
sysfs scsi_device and that is because when the driver gets loaded, not
only does st get loaded, but sg also gets pulled in and increments the
refcount on the sysfs scsi_device. Running 'rmmod sg' in another window
allows the original 'rmmod st' to complete.

This seems bad to me - either the original rmmod should fail with EBUSY,
or it should complete. However, for it to do so, it seems that st needs
to know that sg has its hooks into the device it controls, and it needs
to be able to make it let go. My workaround is impractical if sg is in
use on other devices too.

So....
what do interested parties think? Would this be considered a bug? Should
I chase and see if I can find a way to make it behave, or does someone
already know what's wrong?

Regards,

Tim

BTW, if anyone is interested in the fixed-up qlogicisp, I can make it
available. Error-handling is in and seems to be working (the main
complaint that 2.6 has), and interfaces have been updated to 2.6
standards.


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

* Re: rmmod st "hangs" - bad interaction with sg
  2004-07-10 15:31 rmmod st "hangs" - bad interaction with sg Tim Wright
@ 2004-07-10 15:41 ` Christoph Hellwig
  2004-07-10 16:03   ` Tim Wright
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2004-07-10 15:41 UTC (permalink / raw)
  To: Tim Wright; +Cc: linux-kernel

On Sat, Jul 10, 2004 at 08:31:00AM -0700, Tim Wright wrote:
> Hi,
> I was working on the qlogicisp/isp1020 driver in 2.6, as I still have
> one of these antiques and the driver is a bit out of date (a patch is
> forthcoming). In the process of testing my changes, I came across the
> following:

qlogicisp is slowly going away.  If you look at the qla1280 driver in current
mainline you'll see it has most of the support for the 1020/1040 already,
I just need to fix a final bug and add firmware/pci ids.  This has come up
on linux-scsi a few times..

> This seems bad to me - either the original rmmod should fail with EBUSY,
> or it should complete. However, for it to do so, it seems that st needs
> to know that sg has its hooks into the device it controls, and it needs
> to be able to make it let go. My workaround is impractical if sg is in
> use on other devices too.

I don't think we can fix much about this, it's how the driver model code
works.  Best workarond is to not use sg.


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

* Re: rmmod st "hangs" - bad interaction with sg
  2004-07-10 15:41 ` Christoph Hellwig
@ 2004-07-10 16:03   ` Tim Wright
  0 siblings, 0 replies; 3+ messages in thread
From: Tim Wright @ 2004-07-10 16:03 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-kernel

Hi Christoph!
On Sat, 2004-07-10 at 08:41, Christoph Hellwig wrote:
> On Sat, Jul 10, 2004 at 08:31:00AM -0700, Tim Wright wrote:
> > Hi,
> > I was working on the qlogicisp/isp1020 driver in 2.6, as I still have
> > one of these antiques and the driver is a bit out of date (a patch is
> > forthcoming). In the process of testing my changes, I came across the
> > following:
> 
> qlogicisp is slowly going away.  If you look at the qla1280 driver in current
> mainline you'll see it has most of the support for the 1020/1040 already,
> I just need to fix a final bug and add firmware/pci ids.  This has come up
> on linux-scsi a few times..
> 

Ah thanks. Of course, as soon as I posted, I realized I should probably
have copied linux-scsi and/or gone and checked the archives there sigh.
Just getting back into the swing of things. If you need a tester, I'm
happy to do so on my setup.

> > This seems bad to me - either the original rmmod should fail with EBUSY,
> > or it should complete. However, for it to do so, it seems that st needs
> > to know that sg has its hooks into the device it controls, and it needs
> > to be able to make it let go. My workaround is impractical if sg is in
> > use on other devices too.
> 
> I don't think we can fix much about this, it's how the driver model code
> works.  Best workarond is to not use sg.

Hmmm... the problem was that it was autoloaded - I haven't gone and
checked the code yet, but it seems that unless you don't actually build
sg at all, it gets pulled in whether you want it or not. Now that the
ATA passthrough stuff works for CDRW etc., I actually have no good
reason to load it. It just seemed a little "sucky" - if I had tried to
e.g. rmmod qlogicisp, it would correctly fail because st depends on it.
It seems weak that an attempt to unload st didn't catch the hidden
dependency. Actually, it seems that a workaround with no side effects is
to 'echo 1 > /sys/class/scsi_device/.../delete' for the tape drive. That
frees things up and unhooks sg without unloading it.

Thanks,

Tim


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

end of thread, other threads:[~2004-07-10 16:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-10 15:31 rmmod st "hangs" - bad interaction with sg Tim Wright
2004-07-10 15:41 ` Christoph Hellwig
2004-07-10 16:03   ` Tim Wright

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.