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>
This commit is contained in:
parent
9bd1b291e3
commit
0caffe52b8
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user