* [PATCH] netvsc: fix deadlock betwen link status and removal
@ 2017-08-24 23:49 Stephen Hemminger
2017-08-25 4:59 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2017-08-24 23:49 UTC (permalink / raw)
To: kys, haiyangz, sthemmin; +Cc: netdev
There is a deadlock possible when canceling the link status
delayed work queue. The removal process is run with RTNL held,
and the link status callback is acquring RTNL.
Resolve the issue by using trylock and rescheduling.
If cancel is in process, that block it from happening.
Fixes: 122a5f6410f4 ("staging: hv: use delayed_work for netvsc_send_garp()")
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
---
This should be queued for stable as well. Problem has existed back to 3.10
drivers/net/hyperv/netvsc_drv.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 0d78727f1a14..d91cbc6c3ca4 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -1269,7 +1269,12 @@ static void netvsc_link_change(struct work_struct *w)
bool notify = false, reschedule = false;
unsigned long flags, next_reconfig, delay;
- rtnl_lock();
+ /* if changes are happening, comeback later */
+ if (!rtnl_trylock()) {
+ schedule_delayed_work(&ndev_ctx->dwork, LINKCHANGE_INT);
+ return;
+ }
+
net_device = rtnl_dereference(ndev_ctx->nvdev);
if (!net_device)
goto out_unlock;
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] netvsc: fix deadlock betwen link status and removal
2017-08-24 23:49 [PATCH] netvsc: fix deadlock betwen link status and removal Stephen Hemminger
@ 2017-08-25 4:59 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-08-25 4:59 UTC (permalink / raw)
To: stephen; +Cc: kys, haiyangz, sthemmin, netdev
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Thu, 24 Aug 2017 16:49:16 -0700
> There is a deadlock possible when canceling the link status
> delayed work queue. The removal process is run with RTNL held,
> and the link status callback is acquring RTNL.
>
> Resolve the issue by using trylock and rescheduling.
> If cancel is in process, that block it from happening.
>
> Fixes: 122a5f6410f4 ("staging: hv: use delayed_work for netvsc_send_garp()")
> Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-25 4:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-24 23:49 [PATCH] netvsc: fix deadlock betwen link status and removal Stephen Hemminger
2017-08-25 4:59 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).