diff options
-rw-r--r-- | api/src/glfs.c | 10 | ||||
-rw-r--r-- | cli/src/cli.c | 6 | ||||
-rw-r--r-- | glusterfsd/src/glusterfsd-messages.h | 2 | ||||
-rw-r--r-- | glusterfsd/src/glusterfsd.c | 7 |
4 files changed, 19 insertions, 6 deletions
diff --git a/api/src/glfs.c b/api/src/glfs.c index fc0e7c7ba91..e74329caf9d 100644 --- a/api/src/glfs.c +++ b/api/src/glfs.c @@ -66,11 +66,15 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx) call_pool_t *pool = NULL; int ret = -1; - xlator_mem_acct_init (THIS, glfs_mt_end + 1); - if (!ctx) { goto err; - } + } + ret = xlator_mem_acct_init (THIS, glfs_mt_end + 1); + if (ret != 0) { + gf_log(THIS->name, GF_LOG_ERROR, + "Memory accounting init failed"); + return ret; + } ctx->process_uuid = generate_glusterfs_ctx_id (); if (!ctx->process_uuid) { diff --git a/cli/src/cli.c b/cli/src/cli.c index 992f6a54321..6d9f5f6c158 100644 --- a/cli/src/cli.c +++ b/cli/src/cli.c @@ -97,8 +97,12 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx) cmd_args_t *cmd_args = NULL; struct rlimit lim = {0, }; call_pool_t *pool = NULL; + int ret = -1; - xlator_mem_acct_init (THIS, cli_mt_end); + ret = xlator_mem_acct_init (THIS, cli_mt_end); + if (ret != 0) { + return ret; + } ctx->process_uuid = generate_glusterfs_ctx_id (); if (!ctx->process_uuid) diff --git a/glusterfsd/src/glusterfsd-messages.h b/glusterfsd/src/glusterfsd-messages.h index 3165c971f66..ba3b7a58735 100644 --- a/glusterfsd/src/glusterfsd-messages.h +++ b/glusterfsd/src/glusterfsd-messages.h @@ -107,6 +107,8 @@ #define glusterfsd_msg_33 (GLFS_COMP_BASE + 33), "obsolete option " \ "'--volfile-max-fetch-attempts or fetch-attempts' " \ "was provided" +#define glusterfsd_msg_34 (GLFS_COMP_BASE + 34), "memory accounting init" \ + " failed." /*------------*/ #define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages" diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index cae869b33af..c23e83257e1 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -1314,8 +1314,11 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx) struct rlimit lim = {0, }; int ret = -1; - xlator_mem_acct_init (THIS, gfd_mt_end); - + ret = xlator_mem_acct_init (THIS, gfd_mt_end); + if (ret != 0) { + gf_msg(THIS->name, GF_LOG_CRITICAL, 0, glusterfsd_msg_34); + return ret; + } ctx->process_uuid = generate_glusterfs_ctx_id (); if (!ctx->process_uuid) { gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_13); |