diff options
author | Raghavendra G <raghavendra@gluster.com> | 2011-02-23 09:34:30 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2011-02-28 23:40:36 -0800 |
commit | 46c69ec62db97c52c5e8e42e23cf440f742e033e (patch) | |
tree | 425ac9d902281cec16fb253fb5c7a72dcd7c0541 /rpc/rpc-lib/src | |
parent | c46f85b026a1d0ad90f7be0efa4cd380962a1741 (diff) |
rpcsvc: Handle more than one payload vectors.
- fops like write can recieve payload data in more than one vector. This can
happen with write-behind being loaded on client side.
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 2454 (rdma data corruption)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2454
Diffstat (limited to 'rpc/rpc-lib/src')
-rw-r--r-- | rpc/rpc-lib/src/rpc-transport.c | 2 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpcsvc.c | 6 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpcsvc.h | 6 |
3 files changed, 11 insertions, 3 deletions
diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c index 61e31e9038e..e7ffb065ff6 100644 --- a/rpc/rpc-lib/src/rpc-transport.c +++ b/rpc/rpc-lib/src/rpc-transport.c @@ -537,7 +537,7 @@ rpc_transport_pollin_alloc (rpc_transport_t *this, struct iovec *vector, goto out; } - if (count == 2) { + if (count > 1) { msg->vectored = 1; } diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c index 3d6375aa469..0f198e54f33 100644 --- a/rpc/rpc-lib/src/rpcsvc.c +++ b/rpc/rpc-lib/src/rpcsvc.c @@ -800,6 +800,8 @@ rpcsvc_request_init (rpcsvc_t *svc, rpc_transport_t *trans, struct iovec progmsg, rpc_transport_pollin_t *msg, rpcsvc_request_t *req) { + int i = 0; + if ((!trans) || (!callmsg)|| (!req) || (!msg)) return NULL; @@ -814,7 +816,9 @@ rpcsvc_request_init (rpcsvc_t *svc, rpc_transport_t *trans, req->msg[0] = progmsg; req->iobref = iobref_ref (msg->iobref); if (msg->vectored) { - req->msg[1] = msg->vector[1]; + for (i = 1; i < msg->count; i++) { + req->msg[i] = msg->vector[i]; + } } req->svc = svc; diff --git a/rpc/rpc-lib/src/rpcsvc.h b/rpc/rpc-lib/src/rpcsvc.h index 98de7fcae9d..8625600db13 100644 --- a/rpc/rpc-lib/src/rpcsvc.h +++ b/rpc/rpc-lib/src/rpcsvc.h @@ -46,6 +46,10 @@ #define NGRPS 16 #endif /* !NGRPS */ +#ifndef MAX_IOVEC +#define MAX_IOVEC 16 +#endif + #define GF_RPCSVC "rpc-service" #define RPCSVC_THREAD_STACK_SIZE ((size_t)(1024 * GF_UNIT_KB)) @@ -193,7 +197,7 @@ struct rpcsvc_request { * by the program actors. This is the buffer that will need to * be de-xdred by the actor. */ - struct iovec msg[2]; + struct iovec msg[MAX_IOVEC]; int count; struct iobref *iobref; |