lkml.org 
[lkml]   [2002]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 6/10] Fix SMP race in truncate


Closes a small race window: testing PageWriteback() outside the page
lock introduces the possibility that page could be redirtied and have
writeback started after we've inspected PageWriteback.


=====================================

--- 2.5.13/mm/filemap.c~truncate-race Sun May 5 13:32:00 2002
+++ 2.5.13-akpm/mm/filemap.c Sun May 5 13:32:35 2002
@@ -201,18 +201,18 @@ static int truncate_list_pages(struct ad
int failed;

page_cache_get(page);
- if (PageWriteback(page)) {
- /*
- * urgggh. This function is utterly foul,
- * and this addition doesn't help. Kill.
- */
+ failed = TestSetPageLocked(page);
+ if (!failed && PageWriteback(page)) {
+ unlock_page(page);
+ list_del(head);
+ list_add_tail(head, curr);
write_unlock(&mapping->page_lock);
wait_on_page_writeback(page);
+ page_cache_release(page);
unlocked = 1;
write_lock(&mapping->page_lock);
goto restart;
}
- failed = TestSetPageLocked(page);

list_del(head);
if (!failed)
-
-
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/

\
 
 \ /
  Last update: 2005-03-22 13:25    [W:0.027 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site