scsi: ibmvfc: Fix up duplicate response detection
authorBrian King <brking@linux.vnet.ibm.com>
Tue, 19 Oct 2021 15:21:29 +0000 (10:21 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 21 Oct 2021 02:59:45 +0000 (22:59 -0400)
commite20f80b9b163dc402dca115eed0affba6df5ebb5
treeee81de16eaa282773dd57ff76a9bcd2ede245ff8
parent4e5483b8440d01f6851a1388801088a6e0da0b56
scsi: ibmvfc: Fix up duplicate response detection

Commit a264cf5e81c7 ("scsi: ibmvfc: Fix command state accounting and stale
response detection") introduced a regression in detecting duplicate
responses. This was observed in test where a command was sent to the VIOS
and completed before ibmvfc_send_event() set the active flag to 1, which
resulted in the atomic_dec_if_positive() call in ibmvfc_handle_crq()
thinking this was a duplicate response, which resulted in scsi_done() not
getting called, so we then hit a SCSI command timeout for this command once
the timeout expires.  This simply ensures the active flag gets set prior to
making the hcall to send the command to the VIOS, in order to close this
window.

Link: https://lore.kernel.org/r/20211019152129.16558-1-brking@linux.vnet.ibm.com
Fixes: a264cf5e81c7 ("scsi: ibmvfc: Fix command state accounting and stale response detection")
Cc: stable@vger.kernel.org
Acked-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ibmvscsi/ibmvfc.c