summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2016-01-06 14:30:08 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-07-25 23:47:33 -0700
commitd2bd17e5a53d0ffa375df1a5ad957556be2f2b83 (patch)
tree872633e25252817ee332d0b64a92cd64eba7464b
parent558a45fa527b01ec81904150532a8b661c06ae8a (diff)
dict: Don't expose get_new_dict/dict_destroy
get_new_dict/dict_destroy is causing confusion where, dict_new/dict_destroy or get_new_dict/dict_unref are used instead of dict_new/dict_unref. Change-Id: I4cc69f5b6711d720823395e20fd624a0c6c1168c BUG: 1296043 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/13183 Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
-rw-r--r--api/src/glfs-mgmt.c2
-rw-r--r--cli/src/cli-cmd-parser.c44
-rw-r--r--cli/src/cli-cmd-system.c6
-rw-r--r--cli/src/cli-cmd-volume.c2
-rw-r--r--cli/src/cli-rpc-ops.c4
-rw-r--r--cli/src/cli.c2
-rw-r--r--libglusterfs/src/dict.h6
-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
20 files changed, 68 insertions, 76 deletions
diff --git a/api/src/glfs-mgmt.c b/api/src/glfs-mgmt.c
index fd6b2f5c60c..21da06889d1 100644
--- a/api/src/glfs-mgmt.c
+++ b/api/src/glfs-mgmt.c
@@ -313,7 +313,7 @@ out:
}
if (dict)
- dict_destroy (dict);
+ dict_unref (dict);
if (rsp.dict.dict_val)
free (rsp.dict.dict_val);
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 77092b47591..f696ab45c55 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -740,7 +740,7 @@ out:
if (ret) {
gf_log ("cli", GF_LOG_ERROR, "Unable to parse create volume CLI");
if (dict)
- dict_destroy (dict);
+ dict_unref (dict);
}
GF_FREE (trans_type);
@@ -816,7 +816,7 @@ cli_cmd_volume_reset_parse (const char **words, int wordcount, dict_t **options)
out:
if (ret && dict) {
- dict_destroy (dict);
+ dict_unref (dict);
}
return ret;
@@ -978,7 +978,7 @@ cli_cmd_inode_quota_parse (const char **words, int wordcount, dict_t **options)
out:
if (ret < 0) {
if (dict)
- dict_destroy (dict);
+ dict_unref (dict);
}
return ret;
@@ -1317,7 +1317,7 @@ set_type:
out:
if (ret < 0) {
if (dict)
- dict_destroy (dict);
+ dict_unref (dict);
}
return ret;
@@ -1570,8 +1570,8 @@ cli_cmd_volume_set_parse (struct cli_state *state, const char **words,
*options = dict;
out:
- if (ret)
- dict_destroy (dict);
+ if (ret && dict)
+ dict_unref (dict);
return ret;
}
@@ -1711,7 +1711,7 @@ out:
if (ret) {
gf_log ("cli", GF_LOG_ERROR, "Unable to parse add-brick CLI");
if (dict)
- dict_destroy (dict);
+ dict_unref (dict);
}
return ret;
@@ -1790,7 +1790,7 @@ out:
if (ret) {
gf_log ("cli", GF_LOG_ERROR, "Unable to parse tier CLI");
if (dict)
- dict_destroy (dict);
+ dict_unref (dict);
}
return ret;
@@ -2019,7 +2019,7 @@ out:
if (ret) {
gf_log ("cli", GF_LOG_ERROR, "Unable to parse remove-brick CLI");
if (dict)
- dict_destroy (dict);
+ dict_unref (dict);
}
GF_FREE (tmp_brick);
@@ -2112,7 +2112,7 @@ out:
if (ret) {
gf_log ("cli", GF_LOG_ERROR, "Unable to parse replace-brick CLI");
if (dict)
- dict_destroy (dict);
+ dict_unref (dict);
}
return ret;
@@ -2173,7 +2173,7 @@ cli_cmd_log_filename_parse (const char **words, int wordcount, dict_t **options)
out:
if (ret && dict)
- dict_destroy (dict);
+ dict_unref (dict);
return ret;
}
@@ -2230,7 +2230,7 @@ cli_cmd_log_level_parse (const char **words, int worcount, dict_t **options)
out:
if (ret && dict)
- dict_destroy (dict);
+ dict_unref (dict);
return ret;
}
@@ -2281,7 +2281,7 @@ cli_cmd_log_locate_parse (const char **words, int wordcount, dict_t **options)
out:
if (ret && dict)
- dict_destroy (dict);
+ dict_unref (dict);
return ret;
}
@@ -2335,7 +2335,7 @@ cli_cmd_log_rotate_parse (const char **words, int wordcount, dict_t **options)
out:
if (ret && dict)
- dict_destroy (dict);
+ dict_unref (dict);
return ret;
}
@@ -2757,7 +2757,7 @@ out:
GF_FREE (slave_temp);
if (ret) {
if (dict)
- dict_destroy (dict);
+ dict_unref (dict);
} else
*options = dict;
@@ -2854,7 +2854,7 @@ cli_cmd_volume_profile_parse (const char **words, int wordcount,
*options = dict;
out:
if (ret && dict)
- dict_destroy (dict);
+ dict_unref (dict);
return ret;
}
@@ -3043,7 +3043,7 @@ cli_cmd_volume_top_parse (const char **words, int wordcount,
*options = dict;
out:
if (ret && dict)
- dict_destroy (dict);
+ dict_unref (dict);
return ret;
}
@@ -3256,7 +3256,7 @@ cli_cmd_volume_status_parse (const char **words, int wordcount,
out:
if (ret && dict)
- dict_destroy (dict);
+ dict_unref (dict);
return ret;
}
@@ -3318,7 +3318,7 @@ cli_cmd_volume_statedump_options_parse (const char **words, int wordcount,
*options = dict;
out:
if (ret && dict)
- dict_destroy (dict);
+ dict_unref (dict);
if (ret)
gf_log ("cli", GF_LOG_ERROR, "Error parsing dumpoptions");
return ret;
@@ -3794,7 +3794,7 @@ done:
out:
if (ret && dict)
- dict_destroy (dict);
+ dict_unref (dict);
return ret;
}
@@ -5118,7 +5118,7 @@ cli_cmd_snapshot_parse (const char **words, int wordcount, dict_t **options,
out:
if (ret) {
if (dict)
- dict_destroy (dict);
+ dict_unref (dict);
} else
*options = dict;
@@ -5373,7 +5373,7 @@ out:
if (ret) {
gf_log ("cli", GF_LOG_ERROR, "Unable to parse bitrot command");
if (dict)
- dict_destroy (dict);
+ dict_unref (dict);
}
return ret;
diff --git a/cli/src/cli-cmd-system.c b/cli/src/cli-cmd-system.c
index 89d7d23187e..fc632cfcad2 100644
--- a/cli/src/cli-cmd-system.c
+++ b/cli/src/cli-cmd-system.c
@@ -66,7 +66,7 @@ cli_cmd_getspec_cbk (struct cli_state *state, struct cli_cmd_word *word,
out:
if (!proc && ret) {
if (dict)
- dict_destroy (dict);
+ dict_unref (dict);
if (wordcount > 1)
cli_out ("Fetching spec for volume %s failed",
(char *)words[2]);
@@ -109,7 +109,7 @@ cli_cmd_pmap_b2p_cbk (struct cli_state *state, struct cli_cmd_word *word,
out:
if (!proc && ret) {
if (dict)
- dict_destroy (dict);
+ dict_unref (dict);
if (wordcount > 1)
cli_out ("Fetching spec for volume %s failed",
(char *)words[3]);
@@ -188,7 +188,7 @@ make_seq_dict (int argc, char **argv)
}
if (ret) {
- dict_destroy (dict);
+ dict_unref (dict);
dict = NULL;
}
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index 08bab2fefb1..6d44095d757 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -594,7 +594,7 @@ cli_cmd_volume_rename_cbk (struct cli_state *state, struct cli_cmd_word *word,
out:
if (dict)
- dict_destroy (dict);
+ dict_unref (dict);
if (ret) {
cli_cmd_sent_status_get (&sent);
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 40044dad753..3ea918a8cba 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -498,7 +498,7 @@ out:
cli_cmd_broadcast_response (ret);
if (dict)
- dict_destroy (dict);
+ dict_unref (dict);
return ret;
}
@@ -1067,7 +1067,7 @@ out:
cli_cmd_broadcast_response (ret);
if (dict)
- dict_destroy (dict);
+ dict_unref (dict);
free (rsp.dict.dict_val);
diff --git a/cli/src/cli.c b/cli/src/cli.c
index 518ae265f22..8e4caaa944e 100644
--- a/cli/src/cli.c
+++ b/cli/src/cli.c
@@ -575,7 +575,7 @@ cli_quotad_clnt_rpc_init (void)
out:
if (ret) {
if (rpc_opts)
- dict_destroy(rpc_opts);
+ dict_unref(rpc_opts);
}
return rpc;
}
diff --git a/libglusterfs/src/dict.h b/libglusterfs/src/dict.h
index afe83d68fc3..b2a700f9a92 100644
--- a/libglusterfs/src/dict.h
+++ b/libglusterfs/src/dict.h
@@ -113,7 +113,6 @@ int32_t dict_unserialize (char *buf, int32_t size, dict_t **fill);
int32_t dict_allocate_and_serialize (dict_t *this, char **buf, u_int *length);
-void dict_destroy (dict_t *dict);
void dict_unref (dict_t *dict);
dict_t *dict_ref (dict_t *dict);
data_t *data_ref (data_t *data);
@@ -154,11 +153,7 @@ char *data_to_str (data_t *data);
void *data_to_bin (data_t *data);
void *data_to_ptr (data_t *data);
-data_t *get_new_data (void);
data_t * data_copy (data_t *old);
-dict_t *get_new_dict_full (int size_hint);
-dict_t *get_new_dict (void);
-
int dict_foreach (dict_t *this,
int (*fn)(dict_t *this,
char *key,
@@ -191,6 +186,7 @@ int dict_null_foreach_fn (dict_t *d, char *k,
int dict_remove_foreach_fn (dict_t *d, char *k,
data_t *v, void *tmp);
dict_t *dict_copy (dict_t *this, dict_t *new);
+dict_t *get_new_dict (void);
int dict_keys_join (void *value, int size, dict_t *dict,
int (*filter_fn)(char *key));
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; \