Commit cd6ef84e authored by Badari Pulavarty's avatar Badari Pulavarty Committed by Linus Torvalds

[PATCH] ext3: fix nobh mode for chattr +j inodes

One can do "chattr +j" on a file to change its journalling mode.  Fix
writeback mode with "nobh" handling for it.

Even though, we mount ext3 filesystem in writeback mode with "nobh" option,
some one can do "chattr +j" on a single file to force it to do journalled
mode.  In order to do journaling, ext3_block_truncate_page() need to
fallback to default case of creating buffers and adding them to transaction
etc.
Signed-off-by: default avatarBadari Pulavarty <pbadari@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 0adb25d2
...@@ -1624,8 +1624,8 @@ static int ext3_block_truncate_page(handle_t *handle, struct page *page, ...@@ -1624,8 +1624,8 @@ static int ext3_block_truncate_page(handle_t *handle, struct page *page,
* For "nobh" option, we can only work if we don't need to * For "nobh" option, we can only work if we don't need to
* read-in the page - otherwise we create buffers to do the IO. * read-in the page - otherwise we create buffers to do the IO.
*/ */
if (!page_has_buffers(page) && test_opt(inode->i_sb, NOBH)) { if (!page_has_buffers(page) && test_opt(inode->i_sb, NOBH) &&
if (PageUptodate(page)) { ext3_should_writeback_data(inode) && PageUptodate(page)) {
kaddr = kmap_atomic(page, KM_USER0); kaddr = kmap_atomic(page, KM_USER0);
memset(kaddr + offset, 0, length); memset(kaddr + offset, 0, length);
flush_dcache_page(page); flush_dcache_page(page);
...@@ -1633,7 +1633,6 @@ static int ext3_block_truncate_page(handle_t *handle, struct page *page, ...@@ -1633,7 +1633,6 @@ static int ext3_block_truncate_page(handle_t *handle, struct page *page,
set_page_dirty(page); set_page_dirty(page);
goto unlock; goto unlock;
} }
}
if (!page_has_buffers(page)) if (!page_has_buffers(page))
create_empty_buffers(page, blocksize, 0); create_empty_buffers(page, blocksize, 0);
......
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