Skip to content

Commit

Permalink
netns: Add an explicit rcu_barrier to unregister_pernet_{device|subsys}
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric W. Biederman authored and David S. Miller committed Dec 3, 2009
1 parent d79d792 commit 3a765ed
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions net/core/net_namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,11 @@ static int register_pernet_operations(struct list_head *list,
}
}
error = __register_pernet_operations(list, ops);
if (error && ops->id)
ida_remove(&net_generic_ids, *ops->id);
if (error) {
rcu_barrier();
if (ops->id)
ida_remove(&net_generic_ids, *ops->id);
}

return error;
}
Expand All @@ -423,6 +426,7 @@ static void unregister_pernet_operations(struct pernet_operations *ops)
{

__unregister_pernet_operations(ops);
rcu_barrier();
if (ops->id)
ida_remove(&net_generic_ids, *ops->id);
}
Expand Down

0 comments on commit 3a765ed

Please sign in to comment.