diff mbox series

[v2] sunrpc: set the bv_offset of first bvec in svc_tcp_sendmsg

Message ID 20230814-sendpage-v2-1-f56d1a25926c@kernel.org (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series [v2] sunrpc: set the bv_offset of first bvec in svc_tcp_sendmsg | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1330 this patch: 1330
netdev/cc_maintainers success CCed 15 of 15 maintainers
netdev/build_clang success Errors and warnings before: 1355 this patch: 1355
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1353 this patch: 1353
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jeff Layton Aug. 14, 2023, 5:36 p.m. UTC
svc_tcp_sendmsg used to factor in the xdr->page_base when sending pages,
but 5df5dd03a8f7 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>
---
Changes in v2:
- limit the change to just svc_tcp_sendmsg
---
 net/sunrpc/svcsock.c | 3 +++
 1 file changed, 3 insertions(+)


---
base-commit: 2ccdd1b13c591d306f0401d98dedc4bdcd02b421
change-id: 20230814-sendpage-b04874eed249

Best regards,

Comments

Chuck Lever Aug. 14, 2023, 6:59 p.m. UTC | #1
On Mon, Aug 14, 2023 at 01:36:54PM -0400, Jeff Layton wrote:
> svc_tcp_sendmsg used to factor in the xdr->page_base when sending pages,
> but 5df5dd03a8f7 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>

LGTM. However, nfsd-fixes does not have 5df5dd03a8f7 because the
previous nfsd-next was merged into v6.5 before David's
MSG_SPLICE_PAGES work was merged.

Unless someone has a better suggestion, I'll rebase nfsd-fixes to
v6.5-r6 and apply this fix to send to Linus.


> ---
> Changes in v2:
> - limit the change to just svc_tcp_sendmsg
> ---
>  net/sunrpc/svcsock.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
> index e43f26382411..2eb8df44f894 100644
> --- a/net/sunrpc/svcsock.c
> +++ b/net/sunrpc/svcsock.c
> @@ -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);
> 
> ---
> base-commit: 2ccdd1b13c591d306f0401d98dedc4bdcd02b421
> change-id: 20230814-sendpage-b04874eed249
> 
> Best regards,
> -- 
> Jeff Layton <jlayton@kernel.org>
>
Jeff Layton Aug. 14, 2023, 7:11 p.m. UTC | #2
On Mon, 2023-08-14 at 14:59 -0400, Chuck Lever wrote:
> On Mon, Aug 14, 2023 at 01:36:54PM -0400, Jeff Layton wrote:
> > svc_tcp_sendmsg used to factor in the xdr->page_base when sending pages,
> > but 5df5dd03a8f7 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>
> 
> LGTM. However, nfsd-fixes does not have 5df5dd03a8f7 because the
> previous nfsd-next was merged into v6.5 before David's
> MSG_SPLICE_PAGES work was merged.
> 
> Unless someone has a better suggestion, I'll rebase nfsd-fixes to
> v6.5-r6 and apply this fix to send to Linus.
> 

ACK. That's probably safer than trying to pull in the big rework at the
last minute.


> 
> > ---
> > Changes in v2:
> > - limit the change to just svc_tcp_sendmsg
> > ---
> >  net/sunrpc/svcsock.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
> > index e43f26382411..2eb8df44f894 100644
> > --- a/net/sunrpc/svcsock.c
> > +++ b/net/sunrpc/svcsock.c
> > @@ -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);
> > 
> > ---
> > base-commit: 2ccdd1b13c591d306f0401d98dedc4bdcd02b421
> > change-id: 20230814-sendpage-b04874eed249
> > 
> > Best regards,
> > -- 
> > Jeff Layton <jlayton@kernel.org>
> > 
>
diff mbox series

Patch

diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index e43f26382411..2eb8df44f894 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -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);