summaryrefslogtreecommitdiffstats
path: root/xlators/protocol
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2020-01-12 16:33:54 +0200
committerXavi Hernandez <xhernandez@redhat.com>2020-01-21 12:28:07 +0000
commit44602465081ea5fb38255ad68d3ed8e987190d1f (patch)
treedd7bd780490f98406315a2834cc647841076ac8c /xlators/protocol
parent3aa0928623393aa9c296abf32d4726d02a454207 (diff)
dictionary: remove the 'extra_free' parameter
This parameter may have been used in the past, but is no longer needed. Removing it and the few locations it was actually referenced. This allows to remove an extra memdup as well, that was not needed in the 1st place in server_setvolume() and unserialize_rsp_direntp() functions. A followup separate patch will remove extra_stdfree parmeter from the dictionary structure. Change-Id: Ica0ff0a330672373aaa60e808b7e76ec489a0fe3 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'xlators/protocol')
-rw-r--r--xlators/protocol/client/src/client-helpers.c15
-rw-r--r--xlators/protocol/server/src/server-handshake.c21
2 files changed, 8 insertions, 28 deletions
diff --git a/xlators/protocol/client/src/client-helpers.c b/xlators/protocol/client/src/client-helpers.c
index 156f1cd3d9b..e49647faa6f 100644
--- a/xlators/protocol/client/src/client-helpers.c
+++ b/xlators/protocol/client/src/client-helpers.c
@@ -175,7 +175,6 @@ unserialize_rsp_direntp(xlator_t *this, fd_t *fd, struct gfs3_readdirp_rsp *rsp,
gf_dirent_t *entries)
{
struct gfs3_dirplist *trav = NULL;
- char *buf = NULL;
gf_dirent_t *entry = NULL;
inode_table_t *itable = NULL;
int entry_len = 0;
@@ -207,22 +206,18 @@ unserialize_rsp_direntp(xlator_t *this, fd_t *fd, struct gfs3_readdirp_rsp *rsp,
strcpy(entry->d_name, trav->name);
if (trav->dict.dict_val) {
- /* Dictionary is sent along with response */
- buf = gf_memdup(trav->dict.dict_val, trav->dict.dict_len);
- if (!buf)
- goto out;
-
entry->dict = dict_new();
+ if (!entry->dict)
+ goto out;
- ret = dict_unserialize(buf, trav->dict.dict_len, &entry->dict);
+ ret = dict_unserialize(trav->dict.dict_val, trav->dict.dict_len,
+ &entry->dict);
if (ret < 0) {
gf_msg(THIS->name, GF_LOG_WARNING, EINVAL,
PC_MSG_DICT_UNSERIALIZE_FAIL,
"failed to unserialize xattr dict");
goto out;
}
- GF_FREE(buf);
- buf = NULL;
}
entry->inode = inode_find(itable, entry->d_stat.ia_gfid);
@@ -237,8 +232,6 @@ unserialize_rsp_direntp(xlator_t *this, fd_t *fd, struct gfs3_readdirp_rsp *rsp,
ret = 0;
out:
- if (buf)
- GF_FREE(buf);
if (entry)
gf_dirent_entry_free(entry);
return ret;
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c
index dda58b60ca0..6e584a7560d 100644
--- a/xlators/protocol/server/src/server-handshake.c
+++ b/xlators/protocol/server/src/server-handshake.c
@@ -240,7 +240,6 @@ server_setvolume(rpcsvc_request_t *req)
int32_t ret = -1;
int32_t op_ret = -1;
int32_t op_errno = EINVAL;
- char *buf = NULL;
uint32_t opversion = 0;
rpc_transport_t *xprt = NULL;
int32_t fop_version = 0;
@@ -267,18 +266,11 @@ server_setvolume(rpcsvc_request_t *req)
*/
config_params = dict_copy_with_ref(this->options, NULL);
- buf = gf_memdup(args.dict.dict_val, args.dict.dict_len);
- if (buf == NULL) {
- op_ret = -1;
- op_errno = ENOMEM;
- goto fail;
- }
-
- ret = dict_unserialize(buf, args.dict.dict_len, &params);
+ ret = dict_unserialize(args.dict.dict_val, args.dict.dict_len, &params);
if (ret < 0) {
- ret = dict_set_str(reply, "ERROR",
- "Internal error: failed to unserialize "
- "request dictionary");
+ ret = dict_set_sizen_str_sizen(reply, "ERROR",
+ "Internal error: failed to unserialize "
+ "request dictionary");
if (ret < 0)
gf_msg_debug(this->name, 0,
"failed to set error "
@@ -291,9 +283,6 @@ server_setvolume(rpcsvc_request_t *req)
goto fail;
}
- params->extra_free = buf;
- buf = NULL;
-
ret = dict_get_str(params, "remote-subvolume", &name);
if (ret < 0) {
ret = dict_set_str(reply, "ERROR",
@@ -727,8 +716,6 @@ fail:
dict_unref(config_params);
}
- GF_FREE(buf);
-
return 0;
}