[azure][PATCH] UBUNTU: SAUCE: netvsc: fix rtnl deadlock on unregister of vf

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[azure][PATCH] UBUNTU: SAUCE: netvsc: fix rtnl deadlock on unregister of vf

Marcelo Henrique Cerri
From: stephen hemminger <[hidden email]>

BugLink: http://bugs.launchpad.net/bugs/1708995

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 <[hidden email]>
Fixes: 0c195567a8f6 ("netvsc: transparent VF management")
Signed-off-by: Stephen Hemminger <[hidden email]>
Signed-off-by: David S. Miller <[hidden email]>
(cherry picked from net-next commit fb84af8a4397ee664a51c2da1dd64fb3d582ee24)
Signed-off-by: Marcelo Henrique Cerri <[hidden email]>
---
 drivers/net/hyperv/netvsc_drv.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 1678428865d5..cd755d8ee67b 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -1623,7 +1623,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);
@@ -1677,7 +1681,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;
--
2.7.4


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

APPLIED: [azure][PATCH] UBUNTU: SAUCE: netvsc: fix rtnl deadlock on unregister of vf

Marcelo Henrique Cerri
Acked-by: Marcelo Henrique Cerri <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Loading...