struct lpfc_scsi_event_header scsi_event;
        int status;
        u32 logit = LOG_FCP;
+       u32 dev_loss_tmo = vport->cfg_devloss_tmo;
        unsigned long flags;
        DECLARE_WAIT_QUEUE_HEAD_ONSTACK(waitq);
 
 
        status = lpfc_send_taskmgmt(vport, cmnd, tgt_id, lun_id,
                                        FCP_TARGET_RESET);
-       if (status != SUCCESS)
-               logit =  LOG_TRACE_EVENT;
-       spin_lock_irqsave(&pnode->lock, flags);
-       if (status != SUCCESS &&
-           (!(pnode->upcall_flags & NLP_WAIT_FOR_LOGO)) &&
-            !pnode->logo_waitq) {
-               pnode->logo_waitq = &waitq;
-               pnode->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
-               pnode->nlp_flag |= NLP_ISSUE_LOGO;
-               pnode->upcall_flags |= NLP_WAIT_FOR_LOGO;
-               spin_unlock_irqrestore(&pnode->lock, flags);
-               lpfc_unreg_rpi(vport, pnode);
-               wait_event_timeout(waitq,
-                                  (!(pnode->upcall_flags & NLP_WAIT_FOR_LOGO)),
-                                   msecs_to_jiffies(vport->cfg_devloss_tmo *
-                                   1000));
-
-               if (pnode->upcall_flags & NLP_WAIT_FOR_LOGO) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
-                               "0725 SCSI layer TGTRST failed & LOGO TMO "
-                               " (%d, %llu) return x%x\n", tgt_id,
-                                lun_id, status);
-                       spin_lock_irqsave(&pnode->lock, flags);
-                       pnode->upcall_flags &= ~NLP_WAIT_FOR_LOGO;
+       if (status != SUCCESS) {
+               logit = LOG_TRACE_EVENT;
+
+               /* Issue LOGO, if no LOGO is outstanding */
+               spin_lock_irqsave(&pnode->lock, flags);
+               if (!(pnode->upcall_flags & NLP_WAIT_FOR_LOGO) &&
+                   !pnode->logo_waitq) {
+                       pnode->logo_waitq = &waitq;
+                       pnode->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
+                       pnode->nlp_flag |= NLP_ISSUE_LOGO;
+                       pnode->upcall_flags |= NLP_WAIT_FOR_LOGO;
+                       spin_unlock_irqrestore(&pnode->lock, flags);
+                       lpfc_unreg_rpi(vport, pnode);
+                       wait_event_timeout(waitq,
+                                          (!(pnode->upcall_flags &
+                                             NLP_WAIT_FOR_LOGO)),
+                                          msecs_to_jiffies(dev_loss_tmo *
+                                                           1000));
+
+                       if (pnode->upcall_flags & NLP_WAIT_FOR_LOGO) {
+                               lpfc_printf_vlog(vport, KERN_ERR, logit,
+                                                "0725 SCSI layer TGTRST "
+                                                "failed & LOGO TMO (%d, %llu) "
+                                                "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 {
-                       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,