SUNRPC: Use MSG_SENDPAGE_NOTLAST when calling sendpage()
authorTrond Myklebust <trond.myklebust@primarydata.com>
Wed, 7 Oct 2015 17:54:42 +0000 (13:54 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Fri, 23 Oct 2015 19:57:27 +0000 (15:57 -0400)
If we're sending more pages via kernel_sendpage(), then set
MSG_SENDPAGE_NOTLAST.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
net/sunrpc/svcsock.c
net/sunrpc/xprtsock.c

index 0c8120229a0353967138d20c5fe009a1c6e81d1f..48923730722d6093224faee5af900daae236326a 100644 (file)
@@ -181,7 +181,7 @@ int svc_send_common(struct socket *sock, struct xdr_buf *xdr,
        struct page     **ppage = xdr->pages;
        size_t          base = xdr->page_base;
        unsigned int    pglen = xdr->page_len;
-       unsigned int    flags = MSG_MORE;
+       unsigned int    flags = MSG_MORE | MSG_SENDPAGE_NOTLAST;
        int             slen;
        int             len = 0;
 
index 1a85e0ed0b4841792cd5b6a7d86864cbc2d334a3..f264962a1d8a627bb0cedc7c017ce62a9ef9310f 100644 (file)
@@ -360,8 +360,10 @@ static int xs_send_pagedata(struct socket *sock, struct xdr_buf *xdr, unsigned i
                int flags = XS_SENDMSG_FLAGS;
 
                remainder -= len;
-               if (remainder != 0 || more)
+               if (more)
                        flags |= MSG_MORE;
+               if (remainder != 0)
+                       flags |= MSG_SENDPAGE_NOTLAST | MSG_MORE;
                err = do_sendpage(sock, *ppage, base, len, flags);
                if (remainder == 0 || err != len)
                        break;