diff options
author | N Balachandran <nbalacha@redhat.com> | 2015-12-03 12:52:54 +0530 |
---|---|---|
committer | Dan Lambright <dlambrig@redhat.com> | 2015-12-03 10:01:07 -0800 |
commit | 96fc7f64da2ef09e82845a7ab97574f511a9aae5 (patch) | |
tree | 625d0f3e162845acf5d1d0fb63a0cd929669bcb6 /xlators/cluster/dht/src/tier.c | |
parent | cae9512d60f5715459ea5883c657c679197982d9 (diff) |
cluster/tier: fix loading tier.so into glusterd
glusterd occasionally loads shared libraries of translators. This
failed for tiering due to a reference to dht_methods which is defined
as a global variable which is not necessary.
The global variable has been removed and this is now a member of
dht_conf and is now initialised in the *_init calls.
Change-Id: Ifa0a21e3962b5cd8d9b927ef1d087d3b25312953
BUG: 1287842
Signed-off-by: N Balachandran <nbalacha@redhat.com>
Reviewed-on: http://review.gluster.org/12863
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Tested-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/tier.c')
-rw-r--r-- | xlators/cluster/dht/src/tier.c | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c index dbb34c67620..8d134f2a770 100644 --- a/xlators/cluster/dht/src/tier.c +++ b/xlators/cluster/dht/src/tier.c @@ -1571,12 +1571,6 @@ tier_search (xlator_t *this, dht_layout_t *layout, const char *name) return subvol; } -dht_methods_t tier_methods = { - .migration_get_dst_subvol = tier_migration_get_dst, - .migration_other = tier_start, - .migration_needed = tier_migration_needed, - .layout_search = tier_search, -}; static int tier_load_externals (xlator_t *this) @@ -1630,6 +1624,32 @@ int tier_validate_mode (char *mode) return ret; } + +int +tier_init_methods (xlator_t *this) +{ + int ret = -1; + dht_conf_t *conf = NULL; + dht_methods_t *methods = NULL; + + GF_VALIDATE_OR_GOTO ("tier", this, err); + + conf = this->private; + + methods = &(conf->methods); + + methods->migration_get_dst_subvol = tier_migration_get_dst; + methods->migration_other = tier_start; + methods->migration_needed = tier_migration_needed; + methods->layout_search = tier_search; + + ret = 0; +err: + return ret; +} + + + int tier_init (xlator_t *this) { @@ -1645,13 +1665,19 @@ tier_init (xlator_t *this) if (ret) { gf_msg (this->name, GF_LOG_ERROR, 0, DHT_MSG_LOG_TIER_ERROR, - "dht_init failed"); + "tier_init failed"); goto out; } conf = this->private; - conf->methods = &tier_methods; + ret = tier_init_methods (this); + if (ret) { + gf_msg (this->name, GF_LOG_ERROR, 0, + DHT_MSG_LOG_TIER_ERROR, + "tier_init_methods failed"); + goto out; + } if (conf->subvolume_cnt != 2) { gf_msg (this->name, GF_LOG_ERROR, 0, |