]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - drivers/scsi/bnx2fc/bnx2fc_fcoe.c
scsi: bnx2fc: Flush destroy_work queue before calling bnx2fc_interface_put()
[mirror_ubuntu-jammy-kernel.git] / drivers / scsi / bnx2fc / bnx2fc_fcoe.c
index 8863a74e6c57dcff0a644eef28c5e81628f7ab15..a8ce854c468478e0b8bc52b0f31e65b52ed8c380 100644 (file)
@@ -82,7 +82,7 @@ static int bnx2fc_bind_pcidev(struct bnx2fc_hba *hba);
 static void bnx2fc_unbind_pcidev(struct bnx2fc_hba *hba);
 static struct fc_lport *bnx2fc_if_create(struct bnx2fc_interface *interface,
                                  struct device *parent, int npiv);
-static void bnx2fc_destroy_work(struct work_struct *work);
+static void bnx2fc_port_destroy(struct fcoe_port *port);
 
 static struct bnx2fc_hba *bnx2fc_hba_lookup(struct net_device *phys_dev);
 static struct bnx2fc_interface *bnx2fc_interface_lookup(struct net_device
@@ -907,9 +907,6 @@ static void bnx2fc_indicate_netevent(void *context, unsigned long event,
                                __bnx2fc_destroy(interface);
                }
                mutex_unlock(&bnx2fc_dev_lock);
-
-               /* Ensure ALL destroy work has been completed before return */
-               flush_workqueue(bnx2fc_wq);
                return;
 
        default:
@@ -1215,8 +1212,8 @@ static int bnx2fc_vport_destroy(struct fc_vport *vport)
        mutex_unlock(&n_port->lp_mutex);
        bnx2fc_free_vport(interface->hba, port->lport);
        bnx2fc_port_shutdown(port->lport);
+       bnx2fc_port_destroy(port);
        bnx2fc_interface_put(interface);
-       queue_work(bnx2fc_wq, &port->destroy_work);
        return 0;
 }
 
@@ -1525,7 +1522,6 @@ static struct fc_lport *bnx2fc_if_create(struct bnx2fc_interface *interface,
        port->lport = lport;
        port->priv = interface;
        port->get_netdev = bnx2fc_netdev;
-       INIT_WORK(&port->destroy_work, bnx2fc_destroy_work);
 
        /* Configure fcoe_port */
        rc = bnx2fc_lport_config(lport);
@@ -1653,8 +1649,8 @@ static void __bnx2fc_destroy(struct bnx2fc_interface *interface)
        bnx2fc_interface_cleanup(interface);
        bnx2fc_stop(interface);
        list_del(&interface->list);
+       bnx2fc_port_destroy(port);
        bnx2fc_interface_put(interface);
-       queue_work(bnx2fc_wq, &port->destroy_work);
 }
 
 /**
@@ -1694,15 +1690,12 @@ netdev_err:
        return rc;
 }
 
-static void bnx2fc_destroy_work(struct work_struct *work)
+static void bnx2fc_port_destroy(struct fcoe_port *port)
 {
-       struct fcoe_port *port;
        struct fc_lport *lport;
 
-       port = container_of(work, struct fcoe_port, destroy_work);
        lport = port->lport;
-
-       BNX2FC_HBA_DBG(lport, "Entered bnx2fc_destroy_work\n");
+       BNX2FC_HBA_DBG(lport, "Entered %s, destroying lport %p\n", __func__, lport);
 
        bnx2fc_if_destroy(lport);
 }
@@ -2556,9 +2549,6 @@ static void bnx2fc_ulp_exit(struct cnic_dev *dev)
                        __bnx2fc_destroy(interface);
        mutex_unlock(&bnx2fc_dev_lock);
 
-       /* Ensure ALL destroy work has been completed before return */
-       flush_workqueue(bnx2fc_wq);
-
        bnx2fc_ulp_stop(hba);
        /* unregister cnic device */
        if (test_and_clear_bit(BNX2FC_CNIC_REGISTERED, &hba->reg_with_cnic))