This is a note to let you know that I've just added the patch titled

    FS-Cache: Fix __fscache_uncache_all_inode_pages()'s outer

to the 2.6.39-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     fs-cache-fix-__fscache_uncache_all_inode_pages-s-outer.patch
and it can be found in the queue-2.6.39 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From b307d4655a71749ac3f91c6dbe33d28cc026ceeb Mon Sep 17 00:00:00 2001
From: Jan Beulich <[email protected]>
Date: Thu, 21 Jul 2011 15:02:43 +0100
Subject: FS-Cache: Fix __fscache_uncache_all_inode_pages()'s outer
 loop

From: Jan Beulich <[email protected]>

commit b307d4655a71749ac3f91c6dbe33d28cc026ceeb upstream.

The compiler, at least for ix86 and m68k, validly warns that the
comparison:

        next <= (loff_t)-1

is always true (and it's always true also for x86-64 and probably all
other arches - as long as pgoff_t isn't wider than loff_t).  The
intention appears to be to avoid wrapping of "next", so rather than
eliminating the pointless comparison, fix the loop to indeed get exited
when "next" would otherwise wrap.

On m68k the following warning is observed:

  fs/fscache/page.c: In function '__fscache_uncache_all_inode_pages':
  fs/fscache/page.c:979: warning: comparison is always false due to limited 
range of data type

Reported-by: Geert Uytterhoeven <[email protected]>
Reported-by: Jan Beulich <[email protected]>
Signed-off-by: Jan Beulich <[email protected]>
Signed-off-by: David Howells <[email protected]>
Cc: Suresh Jayaraman <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

diff --git a/fs/fscache/page.c b/fs/fscache/page.c
index 2f343b4..3f7a59b 100644
--- a/fs/fscache/page.c
+++ b/fs/fscache/page.c
@@ -976,16 +976,12 @@ void __fscache_uncache_all_inode_pages(struct 
fscache_cookie *cookie,
 
        pagevec_init(&pvec, 0);
        next = 0;
-       while (next <= (loff_t)-1 &&
-              pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)
-              ) {
+       do {
+               if (!pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE))
+                       break;
                for (i = 0; i < pagevec_count(&pvec); i++) {
                        struct page *page = pvec.pages[i];
-                       pgoff_t page_index = page->index;
-
-                       ASSERTCMP(page_index, >=, next);
-                       next = page_index + 1;
-
+                       next = page->index;
                        if (PageFsCache(page)) {
                                __fscache_wait_on_page_write(cookie, page);
                                __fscache_uncache_page(cookie, page);
@@ -993,7 +989,7 @@ void __fscache_uncache_all_inode_pages(struct 
fscache_cookie *cookie,
                }
                pagevec_release(&pvec);
                cond_resched();
-       }
+       } while (++next);
 
        _leave("");
 }


Patches currently in stable-queue which might be from [email protected] are

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to