summaryrefslogtreecommitdiffstats
path: root/xlators/protocol
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2012-05-28 16:55:52 +0530
committerVijay Bellur <vijay@gluster.com>2012-07-03 12:36:30 -0700
commit0c95f6bdb0d934384111aabab0ee2d8980102a50 (patch)
tree6f2d69f40d294dc347cbc7f1cb6132e4bf827772 /xlators/protocol
parentb8fccb47dd43977150ce4c14a1889b2c82917711 (diff)
protocol/client: provide a buffer for storing reply of readlink.
since a readlink response can be bigger than size of rdma-msges that can be inlined, we need to provide a buffer where server can do an rdma-write of response. Change-Id: I6ab06c3a94702f810ab0c57b409aaaf35cc93057 BUG: 822337 Signed-off-by: Raghavendra G <raghavendra@gluster.com> Reviewed-on: http://review.gluster.com/3463 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Tested-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'xlators/protocol')
-rw-r--r--xlators/protocol/client/src/client3_1-fops.c53
1 files changed, 46 insertions, 7 deletions
diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c
index 224a26dc79d..78d2504fb04 100644
--- a/xlators/protocol/client/src/client3_1-fops.c
+++ b/xlators/protocol/client/src/client3_1-fops.c
@@ -3232,11 +3232,17 @@ int32_t
client3_1_readlink (call_frame_t *frame, xlator_t *this,
void *data)
{
- clnt_conf_t *conf = NULL;
- clnt_args_t *args = NULL;
- gfs3_readlink_req req = {{0,},};
- int ret = 0;
- int op_errno = ESTALE;
+ clnt_conf_t *conf = NULL;
+ clnt_args_t *args = NULL;
+ gfs3_readlink_req req = {{0,},};
+ int ret = 0;
+ int op_errno = ESTALE;
+ clnt_local_t *local = NULL;
+ struct iobuf *rsp_iobuf = NULL;
+ struct iobref *rsp_iobref = NULL;
+ struct iovec *rsphdr = NULL;
+ int count = 0;
+ struct iovec vector[MAX_IOVEC] = {{0}, };
if (!frame || !this || !data)
goto unwind;
@@ -3257,14 +3263,43 @@ client3_1_readlink (call_frame_t *frame, xlator_t *this,
req.size = args->size;
conf = this->private;
+ local = mem_get0 (this->local_pool);
+ if (!local) {
+ op_errno = ENOMEM;
+ goto unwind;
+ }
+
+ frame->local = local;
+
GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val),
req.xdata.xdata_len, op_errno, unwind);
+ rsp_iobref = iobref_new ();
+ if (rsp_iobref == NULL) {
+ goto unwind;
+ }
+
+ rsp_iobuf = iobuf_get (this->ctx->iobuf_pool);
+ if (rsp_iobuf == NULL) {
+ goto unwind;
+ }
+
+ iobref_add (rsp_iobref, rsp_iobuf);
+ iobuf_unref (rsp_iobuf);
+ rsphdr = &vector[0];
+ rsphdr->iov_base = iobuf_ptr (rsp_iobuf);
+ rsphdr->iov_len = iobuf_pagesize (rsp_iobuf);
+ count = 1;
+ local->iobref = rsp_iobref;
+ rsp_iobuf = NULL;
+ rsp_iobref = NULL;
+
ret = client_submit_request (this, &req, frame, conf->fops,
GFS3_OP_READLINK,
client3_1_readlink_cbk, NULL,
- NULL, 0, NULL, 0,
- NULL, (xdrproc_t)xdr_gfs3_readlink_req);
+ rsphdr, count, NULL, 0,
+ local->iobref,
+ (xdrproc_t)xdr_gfs3_readlink_req);
if (ret) {
gf_log (this->name, GF_LOG_WARNING, "failed to send the fop");
}
@@ -3274,6 +3309,10 @@ client3_1_readlink (call_frame_t *frame, xlator_t *this,
return 0;
unwind:
+ if (rsp_iobref != NULL) {
+ iobref_unref (rsp_iobref);
+ }
+
CLIENT_STACK_UNWIND (readlink, frame, -1, op_errno, NULL, NULL, NULL);
if (req.xdata.xdata_val)
GF_FREE (req.xdata.xdata_val);