summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2018-12-03 15:58:58 -0500
committerTrond Myklebust <trond.myklebust@hammerspace.com>2018-12-05 07:11:12 -0500
commitb76a5afdce6c6dacfbd51863b31b3d7cc61ca21e (patch)
tree4ac7143b63ba04f02b3dc2c10ede09553f5540ae /net
parent26781eab48ece79000ffc4e69be402f2524e1137 (diff)
downloadlinux-b76a5afdce6c6dacfbd51863b31b3d7cc61ca21e.tar.bz2
SUNRPC: Use the discard iterator rather than MSG_TRUNC
When discarding message data from the stream, we're better off using the discard iterator, since that will work with non-TCP streams. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/xprtsock.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 86bb502e538a..fc6d129401ba 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -376,8 +376,8 @@ static ssize_t
xs_read_discard(struct socket *sock, struct msghdr *msg, int flags,
size_t count)
{
- struct kvec kvec = { 0 };
- return xs_read_kvec(sock, msg, flags | MSG_TRUNC, &kvec, count, 0);
+ iov_iter_discard(&msg->msg_iter, READ, count);
+ return sock_recvmsg(sock, msg, flags);
}
static ssize_t
@@ -616,6 +616,7 @@ xs_read_stream(struct sock_xprt *transport, int flags)
if (transport->recv.offset < transport->recv.len) {
if (!(msg.msg_flags & MSG_TRUNC))
return read;
+ msg.msg_flags = 0;
ret = xs_read_discard(transport->sock, &msg, flags,
transport->recv.len - transport->recv.offset);
if (ret <= 0)