summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2012-05-01 10:50:50 +0530
committerAnand Avati <avati@redhat.com>2012-05-05 23:49:02 -0700
commit0caffe52b8db6670dfa2b1c825477ede7ba304c6 (patch)
tree1d595d40a0dde1ad313a14ead15470526495c9f8 /xlators
parent9bd1b291e3e107250b38d05702df7cd751382bdc (diff)
protocol/client: hold lock when cancelling ping_timer in
client_ping_cbk. Change-Id: I2b4e723ef119c62902f8a692a8a1f424da0d08b4 BUG: 816951 Signed-off-by: Raghavendra G <raghavendra@gluster.com> Reviewed-on: http://review.gluster.com/3254 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/protocol/client/src/client-handshake.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c
index a3cb325b02a..c249516a930 100644
--- a/xlators/protocol/client/src/client-handshake.c
+++ b/xlators/protocol/client/src/client-handshake.c
@@ -254,35 +254,40 @@ client_ping_cbk (struct rpc_req *req, struct iovec *iov, int count,
clnt_conf_t *conf = NULL;
if (!myframe) {
- gf_log (THIS->name, GF_LOG_WARNING, "frame with the request is NULL");
+ gf_log (THIS->name, GF_LOG_WARNING,
+ "frame with the request is NULL");
goto out;
}
frame = myframe;
this = frame->this;
if (!this || !this->private) {
- gf_log (THIS->name, GF_LOG_WARNING, "xlator private is not set");
+ gf_log (THIS->name, GF_LOG_WARNING,
+ "xlator private is not set");
goto out;
}
conf = this->private;
conn = &conf->rpc->conn;
- if (req->rpc_status == -1) {
- if (conn->ping_timer != NULL) {
- gf_log (this->name, GF_LOG_WARNING, "socket or ib"
- " related error");
- gf_timer_call_cancel (this->ctx, conn->ping_timer);
- conn->ping_timer = NULL;
- } else {
- /* timer expired and transport bailed out */
- gf_log (this->name, GF_LOG_WARNING, "timer must have "
- "expired");
- }
- goto out;
- }
-
pthread_mutex_lock (&conn->lock);
{
+ if (req->rpc_status == -1) {
+ if (conn->ping_timer != NULL) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "socket or ib related error");
+ gf_timer_call_cancel (this->ctx,
+ conn->ping_timer);
+ conn->ping_timer = NULL;
+ } else {
+ /* timer expired and transport bailed out */
+ gf_log (this->name, GF_LOG_WARNING,
+ "timer must have expired");
+ }
+
+ goto unlock;
+ }
+
+
timeout.tv_sec = conf->opt.ping_timeout;
timeout.tv_usec = 0;
@@ -297,6 +302,7 @@ client_ping_cbk (struct rpc_req *req, struct iovec *iov, int count,
gf_log (this->name, GF_LOG_WARNING,
"failed to set the ping timer");
}
+unlock:
pthread_mutex_unlock (&conn->lock);
out:
if (frame)