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/cluster/afr/src/afr-self-heal-name.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/cluster/afr/src/afr-self-heal-name.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-name.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-name.c b/xlators/cluster/afr/src/afr-self-heal-name.c index af635f06d52..12163298f7e 100644 --- a/xlators/cluster/afr/src/afr-self-heal-name.c +++ b/xlators/cluster/afr/src/afr-self-heal-name.c @@ -43,7 +43,7 @@ __afr_selfheal_assign_gfid (xlator_t *this, inode_t *parent, uuid_t pargfid, new_local = new_frame->local; - uuid_copy (parent->gfid, pargfid); + gf_uuid_copy (parent->gfid, pargfid); xdata = dict_new (); if (!xdata) { @@ -59,7 +59,7 @@ __afr_selfheal_assign_gfid (xlator_t *this, inode_t *parent, uuid_t pargfid, loc.parent = inode_ref (parent); loc.inode = inode_ref (inode); - uuid_copy (loc.pargfid, pargfid); + gf_uuid_copy (loc.pargfid, pargfid); loc.name = bname; if (is_gfid_absent) { @@ -121,13 +121,13 @@ __afr_selfheal_name_impunge (call_frame_t *frame, xlator_t *this, newentry = alloca0 (priv->child_count); sources = alloca0 (priv->child_count); - uuid_copy (parent->gfid, pargfid); + gf_uuid_copy (parent->gfid, pargfid); for (i = 0; i < priv->child_count; i++) { if (!replies[i].valid) continue; - if (uuid_compare (replies[i].poststat.ia_gfid, + if (gf_uuid_compare (replies[i].poststat.ia_gfid, replies[gfid_idx].poststat.ia_gfid) == 0) { sources[i] = 1; continue; @@ -159,7 +159,7 @@ __afr_selfheal_name_expunge (xlator_t *this, inode_t *parent, uuid_t pargfid, priv = this->private; loc.parent = inode_ref (parent); - uuid_copy (loc.pargfid, pargfid); + gf_uuid_copy (loc.pargfid, pargfid); loc.name = bname; loc.inode = inode_ref (inode); @@ -216,7 +216,7 @@ afr_selfheal_gfid_idx_get (xlator_t *this, struct afr_reply *replies, if (!sources[i]) continue; - if (uuid_is_null (replies[i].poststat.ia_gfid)) + if (gf_uuid_is_null (replies[i].poststat.ia_gfid)) continue; gfid_idx = i; @@ -251,12 +251,12 @@ afr_selfheal_name_need_heal_check (xlator_t *this, struct afr_reply *replies) if (replies[i].op_ret != replies[first_idx].op_ret) need_heal = _gf_true; - if (uuid_compare (replies[i].poststat.ia_gfid, + if (gf_uuid_compare (replies[i].poststat.ia_gfid, replies[first_idx].poststat.ia_gfid)) need_heal = _gf_true; if ((replies[i].op_ret == 0) && - (uuid_is_null(replies[i].poststat.ia_gfid))) + (gf_uuid_is_null(replies[i].poststat.ia_gfid))) need_heal = _gf_true; } @@ -328,7 +328,7 @@ afr_selfheal_name_gfid_mismatch_check (xlator_t *this, struct afr_reply *replies if (!replies[i].valid) continue; - if (uuid_is_null (replies[i].poststat.ia_gfid)) + if (gf_uuid_is_null (replies[i].poststat.ia_gfid)) continue; if (!gfid) { @@ -339,7 +339,7 @@ afr_selfheal_name_gfid_mismatch_check (xlator_t *this, struct afr_reply *replies if (sources[i] || source == -1) { if ((sources[gfid_idx_iter] || source == -1) && - uuid_compare (gfid, replies[i].poststat.ia_gfid)) { + gf_uuid_compare (gfid, replies[i].poststat.ia_gfid)) { gf_msg (this->name, GF_LOG_WARNING, 0, AFR_MSG_SPLIT_BRAIN, "GFID mismatch for <gfid:%s>/%s " @@ -428,7 +428,7 @@ __afr_selfheal_name_do (call_frame_t *frame, xlator_t *this, inode_t *parent, return ret; if (gfid_idx == -1) { - if (!gfid_req || uuid_is_null (gfid_req)) + if (!gfid_req || gf_uuid_is_null (gfid_req)) return -1; gfid = gfid_req; } else { @@ -654,7 +654,7 @@ afr_selfheal_name_unlocked_inspect (call_frame_t *frame, xlator_t *this, if (replies[i].op_ret != replies[first_idx].op_ret) *need_heal = _gf_true; - if (uuid_compare (replies[i].poststat.ia_gfid, + if (gf_uuid_compare (replies[i].poststat.ia_gfid, replies[first_idx].poststat.ia_gfid)) *need_heal = _gf_true; } |