]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
scsi: lpfc: Remove redundant clean up code in disable_vport()
authorJustin Tee <justin.tee@broadcom.com>
Mon, 9 Jan 2023 23:33:10 +0000 (15:33 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 12 Jan 2023 05:03:14 +0000 (00:03 -0500)
The disable_vport() path calls the discovery state machine on all ndlps,
puts them into NPR state, and then calls lpfc_cleanup_rpis() with the
remove flag set.  This unintentionally decrements an ndlp's kref twice and
can result in premature release of an ndlp because
lpfc_dev_loss_tmo_handler() triggers clean up of the ndlp again later.

Remove redundant code in disable_vport() that sets all the ndlps to NPR,
and change the call to lpfc_cleanup_rpis() to not remove the ndlps.
lpfc_dev_loss_tmo_handler() will handle final removal of the ndlps.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_vport.c

index 4d171f5c213f7350a2cbf8e9957dbeda17ac6ded..5aeda245369b23c8d26e02a7bf1470c14ab264df 100644 (file)
@@ -534,7 +534,7 @@ disable_vport(struct fc_vport *fc_vport)
 {
        struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data;
        struct lpfc_hba   *phba = vport->phba;
-       struct lpfc_nodelist *ndlp = NULL, *next_ndlp = NULL;
+       struct lpfc_nodelist *ndlp = NULL;
        struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
 
        /* Can't disable during an outstanding delete. */
@@ -546,17 +546,7 @@ disable_vport(struct fc_vport *fc_vport)
                (void)lpfc_send_npiv_logo(vport, ndlp);
 
        lpfc_sli_host_down(vport);
-
-       /* Mark all nodes for discovery so we can remove them by
-        * calling lpfc_cleanup_rpis(vport, 1)
-        */
-       list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) {
-               if (ndlp->nlp_state == NLP_STE_UNUSED_NODE)
-                       continue;
-               lpfc_disc_state_machine(vport, ndlp, NULL,
-                                       NLP_EVT_DEVICE_RECOVERY);
-       }
-       lpfc_cleanup_rpis(vport, 1);
+       lpfc_cleanup_rpis(vport, 0);
 
        lpfc_stop_vport_timers(vport);
        lpfc_unreg_all_rpis(vport);