diff options
author | Jan Kara <jack@suse.cz> | 2005-10-30 18:00:16 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-30 20:37:17 -0500 |
commit | aaa4059bc2dca7fa816624a28db1958c3a22df9b (patch) | |
tree | 8ae1d5458e2f68f96b033f10dae216847c32d4d2 /mm/truncate.c | |
parent | e812cb5226af32aec91bcbaa8365bd7f921b6ebb (diff) |
[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 'mm/truncate.c')
-rw-r--r-- | mm/truncate.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/mm/truncate.c b/mm/truncate.c index 60c8764bfac2..29c18f68dc35 100644 --- a/mm/truncate.c +++ b/mm/truncate.c | |||
@@ -13,18 +13,9 @@ | |||
13 | #include <linux/pagemap.h> | 13 | #include <linux/pagemap.h> |
14 | #include <linux/pagevec.h> | 14 | #include <linux/pagevec.h> |
15 | #include <linux/buffer_head.h> /* grr. try_to_release_page, | 15 | #include <linux/buffer_head.h> /* grr. try_to_release_page, |
16 | block_invalidatepage */ | 16 | do_invalidatepage */ |
17 | 17 | ||
18 | 18 | ||
19 | static int do_invalidatepage(struct page *page, unsigned long offset) | ||
20 | { | ||
21 | int (*invalidatepage)(struct page *, unsigned long); | ||
22 | invalidatepage = page->mapping->a_ops->invalidatepage; | ||
23 | if (invalidatepage == NULL) | ||
24 | invalidatepage = block_invalidatepage; | ||
25 | return (*invalidatepage)(page, offset); | ||
26 | } | ||
27 | |||
28 | static inline void truncate_partial_page(struct page *page, unsigned partial) | 19 | static inline void truncate_partial_page(struct page *page, unsigned partial) |
29 | { | 20 | { |
30 | memclear_highpage_flush(page, partial, PAGE_CACHE_SIZE-partial); | 21 | memclear_highpage_flush(page, partial, PAGE_CACHE_SIZE-partial); |