aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtsock.c
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/sunrpc/xprtsock.c
parent26781eab48ece79000ffc4e69be402f2524e1137 (diff)
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/sunrpc/xprtsock.c')
-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
376xs_read_discard(struct socket *sock, struct msghdr *msg, int flags, 376xs_read_discard(struct socket *sock, struct msghdr *msg, int flags,
377 size_t count) 377 size_t count)
378{ 378{
379 struct kvec kvec = { 0 }; 379 iov_iter_discard(&msg->msg_iter, READ, count);
380 return xs_read_kvec(sock, msg, flags | MSG_TRUNC, &kvec, count, 0); 380 return sock_recvmsg(sock, msg, flags);
381} 381}
382 382
383static ssize_t 383static ssize_t
@@ -616,6 +616,7 @@ xs_read_stream(struct sock_xprt *transport, int flags)
616 if (transport->recv.offset < transport->recv.len) { 616 if (transport->recv.offset < transport->recv.len) {
617 if (!(msg.msg_flags & MSG_TRUNC)) 617 if (!(msg.msg_flags & MSG_TRUNC))
618 return read; 618 return read;
619 msg.msg_flags = 0;
619 ret = xs_read_discard(transport->sock, &msg, flags, 620 ret = xs_read_discard(transport->sock, &msg, flags,
620 transport->recv.len - transport->recv.offset); 621 transport->recv.len - transport->recv.offset);
621 if (ret <= 0) 622 if (ret <= 0)