[SCSI] scsi_lib: fix DID_RESET status problems
authorJames Bottomley <James.Bottomley@HansenPartnership.com>
Tue, 6 Jan 2009 19:15:20 +0000 (13:15 -0600)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Wed, 7 Jan 2009 21:15:44 +0000 (15:15 -0600)
commit79ed24297236b7430d6ce0a1511ff70cf5b6015a
tree396b2696f4ec57851856702f27019a81a3aefecd
parent4be98c0ca304c8a47998b29a7993664f71791250
[SCSI] scsi_lib: fix DID_RESET status problems

Andrew Vaszquez said:
> There's a problem that is causing commands returned by the LLD with
> a DID_RESET status to be reissued with cleared cmd->sdb data which
> in our tests are manifesting in firmware detected overruns.  Here's
> a snippet of a READ_10 scsi_cmnd upon completion by the storage

The problem is caused by:

commit b60af5b0adf0da24c673598c8d3fb4d4189a15ce
Author: Alan Stern <stern@rowland.harvard.edu>
Date:   Mon Nov 3 15:56:47 2008 -0500

    [SCSI] simplify scsi_io_completion()

Because scsi_release_buffers() is called before commands that go
through the ACTION_RETRY and ACTION_DELAYED_RETRY legs are requeued.
However, they're not re-prepared, so nothing ever reallocates the
buffer resources to them.  Fix this by releasing the buffers only if
we're not going to go down these legs (but scsi_release_buffers() on
all legs including two in scsi_end_request(); this latter needs a
special version __scsi_release_buffers() because the final one can be
called after the request has been freed, so the bidi test in
scsi_release_buffers(), which touches the request has to be skipped).

Reported-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/scsi_lib.c