summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-common.c
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2017-11-13 07:03:36 +0530
committerRavishankar N <ravishankar@redhat.com>2017-11-24 03:49:33 +0000
commit2559d959df1a5dec10b0b80ba5ac0ec292014d8e (patch)
treeacf1fa1c0bd1c0e858f97fd2790e82849d4aee44 /xlators/cluster/afr/src/afr-common.c
parente19f5c34a5bef2f5d097ee359100c3fd43fd310a (diff)
afr: coverity fixes
1.afr_discover_do: COPY_PASTE_ERROR 2.afr_fav_child_reset_sink_xattrs_cbk: REVERSE_INULL 3.afr_fop_lock_proceed: UNUSED_VALUE 4.afr_local_init: CHECKED_RETURN 5.afr_set_split_brain_choice: REVERSE_INULL 6.__afr_inode_write_finalize: FORWARD_NULL 7.afr_refresh_heal_done: REVERSE_INULL 8.afr_xl_op:UNUSED_VALUE 9.afr_changelog_populate_xdata: DEADCODE 10.set_afr_pending_xattrs_option: RESOURCE_LEAK Note: RESOURCE_LEAK complaints about afr_fgetxattr_pathinfo_cbk, afr_getxattr_list_node_uuids_cbk and afr_getxattr_pathinfo_cbk seem to be false alarms. Change-Id: Ia4ca1478b5e2922084732d14c1e7b1b03ad5ac45 BUG: 789278 Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-common.c')
-rw-r--r--xlators/cluster/afr/src/afr-common.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 2da2dc2..f9c0e17 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -930,8 +930,7 @@ unlock:
if (need_invalidate)
inode_invalidate (inode);
out:
- if (data)
- GF_FREE (data);
+ GF_FREE (data);
AFR_STACK_UNWIND (setxattr, frame, ret, op_errno, NULL);
return 0;
}
@@ -2956,7 +2955,6 @@ afr_discover_do (call_frame_t *frame, xlator_t *this, int err)
if (err) {
local->op_errno = -err;
- ret = -1;
goto out;
}
@@ -2967,7 +2965,6 @@ afr_discover_do (call_frame_t *frame, xlator_t *this, int err)
&local->loc);
if (ret) {
local->op_errno = -ret;
- ret = -1;
goto out;
}
@@ -3835,7 +3832,7 @@ afr_fop_lock_proceed (call_frame_t *frame)
* gaining the locks and unwinds with EAGAIN errno.
*/
local->op_ret = -1;
- local->op_ret = EUCLEAN;
+ local->op_errno = EUCLEAN;
local->fop_lock_state = AFR_FOP_LOCK_SERIAL;
afr_local_replies_wipe (local, priv);
if (local->xdata_rsp)
@@ -5398,10 +5395,16 @@ out:
int
afr_local_init (afr_local_t *local, afr_private_t *priv, int32_t *op_errno)
{
+ int __ret = -1;
local->op_ret = -1;
local->op_errno = EUCLEAN;
- syncbarrier_init (&local->barrier);
+ __ret = syncbarrier_init (&local->barrier);
+ if (__ret) {
+ if (op_errno)
+ *op_errno = __ret;
+ goto out;
+ }
local->child_up = GF_CALLOC (priv->child_count,
sizeof (*local->child_up),
@@ -6420,8 +6423,7 @@ afr_fav_child_reset_sink_xattrs_cbk (int ret, call_frame_t *heal_frame,
afr_inode_refresh (txn_frame, this, local->inode, NULL,
local->refreshfn);
- if (heal_frame)
- AFR_STACK_DESTROY (heal_frame);
+ AFR_STACK_DESTROY (heal_frame);
return 0;
}