ext4: warn if direct reclaim tries to writeback pages
authorMel Gorman <[email protected]>
Tue, 1 Nov 2011 00:07:48 +0000 (17:07 -0700)
committerLinus Torvalds <[email protected]>
Tue, 1 Nov 2011 00:30:46 +0000 (17:30 -0700)
Direct reclaim should never writeback pages.  Warn if an attempt is made.

Signed-off-by: Mel Gorman <[email protected]>
Cc: Dave Chinner <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Wu Fengguang <[email protected]>
Cc: Jan Kara <[email protected]>
Cc: Minchan Kim <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Alex Elder <[email protected]>
Cc: Theodore Ts'o <[email protected]>
Cc: Chris Mason <[email protected]>
Cc: Dave Hansen <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/ext4/inode.c

index 986e2388f031dd3ccb2ceec8c07d0a31b058eed1..0defe0bfe019a3083f0156f6473b303caf65f93b 100644 (file)
@@ -1811,8 +1811,12 @@ static int ext4_writepage(struct page *page,
                 * We don't want to do block allocation, so redirty
                 * the page and return.  We may reach here when we do
                 * a journal commit via journal_submit_inode_data_buffers.
-                * We can also reach here via shrink_page_list
+                * We can also reach here via shrink_page_list but it
+                * should never be for direct reclaim so warn if that
+                * happens
                 */
+               WARN_ON_ONCE((current->flags & (PF_MEMALLOC|PF_KSWAPD)) ==
+                                                               PF_MEMALLOC);
                goto redirty_page;
        }
        if (commit_write)