summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2011-10-14 18:28:27 +0530
committerVijay Bellur <vijay@gluster.com>2011-10-14 06:04:54 -0700
commitfed29e0ae382ef24f4d3dff3623daefc57dab6ce (patch)
tree17fdeb160f819688720273ce0e2d7410b7ea8d61
parent3edfb0c492d73b349d83f904c42e6edfb9678965 (diff)
cluster/afr: Prevent truncation of mask uint64_t->gf_boolean_t
Change-Id: If67f726f21b713fa9312dc499a1aca4cb00f71de BUG: 3682 Reviewed-on: http://review.gluster.com/589 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
-rw-r--r--xlators/cluster/afr/src/afr-common.c12
-rw-r--r--xlators/cluster/afr/src/afr.h2
2 files changed, 9 insertions, 5 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 7c38d65ed3b..e6b0881fc9d 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -210,11 +210,15 @@ afr_inode_get_ctx (xlator_t *this, inode_t *inode, afr_inode_params_t *params)
fresh_children[i] = ctx->fresh_children[i];
break;
case AFR_INODE_GET_OPENDIR_DONE:
- params->u.value = ctx->masks &
- AFR_ICTX_OPENDIR_DONE_MASK;
+ params->u.value = _gf_false;
+ if (ctx->masks & AFR_ICTX_OPENDIR_DONE_MASK)
+ params->u.value = _gf_true;
break;
case AFR_INODE_GET_SPLIT_BRAIN:
- params->u.value = ctx->masks & AFR_ICTX_SPLIT_BRAIN_MASK;
+ params->u.value = _gf_false;
+ if (ctx->masks & AFR_ICTX_SPLIT_BRAIN_MASK)
+ params->u.value = _gf_true;
+ ;
break;
default:
GF_ASSERT (0);
@@ -225,7 +229,7 @@ unlock:
UNLOCK (&inode->lock);
}
-uint64_t
+gf_boolean_t
afr_is_split_brain (xlator_t *this, inode_t *inode)
{
afr_inode_params_t params = {0};
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
index 7320c8d7cf3..1f6481e109c 100644
--- a/xlators/cluster/afr/src/afr.h
+++ b/xlators/cluster/afr/src/afr.h
@@ -852,7 +852,7 @@ afr_local_cleanup (afr_local_t *local, xlator_t *this);
int
afr_frame_return (call_frame_t *frame);
-uint64_t
+gf_boolean_t
afr_is_split_brain (xlator_t *this, inode_t *inode);
void