summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src
diff options
context:
space:
mode:
authorKaushal M <kaushal@redhat.com>2013-04-30 13:03:08 +0530
committerVijay Bellur <vbellur@redhat.com>2013-05-31 06:43:42 -0700
commit599c6b472869cfaf0058e7b169de204450a41948 (patch)
tree2c66b1022fd61b76a4e2beaa6fa30f779e767637 /libglusterfs/src
parent003713139c8a7830a90a40dfead72f8299c17e31 (diff)
glusterd-volgen: Improve volume op-versions calculation
Volume op-versions calculations now take into account if an option, a. enables/disables an xlator, or b. is a boolean option. This prevents op-versions from being updated when a feature is disabled. Also, correctly close the dynamically loaded xlators in xlator_volopt_dynload() and prevent leaks. Change-Id: I895ddeeec6f6a33e509325f0ce6f01b7aad3cf5c BUG: 954256 Signed-off-by: Kaushal M <kaushal@redhat.com> Reviewed-on: http://review.gluster.org/4952 Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'libglusterfs/src')
-rw-r--r--libglusterfs/src/options.c3
-rw-r--r--libglusterfs/src/options.h3
-rw-r--r--libglusterfs/src/xlator.c29
3 files changed, 9 insertions, 26 deletions
diff --git a/libglusterfs/src/options.c b/libglusterfs/src/options.c
index 5d436bab38d..842b6413ab4 100644
--- a/libglusterfs/src/options.c
+++ b/libglusterfs/src/options.c
@@ -761,7 +761,7 @@ out:
}
-static volume_option_t *
+volume_option_t *
xlator_volume_option_get_list (volume_opt_list_t *vol_list, const char *key)
{
volume_option_t *opt = NULL;
@@ -1098,7 +1098,6 @@ pc_or_size (char *in, double *out)
return ret;
}
-
DEFINE_INIT_OPT(char *, str, pass);
DEFINE_INIT_OPT(uint64_t, uint64, gf_string2uint64);
DEFINE_INIT_OPT(int64_t, int64, gf_string2int64);
diff --git a/libglusterfs/src/options.h b/libglusterfs/src/options.h
index 64c2c64ef59..e2a25baa9e7 100644
--- a/libglusterfs/src/options.h
+++ b/libglusterfs/src/options.h
@@ -93,6 +93,9 @@ int xlator_options_validate (xlator_t *xl, dict_t *options, char **errstr);
volume_option_t *
xlator_volume_option_get (xlator_t *xl, const char *key);
+volume_option_t *
+xlator_volume_option_get_list (volume_opt_list_t *vol_list, const char *key);
+
#define DECLARE_INIT_OPT(type_t, type) \
int \
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 348f48c4805..d8997bc7d16 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -119,18 +119,9 @@ xlator_volopt_dynload (char *xlator_type, void **dl_handle,
int ret = -1;
char *name = NULL;
void *handle = NULL;
- volume_opt_list_t *vol_opt = NULL;
GF_VALIDATE_OR_GOTO ("xlator", xlator_type, out);
- GF_ASSERT (dl_handle);
-
- if (*dl_handle)
- if (dlclose (*dl_handle))
- gf_log ("xlator", GF_LOG_WARNING, "Unable to close "
- "previously opened handle( may be stale)."
- "Ignoring the invalid handle");
-
ret = gf_asprintf (&name, "%s/%s.so", XLATORDIR, xlator_type);
if (-1 == ret) {
gf_log ("xlator", GF_LOG_ERROR, "asprintf failed");
@@ -146,25 +137,15 @@ xlator_volopt_dynload (char *xlator_type, void **dl_handle,
gf_log ("xlator", GF_LOG_WARNING, "%s", dlerror ());
goto out;
}
- *dl_handle = handle;
-
- vol_opt = GF_CALLOC (1, sizeof (volume_opt_list_t),
- gf_common_mt_volume_opt_list_t);
-
- if (!vol_opt) {
- goto out;
- }
-
- if (!(vol_opt->given_opt = dlsym (handle, "options"))) {
+ if (!(opt_list->given_opt = dlsym (handle, "options"))) {
dlerror ();
- gf_log ("xlator", GF_LOG_DEBUG,
- "Strict option validation not enforced -- neglecting");
+ gf_log ("xlator", GF_LOG_ERROR,
+ "Failed to load xlator opt table");
+ goto out;
}
- opt_list->given_opt = vol_opt->given_opt;
- INIT_LIST_HEAD (&vol_opt->list);
- list_add_tail (&vol_opt->list, &opt_list->list);
+ *dl_handle = handle;
ret = 0;
out: