cf62f1947f
Resolves: bz#1264911 bz#1277924 bz#1286820 bz#1360331 bz#1401969 Resolves: bz#1410719 bz#1419438 bz#1426042 bz#1444820 bz#1459101 Resolves: bz#1464150 bz#1464350 bz#1466122 bz#1466129 bz#1467903 Resolves: bz#1468972 bz#1476876 bz#1484446 bz#1492591 bz#1498391 Resolves: bz#1498730 bz#1499865 bz#1500704 bz#1501345 bz#1505570 Resolves: bz#1507361 bz#1507394 bz#1509102 bz#1509191 bz#1509810 Resolves: bz#1509833 bz#1511766 bz#1512470 bz#1512496 bz#1512963 Resolves: bz#1515051 bz#1519076 bz#1519740 bz#1534253 bz#1534530 Signed-off-by: Milind Changire <mchangir@redhat.com>
117 lines
4.1 KiB
Diff
117 lines
4.1 KiB
Diff
From 09c73d2c7793d2316c62837a80b41904a2a5b15f Mon Sep 17 00:00:00 2001
|
|
From: Xavier Hernandez <jahernan@redhat.com>
|
|
Date: Mon, 20 Nov 2017 10:51:09 +0100
|
|
Subject: [PATCH 103/128] features/locks: Fix memory leaks
|
|
|
|
> Upstream patch: https://review.gluster.org/18812
|
|
|
|
Change-Id: Ic1d2e17a7d14389b6734d1b88bd28c0a2907bbd6
|
|
BUG: 1507361
|
|
Signed-off-by: Xavier Hernandez <jahernan@redhat.com>
|
|
Reviewed-on: https://code.engineering.redhat.com/gerrit/125955
|
|
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
---
|
|
xlators/features/locks/src/clear.c | 2 +-
|
|
xlators/features/locks/src/common.c | 1 +
|
|
xlators/features/locks/src/entrylk.c | 3 ++-
|
|
xlators/features/locks/src/inodelk.c | 7 ++++---
|
|
xlators/features/locks/src/posix.c | 3 +++
|
|
5 files changed, 11 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/xlators/features/locks/src/clear.c b/xlators/features/locks/src/clear.c
|
|
index d7c210f..22c03b5 100644
|
|
--- a/xlators/features/locks/src/clear.c
|
|
+++ b/xlators/features/locks/src/clear.c
|
|
@@ -184,7 +184,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 4b63c43..7311126 100644
|
|
--- a/xlators/features/locks/src/common.c
|
|
+++ b/xlators/features/locks/src/common.c
|
|
@@ -438,6 +438,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 4231d76..8e9008b 100644
|
|
--- a/xlators/features/locks/src/entrylk.c
|
|
+++ b/xlators/features/locks/src/entrylk.c
|
|
@@ -784,7 +784,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);
|
|
@@ -960,6 +960,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 e1702c7..4aebac6 100644
|
|
--- a/xlators/features/locks/src/inodelk.c
|
|
+++ b/xlators/features/locks/src/inodelk.c
|
|
@@ -721,9 +721,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.
|
|
*/
|
|
@@ -732,6 +729,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 ff9a3da..a158227 100644
|
|
--- a/xlators/features/locks/src/posix.c
|
|
+++ b/xlators/features/locks/src/posix.c
|
|
@@ -2472,6 +2472,7 @@ pl_forget (xlator_t *this,
|
|
list) {
|
|
|
|
list_del (&rw_req->list);
|
|
+ call_stub_destroy(rw_req->stub);
|
|
GF_FREE (rw_req);
|
|
}
|
|
}
|
|
@@ -2555,6 +2556,8 @@ pl_forget (xlator_t *this,
|
|
|
|
}
|
|
|
|
+ pthread_mutex_destroy(&pl_inode->mutex);
|
|
+
|
|
GF_FREE (pl_inode);
|
|
|
|
return 0;
|
|
--
|
|
1.8.3.1
|
|
|