Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netns: Add an explicit rcu_barrier to unregister_pernet_{device|subsys}

This allows namespace exit methods to batch work that comes requires an
rcu barrier using call_rcu without having to treat the
unregister_pernet_operations cases specially.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Eric W. Biederman and committed by
David S. Miller
3a765eda d79d792e

+6 -2
+6 -2
net/core/net_namespace.c
··· 413 413 } 414 414 } 415 415 error = __register_pernet_operations(list, ops); 416 - if (error && ops->id) 417 - ida_remove(&net_generic_ids, *ops->id); 416 + if (error) { 417 + rcu_barrier(); 418 + if (ops->id) 419 + ida_remove(&net_generic_ids, *ops->id); 420 + } 418 421 419 422 return error; 420 423 } ··· 426 423 { 427 424 428 425 __unregister_pernet_operations(ops); 426 + rcu_barrier(); 429 427 if (ops->id) 430 428 ida_remove(&net_generic_ids, *ops->id); 431 429 }