diff options
author | vmallika <vmallika@redhat.com> | 2015-06-24 11:56:30 +0530 |
---|---|---|
committer | Raghavendra G <rgowdapp@redhat.com> | 2015-06-25 02:02:14 -0700 |
commit | 9b1305e549879e7698c46553bd91c722877d44cb (patch) | |
tree | ecd4541c3e022268bf9378927e09e901306a8019 /xlators/features/marker/src/marker-quota-helper.h | |
parent | a1e32fbcfbfaf6e4c63e140b3b90a80dc748a269 (diff) |
quota/marker: fix mem-leak in marker
When removing contribution xattr, we also need to free
contribution node in memory.
Use ref/unref mechanism to handle contribution node memory
local->xdata should be freed in mq_local_unref
There is another huge memory consumption happens
in function mq_inspect_directory_xattr_task
where dirty flag is not set.
Change-Id: Ieca3ab4bf410c51259560e778bce4e81b9d888bf
BUG: 1207735
Signed-off-by: vmallika <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/11361
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Tested-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/features/marker/src/marker-quota-helper.h')
-rw-r--r-- | xlators/features/marker/src/marker-quota-helper.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/xlators/features/marker/src/marker-quota-helper.h b/xlators/features/marker/src/marker-quota-helper.h index b333a0ec52f..7450a6e3604 100644 --- a/xlators/features/marker/src/marker-quota-helper.h +++ b/xlators/features/marker/src/marker-quota-helper.h @@ -13,10 +13,14 @@ #include "marker.h" -#define QUOTA_FREE_CONTRIBUTION_NODE(_contribution) \ - do { \ - list_del (&_contribution->contri_list); \ - GF_FREE (_contribution); \ +#define QUOTA_FREE_CONTRIBUTION_NODE(ctx, _contribution) \ + do { \ + LOCK (&ctx->lock); \ + { \ + list_del (&_contribution->contri_list); \ + GF_REF_PUT (_contribution); \ + } \ + UNLOCK (&ctx->lock); \ } while (0) #define QUOTA_SAFE_INCREMENT(lock, var) \ @@ -62,6 +66,12 @@ mq_local_ref (quota_local_t *); int32_t mq_local_unref (xlator_t *, quota_local_t *); +void +mq_contri_fini (void *data); + +inode_contribution_t* +mq_contri_init (inode_t *inode); + inode_contribution_t * mq_get_contribution_node (inode_t *, quota_inode_ctx_t *); |