From: Suparna Bhattacharya

Safeguard to make sure we break out of pagevec_lookup_tag loop if we
are beyond the specified range.


 mpage.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)

--- aio/fs/mpage.c.orig	2004-06-18 14:55:21.937871440 -0700
+++ fix-writepages-range/fs/mpage.c	2004-06-18 14:56:10.739452472 -0700
@@ -636,7 +636,8 @@ mpage_writepages(struct address_space *m
 		scanned = 1;
 	}
 retry:
-	while (!done && (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
+	while (!done && (index <= end) && 
+			(nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
 			PAGECACHE_TAG_DIRTY,
 			min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1))) {
 		unsigned i;
