diff options
author | nik-redhat <nladha@redhat.com> | 2020-07-21 12:44:41 +0530 |
---|---|---|
committer | nik-redhat <nladha@redhat.com> | 2020-07-27 19:32:36 +0530 |
commit | 4284a3fea05af2d6de63fc71f79c7a0832dbaa96 (patch) | |
tree | b7d407274e7c75f3625f9006b094af91a33032e1 /libglusterfs/src/xlator.c | |
parent | e12d89ef24e90fe6855274966b558a8f831246c1 (diff) |
libglusterfs/xlator: undefined symbol xlator_api
Issue:
On executiing the command gluster vol set help, an error
comes up in glusterd logs stating `undefined symbol: xlator_api`.
This issue is seen for the rpc-transport/socket.so file.
Fix:
The symbol `xlator_api` is not found in rpc-transport/socket.so
file as it is not a xlator but a shared object for transport.
In the `xlator.c` file, there is a function `xlator_volopt_dynload`,
which looks for the default values of the options available in gluster,
which is stored inside the respective xlator files for different voltypes.
In each of these files the `options` object is present which contains
the default values, which is therefore referenced from the `options` data
member of `xlator_api` object in case of xlators.But, since
`rpc-transport/socket.so` is not an xlator we don't have the `xlator_api`
object present to point to that object. So, in case of
`rpc-transport/socket.so` type we are accesing the `options` object
directly from the `xlator_volopt_dynload` function to fetch the default
values for the available options.
Fixes: #827
Change-Id: I3b2b0c1f2a11896be250aaca1a33a65b044991d5
Signed-off-by: nik-redhat <nladha@redhat.com>
Diffstat (limited to 'libglusterfs/src/xlator.c')
-rw-r--r-- | libglusterfs/src/xlator.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index e793e1e3d68..539da7f4716 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -184,9 +184,11 @@ xlator_volopt_dynload(char *xlator_type, void **dl_handle, volume_opt_list_t *opt_list) { int ret = -1; + int flag = 0; char *name = NULL; void *handle = NULL; xlator_api_t *xlapi = NULL; + volume_option_t *opt = NULL; GF_VALIDATE_OR_GOTO("xlator", xlator_type, out); @@ -194,8 +196,10 @@ xlator_volopt_dynload(char *xlator_type, void **dl_handle, * need this check */ if (!strstr(xlator_type, "rpc-transport")) ret = gf_asprintf(&name, "%s/%s.so", XLATORDIR, xlator_type); - else + else { + flag = 1; ret = gf_asprintf(&name, "%s/%s.so", XLATORPARENTDIR, xlator_type); + } if (-1 == ret) { goto out; } @@ -211,18 +215,29 @@ xlator_volopt_dynload(char *xlator_type, void **dl_handle, goto out; } - /* check new struct first, and then check this */ - xlapi = dlsym(handle, "xlator_api"); - if (!xlapi) { - gf_smsg("xlator", GF_LOG_ERROR, 0, LG_MSG_DLSYM_ERROR, "error=%s", - dlerror(), NULL); - goto out; - } + if (flag == 0) { + /* check new struct first, and then check this */ + xlapi = dlsym(handle, "xlator_api"); + if (!xlapi) { + gf_smsg("xlator", GF_LOG_ERROR, 0, LG_MSG_DLSYM_ERROR, "error=%s", + dlerror(), NULL); + goto out; + } - opt_list->given_opt = xlapi->options; - if (!opt_list->given_opt) { - gf_smsg("xlator", GF_LOG_ERROR, 0, LG_MSG_LOAD_FAILED, NULL); - goto out; + opt_list->given_opt = xlapi->options; + if (!opt_list->given_opt) { + gf_smsg("xlator", GF_LOG_ERROR, 0, LG_MSG_LOAD_FAILED, NULL); + goto out; + } + } else { + opt = dlsym(handle, "options"); + if (!opt) { + gf_smsg("xlator", GF_LOG_ERROR, 0, LG_MSG_DLSYM_ERROR, "error=%s", + dlerror(), NULL); + goto out; + } + + opt_list->given_opt = opt; } *dl_handle = handle; |