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-common.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-common.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 58c33e20d36..efe8f8bc435 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -680,7 +680,7 @@ afr_inode_refresh_subvol (call_frame_t *frame, xlator_t *this, int i, priv = this->private; loc.inode = inode; - uuid_copy (loc.gfid, inode->gfid); + gf_uuid_copy (loc.gfid, inode->gfid); STACK_WIND_COOKIE (frame, afr_inode_refresh_subvol_cbk, (void *) (long) i, priv->children[i], @@ -850,7 +850,7 @@ afr_hash_child (inode_t *inode, int32_t child_count, int hashmode) } if (inode) { - uuid_copy (gfid_copy, inode->gfid); + gf_uuid_copy (gfid_copy, inode->gfid); } if (hashmode > 1 && inode->ia_type != IA_IFDIR) { @@ -1379,7 +1379,7 @@ afr_lookup_done (call_frame_t *frame, xlator_t *this) if (read_subvol == -1 || !readable[read_subvol]) { read_subvol = i; - uuid_copy (read_gfid, replies[i].poststat.ia_gfid); + gf_uuid_copy (read_gfid, replies[i].poststat.ia_gfid); local->op_ret = 0; } } @@ -1398,7 +1398,7 @@ afr_lookup_done (call_frame_t *frame, xlator_t *this) continue; } - if (!uuid_compare (replies[i].poststat.ia_gfid, read_gfid)) + if (!gf_uuid_compare (replies[i].poststat.ia_gfid, read_gfid)) continue; can_interpret = _gf_false; @@ -1637,7 +1637,7 @@ afr_can_start_metadata_self_heal(call_frame_t *frame, xlator_t *this) continue; } - if (uuid_compare (stbuf.ia_gfid, replies[i].poststat.ia_gfid)) { + if (gf_uuid_compare (stbuf.ia_gfid, replies[i].poststat.ia_gfid)) { start = _gf_false; break; } @@ -1753,7 +1753,7 @@ afr_lookup_entry_heal (call_frame_t *frame, xlator_t *this) break; } - if (uuid_compare (replies[i].poststat.ia_gfid, + if (gf_uuid_compare (replies[i].poststat.ia_gfid, replies[first].poststat.ia_gfid)) { need_heal = _gf_true; break; @@ -2004,7 +2004,7 @@ afr_discover (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req allocate one for us */ local->xattr_req = dict_ref (xattr_req); - if (uuid_is_null (loc->inode->gfid)) { + if (gf_uuid_is_null (loc->inode->gfid)) { afr_discover_do (frame, this, 0); return 0; } @@ -2115,7 +2115,7 @@ afr_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req) void *gfid_req = NULL; int ret = 0; - if (!loc->parent && uuid_is_null (loc->pargfid)) { + if (!loc->parent && gf_uuid_is_null (loc->pargfid)) { if (xattr_req) dict_del (xattr_req, "gfid-req"); afr_discover (frame, this, loc, xattr_req); @@ -2149,7 +2149,7 @@ afr_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req) allocate one for us */ ret = dict_get_ptr (xattr_req, "gfid-req", &gfid_req); if (ret == 0) { - uuid_copy (local->cont.lookup.gfid_req, gfid_req); + gf_uuid_copy (local->cont.lookup.gfid_req, gfid_req); dict_del (xattr_req, "gfid-req"); } local->xattr_req = dict_ref (xattr_req); |