summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-handshake.c
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-03-03 05:47:33 +0000
committerAnand V. Avati <avati@dev.gluster.com>2011-03-04 00:41:00 -0800
commit8f132b363d41e7fe94a8712ed297a5f810e8ed56 (patch)
tree18cd6c294c0eb585ca1ac4da479f79f2926b162c /xlators/mgmt/glusterd/src/glusterd-handshake.c
parent568d4027033a5cb89d6aaee757d4c71e5369fe25 (diff)
glusterd: check for the variable before dereferencing it
check if 'peerinfo->mgmt' is set (ie, handshake is completed), before sending any request to that peer. Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 2486 ([glusterfs-3.1.3qa2]: Core generated due to SegFault in glusterd_sm.c) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2486
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-handshake.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handshake.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c
index c3af04b2a78..d364339a671 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handshake.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c
@@ -292,10 +292,6 @@ glusterd_set_clnt_mgmt_program (glusterd_peerinfo_t *peerinfo,
if ((gd_clnt_mgmt_prog.prognum == trav->prognum) &&
(gd_clnt_mgmt_prog.progver == trav->progver)) {
peerinfo->mgmt = &gd_clnt_mgmt_prog;
- gf_log ("", GF_LOG_INFO,
- "Using Program %s, Num (%"PRId64"), "
- "Version (%"PRId64")",
- trav->progname, trav->prognum, trav->progver);
ret = 0;
/* Break here, as this gets higher priority */
break;
@@ -303,20 +299,24 @@ glusterd_set_clnt_mgmt_program (glusterd_peerinfo_t *peerinfo,
if ((glusterd3_1_mgmt_prog.prognum == trav->prognum) &&
(glusterd3_1_mgmt_prog.progver == trav->progver)) {
peerinfo->mgmt = &glusterd3_1_mgmt_prog;
- gf_log ("", GF_LOG_INFO,
- "Using Program %s, Num (%"PRId64"), "
- "Version (%"PRId64")",
- trav->progname, trav->prognum, trav->progver);
ret = 0;
}
if (ret) {
- gf_log ("", GF_LOG_TRACE,
- "%s (%"PRId64") not supported", trav->progname,
+ gf_log ("", GF_LOG_DEBUG,
+ "%s (%"PRId64":%"PRId64") not supported",
+ trav->progname, trav->prognum,
trav->progver);
}
trav = trav->next;
}
+ if (!ret && peerinfo->mgmt) {
+ gf_log ("", GF_LOG_INFO,
+ "Using Program %s, Num (%d), Version (%d)",
+ peerinfo->mgmt->progname, peerinfo->mgmt->prognum,
+ peerinfo->mgmt->progver);
+ }
+
out:
return ret;
}
@@ -370,6 +370,9 @@ glusterd_peer_dump_version_cbk (struct rpc_req *req, struct iovec *iov,
peerctx->args.req = NULL;
} else if (GD_MODE_SWITCH_ON == peerctx->args.mode) {
peerctx->args.mode = GD_MODE_ON;
+ } else {
+ gf_log ("", GF_LOG_WARNING, "unknown mode %d",
+ peerctx->args.mode);
}
glusterd_friend_sm ();
@@ -405,7 +408,7 @@ glusterd_peer_handshake (xlator_t *this, struct rpc_clnt *rpc,
{
call_frame_t *frame = NULL;
gf_dump_req req = {0,};
- int ret = 0;
+ int ret = -1;
frame = create_frame (this, this->ctx->pool);
if (!frame)