diff options
author | Emmanuel Dreyfus <manu@netbsd.org> | 2015-04-02 15:51:30 +0200 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-04-04 10:48:35 -0700 |
commit | 28397cae4102ac3f08576ebaf071ad92683097e8 (patch) | |
tree | 4c8be92299a951c8a28e1dc85bf2671f60da6e08 /xlators/mgmt/glusterd/src/glusterd-rpc-ops.c | |
parent | 0aebfaa349c7c68c2d59531eabae5a03a748e16a (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-rpc-ops.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rpc-ops.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c index 655f4b07f56..59b0e5f072e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c @@ -292,7 +292,7 @@ __glusterd_probe_cbk (struct rpc_req *req, struct iovec *iov, * command was used to begin the probe process. */ if ((conf->op_version >= GD_OP_VERSION_3_6_0) && - (uuid_compare (rsp.uuid, peerinfo->uuid) == 0)) { + (gf_uuid_compare (rsp.uuid, peerinfo->uuid) == 0)) { ctx = ((call_frame_t *)myframe)->local; /* Presence of ctx->req implies this probe was started by a cli * probe command @@ -322,7 +322,7 @@ __glusterd_probe_cbk (struct rpc_req *req, struct iovec *iov, &event); if (!ret) { event->peername = gf_strdup (peerinfo->hostname); - uuid_copy (event->peerid, peerinfo->uuid); + gf_uuid_copy (event->peerid, peerinfo->uuid); ret = glusterd_friend_sm_inject_event (event); } @@ -379,7 +379,7 @@ reply: } cont: - uuid_copy (peerinfo->uuid, rsp.uuid); + gf_uuid_copy (peerinfo->uuid, rsp.uuid); ret = glusterd_friend_sm_new_event (GD_FRIEND_EVENT_INIT_FRIEND_REQ, &event); @@ -391,7 +391,7 @@ cont: } event->peername = gf_strdup (peerinfo->hostname); - uuid_copy (event->peerid, peerinfo->uuid); + gf_uuid_copy (event->peerid, peerinfo->uuid); event->ctx = ((call_frame_t *)myframe)->local; ((call_frame_t *)myframe)->local = NULL; @@ -492,11 +492,11 @@ __glusterd_friend_add_cbk (struct rpc_req * req, struct iovec *iov, goto unlock; } - uuid_copy (ev_ctx->uuid, rsp.uuid); + gf_uuid_copy (ev_ctx->uuid, rsp.uuid); ev_ctx->hostname = gf_strdup (rsp.hostname); event->peername = gf_strdup (peerinfo->hostname); - uuid_copy (event->peerid, peerinfo->uuid); + gf_uuid_copy (event->peerid, peerinfo->uuid); event->ctx = ev_ctx; ret = glusterd_friend_sm_inject_event (event); @@ -596,7 +596,7 @@ inject: goto unlock; } event->peername = gf_strdup (peerinfo->hostname); - uuid_copy (event->peerid, peerinfo->uuid); + gf_uuid_copy (event->peerid, peerinfo->uuid); ret = glusterd_friend_sm_inject_event (event); @@ -1408,7 +1408,7 @@ glusterd_rpc_probe (call_frame_t *frame, xlator_t *this, if (ret) goto out; - uuid_copy (req.uuid, MY_UUID); + gf_uuid_copy (req.uuid, MY_UUID); req.hostname = gf_strdup (hostname); req.port = port; @@ -1457,7 +1457,7 @@ glusterd_rpc_friend_add (call_frame_t *frame, xlator_t *this, goto out; } - uuid_copy (req.uuid, MY_UUID); + gf_uuid_copy (req.uuid, MY_UUID); req.hostname = gf_strdup (peerinfo->hostname); req.port = peerinfo->port; @@ -1542,7 +1542,7 @@ glusterd_rpc_friend_remove (call_frame_t *frame, xlator_t *this, goto out; } - uuid_copy (req.uuid, MY_UUID); + gf_uuid_copy (req.uuid, MY_UUID); req.hostname = gf_strdup (peerinfo->hostname); req.port = peerinfo->port; @@ -1590,7 +1590,7 @@ glusterd_rpc_friend_update (call_frame_t *frame, xlator_t *this, if (ret) goto out; - uuid_copy (req.uuid, MY_UUID); + gf_uuid_copy (req.uuid, MY_UUID); dummy_frame = create_frame (this, this->ctx->pool); ret = glusterd_submit_request (peerinfo->rpc, &req, dummy_frame, @@ -1686,7 +1686,7 @@ glusterd_mgmt_v3_lock_peers (call_frame_t *frame, xlator_t *this, } else { gf_log (this->name, GF_LOG_DEBUG, "Transaction_id = %s", uuid_utoa (*txn_id)); - uuid_copy (req.txn_id, *txn_id); + gf_uuid_copy (req.txn_id, *txn_id); } if (!frame) @@ -1701,7 +1701,7 @@ glusterd_mgmt_v3_lock_peers (call_frame_t *frame, xlator_t *this, ret = -1; goto out; } - uuid_copy (frame->cookie, req.txn_id); + gf_uuid_copy (frame->cookie, req.txn_id); ret = glusterd_submit_request (peerinfo->rpc, &req, frame, peerinfo->mgmt_v3, @@ -1759,7 +1759,7 @@ glusterd_mgmt_v3_unlock_peers (call_frame_t *frame, xlator_t *this, } else { gf_log (this->name, GF_LOG_DEBUG, "Transaction_id = %s", uuid_utoa (*txn_id)); - uuid_copy (req.txn_id, *txn_id); + gf_uuid_copy (req.txn_id, *txn_id); } if (!frame) @@ -1774,7 +1774,7 @@ glusterd_mgmt_v3_unlock_peers (call_frame_t *frame, xlator_t *this, ret = -1; goto out; } - uuid_copy (frame->cookie, req.txn_id); + gf_uuid_copy (frame->cookie, req.txn_id); ret = glusterd_submit_request (peerinfo->rpc, &req, frame, peerinfo->mgmt_v3, |