summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorXavier Hernandez <jahernan@redhat.com>2017-11-20 10:51:09 +0100
committerAmar Tumballi <amarts@redhat.com>2017-11-22 10:12:47 +0000
commitc913a6e6fcd9ebd962955ba5d51f518b2875eba3 (patch)
tree4fe5e5cdc2512cfee9f3cc3212dbe9b2c4643517 /xlators
parent77e3bc671aab2fda68ada53f38ec368b20675f59 (diff)
features/locks: Fix memory leaks
Change-Id: Ic1d2e17a7d14389b6734d1b88bd28c0a2907bbd6 BUG: 1515161 Signed-off-by: Xavier Hernandez <jahernan@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/locks/src/clear.c2
-rw-r--r--xlators/features/locks/src/common.c1
-rw-r--r--xlators/features/locks/src/entrylk.c3
-rw-r--r--xlators/features/locks/src/inodelk.c7
-rw-r--r--xlators/features/locks/src/posix.c3
5 files changed, 11 insertions, 5 deletions
diff --git a/xlators/features/locks/src/clear.c b/xlators/features/locks/src/clear.c
index f6897333ce7..a76d6beacb1 100644
--- a/xlators/features/locks/src/clear.c
+++ b/xlators/features/locks/src/clear.c
@@ -183,7 +183,7 @@ clrlk_clear_posixlk (xlator_t *this, pl_inode_t *pl_inode, clrlk_args *args,
} else {
gcount++;
}
- GF_FREE (plock);
+ __destroy_lock(plock);
}
}
pthread_mutex_unlock (&pl_inode->mutex);
diff --git a/xlators/features/locks/src/common.c b/xlators/features/locks/src/common.c
index b8c09a988ee..c22dff08382 100644
--- a/xlators/features/locks/src/common.c
+++ b/xlators/features/locks/src/common.c
@@ -437,6 +437,7 @@ pl_inode_get (xlator_t *this, inode_t *inode)
ret = __inode_ctx_put (inode, this, (uint64_t)(long)(pl_inode));
if (ret) {
+ pthread_mutex_destroy (&pl_inode->mutex);
GF_FREE (pl_inode);
pl_inode = NULL;
goto unlock;
diff --git a/xlators/features/locks/src/entrylk.c b/xlators/features/locks/src/entrylk.c
index 0dfc9df737b..6698516fc83 100644
--- a/xlators/features/locks/src/entrylk.c
+++ b/xlators/features/locks/src/entrylk.c
@@ -783,7 +783,7 @@ pl_common_entrylk (call_frame_t *frame, xlator_t *this,
break;
default:
- inode_unref (pinode->inode);
+ need_inode_unref = _gf_true;
gf_log (this->name, GF_LOG_ERROR,
"Unexpected case in entrylk (cmd=%d). Please file"
"a bug report at http://bugs.gluster.com", cmd);
@@ -959,6 +959,7 @@ pl_entrylk_client_cleanup (xlator_t *this, pl_ctx_t *ctx)
__pl_entrylk_unref (l);
}
pthread_mutex_unlock (&pinode->mutex);
+
inode_unref (pinode->inode);
}
diff --git a/xlators/features/locks/src/inodelk.c b/xlators/features/locks/src/inodelk.c
index a8381adda3d..64ffb00c18c 100644
--- a/xlators/features/locks/src/inodelk.c
+++ b/xlators/features/locks/src/inodelk.c
@@ -720,9 +720,6 @@ out:
if (ctx)
pthread_mutex_unlock (&ctx->lock);
- if (need_inode_unref)
- inode_unref (pl_inode->inode);
-
/* The following (extra) unref corresponds to the ref that
* was done at the time the lock was granted.
*/
@@ -731,6 +728,10 @@ out:
grant_blocked_inode_locks (this, pl_inode, dom);
}
+ if (need_inode_unref) {
+ inode_unref (pl_inode->inode);
+ }
+
return ret;
}
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index 7e94c284ed1..78bf160058c 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -2471,6 +2471,7 @@ pl_forget (xlator_t *this,
list) {
list_del (&rw_req->list);
+ call_stub_destroy(rw_req->stub);
GF_FREE (rw_req);
}
}
@@ -2554,6 +2555,8 @@ pl_forget (xlator_t *this,
}
+ pthread_mutex_destroy(&pl_inode->mutex);
+
GF_FREE (pl_inode);
return 0;