summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c23
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.h3
-rw-r--r--xlators/mgmt/glusterd/src/glusterd3_1-mops.c2
3 files changed, 15 insertions, 13 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index dbeb07ff58d..73491013400 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -2868,7 +2868,8 @@ out:
int32_t
glusterd_op_send_cli_response (int32_t op, int32_t op_ret,
- int32_t op_errno, rpcsvc_request_t *req)
+ int32_t op_errno, rpcsvc_request_t *req,
+ void *op_ctx)
{
int32_t ret = -1;
gd_serialize_t sfunc = NULL;
@@ -2959,14 +2960,9 @@ glusterd_op_send_cli_response (int32_t op, int32_t op_ret,
case GD_MGMT_CLI_REPLACE_BRICK:
{
gf1_cli_replace_brick_rsp rsp = {0,};
- ctx = glusterd_op_get_ctx (GD_OP_REPLACE_BRICK);
- if (!ctx) {
- gf_log ("", GF_LOG_ERROR,
- "Operation Context is not present");
- ret = -1;
- goto out;
- }
- if (dict_get_str (ctx, "status-reply", &rsp.status))
+ ctx = op_ctx;
+ if (ctx &&
+ dict_get_str (ctx, "status-reply", &rsp.status))
rsp.status = "";
rsp.op_ret = op_ret;
rsp.op_errno = op_errno;
@@ -3021,6 +3017,8 @@ glusterd_op_txn_complete ()
int32_t op_errno = 0;
int32_t cli_op = 0;
rpcsvc_request_t *req = NULL;
+ void *ctx = NULL;
+ gf_boolean_t ctx_free = _gf_false;
priv = THIS->private;
GF_ASSERT (priv);
@@ -3050,14 +3048,17 @@ glusterd_op_txn_complete ()
glusterd_op_clear_pending_op (op);
glusterd_op_clear_commit_op (op);
glusterd_op_clear_op (op);
- glusterd_op_clear_ctx (op);
+ ctx = glusterd_op_get_ctx (op);
+ ctx_free = glusterd_op_get_ctx_free (op);
glusterd_op_clear_ctx_free (op);
}
out:
pthread_mutex_unlock (&opinfo.lock);
ret = glusterd_op_send_cli_response (cli_op, op_ret,
- op_errno, req);
+ op_errno, req, ctx);
+ if (ctx_free && ctx && (op != -1))
+ glusterd_op_clear_ctx (op);
gf_log ("glusterd", GF_LOG_NORMAL, "Returning %d", ret);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.h b/xlators/mgmt/glusterd/src/glusterd-op-sm.h
index 554169aee6a..0d7c1cccb30 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.h
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.h
@@ -207,7 +207,8 @@ glusterd_op_set_cli_op (gf_mgmt_procnum op);
int32_t
glusterd_op_send_cli_response (int32_t op, int32_t op_ret,
- int32_t op_errno, rpcsvc_request_t *req);
+ int32_t op_errno, rpcsvc_request_t *req,
+ void *ctx);
int32_t
glusterd_op_get_op ();
diff --git a/xlators/mgmt/glusterd/src/glusterd3_1-mops.c b/xlators/mgmt/glusterd/src/glusterd3_1-mops.c
index 0376f4be13e..e4525b93081 100644
--- a/xlators/mgmt/glusterd/src/glusterd3_1-mops.c
+++ b/xlators/mgmt/glusterd/src/glusterd3_1-mops.c
@@ -1233,7 +1233,7 @@ out:
be 0, and we should not point to any RPC errors, because
otherwise rpcsvc.c will send an error reply for the same
request, which causes double replies */
- ret = glusterd_op_send_cli_response (req->procnum, ret, 0, req);
+ ret = glusterd_op_send_cli_response (req->procnum, ret, 0, req, NULL);
if (!ret)
req->rpc_err = SUCCESS;
}