* v2.4.6-pre3 swap cache race
@ 2001-06-19 2:01 Ben LaHaise
0 siblings, 0 replies; only message in thread
From: Ben LaHaise @ 2001-06-19 2:01 UTC (permalink / raw)
To: riel; +Cc: linux-mm, linux-kernel
diff -urN v2.4.6-pre3/mm/filemap.c swaprace/mm/filemap.c
--- v2.4.6-pre3/mm/filemap.c Mon Jun 18 21:51:03 2001
+++ swaprace/mm/filemap.c Mon Jun 18 21:59:57 2001
@@ -714,16 +714,16 @@
* The SwapCache check is protected by the pagecache lock.
*/
struct page * __find_get_swapcache_page(struct address_space *mapping,
- unsigned long offset, struct page **hash)
+ unsigned long index, struct page **hash)
{
struct page *page;
/*
* We need the LRU lock to protect against page_launder().
*/
-
+try_again:
spin_lock(&pagecache_lock);
- page = __find_page_nolock(mapping, offset, *hash);
+ page = __find_page_nolock(mapping, index, *hash);
if (page) {
spin_lock(&pagemap_lru_lock);
if (PageSwapCache(page))
@@ -733,6 +733,16 @@
spin_unlock(&pagemap_lru_lock);
}
spin_unlock(&pagecache_lock);
+
+ if (page) {
+ lock_page(page);
+ if (!PageSwapCache(page) || page->mapping != mapping ||
+ page->index != index) {
+ UnlockPage(page);
+ goto try_again;
+ }
+ UnlockPage(page);
+ }
return page;
}
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-06-19 2:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-19 2:01 v2.4.6-pre3 swap cache race Ben LaHaise
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox