summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2014-03-22 19:30:45 +0530
committerVijay Bellur <vbellur@redhat.com>2014-03-22 10:00:01 -0700
commitdc6f7acaeda69ac0765812b3d961197a68ef9bf5 (patch)
treecf559ac4fec325cd10248f11f27e4eb9b69747e5
parent53194718bb2aed6b88084cafd9e84a4350663ac6 (diff)
encryption/crypt: Add mem-accounting for crypt xlator
Without these changes crypt.t crashes when compiled with -DDEBUG Change-Id: I1f7372aa30a09dbe3ae81d1dd598cf36e17fe0b7 BUG: 1030058 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/7319 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--xlators/encryption/crypt/src/crypt-mem-types.h1
-rw-r--r--xlators/encryption/crypt/src/crypt.c19
2 files changed, 20 insertions, 0 deletions
diff --git a/xlators/encryption/crypt/src/crypt-mem-types.h b/xlators/encryption/crypt/src/crypt-mem-types.h
index 799727573c3..2eab921fcba 100644
--- a/xlators/encryption/crypt/src/crypt-mem-types.h
+++ b/xlators/encryption/crypt/src/crypt-mem-types.h
@@ -24,6 +24,7 @@ enum gf_crypt_mem_types_ {
gf_crypt_mt_key,
gf_crypt_mt_iovec,
gf_crypt_mt_char,
+ gf_crypt_mt_end,
};
#endif /* __CRYPT_MEM_TYPES_H__ */
diff --git a/xlators/encryption/crypt/src/crypt.c b/xlators/encryption/crypt/src/crypt.c
index becff3e4763..1abdad31d99 100644
--- a/xlators/encryption/crypt/src/crypt.c
+++ b/xlators/encryption/crypt/src/crypt.c
@@ -4380,6 +4380,25 @@ static void crypt_free_private(xlator_t *this)
}
}
+int32_t
+mem_acct_init (xlator_t *this)
+{
+ int ret = -1;
+
+ if (!this)
+ return ret;
+
+ ret = xlator_mem_acct_init (this, gf_crypt_mt_end);
+
+ if (ret != 0) {
+ gf_log(this->name, GF_LOG_ERROR, "Memory accounting init"
+ "failed");
+ return ret;
+ }
+
+ return ret;
+}
+
int32_t reconfigure (xlator_t *this, dict_t *options)
{
int32_t ret = -1;