summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitaliy Gusev <gusev.vitaliy@gmail.com>2021-05-31 01:19:18 +0300
committerRobert Mustacchi <rm@fingolfin.org>2021-06-29 08:01:40 -0700
commita547d3069fbb76f7603ab6fe082827b54e008a3e (patch)
treefaba726088a393b2d060c56d82ab3bd73dfd76f3
parent3b3c8f601c5530d4928a71e238c573c623491c34 (diff)
downloadillumos-joyent-a547d3069fbb76f7603ab6fe082827b54e008a3e.tar.gz
13848 nfssrv: excessive crdup/crfree cause bottleneck after fixing 6770
Reviewed by: Jason King <jason.brian.king@gmail.com> Reviewed by: Patrick Mooney <pmooney@pfmooney.com> Reviewed by: Marcel Telka <marcel@telka.sk> Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r--usr/src/uts/common/fs/nfs/nfs_auth.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/usr/src/uts/common/fs/nfs/nfs_auth.c b/usr/src/uts/common/fs/nfs/nfs_auth.c
index 7ac3c3318b..e132346545 100644
--- a/usr/src/uts/common/fs/nfs/nfs_auth.c
+++ b/usr/src/uts/common/fs/nfs/nfs_auth.c
@@ -910,9 +910,6 @@ nfsauth_cache_get(struct exportinfo *exi, struct svc_req *req, int flavor,
ASSERT(taddrmask != NULL);
addrmask(&addr, taddrmask);
- ac.auth_flavor = flavor;
- ac.auth_clnt_cred = crdup(cr);
-
acc.authc_addr = addr;
tree = exi->exi_cache[hash(&addr)];
@@ -964,6 +961,10 @@ nfsauth_cache_get(struct exportinfo *exi, struct svc_req *req, int flavor,
ASSERT(c != NULL);
rw_enter(&c->authc_lock, RW_READER);
+
+ ac.auth_flavor = flavor;
+ ac.auth_clnt_cred = cr;
+
p = (struct auth_cache *)avl_find(&c->authc_tree, &ac, NULL);
if (p == NULL) {
@@ -983,7 +984,7 @@ nfsauth_cache_get(struct exportinfo *exi, struct svc_req *req, int flavor,
*/
np->auth_clnt = c;
np->auth_flavor = flavor;
- np->auth_clnt_cred = ac.auth_clnt_cred;
+ np->auth_clnt_cred = crdup(cr);
np->auth_srv_ngids = 0;
np->auth_srv_gids = NULL;
np->auth_time = np->auth_freshness = gethrestime_sec();
@@ -1004,12 +1005,11 @@ nfsauth_cache_get(struct exportinfo *exi, struct svc_req *req, int flavor,
cv_destroy(&np->auth_cv);
mutex_destroy(&np->auth_lock);
- crfree(ac.auth_clnt_cred);
+ crfree(np->auth_clnt_cred);
kmem_cache_free(exi_cache_handle, np);
}
} else {
rw_exit(&exi->exi_cache_lock);
- crfree(ac.auth_clnt_cred);
}
mutex_enter(&p->auth_lock);
@@ -1212,7 +1212,6 @@ nfsauth_cache_get(struct exportinfo *exi, struct svc_req *req, int flavor,
return (access);
retrieve:
- crfree(ac.auth_clnt_cred);
/*
* Retrieve the required data without caching.