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/protocol/server/src | |
| 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/protocol/server/src')
| -rw-r--r-- | xlators/protocol/server/src/server-resolve.c | 24 | ||||
| -rw-r--r-- | xlators/protocol/server/src/server-rpc-fops.c | 2 | 
2 files changed, 13 insertions, 13 deletions
diff --git a/xlators/protocol/server/src/server-resolve.c b/xlators/protocol/server/src/server-resolve.c index 9528259970a..3c3dcfeb3e5 100644 --- a/xlators/protocol/server/src/server-resolve.c +++ b/xlators/protocol/server/src/server-resolve.c @@ -135,13 +135,13 @@ resolve_gfid_cbk (call_frame_t *frame, void *cookie, xlator_t *this,          */          loc_wipe (resolve_loc); -        if (uuid_is_null (resolve->pargfid)) { +        if (gf_uuid_is_null (resolve->pargfid)) {                  inode_unref (link_inode);                  goto out;          }          resolve_loc->parent = link_inode; -        uuid_copy (resolve_loc->pargfid, resolve_loc->parent->gfid); +        gf_uuid_copy (resolve_loc->pargfid, resolve_loc->parent->gfid);          resolve_loc->name = resolve->bname; @@ -175,10 +175,10 @@ resolve_gfid (call_frame_t *frame)          resolve = state->resolve_now;          resolve_loc = &resolve->resolve_loc; -        if (!uuid_is_null (resolve->pargfid)) -                uuid_copy (resolve_loc->gfid, resolve->pargfid); -        else if (!uuid_is_null (resolve->gfid)) -                uuid_copy (resolve_loc->gfid, resolve->gfid); +        if (!gf_uuid_is_null (resolve->pargfid)) +                gf_uuid_copy (resolve_loc->gfid, resolve->pargfid); +        else if (!gf_uuid_is_null (resolve->gfid)) +                gf_uuid_copy (resolve_loc->gfid, resolve->gfid);          resolve_loc->inode = inode_new (state->itable);          ret = loc_path (resolve_loc, NULL); @@ -208,9 +208,9 @@ resolve_continue (call_frame_t *frame)          if (resolve->fd_no != -1) {                  ret = resolve_anonfd_simple (frame);                  goto out; -        } else if (!uuid_is_null (resolve->pargfid)) +        } else if (!gf_uuid_is_null (resolve->pargfid))                  ret = resolve_entry_simple (frame); -        else if (!uuid_is_null (resolve->gfid)) +        else if (!gf_uuid_is_null (resolve->gfid))                  ret = resolve_inode_simple (frame);          if (ret)                  gf_log (this->name, GF_LOG_DEBUG, @@ -256,7 +256,7 @@ resolve_entry_simple (call_frame_t *frame)          }          /* expected @parent was found from the inode cache */ -        uuid_copy (state->loc_now->pargfid, resolve->pargfid); +        gf_uuid_copy (state->loc_now->pargfid, resolve->pargfid);          state->loc_now->parent = inode_ref (parent);          state->loc_now->name = resolve->bname; @@ -355,7 +355,7 @@ resolve_inode_simple (call_frame_t *frame)          ret = 0;          state->loc_now->inode = inode_ref (inode); -        uuid_copy (state->loc_now->gfid, resolve->gfid); +        gf_uuid_copy (state->loc_now->gfid, resolve->gfid);  out:          if (inode) @@ -509,11 +509,11 @@ server_resolve (call_frame_t *frame)                  server_resolve_fd (frame); -        } else if (!uuid_is_null (resolve->pargfid)) { +        } else if (!gf_uuid_is_null (resolve->pargfid)) {                  server_resolve_entry (frame); -        } else if (!uuid_is_null (resolve->gfid)) { +        } else if (!gf_uuid_is_null (resolve->gfid)) {                  server_resolve_inode (frame); diff --git a/xlators/protocol/server/src/server-rpc-fops.c b/xlators/protocol/server/src/server-rpc-fops.c index 024cfc0b8d6..c69b17fd255 100644 --- a/xlators/protocol/server/src/server-rpc-fops.c +++ b/xlators/protocol/server/src/server-rpc-fops.c @@ -116,7 +116,7 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,                  /* we just looked up root ("/") */                  stbuf->ia_ino = 1;                  rootgfid[15]  = 1; -                uuid_copy (stbuf->ia_gfid, rootgfid); +                gf_uuid_copy (stbuf->ia_gfid, rootgfid);                  if (inode->ia_type == 0)                          inode->ia_type = stbuf->ia_type;          }  | 
