From: Kirill Tkhai <ktkhai@virtuozzo.com>
To: davem@davemloft.net, ktkhai@virtuozzo.com,
nicolas.dichtel@6wind.com, vyasevic@redhat.com,
paulmck@linux.vnet.ibm.com, vyasevich@gmail.com,
mark.rutland@arm.com, leonro@mellanox.com, avagin@virtuozzo.com,
fw@strlen.de, ebiederm@xmission.com, roman.kapl@sysgo.com,
dsahern@gmail.com, netdev@vger.kernel.org, bfields@fieldses.org
Subject: [PATCH net-next 5/5] net: Add more comments
Date: Tue, 27 Mar 2018 18:02:32 +0300 [thread overview]
Message-ID: <152216295237.1634.4727721481434422445.stgit@localhost.localdomain> (raw)
In-Reply-To: <152216238129.1634.4807322431520445566.stgit@localhost.localdomain>
This adds comments to different places to improve
readability.
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
include/net/net_namespace.h | 4 ++++
net/core/net_namespace.c | 2 ++
net/core/rtnetlink.c | 2 +-
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 922e8b6fb422..1ab4f920f109 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -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
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 9e8ee4640451..b5796d17a302 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -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);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 73011a60434c..2d3949789cef 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -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);
next prev parent reply other threads:[~2018-03-27 15:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-27 15:01 [PATCH net-next 0/5] Make pernet_operations always read locked Kirill Tkhai
2018-03-27 15:01 ` [PATCH net-next 1/5] net: Convert nfsd_net_ops Kirill Tkhai
2018-03-27 15:02 ` [PATCH net-next 2/5] net: Reflect all pernet_operations are converted Kirill Tkhai
2018-03-27 15:02 ` [PATCH net-next 3/5] net: Drop pernet_operations::async Kirill Tkhai
2018-03-27 15:02 ` [PATCH net-next 4/5] net: Rename net_sem to pernet_ops_rwsem Kirill Tkhai
2018-03-27 15:02 ` Kirill Tkhai [this message]
2018-03-27 17:18 ` [PATCH net-next 0/5] Make pernet_operations always read locked David Miller
2018-03-27 17:34 ` Kirill Tkhai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=152216295237.1634.4727721481434422445.stgit@localhost.localdomain \
--to=ktkhai@virtuozzo.com \
--cc=avagin@virtuozzo.com \
--cc=bfields@fieldses.org \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=ebiederm@xmission.com \
--cc=fw@strlen.de \
--cc=leonro@mellanox.com \
--cc=mark.rutland@arm.com \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=roman.kapl@sysgo.com \
--cc=vyasevic@redhat.com \
--cc=vyasevich@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox