From 29377452062b07b6487105ebe65a717898e19e2a Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Thu, 14 Oct 2010 05:12:12 +0000 Subject: io-stats: handle the case of 'cleanup_and_exit()' properly Signed-off-by: Amar Tumballi Signed-off-by: Anand V. Avati BUG: 1933 (Segfault while expansion of volume from distributed mirror) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1933 --- xlators/debug/io-stats/src/io-stats.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'xlators') diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 90f02b6ee83..fff16ede215 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -91,8 +91,8 @@ struct ios_local { struct ios_conf *conf = NULL; \ \ conf = this->private; \ - if (conf->measure_latency) { \ - gettimeofday (&frame->end, NULL); \ + if (conf && conf->measure_latency) { \ + gettimeofday (&frame->end, NULL); \ update_ios_latency (conf, frame, GF_FOP_##op); \ } \ } while (0) @@ -102,8 +102,8 @@ struct ios_local { struct ios_conf *conf = NULL; \ \ conf = this->private; \ - if (conf->measure_latency) { \ - gettimeofday (&frame->begin, NULL); \ + if (conf && conf->measure_latency) { \ + gettimeofday (&frame->begin, NULL); \ } \ } while (0) @@ -113,6 +113,8 @@ struct ios_local { struct ios_conf *conf = NULL; \ \ conf = this->private; \ + if (!conf) \ + break; \ LOCK (&conf->lock); \ { \ conf->cumulative.fop_hits[GF_FOP_##op]++; \ @@ -131,6 +133,8 @@ struct ios_local { conf = this->private; \ lb2 = log_base2 (len); \ ios_fd_ctx_get (fd, this, &iosfd); \ + if (!conf) \ + break; \ \ LOCK (&conf->lock); \ { \ @@ -157,6 +161,8 @@ struct ios_local { conf = this->private; \ lb2 = log_base2 (len); \ ios_fd_ctx_get (fd, this, &iosfd); \ + if (!conf) \ + break; \ \ LOCK (&conf->lock); \ { \ -- cgit