diff options
author | Xiubo Li <xiubli@redhat.com> | 2019-07-26 12:34:52 +0800 |
---|---|---|
committer | Rinku Kothiya <rkothiya@redhat.com> | 2019-08-21 06:13:38 +0000 |
commit | acbabe3d916d763a0bb13e7df876cac61ca5b160 (patch) | |
tree | 8eeb15421811083a19c49bc3322500febbe53a5a /xlators | |
parent | d89199919265480e43172dd3883c20ee24d46bde (diff) |
event: rename event_XXX with gf_ prefixed
I hit one crash issue when using the libgfapi.
In the libgfapi it will call glfs_poller() --> event_dispatch()
in file api/src/glfs.c:721, and the event_dispatch() is defined
by libgluster locally, the problem is the name of event_dispatch()
is the extremly the same with the one from libevent package form
the OS.
For example, if a executable program Foo, which will also use and
link the libevent and the libgfapi at the same time, I can hit the
crash, like:
kernel: glfs_glfspoll[68486]: segfault at 1c0 ip 00007fef006fd2b8 sp
00007feeeaffce30 error 4 in libevent-2.0.so.5.1.9[7fef006ed000+46000]
The link for Foo is:
lib_foo_LADD = -levent $(GFAPI_LIBS)
It will crash.
This is because the glfs_poller() is calling the event_dispatch() from
the libevent, not the libglsuter.
The gfapi link info :
GFAPI_LIBS = -lacl -lgfapi -lglusterfs -lgfrpc -lgfxdr -luuid
If I link Foo like:
lib_foo_LADD = $(GFAPI_LIBS) -levent
It will works well without any problem.
And if Foo call one private lib, such as handler_glfs.so, and the
handler_glfs.so will link the GFAPI_LIBS directly, while the Foo won't
and it will dlopen(handler_glfs.so), then the crash will be hit everytime.
The link info will be:
foo_LADD = -levent
libhandler_glfs_LIBADD = $(GFAPI_LIBS)
I can avoid the crash temporarily by linking the GFAPI_LIBS in Foo too like:
foo_LADD = $(GFAPI_LIBS) -levent
libhandler_glfs_LIBADD = $(GFAPI_LIBS)
But this is ugly since the Foo won't use any APIs from the GFAPI_LIBS.
And in some cases when the --as-needed link option is added(on many dists
it is added as default), then the crash is back again, the above workaround
won't work.
Backport of:
> https://review.gluster.org/#/c/glusterfs/+/23110/
> Change-Id: I38f0200b941bd1cff4bf3066fca2fc1f9a5263aa
> Fixes: #699
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
Change-Id: I38f0200b941bd1cff4bf3066fca2fc1f9a5263aa
updates: bz#1740519
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit 799edc73c3d4f694c365c6a7c27c9ab8eed5f260)
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/features/changelog/lib/src/gf-changelog.c | 4 | ||||
-rw-r--r-- | xlators/features/changelog/src/changelog-rpc-common.c | 2 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.c | 2 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs.c | 4 | ||||
-rw-r--r-- | xlators/protocol/client/src/client.c | 4 | ||||
-rw-r--r-- | xlators/protocol/server/src/server.c | 4 |
6 files changed, 10 insertions, 10 deletions
diff --git a/xlators/features/changelog/lib/src/gf-changelog.c b/xlators/features/changelog/lib/src/gf-changelog.c index d6acb37f3ef..59c98975cf5 100644 --- a/xlators/features/changelog/lib/src/gf-changelog.c +++ b/xlators/features/changelog/lib/src/gf-changelog.c @@ -102,8 +102,8 @@ gf_changelog_ctx_defaults_init(glusterfs_ctx_t *ctx) if (!ctx->iobuf_pool) goto free_pool; - ctx->event_pool = event_pool_new(GF_CHANGELOG_EVENT_POOL_SIZE, - GF_CHANGELOG_EVENT_THREAD_COUNT); + ctx->event_pool = gf_event_pool_new(GF_CHANGELOG_EVENT_POOL_SIZE, + GF_CHANGELOG_EVENT_THREAD_COUNT); if (!ctx->event_pool) goto free_pool; diff --git a/xlators/features/changelog/src/changelog-rpc-common.c b/xlators/features/changelog/src/changelog-rpc-common.c index dcdcfb1c735..991d77bd837 100644 --- a/xlators/features/changelog/src/changelog-rpc-common.c +++ b/xlators/features/changelog/src/changelog-rpc-common.c @@ -28,7 +28,7 @@ changelog_rpc_poller(void *arg) { xlator_t *this = arg; - (void)event_dispatch(this->ctx->event_pool); + (void)gf_event_dispatch(this->ctx->event_pool); return NULL; } diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index 131a3c2b7f2..10b5f82ad5a 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -2015,7 +2015,7 @@ init(xlator_t *this) GF_OPTION_INIT("event-threads", workers, int32, out); if (workers > 0 && workers != conf->workers) { conf->workers = workers; - ret = event_reconfigure_threads(this->ctx->event_pool, workers); + ret = gf_event_reconfigure_threads(this->ctx->event_pool, workers); if (ret) goto out; } diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c index aef88acc37b..cab57bbf3c9 100644 --- a/xlators/nfs/server/src/nfs.c +++ b/xlators/nfs/server/src/nfs.c @@ -1115,7 +1115,7 @@ nfs_init_state(xlator_t *this) GF_OPTION_INIT("nfs.event-threads", nfs->event_threads, uint32, free_foppool); - event_reconfigure_threads(this->ctx->event_pool, nfs->event_threads); + gf_event_reconfigure_threads(this->ctx->event_pool, nfs->event_threads); this->private = (void *)nfs; INIT_LIST_HEAD(&nfs->versions); @@ -1338,7 +1338,7 @@ nfs_reconfigure_state(xlator_t *this, dict_t *options) GF_OPTION_RECONF("nfs.event-threads", nfs->event_threads, options, uint32, out); - event_reconfigure_threads(this->ctx->event_pool, nfs->event_threads); + gf_event_reconfigure_threads(this->ctx->event_pool, nfs->event_threads); ret = 0; out: diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index 94d878a47fd..776e7160c51 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -2637,8 +2637,8 @@ client_check_event_threads(xlator_t *this, clnt_conf_t *conf, int32_t old, return 0; conf->event_threads = new; - return event_reconfigure_threads(this->ctx->event_pool, - conf->event_threads); + return gf_event_reconfigure_threads(this->ctx->event_pool, + conf->event_threads); } int diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c index 45a5e96e31a..f79fe26641d 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -699,7 +699,7 @@ server_check_event_threads(xlator_t *this, server_conf_t *conf, int32_t new) return 0; } - return event_reconfigure_threads(pool, target); + return gf_event_reconfigure_threads(pool, target); } int @@ -1005,7 +1005,7 @@ server_cleanup(xlator_t *this, server_conf_t *conf) if (this->ctx->event_pool) { /* Free the event pool */ - (void)event_pool_destroy(this->ctx->event_pool); + (void)gf_event_pool_destroy(this->ctx->event_pool); } if (dict_get_sizen(this->options, "config-directory")) { |