提交 8518e9bb 编写于 作者: K Kirill Tkhai 提交者: David S. Miller

net: Add more comments

This adds comments to different places to improve
readability.
Signed-off-by: NKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 4420bf21
...@@ -323,6 +323,10 @@ struct pernet_operations { ...@@ -323,6 +323,10 @@ struct pernet_operations {
* have to keep in mind all other pernet_operations and * have to keep in mind all other pernet_operations and
* to introduce a locking, if they share common resources. * to introduce a locking, if they share common resources.
* *
* The only time they are called with exclusive lock is
* from register_pernet_subsys(), unregister_pernet_subsys()
* register_pernet_device() and unregister_pernet_device().
*
* Exit methods using blocking RCU primitives, such as * Exit methods using blocking RCU primitives, such as
* synchronize_rcu(), should be implemented via exit_batch. * synchronize_rcu(), should be implemented via exit_batch.
* Then, destruction of a group of net requires single * Then, destruction of a group of net requires single
......
...@@ -43,6 +43,8 @@ static bool init_net_initialized; ...@@ -43,6 +43,8 @@ static bool init_net_initialized;
/* /*
* pernet_ops_rwsem: protects: pernet_list, net_generic_ids, * pernet_ops_rwsem: protects: pernet_list, net_generic_ids,
* init_net_initialized and first_device pointer. * init_net_initialized and first_device pointer.
* This is internal net namespace object. Please, don't use it
* outside.
*/ */
DECLARE_RWSEM(pernet_ops_rwsem); DECLARE_RWSEM(pernet_ops_rwsem);
......
...@@ -459,7 +459,7 @@ static void rtnl_lock_unregistering_all(void) ...@@ -459,7 +459,7 @@ static void rtnl_lock_unregistering_all(void)
*/ */
void rtnl_link_unregister(struct rtnl_link_ops *ops) void rtnl_link_unregister(struct rtnl_link_ops *ops)
{ {
/* Close the race with cleanup_net() */ /* Close the race with setup_net() and cleanup_net() */
down_write(&pernet_ops_rwsem); down_write(&pernet_ops_rwsem);
rtnl_lock_unregistering_all(); rtnl_lock_unregistering_all();
__rtnl_link_unregister(ops); __rtnl_link_unregister(ops);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册