]> git.baikalelectronics.ru Git - kernel.git/commit
netpoll: allow cleanup to be synchronous
authorDebabrata Banerjee <dbanerje@akamai.com>
Thu, 18 Oct 2018 15:18:26 +0000 (11:18 -0400)
committerDavid S. Miller <davem@davemloft.net>
Sat, 20 Oct 2018 00:01:43 +0000 (17:01 -0700)
commitec677013b06d0bfcab1f9710681c18e248a44c00
tree1f3d85463e83f066e5aa7e335d70382f0fc23dba
parent03f2e7612ad382c2dd612d0812c3d23c8ac83c46
netpoll: allow cleanup to be synchronous

This fixes a problem introduced by:
commit bff9b8a7f5f7 ("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. It appears to be locked everywhere it's called from.

Generalize the design pattern from the teaming driver for current
callers of __netpoll_free_async.

CC: Neil Horman <nhorman@tuxdriver.com>
CC: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Debabrata Banerjee <dbanerje@akamai.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_main.c
drivers/net/macvlan.c
drivers/net/team/team.c
include/linux/netpoll.h
net/8021q/vlan_dev.c
net/bridge/br_device.c
net/core/netpoll.c
net/dsa/slave.c