summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshish Pandey <aspandey@redhat.com>2018-08-23 14:24:56 +0530
committerAmar Tumballi <amarts@redhat.com>2018-08-27 03:29:00 +0000
commitf74181f85ab953b1f08eae358784e4b102b773b9 (patch)
tree6da9a084ca1032bbd4167a95339ded3e5fc7a54a
parent7f89cff0cdc63c4b6734bd2e3c56ee0e70957813 (diff)
feature/shard: Fix Coverity issue
Fix following coverity issues- CID: 1394660 1394668 1394667 1389008 1389434 https://scan6.coverity.com/reports.htm#v42607/p10714/fileInstanceId=84880983&defectInstanceId=25821108&mergedDefectId=1389008 https://scan6.coverity.com/reports.htm#v42607/p10714/fileInstanceId=84880983&defectInstanceId=25821101&mergedDefectId=1389434 https://scan6.coverity.com/reports.htm#v42607/p10714/fileInstanceId=84880983&defectInstanceId=25821001&mergedDefectId=1394660 https://scan6.coverity.com/reports.htm#v42607/p10714/fileInstanceId=84880983&defectInstanceId=25821010&mergedDefectId=1394667 https://scan6.coverity.com/reports.htm#v42607/p10714/fileInstanceId=84880983&defectInstanceId=25821017&mergedDefectId=1394668 Change-Id: I08f09649dbe758ba0d367ae5330b48b18784dec3 updates: bz#789278 Signed-off-by: Ashish Pandey <aspandey@redhat.com>
-rw-r--r--xlators/features/shard/src/shard.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c
index 45711754ebe..39f144e9668 100644
--- a/xlators/features/shard/src/shard.c
+++ b/xlators/features/shard/src/shard.c
@@ -906,13 +906,13 @@ shard_evicted_inode_fsync_cbk (call_frame_t *frame, void *cookie,
shard_priv_t *priv = NULL;
priv = this->private;
- shard_inode = anon_fd->inode;
- if (op_ret < 0) {
+ if (anon_fd == NULL || op_ret < 0) {
gf_msg (this->name, GF_LOG_WARNING, op_errno,
SHARD_MSG_MEMALLOC_FAILED, "fsync failed on shard");
goto out;
}
+ shard_inode = anon_fd->inode;
LOCK (&priv->lock);
LOCK(&shard_inode->lock);
@@ -3765,8 +3765,6 @@ shard_lookup_marker_file (call_frame_t *frame, xlator_t *this)
dict_unref (xattr_req);
return 0;
err:
- if (xattr_req)
- dict_unref (xattr_req);
shard_common_failure_unwind (local->fop, frame, -1, op_errno);
return 0;
}
@@ -4025,6 +4023,7 @@ shard_acquire_entrylk (call_frame_t *frame, xlator_t *this, inode_t *inode,
shard_entrylk_t *int_entrylk = NULL;
call_frame_t *entrylk_frame = NULL;
+ local = frame->local;
entrylk_frame = create_frame (this, this->ctx->pool);
if (!entrylk_frame) {
gf_msg (this->name, GF_LOG_WARNING, ENOMEM,
@@ -4039,7 +4038,6 @@ shard_acquire_entrylk (call_frame_t *frame, xlator_t *this, inode_t *inode,
goto err;
}
- local = frame->local;
entrylk_frame->local = entrylk_local;
entrylk_local->main_frame = frame;
int_entrylk = &entrylk_local->int_entrylk;
@@ -4146,6 +4144,7 @@ shard_acquire_inodelk (call_frame_t *frame, xlator_t *this, loc_t *loc)
shard_local_t *lk_local = NULL;
shard_inodelk_t *int_inodelk = NULL;
+ local = frame->local;
lk_frame = create_frame (this, this->ctx->pool);
if (!lk_frame) {
gf_msg (this->name, GF_LOG_WARNING, ENOMEM,
@@ -4159,7 +4158,6 @@ shard_acquire_inodelk (call_frame_t *frame, xlator_t *this, loc_t *loc)
goto err;
}
- local = frame->local;
lk_frame->local = lk_local;
lk_local->main_frame = frame;
int_inodelk = &lk_local->int_inodelk;
@@ -5762,7 +5760,7 @@ shard_fsync_shards_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
UNLOCK (&frame->lock);
fd_ctx_get (anon_fd, this, &fsync_count);
out:
- if (base_inode != anon_fd->inode) {
+ if (anon_fd && (base_inode != anon_fd->inode)) {
LOCK (&base_inode->lock);
LOCK (&anon_fd->inode->lock);
{