The patch closes the race by performing the PageWriteback test inside
PageLocked.
Testing PageWriteback inside PageLocked is "definitive" - when a page
is locked, writeback cannot start against it.
filemap.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
--- 2.5.24/mm/filemap.c~invalidate-race Thu Jul 4 16:17:32 2002
+++ 2.5.24-akpm/mm/filemap.c Thu Jul 4 16:17:32 2002
@@ -367,16 +367,18 @@ static int invalidate_list_pages2(struct
while (curr != head) {
page = list_entry(curr, struct page, list);
- if (PageWriteback(page)) {
- write_unlock(&mapping->page_lock);
- wait_on_page_writeback(page);
- unlocked = 1;
- write_lock(&mapping->page_lock);
- goto restart;
- }
if (!TestSetPageLocked(page)) {
int __unlocked;
+ if (PageWriteback(page)) {
+ write_unlock(&mapping->page_lock);
+ wait_on_page_writeback(page);
+ unlocked = 1;
+ write_lock(&mapping->page_lock);
+ unlock_page(page);
+ goto restart;
+ }
+
__unlocked = invalidate_this_page2(mapping, page, curr, head);
unlock_page(page);
unlocked |= __unlocked;
-
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/