From 0d2d861849a3b066eac676ebed4e16accdfe8598 Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Thu, 14 Apr 2011 05:11:33 +0000 Subject: DHT:first_up_subvol should be the one up the longest Signed-off-by: shishir gowda Signed-off-by: Anand Avati BUG: 2684 (Dir missing from mount point) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2684 --- xlators/cluster/dht/src/dht-common.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'xlators/cluster/dht/src/dht-common.c') diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 8fa93fa07..cd2985002 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -4992,6 +4992,11 @@ dht_init_subvolumes (xlator_t *this, dht_conf_t *conf) return -1; } + conf->subvol_up_time = GF_CALLOC (cnt, sizeof (time_t), + gf_dht_mt_subvol_time); + if (!conf->subvol_up_time) { + return -1; + } return 0; } @@ -5008,7 +5013,7 @@ dht_notify (xlator_t *this, int event, void *data, ...) int had_heard_from_all = 0; int have_heard_from_all = 0; - + struct timeval time = {0,}; conf = this->private; if (!conf) @@ -5042,10 +5047,12 @@ dht_notify (xlator_t *this, int event, void *data, ...) break; } + gettimeofday (&time, NULL); LOCK (&conf->subvolume_lock); { conf->subvolume_status[cnt] = 1; conf->last_event[cnt] = event; + conf->subvol_up_time[cnt] = time.tv_sec; } UNLOCK (&conf->subvolume_lock); @@ -5089,6 +5096,7 @@ dht_notify (xlator_t *this, int event, void *data, ...) { conf->subvolume_status[cnt] = 0; conf->last_event[cnt] = event; + conf->subvol_up_time[cnt] = 0; } UNLOCK (&conf->subvolume_lock); -- cgit