summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2010-02-22 03:42:04 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-02-22 01:31:00 -0800
commitfa3b447cb058a7012ed2f68b89bc9b9e933c7367 (patch)
tree0349e27672aaca19db26225cca200ba97d0802dc /xlators
parent40a07c180a479472b7fac8f16b7d825ca26f6f50 (diff)
protocol/client: better pointer check on saved_frames mapping in ping timer
Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 434 (Crash with 3.0.0pre2 on client01 with "metarates" parallel MPI metadata benchmark) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=434
Diffstat (limited to 'xlators')
-rw-r--r--xlators/protocol/client/src/client-protocol.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c
index 8182954ceb6..3adfbd79b74 100644
--- a/xlators/protocol/client/src/client-protocol.c
+++ b/xlators/protocol/client/src/client-protocol.c
@@ -433,6 +433,7 @@ client_start_ping (void *data)
call_frame_t *dummy_frame = NULL;
size_t hdrlen = -1;
gf_mop_ping_req_t *req = NULL;
+ int frame_count = 0;
trans = data;
@@ -445,33 +446,35 @@ client_start_ping (void *data)
pthread_mutex_lock (&conn->lock);
{
- if ((conn->saved_frames->count == 0) ||
- !conn->connected) {
+ if (conn->ping_timer)
+ gf_timer_call_cancel (trans->xl->ctx, conn->ping_timer);
+
+ conn->ping_timer = NULL;
+ conn->ping_started = 0;
+
+ if (conn->saved_frames)
+ /* treat the case where conn->saved_frames is NULL
+ as no pending frames */
+ frame_count = conn->saved_frames->count;
+
+ if ((frame_count == 0) || !conn->connected) {
/* using goto looked ugly here,
* hence getting out this way */
- if (conn->ping_timer)
- gf_timer_call_cancel (trans->xl->ctx,
- conn->ping_timer);
- conn->ping_timer = NULL;
- conn->ping_started = 0;
/* unlock */
pthread_mutex_unlock (&conn->lock);
return;
}
- if (conn->saved_frames->count < 0) {
+ if (frame_count < 0) {
gf_log (this->name, GF_LOG_DEBUG,
"saved_frames->count is %"PRId64,
conn->saved_frames->count);
conn->saved_frames->count = 0;
}
+
timeout.tv_sec = conn->ping_timeout;
timeout.tv_usec = 0;
- if (conn->ping_timer)
- gf_timer_call_cancel (trans->xl->ctx,
- conn->ping_timer);
-
conn->ping_timer =
gf_timer_call_after (trans->xl->ctx, timeout,
client_ping_timer_expired,