aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/svcauth_unix.c
diff options
context:
space:
mode:
authorTrond Myklebust <trondmy@gmail.com>2018-10-01 10:41:44 -0400
committerJ. Bruce Fields <bfields@redhat.com>2018-10-03 11:32:59 -0400
commit608a0ab2f54ab0e301ad76a41aad979ea0d02670 (patch)
tree26382fa9fd57a2f549fb991c067c72257a2b2b61 /net/sunrpc/svcauth_unix.c
parent30382d6ce593f863292cd7c026a79077c4e7280f (diff)
SUNRPC: Add lockless lookup of the server's auth domain
Avoid taking the global auth_domain_lock in most lookups of the auth domain by adding an RCU protected lookup. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net/sunrpc/svcauth_unix.c')
-rw-r--r--net/sunrpc/svcauth_unix.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index af7f28fb8102..84cf39021a03 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -37,20 +37,26 @@ struct unix_domain {
37extern struct auth_ops svcauth_null; 37extern struct auth_ops svcauth_null;
38extern struct auth_ops svcauth_unix; 38extern struct auth_ops svcauth_unix;
39 39
40static void svcauth_unix_domain_release(struct auth_domain *dom) 40static void svcauth_unix_domain_release_rcu(struct rcu_head *head)
41{ 41{
42 struct auth_domain *dom = container_of(head, struct auth_domain, rcu_head);
42 struct unix_domain *ud = container_of(dom, struct unix_domain, h); 43 struct unix_domain *ud = container_of(dom, struct unix_domain, h);
43 44
44 kfree(dom->name); 45 kfree(dom->name);
45 kfree(ud); 46 kfree(ud);
46} 47}
47 48
49static void svcauth_unix_domain_release(struct auth_domain *dom)
50{
51 call_rcu(&dom->rcu_head, svcauth_unix_domain_release_rcu);
52}
53
48struct auth_domain *unix_domain_find(char *name) 54struct auth_domain *unix_domain_find(char *name)
49{ 55{
50 struct auth_domain *rv; 56 struct auth_domain *rv;
51 struct unix_domain *new = NULL; 57 struct unix_domain *new = NULL;
52 58
53 rv = auth_domain_lookup(name, NULL); 59 rv = auth_domain_find(name);
54 while(1) { 60 while(1) {
55 if (rv) { 61 if (rv) {
56 if (new && rv != &new->h) 62 if (new && rv != &new->h)