Commit b76a5afd authored by Trond Myklebust's avatar Trond Myklebust

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: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 26781eab
...@@ -376,8 +376,8 @@ static ssize_t ...@@ -376,8 +376,8 @@ static ssize_t
xs_read_discard(struct socket *sock, struct msghdr *msg, int flags, xs_read_discard(struct socket *sock, struct msghdr *msg, int flags,
size_t count) size_t count)
{ {
struct kvec kvec = { 0 }; iov_iter_discard(&msg->msg_iter, READ, count);
return xs_read_kvec(sock, msg, flags | MSG_TRUNC, &kvec, count, 0); return sock_recvmsg(sock, msg, flags);
} }
static ssize_t static ssize_t
...@@ -616,6 +616,7 @@ xs_read_stream(struct sock_xprt *transport, int flags) ...@@ -616,6 +616,7 @@ xs_read_stream(struct sock_xprt *transport, int flags)
if (transport->recv.offset < transport->recv.len) { if (transport->recv.offset < transport->recv.len) {
if (!(msg.msg_flags & MSG_TRUNC)) if (!(msg.msg_flags & MSG_TRUNC))
return read; return read;
msg.msg_flags = 0;
ret = xs_read_discard(transport->sock, &msg, flags, ret = xs_read_discard(transport->sock, &msg, flags,
transport->recv.len - transport->recv.offset); transport->recv.len - transport->recv.offset);
if (ret <= 0) if (ret <= 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment