summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client
diff options
context:
space:
mode:
authorAnuradha Talur <atalur@redhat.com>2016-08-29 16:41:09 +0530
committerRaghavendra G <rgowdapp@redhat.com>2016-08-30 23:50:40 -0700
commit7cbc10037ecc873d60c3a970d00faf2819019525 (patch)
tree35026d258fa4bb9aad89f7a504954bb566ffa4fc /xlators/protocol/client
parentfe929224c47d5c82da5650e9e1041645a8d7f244 (diff)
compound fops: Some fixes to compound fops framework
Change-Id: I808fd5f9f002a35bff94d310c5d61a781e49570b BUG: 1360169 Signed-off-by: Anuradha Talur <atalur@redhat.com> Reviewed-on: http://review.gluster.org/15010 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/protocol/client')
-rw-r--r--xlators/protocol/client/src/client-common.c1
-rw-r--r--xlators/protocol/client/src/client-helpers.c298
-rw-r--r--xlators/protocol/client/src/client-rpc-fops.c56
-rw-r--r--xlators/protocol/client/src/client.h25
4 files changed, 287 insertions, 93 deletions
diff --git a/xlators/protocol/client/src/client-common.c b/xlators/protocol/client/src/client-common.c
index 05939b8aa0b..4fff7e6e64f 100644
--- a/xlators/protocol/client/src/client-common.c
+++ b/xlators/protocol/client/src/client-common.c
@@ -1402,6 +1402,7 @@ client_post_readlink (xlator_t *this, gfs3_readlink_rsp *rsp,
rsp->op_errno, out);
out:
+
return ret;
}
diff --git a/xlators/protocol/client/src/client-helpers.c b/xlators/protocol/client/src/client-helpers.c
index 4bdb364a9a3..a7e46b55546 100644
--- a/xlators/protocol/client/src/client-helpers.c
+++ b/xlators/protocol/client/src/client-helpers.c
@@ -135,10 +135,6 @@ client_local_wipe (clnt_local_t *local)
iobref_unref (local->iobref);
}
- if (local->iobref2) {
- iobref_unref (local->iobref2);
- }
-
GF_FREE (local->name);
local->compound_args = NULL;
@@ -1126,8 +1122,8 @@ int
client_handle_fop_requirements (xlator_t *this, call_frame_t *frame,
gfs3_compound_req *req,
clnt_local_t *local,
- struct iobref *req_iobref,
- struct iobref *rsp_iobref,
+ struct iobref **req_iobref,
+ struct iobref **rsp_iobref,
struct iovec *req_vector,
struct iovec *rsp_vector, int *req_count,
int *rsp_count, default_args_t *args,
@@ -1160,10 +1156,8 @@ client_handle_fop_requirements (xlator_t *this, call_frame_t *frame,
op_errno, out,
&args->loc, args->mode, args->rdev,
args->umask, args->xdata);
- if (!&local->loc) {
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
- }
+ loc_copy (&local->loc, &args->loc);
+ loc_path (&local->loc, NULL);
break;
case GF_FOP_MKDIR:
CLIENT_PRE_FOP (mkdir, this,
@@ -1171,10 +1165,8 @@ client_handle_fop_requirements (xlator_t *this, call_frame_t *frame,
op_errno, out,
&args->loc, args->mode,
args->umask, args->xdata);
- if (!&local->loc) {
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
- }
+ loc_copy (&local->loc, &args->loc);
+ loc_path (&local->loc, NULL);
break;
case GF_FOP_UNLINK:
CLIENT_PRE_FOP (unlink, this,
@@ -1194,10 +1186,8 @@ client_handle_fop_requirements (xlator_t *this, call_frame_t *frame,
op_errno, out,
&args->loc, args->linkname, args->umask,
args->xdata);
- if (!&local->loc) {
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
- }
+ loc_copy (&local->loc, &args->loc);
+ loc_path (&local->loc, NULL);
break;
case GF_FOP_RENAME:
CLIENT_PRE_FOP (rename, this,
@@ -1246,15 +1236,15 @@ client_handle_fop_requirements (xlator_t *this, call_frame_t *frame,
goto out;
}
- if (!rsp_iobref) {
- rsp_iobref = iobref_new ();
- if (rsp_iobref == NULL) {
+ if (!*rsp_iobref) {
+ *rsp_iobref = iobref_new ();
+ if (*rsp_iobref == NULL) {
op_errno = ENOMEM;
goto out;
}
}
- iobref_add (rsp_iobref, rsp_iobuf);
+ iobref_add (*rsp_iobref, rsp_iobuf);
iobuf_unref (rsp_iobuf);
if (*rsp_count + 1 >= MAX_IOVEC) {
@@ -1280,7 +1270,8 @@ client_handle_fop_requirements (xlator_t *this, call_frame_t *frame,
case GF_FOP_WRITE:
op_errno = client_pre_writev (this,
&this_req->compound_req_u.compound_write_req,
- args->fd, args->count, args->offset,
+ args->fd, iov_length (args->vector, args->count),
+ args->offset,
args->flags, args->xdata);
if (op_errno) {
@@ -1292,7 +1283,7 @@ client_handle_fop_requirements (xlator_t *this, call_frame_t *frame,
local->attempt_reopen = client_is_reopen_needed
(args->fd, this, remote_fd);
- if (*req_count + 1 >= MAX_IOVEC) {
+ if (*req_count + args->count >= MAX_IOVEC) {
op_errno = ENOMEM;
goto out;
}
@@ -1300,10 +1291,10 @@ client_handle_fop_requirements (xlator_t *this, call_frame_t *frame,
(args->count * sizeof(req_vector[0])));
*req_count += args->count;
- if (!req_iobref)
- req_iobref = args->iobref;
+ if (!*req_iobref)
+ *req_iobref = args->iobref;
else
- if (iobref_merge (req_iobref, args->iobref))
+ if (iobref_merge (*req_iobref, args->iobref))
goto out;
break;
case GF_FOP_STATFS:
@@ -1339,10 +1330,8 @@ client_handle_fop_requirements (xlator_t *this, call_frame_t *frame,
&this_req->compound_req_u.compound_getxattr_req,
op_errno, out,
&args->loc, args->name, args->xdata);
- if (!&local->loc) {
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
- }
+ loc_copy (&local->loc, &args->loc);
+ loc_path (&local->loc, NULL);
break;
case GF_FOP_REMOVEXATTR:
CLIENT_PRE_FOP (removexattr, this,
@@ -1357,10 +1346,8 @@ client_handle_fop_requirements (xlator_t *this, call_frame_t *frame,
&args->loc, args->fd, args->xdata);
if (!local->fd)
local->fd = fd_ref (args->fd);
- if (!&local->loc) {
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
- }
+ loc_copy (&local->loc, &args->loc);
+ loc_path (&local->loc, NULL);
break;
case GF_FOP_FSYNCDIR:
CLIENT_PRE_FOP (fsyncdir, this,
@@ -1383,10 +1370,8 @@ client_handle_fop_requirements (xlator_t *this, call_frame_t *frame,
if (!local->fd)
local->fd = fd_ref (args->fd);
- if (!&local->loc) {
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
- }
+ loc_copy (&local->loc, &args->loc);
+ loc_path (&local->loc, NULL);
break;
case GF_FOP_FTRUNCATE:
CLIENT_PRE_FOP (ftruncate, this,
@@ -1414,10 +1399,8 @@ client_handle_fop_requirements (xlator_t *this, call_frame_t *frame,
&this_req->compound_req_u.compound_lookup_req,
op_errno, out,
&args->loc, args->xdata);
- if (!&local->loc) {
- loc_copy (&local->loc, &args->loc);
- loc_path (&local->loc, NULL);
- }
+ loc_copy (&local->loc, &args->loc);
+ loc_path (&local->loc, NULL);
break;
case GF_FOP_READDIR:
CLIENT_PRE_FOP (readdir, this,
@@ -1582,6 +1565,9 @@ compound_request_cleanup (gfs3_compound_req *req)
compound_req *curr_req = NULL;
+ if (!req->compound_req_array.compound_req_array_val)
+ return;
+
for (i = 0; i < length; i++) {
curr_req = &req->compound_req_array.compound_req_array_val[i];
@@ -1636,8 +1622,9 @@ compound_request_cleanup (gfs3_compound_req *req)
break;
case GF_FOP_SETXATTR:
{
- gfs3_setxattr_req args = curr_req->compound_req_u.compound_setxattr_req;
- GF_FREE (args.dict.dict_val);
+ gfs3_setxattr_req *args = &CPD_REQ_FIELD (curr_req,
+ setxattr);
+ GF_FREE (args->dict.dict_val);
CLIENT_COMPOUND_FOP_CLEANUP (curr_req, setxattr);
break;
}
@@ -1688,15 +1675,17 @@ compound_request_cleanup (gfs3_compound_req *req)
break;
case GF_FOP_XATTROP:
{
- gfs3_xattrop_req args = curr_req->compound_req_u.compound_xattrop_req;
- GF_FREE (args.dict.dict_val);
+ gfs3_xattrop_req *args = &CPD_REQ_FIELD (curr_req,
+ xattrop);
+ GF_FREE (args->dict.dict_val);
CLIENT_COMPOUND_FOP_CLEANUP (curr_req, xattrop);
break;
}
case GF_FOP_FXATTROP:
{
- gfs3_fxattrop_req args = curr_req->compound_req_u.compound_fxattrop_req;
- GF_FREE (args.dict.dict_val);
+ gfs3_fxattrop_req *args = &CPD_REQ_FIELD (curr_req,
+ fxattrop);
+ GF_FREE (args->dict.dict_val);
CLIENT_COMPOUND_FOP_CLEANUP (curr_req, fxattrop);
break;
}
@@ -1705,8 +1694,9 @@ compound_request_cleanup (gfs3_compound_req *req)
break;
case GF_FOP_FSETXATTR:
{
- gfs3_fsetxattr_req args = curr_req->compound_req_u.compound_fsetxattr_req;
- GF_FREE (args.dict.dict_val);
+ gfs3_fsetxattr_req *args = &CPD_REQ_FIELD(curr_req,
+ fsetxattr);
+ GF_FREE (args->dict.dict_val);
CLIENT_COMPOUND_FOP_CLEANUP (curr_req, fsetxattr);
break;
}
@@ -1721,8 +1711,9 @@ compound_request_cleanup (gfs3_compound_req *req)
break;
case GF_FOP_READDIRP:
{
- gfs3_readdirp_req args = curr_req->compound_req_u.compound_readdirp_req;
- GF_FREE (args.dict.dict_val);
+ gfs3_readdirp_req *args = &CPD_REQ_FIELD(curr_req,
+ readdirp);
+ GF_FREE (args->dict.dict_val);
break;
}
case GF_FOP_FREMOVEXATTR:
@@ -1888,3 +1879,204 @@ out:
return ret;
}
+
+void
+client_compound_rsp_cleanup (gfs3_compound_rsp *rsp, int len)
+{
+ int i = 0;
+ compound_rsp *this_rsp = NULL;
+
+ for (i = 0; i < len; i++) {
+ this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];
+ switch (this_rsp->fop_enum) {
+ case GF_FOP_STAT:
+ CLIENT_FOP_RSP_CLEANUP (rsp, stat, i);
+ break;
+ case GF_FOP_MKNOD:
+ CLIENT_FOP_RSP_CLEANUP (rsp, mknod, i);
+ break;
+ case GF_FOP_MKDIR:
+ CLIENT_FOP_RSP_CLEANUP (rsp, mkdir, i);
+ break;
+ case GF_FOP_UNLINK:
+ CLIENT_FOP_RSP_CLEANUP (rsp, unlink, i);
+ break;
+ case GF_FOP_RMDIR:
+ CLIENT_FOP_RSP_CLEANUP (rsp, rmdir, i);
+ break;
+ case GF_FOP_SYMLINK:
+ CLIENT_FOP_RSP_CLEANUP (rsp, symlink, i);
+ break;
+ case GF_FOP_RENAME:
+ CLIENT_FOP_RSP_CLEANUP (rsp, rename, i);
+ break;
+ case GF_FOP_LINK:
+ CLIENT_FOP_RSP_CLEANUP (rsp, link, i);
+ break;
+ case GF_FOP_TRUNCATE:
+ CLIENT_FOP_RSP_CLEANUP (rsp, truncate, i);
+ break;
+ case GF_FOP_OPEN:
+ CLIENT_FOP_RSP_CLEANUP (rsp, open, i);
+ break;
+ case GF_FOP_READ:
+ CLIENT_FOP_RSP_CLEANUP (rsp, read, i);
+ break;
+ case GF_FOP_WRITE:
+ CLIENT_FOP_RSP_CLEANUP (rsp, write, i);
+ break;
+ case GF_FOP_STATFS:
+ CLIENT_FOP_RSP_CLEANUP (rsp, statfs, i);
+ break;
+ case GF_FOP_FSYNC:
+ CLIENT_FOP_RSP_CLEANUP (rsp, fsync, i);
+ break;
+ case GF_FOP_OPENDIR:
+ CLIENT_FOP_RSP_CLEANUP (rsp, opendir, i);
+ break;
+ case GF_FOP_CREATE:
+ CLIENT_FOP_RSP_CLEANUP (rsp, create, i);
+ break;
+ case GF_FOP_FTRUNCATE:
+ CLIENT_FOP_RSP_CLEANUP (rsp, ftruncate, i);
+ break;
+ case GF_FOP_FSTAT:
+ CLIENT_FOP_RSP_CLEANUP (rsp, fstat, i);
+ break;
+ case GF_FOP_LK:
+ CLIENT_FOP_RSP_CLEANUP (rsp, lk, i);
+ break;
+ case GF_FOP_LOOKUP:
+ CLIENT_FOP_RSP_CLEANUP (rsp, lookup, i);
+ break;
+ case GF_FOP_SETATTR:
+ CLIENT_FOP_RSP_CLEANUP (rsp, setattr, i);
+ break;
+ case GF_FOP_FSETATTR:
+ CLIENT_FOP_RSP_CLEANUP (rsp, fsetattr, i);
+ break;
+ case GF_FOP_FALLOCATE:
+ CLIENT_FOP_RSP_CLEANUP (rsp, fallocate, i);
+ break;
+ case GF_FOP_DISCARD:
+ CLIENT_FOP_RSP_CLEANUP (rsp, discard, i);
+ break;
+ case GF_FOP_ZEROFILL:
+ CLIENT_FOP_RSP_CLEANUP (rsp, zerofill, i);
+ break;
+ case GF_FOP_IPC:
+ CLIENT_FOP_RSP_CLEANUP (rsp, ipc, i);
+ break;
+ case GF_FOP_SEEK:
+ CLIENT_FOP_RSP_CLEANUP (rsp, seek, i);
+ break;
+ case GF_FOP_LEASE:
+ CLIENT_FOP_RSP_CLEANUP (rsp, lease, i);
+ break;
+ /* fops that use gf_common_rsp */
+ case GF_FOP_FLUSH:
+ CLIENT_COMMON_RSP_CLEANUP (rsp, flush, i);
+ break;
+ case GF_FOP_SETXATTR:
+ CLIENT_COMMON_RSP_CLEANUP (rsp, setxattr, i);
+ break;
+ case GF_FOP_REMOVEXATTR:
+ CLIENT_COMMON_RSP_CLEANUP (rsp, removexattr, i);
+ break;
+ case GF_FOP_FSETXATTR:
+ CLIENT_COMMON_RSP_CLEANUP (rsp, fsetxattr, i);
+ break;
+ case GF_FOP_FREMOVEXATTR:
+ CLIENT_COMMON_RSP_CLEANUP (rsp, fremovexattr, i);
+ break;
+ case GF_FOP_FSYNCDIR:
+ CLIENT_COMMON_RSP_CLEANUP (rsp, fsyncdir, i);
+ break;
+ case GF_FOP_ACCESS:
+ CLIENT_COMMON_RSP_CLEANUP (rsp, access, i);
+ break;
+ case GF_FOP_INODELK:
+ CLIENT_COMMON_RSP_CLEANUP (rsp, inodelk, i);
+ break;
+ case GF_FOP_FINODELK:
+ CLIENT_COMMON_RSP_CLEANUP (rsp, finodelk, i);
+ break;
+ case GF_FOP_ENTRYLK:
+ CLIENT_COMMON_RSP_CLEANUP (rsp, entrylk, i);
+ break;
+ case GF_FOP_FENTRYLK:
+ CLIENT_COMMON_RSP_CLEANUP (rsp, fentrylk, i);
+ break;
+ /* fops that need extra cleanup */
+ case GF_FOP_READLINK:
+ {
+ CLIENT_FOP_RSP_CLEANUP (rsp, readlink, i);
+ gfs3_readlink_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
+ readlink);
+ free (tmp_rsp->path);
+ break;
+ }
+ case GF_FOP_XATTROP:
+ {
+ gfs3_xattrop_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
+ xattrop);
+ CLIENT_FOP_RSP_CLEANUP (rsp, xattrop, i);
+ free (tmp_rsp->dict.dict_val);
+ break;
+ }
+ case GF_FOP_FXATTROP:
+ {
+ gfs3_fxattrop_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
+ fxattrop);
+ CLIENT_FOP_RSP_CLEANUP (rsp, fxattrop, i);
+ free (tmp_rsp->dict.dict_val);
+ break;
+ }
+ case GF_FOP_READDIR:
+ {
+ CLIENT_FOP_RSP_CLEANUP (rsp, readdir, i);
+ gfs3_readdir_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
+ readdir);
+ clnt_readdir_rsp_cleanup (tmp_rsp);
+ break;
+ }
+ case GF_FOP_READDIRP:
+ {
+ CLIENT_FOP_RSP_CLEANUP (rsp, readdirp, i);
+ gfs3_readdirp_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
+ readdirp);
+ clnt_readdirp_rsp_cleanup (tmp_rsp);
+ break;
+ }
+ case GF_FOP_GETXATTR:
+ {
+ gfs3_getxattr_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
+ getxattr);
+ CLIENT_FOP_RSP_CLEANUP (rsp, getxattr, i);
+ free (tmp_rsp->dict.dict_val);
+ break;
+ }
+ case GF_FOP_FGETXATTR:
+ {
+ gfs3_fgetxattr_rsp *tmp_rsp = &CPD_RSP_FIELD(this_rsp,
+ fgetxattr);
+ CLIENT_FOP_RSP_CLEANUP (rsp, fgetxattr, i);
+ free (tmp_rsp->dict.dict_val);
+ break;
+ }
+ case GF_FOP_RCHECKSUM:
+ {
+ gfs3_rchecksum_rsp *rck = &CPD_RSP_FIELD(this_rsp,
+ rchecksum);
+ CLIENT_FOP_RSP_CLEANUP (rsp, rchecksum, i);
+ if (rck->strong_checksum.strong_checksum_val) {
+ free (rck->strong_checksum.strong_checksum_val);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ return;
+}
diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c
index b26c4946d7f..c122941cf4e 100644
--- a/xlators/protocol/client/src/client-rpc-fops.c
+++ b/xlators/protocol/client/src/client-rpc-fops.c
@@ -16,6 +16,7 @@
#include "client-messages.h"
#include "defaults.h"
#include "client-common.h"
+#include "compound-fop-utils.h"
int32_t client3_getspec (call_frame_t *frame, xlator_t *this, void *data);
rpc_clnt_prog_t clnt3_3_fop_prog;
@@ -3161,12 +3162,12 @@ client3_3_compound_cbk (struct rpc_req *req, struct iovec *iov, int count,
gfs3_compound_rsp rsp = {0,};
compound_args_cbk_t *args_cbk = NULL;
call_frame_t *frame = NULL;
- int ret = -1;
xlator_t *this = NULL;
dict_t *xdata = NULL;
clnt_local_t *local = NULL;
int op_errno = 0;
int i,length = 0;
+ int ret = -1;
this = THIS;
@@ -3186,55 +3187,40 @@ client3_3_compound_cbk (struct rpc_req *req, struct iovec *iov, int count,
goto out;
}
- args_cbk = GF_CALLOC (1, sizeof (compound_args_cbk_t), gf_mt_compound_rsp_t);
- if (!args_cbk) {
- op_errno = ENOMEM;
- goto out;
- }
+ GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),
+ (rsp.xdata.xdata_len), rsp.op_ret,
+ rsp.op_errno, out);
- length = args_cbk->fop_length = local->length;
+ length = local->length;
- args_cbk->rsp_list = GF_CALLOC (length, sizeof (default_args_cbk_t),
- gf_mt_default_args_cbk_t);
- if (!args_cbk->rsp_list) {
+ args_cbk = compound_args_cbk_alloc (length, xdata);
+ if (!args_cbk) {
op_errno = ENOMEM;
goto out;
}
- op_errno = rsp.op_errno;
-
for (i = 0; i < args_cbk->fop_length; i++) {
ret = client_process_response (frame, this, req, &rsp,
args_cbk, i);
if (ret) {
op_errno = -ret;
- ret = -1;
goto out;
}
}
-
- GF_PROTOCOL_DICT_UNSERIALIZE (this, xdata, (rsp.xdata.xdata_val),
- (rsp.xdata.xdata_len), ret,
- rsp.op_errno, out);
-
- ret = 0;
+ rsp.op_ret = 0;
out:
- CLIENT_STACK_UNWIND (compound, frame, ret,
- gf_error_to_errno (op_errno), args_cbk, xdata);
+ CLIENT_STACK_UNWIND (compound, frame, rsp.op_ret,
+ gf_error_to_errno (rsp.op_errno), args_cbk, xdata);
free (rsp.xdata.xdata_val);
+ client_compound_rsp_cleanup (&rsp, local->length);
+
if (xdata)
dict_unref (xdata);
- if (args_cbk->rsp_list) {
- for (i = 0; i < length; i++) {
- args_cbk_wipe (&args_cbk->rsp_list[i]);
- }
- }
- GF_FREE (args_cbk->rsp_list);
- GF_FREE (args_cbk);
+ compound_args_cbk_cleanup (args_cbk);
return 0;
}
@@ -6131,7 +6117,6 @@ client3_3_compound (call_frame_t *frame, xlator_t *this, void *data)
struct iobuf *rsphdr_iobuf = NULL;
int rsphdr_count = 0;
int req_count = 0;
- int index = 0;
dict_t *xdata = c_args->xdata;
GF_ASSERT (frame);
@@ -6171,13 +6156,11 @@ client3_3_compound (call_frame_t *frame, xlator_t *this, void *data)
rsphdr->iov_base = iobuf_ptr (rsphdr_iobuf);
rsphdr->iov_len = iobuf_pagesize (rsphdr_iobuf);
rsphdr_count = 1;
- local->iobref = rsp_iobref;
rsphdr_iobuf = NULL;
rsphdr_iobref = NULL;
req.compound_fop_enum = c_args->fop_enum;
req.compound_req_array.compound_req_array_len = c_args->fop_length;
- /*TODO : Talk to Sowmya about this */
req.compound_version = 0;
if (xdata) {
GF_PROTOCOL_DICT_SERIALIZE (this, xdata,
@@ -6198,29 +6181,28 @@ client3_3_compound (call_frame_t *frame, xlator_t *this, void *data)
for (i = 0; i < local->length; i++) {
ret = client_handle_fop_requirements (this, frame,
&req, local,
- req_iobref, rsp_iobref,
+ &req_iobref, &rsp_iobref,
req_vector,
rsp_vector, &req_count,
&rsp_count,
&c_args->req_list[i],
c_args->enum_list[i],
- index);
+ i);
if (ret) {
op_errno = ret;
goto unwind;
}
- index++;
}
- local->iobref2 = rsp_iobref;
+ local->iobref = rsp_iobref;
rsp_iobref = NULL;
ret = client_submit_compound_request (this, &req, frame, conf->fops,
GFS3_OP_COMPOUND, client3_3_compound_cbk,
- req_vector, req_count, local->iobref,
+ req_vector, req_count, req_iobref,
rsphdr, rsphdr_count,
rsp_vector, rsp_count,
- local->iobref2,
+ local->iobref,
(xdrproc_t) xdr_gfs3_compound_req);
GF_FREE (req.xdata.xdata_val);
diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h
index 61409d1fc79..f7453bedc47 100644
--- a/xlators/protocol/client/src/client.h
+++ b/xlators/protocol/client/src/client.h
@@ -89,6 +89,24 @@ typedef enum {
GF_FREE (_req->xdata.xdata_val); \
} while (0)
+#define CLIENT_COMMON_RSP_CLEANUP(rsp, fop, i) \
+ do { \
+ compound_rsp *this_rsp = NULL; \
+ this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];\
+ gf_common_rsp *_this_rsp = &CPD_RSP_FIELD (this_rsp, fop); \
+ \
+ free (_this_rsp->xdata.xdata_val); \
+ } while (0)
+
+#define CLIENT_FOP_RSP_CLEANUP(rsp, fop, i) \
+ do { \
+ compound_rsp *this_rsp = NULL; \
+ this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];\
+ gfs3_##fop##_rsp *_this_rsp = &CPD_RSP_FIELD (this_rsp, fop); \
+ \
+ free (_this_rsp->xdata.xdata_val); \
+ } while (0)
+
#define CLIENT_GET_REMOTE_FD(xl, fd, flags, remote_fd, op_errno, label) \
do { \
int _ret = 0; \
@@ -233,7 +251,6 @@ typedef struct client_local {
char *name;
gf_boolean_t attempt_reopen;
/* required for compound fops */
- struct iobref *iobref2;
compound_args_t *compound_args;
unsigned int length; /* length of a compound fop */
unsigned int read_length; /* defines the last processed length for a compound read */
@@ -353,8 +370,8 @@ int
client_handle_fop_requirements (xlator_t *this, call_frame_t *frame,
gfs3_compound_req *req,
clnt_local_t *local,
- struct iobref *req_iobref,
- struct iobref *rsp_iobref,
+ struct iobref **req_iobref,
+ struct iobref **rsp_iobref,
struct iovec *req_vector,
struct iovec *rsp_vector, int *req_count,
int *rsp_count, default_args_t *args,
@@ -380,4 +397,6 @@ int
serialize_req_locklist (lock_migration_info_t *locklist,
gfs3_setactivelk_req *req);
+void
+client_compound_rsp_cleanup (gfs3_compound_rsp *rsp, int len);
#endif /* !_CLIENT_H */