scsi: qla2xxx: Fix a race condition between aborting and completing a SCSI command
authorBart Van Assche <bvanassche@acm.org>
Fri, 9 Aug 2019 03:02:06 +0000 (20:02 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 13 Aug 2019 01:34:08 +0000 (21:34 -0400)
commit85cffefa09e448906a6f0bc20f422d75a18675bd
tree514d00f532ba5e329c1c73307a59b2317deb283e
parentbdb61b9b944d1e5b7cee5a9fe21014363c55b811
scsi: qla2xxx: Fix a race condition between aborting and completing a SCSI command

Instead of allocating a struct srb dynamically from inside .queuecommand(),
set qla2xxx_driver_template.cmd_size such that struct scsi_cmnd and struct
srb are contiguous. Do not call QLA_QPAIR_MARK_BUSY() /
QLA_QPAIR_MARK_NOT_BUSY() for SRBs associated with SCSI commands. That is
safe because scsi_remove_host() is called before queue pairs are deleted
and scsi_remove_host() waits for all outstanding SCSI commands to finish.

Cc: Himanshu Madhani <hmadhani@marvell.com>
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>
drivers/scsi/qla2xxx/qla_def.h
drivers/scsi/qla2xxx/qla_os.c