Skip to content

Commit 24411fc

Browse files
Dick Kennedymartinkpetersen
authored andcommitted
scsi: lpfc: Fix oops when unloading driver while running mds diags
While mds diagnostic tests are running, if the driver is requested to be unloaded, oops or hangs are observed. The driver doesn't terminate the processing of diag frames when the unload is started. As such: oops may be seen for __lpfc_sli_release_iocbq_s4 because ring memory is referenced that was already freed; or hangs see in lpfc_nvme_wait_for_io_drain as ios no longer complete. If unloading, don't process diag frames. Just clean them up. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dick Kennedy <[email protected]> Signed-off-by: James Smart <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 8ccd692 commit 24411fc

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/scsi/lpfc/lpfc_sli.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13650,7 +13650,11 @@ lpfc_sli4_sp_handle_rcqe(struct lpfc_hba *phba, struct lpfc_rcqe *rcqe)
1365013650
fc_hdr->fh_r_ctl == FC_RCTL_DD_UNSOL_DATA) {
1365113651
spin_unlock_irqrestore(&phba->hbalock, iflags);
1365213652
/* Handle MDS Loopback frames */
13653-
lpfc_sli4_handle_mds_loopback(phba->pport, dma_buf);
13653+
if (!(phba->pport->load_flag & FC_UNLOADING))
13654+
lpfc_sli4_handle_mds_loopback(phba->pport,
13655+
dma_buf);
13656+
else
13657+
lpfc_in_buf_free(phba, &dma_buf->dbuf);
1365413658
break;
1365513659
}
1365613660

@@ -18363,7 +18367,10 @@ lpfc_sli4_handle_received_buffer(struct lpfc_hba *phba,
1836318367
fc_hdr->fh_r_ctl == FC_RCTL_DD_UNSOL_DATA) {
1836418368
vport = phba->pport;
1836518369
/* Handle MDS Loopback frames */
18366-
lpfc_sli4_handle_mds_loopback(vport, dmabuf);
18370+
if (!(phba->pport->load_flag & FC_UNLOADING))
18371+
lpfc_sli4_handle_mds_loopback(vport, dmabuf);
18372+
else
18373+
lpfc_in_buf_free(phba, &dmabuf->dbuf);
1836718374
return;
1836818375
}
1836918376

0 commit comments

Comments
 (0)