summaryrefslogtreecommitdiffstats
path: root/xlators/features
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/features')
-rw-r--r--xlators/features/marker/src/marker.c17
-rw-r--r--xlators/features/quota/src/quota-enforcer-client.c3
-rw-r--r--xlators/features/quota/src/quota.c17
-rw-r--r--xlators/features/quota/src/quotad-aggregator.c3
4 files changed, 23 insertions, 17 deletions
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c
index 465ee8c7ce6..b037844e855 100644
--- a/xlators/features/marker/src/marker.c
+++ b/xlators/features/marker/src/marker.c
@@ -250,7 +250,8 @@ marker_getxattr_stampfile_cbk (call_frame_t *frame, xlator_t *this,
STACK_UNWIND_STRICT (getxattr, frame, 0, 0, dict, xdata);
- dict_unref (dict);
+ if (dict)
+ dict_unref (dict);
out:
return 0;
}
@@ -2778,7 +2779,11 @@ marker_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
priv = this->private;
- if ((dict != NULL) && dict_get (dict, GET_ANCESTRY_DENTRY_KEY)) {
+ dict = dict ? dict_ref(dict) : dict_new();
+ if (!dict)
+ goto unwind;
+
+ if (dict_get (dict, GET_ANCESTRY_DENTRY_KEY)) {
STACK_WIND (frame, marker_build_ancestry_cbk,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->readdirp,
@@ -2791,9 +2796,6 @@ marker_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
loc.parent = local->loc.inode = inode_ref (fd->inode);
- if (dict == NULL)
- dict = dict_new ();
-
mq_req_xattr (this, &loc, dict);
}
@@ -2803,10 +2805,13 @@ marker_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
fd, size, offset, dict);
}
+ dict_unref (dict);
+ return 0;
+unwind:
+ STACK_UNWIND_STRICT (readdirp, frame, -1, ENOMEM, NULL, NULL);
return 0;
}
-
int32_t
mem_acct_init (xlator_t *this)
{
diff --git a/xlators/features/quota/src/quota-enforcer-client.c b/xlators/features/quota/src/quota-enforcer-client.c
index a52180936e3..49279449320 100644
--- a/xlators/features/quota/src/quota-enforcer-client.c
+++ b/xlators/features/quota/src/quota-enforcer-client.c
@@ -321,7 +321,8 @@ quota_enforcer_blocking_connect (rpc_clnt_t *rpc)
ret = 0;
out:
- dict_unref (options);
+ if (options)
+ dict_unref (options);
return ret;
}
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index afdade1432a..7b2e83189d4 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -562,7 +562,8 @@ quota_build_ancestry_open_cbk (call_frame_t *frame, void *cookie,
err:
fd_unref (fd);
- dict_unref (xdata_req);
+ if (xdata_req)
+ dict_unref (xdata_req);
if (op_ret < 0) {
local = frame->local;
@@ -2496,6 +2497,8 @@ dict_set:
ret = 0;
out:
+ if (dict)
+ dict_unref (dict);
return ret;
}
@@ -3534,7 +3537,6 @@ quota_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int64_t blocks = 0;
quota_inode_ctx_t *ctx = NULL;
int ret = 0;
- gf_boolean_t dict_created = _gf_false;
quota_local_t *local = frame->local;
inode = cookie;
@@ -3580,12 +3582,9 @@ quota_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
buf->f_bavail = buf->f_bfree;
}
- if (!xdata) {
- xdata = dict_new ();
- if (!xdata)
- goto unwind;
- dict_created = _gf_true;
- }
+ xdata = xdata ? dict_ref(xdata) : dict_new();
+ if (!xdata)
+ goto unwind;
ret = dict_set_int8 (xdata, "quota-deem-statfs", 1);
if (-1 == ret)
@@ -3595,7 +3594,7 @@ quota_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
unwind:
QUOTA_STACK_UNWIND (statfs, frame, op_ret, op_errno, buf, xdata);
- if (dict_created)
+ if (xdata)
dict_unref (xdata);
return 0;
diff --git a/xlators/features/quota/src/quotad-aggregator.c b/xlators/features/quota/src/quotad-aggregator.c
index 2c2b8589356..e3b9bdd4af0 100644
--- a/xlators/features/quota/src/quotad-aggregator.c
+++ b/xlators/features/quota/src/quotad-aggregator.c
@@ -247,7 +247,8 @@ err:
cli_rsp.op_errstr = "";
quotad_aggregator_getlimit_cbk (this, frame, &cli_rsp);
- dict_unref (dict);
+ if (dict)
+ dict_unref (dict);
return ret;
}