diff options
author | Shehjar Tikoo <shehjart@gluster.com> | 2010-09-22 03:32:16 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-09-22 04:14:23 -0700 |
commit | 6b2e2fb0903fc56105c267881f202a4865a8b6c7 (patch) | |
tree | 49467f7c86a8ddd344b45ee4c7cd4f129ef0363f /xlators/cluster/dht/src | |
parent | a4c948aca6058049523e31acf33ce5770f8693ad (diff) |
distribute: Propagate CHILD-UP when all subvols are up
Signed-off-by: Shehjar Tikoo <shehjart@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1643 (Initial requests after mount ESTALE if DHT subvolumes connect after nfs startup)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1643
Diffstat (limited to 'xlators/cluster/dht/src')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 20 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-common.h | 1 |
2 files changed, 18 insertions, 3 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 92ea5854e20..bec412c4188 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -4555,6 +4555,10 @@ dht_notify (xlator_t *this, int event, void *data, ...) dht_conf_t *conf = NULL; int ret = -1; + /* Notify is on by default for all events except CHILD_UP. Do not + * notify parent for CHILD_UP till all distribute children have come up. + */ + int notify = 1; conf = this->private; @@ -4580,7 +4584,13 @@ dht_notify (xlator_t *this, int event, void *data, ...) LOCK (&conf->subvolume_lock); { - conf->subvolume_status[cnt] = 1; + if (!conf->subvolume_status[cnt]) { + conf->subvolume_status[cnt] = 1; + ++conf->upsubvols; + } + + if (conf->upsubvols != conf->subvolume_cnt) + notify = 0; } UNLOCK (&conf->subvolume_lock); @@ -4608,14 +4618,18 @@ dht_notify (xlator_t *this, int event, void *data, ...) LOCK (&conf->subvolume_lock); { - conf->subvolume_status[cnt] = 0; + if (conf->subvolume_status[cnt]) { + conf->subvolume_status[cnt] = 0; + --conf->upsubvols; + } } UNLOCK (&conf->subvolume_lock); break; } - ret = default_notify (this, event, data); + if (notify) + ret = default_notify (this, event, data); return ret; } diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index 0d028a2e542..918eb566b19 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -156,6 +156,7 @@ struct dht_conf { void *private; /* Can be used by wrapper xlators over dht */ gf_boolean_t use_readdirp; + int upsubvols; /* Count the number of online children*/ }; typedef struct dht_conf dht_conf_t; |