scsi: qla2xxx: Really fix qla2xxx_eh_abort()
authorBart Van Assche <bvanassche@acm.org>
Fri, 9 Aug 2019 03:01:23 +0000 (20:01 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Dec 2019 19:08:26 +0000 (20:08 +0100)
commit64549a2ecb8222fbd7f5a23bbcb9ffaf10f51767
treeec35cff188720c79347dd4233fa3c181ab135700
parent97ba2bec3aa329a62de3f51b95c08f70e6208aee
scsi: qla2xxx: Really fix qla2xxx_eh_abort()

[ Upstream commit 8dd9593cc07ad7d999bef81b06789ef873a94881 ]

I'm not sure how this happened but the patch that was intended to fix abort
handling was incomplete. This patch fixes that patch as follows:

 - If aborting the SCSI command failed, wait until the SCSI command
   completes.

 - Return SUCCESS instead of FAILED if an abort attempt races with SCSI
   command completion.

 - Since qla2xxx_eh_abort() increments the sp reference count by calling
   sp_get(), decrement the sp reference count before returning.

Cc: Himanshu Madhani <hmadhani@marvell.com>
Fixes: 219d27d7147e ("scsi: qla2xxx: Fix race conditions in the code for aborting SCSI commands")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Himanshu Madhani <hmadhani@marvell.com>
Reviewed-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/qla2xxx/qla_os.c