Commit 21990d3d authored by James Smart's avatar James Smart Committed by Martin K. Petersen

scsi: lpfc: Fix target reset handler from falsely returning FAILURE

Previous logic accidentally overrides the status variable to FAILURE when
target reset status is SUCCESS.

Refactor the non-SUCCESS logic of lpfc_vmid_vport_cleanup(), which resolves
the false override.

Link: https://lore.kernel.org/r/20210707184351.67872-7-jsmart2021@gmail.comCo-developed-by: default avatarJustin Tee <justin.tee@broadcom.com>
Signed-off-by: default avatarJustin Tee <justin.tee@broadcom.com>
Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent e77803bd
...@@ -6273,6 +6273,7 @@ lpfc_target_reset_handler(struct scsi_cmnd *cmnd) ...@@ -6273,6 +6273,7 @@ lpfc_target_reset_handler(struct scsi_cmnd *cmnd)
struct lpfc_scsi_event_header scsi_event; struct lpfc_scsi_event_header scsi_event;
int status; int status;
u32 logit = LOG_FCP; u32 logit = LOG_FCP;
u32 dev_loss_tmo = vport->cfg_devloss_tmo;
unsigned long flags; unsigned long flags;
DECLARE_WAIT_QUEUE_HEAD_ONSTACK(waitq); DECLARE_WAIT_QUEUE_HEAD_ONSTACK(waitq);
...@@ -6314,39 +6315,44 @@ lpfc_target_reset_handler(struct scsi_cmnd *cmnd) ...@@ -6314,39 +6315,44 @@ lpfc_target_reset_handler(struct scsi_cmnd *cmnd)
status = lpfc_send_taskmgmt(vport, cmnd, tgt_id, lun_id, status = lpfc_send_taskmgmt(vport, cmnd, tgt_id, lun_id,
FCP_TARGET_RESET); FCP_TARGET_RESET);
if (status != SUCCESS) if (status != SUCCESS) {
logit = LOG_TRACE_EVENT; logit = LOG_TRACE_EVENT;
spin_lock_irqsave(&pnode->lock, flags);
if (status != SUCCESS && /* Issue LOGO, if no LOGO is outstanding */
(!(pnode->upcall_flags & NLP_WAIT_FOR_LOGO)) && spin_lock_irqsave(&pnode->lock, flags);
!pnode->logo_waitq) { if (!(pnode->upcall_flags & NLP_WAIT_FOR_LOGO) &&
pnode->logo_waitq = &waitq; !pnode->logo_waitq) {
pnode->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; pnode->logo_waitq = &waitq;
pnode->nlp_flag |= NLP_ISSUE_LOGO; pnode->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
pnode->upcall_flags |= NLP_WAIT_FOR_LOGO; pnode->nlp_flag |= NLP_ISSUE_LOGO;
spin_unlock_irqrestore(&pnode->lock, flags); pnode->upcall_flags |= NLP_WAIT_FOR_LOGO;
lpfc_unreg_rpi(vport, pnode); spin_unlock_irqrestore(&pnode->lock, flags);
wait_event_timeout(waitq, lpfc_unreg_rpi(vport, pnode);
(!(pnode->upcall_flags & NLP_WAIT_FOR_LOGO)), wait_event_timeout(waitq,
msecs_to_jiffies(vport->cfg_devloss_tmo * (!(pnode->upcall_flags &
1000)); NLP_WAIT_FOR_LOGO)),
msecs_to_jiffies(dev_loss_tmo *
if (pnode->upcall_flags & NLP_WAIT_FOR_LOGO) { 1000));
lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
"0725 SCSI layer TGTRST failed & LOGO TMO " if (pnode->upcall_flags & NLP_WAIT_FOR_LOGO) {
" (%d, %llu) return x%x\n", tgt_id, lpfc_printf_vlog(vport, KERN_ERR, logit,
lun_id, status); "0725 SCSI layer TGTRST "
spin_lock_irqsave(&pnode->lock, flags); "failed & LOGO TMO (%d, %llu) "
pnode->upcall_flags &= ~NLP_WAIT_FOR_LOGO; "return x%x\n",
tgt_id, lun_id, status);
spin_lock_irqsave(&pnode->lock, flags);
pnode->upcall_flags &= ~NLP_WAIT_FOR_LOGO;
} else {
spin_lock_irqsave(&pnode->lock, flags);
}
pnode->logo_waitq = NULL;
spin_unlock_irqrestore(&pnode->lock, flags);
status = SUCCESS;
} else { } else {
spin_lock_irqsave(&pnode->lock, flags); spin_unlock_irqrestore(&pnode->lock, flags);
status = FAILED;
} }
pnode->logo_waitq = NULL;
spin_unlock_irqrestore(&pnode->lock, flags);
status = SUCCESS;
} else {
status = FAILED;
spin_unlock_irqrestore(&pnode->lock, flags);
} }
lpfc_printf_vlog(vport, KERN_ERR, logit, lpfc_printf_vlog(vport, KERN_ERR, logit,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment