diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2018-12-02 15:35:09 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-12-17 17:19:00 +0000 |
commit | c228f0c2d94c028619088c07b66f88488f7c3335 (patch) | |
tree | c312f100b984ae36ec2d4e865194743a47f44769 /xlators/cluster/afr/src/afr-common.c | |
parent | bdcb2d8497d77ff28cb031ae3992eb7ea0c90486 (diff) |
Don't depend on string options to be valid always
updates bz#1650403
Change-Id: Ib5a11e691599ce4bd93c1ed5aca6060592893961
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-common.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 5656cec4226..40740814103 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -1156,18 +1156,12 @@ ret: } gf_boolean_t -afr_selfheal_enabled(xlator_t *this) +afr_selfheal_enabled(const xlator_t *this) { - afr_private_t *priv = NULL; - gf_boolean_t data = _gf_false; - int ret = 0; - - priv = this->private; - - ret = gf_string2boolean(priv->data_self_heal, &data); - GF_ASSERT(!ret); + const afr_private_t *priv = this->private; - return data || priv->metadata_self_heal || priv->entry_self_heal; + return priv->data_self_heal || priv->metadata_self_heal || + priv->entry_self_heal; } int @@ -4876,7 +4870,7 @@ afr_priv_dump(xlator_t *this) sprintf(key, "child_latency[%d]", i); gf_proc_dump_write(key, "%" PRId64, priv->child_latency[i]); } - gf_proc_dump_write("data_self_heal", "%s", priv->data_self_heal); + gf_proc_dump_write("data_self_heal", "%d", priv->data_self_heal); gf_proc_dump_write("metadata_self_heal", "%d", priv->metadata_self_heal); gf_proc_dump_write("entry_self_heal", "%d", priv->entry_self_heal); gf_proc_dump_write("read_child", "%d", priv->read_child); @@ -6020,8 +6014,10 @@ afr_selfheal_locked_entry_inspect(call_frame_t *frame, xlator_t *this, gf_boolean_t granular_locks = _gf_false; priv = this->private; - if (strcmp("granular", priv->locking_scheme) == 0) - granular_locks = _gf_true; + granular_locks = priv->granular_locks; /*Assign to local variable so that + reconfigure doesn't change this + value between locking and unlocking + below*/ locked_on = alloca0(priv->child_count); data_lock = alloca0(priv->child_count); sources = alloca0(priv->child_count); |