diff options
author | stephen hemminger <stephen@networkplumber.org> | 2017-08-04 12:14:00 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-06 21:28:10 -0700 |
commit | fb84af8a4397ee664a51c2da1dd64fb3d582ee24 (patch) | |
tree | 6a3deb9f2ce3a088a5467f75cc42447b8f3ae1ba /drivers/net/hyperv | |
parent | 5f6b4e14cada6ddc662b80cbd670d9cd2922aea1 (diff) | |
download | talos-op-linux-fb84af8a4397ee664a51c2da1dd64fb3d582ee24.tar.gz talos-op-linux-fb84af8a4397ee664a51c2da1dd64fb3d582ee24.zip |
netvsc: fix rtnl deadlock on unregister of vf
With new transparent VF support, it is possible to get a deadlock
when some of the deferred work is running and the unregister_vf
is trying to cancel the work element. The solution is to use
trylock and reschedule (similar to bonding and team device).
Reported-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Fixes: 0c195567a8f6 ("netvsc: transparent VF management")
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/hyperv')
-rw-r--r-- | drivers/net/hyperv/netvsc_drv.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index c71728d82049..e75c0f852a63 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -1601,7 +1601,11 @@ static void netvsc_vf_setup(struct work_struct *w) struct net_device *ndev = hv_get_drvdata(ndev_ctx->device_ctx); struct net_device *vf_netdev; - rtnl_lock(); + if (!rtnl_trylock()) { + schedule_work(w); + return; + } + vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev); if (vf_netdev) __netvsc_vf_setup(ndev, vf_netdev); @@ -1655,7 +1659,11 @@ static void netvsc_vf_update(struct work_struct *w) struct net_device *vf_netdev; bool vf_is_up; - rtnl_lock(); + if (!rtnl_trylock()) { + schedule_work(w); + return; + } + vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev); if (!vf_netdev) goto unlock; |