summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2013-11-25 10:28:56 -0800
committerAnand Avati <avati@redhat.com>2013-11-26 10:31:04 -0800
commit9da4958b7853f36a137c80493bec932b79d85e84 (patch)
tree0a8be5b7c73a859b711abd34e68a30ea2ec61a7c /rpc
parent9f793d70bab528e96daf3478261aeb32b2ae5523 (diff)
socket: limit vector count to IOV_MAX
IOV_MAX is the maximum supported vector count on a given platform. Limit the count to IOV_MAX if higher. As we are performing non-blocking IO getting a smaller return value is handled naturally. Change-Id: I94ef67a03ed0e10da67a776af2b55506bf721611 BUG: 1034398 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.org/6354 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@gmail.com>
Diffstat (limited to 'rpc')
-rw-r--r--rpc/rpc-transport/socket/src/socket.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
index 93da3f2..f9df4ac 100644
--- a/rpc/rpc-transport/socket/src/socket.c
+++ b/rpc/rpc-transport/socket/src/socket.c
@@ -327,7 +327,7 @@ __socket_ssl_readv (rpc_transport_t *this, struct iovec *opvector, int opcount)
if (priv->use_ssl) {
ret = ssl_read_one (this, opvector->iov_base, opvector->iov_len);
} else {
- ret = readv (sock, opvector, opcount);
+ ret = readv (sock, opvector, IOV_MIN(opcount));
}
return ret;
@@ -477,7 +477,7 @@ __socket_rwv (rpc_transport_t *this, struct iovec *vector, int count,
opvector->iov_base, opvector->iov_len);
}
else {
- ret = writev (sock, opvector, opcount);
+ ret = writev (sock, opvector, IOV_MIN(opcount));
}
if (ret == 0 || (ret == -1 && errno == EAGAIN)) {