summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kp@gluster.com>2011-10-10 18:44:41 +0530
committerVijay Bellur <vijay@gluster.com>2011-10-14 05:42:52 -0700
commit3edfb0c492d73b349d83f904c42e6edfb9678965 (patch)
tree7c0c870afe5e975e8ed093d3bc88143f582e9a81 /xlators/mgmt/glusterd
parent513cd0d12e3b72e9a3714deeee251414e651213f (diff)
glusterd: Removing delayed moving of op sm for stop vol/remove brick op.
Earlier we waited for brick disconnect or 5s whichever is smaller, before we move op sm from brick op stage to commit stage. This involves a race where both the above mentioned events can happen 'concurrently' and result in double free. Change-Id: I8b1524afded84c20d55e29cfe2579ca872d2ac26 BUG: 3700 Reviewed-on: http://review.gluster.com/575 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amar@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c23
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.h1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rpc-ops.c39
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h1
5 files changed, 4 insertions, 62 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 3101f87fc5f..ff00824642e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -2561,8 +2561,6 @@ glusterd_brick_rpc_notify (struct rpc_clnt *rpc, void *mydata,
case RPC_CLNT_DISCONNECT:
gf_log (this->name, GF_LOG_DEBUG, "got RPC_CLNT_DISCONNECT");
glusterd_set_brick_status (brickinfo, GF_BRICK_STOPPED);
- if (brickinfo->timer && brickinfo->timer->callbk)
- brickinfo->timer->callbk (brickinfo->timer->data);
break;
default:
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 73d877fcbd3..4e780c84374 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -1857,29 +1857,6 @@ out:
return ret;
}
-void
-glusterd_op_brick_disconnect (void *data)
-{
- glusterd_brickinfo_t *brickinfo = NULL;
- glusterd_op_brick_rsp_ctx_t *ev_ctx = NULL;
-
- ev_ctx = data;
- GF_ASSERT (ev_ctx);
- brickinfo = ev_ctx->pending_node->node;
- GF_ASSERT (brickinfo);
-
- if (brickinfo->timer) {
- gf_timer_call_cancel (THIS->ctx, brickinfo->timer);
- brickinfo->timer = NULL;
- gf_log ("", GF_LOG_DEBUG,
- "Cancelled timer thread");
- }
-
- glusterd_op_sm_inject_event (GD_OP_EVENT_RCVD_ACC, ev_ctx);
- glusterd_op_sm ();
-}
-
-
static int
glusterd_op_ac_rcvd_commit_op_acc (glusterd_op_sm_event_t *event, void *ctx)
{
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.h b/xlators/mgmt/glusterd/src/glusterd-op-sm.h
index 668da556df1..31551ca430f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.h
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.h
@@ -246,7 +246,6 @@ int32_t
glusterd_handle_brick_rsp (glusterd_brickinfo_t *brickinfo,
glusterd_op_t op, dict_t *rsp_dict, dict_t *ctx_dict,
char **op_errstr);
-void glusterd_op_brick_disconnect (void *data);
int32_t
glusterd_op_init_ctx (glusterd_op_t op);
int32_t
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
index 06bee97b509..ea7a2620fae 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c
@@ -1946,30 +1946,6 @@ out:
}
int32_t
-glusterd_start_brick_disconnect_timer (glusterd_op_brick_rsp_ctx_t *ev_ctx)
-{
- struct timeval timeout = {0, };
- int32_t ret = -1;
- xlator_t *this = NULL;
- glusterd_brickinfo_t *brickinfo = NULL;
-
- timeout.tv_sec = 5;
- timeout.tv_usec = 0;
- brickinfo = ev_ctx->pending_node->node;
- GF_ASSERT (brickinfo);
- this = THIS;
- GF_ASSERT (this);
-
- brickinfo->timer = gf_timer_call_after (this->ctx, timeout,
- glusterd_op_brick_disconnect,
- (void *) ev_ctx);
-
- ret = 0;
-
- return ret;
-}
-
-int32_t
glusterd3_1_brick_op_cbk (struct rpc_req *req, struct iovec *iov,
int count, void *myframe)
{
@@ -1979,7 +1955,6 @@ glusterd3_1_brick_op_cbk (struct rpc_req *req, struct iovec *iov,
glusterd_op_sm_event_type_t event_type = GD_OP_EVENT_NONE;
call_frame_t *frame = NULL;
glusterd_op_brick_rsp_ctx_t *ev_ctx = NULL;
- int32_t op = -1;
dict_t *dict = NULL;
GF_ASSERT (req);
@@ -2036,16 +2011,10 @@ out:
ev_ctx->pending_node = frame->cookie;
ev_ctx->rsp_dict = dict;
ev_ctx->commit_ctx = frame->local;
- op = glusterd_op_get_op ();
- if ((op == GD_OP_STOP_VOLUME) ||
- (op == GD_OP_REMOVE_BRICK)) {
- ret = glusterd_start_brick_disconnect_timer (ev_ctx);
- } else {
- ret = glusterd_op_sm_inject_event (event_type, ev_ctx);
- if (!ret) {
- glusterd_friend_sm ();
- glusterd_op_sm ();
- }
+ ret = glusterd_op_sm_inject_event (event_type, ev_ctx);
+ if (!ret) {
+ glusterd_friend_sm ();
+ glusterd_op_sm ();
}
if (ret && dict)
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index 203f6e975c7..d59193e745a 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -142,7 +142,6 @@ struct glusterd_brickinfo {
glusterd_store_handle_t *shandle;
gf_brick_status_t status;
struct rpc_clnt *rpc;
- gf_timer_t *timer;
int decommissioned;
};