[rds-devel] [PATCH] Fix a bug in setting up memory ranges
Olaf Kirch
olaf.kirch at oracle.com
Mon Jan 7 00:20:17 PST 2008
Hi Rick,
On Saturday 05 January 2008 03:30, Richard Frank wrote:
> The issue with sg_set_page - is that the use of the macro is referencing
> the sg->offset field before it is set !
>
> So I put back the old sg->page,offset,length set up to test with - and
> it works - need to go back and fix the sg_set_page to do the right thing.
Using sg_set_page is a must, otherwise the code won't compile on newer
kernels.
Here's an alternative patch - can you confirm it works for you?
Olaf
--
Olaf Kirch | --- o --- Nous sommes du soleil we love when we play
okir at lst.de | / | \ sol.dhoop.naytheet.ah kin.ir.samse.qurax
------------------
From: Olaf Kirch <olaf.kirch at oracle.com>
Subject: [RDS] Fix a bug in setting up memory ranges
Rick Frank discovered a bug I introduced when converting the RDMA
code to use scatterlist acessors. In rds_get_mr, we use sg->offset
before initializing it. This patch should fix this.
Signed-off-by: Olaf Kirch <olaf.kirch at oracle.com>
---
net/rds/rdma.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Index: ofa-kernel-1.3/net/rds/rdma.c
===================================================================
--- ofa-kernel-1.3.orig/net/rds/rdma.c
+++ ofa-kernel-1.3/net/rds/rdma.c
@@ -263,10 +263,12 @@ int rds_get_mr(struct rds_sock *rs, char
mr->r_nents = ret;
for (i = 0 ; i < mr->r_nents; i++) {
+ unsigned int offset = args.vec.addr & ~PAGE_MASK;
+
sg = &mr->r_sg[i];
sg_set_page(sg, pages[i],
- min_t(unsigned int, args.vec.bytes, PAGE_SIZE - sg->offset),
- args.vec.addr & ~PAGE_MASK);
+ min_t(unsigned int, args.vec.bytes, offset),
+ PAGE_SIZE - offset);
args.vec.addr += sg->length;
args.vec.bytes -= sg->length;
More information about the rds-devel
mailing list