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-helper.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'xlators/cluster/dht/src/dht-helper.c') diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c index cd57b9ea0..42c6d025f 100644 --- a/xlators/cluster/dht/src/dht-helper.c +++ b/xlators/cluster/dht/src/dht-helper.c @@ -268,6 +268,7 @@ dht_first_up_subvol (xlator_t *this) dht_conf_t *conf = NULL; xlator_t *child = NULL; int i = 0; + time_t time = 0; conf = this->private; if (!conf) @@ -276,9 +277,14 @@ dht_first_up_subvol (xlator_t *this) LOCK (&conf->subvolume_lock); { for (i = 0; i < conf->subvolume_cnt; i++) { - if (conf->subvolume_status[i]) { - child = conf->subvolumes[i]; - break; + if (conf->subvol_up_time[i]) { + if (!time) { + time = conf->subvol_up_time[i]; + child = conf->subvolumes[i]; + } else if (time > conf->subvol_up_time[i]) { + time = conf->subvol_up_time[i]; + child = conf->subvolumes[i]; + } } } } -- cgit