netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] SUNRPC: use request size to initialize bio_vec in svc_udp_sendto()
@ 2024-01-17 21:06 Lucas Stach
  2024-01-17 22:03 ` Chuck Lever
  0 siblings, 1 reply; 3+ messages in thread
From: Lucas Stach @ 2024-01-17 21:06 UTC (permalink / raw)
  To: Chuck Lever, Jeff Layton
  Cc: Neil Brown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker, linux-nfs, netdev, kernel,
	patchwork-lst

Use the proper size when setting up the bio_vec, as otherwise only
zero-length UDP packets will be sent.

Fixes: baabf59c2414 ("SUNRPC: Convert svc_udp_sendto() to use the per-socket bio_vec array")
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 net/sunrpc/svcsock.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 998687421fa6..e0ce4276274b 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -717,12 +717,12 @@ static int svc_udp_sendto(struct svc_rqst *rqstp)
 				ARRAY_SIZE(rqstp->rq_bvec), xdr);
 
 	iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, rqstp->rq_bvec,
-		      count, 0);
+		      count, rqstp->rq_res.len);
 	err = sock_sendmsg(svsk->sk_sock, &msg);
 	if (err == -ECONNREFUSED) {
 		/* ICMP error on earlier request. */
 		iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, rqstp->rq_bvec,
-			      count, 0);
+			      count, rqstp->rq_res.len);
 		err = sock_sendmsg(svsk->sk_sock, &msg);
 	}
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] SUNRPC: use request size to initialize bio_vec in svc_udp_sendto()
  2024-01-17 21:06 [PATCH] SUNRPC: use request size to initialize bio_vec in svc_udp_sendto() Lucas Stach
@ 2024-01-17 22:03 ` Chuck Lever
  2024-01-18  8:42   ` Lucas Stach
  0 siblings, 1 reply; 3+ messages in thread
From: Chuck Lever @ 2024-01-17 22:03 UTC (permalink / raw)
  To: Lucas Stach
  Cc: Jeff Layton, Neil Brown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker, linux-nfs, netdev, kernel,
	patchwork-lst

On Wed, Jan 17, 2024 at 10:06:28PM +0100, Lucas Stach wrote:
> Use the proper size when setting up the bio_vec, as otherwise only
> zero-length UDP packets will be sent.
> 
> Fixes: baabf59c2414 ("SUNRPC: Convert svc_udp_sendto() to use the per-socket bio_vec array")
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  net/sunrpc/svcsock.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
> index 998687421fa6..e0ce4276274b 100644
> --- a/net/sunrpc/svcsock.c
> +++ b/net/sunrpc/svcsock.c
> @@ -717,12 +717,12 @@ static int svc_udp_sendto(struct svc_rqst *rqstp)
>  				ARRAY_SIZE(rqstp->rq_bvec), xdr);
>  
>  	iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, rqstp->rq_bvec,
> -		      count, 0);
> +		      count, rqstp->rq_res.len);
>  	err = sock_sendmsg(svsk->sk_sock, &msg);
>  	if (err == -ECONNREFUSED) {
>  		/* ICMP error on earlier request. */
>  		iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, rqstp->rq_bvec,
> -			      count, 0);
> +			      count, rqstp->rq_res.len);
>  		err = sock_sendmsg(svsk->sk_sock, &msg);
>  	}
>  
> -- 
> 2.43.0
> 

I can't fathom why I would have chosen zero for the @count argument.

We currently have zero test coverage for UDP. I'll look into that.

I've applied this to the nfsd-fixes branch. It should appear in
v6.8-rc if I can get it tested.


-- 
Chuck Lever

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] SUNRPC: use request size to initialize bio_vec in svc_udp_sendto()
  2024-01-17 22:03 ` Chuck Lever
@ 2024-01-18  8:42   ` Lucas Stach
  0 siblings, 0 replies; 3+ messages in thread
From: Lucas Stach @ 2024-01-18  8:42 UTC (permalink / raw)
  To: Chuck Lever
  Cc: Jeff Layton, Neil Brown, Olga Kornievskaia, Dai Ngo, Tom Talpey,
	Trond Myklebust, Anna Schumaker, linux-nfs, netdev, kernel,
	patchwork-lst

Am Mittwoch, dem 17.01.2024 um 17:03 -0500 schrieb Chuck Lever:
> On Wed, Jan 17, 2024 at 10:06:28PM +0100, Lucas Stach wrote:
> > Use the proper size when setting up the bio_vec, as otherwise only
> > zero-length UDP packets will be sent.
> > 
> > Fixes: baabf59c2414 ("SUNRPC: Convert svc_udp_sendto() to use the per-socket bio_vec array")
> > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> > ---
> >  net/sunrpc/svcsock.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
> > index 998687421fa6..e0ce4276274b 100644
> > --- a/net/sunrpc/svcsock.c
> > +++ b/net/sunrpc/svcsock.c
> > @@ -717,12 +717,12 @@ static int svc_udp_sendto(struct svc_rqst *rqstp)
> >  				ARRAY_SIZE(rqstp->rq_bvec), xdr);
> >  
> >  	iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, rqstp->rq_bvec,
> > -		      count, 0);
> > +		      count, rqstp->rq_res.len);
> >  	err = sock_sendmsg(svsk->sk_sock, &msg);
> >  	if (err == -ECONNREFUSED) {
> >  		/* ICMP error on earlier request. */
> >  		iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, rqstp->rq_bvec,
> > -			      count, 0);
> > +			      count, rqstp->rq_res.len);
> >  		err = sock_sendmsg(svsk->sk_sock, &msg);
> >  	}
> >  
> > -- 
> > 2.43.0
> > 
> 
> I can't fathom why I would have chosen zero for the @count argument.
> 
> We currently have zero test coverage for UDP. I'll look into that.
> 
> I've applied this to the nfsd-fixes branch. It should appear in
> v6.8-rc if I can get it tested.

Thanks. For what it is worth, this fix didn't come out of pure code
inspection, but fixes a real world setup for me. While I can't claim
that I have any kind of comprehensive testing, this fix has at least
shown to fix the issue introduced in the referenced commit in my setup.

Regards,
Lucas

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-18  8:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-17 21:06 [PATCH] SUNRPC: use request size to initialize bio_vec in svc_udp_sendto() Lucas Stach
2024-01-17 22:03 ` Chuck Lever
2024-01-18  8:42   ` Lucas Stach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).