[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181012165929.20098-1-dbanerje@akamai.com>
Date: Fri, 12 Oct 2018 12:59:29 -0400
From: Debabrata Banerjee <dbanerje@...mai.com>
To: "David S . Miller" <davem@...emloft.net>, netdev@...r.kernel.org
Cc: dbanerje@...mai.com, Neil Horman <nhorman@...driver.com>
Subject: [PATCH net-next] netpoll: allow cleanup to be synchronous
This fixes a problem introduced by:
commit 2cde6acd49da ("netpoll: Fix __netpoll_rcu_free so that it can hold the rtnl lock")
When using netconsole on a bond, __netpoll_cleanup can asynchronously
recurse multiple times, each __netpoll_free_async call can result in
more __netpoll_free_async's. This means there is now a race between
cleanup_work queues on multiple netpoll_info's on multiple devices and
the configuration of a new netpoll. For example if a netconsole is set
to enable 0, reconfigured, and enable 1 immediately, this netconsole
will likely not work.
Given the reason for __netpoll_free_async is it can be called when rtnl
is not locked, if it is locked, we should be able to execute
synchronously.
CC: Neil Horman <nhorman@...driver.com>
CC: "David S. Miller" <davem@...emloft.net>
Signed-off-by: Debabrata Banerjee <dbanerje@...mai.com>
---
net/core/netpoll.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index de1d1ba92f2d..b899cbfbe639 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -826,7 +826,10 @@ static void netpoll_async_cleanup(struct work_struct *work)
void __netpoll_free_async(struct netpoll *np)
{
- schedule_work(&np->cleanup_work);
+ if (rtnl_is_locked())
+ __netpoll_cleanup(np);
+ else
+ schedule_work(&np->cleanup_work);
}
EXPORT_SYMBOL_GPL(__netpoll_free_async);
--
2.19.1
Powered by blists - more mailing lists