From 28397cae4102ac3f08576ebaf071ad92683097e8 Mon Sep 17 00:00:00 2001 From: Emmanuel Dreyfus Date: Thu, 2 Apr 2015 15:51:30 +0200 Subject: 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 Reviewed-on: http://review.gluster.org/10017 Tested-by: Gluster Build System Reviewed-by: Niels de Vos --- xlators/mgmt/glusterd/src/glusterd-mgmt.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-mgmt.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c index 8cd2f47fd31..2a34c78b35b 100644 --- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c +++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c @@ -318,7 +318,7 @@ gd_mgmt_v3_lock_cbk_fn (struct rpc_req *req, struct iovec *iov, if (ret < 0) goto out; - uuid_copy (args->uuid, rsp.uuid); + gf_uuid_copy (args->uuid, rsp.uuid); op_ret = rsp.op_ret; op_errno = rsp.op_errno; @@ -365,7 +365,7 @@ gd_mgmt_v3_lock (glusterd_op_t op, dict_t *op_ctx, if (ret) goto out; - uuid_copy (req.uuid, my_uuid); + gf_uuid_copy (req.uuid, my_uuid); req.op = op; synclock_unlock (&conf->big_lock); @@ -545,7 +545,7 @@ gd_mgmt_v3_pre_validate_cbk_fn (struct rpc_req *req, struct iovec *iov, } } - uuid_copy (args->uuid, rsp.uuid); + gf_uuid_copy (args->uuid, rsp.uuid); pthread_mutex_lock (&args->lock_dict); { ret = glusterd_pre_validate_aggr_rsp_dict (rsp.op, args->dict, @@ -615,7 +615,7 @@ gd_mgmt_v3_pre_validate_req (glusterd_op_t op, dict_t *op_ctx, if (ret) goto out; - uuid_copy (req.uuid, my_uuid); + gf_uuid_copy (req.uuid, my_uuid); req.op = op; synclock_unlock (&conf->big_lock); @@ -796,7 +796,7 @@ gd_mgmt_v3_brick_op_cbk_fn (struct rpc_req *req, struct iovec *iov, if (ret < 0) goto out; - uuid_copy (args->uuid, rsp.uuid); + gf_uuid_copy (args->uuid, rsp.uuid); op_ret = rsp.op_ret; op_errno = rsp.op_errno; @@ -848,7 +848,7 @@ gd_mgmt_v3_brick_op_req (glusterd_op_t op, dict_t *op_ctx, if (ret) goto out; - uuid_copy (req.uuid, my_uuid); + gf_uuid_copy (req.uuid, my_uuid); req.op = op; synclock_unlock (&conf->big_lock); @@ -1000,7 +1000,7 @@ gd_mgmt_v3_commit_cbk_fn (struct rpc_req *req, struct iovec *iov, } } - uuid_copy (args->uuid, rsp.uuid); + gf_uuid_copy (args->uuid, rsp.uuid); pthread_mutex_lock (&args->lock_dict); { ret = glusterd_syncop_aggr_rsp_dict (rsp.op, args->dict, @@ -1067,7 +1067,7 @@ gd_mgmt_v3_commit_req (glusterd_op_t op, dict_t *op_ctx, if (ret) goto out; - uuid_copy (req.uuid, my_uuid); + gf_uuid_copy (req.uuid, my_uuid); req.op = op; synclock_unlock (&conf->big_lock); @@ -1213,7 +1213,7 @@ gd_mgmt_v3_post_validate_cbk_fn (struct rpc_req *req, struct iovec *iov, if (ret < 0) goto out; - uuid_copy (args->uuid, rsp.uuid); + gf_uuid_copy (args->uuid, rsp.uuid); op_ret = rsp.op_ret; op_errno = rsp.op_errno; @@ -1263,7 +1263,7 @@ gd_mgmt_v3_post_validate_req (glusterd_op_t op, int32_t op_ret, dict_t *op_ctx, if (ret) goto out; - uuid_copy (req.uuid, my_uuid); + gf_uuid_copy (req.uuid, my_uuid); req.op = op; req.op_ret = op_ret; synclock_unlock (&conf->big_lock); @@ -1404,7 +1404,7 @@ gd_mgmt_v3_unlock_cbk_fn (struct rpc_req *req, struct iovec *iov, if (ret < 0) goto out; - uuid_copy (args->uuid, rsp.uuid); + gf_uuid_copy (args->uuid, rsp.uuid); op_ret = rsp.op_ret; op_errno = rsp.op_errno; @@ -1451,7 +1451,7 @@ gd_mgmt_v3_unlock (glusterd_op_t op, dict_t *op_ctx, if (ret) goto out; - uuid_copy (req.uuid, my_uuid); + gf_uuid_copy (req.uuid, my_uuid); req.op = op; synclock_unlock (&conf->big_lock); @@ -1566,7 +1566,7 @@ glusterd_mgmt_v3_initiate_all_phases (rpcsvc_request_t *req, glusterd_op_t op, goto out; } - uuid_copy (*originator_uuid, MY_UUID); + gf_uuid_copy (*originator_uuid, MY_UUID); ret = dict_set_bin (dict, "originator_uuid", originator_uuid, sizeof (uuid_t)); if (ret) { @@ -1786,7 +1786,7 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op, goto out; } - uuid_copy (*originator_uuid, MY_UUID); + gf_uuid_copy (*originator_uuid, MY_UUID); ret = dict_set_bin (dict, "originator_uuid", originator_uuid, sizeof (uuid_t)); if (ret) { -- cgit