diff options
author | Anand Avati <avati@gluster.com> | 2010-02-22 03:42:04 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-02-22 01:31:05 -0800 |
commit | 1f1a2f8c47c4b67438d9413e7fc7a18af9083f4b (patch) | |
tree | f93dc9f1aec387cc785aab985611adf5b02de984 | |
parent | e1a1dc21efb20bd7d7a85d0e3c19153615f458fc (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
-rw-r--r-- | xlators/protocol/client/src/client-protocol.c | 27 |
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, |