summaryrefslogtreecommitdiffstats
path: root/xlators/nfs
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2019-02-12 11:17:37 +0200
committerAmar Tumballi <amarts@redhat.com>2019-02-18 02:51:45 +0000
commitec273a46820ba17f46488c082c65cd1aa6739be3 (patch)
tree9b01e29b710be1b91972dcd4d16014a434c51ad7 /xlators/nfs
parent8e2e11ff0fbbd86ef7f3ed2dab30572c27bdfa83 (diff)
auth-cache.c: minor reduction of work under lock.
Minor change to reduce work done under a lock. Also, remove unused variable (unrelated to the above). Compile-tested only! updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: I1dfb55823c3db7c638d8a34288423bd1faa37c32
Diffstat (limited to 'xlators/nfs')
-rw-r--r--xlators/nfs/server/src/auth-cache.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/xlators/nfs/server/src/auth-cache.c b/xlators/nfs/server/src/auth-cache.c
index f8e5061dc54..64768646074 100644
--- a/xlators/nfs/server/src/auth-cache.c
+++ b/xlators/nfs/server/src/auth-cache.c
@@ -40,16 +40,12 @@ make_hashkey(struct nfs3_fh *fh, const char *host)
char exportid[256] = {
0,
};
- char gfid[256] = {
- 0,
- };
char mountid[256] = {
0,
};
size_t nbytes = 0;
gf_uuid_unparse(fh->exportid, exportid);
- gf_uuid_unparse(fh->gfid, gfid);
gf_uuid_unparse(fh->mountid, mountid);
nbytes = strlen(exportid) + strlen(host) + strlen(mountid) + 3;
@@ -145,7 +141,7 @@ auth_cache_add(struct auth_cache *cache, char *hashkey,
{
int ret = -1;
data_t *entry_data = NULL;
-
+ int hashkey_len;
GF_VALIDATE_OR_GOTO(GF_NFS, cache, out);
GF_VALIDATE_OR_GOTO(GF_NFS, cache->cache_dict, out);
@@ -168,9 +164,10 @@ auth_cache_add(struct auth_cache *cache, char *hashkey,
* auth_cache_entry is released */
entry->data = data_ref(entry_data);
+ hashkey_len = strlen(hashkey);
LOCK(&cache->lock);
{
- ret = dict_set(cache->cache_dict, hashkey, entry_data);
+ ret = dict_setn(cache->cache_dict, hashkey, hashkey_len, entry_data);
}
UNLOCK(&cache->lock);