]> www.infradead.org Git - users/hch/misc.git/commitdiff
scsi: lpfc: Check return status of lpfc_reset_flush_io_context during TGT_RESET
authorJustin Tee <justin.tee@broadcom.com>
Mon, 15 Sep 2025 18:08:03 +0000 (11:08 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 17 Sep 2025 02:19:59 +0000 (22:19 -0400)
If lpfc_reset_flush_io_context fails to execute, then the wrong return
status code may be passed back to upper layers when issuing a target
reset TMF command.  Fix by checking the return status from
lpfc_reset_flush_io_context() first in order to properly return FAILED
or FAST_IO_FAIL.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Message-ID: <20250915180811.137530-7-justintee8345@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_scsi.c

index 508ceeecf2d9598829f03b53b3efc97ab5372d45..6d9d8c196936afbf56620535d03b869c25e2bea5 100644 (file)
@@ -5935,7 +5935,7 @@ lpfc_chk_tgt_mapped(struct lpfc_vport *vport, struct fc_rport *rport)
 /**
  * lpfc_reset_flush_io_context -
  * @vport: The virtual port (scsi_host) for the flush context
- * @tgt_id: If aborting by Target contect - specifies the target id
+ * @tgt_id: If aborting by Target context - specifies the target id
  * @lun_id: If aborting by Lun context - specifies the lun id
  * @context: specifies the context level to flush at.
  *
@@ -6109,8 +6109,14 @@ lpfc_target_reset_handler(struct scsi_cmnd *cmnd)
                        pnode->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
                        spin_unlock_irqrestore(&pnode->lock, flags);
                }
-               lpfc_reset_flush_io_context(vport, tgt_id, lun_id,
-                                         LPFC_CTX_TGT);
+               status = lpfc_reset_flush_io_context(vport, tgt_id, lun_id,
+                                                    LPFC_CTX_TGT);
+               if (status != SUCCESS) {
+                       lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
+                                        "0726 Target Reset flush status x%x\n",
+                                        status);
+                       return status;
+               }
                return FAST_IO_FAIL;
        }
 
@@ -6202,7 +6208,7 @@ lpfc_host_reset_handler(struct scsi_cmnd *cmnd)
        int rc, ret = SUCCESS;
 
        lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
-                        "3172 SCSI layer issued Host Reset Data:\n");
+                        "3172 SCSI layer issued Host Reset\n");
 
        lpfc_offline_prep(phba, LPFC_MBX_WAIT);
        lpfc_offline(phba);