diff options
-rw-r--r-- | tests/bugs/bug-1102656.t | 20 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 26 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 2 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-replace-brick.c | 17 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rpc-ops.c | 48 |
5 files changed, 71 insertions, 42 deletions
diff --git a/tests/bugs/bug-1102656.t b/tests/bugs/bug-1102656.t new file mode 100644 index 00000000000..18f2b93eb49 --- /dev/null +++ b/tests/bugs/bug-1102656.t @@ -0,0 +1,20 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 2 $H0:$B0/brick0 $H0:$B0/brick1 +TEST $CLI volume start $V0 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'Started' volinfo_field $V0 'Status'; + +TEST $CLI volume top $V0 open +TEST ! $CLI volume top $V0 open brick $H0:/tmp/brick +TEST $CLI volume top $V0 read + +TEST $CLI volume status +TEST $CLI volume stop $V0 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'Stopped' volinfo_field $V0 'Status'; +cleanup; diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 7303622aed7..e203e5af01f 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -905,23 +905,25 @@ __glusterd_handle_stage_op (rpcsvc_request_t *req) goto out; } - if (glusterd_friend_find_by_uuid (op_req.uuid, &peerinfo)) { - gf_log (this->name, GF_LOG_WARNING, "%s doesn't " - "belong to the cluster. Ignoring request.", - uuid_utoa (op_req.uuid)); - ret = -1; - goto out; - } - ret = glusterd_req_ctx_create (req, op_req.op, op_req.uuid, op_req.buf.buf_val, op_req.buf.buf_len, gf_gld_mt_op_stage_ctx_t, &req_ctx); - if (ret) + if (ret) { + gf_log (this->name, GF_LOG_ERROR, "Failed to create req_ctx"); goto out; + } ret = dict_get_bin (req_ctx->dict, "transaction_id", (void **)&txn_id); + gf_log (this->name, GF_LOG_DEBUG, "transaction ID = %s", + uuid_utoa (*txn_id)); - gf_log ("", GF_LOG_DEBUG, "transaction ID = %s", uuid_utoa (*txn_id)); + if (glusterd_friend_find_by_uuid (op_req.uuid, &peerinfo)) { + gf_log (this->name, GF_LOG_WARNING, "%s doesn't " + "belong to the cluster. Ignoring request.", + uuid_utoa (op_req.uuid)); + ret = -1; + goto out; + } /* In cases where there is no volname, the receivers won't have a * transaction opinfo created, as for those operations, the locking @@ -1009,8 +1011,8 @@ __glusterd_handle_commit_op (rpcsvc_request_t *req) goto out; ret = dict_get_bin (req_ctx->dict, "transaction_id", (void **)&txn_id); - - gf_log ("", GF_LOG_DEBUG, "transaction ID = %s", uuid_utoa (*txn_id)); + gf_log (this->name, GF_LOG_DEBUG, "transaction ID = %s", + uuid_utoa (*txn_id)); ret = glusterd_op_sm_inject_event (GD_OP_EVENT_COMMIT_OP, txn_id, req_ctx); diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 8b9ddf32259..4ad53c126e6 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -6488,7 +6488,7 @@ glusterd_op_sm () "type: '%s'", glusterd_op_sm_event_name_get(event_type)); - gf_log ("", GF_LOG_DEBUG, "transaction ID = %s", + gf_log (this->name, GF_LOG_DEBUG, "transaction ID = %s", uuid_utoa (event->txn_id)); ret = glusterd_get_txn_opinfo (&event->txn_id, diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c index 929c86b718c..151d41f4e49 100644 --- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c +++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c @@ -1929,6 +1929,7 @@ glusterd_do_replace_brick (void *data) int32_t op = 0; int32_t src_port = 0; int32_t dst_port = 0; + int32_t ret = 0; dict_t *dict = NULL; char *src_brick = NULL; char *dst_brick = NULL; @@ -1937,16 +1938,16 @@ glusterd_do_replace_brick (void *data) glusterd_brickinfo_t *dst_brickinfo = NULL; glusterd_conf_t *priv = NULL; uuid_t *txn_id = NULL; + xlator_t *this = NULL; - int ret = 0; - - dict = data; - - GF_ASSERT (THIS); - priv = THIS->private; + this = THIS; + GF_ASSERT (this); + priv = this->private; GF_ASSERT (priv); + GF_ASSERT (data); txn_id = &priv->global_txn_id; + dict = data; if (priv->timer) { gf_timer_call_cancel (THIS->ctx, priv->timer); @@ -1959,8 +1960,8 @@ glusterd_do_replace_brick (void *data) "Replace brick operation detected"); ret = dict_get_bin (dict, "transaction_id", (void **)&txn_id); - - gf_log ("", GF_LOG_DEBUG, "transaction ID = %s", uuid_utoa (*txn_id)); + gf_log (this->name, GF_LOG_DEBUG, "transaction ID = %s", + uuid_utoa (*txn_id)); ret = dict_get_int32 (dict, "operation", &op); if (ret) { diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c index 216806f4457..7025e9844db 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c @@ -897,11 +897,16 @@ __glusterd_stage_op_cbk (struct rpc_req *req, struct iovec *iov, char err_str[2048] = {0}; char *peer_str = NULL; xlator_t *this = NULL; + glusterd_conf_t *priv = NULL; uuid_t *txn_id = NULL; this = THIS; GF_ASSERT (this); GF_ASSERT (req); + priv = this->private; + GF_ASSERT (priv); + + txn_id = &priv->global_txn_id; if (-1 == req->rpc_status) { rsp.op_ret = -1; @@ -951,17 +956,14 @@ out: (op_ret) ? "RJT" : "ACC", uuid_utoa (rsp.uuid)); ret = dict_get_bin (dict, "transaction_id", (void **)&txn_id); - - gf_log ("", GF_LOG_DEBUG, "transaction ID = %s", uuid_utoa (*txn_id)); + gf_log (this->name, GF_LOG_DEBUG, "transaction ID = %s", + uuid_utoa (*txn_id)); ret = glusterd_friend_find (rsp.uuid, NULL, &peerinfo); - - if (ret) { + if (ret) gf_log (this->name, GF_LOG_CRITICAL, "Stage response received " "from unknown peer: %s. Ignoring response.", uuid_utoa (rsp.uuid)); - goto out; - } if (op_ret) { event_type = GD_OP_EVENT_RCVD_RJT; @@ -977,10 +979,8 @@ out: OPERRSTR_STAGE_FAIL, peer_str); opinfo.op_errstr = gf_strdup (err_str); } - if (!opinfo.op_errstr) { + if (!opinfo.op_errstr) ret = -1; - goto out; - } } else { event_type = GD_OP_EVENT_RCVD_ACC; } @@ -1031,12 +1031,16 @@ __glusterd_commit_op_cbk (struct rpc_req *req, struct iovec *iov, char err_str[2048] = {0}; char *peer_str = NULL; xlator_t *this = NULL; + glusterd_conf_t *priv = NULL; uuid_t *txn_id = NULL; - this = THIS; GF_ASSERT (this); GF_ASSERT (req); + priv = this->private; + GF_ASSERT (priv); + + txn_id = &priv->global_txn_id; if (-1 == req->rpc_status) { rsp.op_ret = -1; @@ -1087,11 +1091,10 @@ __glusterd_commit_op_cbk (struct rpc_req *req, struct iovec *iov, (op_ret)?"RJT":"ACC", uuid_utoa (rsp.uuid)); ret = dict_get_bin (dict, "transaction_id", (void **)&txn_id); - - gf_log ("", GF_LOG_DEBUG, "transaction ID = %s", uuid_utoa (*txn_id)); + gf_log (this->name, GF_LOG_DEBUG, "transaction ID = %s", + uuid_utoa (*txn_id)); ret = glusterd_friend_find (rsp.uuid, NULL, &peerinfo); - if (ret) { gf_log (this->name, GF_LOG_CRITICAL, "Commit response for " "'Volume %s' received from unknown peer: %s", @@ -1791,9 +1794,12 @@ __glusterd_brick_op_cbk (struct rpc_req *req, struct iovec *iov, } out: - ret = dict_get_bin (req_ctx->dict, "transaction_id", (void **)&txn_id); - - gf_log ("", GF_LOG_DEBUG, "transaction ID = %s", uuid_utoa (*txn_id)); + if (req_ctx && req_ctx->dict) { + ret = dict_get_bin (req_ctx->dict, "transaction_id", + (void **)&txn_id); + gf_log (this->name, GF_LOG_DEBUG, + "transaction ID = %s", uuid_utoa (*txn_id)); + } ev_ctx = GF_CALLOC (1, sizeof (*ev_ctx), gf_gld_mt_brick_rsp_ctx_t); GF_ASSERT (ev_ctx); @@ -1857,6 +1863,11 @@ glusterd_brick_op (call_frame_t *frame, xlator_t *this, req_ctx = data; GF_ASSERT (req_ctx); INIT_LIST_HEAD (&opinfo.pending_bricks); + + ret = dict_get_bin (req_ctx->dict, "transaction_id", (void **)&txn_id); + gf_log (this->name, GF_LOG_DEBUG, "transaction ID = %s", + uuid_utoa (*txn_id)); + ret = glusterd_op_bricks_select (req_ctx->op, req_ctx->dict, &op_errstr, &opinfo.pending_bricks, NULL); @@ -1868,11 +1879,6 @@ glusterd_brick_op (call_frame_t *frame, xlator_t *this, goto out; } - - ret = dict_get_bin (req_ctx->dict, "transaction_id", (void **)&txn_id); - - gf_log ("", GF_LOG_DEBUG, "transaction ID = %s", uuid_utoa (*txn_id)); - list_for_each_entry (pending_node, &opinfo.pending_bricks, list) { dummy_frame = create_frame (this, this->ctx->pool); if (!dummy_frame) |