All of lore.kernel.org
 help / color / mirror / Atom feed
From: Debabrata Banerjee <dbanerje@akamai.com>
To: "David S . Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Cc: dbanerje@akamai.com, Neil Horman <nhorman@tuxdriver.com>
Subject: [PATCH net-next] netpoll: allow cleanup to be synchronous
Date: Fri, 12 Oct 2018 12:59:29 -0400	[thread overview]
Message-ID: <20181012165929.20098-1-dbanerje@akamai.com> (raw)

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@tuxdriver.com>
CC: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Debabrata Banerjee <dbanerje@akamai.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

             reply	other threads:[~2018-10-13  1:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-12 16:59 Debabrata Banerjee [this message]
2018-10-12 17:27 ` [PATCH net-next] netpoll: allow cleanup to be synchronous Banerjee, Debabrata
2018-10-18  4:47 ` David Miller
2018-10-18 11:29   ` Neil Horman
2018-10-18 15:17     ` Banerjee, Debabrata
2018-10-18 16:59       ` Neil Horman
2018-10-18 17:47         ` Banerjee, Debabrata

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181012165929.20098-1-dbanerje@akamai.com \
    --to=dbanerje@akamai.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.