Commit 0e31f51d authored by Badari Pulavarty's avatar Badari Pulavarty Committed by Linus Torvalds

[PATCH] ext3 -nobh option causes oops

For files other than IFREG, nobh option doesn't make sense.  Modifications
to them are journalled and needs buffer heads to do that.  Without this
patch, we get kernel oops in page_buffers().
Signed-off-by: default avatarBadari Pulavarty <pbadari@us.ibm.com>
Cc: <stable@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 51d8c5ed
...@@ -1158,7 +1158,7 @@ static int ext3_prepare_write(struct file *file, struct page *page, ...@@ -1158,7 +1158,7 @@ static int ext3_prepare_write(struct file *file, struct page *page,
ret = PTR_ERR(handle); ret = PTR_ERR(handle);
goto out; goto out;
} }
if (test_opt(inode->i_sb, NOBH)) if (test_opt(inode->i_sb, NOBH) && ext3_should_writeback_data(inode))
ret = nobh_prepare_write(page, from, to, ext3_get_block); ret = nobh_prepare_write(page, from, to, ext3_get_block);
else else
ret = block_prepare_write(page, from, to, ext3_get_block); ret = block_prepare_write(page, from, to, ext3_get_block);
...@@ -1244,7 +1244,7 @@ static int ext3_writeback_commit_write(struct file *file, struct page *page, ...@@ -1244,7 +1244,7 @@ static int ext3_writeback_commit_write(struct file *file, struct page *page,
if (new_i_size > EXT3_I(inode)->i_disksize) if (new_i_size > EXT3_I(inode)->i_disksize)
EXT3_I(inode)->i_disksize = new_i_size; EXT3_I(inode)->i_disksize = new_i_size;
if (test_opt(inode->i_sb, NOBH)) if (test_opt(inode->i_sb, NOBH) && ext3_should_writeback_data(inode))
ret = nobh_commit_write(file, page, from, to); ret = nobh_commit_write(file, page, from, to);
else else
ret = generic_commit_write(file, page, from, to); ret = generic_commit_write(file, page, from, to);
...@@ -1494,7 +1494,7 @@ static int ext3_writeback_writepage(struct page *page, ...@@ -1494,7 +1494,7 @@ static int ext3_writeback_writepage(struct page *page,
goto out_fail; goto out_fail;
} }
if (test_opt(inode->i_sb, NOBH)) if (test_opt(inode->i_sb, NOBH) && ext3_should_writeback_data(inode))
ret = nobh_writepage(page, ext3_get_block, wbc); ret = nobh_writepage(page, ext3_get_block, wbc);
else else
ret = block_write_full_page(page, ext3_get_block, wbc); ret = block_write_full_page(page, ext3_get_block, wbc);
......
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