Recent testing has shown that the BUG() check in try_to_unuse is unsafe.
delete_from_swap_cache does final swap_free just after removing page
from swap cache, and add_to_swap_cache does swap_duplicate just before
putting page into swap cache, therefore swapin_readahead may resurrect
a dying swap entry and assign a new page to it. That's fine, there's
no need to change this ordering; but it does mean that try_to_unuse's
page may have left the swap cache yet its swap_map count still be set.
That BUG() has done good service for swapoff sanity, but now abandon it.
--- 2.4.19-pre10/mm/swapfile.c Tue Jun 4 13:54:20 2002
+++ linux/mm/swapfile.c Tue Jun 11 19:02:30 2002
@@ -671,10 +671,7 @@
* private" pages, but they are handled by tmpfs files.
* Note shmem_unuse already deleted its from swap cache.
*/
- swcount = *swap_map;
- if ((swcount > 0) != PageSwapCache(page))
- BUG();
- if ((swcount > 1) && PageDirty(page)) {
+ if ((*swap_map > 1) && PageDirty(page) && PageSwapCache(page)) {
rw_swap_page(WRITE, page);
lock_page(page);
}
-
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/
This archive was generated by hypermail 2b29 : Sat Jun 15 2002 - 22:00:24 EST