net: Add more comments
authorKirill Tkhai <ktkhai@virtuozzo.com>
Tue, 27 Mar 2018 15:02:32 +0000 (18:02 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 27 Mar 2018 17:18:09 +0000 (13:18 -0400)
This adds comments to different places to improve
readability.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/net_namespace.h
net/core/net_namespace.c
net/core/rtnetlink.c

index 922e8b6fb422316a02aef5157fef3f16455f4286..1ab4f920f1091d925531ecbb6527eac7059c464c 100644 (file)
@@ -323,6 +323,10 @@ struct pernet_operations {
         * have to keep in mind all other pernet_operations and
         * 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
         * synchronize_rcu(), should be implemented via exit_batch.
         * Then, destruction of a group of net requires single
index 9e8ee4640451bc9d12f18064c4efbff9547a6a67..b5796d17a3020513e0b4d087e357b1e747cf4b23 100644 (file)
@@ -43,6 +43,8 @@ static bool init_net_initialized;
 /*
  * pernet_ops_rwsem: protects: pernet_list, net_generic_ids,
  * init_net_initialized and first_device pointer.
+ * This is internal net namespace object. Please, don't use it
+ * outside.
  */
 DECLARE_RWSEM(pernet_ops_rwsem);
 
index 73011a60434c21ca982014abc48ab01a88b99955..2d3949789cef4148f1325ab5b881201a1b598a26 100644 (file)
@@ -459,7 +459,7 @@ static void rtnl_lock_unregistering_all(void)
  */
 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);
        rtnl_lock_unregistering_all();
        __rtnl_link_unregister(ops);