Commit 3a765eda authored by Eric W. Biederman's avatar Eric W. Biederman Committed by David S. Miller

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: default avatarEric W. Biederman <ebiederm@xmission.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d79d792e
...@@ -413,8 +413,11 @@ static int register_pernet_operations(struct list_head *list, ...@@ -413,8 +413,11 @@ static int register_pernet_operations(struct list_head *list,
} }
} }
error = __register_pernet_operations(list, ops); error = __register_pernet_operations(list, ops);
if (error && ops->id) if (error) {
ida_remove(&net_generic_ids, *ops->id); rcu_barrier();
if (ops->id)
ida_remove(&net_generic_ids, *ops->id);
}
return error; return error;
} }
...@@ -423,6 +426,7 @@ static void unregister_pernet_operations(struct pernet_operations *ops) ...@@ -423,6 +426,7 @@ static void unregister_pernet_operations(struct pernet_operations *ops)
{ {
__unregister_pernet_operations(ops); __unregister_pernet_operations(ops);
rcu_barrier();
if (ops->id) if (ops->id)
ida_remove(&net_generic_ids, *ops->id); ida_remove(&net_generic_ids, *ops->id);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment