ret_val = __lpfc_sli_issue_iocb(phba, LPFC_FCP_RING,
                                                abtsiocb, 0);
        }
-       /* no longer need the lock after this point */
-       spin_unlock_irqrestore(&phba->hbalock, flags);
 
        if (ret_val == IOCB_ERROR) {
                /* Indicate the IO is not being aborted by the driver. */
                iocb->iocb_flag &= ~LPFC_DRIVER_ABORTED;
                lpfc_cmd->waitq = NULL;
                spin_unlock(&lpfc_cmd->buf_lock);
+               spin_unlock_irqrestore(&phba->hbalock, flags);
                lpfc_sli_release_iocbq(phba, abtsiocb);
                ret = FAILED;
                goto out;
        }
 
+       /* no longer need the lock after this point */
        spin_unlock(&lpfc_cmd->buf_lock);
+       spin_unlock_irqrestore(&phba->hbalock, flags);
 
        if (phba->cfg_poll & DISABLE_FCP_RING_INT)
                lpfc_sli_handle_fast_ring_event(phba,