diff options
author | Pavan Sondur <pavan@gluster.com> | 2010-01-25 05:50:38 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-01-25 04:32:35 -0800 |
commit | 6302f2c2262647974e94b494805f2a70da142949 (patch) | |
tree | 513d29307fa97850b64ea99467ad48d8fe57d1d3 /xlators | |
parent | 0455e828c91b9b8f3dfd2cb5afac455571cca450 (diff) |
features/quota: Fix memory leak while syncing disk usage.
Signed-off-by: Pavan Vilas Sondur <pavan@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 569 (Memory leak in quota translator)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=569
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/features/quota/src/quota.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index 68090953bc6..4a2c675f792 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -52,6 +52,8 @@ struct quota_priv { uint32_t current_free_disk; /* current free disk space available, in % */ uint32_t refresh_interval; /* interval in seconds */ uint32_t min_disk_last_updated_time; /* used for interval calculation */ + + dict_t *dict; /* dictionary pointer used while syncing disk usage */ }; @@ -788,12 +790,17 @@ int quota_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno) { + struct quota_priv *priv = NULL; + + priv = this->private; + if (op_ret == -1) { gf_log (this->name, GF_LOG_CRITICAL, "failed to set the disk-usage value: %s", strerror (op_errno)); } + dict_unref (priv->dict); STACK_DESTROY (frame->root); return 0; } @@ -905,6 +912,9 @@ gf_quota_cache_sync (xlator_t *this) dict_set (dict, "trusted.glusterfs-quota-du", data_from_uint64 (priv->current_disk_usage)); + dict_ref (dict); + priv->dict = dict; + STACK_WIND (frame, quota_setxattr_cbk, this->children->xlator, this->children->xlator->fops->setxattr, |