summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.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-snapshot-utils.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-snapshot-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
index 404866dff14..8819f69c594 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
@@ -177,7 +177,7 @@ glusterd_snap_volinfo_restore (dict_t *dict, dict_t *rsp_dict,
/* If the brick is not of this peer, or snapshot is missed *
* for the brick do not replace the xattr for it */
- if ((!uuid_compare (brickinfo->uuid, MY_UUID)) &&
+ if ((!gf_uuid_compare (brickinfo->uuid, MY_UUID)) &&
(brickinfo->snap_status != -1)) {
/* We need to replace the volume id of all the bricks
* to the volume id of the origin volume. new_volinfo
@@ -264,14 +264,14 @@ glusterd_snap_volinfo_find_by_volume_id (uuid_t volume_id,
GF_ASSERT (priv);
GF_ASSERT (volinfo);
- if (uuid_is_null(volume_id)) {
+ if (gf_uuid_is_null(volume_id)) {
gf_log (this->name, GF_LOG_WARNING, "Volume UUID is NULL");
goto out;
}
cds_list_for_each_entry (snap, &priv->snapshots, snap_list) {
cds_list_for_each_entry (voliter, &snap->volumes, vol_list) {
- if (uuid_compare (volume_id, voliter->volume_id))
+ if (gf_uuid_compare (volume_id, voliter->volume_id))
continue;
*volinfo = voliter;
ret = 0;
@@ -606,7 +606,7 @@ glusterd_add_snap_to_dict (glusterd_snap_t *snap, dict_t *peer_data,
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)) {
host_bricks = _gf_true;
break;
}
@@ -856,7 +856,7 @@ gd_import_volume_snap_details (dict_t *dict, glusterd_volinfo_t *volinfo,
goto out;
}
- uuid_parse (restored_snap, volinfo->restored_from_snap);
+ gf_uuid_parse (restored_snap, volinfo->restored_from_snap);
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s.snap-max-hard-limit", prefix);
@@ -923,7 +923,7 @@ glusterd_perform_missed_op (glusterd_snap_t *snap, int32_t op)
}
volinfo->version--;
- uuid_copy (volinfo->restored_from_snap, null_uuid);
+ gf_uuid_copy (volinfo->restored_from_snap, null_uuid);
/* gd_restore_snap_volume() uses the dict and volcount
* to fetch snap brick info from other nodes, which were
@@ -945,7 +945,7 @@ glusterd_perform_missed_op (glusterd_snap_t *snap, int32_t op)
/* Restore is successful therefore delete the original
* volume's volinfo. If the volinfo is already restored
* then we should delete the backend LVMs */
- if (!uuid_is_null (volinfo->restored_from_snap)) {
+ if (!gf_uuid_is_null (volinfo->restored_from_snap)) {
ret = glusterd_lvm_snapshot_remove (dict,
volinfo);
if (ret) {
@@ -1023,7 +1023,7 @@ glusterd_perform_missed_snap_ops ()
continue;
/* Find the snap id */
- uuid_parse (missed_snapinfo->snap_uuid, snap_uuid);
+ gf_uuid_parse (missed_snapinfo->snap_uuid, snap_uuid);
snap = NULL;
snap = glusterd_find_snap_by_id (snap_uuid);
if (!snap) {
@@ -1157,8 +1157,8 @@ glusterd_is_peer_snap_conflicting (char *peer_snap_name, char *peer_snap_id,
*snap = glusterd_find_snap_by_name (peer_snap_name);
if (*snap) {
- uuid_parse (peer_snap_id, peer_snap_uuid);
- if (!uuid_compare (peer_snap_uuid, (*snap)->snap_id)) {
+ gf_uuid_parse (peer_snap_id, peer_snap_uuid);
+ if (!gf_uuid_compare (peer_snap_uuid, (*snap)->snap_id)) {
/* Current node contains the same snap having
* the same snapname and snap_id
*/
@@ -1201,7 +1201,7 @@ glusterd_are_snap_bricks_local (glusterd_snap_t *snap)
cds_list_for_each_entry (volinfo, &snap->volumes, vol_list) {
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)) {
is_local = _gf_true;
goto out;
}
@@ -1377,7 +1377,7 @@ glusterd_import_friend_snap (dict_t *peer_data, int32_t snap_count,
}
strcpy (snap->snapname, peer_snap_name);
- uuid_parse (peer_snap_id, snap->snap_id);
+ gf_uuid_parse (peer_snap_id, snap->snap_id);
snprintf (buf, sizeof(buf), "%s.snapid", prefix);
ret = dict_get_str (peer_data, buf, &snap->description);