summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-sm.c
diff options
context:
space:
mode:
authorEmmanuel Dreyfus <manu@netbsd.org>2015-04-02 15:51:30 +0200
committerVijay Bellur <vbellur@redhat.com>2015-04-04 10:48:35 -0700
commit28397cae4102ac3f08576ebaf071ad92683097e8 (patch)
tree4c8be92299a951c8a28e1dc85bf2671f60da6e08 /xlators/mgmt/glusterd/src/glusterd-sm.c
parent0aebfaa349c7c68c2d59531eabae5a03a748e16a (diff)
Avoid conflict between contrib/uuid and system uuid
glusterfs relies on Linux uuid implementation, which API is incompatible with most other systems's uuid. As a result, libglusterfs has to embed contrib/uuid, which is the Linux implementation, on non Linux systems. This implementation is incompatible with systtem's built in, but the symbols have the same names. Usually this is not a problem because when we link with -lglusterfs, libc's symbols are trumped. However there is a problem when a program not linked with -lglusterfs will dlopen() glusterfs component. In such a case, libc's uuid implementation is already loaded in the calling program, and it will be used instead of libglusterfs's implementation, causing crashes. A possible workaround is to use pre-load libglusterfs in the calling program (using LD_PRELOAD on NetBSD for instance), but such a mechanism is not portable, nor is it flexible. A much better approach is to rename libglusterfs's uuid_* functions to gf_uuid_* to avoid any possible conflict. This is what this change attempts. BUG: 1206587 Change-Id: I9ccd3e13afed1c7fc18508e92c7beb0f5d49f31a Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org> Reviewed-on: http://review.gluster.org/10017 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-sm.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-sm.c b/xlators/mgmt/glusterd/src/glusterd-sm.c
index 9de701ed6bf..2ea473aeb16 100644
--- a/xlators/mgmt/glusterd/src/glusterd-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-sm.c
@@ -252,7 +252,7 @@ glusterd_ac_reverse_probe_begin (glusterd_friend_sm_event_t *event, void *ctx)
new_ev_ctx->req = NULL;
new_event->peername = gf_strdup (peerinfo->hostname);
- uuid_copy (new_event->peerid, peerinfo->uuid);
+ gf_uuid_copy (new_event->peerid, peerinfo->uuid);
new_event->ctx = new_ev_ctx;
ret = glusterd_friend_sm_inject_event (new_event);
@@ -438,7 +438,7 @@ glusterd_ac_send_friend_remove_req (glusterd_friend_sm_event_t *event,
if (!ret) {
new_event->peername = peerinfo->hostname;
- uuid_copy (new_event->peerid, peerinfo->uuid);
+ gf_uuid_copy (new_event->peerid, peerinfo->uuid);
ret = glusterd_friend_sm_inject_event (new_event);
} else {
gf_log ("glusterd", GF_LOG_ERROR,
@@ -646,7 +646,7 @@ glusterd_ac_handle_friend_remove_req (glusterd_friend_sm_event_t *event,
}
new_event->peername = gf_strdup (peerinfo->hostname);
- uuid_copy (new_event->peerid, peerinfo->uuid);
+ gf_uuid_copy (new_event->peerid, peerinfo->uuid);
ret = glusterd_friend_sm_inject_event (new_event);
if (ret) {
@@ -739,7 +739,7 @@ glusterd_ac_handle_friend_add_req (glusterd_friend_sm_event_t *event, void *ctx)
GF_ASSERT (ctx);
ev_ctx = ctx;
- uuid_copy (uuid, ev_ctx->uuid);
+ gf_uuid_copy (uuid, ev_ctx->uuid);
rcu_read_lock ();
peerinfo = glusterd_peerinfo_find (event->peerid, event->peername);
@@ -755,7 +755,7 @@ glusterd_ac_handle_friend_add_req (glusterd_friend_sm_event_t *event, void *ctx)
/* TODO: Updating within a read-critical section is also invalid
* Update properly with updater synchronization
*/
- uuid_copy (peerinfo->uuid, ev_ctx->uuid);
+ gf_uuid_copy (peerinfo->uuid, ev_ctx->uuid);
rcu_read_unlock ();
@@ -822,7 +822,7 @@ glusterd_ac_handle_friend_add_req (glusterd_friend_sm_event_t *event, void *ctx)
}
new_event->peername = gf_strdup (event->peername);
- uuid_copy (new_event->peerid, event->peerid);
+ gf_uuid_copy (new_event->peerid, event->peerid);
new_ev_ctx = GF_CALLOC (1, sizeof (*new_ev_ctx),
gf_gld_mt_friend_update_ctx_t);
@@ -831,7 +831,7 @@ glusterd_ac_handle_friend_add_req (glusterd_friend_sm_event_t *event, void *ctx)
goto out;
}
- uuid_copy (new_ev_ctx->uuid, ev_ctx->uuid);
+ gf_uuid_copy (new_ev_ctx->uuid, ev_ctx->uuid);
new_ev_ctx->hostname = gf_strdup (ev_ctx->hostname);
new_ev_ctx->op = GD_FRIEND_UPDATE_ADD;