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) <>
Signed-off-by: Eric Dumazet <>
Signed-off-by: Joel Fernandes (Google) <>
Cc: David Ahern <>
Cc: "David S. Miller" <>
Cc: Hideaki YOSHIFUJI <>
Cc: Jakub Kicinski <>
Cc: Paolo Abeni <>
Cc: <>
Signed-off-by: Paul E. McKenney <>
1 file changed