From af4604ad4cf58f4b9b3fab26121c3ebd105428ca Mon Sep 17 00:00:00 2001 From: Vijay Bellur Date: Wed, 6 Apr 2011 12:41:12 +0000 Subject: mgmt/glusterd: Reset context upon operation completion Signed-off-by: Vijay Bellur BUG: 2650 (replace brick failed in distributed-replicated setup) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2650 --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 45 ++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 12 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 970ee716d..d5676d79a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -6275,6 +6275,31 @@ glusterd_op_clear_errstr() { return 0; } +int32_t +glusterd_op_set_ctx (glusterd_op_t op, void *ctx) +{ + + GF_ASSERT (op < GD_OP_MAX); + GF_ASSERT (op > GD_OP_NONE); + + opinfo.op_ctx[op] = ctx; + + return 0; + +} + +int32_t +glusterd_op_reset_ctx (glusterd_op_t op) +{ + + GF_ASSERT (op < GD_OP_MAX); + GF_ASSERT (op > GD_OP_NONE); + + glusterd_op_set_ctx (op, NULL); + + return 0; +} + int32_t glusterd_op_txn_complete () { @@ -6322,7 +6347,7 @@ glusterd_op_txn_complete () glusterd_op_clear_op (op); ctx = glusterd_op_get_ctx (op); ctx_free = glusterd_op_get_ctx_free (op); - glusterd_op_set_ctx (op, NULL); + glusterd_op_reset_ctx (op); glusterd_op_clear_ctx_free (op); glusterd_op_clear_errstr (); } @@ -7614,6 +7639,10 @@ glusterd_op_init_ctx (glusterd_op_t op) int ret = 0; dict_t *dict = NULL; + if (GD_OP_PROFILE_VOLUME != op) { + gf_log ("", GF_LOG_DEBUG, "Received op: %d, returning", op); + goto out; + } dict = dict_new (); if (dict == NULL) { ret = -1; @@ -7630,6 +7659,8 @@ out: return ret; } + + int32_t glusterd_op_fini_ctx (glusterd_op_t op) { @@ -7640,21 +7671,11 @@ glusterd_op_fini_ctx (glusterd_op_t op) if (dict) dict_unref (dict); } + glusterd_op_reset_ctx (op); return 0; } -int32_t -glusterd_op_set_ctx (glusterd_op_t op, void *ctx) -{ - GF_ASSERT (op < GD_OP_MAX); - GF_ASSERT (op > GD_OP_NONE); - - opinfo.op_ctx[op] = ctx; - - return 0; - -} int32_t glusterd_op_free_ctx (glusterd_op_t op, void *ctx, gf_boolean_t ctx_free) -- cgit