提交 fb84af8a 编写于 作者: S stephen hemminger 提交者: David S. Miller

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: NVitaly Kuznetsov <vkuznets@redhat.com>
Fixes: 0c195567 ("netvsc: transparent VF management")
Signed-off-by: NStephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 5f6b4e14
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册