summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-common.c6
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-name.c2
-rw-r--r--xlators/cluster/dht/src/dht-selfheal.c16
-rw-r--r--xlators/cluster/dht/src/dht-shared.c2
-rw-r--r--xlators/experimental/jbr-server/src/jbr.c4
-rw-r--r--xlators/features/read-only/src/worm-helper.c6
-rw-r--r--xlators/features/read-only/src/worm.c2
-rw-r--r--xlators/features/upcall/src/upcall.c15
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-geo-rep.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c12
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c3
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.h2
13 files changed, 37 insertions, 41 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
index a4c0e89e434..0ad4b644c42 100644
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
@@ -1132,13 +1132,13 @@ afr_selfheal_unlocked_lookup_on (call_frame_t *frame, inode_t *parent,
dict_copy (xattr, xattr_req);
if (afr_xattr_req_prepare (frame->this, xattr_req) != 0) {
- dict_destroy (xattr_req);
+ dict_unref (xattr_req);
return NULL;
}
inode = inode_new (parent->table);
if (!inode) {
- dict_destroy (xattr_req);
+ dict_unref (xattr_req);
return NULL;
}
@@ -1176,7 +1176,7 @@ afr_selfheal_unlocked_discover_on (call_frame_t *frame, inode_t *inode,
return -ENOMEM;
if (afr_xattr_req_prepare (frame->this, xattr_req) != 0) {
- dict_destroy (xattr_req);
+ dict_unref (xattr_req);
return -ENOMEM;
}
diff --git a/xlators/cluster/afr/src/afr-self-heal-name.c b/xlators/cluster/afr/src/afr-self-heal-name.c
index 3445ecccf9c..b11285ca54e 100644
--- a/xlators/cluster/afr/src/afr-self-heal-name.c
+++ b/xlators/cluster/afr/src/afr-self-heal-name.c
@@ -576,7 +576,7 @@ afr_selfheal_name_do (call_frame_t *frame, xlator_t *this, inode_t *parent,
ret = dict_set_int32 (xattr, GF_GFIDLESS_LOOKUP, 1);
if (ret) {
- dict_destroy (xattr);
+ dict_unref (xattr);
return -1;
}
diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c
index d3de1b76795..d197117b838 100644
--- a/xlators/cluster/dht/src/dht-selfheal.c
+++ b/xlators/cluster/dht/src/dht-selfheal.c
@@ -680,7 +680,7 @@ dht_selfheal_dir_xattr_persubvol (call_frame_t *frame, loc_t *loc,
conf = this->private;
- xattr = get_new_dict ();
+ xattr = dict_new ();
if (!xattr) {
goto err;
}
@@ -726,7 +726,6 @@ dht_selfheal_dir_xattr_persubvol (call_frame_t *frame, loc_t *loc,
"Directory self heal xattr failed:"
"%s: (subvol %s) Failed to set xattr dictionary,"
" gfid = %s", loc->path, subvol->name, gfid);
- GF_FREE (disk_layout);
goto err;
}
disk_layout = NULL;
@@ -736,7 +735,6 @@ dht_selfheal_dir_xattr_persubvol (call_frame_t *frame, loc_t *loc,
" for %s", layout->list[i].start, layout->list[i].stop,
layout->type, subvol->name, loc->path);
- dict_ref (xattr);
if (local->xattr) {
data = dict_get (local->xattr, QUOTA_LIMIT_KEY);
if (data) {
@@ -776,7 +774,7 @@ dht_selfheal_dir_xattr_persubvol (call_frame_t *frame, loc_t *loc,
err:
if (xattr)
- dict_destroy (xattr);
+ dict_unref (xattr);
if (xdata)
dict_unref (xdata);
@@ -2411,7 +2409,7 @@ dht_update_commit_hash_for_layout_resume (call_frame_t *frame, void *cookie,
goto err;
}
- xattr[i] = get_new_dict ();
+ xattr[i] = dict_new ();
if (!xattr[i]) {
local->op_errno = errno;
@@ -2452,22 +2450,22 @@ dht_update_commit_hash_for_layout_resume (call_frame_t *frame, void *cookie,
local->op_ret = 0;
local->op_errno = 0;
for (i = 0; i < count; i++) {
- dict_ref (xattr[i]);
-
STACK_WIND (frame, dht_update_commit_hash_for_layout_cbk,
conf->local_subvols[i],
conf->local_subvols[i]->fops->setxattr,
&local->loc, xattr[i], 0, NULL);
- dict_unref (xattr[i]);
}
+ for (i = 0; i < count; i++)
+ dict_unref (xattr[i]);
+ GF_FREE (xattr);
return 0;
err:
if (xattr) {
for (i = 0; i < count; i++) {
if (xattr[i])
- dict_destroy (xattr[i]);
+ dict_unref (xattr[i]);
}
GF_FREE (xattr);
diff --git a/xlators/cluster/dht/src/dht-shared.c b/xlators/cluster/dht/src/dht-shared.c
index 0fea1d58e58..873ced53eec 100644
--- a/xlators/cluster/dht/src/dht-shared.c
+++ b/xlators/cluster/dht/src/dht-shared.c
@@ -235,7 +235,7 @@ dht_fini (xlator_t *this)
GF_FREE (conf->file_layouts);
}
- dict_destroy(conf->leaf_to_subvol);
+ dict_unref(conf->leaf_to_subvol);
GF_FREE (conf->subvolumes);
diff --git a/xlators/experimental/jbr-server/src/jbr.c b/xlators/experimental/jbr-server/src/jbr.c
index afdbc5d9f4a..cd9e71a9ea3 100644
--- a/xlators/experimental/jbr-server/src/jbr.c
+++ b/xlators/experimental/jbr-server/src/jbr.c
@@ -864,11 +864,11 @@ jbr_getxattr_special (call_frame_t *frame, xlator_t *this, loc_t *loc,
}
STACK_UNWIND_STRICT (getxattr, frame, 0, 0, result, NULL);
- dict_destroy(result);
+ dict_unref(result);
return 0;
dsu_failed:
- dict_destroy(result);
+ dict_unref(result);
dn_failed:
STACK_UNWIND_STRICT (getxattr, frame, -1, ENOMEM, NULL, NULL);
return 0;
diff --git a/xlators/features/read-only/src/worm-helper.c b/xlators/features/read-only/src/worm-helper.c
index 61aa4f02651..425e48123b1 100644
--- a/xlators/features/read-only/src/worm-helper.c
+++ b/xlators/features/read-only/src/worm-helper.c
@@ -62,7 +62,7 @@ worm_init_state (xlator_t *this, gf_boolean_t fop_with_fd, void *file_ptr)
NULL);
out:
if (dict)
- dict_destroy (dict);
+ dict_unref (dict);
return ret;
}
@@ -283,7 +283,7 @@ gf_worm_set_xattr (xlator_t *this, worm_reten_state_t *reten_state,
NULL);
out:
if (dict)
- dict_destroy (dict);
+ dict_unref (dict);
return ret;
}
@@ -410,4 +410,4 @@ is_wormfile (xlator_t *this, gf_boolean_t fop_with_fd, void *file_ptr)
dict_unref (dict);
}
return ret;
-} \ No newline at end of file
+}
diff --git a/xlators/features/read-only/src/worm.c b/xlators/features/read-only/src/worm.c
index 3e32d65dbac..5ba6641fca2 100644
--- a/xlators/features/read-only/src/worm.c
+++ b/xlators/features/read-only/src/worm.c
@@ -433,7 +433,7 @@ out:
STACK_UNWIND_STRICT (create, frame, op_ret, op_errno, fd, inode, buf,
preparent, postparent, xdata);
if (dict)
- dict_destroy (dict);
+ dict_unref (dict);
return ret;
}
diff --git a/xlators/features/upcall/src/upcall.c b/xlators/features/upcall/src/upcall.c
index 76f8ee4923d..40cfb6c7f11 100644
--- a/xlators/features/upcall/src/upcall.c
+++ b/xlators/features/upcall/src/upcall.c
@@ -1641,6 +1641,7 @@ up_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
op_errno = ENOMEM;
goto err;
}
+ dict_unref (xattr);
out:
STACK_WIND (frame, up_setxattr_cbk, FIRST_CHILD(this),
@@ -1650,6 +1651,8 @@ out:
return 0;
err:
+ if (xattr)
+ dict_unref (xattr);
UPCALL_STACK_UNWIND (setxattr, frame, -1, op_errno, NULL);
return 0;
@@ -1719,6 +1722,7 @@ up_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict,
op_errno = ENOMEM;
goto err;
}
+ dict_unref (xattr);
out:
STACK_WIND (frame, up_fsetxattr_cbk,
@@ -1728,6 +1732,8 @@ out:
return 0;
err:
+ if (xattr)
+ dict_unref (xattr);
UPCALL_STACK_UNWIND (fsetxattr, frame, -1, op_errno, NULL);
return 0;
@@ -2010,13 +2016,8 @@ upcall_local_wipe (xlator_t *this, upcall_local_t *local)
{
if (local) {
inode_unref (local->inode);
- if (local->xattr) {
- /* There will be 2 refs at this point, hence dict_destroy:
- * 1. taken by dict_copy_with_ref
- * 2. taken by upcall_local_init ()
- */
- dict_destroy (local->xattr);
- }
+ if (local->xattr)
+ dict_unref (local->xattr);
loc_wipe (&local->rename_oldloc);
loc_wipe (&local->loc);
if (local->fd)
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
index 55e249643c0..67f27712f86 100644
--- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
+++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
@@ -1982,7 +1982,7 @@ is_geo_rep_active (glusterd_volinfo_t *volinfo, char *slave,
ret = 0;
out:
if (confd)
- dict_destroy (confd);
+ dict_unref (confd);
return ret;
}
@@ -2621,7 +2621,7 @@ fetch_data:
}
if (confd)
- dict_destroy (confd);
+ dict_unref (confd);
gf_msg_debug (this->name, 0, "Returning %d ", ret);
return ret;
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index e9f261c2fb3..b06a5978540 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -4047,7 +4047,7 @@ glusterd_op_build_payload (dict_t **req, char **op_errstr, dict_t *op_ctx)
if (ret)
goto out;
}
- dict_destroy (req_dict);
+ dict_unref (req_dict);
req_dict = dict_ref (dict);
}
break;
@@ -4073,7 +4073,7 @@ glusterd_op_build_payload (dict_t **req, char **op_errstr, dict_t *op_ctx)
goto out;
}
- dict_destroy (req_dict);
+ dict_unref (req_dict);
req_dict = dict_ref (dict);
}
break;
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 6a755486d7d..9eefd2a8491 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -93,7 +93,7 @@ xlator_instantiate_va (const char *type, const char *format, va_list arg)
ret = xlator_set_type_virtual (xl, type);
if (ret)
goto error;
- xl->options = get_new_dict();
+ xl->options = dict_new ();
if (!xl->options)
goto error;
xl->name = volname;
@@ -1065,7 +1065,7 @@ build_graph_generic (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
int ret = 0;
if (mod_dict) {
- set_dict = dict_copy (volinfo->dict, NULL);
+ set_dict = dict_copy_with_ref (volinfo->dict, NULL);
if (!set_dict)
return -1;
dict_copy (mod_dict, set_dict);
@@ -1079,7 +1079,7 @@ build_graph_generic (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
ret = volgen_graph_set_options (graph, set_dict);
if (mod_dict)
- dict_destroy (set_dict);
+ dict_unref (set_dict);
return ret;
}
@@ -4798,7 +4798,7 @@ build_rebalance_volfile (glusterd_volinfo_t *volinfo, char *filepath,
return 0;
}
- set_dict = dict_copy (volinfo->dict, NULL);
+ set_dict = dict_copy_with_ref (volinfo->dict, NULL);
if (!set_dict)
return -1;
@@ -4840,7 +4840,7 @@ build_rebalance_volfile (glusterd_volinfo_t *volinfo, char *filepath,
out:
volgen_graph_free (&graph);
- dict_destroy (set_dict);
+ dict_unref (set_dict);
return ret;
}
@@ -5106,7 +5106,7 @@ build_nfs_graph (volgen_graph_t *graph, dict_t *mod_dict)
out:
gf_msg_debug ("glusterd", 0, "Returning %d", ret);
- dict_destroy (set_dict);
+ dict_unref (set_dict);
return ret;
}
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index eead33fbd55..a79f7497acf 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -3282,7 +3282,7 @@ fuse_setxattr (xlator_t *this, fuse_in_header_t *finh, void *msg)
fuse_resolve_inode_init (state, &state->resolve, finh->nodeid);
- state->xattr = get_new_dict ();
+ state->xattr = dict_new ();
if (!state->xattr) {
gf_log ("glusterfs-fuse", GF_LOG_ERROR,
"%"PRIu64": SETXATTR dict allocation failed",
@@ -3312,7 +3312,6 @@ fuse_setxattr (xlator_t *this, fuse_in_header_t *finh, void *msg)
}
dict_set (state->xattr, newkey,
data_from_dynptr ((void *)dict_value, fsi->size));
- dict_ref (state->xattr);
state->flags = fsi->flags;
state->name = newkey;
diff --git a/xlators/mount/fuse/src/fuse-bridge.h b/xlators/mount/fuse/src/fuse-bridge.h
index 40bd17ba6e6..e4075c83f2c 100644
--- a/xlators/mount/fuse/src/fuse-bridge.h
+++ b/xlators/mount/fuse/src/fuse-bridge.h
@@ -257,7 +257,6 @@ typedef struct fuse_graph_switch_args fuse_graph_switch_args_t;
GF_LOG_WARNING, \
"%s Failed adding umask"\
" to request", op); \
- dict_destroy (state->xdata); \
send_fuse_err (this, finh, ENOMEM); \
free_fuse_state (state); \
return; \
@@ -269,7 +268,6 @@ typedef struct fuse_graph_switch_args fuse_graph_switch_args_t;
GF_LOG_WARNING, \
"%s Failed adding mode " \
"to request", op); \
- dict_destroy (state->xdata); \
send_fuse_err (this, finh, ENOMEM); \
free_fuse_state (state); \
return; \