diff options
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 2 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handshake.c | 2 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 18 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-sm.c | 23 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-sm.h | 2 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 2 |
6 files changed, 25 insertions, 24 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 57239c6266d..e22f0e40394 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -321,7 +321,7 @@ glusterd_add_volume_detail_to_dict (glusterd_volinfo_t *volinfo, ret = -1; goto out; } - + pairs = dict->members_list; if (!pairs) { ret = -1; diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c index fbc25d1c602..213bcc6fb48 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handshake.c +++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c @@ -164,7 +164,7 @@ server_getspec (rpcsvc_request_t *req) } if (file_len) { - rsp.spec = CALLOC (file_len, sizeof (char)); + rsp.spec = CALLOC (file_len+1, sizeof (char)); if (!rsp.spec) { ret = -1; op_errno = ENOMEM; diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 4ae7afcc39d..d9d324b2e1e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -440,12 +440,15 @@ glusterd_op_stage_create_volume (gd1_mgmt_stage_op_req *req, char **op_errstr) brick_list = tmpptr; } glusterd_brickinfo_delete (brick_info); + brick_info = NULL; } out: if (dict) dict_unref (dict); if (free_ptr) GF_FREE (free_ptr); + if (brick_info) + glusterd_brickinfo_delete (brick_info); gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); return ret; @@ -695,6 +698,7 @@ glusterd_op_stage_add_brick (gd1_mgmt_stage_op_req *req, char **op_errstr) char cmd_str[1024]; glusterd_conf_t *priv = NULL; char msg[2048] = {0,}; + gf_boolean_t brick_alloc = _gf_false; GF_ASSERT (req); @@ -755,19 +759,21 @@ glusterd_op_stage_add_brick (gd1_mgmt_stage_op_req *req, char **op_errstr) brick = strtok_r (brick_list+1, " \n", &saveptr); while ( i < count) { - ret = glusterd_volume_brickinfo_get_by_brick (brick, volinfo, &brickinfo); + ret = glusterd_volume_brickinfo_get_by_brick (brick, volinfo, + &brickinfo); if (!ret) { gf_log ("", GF_LOG_ERROR, "Adding duplicate brick: %s", brick); ret = -1; goto out; } else { - ret = glusterd_brickinfo_from_brick(brick, &brickinfo); + ret = glusterd_brickinfo_from_brick (brick, &brickinfo); if (ret) { gf_log ("", GF_LOG_ERROR, "Add-brick: Unable" " to get brickinfo"); goto out; } + brick_alloc = _gf_true; } snprintf (cmd_str, 1024, "%s", brickinfo->path); ret = glusterd_resolve_brick (brickinfo); @@ -802,6 +808,8 @@ glusterd_op_stage_add_brick (gd1_mgmt_stage_op_req *req, char **op_errstr) } glusterd_brickinfo_delete (brickinfo); + brick_alloc = _gf_false; + brickinfo = NULL; brick = strtok_r (NULL, " \n", &saveptr); i++; } @@ -811,6 +819,9 @@ out: dict_unref (dict); if (free_ptr) GF_FREE (free_ptr); + if (brick_alloc && brickinfo) + glusterd_brickinfo_delete (brickinfo); + gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); return ret; @@ -1436,7 +1447,8 @@ glusterd_op_perform_add_bricks (glusterd_volinfo_t *volinfo, int32_t count, while (i <= count) { - ret = glusterd_volume_brickinfo_get_by_brick (brick, volinfo, &brickinfo); + ret = glusterd_volume_brickinfo_get_by_brick (brick, volinfo, + &brickinfo); if (ret) goto out; diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c index 051bdee91be..6061d0276f2 100644 --- a/xlators/mgmt/glusterd/src/glusterd-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-sm.c @@ -129,10 +129,9 @@ glusterd_broadcast_friend_delete (char *hostname, uuid_t uuid) { int ret = 0; rpc_clnt_procedure_t *proc = NULL; - call_frame_t *frame = NULL; glusterd_conf_t *conf = NULL; xlator_t *this = NULL; - glusterd_friend_update_ctx_t *ctx = NULL; + glusterd_friend_update_ctx_t ctx = {{0},}; this = THIS; conf = this->private; @@ -140,27 +139,13 @@ glusterd_broadcast_friend_delete (char *hostname, uuid_t uuid) GF_ASSERT (conf); GF_ASSERT (conf->mgmt); - ctx = GF_CALLOC (1, sizeof (*ctx), - gf_gld_mt_friend_update_ctx_t); - - if (!ctx) { - ret = -1; - goto out; - } - - ctx->hostname = gf_strdup (hostname); - ctx->op = GD_FRIEND_UPDATE_DEL; + ctx.hostname = hostname; + ctx.op = GD_FRIEND_UPDATE_DEL; proc = &conf->mgmt->proctable[GD_MGMT_FRIEND_UPDATE]; if (proc->fn) { - frame = create_frame (this, this->ctx->pool); - if (!frame) { - goto out; - } - frame->local = ctx; - ret = proc->fn (frame, this, ctx); + ret = proc->fn (NULL, this, &ctx); } -out: gf_log ("", GF_LOG_DEBUG, "Returning with %d", ret); return ret; diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.h b/xlators/mgmt/glusterd/src/glusterd-sm.h index 5828f05e34e..8e8c2ea7f09 100644 --- a/xlators/mgmt/glusterd/src/glusterd-sm.h +++ b/xlators/mgmt/glusterd/src/glusterd-sm.h @@ -182,4 +182,6 @@ glusterd_friend_sm_state_name_get (glusterd_friend_sm_state_t state); int glusterd_broadcast_friend_delete (char *hostname, uuid_t uuid); +void +glusterd_destroy_friend_update_ctx (glusterd_friend_update_ctx_t *ctx); #endif diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index c7018cde86f..11a19d2a25e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -1575,6 +1575,8 @@ glusterd_import_friend_volume (dict_t *vols, int count) list_for_each_entry_safe (brickinfo, tmp, &volinfo->bricks, brick_list) { + glusterd_delete_volfile (volinfo, brickinfo); + glusterd_store_delete_brick (volinfo, brickinfo); ret = glusterd_brickinfo_delete (brickinfo); if (ret) goto out; |