[PATCH] swap 3/4 unsafe Dirty check

Hugh Dickins (hugh@veritas.com)
Wed, 12 Jun 2002 04:08:46 +0100 (BST)


Todd reported swapoff kernel BUG at filemap.c:122 to LKML 24 May.
Other problems on that system may have contributed, but yes, despite
__delete_from_swap_cache doing ClearPageDirty before __remove_inode_page
to avoid the BUG(), a concurrent __free_pte might race to SetPageDirty.
So skip that oops in PageSwapCache case (please, if someone wants to use
unlikely or BUG_ON there, do so in your later patch). Remove the prior
ClearPageDirty? maybe but not without deeper thought: let stay for now.

--- 2.4.19-pre10/mm/filemap.c Tue Jun 4 13:54:19 2002
+++ linux/mm/filemap.c Tue Jun 11 19:02:30 2002
@@ -119,7 +119,8 @@
*/
void __remove_inode_page(struct page *page)
{
- if (PageDirty(page)) BUG();
+ if (PageDirty(page) && !PageSwapCache(page))
+ BUG();
remove_page_from_inode_queue(page);
remove_page_from_hash_queue(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/