diff options
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/protocol/client/src/client3_1-fops.c | 15 | ||||
-rw-r--r-- | xlators/protocol/server/src/server3_1-fops.c | 60 |
2 files changed, 68 insertions, 7 deletions
diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c index e17a650d3c4..07d55c8956b 100644 --- a/xlators/protocol/client/src/client3_1-fops.c +++ b/xlators/protocol/client/src/client3_1-fops.c @@ -2693,6 +2693,10 @@ client3_1_readv_cbk (struct rpc_req *req, struct iovec *iov, int count, (rsp.xdata.xdata_len), ret, rsp.op_errno, out); +#ifdef GF_TESTING_IO_XDATA + dict_dump (xdata); +#endif + out: if (rsp.op_ret == -1) { gf_log (this->name, GF_LOG_WARNING, @@ -4010,6 +4014,17 @@ client3_1_writev (call_frame_t *frame, xlator_t *this, void *data) memcpy (req.gfid, args->fd->inode->gfid, 16); +#ifdef GF_TESTING_IO_XDATA + if (!args->xdata) + args->xdata = dict_new (); + + ret = dict_set_str (args->xdata, "testing-the-xdata-key", + "testing-the-xdata-value"); +#endif + + GF_PROTOCOL_DICT_SERIALIZE (this, args->xdata, (&req.xdata.xdata_val), + req.xdata.xdata_len, op_errno, unwind); + ret = client_submit_vec_request (this, &req, frame, conf->fops, GFS3_OP_WRITE, client3_1_writev_cbk, args->vector, args->count, diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c index 2e0bbb4c8cd..06283461d06 100644 --- a/xlators/protocol/server/src/server3_1-fops.c +++ b/xlators/protocol/server/src/server3_1-fops.c @@ -1455,6 +1455,16 @@ server_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, op_ret, strerror (op_errno)); } +#ifdef GF_TESTING_IO_XDATA + { + int ret = 0; + if (!xdata) + xdata = dict_new (); + + ret = dict_set_str (xdata, "testing-the-xdata-key", + "testing-xdata-value"); + } +#endif GF_PROTOCOL_DICT_SERIALIZE (this, xdata, (&rsp.xdata.xdata_val), rsp.xdata.xdata_len, op_errno, out); @@ -3392,6 +3402,10 @@ server_writev (rpcsvc_request_t *req) (args.xdata.xdata_len), ret, op_errno, out); +#ifdef GF_TESTING_IO_XDATA + dict_dump (state->xdata); +#endif + ret = 0; resolve_and_resume (frame, server_writev_resume); out: @@ -3413,26 +3427,58 @@ server_writev_vec (rpcsvc_request_t *req, struct iovec *payload, } #define SERVER3_1_VECWRITE_START 0 -#define SERVER3_1_VECWRITE_READINGHDR 1 +#define SERVER3_1_VECWRITE_READING_HDR 1 +#define SERVER3_1_VECWRITE_READING_OPAQUE 2 int server_writev_vecsizer (int state, ssize_t *readsize, char *addr) { - int nextstate = 0; - gfs3_write_req write_req = {{0,},}; + ssize_t size = 0; + int nextstate = 0; + gfs3_write_req write_req = {{0,},}; + XDR xdr; switch (state) { case SERVER3_1_VECWRITE_START: - *readsize = xdr_sizeof ((xdrproc_t) xdr_gfs3_write_req, &write_req); - nextstate = SERVER3_1_VECWRITE_READINGHDR; + size = xdr_sizeof ((xdrproc_t) xdr_gfs3_write_req, + &write_req); + *readsize = size; + nextstate = SERVER3_1_VECWRITE_READING_HDR; + break; + case SERVER3_1_VECWRITE_READING_HDR: + size = xdr_sizeof ((xdrproc_t) xdr_gfs3_write_req, + &write_req); + + xdrmem_create (&xdr, addr, size, XDR_DECODE); + + /* This will fail if there is xdata sent from client, if not, + well and good */ + xdr_gfs3_write_req (&xdr, &write_req); + + /* need to round off to proper roof (%4), as XDR packing pads + the end of opaque object with '0' */ + size = roof (write_req.xdata.xdata_len, 4); + + *readsize = size; + + if (!size) + nextstate = SERVER3_1_VECWRITE_START; + else + nextstate = SERVER3_1_VECWRITE_READING_OPAQUE; + + if (write_req.xdata.xdata_val) + free (write_req.xdata.xdata_val); + break; - case SERVER3_1_VECWRITE_READINGHDR: + + case SERVER3_1_VECWRITE_READING_OPAQUE: *readsize = 0; nextstate = SERVER3_1_VECWRITE_START; break; default: - gf_log ("server3_1", GF_LOG_ERROR, "wrong state: %d", state); + gf_log ("server", GF_LOG_ERROR, "wrong state: %d", state); } + return nextstate; } |