Re: [linux-usb-devel] Re: [PATCH] USB changes for 2.5.58

James Bottomley
2003-01-21T13:30:48Z

alan@lxorguk.ukuu.org.uk said:
> Providing you refcount objects and defer freeing of resources its not
> normally too terrible

We already have a struct device, which is a ref counted object precisely for
this purpose, embedded inside Scsi_Device.

One of the issues doing this is fast reattachment: the device goes away then
comes back before we've cleared the outstanding command queue.

In the latter case, I think we could use some of the work Luben Tuikov has
been doing to make the cmnd structures tie more closely to the device: as
long as we remove the device from user visibility as soon as it is removed, we
can keep the Scsi_Device object around until the ref count falls to zero, and
even create a new one while this is going on. Commands attached to the old
device still error out.

It would still be nice if the trigger for Scsi_device removal came from a USB
hotplug event at user level, but I'm not too bothered about that.

James