summaryrefslogtreecommitdiffstats
path: root/xlators/features
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/features')
-rw-r--r--xlators/features/locks/src/common.c2
-rw-r--r--xlators/features/marker/src/marker-quota.c3
-rw-r--r--xlators/features/quota/src/quota.c10
-rw-r--r--xlators/features/quota/src/quotad-aggregator.c5
-rw-r--r--xlators/features/sdfs/src/sdfs.c3
-rw-r--r--xlators/features/shard/src/shard.c28
6 files changed, 33 insertions, 18 deletions
diff --git a/xlators/features/locks/src/common.c b/xlators/features/locks/src/common.c
index 24422b494b9..ad1ce6c604d 100644
--- a/xlators/features/locks/src/common.c
+++ b/xlators/features/locks/src/common.c
@@ -1274,7 +1274,7 @@ pl_local_init(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd)
return -1;
}
- local->inode = (fd ? inode_ref(fd->inode) : inode_ref(loc->inode));
+ local->inode = (loc ? inode_ref(loc->inode) : inode_ref(fd->inode));
frame->local = local;
}
diff --git a/xlators/features/marker/src/marker-quota.c b/xlators/features/marker/src/marker-quota.c
index 31584f5446b..4176ab6a8f1 100644
--- a/xlators/features/marker/src/marker-quota.c
+++ b/xlators/features/marker/src/marker-quota.c
@@ -2063,6 +2063,9 @@ mq_inspect_directory_xattr(xlator_t *this, quota_inode_ctx_t *ctx,
if (ret < 0)
goto create_xattr;
+ if (!contribution)
+ goto create_xattr;
+
if (!loc_is_root(loc)) {
GET_CONTRI_KEY(this, contri_key, contribution->gfid, keylen);
if (keylen < 0) {
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index a0c236d4cf6..1335386a197 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -1921,10 +1921,12 @@ quota_writev(call_frame_t *frame, xlator_t *this, fd_t *fd,
par_inode = do_quota_check_limit(frame, fd->inode, this, dentry,
_gf_false);
if (par_inode == NULL) {
- /* remove stale entry from inode ctx */
- quota_dentry_del(ctx, dentry->name, dentry->par);
- parents--;
- fail_count++;
+ if (ctx) {
+ /* remove stale entry from inode ctx */
+ quota_dentry_del(ctx, dentry->name, dentry->par);
+ parents--;
+ fail_count++;
+ }
} else {
inode_unref(par_inode);
}
diff --git a/xlators/features/quota/src/quotad-aggregator.c b/xlators/features/quota/src/quotad-aggregator.c
index 5a755c45fda..15b482503e3 100644
--- a/xlators/features/quota/src/quotad-aggregator.c
+++ b/xlators/features/quota/src/quotad-aggregator.c
@@ -176,8 +176,9 @@ out:
}
reply:
- quotad_aggregator_submit_reply(frame, frame->local, (void *)&cli_rsp, NULL,
- 0, NULL, (xdrproc_t)xdr_gf_cli_rsp);
+ quotad_aggregator_submit_reply(frame, (frame) ? frame->local : NULL,
+ (void *)&cli_rsp, NULL, 0, NULL,
+ (xdrproc_t)xdr_gf_cli_rsp);
dict_unref(xdata);
GF_FREE(cli_rsp.dict.dict_val);
diff --git a/xlators/features/sdfs/src/sdfs.c b/xlators/features/sdfs/src/sdfs.c
index b3fbc01caf7..3460b475824 100644
--- a/xlators/features/sdfs/src/sdfs.c
+++ b/xlators/features/sdfs/src/sdfs.c
@@ -177,9 +177,10 @@ sdfs_get_new_frame(call_frame_t *frame, loc_t *loc, call_frame_t **new_frame)
ret = 0;
err:
- if ((ret < 0) && (*new_frame != NULL)) {
+ if (ret && (*new_frame)) {
SDFS_STACK_DESTROY((*new_frame));
*new_frame = NULL;
+ ret = -1;
}
return ret;
diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c
index 2249cefc5ab..bb660306212 100644
--- a/xlators/features/shard/src/shard.c
+++ b/xlators/features/shard/src/shard.c
@@ -886,26 +886,34 @@ int
shard_common_inode_write_success_unwind(glusterfs_fop_t fop,
call_frame_t *frame, int32_t op_ret)
{
- shard_local_t *local = NULL;
+ shard_local_t *local = frame->local;
- local = frame->local;
+ /* the below 3 variables are required because, in SHARD_STACK_UNWIND()
+ macro, there is a check for local being null. So many static analyzers
+ backtrace the code with assumption of possible (local == NULL) case,
+ and complains for below lines. By handling it like below, we overcome
+ the warnings */
+
+ struct iatt *prebuf = ((local) ? &local->prebuf : NULL);
+ struct iatt *postbuf = ((local) ? &local->postbuf : NULL);
+ dict_t *xattr_rsp = ((local) ? local->xattr_rsp : NULL);
switch (fop) {
case GF_FOP_WRITE:
- SHARD_STACK_UNWIND(writev, frame, op_ret, 0, &local->prebuf,
- &local->postbuf, local->xattr_rsp);
+ SHARD_STACK_UNWIND(writev, frame, op_ret, 0, prebuf, postbuf,
+ xattr_rsp);
break;
case GF_FOP_FALLOCATE:
- SHARD_STACK_UNWIND(fallocate, frame, op_ret, 0, &local->prebuf,
- &local->postbuf, local->xattr_rsp);
+ SHARD_STACK_UNWIND(fallocate, frame, op_ret, 0, prebuf, postbuf,
+ xattr_rsp);
break;
case GF_FOP_ZEROFILL:
- SHARD_STACK_UNWIND(zerofill, frame, op_ret, 0, &local->prebuf,
- &local->postbuf, local->xattr_rsp);
+ SHARD_STACK_UNWIND(zerofill, frame, op_ret, 0, prebuf, postbuf,
+ xattr_rsp);
break;
case GF_FOP_DISCARD:
- SHARD_STACK_UNWIND(discard, frame, op_ret, 0, &local->prebuf,
- &local->postbuf, local->xattr_rsp);
+ SHARD_STACK_UNWIND(discard, frame, op_ret, 0, prebuf, postbuf,
+ xattr_rsp);
break;
default:
gf_msg(THIS->name, GF_LOG_WARNING, 0, SHARD_MSG_INVALID_FOP,