Commit 319a1ad4 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ext3: fix data=journal for small blocksize

Fix various problems which cropped up due to MAP_SHARED traffic on
data=journal with blocksize < PAGE_CACHE_SIZE.

All relate to handling the "pending truncate" buffers outside i_size.
parent 2ab7407c
...@@ -1075,6 +1075,8 @@ static int walk_page_buffers( handle_t *handle, ...@@ -1075,6 +1075,8 @@ static int walk_page_buffers( handle_t *handle,
static int do_journal_get_write_access(handle_t *handle, static int do_journal_get_write_access(handle_t *handle,
struct buffer_head *bh) struct buffer_head *bh)
{ {
if (!buffer_mapped(bh) || buffer_freed(bh))
return 0;
return ext3_journal_get_write_access(handle, bh); return ext3_journal_get_write_access(handle, bh);
} }
...@@ -1118,6 +1120,8 @@ ext3_journal_dirty_data(handle_t *handle, struct buffer_head *bh) ...@@ -1118,6 +1120,8 @@ ext3_journal_dirty_data(handle_t *handle, struct buffer_head *bh)
/* For commit_write() in data=journal mode */ /* For commit_write() in data=journal mode */
static int commit_write_fn(handle_t *handle, struct buffer_head *bh) static int commit_write_fn(handle_t *handle, struct buffer_head *bh)
{ {
if (!buffer_mapped(bh) || buffer_freed(bh))
return 0;
set_buffer_uptodate(bh); set_buffer_uptodate(bh);
return ext3_journal_dirty_metadata(handle, bh); return ext3_journal_dirty_metadata(handle, bh);
} }
...@@ -1699,11 +1703,19 @@ static int ext3_block_truncate_page(handle_t *handle, ...@@ -1699,11 +1703,19 @@ static int ext3_block_truncate_page(handle_t *handle,
} }
err = 0; err = 0;
if (buffer_freed(bh)) {
BUFFER_TRACE(bh, "freed: skip");
goto unlock;
}
if (!buffer_mapped(bh)) { if (!buffer_mapped(bh)) {
BUFFER_TRACE(bh, "unmapped");
ext3_get_block(inode, iblock, bh, 0); ext3_get_block(inode, iblock, bh, 0);
/* unmapped? It's a hole - nothing to do */ /* unmapped? It's a hole - nothing to do */
if (!buffer_mapped(bh)) if (!buffer_mapped(bh)) {
BUFFER_TRACE(bh, "still unmapped");
goto unlock; goto unlock;
}
} }
/* Ok, it's mapped. Make sure it's up-to-date */ /* Ok, it's mapped. Make sure it's up-to-date */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment