Skip to contentSkip to conversation

SGI 954233: fix fencepost error in _shift_data_right_pages

PATCH In review Greg Banks 2 participants 3 messages Jul 3, 2006 – Jul 4, 2006

Subsystems (3)
lore
Share & tools
lore

Greg Banks

author
#0 lore raw

PATCH 1/1 SGI 954233: fix fencepost error in _shift_data_right_pages

G'day,

This fixes a panic doing the first READDIR or READDIRPLUS call when:

* the client is ia64 or any platform that actually implements flush_dcache_page(), and

* the server returns fsinfo.dtpref >= client's PAGE_SIZE, and

* the server does *not* return post-op attributes for the directory in the READDIR reply.

---

 net/sunrpc/xdr.c |    6 ++++++
 1 files changed, 6 insertions(+)
net/sunrpc/xdr.c +6 -0
Index: linux/net/sunrpc/xdr.c
===================================================================
@@ -188,6 +188,12 @@ _shift_data_right_pages(struct page **pa
 	pgto_base &= ~PAGE_CACHE_MASK;
 	pgfrom_base &= ~PAGE_CACHE_MASK;
 
+	if (pgto_base == 0) {
+		/* don't flush *pgto, it points beyond valid page*'s */
+		pgto_base = PAGE_CACHE_SIZE;
+		pgto--;
+	}
+
 	do {
 		/* Are any pointers crossing a page boundary? */
 		if (pgto_base == 0) {
Signature · 12 lines
Greg Banks, R&D Software Engineer, SGI Australian Software Group.
I don't speak for SGI.



Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist  -  [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
#1 lore raw
Quoted 26 lines · Greg Banks

G'day,

This fixes a panic doing the first READDIR or READDIRPLUS call when:

* the client is ia64 or any platform that actually implements flush_dcache_page(), and

* the server returns fsinfo.dtpref >= client's PAGE_SIZE, and

* the server does *not* return post-op attributes for the directory in the READDIR reply.

---

 net/sunrpc/xdr.c |    6 ++++++
 1 files changed, 6 insertions(+)

Index: linux/net/sunrpc/xdr.c
===================================================================

net/sunrpc/xdr.c +0 -0
@@ -188,6 +188,12 @@ _shift_data_right_pages(struct page **pa
 	pgto_base &= ~PAGE_CACHE_MASK;
 	pgfrom_base &= ~PAGE_CACHE_MASK;

net/sunrpc/xdr.c _shift_data_right_pages(struct page **pa · line 199

Quoted 10 lines
net/sunrpc/xdr.c +6 -0
 
+	if (pgto_base == 0) {
+		/* don't flush *pgto, it points beyond valid page*'s */
+		pgto_base = PAGE_CACHE_SIZE;
+		pgto--;
+	}
+
 	do {
 		/* Are any pointers crossing a page boundary? */
 		if (pgto_base == 0) {

Hmm... It irks me that all architectures should have to check pgto_base twice just because of the few that need the flush_dcache_page() crap. What say we do the following instead?

Cheers,
Trond

commit 34a52114f90d5f9350282b2720b8b8f95de07d4b

Author: Trond Myklebust <[email protected]>
Date:   Mon Jul 3 17:06:42 2006 -0400

This fixes a panic doing the first READDIR or READDIRPLUS call when:

* the client is ia64 or any platform that actually implements flush_dcache_page(), and

* the server returns fsinfo.dtpref >= client's PAGE_SIZE, and

* the server does *not* return post-op attributes for the directory in the READDIR reply.

Problem diagnosed by Greg Banks <[email protected]>

net/sunrpc/xdr.c +1 -2
index 49174f0..6ac4510 100644
@@ -191,7 +191,6 @@ _shift_data_right_pages(struct page **pa
 	do {
 		/* Are any pointers crossing a page boundary? */
 		if (pgto_base == 0) {
-			flush_dcache_page(*pgto);
 			pgto_base = PAGE_CACHE_SIZE;
 			pgto--;
 		}
@@ -211,11 +210,11 @@ _shift_data_right_pages(struct page **pa
 		vto = kmap_atomic(*pgto, KM_USER0);
 		vfrom = kmap_atomic(*pgfrom, KM_USER1);
 		memmove(vto + pgto_base, vfrom + pgfrom_base, copy);
+		flush_dcache_page(*pgto);
 		kunmap_atomic(vfrom, KM_USER1);
 		kunmap_atomic(vto, KM_USER0);
 
 	} while ((len -= copy) != 0);
-	flush_dcache_page(*pgto);
 }
 
 /*

Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

author
#2 lore raw
Quoted 14 lines · Trond Myklebust

On Mon, 2006-07-03 at 13:32 +1000, Greg Banks wrote:

net/sunrpc/xdr.c +0 -1
index 49174f0..6ac4510 100644
@@ -191,7 +191,6 @@ _shift_data_right_pages(struct page **pa
 	do {
 		/* Are any pointers crossing a page boundary? */
 		if (pgto_base == 0) {
-			flush_dcache_page(*pgto);
 			pgto_base = PAGE_CACHE_SIZE;
 			pgto--;
 		}

net/sunrpc/xdr.c _shift_data_right_pages(struct page **pa · line 218

Quoted 10 lines
net/sunrpc/xdr.c +1 -1
@@ -211,11 +210,11 @@ _shift_data_right_pages(struct page **pa
 		vto = kmap_atomic(*pgto, KM_USER0);
 		vfrom = kmap_atomic(*pgfrom, KM_USER1);
 		memmove(vto + pgto_base, vfrom + pgfrom_base, copy);
+		flush_dcache_page(*pgto);
 		kunmap_atomic(vfrom, KM_USER1);
 		kunmap_atomic(vto, KM_USER0);
 
 	} while ((len -= copy) != 0);
-	flush_dcache_page(*pgto);
 }

Sure, that would work and more gracefully too.

Greg.

Signature · 12 lines
Greg Banks, R&D Software Engineer, SGI Australian Software Group.
I don't speak for SGI.



Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist  -  [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs