atomic_inc(&lpfc_nvmep->xmt_fcp_abort);
 
        spin_lock_irqsave(&ctxp->ctxlock, flags);
-       ctxp->state = LPFC_NVMET_STE_ABORT;
 
        /* Since iaab/iaar are NOT set, we need to check
         * if the firmware is in process of aborting IO
        ctxp->flag |= LPFC_NVMET_ABORT_OP;
 
        if (ctxp->flag & LPFC_NVMET_DEFER_WQFULL) {
+               spin_unlock_irqrestore(&ctxp->ctxlock, flags);
                lpfc_nvmet_unsol_fcp_issue_abort(phba, ctxp, ctxp->sid,
                                                 ctxp->oxid);
                wq = ctxp->hdwq->nvme_wq;
-               spin_unlock_irqrestore(&ctxp->ctxlock, flags);
                lpfc_nvmet_wqfull_flush(phba, wq, ctxp);
                return;
        }
+       spin_unlock_irqrestore(&ctxp->ctxlock, flags);
 
        /* An state of LPFC_NVMET_STE_RCV means we have just received
         * the NVME command and have not started processing it.
        else
                lpfc_nvmet_sol_fcp_issue_abort(phba, ctxp, ctxp->sid,
                                               ctxp->oxid);
-       spin_unlock_irqrestore(&ctxp->ctxlock, flags);
 }
 
 static void
        unsigned long flags;
        bool aborting = false;
 
-       if (ctxp->state != LPFC_NVMET_STE_DONE &&
-           ctxp->state != LPFC_NVMET_STE_ABORT) {
+       spin_lock_irqsave(&ctxp->ctxlock, flags);
+       if (ctxp->flag & LPFC_NVMET_XBUSY)
+               lpfc_printf_log(phba, KERN_INFO, LOG_NVME_IOERR,
+                               "6027 NVMET release with XBUSY flag x%x"
+                               " oxid x%x\n",
+                               ctxp->flag, ctxp->oxid);
+       else if (ctxp->state != LPFC_NVMET_STE_DONE &&
+                ctxp->state != LPFC_NVMET_STE_ABORT)
                lpfc_printf_log(phba, KERN_ERR, LOG_NVME_IOERR,
                                "6413 NVMET release bad state %d %d oxid x%x\n",
                                ctxp->state, ctxp->entry_cnt, ctxp->oxid);
-       }
 
-       spin_lock_irqsave(&ctxp->ctxlock, flags);
        if ((ctxp->flag & LPFC_NVMET_ABORT_OP) ||
            (ctxp->flag & LPFC_NVMET_XBUSY)) {
                aborting = true;
                if (ctxp->ctxbuf->sglq->sli4_xritag != xri)
                        continue;
 
+               spin_lock(&ctxp->ctxlock);
                /* Check if we already received a free context call
                 * and we have completed processing an abort situation.
                 */
                        released = true;
                }
                ctxp->flag &= ~LPFC_NVMET_XBUSY;
+               spin_unlock(&ctxp->ctxlock);
                spin_unlock(&phba->sli4_hba.abts_nvmet_buf_list_lock);
 
                rrq_empty = list_empty(&phba->active_rrq_list);
 int
 lpfc_nvmet_rcv_unsol_abort(struct lpfc_vport *vport,
                           struct fc_frame_header *fc_hdr)
-
 {
 #if (IS_ENABLED(CONFIG_NVME_TARGET_FC))
        struct lpfc_hba *phba = vport->phba;
        if (ctxp->flag & LPFC_NVMET_ABORT_OP)
                atomic_inc(&tgtp->xmt_fcp_abort_cmpl);
 
+       spin_lock_irqsave(&ctxp->ctxlock, flags);
        ctxp->state = LPFC_NVMET_STE_DONE;
 
        /* Check if we already received a free context call
         * and we have completed processing an abort situation.
         */
-       spin_lock_irqsave(&ctxp->ctxlock, flags);
        if ((ctxp->flag & LPFC_NVMET_CTX_RLS) &&
            !(ctxp->flag & LPFC_NVMET_XBUSY)) {
+               spin_lock(&phba->sli4_hba.abts_nvmet_buf_list_lock);
                list_del(&ctxp->list);
+               spin_unlock(&phba->sli4_hba.abts_nvmet_buf_list_lock);
                released = true;
        }
        ctxp->flag &= ~LPFC_NVMET_ABORT_OP;
        }
 
        tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private;
+       spin_lock_irqsave(&ctxp->ctxlock, flags);
        if (ctxp->flag & LPFC_NVMET_ABORT_OP)
                atomic_inc(&tgtp->xmt_fcp_abort_cmpl);
 
         * and we have completed processing an abort situation.
         */
        ctxp->state = LPFC_NVMET_STE_DONE;
-       spin_lock_irqsave(&ctxp->ctxlock, flags);
        if ((ctxp->flag & LPFC_NVMET_CTX_RLS) &&
            !(ctxp->flag & LPFC_NVMET_XBUSY)) {
+               spin_lock(&phba->sli4_hba.abts_nvmet_buf_list_lock);
                list_del(&ctxp->list);
+               spin_unlock(&phba->sli4_hba.abts_nvmet_buf_list_lock);
                released = true;
        }
        ctxp->flag &= ~LPFC_NVMET_ABORT_OP;
                                (ndlp) ? ndlp->nlp_state : NLP_STE_MAX_STATE);
 
                /* No failure to an ABTS request. */
+               spin_lock_irqsave(&ctxp->ctxlock, flags);
                ctxp->flag &= ~LPFC_NVMET_ABORT_OP;
+               spin_unlock_irqrestore(&ctxp->ctxlock, flags);
                return 0;
        }
 
        /* Issue ABTS for this WQE based on iotag */
        ctxp->abort_wqeq = lpfc_sli_get_iocbq(phba);
+       spin_lock_irqsave(&ctxp->ctxlock, flags);
        if (!ctxp->abort_wqeq) {
                atomic_inc(&tgtp->xmt_abort_rsp_error);
                lpfc_printf_log(phba, KERN_ERR, LOG_NVME_ABTS,
                                "xri: x%x\n", ctxp->oxid);
                /* No failure to an ABTS request. */
                ctxp->flag &= ~LPFC_NVMET_ABORT_OP;
+               spin_unlock_irqrestore(&ctxp->ctxlock, flags);
                return 0;
        }
        abts_wqeq = ctxp->abort_wqeq;
        abts_wqe = &abts_wqeq->wqe;
        ctxp->state = LPFC_NVMET_STE_ABORT;
+       spin_unlock_irqrestore(&ctxp->ctxlock, flags);
 
        /* Announce entry to new IO submit field. */
        lpfc_printf_log(phba, KERN_INFO, LOG_NVME_ABTS,
                                "NVME Req now. hba_flag x%x oxid x%x\n",
                                phba->hba_flag, ctxp->oxid);
                lpfc_sli_release_iocbq(phba, abts_wqeq);
+               spin_lock_irqsave(&ctxp->ctxlock, flags);
                ctxp->flag &= ~LPFC_NVMET_ABORT_OP;
+               spin_unlock_irqrestore(&ctxp->ctxlock, flags);
                return 0;
        }
 
                                "still pending on oxid x%x\n",
                                ctxp->oxid);
                lpfc_sli_release_iocbq(phba, abts_wqeq);
+               spin_lock_irqsave(&ctxp->ctxlock, flags);
                ctxp->flag &= ~LPFC_NVMET_ABORT_OP;
+               spin_unlock_irqrestore(&ctxp->ctxlock, flags);
                return 0;
        }
 
        }
 
        atomic_inc(&tgtp->xmt_abort_rsp_error);
+       spin_lock_irqsave(&ctxp->ctxlock, flags);
        ctxp->flag &= ~LPFC_NVMET_ABORT_OP;
+       spin_unlock_irqrestore(&ctxp->ctxlock, flags);
        lpfc_sli_release_iocbq(phba, abts_wqeq);
        lpfc_printf_log(phba, KERN_ERR, LOG_NVME_ABTS,
                        "6166 Failed ABORT issue_wqe with status x%x "
        return 1;
 }
 
-
 static int
 lpfc_nvmet_unsol_fcp_issue_abort(struct lpfc_hba *phba,
                                 struct lpfc_nvmet_rcv_ctx *ctxp,
        struct lpfc_nvmet_tgtport *tgtp;
        struct lpfc_iocbq *abts_wqeq;
        unsigned long flags;
+       bool released = false;
        int rc;
 
        tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private;
 
 aerr:
        spin_lock_irqsave(&ctxp->ctxlock, flags);
-       if (ctxp->flag & LPFC_NVMET_CTX_RLS)
+       if (ctxp->flag & LPFC_NVMET_CTX_RLS) {
+               spin_lock(&phba->sli4_hba.abts_nvmet_buf_list_lock);
                list_del(&ctxp->list);
+               spin_unlock(&phba->sli4_hba.abts_nvmet_buf_list_lock);
+               released = true;
+       }
        ctxp->flag &= ~(LPFC_NVMET_ABORT_OP | LPFC_NVMET_CTX_RLS);
        spin_unlock_irqrestore(&ctxp->ctxlock, flags);
 
        lpfc_printf_log(phba, KERN_ERR, LOG_NVME_ABTS,
                        "6135 Failed to Issue ABTS for oxid x%x. Status x%x\n",
                        ctxp->oxid, rc);
-       lpfc_nvmet_ctxbuf_post(phba, ctxp->ctxbuf);
+       if (released)
+               lpfc_nvmet_ctxbuf_post(phba, ctxp->ctxbuf);
        return 1;
 }