From: Tao Ma Date: Wed, 26 Oct 2011 15:08:39 +0000 (-0400) Subject: ext4: don't check io->flag when setting EXT4_STATE_DIO_UNWRITTEN inode state X-Git-Tag: v3.2-rc1~85^2~25 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3ff05690845911cc40387176f0bc5a7af9ef3ff;p=pandora-kernel.git ext4: don't check io->flag when setting EXT4_STATE_DIO_UNWRITTEN inode state When we want to convert the unitialized extent in direct write, we can either do it in ext4_end_io_nolock(AIO case) or in ext4_ext_direct_IO(non AIO case) and EXT4_I(inode)->cur_aio_dio is a guard for ext4_ext_map_blocks to find the right case. In e9e3bcecf, we mistakenly change it by: - if (io) + if (io && !(io->flag & EXT4_IO_END_UNWRITTEN)) { io->flag = EXT4_IO_END_UNWRITTEN; - else + atomic_inc(&EXT4_I(inode)->i_aiodio_unwritten); + } else ext4_set_inode_state(inode, EXT4_STATE_DIO_UNWRITTEN); So now if we map 2 blocks, and the first one set the EXT_IO_END_UNWRITTEN, the 2nd mapping will set inode state because of the check for the flag. This is wrong. Cc: Eric Sandeen Signed-off-by: Tao Ma Signed-off-by: "Theodore Ts'o" --- Reading git-diff-tree failed