ibmvnic: Flush existing work items before device removal

Ensure that all scheduled work items have completed before continuing
with device removal and after further event scheduling has been
halted. This patch fixes a bug where a scheduled driver reset event
is processed following device removal.

Signed-off-by: Thomas Falcon <tlfalcon@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Thomas Falcon 2020-06-12 13:34:41 -05:00 committed by David S. Miller
parent b65ce380b7
commit 6954a9e419
1 changed files with 3 additions and 0 deletions

View File

@ -5184,6 +5184,9 @@ static int ibmvnic_remove(struct vio_dev *dev)
adapter->state = VNIC_REMOVING; adapter->state = VNIC_REMOVING;
spin_unlock_irqrestore(&adapter->state_lock, flags); spin_unlock_irqrestore(&adapter->state_lock, flags);
flush_work(&adapter->ibmvnic_reset);
flush_delayed_work(&adapter->ibmvnic_delayed_reset);
rtnl_lock(); rtnl_lock();
unregister_netdevice(netdev); unregister_netdevice(netdev);