summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith K <pranithk@gluster.com>2010-10-02 01:36:16 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-10-02 00:40:21 -0700
commit365c814f7ba4cc8e04959927c3ded9cdd5b2ab24 (patch)
treea927020462af77ffba8cb23170decb8c4501a865
parentc5714ce6e6fe20575159220bbdf178ebf33ca0ad (diff)
mgmt/glusterd: handle peer not connected in peer detachv3.1.0qa38
Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1762 (peer detach/peer status ,created glusterd crash) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1762
-rw-r--r--xlators/mgmt/glusterd/src/glusterd3_1-mops.c43
1 files changed, 33 insertions, 10 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd3_1-mops.c b/xlators/mgmt/glusterd/src/glusterd3_1-mops.c
index a92fab4594a..24035428ed0 100644
--- a/xlators/mgmt/glusterd/src/glusterd3_1-mops.c
+++ b/xlators/mgmt/glusterd/src/glusterd3_1-mops.c
@@ -839,7 +839,9 @@ glusterd3_1_friend_remove (call_frame_t *frame, xlator_t *this,
glusterd_peerinfo_t *peerinfo = NULL;
glusterd_conf_t *priv = NULL;
glusterd_friend_sm_event_t *event = NULL;
- glusterd_friend_req_ctx_t *ctx = NULL;
+ glusterd_probe_ctx_t *ctx = NULL;
+ glusterd_friend_sm_event_t *new_event = NULL;
+ glusterd_friend_sm_event_type_t event_type = GD_FRIEND_EVENT_NONE;
if (!frame || !this || !data) {
@@ -856,15 +858,36 @@ glusterd3_1_friend_remove (call_frame_t *frame, xlator_t *this,
peerinfo = event->peerinfo;
- uuid_copy (req.uuid, priv->uuid);
- req.hostname = peerinfo->hostname;
- req.port = peerinfo->port;
- ret = glusterd_submit_request (peerinfo, &req, frame, priv->mgmt,
- GD_MGMT_FRIEND_REMOVE,
- NULL, gd_xdr_from_mgmt_friend_req,
- this, glusterd3_1_friend_remove_cbk);
- //Override ret
- ret = 0;
+ ret = -1;
+ if (peerinfo->connected) {
+ uuid_copy (req.uuid, priv->uuid);
+ req.hostname = peerinfo->hostname;
+ req.port = peerinfo->port;
+ ret = glusterd_submit_request (peerinfo, &req, frame, priv->mgmt,
+ GD_MGMT_FRIEND_REMOVE,
+ NULL, gd_xdr_from_mgmt_friend_req,
+ this, glusterd3_1_friend_remove_cbk);
+ }
+ if (ret) {
+ event_type = GD_FRIEND_EVENT_REMOVE_FRIEND;
+
+ ret = glusterd_friend_sm_new_event (event_type, &new_event);
+
+ if (!ret) {
+ new_event->peerinfo = peerinfo;
+ ret = glusterd_friend_sm_inject_event (new_event);
+ } else {
+ gf_log ("glusterd", GF_LOG_ERROR,
+ "Unable to get event");
+ }
+ if (ctx)
+ ret = glusterd_xfer_cli_deprobe_resp (ctx->req, ret, 0,
+ ctx->hostname);
+ glusterd_friend_sm ();
+ glusterd_op_sm ();
+ if (ctx)
+ glusterd_destroy_probe_ctx (ctx);
+ }
out:
gf_log ("glusterd", GF_LOG_DEBUG, "Returning %d", ret);