summaryrefslogtreecommitdiffstats
path: root/xlators/nfs/server
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2016-11-29 16:51:58 +0100
committerNiels de Vos <ndevos@redhat.com>2016-12-11 00:47:05 -0800
commit2f0e9ab1ef271132b8b7b1af25e23ac7bb0720c8 (patch)
tree050235f872a64ca0f9f5c7153cea319266edd61a /xlators/nfs/server
parent2d012c4558046afd6adb3992ff88f937c5f835e4 (diff)
refcount: return pointer to the structure instead of a counter
There are no real users of the counter. It was thought of a handy tool to track and debug refcounting, but it is not used at all. Some parts of the code would benefit from a pointer getting returned instead. BUG: 1399780 Change-Id: I97e52c48420fed61be942ea27ff4849b803eed12 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/15971 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Xavier Hernandez <xhernandez@datalab.es> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'xlators/nfs/server')
-rw-r--r--xlators/nfs/server/src/auth-cache.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/xlators/nfs/server/src/auth-cache.c b/xlators/nfs/server/src/auth-cache.c
index 71e300ddf11..2b37a7f06bd 100644
--- a/xlators/nfs/server/src/auth-cache.c
+++ b/xlators/nfs/server/src/auth-cache.c
@@ -145,8 +145,9 @@ auth_cache_add (struct auth_cache *cache, char *hashkey,
GF_VALIDATE_OR_GOTO (GF_NFS, cache, out);
GF_VALIDATE_OR_GOTO (GF_NFS, cache->cache_dict, out);
- ret = GF_REF_GET (entry);
- if (ret == 0) {
+ /* FIXME: entry is passed as parameter, this can never fail? */
+ entry = GF_REF_GET (entry);
+ if (!entry) {
/* entry does not have any references */
ret = -1;
goto out;
@@ -221,8 +222,9 @@ auth_cache_get (struct auth_cache *cache, char *hashkey,
if (!entry_data)
goto unlock;
- lookup_res = (struct auth_cache_entry *)(entry_data->data);
- if (GF_REF_GET (lookup_res) == 0) {
+ /* FIXME: this is dangerous use of entry_data */
+ lookup_res = GF_REF_GET ((struct auth_cache_entry *) entry_data->data);
+ if (lookup_res == NULL) {
/* entry has been free'd */
ret = ENTRY_EXPIRED;
goto unlock;