Skip to content

Commit 8518e9b

Browse files
Kirill Tkhaidavem330
authored andcommitted
net: Add more comments
This adds comments to different places to improve readability. Signed-off-by: Kirill Tkhai <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4420bf2 commit 8518e9b

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

include/net/net_namespace.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,10 @@ struct pernet_operations {
323323
* have to keep in mind all other pernet_operations and
324324
* to introduce a locking, if they share common resources.
325325
*
326+
* The only time they are called with exclusive lock is
327+
* from register_pernet_subsys(), unregister_pernet_subsys()
328+
* register_pernet_device() and unregister_pernet_device().
329+
*
326330
* Exit methods using blocking RCU primitives, such as
327331
* synchronize_rcu(), should be implemented via exit_batch.
328332
* Then, destruction of a group of net requires single

net/core/net_namespace.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ static bool init_net_initialized;
4343
/*
4444
* pernet_ops_rwsem: protects: pernet_list, net_generic_ids,
4545
* init_net_initialized and first_device pointer.
46+
* This is internal net namespace object. Please, don't use it
47+
* outside.
4648
*/
4749
DECLARE_RWSEM(pernet_ops_rwsem);
4850

net/core/rtnetlink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ static void rtnl_lock_unregistering_all(void)
459459
*/
460460
void rtnl_link_unregister(struct rtnl_link_ops *ops)
461461
{
462-
/* Close the race with cleanup_net() */
462+
/* Close the race with setup_net() and cleanup_net() */
463463
down_write(&pernet_ops_rwsem);
464464
rtnl_lock_unregistering_all();
465465
__rtnl_link_unregister(ops);

0 commit comments

Comments
 (0)