diff mbox series

[v2] svcrdma: fix bounce buffers for unaligned offsets and multiple pages

Message ID 20201002193343.1040351-1-dan@kernelim.com
State New
Headers show
Series [v2] svcrdma: fix bounce buffers for unaligned offsets and multiple pages | expand

Commit Message

Dan Aloni Oct. 2, 2020, 7:33 p.m. UTC
This was discovered using O_DIRECT at the client side, with small
unaligned file offsets or IOs that span multiple file pages.

Fixes: e248aa7be86 ("svcrdma: Remove max_sge check at connect time")
Signed-off-by: Dan Aloni <dan@kernelim.com>
---
 net/sunrpc/xprtrdma/svc_rdma_sendto.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Extended testing found another issue with the loop.

Comments

bfields@fieldses.org Oct. 14, 2020, 9:26 p.m. UTC | #1
Thanks, applying for 5.10.--b.

On Fri, Oct 02, 2020 at 10:33:43PM +0300, Dan Aloni wrote:
> This was discovered using O_DIRECT at the client side, with small
> unaligned file offsets or IOs that span multiple file pages.
> 
> Fixes: e248aa7be86 ("svcrdma: Remove max_sge check at connect time")
> Signed-off-by: Dan Aloni <dan@kernelim.com>
> ---
>  net/sunrpc/xprtrdma/svc_rdma_sendto.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> Extended testing found another issue with the loop.
> 
> diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
> index 7b94d971feb3..c3d588b149aa 100644
> --- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c
> +++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
> @@ -638,10 +638,11 @@ static int svc_rdma_pull_up_reply_msg(struct svcxprt_rdma *rdma,
>  		while (remaining) {
>  			len = min_t(u32, PAGE_SIZE - pageoff, remaining);
>  
> -			memcpy(dst, page_address(*ppages), len);
> +			memcpy(dst, page_address(*ppages) + pageoff, len);
>  			remaining -= len;
>  			dst += len;
>  			pageoff = 0;
> +			ppages++;
>  		}
>  	}
>  
> -- 
> 2.26.2
diff mbox series

Patch

diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
index 7b94d971feb3..c3d588b149aa 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
@@ -638,10 +638,11 @@  static int svc_rdma_pull_up_reply_msg(struct svcxprt_rdma *rdma,
 		while (remaining) {
 			len = min_t(u32, PAGE_SIZE - pageoff, remaining);
 
-			memcpy(dst, page_address(*ppages), len);
+			memcpy(dst, page_address(*ppages) + pageoff, len);
 			remaining -= len;
 			dst += len;
 			pageoff = 0;
+			ppages++;
 		}
 	}