summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-op-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-op-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-op-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 3e88a131f82..75943267e90 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -161,9 +161,9 @@ glusterd_generate_txn_id (dict_t *dict, uuid_t **txn_id)
goto out;
if (priv->op_version < GD_OP_VERSION_3_6_0)
- uuid_copy (**txn_id, priv->global_txn_id);
+ gf_uuid_copy (**txn_id, priv->global_txn_id);
else
- uuid_generate (**txn_id);
+ gf_uuid_generate (**txn_id);
ret = dict_set_bin (dict, "transaction_id",
*txn_id, sizeof (**txn_id));
@@ -979,7 +979,7 @@ glusterd_op_stage_set_volume (dict_t *dict, char **op_errstr)
list_for_each_entry (brickinfo, &volinfo->bricks,
brick_list) {
/* Check for local brick */
- if (!uuid_compare (brickinfo->uuid, MY_UUID)) {
+ if (!gf_uuid_compare (brickinfo->uuid, MY_UUID)) {
trash_path = gf_strdup (brickinfo->path);
strcat(trash_path, "/");
strcat(trash_path, value);
@@ -2612,7 +2612,7 @@ glusterd_aggregate_task_status (dict_t *rsp_dict, glusterd_volinfo_t *volinfo)
this = THIS;
GF_ASSERT (this);
- if (!uuid_is_null (volinfo->rebal.rebalance_id)) {
+ if (!gf_uuid_is_null (volinfo->rebal.rebalance_id)) {
ret = _add_task_to_dict (rsp_dict, volinfo, volinfo->rebal.op,
tasks);
if (ret) {
@@ -2623,7 +2623,7 @@ glusterd_aggregate_task_status (dict_t *rsp_dict, glusterd_volinfo_t *volinfo)
tasks++;
}
- if (!uuid_is_null (volinfo->rep_brick.rb_id)) {
+ if (!gf_uuid_is_null (volinfo->rep_brick.rb_id)) {
ret = _add_task_to_dict (rsp_dict, volinfo, GD_OP_REPLACE_BRICK,
tasks);
if (ret) {
@@ -2752,7 +2752,7 @@ glusterd_op_status_volume (dict_t *dict, char **op_errstr,
if (ret)
goto out;
- if (uuid_compare (brickinfo->uuid, MY_UUID))
+ if (gf_uuid_compare (brickinfo->uuid, MY_UUID))
goto out;
glusterd_add_brick_to_dict (volinfo, brickinfo, rsp_dict,
@@ -2771,7 +2771,7 @@ glusterd_op_status_volume (dict_t *dict, char **op_errstr,
cds_list_for_each_entry (brickinfo, &volinfo->bricks,
brick_list) {
brick_index++;
- if (uuid_compare (brickinfo->uuid, MY_UUID))
+ if (gf_uuid_compare (brickinfo->uuid, MY_UUID))
continue;
glusterd_add_brick_to_dict (volinfo, brickinfo,
@@ -3649,7 +3649,7 @@ glusterd_op_start_rb_timer (dict_t *dict, uuid_t *txn_id)
if (!rb_txn_id)
goto out;
- uuid_copy (*rb_txn_id, *txn_id);
+ gf_uuid_copy (*rb_txn_id, *txn_id);
timeout.tv_sec = 5;
timeout.tv_nsec = 0;
@@ -3712,7 +3712,7 @@ glusterd_op_volume_dict_uuid_to_hostname (dict_t *dict, const char *key_fmt,
gf_log (this->name, GF_LOG_DEBUG, "Got uuid %s",
uuid_str);
- ret = uuid_parse (uuid_str, uuid);
+ ret = gf_uuid_parse (uuid_str, uuid);
/* if parsing fails don't error out
* let the original value be retained
*/
@@ -4636,7 +4636,7 @@ glusterd_op_ac_stage_op (glusterd_op_sm_event_t *event, void *ctx)
txn_id = GF_CALLOC (1, sizeof(uuid_t), gf_common_mt_uuid_t);
if (txn_id)
- uuid_copy (*txn_id, event->txn_id);
+ gf_uuid_copy (*txn_id, event->txn_id);
else {
ret = -1;
goto out;
@@ -4748,7 +4748,7 @@ glusterd_op_ac_commit_op (glusterd_op_sm_event_t *event, void *ctx)
txn_id = GF_CALLOC (1, sizeof(uuid_t), gf_common_mt_uuid_t);
if (txn_id)
- uuid_copy (*txn_id, event->txn_id);
+ gf_uuid_copy (*txn_id, event->txn_id);
else {
ret = -1;
goto out;
@@ -5445,7 +5445,7 @@ get_replica_index_for_per_replica_cmd (glusterd_volinfo_t *volinfo,
replica_count = volinfo->replica_count;
cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
- if (uuid_is_null (brickinfo->uuid))
+ if (gf_uuid_is_null (brickinfo->uuid))
(void)glusterd_resolve_brick (brickinfo);
if (!strcmp (brickinfo->path, path) &&
!strcmp (brickinfo->hostname, hostname)) {
@@ -5483,10 +5483,10 @@ _select_hxlator_with_matching_brick (xlator_t *this,
hxl_children = _get_hxl_children_count (volinfo);
cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
- if (uuid_is_null (brickinfo->uuid))
+ if (gf_uuid_is_null (brickinfo->uuid))
(void)glusterd_resolve_brick (brickinfo);
- if (!uuid_compare (MY_UUID, brickinfo->uuid)) {
+ if (!gf_uuid_compare (MY_UUID, brickinfo->uuid)) {
_add_hxlator_to_dict (dict, volinfo,
(index - 1)/hxl_children, 0);
return 1;
@@ -5512,10 +5512,10 @@ _select_hxlators_with_local_bricks (xlator_t *this, glusterd_volinfo_t *volinfo,
hxl_children = _get_hxl_children_count (volinfo);
cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
- if (uuid_is_null (brickinfo->uuid))
+ if (gf_uuid_is_null (brickinfo->uuid))
(void)glusterd_resolve_brick (brickinfo);
- if (!uuid_compare (MY_UUID, brickinfo->uuid))
+ if (!gf_uuid_compare (MY_UUID, brickinfo->uuid))
add = _gf_true;
if (index % hxl_children == 0) {
@@ -5554,20 +5554,20 @@ _select_hxlators_for_full_self_heal (xlator_t *this,
}
cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
- if (uuid_is_null (brickinfo->uuid))
+ if (gf_uuid_is_null (brickinfo->uuid))
(void)glusterd_resolve_brick (brickinfo);
- if (uuid_compare (brickinfo->uuid, candidate) > 0)
- uuid_copy (candidate, brickinfo->uuid);
+ if (gf_uuid_compare (brickinfo->uuid, candidate) > 0)
+ gf_uuid_copy (candidate, brickinfo->uuid);
if (index % hxl_children == 0) {
- if (!uuid_compare (MY_UUID, candidate)) {
+ if (!gf_uuid_compare (MY_UUID, candidate)) {
_add_hxlator_to_dict (dict, volinfo,
(index-1)/hxl_children,
hxlator_count);
hxlator_count++;
}
- uuid_clear (candidate);
+ gf_uuid_clear (candidate);
}
index++;
@@ -5606,7 +5606,7 @@ glusterd_bricks_select_snap (dict_t *dict, char **op_errstr,
cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
brick_index++;
- if (uuid_compare (brickinfo->uuid, MY_UUID) ||
+ if (gf_uuid_compare (brickinfo->uuid, MY_UUID) ||
!glusterd_is_brick_started (brickinfo)) {
continue;
}
@@ -5658,10 +5658,10 @@ fill_shd_status_for_local_bricks (dict_t *dict, glusterd_volinfo_t *volinfo,
}
cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
- if (uuid_is_null (brickinfo->uuid))
+ if (gf_uuid_is_null (brickinfo->uuid))
(void)glusterd_resolve_brick (brickinfo);
- if (uuid_compare (MY_UUID, brickinfo->uuid)) {
+ if (gf_uuid_compare (MY_UUID, brickinfo->uuid)) {
index++;
continue;
}
@@ -5950,7 +5950,7 @@ glusterd_bricks_select_status_volume (dict_t *dict, char **op_errstr,
if (ret)
goto out;
- if (uuid_compare (brickinfo->uuid, MY_UUID)||
+ if (gf_uuid_compare (brickinfo->uuid, MY_UUID)||
!glusterd_is_brick_started (brickinfo))
goto out;
@@ -6049,7 +6049,7 @@ glusterd_bricks_select_status_volume (dict_t *dict, char **op_errstr,
cds_list_for_each_entry (brickinfo, &volinfo->bricks,
brick_list) {
brick_index++;
- if (uuid_compare (brickinfo->uuid, MY_UUID) ||
+ if (gf_uuid_compare (brickinfo->uuid, MY_UUID) ||
!glusterd_is_brick_started (brickinfo)) {
continue;
}
@@ -6101,7 +6101,7 @@ glusterd_bricks_select_barrier (dict_t *dict, struct cds_list_head *selected)
}
cds_list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) {
- if (uuid_compare (brickinfo->uuid, MY_UUID) ||
+ if (gf_uuid_compare (brickinfo->uuid, MY_UUID) ||
!glusterd_is_brick_started (brickinfo)) {
continue;
}
@@ -6143,7 +6143,7 @@ glusterd_op_ac_send_brick_op (glusterd_op_sm_event_t *event, void *ctx)
gf_gld_mt_op_allack_ctx_t);
op = glusterd_op_get_op ();
req_ctx->op = op;
- uuid_copy (req_ctx->uuid, MY_UUID);
+ gf_uuid_copy (req_ctx->uuid, MY_UUID);
ret = glusterd_op_build_payload (&req_ctx->dict, &op_errstr,
NULL);
if (ret) {
@@ -6618,7 +6618,7 @@ glusterd_op_sm_inject_event (glusterd_op_sm_event_type_t event_type,
event->ctx = ctx;
if (txn_id)
- uuid_copy (event->txn_id, *txn_id);
+ gf_uuid_copy (event->txn_id, *txn_id);
gf_log (THIS->name, GF_LOG_DEBUG, "Enqueue event: '%s'",
glusterd_op_sm_event_name_get (event->event));