Re: [PATCH scsi-misc-2.6 08/08] scsi: fix hot unplug sequence

Tejun Heo
2005-03-25T05:38:53Z

Hi,

On Thu, Mar 24, 2005 at 11:02:45PM -0600, James Bottomley wrote:
> On Fri, 2005-03-25 at 12:15 +0900, Tejun Heo wrote:
> > I think I found the cause. Special requests submitted using
> > scsi_do_req() never initializes ->end_io(). Normally, SCSI midlayer
> > terminates special requests inside the SCSI midlayer without passing
> > through the blkdev layer. However, if a device is going away or taken
> > offline, blkdev layer gets to terminate special requests and, as
> > ->end_io() is never set-up, nothing happens and the completion gets
> > lost.
>
> The analysis is exactly correct, well done! I think your patch is a bit
> overly complex, though. We can achieve the same effect simply by
> executing the completion without changing the rq_status like the patch
> below.
>
> Jens, To go back to the original problem, except when I hit the usb-
> storage error handling oops, I can plug and unplug to my hearts content
> and everything works.

We have users of scsi_do_req() other than scsi_wait_req() and they
use different done() functions to do different things. I've checked
other done functions and none uses contents inside the passed
scsi_cmnd, so using a dummy command should be okay with them. Am I
missing something here?

Oh, and I would really appreciate if you can fill me in / give a
pointer about the scsi_request/scsi_cmnd distinction.

Thanks a lot.

--
tejun