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/dht/src/dht-rename.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/dht/src/dht-rename.c')
-rw-r--r-- | xlators/cluster/dht/src/dht-rename.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c index c8a05a3939d..7d73eb9f272 100644 --- a/xlators/cluster/dht/src/dht-rename.c +++ b/xlators/cluster/dht/src/dht-rename.c @@ -40,7 +40,7 @@ dht_rename_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == -1) { /* TODO: undo the damage */ - uuid_unparse(local->loc.inode->gfid, gfid); + gf_uuid_unparse(local->loc.inode->gfid, gfid); gf_msg (this->name, GF_LOG_INFO, op_errno, DHT_MSG_RENAME_FAILED, @@ -110,7 +110,7 @@ dht_rename_hashed_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == -1) { /* TODO: undo the damage */ - uuid_unparse(local->loc.inode->gfid, gfid); + gf_uuid_unparse(local->loc.inode->gfid, gfid); gf_msg (this->name, GF_LOG_INFO, op_errno, DHT_MSG_RENAME_FAILED, @@ -241,7 +241,7 @@ dht_rename_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == -1) { - uuid_unparse(local->loc.inode->gfid, gfid); + gf_uuid_unparse(local->loc.inode->gfid, gfid); gf_msg (this->name, GF_LOG_INFO, op_errno, DHT_MSG_OPENDIR_FAILED, "opendir on %s for %s failed,(gfid = %s) ", @@ -501,7 +501,7 @@ dht_rename_cleanup (call_frame_t *frame) DHT_MARK_FOP_INTERNAL (xattr); - uuid_unparse(local->loc.inode->gfid, gfid); + gf_uuid_unparse(local->loc.inode->gfid, gfid); if (local->linked && (dst_hashed != src_hashed) && (dst_hashed != src_cached)) { @@ -535,7 +535,7 @@ dht_rename_cleanup (call_frame_t *frame) xattr_new = dict_copy_with_ref (xattr, NULL); - if (uuid_compare (local->loc.pargfid, + if (gf_uuid_compare (local->loc.pargfid, local->loc2.pargfid) == 0) { DHT_MARKER_DONT_ACCOUNT(xattr_new); } @@ -683,7 +683,7 @@ dht_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (link_local->loc.inode) inode_unref (link_local->loc.inode); link_local->loc.inode = inode_ref (local->loc.inode); - uuid_copy (link_local->gfid, local->loc.inode->gfid); + gf_uuid_copy (link_local->gfid, local->loc.inode->gfid); dht_linkfile_create (link_frame, dht_rename_links_create_cbk, this, src_cached, dst_hashed, @@ -740,7 +740,7 @@ err: "deleting old src datafile %s @ %s", local->loc.path, src_cached->name); - if (uuid_compare (local->loc.pargfid, + if (gf_uuid_compare (local->loc.pargfid, local->loc2.pargfid) == 0) { DHT_MARKER_DONT_ACCOUNT(xattr_new); } @@ -920,7 +920,7 @@ dht_rename_linkto_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_msg_trace (this->name, 0, "link %s => %s (%s)", local->loc.path, local->loc2.path, src_cached->name); - if (uuid_compare (local->loc.pargfid, + if (gf_uuid_compare (local->loc.pargfid, local->loc2.pargfid) == 0) { DHT_MARKER_DONT_ACCOUNT(xattr); } @@ -1062,7 +1062,7 @@ dht_rename_create_links (call_frame_t *frame) gf_msg_trace (this->name, 0, "link %s => %s (%s)", local->loc.path, local->loc2.path, src_cached->name); - if (uuid_compare (local->loc.pargfid, + if (gf_uuid_compare (local->loc.pargfid, local->loc2.pargfid) == 0) { DHT_MARKER_DONT_ACCOUNT(xattr_new); } @@ -1281,7 +1281,7 @@ dht_rename (call_frame_t *frame, xlator_t *this, VALIDATE_OR_GOTO (oldloc, err); VALIDATE_OR_GOTO (newloc, err); - uuid_unparse(oldloc->inode->gfid, gfid); + gf_uuid_unparse(oldloc->inode->gfid, gfid); src_hashed = dht_subvol_get_hashed (this, oldloc); if (!src_hashed) { |