Unverified Commit c05bfd86 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!9550 scsi: bnx2fc: Flush destroy_work queue before calling bnx2fc_interface_put()

parents 9136f1ca 87d2f277
Loading
Loading
Loading
Loading
+5 −15
Original line number Diff line number Diff line
@@ -80,7 +80,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
@@ -916,9 +916,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:
@@ -1225,8 +1222,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;
}

@@ -1535,7 +1532,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);
@@ -1663,8 +1659,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);
}

/**
@@ -1705,15 +1701,12 @@ static int bnx2fc_destroy(struct net_device *netdev)
	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);
}
@@ -2567,9 +2560,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))