summaryrefslogtreecommitdiffstats
path: root/fs/buffer.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2005-10-30 15:00:16 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 17:37:17 -0800
commitaaa4059bc2dca7fa816624a28db1958c3a22df9b (patch)
tree8ae1d5458e2f68f96b033f10dae216847c32d4d2 /fs/buffer.c
parente812cb5226af32aec91bcbaa8365bd7f921b6ebb (diff)
downloadlinux-aaa4059bc2dca7fa816624a28db1958c3a22df9b.tar.gz
linux-aaa4059bc2dca7fa816624a28db1958c3a22df9b.tar.bz2
linux-aaa4059bc2dca7fa816624a28db1958c3a22df9b.zip
[PATCH] ext3: Fix unmapped buffers in transaction's lists
Fix the problem (BUG 4964) with unmapped buffers in transaction's t_sync_data list. The problem is we need to call filesystem's own invalidatepage() from block_write_full_page(). block_write_full_page() must call filesystem's invalidatepage(). Otherwise following nasty race can happen: proc 1 proc 2 ------ ------ - write some new data to 'offset' => bh gets to the transactions data list - starts truncate => i_size set to new size - mpage_writepages() - ext3_ordered_writepage() to 'offset' - block_write_full_page() - page->index > end_index+1 - block_invalidatepage() - discard_buffer() - clear_buffer_mapped() - commit triggers and finds unmapped buffer - BOOM! Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/buffer.c')
-rw-r--r--fs/buffer.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index 2066e4cb700c..75cac9ada026 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1637,6 +1637,15 @@ out:
}
EXPORT_SYMBOL(block_invalidatepage);
+int do_invalidatepage(struct page *page, unsigned long offset)
+{
+ int (*invalidatepage)(struct page *, unsigned long);
+ invalidatepage = page->mapping->a_ops->invalidatepage;
+ if (invalidatepage == NULL)
+ invalidatepage = block_invalidatepage;
+ return (*invalidatepage)(page, offset);
+}
+
/*
* We attach and possibly dirty the buffers atomically wrt
* __set_page_dirty_buffers() via private_lock. try_to_free_buffers
@@ -2696,7 +2705,7 @@ int block_write_full_page(struct page *page, get_block_t *get_block,
* they may have been added in ext3_writepage(). Make them
* freeable here, so the page does not leak.
*/
- block_invalidatepage(page, 0);
+ do_invalidatepage(page, 0);
unlock_page(page);
return 0; /* don't care */
}