Message ID | 1486161655-2307-11-git-send-email-himanshu.madhani@cavium.com (mailing list archive) |
---|---|
State | Deferred |
Headers | show |
On Fri, 2017-02-03 at 14:40 -0800, Himanshu Madhani wrote: > From: Quinn Tran <quinn.tran@cavium.com> > > 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> > --- > drivers/scsi/qla2xxx/qla_target.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c > index b61cbb8..b5fb9c55 100644 > --- a/drivers/scsi/qla2xxx/qla_target.c > +++ b/drivers/scsi/qla2xxx/qla_target.c > @@ -5170,16 +5170,22 @@ static int __qlt_send_busy(struct scsi_qla_host *vha, > > static int > qlt_chk_qfull_thresh_hold(struct scsi_qla_host *vha, > - struct atio_from_isp *atio) > + struct atio_from_isp *atio, uint8_t ha_locked) > { > struct qla_hw_data *ha = vha->hw; > uint16_t status; > + unsigned long flags; > > if (ha->tgt.num_pend_cmds < Q_FULL_THRESH_HOLD(ha)) > return 0; > > + if (!ha_locked) > + spin_lock_irqsave(&ha->hardware_lock, flags); > status = temp_sam_status; > qlt_send_busy(vha, atio, status); > + if (!ha_locked) > + spin_unlock_irqrestore(&ha->hardware_lock, flags); > + > return 1; > } > > @@ -5224,7 +5230,7 @@ static void qlt_24xx_atio_pkt(struct scsi_qla_host *vha, > > > if (likely(atio->u.isp24.fcp_cmnd.task_mgmt_flags == 0)) { > - rc = qlt_chk_qfull_thresh_hold(vha, atio); > + rc = qlt_chk_qfull_thresh_hold(vha, atio, ha_locked); > if (rc != 0) { > tgt->atio_irq_cmd_count--; > return; > @@ -5347,7 +5353,7 @@ static void qlt_response_pkt(struct scsi_qla_host *vha, response_t *pkt) > break; > } > > - rc = qlt_chk_qfull_thresh_hold(vha, atio); > + rc = qlt_chk_qfull_thresh_hold(vha, atio, 1); > if (rc != 0) { > tgt->irq_cmd_count--; > return; Hello Quinn, Please consider to use bool instead of uint8_t for ha_locked and true / false instead of 1 / 0. Bart.-- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
QmFydCwgdGhhbmtzIGZvciByZXZpZXdpbmcuICBXaWxsIGNsZWFuIGl0IHVwLg0KDQpSZWdhcmRz LA0KUXVpbm4gVHJhbg0KDQotLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KRnJvbTogPGxpbnV4 LXNjc2ktb3duZXJAdmdlci5rZXJuZWwub3JnPiBvbiBiZWhhbGYgb2YgQmFydCBWYW4gQXNzY2hl IDxCYXJ0LlZhbkFzc2NoZUBzYW5kaXNrLmNvbT4NCkRhdGU6IFdlZG5lc2RheSwgRmVicnVhcnkg OCwgMjAxNyBhdCAxMToyMiBBTQ0KVG86ICJoY2hAaW5mcmFkZWFkLm9yZyIgPGhjaEBpbmZyYWRl YWQub3JnPiwgIk1hZGhhbmksIEhpbWFuc2h1IiA8SGltYW5zaHUuTWFkaGFuaUBjYXZpdW0uY29t PiwgdGFyZ2V0LWRldmVsIDx0YXJnZXQtZGV2ZWxAdmdlci5rZXJuZWwub3JnPiwgTmljaG9sYXMg QmVsbGluZ2VyIDxuYWJAbGludXgtaXNjc2kub3JnPg0KQ2M6ICJsaW51eC1zY3NpQHZnZXIua2Vy bmVsLm9yZyIgPGxpbnV4LXNjc2lAdmdlci5rZXJuZWwub3JnPiwgIk1hbGF2YWxpLCBHaXJpZGhh ciIgPEdpcmlkaGFyLk1hbGF2YWxpQGNhdml1bS5jb20+DQpTdWJqZWN0OiBSZTogW1BBVENIIHYy IDEwLzE0XSBxbGEyeHh4OiBGaXggcmVxdWVzdCBxdWV1ZSBjb3JydXB0aW9uLg0KUmVzZW50LUZy b206IDxxdWlubi50c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u DQogICAgDQogICAgQmFydC4NCiAgICANCg0K -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index b61cbb8..b5fb9c55 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -5170,16 +5170,22 @@ static int __qlt_send_busy(struct scsi_qla_host *vha, static int qlt_chk_qfull_thresh_hold(struct scsi_qla_host *vha, - struct atio_from_isp *atio) + struct atio_from_isp *atio, uint8_t ha_locked) { struct qla_hw_data *ha = vha->hw; uint16_t status; + unsigned long flags; if (ha->tgt.num_pend_cmds < Q_FULL_THRESH_HOLD(ha)) return 0; + if (!ha_locked) + spin_lock_irqsave(&ha->hardware_lock, flags); status = temp_sam_status; qlt_send_busy(vha, atio, status); + if (!ha_locked) + spin_unlock_irqrestore(&ha->hardware_lock, flags); + return 1; } @@ -5224,7 +5230,7 @@ static void qlt_24xx_atio_pkt(struct scsi_qla_host *vha, if (likely(atio->u.isp24.fcp_cmnd.task_mgmt_flags == 0)) { - rc = qlt_chk_qfull_thresh_hold(vha, atio); + rc = qlt_chk_qfull_thresh_hold(vha, atio, ha_locked); if (rc != 0) { tgt->atio_irq_cmd_count--; return; @@ -5347,7 +5353,7 @@ static void qlt_response_pkt(struct scsi_qla_host *vha, response_t *pkt) break; } - rc = qlt_chk_qfull_thresh_hold(vha, atio); + rc = qlt_chk_qfull_thresh_hold(vha, atio, 1); if (rc != 0) { tgt->irq_cmd_count--; return;