[openib-general] SRP: [PATCH] Releasing the scsi_host when unloading

Ishai Rabinovitz ishai at mellanox.co.il
Wed May 17 07:57:45 PDT 2006


On Wed, May 17, 2006 at 02:55:57AM +0300, Roland Dreier wrote:
> Hmm, this doesn't seem right to me.  If I try this, then I get a crash
> because the scsi_host is already gone after the first put.  I verified
> that the reference count is 1 before these puts, and with the
> unmodified module I don't see anything left in /sys/class/scsi_host
> after unloading the module.
> 
> What kernel are you seeing problems with?  I'm testing with an
> up-to-date git kernel, although I doubt it makes a difference (did
> SCSI reference counting change recently??).
> 
> I do think there are some extra scsi_host_put() calls in
> srp_remove_work() -- I think the double scsi_host_put() dates back to
> a version (which I may never even have checked in) where there was a
> scsi_host_get() to avoid the scsi_host going away between the
> schedule_work() and srp_remove_work() actually running.
> 
> So the patch below seems correct to me.
> 
> What do you think?

I could not reproduce the problem again, so this patch works for me.

-- 
Ishai Rabinovitz



More information about the general mailing list