]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
sunrpc: set the bv_offset of first bvec in svc_tcp_sendmsg
authorJeff Layton <jlayton@kernel.org>
Mon, 14 Aug 2023 17:36:54 +0000 (13:36 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 14 Aug 2023 19:02:25 +0000 (15:02 -0400)
svc_tcp_sendmsg used to factor in the xdr->page_base when sending pages,
but commit 5df5dd03a8f7 ("sunrpc: Use sendmsg(MSG_SPLICE_PAGES) rather
then sendpage") dropped that part of the handling. Fix it by setting
the bv_offset of the first bvec.

Fixes: 5df5dd03a8f7 ("sunrpc: Use sendmsg(MSG_SPLICE_PAGES) rather then sendpage")
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
net/sunrpc/svcsock.c

index e43f2638241149728ff9dce43469609b5fcb8129..2eb8df44f894d7e91240382dfc83fac1b1250dde 100644 (file)
@@ -1244,6 +1244,9 @@ static int svc_tcp_sendmsg(struct socket *sock, struct xdr_buf *xdr,
        if (ret != head->iov_len)
                goto out;
 
+       if (xdr_buf_pagecount(xdr))
+               xdr->bvec[0].bv_offset = offset_in_page(xdr->page_base);
+
        msg.msg_flags = MSG_SPLICE_PAGES;
        iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, xdr->bvec,
                      xdr_buf_pagecount(xdr), xdr->page_len);