Skip to content

Commit

Permalink
scsi: lpfc: Fix oops when unloading driver while running mds diags
Browse files Browse the repository at this point in the history
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/20200803210229.23063-5-jsmart2021@gmail.com
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Dick Kennedy authored and Martin K. Petersen committed Aug 5, 2020
1 parent 8ccd692 commit 24411fc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions drivers/scsi/lpfc/lpfc_sli.c
Original file line number Diff line number Diff line change
Expand Up @@ -13650,7 +13650,11 @@ lpfc_sli4_sp_handle_rcqe(struct lpfc_hba *phba, struct lpfc_rcqe *rcqe)
fc_hdr->fh_r_ctl == FC_RCTL_DD_UNSOL_DATA) {
spin_unlock_irqrestore(&phba->hbalock, iflags);
/* Handle MDS Loopback frames */
lpfc_sli4_handle_mds_loopback(phba->pport, dma_buf);
if (!(phba->pport->load_flag & FC_UNLOADING))
lpfc_sli4_handle_mds_loopback(phba->pport,
dma_buf);
else
lpfc_in_buf_free(phba, &dma_buf->dbuf);
break;
}

Expand Down Expand Up @@ -18363,7 +18367,10 @@ lpfc_sli4_handle_received_buffer(struct lpfc_hba *phba,
fc_hdr->fh_r_ctl == FC_RCTL_DD_UNSOL_DATA) {
vport = phba->pport;
/* Handle MDS Loopback frames */
lpfc_sli4_handle_mds_loopback(vport, dmabuf);
if (!(phba->pport->load_flag & FC_UNLOADING))
lpfc_sli4_handle_mds_loopback(vport, dmabuf);
else
lpfc_in_buf_free(phba, &dmabuf->dbuf);
return;
}

Expand Down

0 comments on commit 24411fc

Please sign in to comment.