On Wed, 27 May 2009, James Bottomley wrote: > I find the terms delete and release too close for comfort, which is why > I've always been careful to say remove from visibility. Okay; I'll use your terms when conversing with you. :-) > > That's fine. You remove a target from visibility when target->reap_ref > > becomes 0. The target isn't released until the target's embedded > > struct device's refcount becomes 0. To make this work, simply have > > scsi_alloc_sdev() call > > > > get_device(&starget->dev); > > > > and have scsi_device_dev_release_usercontext() call > > > > put_device(&starget->dev); > > > > Doesn't that do exactly what you're asking for? > > That's um what we do to day ... the addition has to be to the visibility > management. That's what I was trying to accomplish in the patch you said was wrong. It moved the call to scsi_target_reap() from scsi_device_dev_release_usercontext() into __scsi_remove_device(). That is, the target's count of underlying sdevs was to be decremented whenever an sdev was removed from visibility, not when the sdev was released. That's how the problem should be solved. But the details need to be correct, and I don't understand how they all work (as you noticed when reading the patch). Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html