summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libglusterfs/src/compat.c4
-rw-r--r--libglusterfs/src/inode.c11
-rw-r--r--libglusterfs/src/inode.h3
-rw-r--r--xlators/cluster/dht/src/dht-common.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c2
-rw-r--r--xlators/storage/posix/src/posix.c2
6 files changed, 13 insertions, 11 deletions
diff --git a/libglusterfs/src/compat.c b/libglusterfs/src/compat.c
index e6c7f41e..20e165a7 100644
--- a/libglusterfs/src/compat.c
+++ b/libglusterfs/src/compat.c
@@ -121,7 +121,7 @@ make_export_path (const char *real_path, char **path)
ret = solaris_getxattr ("/", GFID_XATTR_KEY, gfid, 16);
/* Return value of getxattr */
if (ret == 16) {
- if (!__is_root_gfid (gfid)){
+ if (__is_root_gfid (gfid)){
strcat (export_path, "/");
ret = 0;
goto done;
@@ -135,7 +135,7 @@ make_export_path (const char *real_path, char **path)
strcat (export_path, dup);
ret = solaris_getxattr (export_path, GFID_XATTR_KEY, gfid, 16);
if (ret == 16) {
- if (!__is_root_gfid (gfid)) {
+ if (__is_root_gfid (gfid)) {
ret = 0;
goto done;
}
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index 117b977b..3239878b 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -653,18 +653,19 @@ inode_grep (inode_table_t *table, inode_t *parent, const char *name)
return inode;
}
-int
+/* return 1 if gfid is of root, 0 if not */
+gf_boolean_t
__is_root_gfid (uuid_t gfid)
{
uuid_t root;
- int ret;
memset (root, 0, 16);
root[15] = 1;
- ret = uuid_compare (gfid, root);
+ if (uuid_compare (gfid, root) == 0)
+ return _gf_true;
- return ret;
+ return _gf_false;
}
@@ -680,7 +681,7 @@ __inode_find (inode_table_t *table, uuid_t gfid)
goto out;
}
- if (__is_root_gfid (gfid) == 0)
+ if (__is_root_gfid (gfid))
return table->root;
hash = hash_gfid (gfid, 65536);
diff --git a/libglusterfs/src/inode.h b/libglusterfs/src/inode.h
index b1d9b374..a632ff5e 100644
--- a/libglusterfs/src/inode.h
+++ b/libglusterfs/src/inode.h
@@ -182,6 +182,7 @@ int
inode_ctx_del2 (inode_t *inode, xlator_t *xlator, uint64_t *value1,
uint64_t *value2);
-int
+gf_boolean_t
__is_root_gfid (uuid_t gfid);
+
#endif /* _INODE_H */
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 6cf1d0c8..63e505c8 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -1829,7 +1829,7 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
tmp = dict_get (xattr, "decommission-brick");
if (tmp) {
/* This operation should happen only on '/' */
- if (__is_root_gfid (loc->inode->gfid) != 0) {
+ if (!__is_root_gfid (loc->inode->gfid)) {
op_errno = ENOTSUP;
goto err;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 9ecd78df..0b399da0 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -3644,7 +3644,7 @@ check_xattr:
other than that of root '/' */
ret = sys_lgetxattr (path, "trusted.gfid", gfid, 16);
if (ret == 16) {
- if (__is_root_gfid (gfid) != 0) {
+ if (!__is_root_gfid (gfid)) {
gf_log (THIS->name, GF_LOG_WARNING,
"%s: gfid (%s) is not that of glusterfs '/' ",
path, uuid_utoa (gfid));
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 6a623c0a..ab512af1 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -3924,7 +3924,7 @@ init (xlator_t *this)
other than that of root '/' */
ret = sys_lgetxattr (dir_data->data, "trusted.gfid", gfid, 16);
if (ret == 16) {
- if (__is_root_gfid (gfid) != 0) {
+ if (!__is_root_gfid (gfid)) {
gf_log (this->name, GF_LOG_WARNING,
"%s: gfid (%s) is not that of glusterfs '/' ",
dir_data->data, uuid_utoa (gfid));