|
|
1df6c8 |
From 0d8c6d78130d22c475010bcce8055073b19de82a Mon Sep 17 00:00:00 2001
|
|
|
1df6c8 |
From: Xie Changlong <xiechanglong@cmss.chinamobile.com>
|
|
|
1df6c8 |
Date: Fri, 17 May 2019 18:33:11 +0800
|
|
|
1df6c8 |
Subject: [PATCH 358/362] inode: fix wrong loop count in __inode_ctx_free
|
|
|
1df6c8 |
|
|
|
1df6c8 |
Avoid serious memory leak
|
|
|
1df6c8 |
|
|
|
1df6c8 |
Backport of :
|
|
|
1df6c8 |
>fixes: bz#1711240
|
|
|
1df6c8 |
>Upstream patch link: https://review.gluster.org/#/c/glusterfs/+/22738/
|
|
|
1df6c8 |
>Change-Id: Ic61a8fdd0e941e136c98376a87b5a77fa8c22316
|
|
|
1df6c8 |
>Signed-off-by: Xie Changlong <xiechanglong@cmss.chinamobile.com>
|
|
|
1df6c8 |
|
|
|
1df6c8 |
BUG: 1781543
|
|
|
1df6c8 |
Change-Id: I601ebb6cd6744a61c64edd3d21d3b9a0edf1e95b
|
|
|
1df6c8 |
Signed-off-by: Rinku Kothiya <rkothiya@redhat.com>
|
|
|
1df6c8 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/195611
|
|
|
1df6c8 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
1df6c8 |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
1df6c8 |
---
|
|
|
1df6c8 |
libglusterfs/src/inode.c | 11 ++++++-----
|
|
|
1df6c8 |
1 file changed, 6 insertions(+), 5 deletions(-)
|
|
|
1df6c8 |
|
|
|
1df6c8 |
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
|
|
|
1df6c8 |
index 5331e93..9dbb25b 100644
|
|
|
1df6c8 |
--- a/libglusterfs/src/inode.c
|
|
|
1df6c8 |
+++ b/libglusterfs/src/inode.c
|
|
|
1df6c8 |
@@ -402,14 +402,15 @@ __inode_ctx_free(inode_t *inode)
|
|
|
1df6c8 |
goto noctx;
|
|
|
1df6c8 |
}
|
|
|
1df6c8 |
|
|
|
1df6c8 |
- for (index = 0; index < inode->table->xl->graph->xl_count; index++) {
|
|
|
1df6c8 |
+ for (index = 0; index < inode->table->ctxcount; index++) {
|
|
|
1df6c8 |
if (inode->_ctx[index].value1 || inode->_ctx[index].value2) {
|
|
|
1df6c8 |
xl = (xlator_t *)(long)inode->_ctx[index].xl_key;
|
|
|
1df6c8 |
- old_THIS = THIS;
|
|
|
1df6c8 |
- THIS = xl;
|
|
|
1df6c8 |
- if (!xl->call_cleanup && xl->cbks->forget)
|
|
|
1df6c8 |
+ if (xl && !xl->call_cleanup && xl->cbks->forget) {
|
|
|
1df6c8 |
+ old_THIS = THIS;
|
|
|
1df6c8 |
+ THIS = xl;
|
|
|
1df6c8 |
xl->cbks->forget(xl, inode);
|
|
|
1df6c8 |
- THIS = old_THIS;
|
|
|
1df6c8 |
+ THIS = old_THIS;
|
|
|
1df6c8 |
+ }
|
|
|
1df6c8 |
}
|
|
|
1df6c8 |
}
|
|
|
1df6c8 |
|
|
|
1df6c8 |
--
|
|
|
1df6c8 |
1.8.3.1
|
|
|
1df6c8 |
|