aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuinn Tran <quinn.tran@cavium.com>2017-03-15 12:48:45 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-03-26 07:05:56 -0400
commit66e70bdca599abd2dc42c5849ae21895de141bfe (patch)
tree6ce68598836601322bb7a246652b6df4b435ab95
parentc5ad350d61441ea18869f910e60ae1b58a57d850 (diff)
qla2xxx: Fix request queue corruption.
commit 8b666809e10cda9814af3e8be339d35b83909056 upstream. When FW notify driver or driver detects low FW resource, driver tries to send out Busy SCSI Status to tell Initiator side to back off. During the send process, the lock was not held. Signed-off-by: Quinn Tran <quinn.tran@qlogic.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/scsi/qla2xxx/qla_target.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index c6c3b97a1e93..feab7ea8e823 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -5375,16 +5375,22 @@ qlt_send_busy(struct scsi_qla_host *vha,
5375 5375
5376static int 5376static int
5377qlt_chk_qfull_thresh_hold(struct scsi_qla_host *vha, 5377qlt_chk_qfull_thresh_hold(struct scsi_qla_host *vha,
5378 struct atio_from_isp *atio) 5378 struct atio_from_isp *atio, bool ha_locked)
5379{ 5379{
5380 struct qla_hw_data *ha = vha->hw; 5380 struct qla_hw_data *ha = vha->hw;
5381 uint16_t status; 5381 uint16_t status;
5382 unsigned long flags;
5382 5383
5383 if (ha->tgt.num_pend_cmds < Q_FULL_THRESH_HOLD(ha)) 5384 if (ha->tgt.num_pend_cmds < Q_FULL_THRESH_HOLD(ha))
5384 return 0; 5385 return 0;
5385 5386
5387 if (!ha_locked)
5388 spin_lock_irqsave(&ha->hardware_lock, flags);
5386 status = temp_sam_status; 5389 status = temp_sam_status;
5387 qlt_send_busy(vha, atio, status); 5390 qlt_send_busy(vha, atio, status);
5391 if (!ha_locked)
5392 spin_unlock_irqrestore(&ha->hardware_lock, flags);
5393
5388 return 1; 5394 return 1;
5389} 5395}
5390 5396
@@ -5429,7 +5435,7 @@ static void qlt_24xx_atio_pkt(struct scsi_qla_host *vha,
5429 5435
5430 5436
5431 if (likely(atio->u.isp24.fcp_cmnd.task_mgmt_flags == 0)) { 5437 if (likely(atio->u.isp24.fcp_cmnd.task_mgmt_flags == 0)) {
5432 rc = qlt_chk_qfull_thresh_hold(vha, atio); 5438 rc = qlt_chk_qfull_thresh_hold(vha, atio, ha_locked);
5433 if (rc != 0) { 5439 if (rc != 0) {
5434 tgt->atio_irq_cmd_count--; 5440 tgt->atio_irq_cmd_count--;
5435 return; 5441 return;
@@ -5552,7 +5558,7 @@ static void qlt_response_pkt(struct scsi_qla_host *vha, response_t *pkt)
5552 break; 5558 break;
5553 } 5559 }
5554 5560
5555 rc = qlt_chk_qfull_thresh_hold(vha, atio); 5561 rc = qlt_chk_qfull_thresh_hold(vha, atio, true);
5556 if (rc != 0) { 5562 if (rc != 0) {
5557 tgt->irq_cmd_count--; 5563 tgt->irq_cmd_count--;
5558 return; 5564 return;