]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: Fix BUG when writing to an unitialized extent
authorMingming Cao <cmm@us.ibm.com>
Mon, 25 Feb 2008 20:29:55 +0000 (15:29 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 25 Feb 2008 20:29:55 +0000 (15:29 -0500)
commit4a1be5990d1295666d69ad1122bd660ae13d0718
tree9a5b63d45dc805383f7789bba75f7935626767fe
parent4c67ea9995ea6baaaea4465c0cd37b4ce72a3407
ext4: Fix BUG when writing to an unitialized extent

This patch fixes a bug when writing to preallocated but uninitialized
blocks, which resulted in a BUG in fs/buffer.c saying that the buffer
is not mapped.

When writing to a file, ext4_get_block_wrap() is called with create=1 in
order to request that blocks be allocated if necessary.  It currently
calls ext4_get_blocks() with create=0 in order to do a lookup first.  If
the inode contains an unitialized data block, the buffer head is left
unampped, which ext4_get_blocks_wrap() returns, causing the BUG.

We fix this by checking to see if the buffer head is unmapped, and if
so, we make sure the the buffer head is mapped by calling
ext4_ext_get_blocks with create=1.

Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/extents.c
fs/ext4/inode.c