net: devinet: Reduce refcount before grace period
authorEric Dumazet <edumazet@google.com>
Fri, 18 Nov 2022 19:19:09 +0000 (19:19 +0000)
committerPaul E. McKenney <paulmck@kernel.org>
Wed, 30 Nov 2022 21:17:52 +0000 (13:17 -0800)
commit9d40c84cf5bcb5b1d124921ded2056d76be7640d
tree1b935a074c4996bba2aa89067e41d2acbcd2aa7d
parent483c26ff63f42e8898ed43aca0b9953bc91f0cd4
net: devinet: Reduce refcount before grace period

Currently, the inetdev_destroy() function waits for an RCU grace period
before decrementing the refcount and freeing memory. This causes a delay
with a new RCU configuration that tries to save power, which results in the
network interface disappearing later than expected. The resulting delay
causes test failures on ChromeOS.

Refactor the code such that the refcount is freed before the grace period
and memory is freed after. With this a ChromeOS network test passes that
does 'ip netns del' and polls for an interface disappearing, now passes.

Reported-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Cc: David Ahern <dsahern@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: <netdev@vger.kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
net/ipv4/devinet.c