summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src
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
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')
-rw-r--r--xlators/cluster/afr/src/afr-common.c18
-rw-r--r--xlators/cluster/afr/src/afr-inode-write.c22
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-common.c3
-rw-r--r--xlators/cluster/afr/src/afr-self-heald.c3
-rw-r--r--xlators/cluster/afr/src/afr-transaction.c2
5 files changed, 24 insertions, 24 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 2da2dc271d9..f9c0e177c15 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;
}
diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c
index 14114699594..8078f4403c0 100644
--- a/xlators/cluster/afr/src/afr-inode-write.c
+++ b/xlators/cluster/afr/src/afr-inode-write.c
@@ -47,10 +47,11 @@ __afr_inode_write_finalize (call_frame_t *frame, xlator_t *this)
local = frame->local;
priv = this->private;
+ GF_VALIDATE_OR_GOTO (this->name, local->inode, out);
/*This code needs to stay till DHT sends fops on linked
* inodes*/
- if (local->inode && !inode_is_linked (local->inode)) {
+ if (!inode_is_linked (local->inode)) {
for (i = 0; i < priv->child_count; i++) {
if (!local->replies[i].valid)
continue;
@@ -76,14 +77,15 @@ __afr_inode_write_finalize (call_frame_t *frame, xlator_t *this)
}
}
- if (local->inode) {
- if (local->transaction.type == AFR_METADATA_TRANSACTION)
- read_subvol = afr_metadata_subvol_get (local->inode,
- this, NULL, local->readable, NULL, &args);
- else
- read_subvol = afr_data_subvol_get (local->inode, this,
- NULL, local->readable, NULL, &args);
- }
+ if (local->transaction.type == AFR_METADATA_TRANSACTION) {
+ read_subvol = afr_metadata_subvol_get (local->inode, this,
+ NULL, local->readable,
+ NULL, &args);
+ } else {
+ read_subvol = afr_data_subvol_get (local->inode, this,
+ NULL, local->readable,
+ NULL, &args);
+ }
local->op_ret = -1;
local->op_errno = afr_final_errno (local, priv);
@@ -131,6 +133,8 @@ __afr_inode_write_finalize (call_frame_t *frame, xlator_t *this)
}
afr_set_in_flight_sb_status (this, frame, local->inode);
+out:
+ return;
}
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
index 26d3860b234..8e75d200567 100644
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
@@ -2557,8 +2557,7 @@ afr_refresh_heal_done (int ret, call_frame_t *frame, void *opaque)
}
UNLOCK (&priv->lock);
- if (heal_frame)
- AFR_STACK_DESTROY (heal_frame);
+ AFR_STACK_DESTROY (heal_frame);
if (local)
afr_heal_synctask (this, local);
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c
index 19cde88a6d5..fcf1559e545 100644
--- a/xlators/cluster/afr/src/afr-self-heald.c
+++ b/xlators/cluster/afr/src/afr-self-heald.c
@@ -1197,9 +1197,6 @@ afr_xl_op (xlator_t *this, dict_t *input, dict_t *output)
}
}
-// ret = _do_crawl_op_on_local_subvols (this, INDEX_TO_BE_HEALED,
-// STATISTICS_TO_BE_HEALED,
-// output);
break;
default:
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index a04636f25a0..440e8d1ed97 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -1240,8 +1240,6 @@ afr_changelog_populate_xdata (call_frame_t *frame, afr_xattrop_type_t op,
out:
if (xdata1)
dict_unref (xdata1);
- if (xdata2)
- dict_unref (xdata2);
return;
}