diff options
author | Theodore Ts'o <tytso@mit.edu> | 2011-02-27 16:43:24 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-02-27 16:43:24 -0500 |
commit | a54aa76108619e5d8290b49081c2aaaeff5be9a2 (patch) | |
tree | a3c436e29b5452f9c17bffc7bbc6b8f437c3255c /fs/ext4 | |
parent | 168fc0223c0e944957b1f31d88c2334fc904baf1 (diff) |
ext4: don't leave PageWriteback set after memory failure
In ext4_bio_write_page(), if the memory allocation for the struct
ext4_io_page fails, it returns with the page's PageWriteback flag set.
This will end up causing the page not to skip writeback in
WB_SYNC_NONE mode, and in WB_SYNC_ALL mode (i.e., on a sync, fsync, or
umount) the writeback daemon will get stuck forever on the
wait_on_page_writeback() function in write_cache_pages_da().
Or, if journalling is enabled and the file gets deleted, it the
journal thread can get stuck in journal_finish_inode_data_buffers()
call to filemap_fdatawait().
Another place where things can get hung up is in
truncate_inode_pages(), called out of ext4_evict_inode().
Fix this by not setting PageWriteback until after we have successfully
allocated the struct ext4_io_page.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/page-io.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index 68d92a8f71d7..d5c391ffad7a 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c | |||
@@ -381,8 +381,6 @@ int ext4_bio_write_page(struct ext4_io_submit *io, | |||
381 | 381 | ||
382 | BUG_ON(!PageLocked(page)); | 382 | BUG_ON(!PageLocked(page)); |
383 | BUG_ON(PageWriteback(page)); | 383 | BUG_ON(PageWriteback(page)); |
384 | set_page_writeback(page); | ||
385 | ClearPageError(page); | ||
386 | 384 | ||
387 | io_page = kmem_cache_alloc(io_page_cachep, GFP_NOFS); | 385 | io_page = kmem_cache_alloc(io_page_cachep, GFP_NOFS); |
388 | if (!io_page) { | 386 | if (!io_page) { |
@@ -393,6 +391,8 @@ int ext4_bio_write_page(struct ext4_io_submit *io, | |||
393 | io_page->p_page = page; | 391 | io_page->p_page = page; |
394 | atomic_set(&io_page->p_count, 1); | 392 | atomic_set(&io_page->p_count, 1); |
395 | get_page(page); | 393 | get_page(page); |
394 | set_page_writeback(page); | ||
395 | ClearPageError(page); | ||
396 | 396 | ||
397 | for (bh = head = page_buffers(page), block_start = 0; | 397 | for (bh = head = page_buffers(page), block_start = 0; |
398 | bh != head || !block_start; | 398 | bh != head || !block_start; |