]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
ext4: fix BUG_ON() in ext4_ext_insert_extent()
authorZheng Liu <wenqing.lz@taobao.com>
Fri, 28 Oct 2011 12:34:02 +0000 (20:34 +0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 7 Nov 2011 21:47:42 +0000 (13:47 -0800)
commit56e66f0894df0cb2c18e10422d77da6693fd98bb
treee61824922b1adac4cf2ec4230bdefffb00b3df29
parent71aa3ac47d5116142b37fca35e8f8710be543f16
ext4: fix BUG_ON() in ext4_ext_insert_extent()

Does not corrispond with a direct commit in Linus's tree as it was fixed
differently in the 3.0 release.

We will meet with a BUG_ON() if following script is run.

mkfs.ext4 -b 4096 /dev/sdb1 1000000
mount -t ext4 /dev/sdb1 /mnt/sdb1
fallocate -l 100M /mnt/sdb1/test
sync
for((i=0;i<170;i++))
do
        dd if=/dev/zero of=/mnt/sdb1/test conv=notrunc bs=256k count=1
seek=`expr $i \* 2`
done
umount /mnt/sdb1
mount -t ext4 /dev/sdb1 /mnt/sdb1
dd if=/dev/zero of=/mnt/sdb1/test conv=notrunc bs=256k count=1 seek=341
umount /mnt/sdb1
mount /dev/sdb1 /mnt/sdb1
dd if=/dev/zero of=/mnt/sdb1/test conv=notrunc bs=256k count=1 seek=340
sync

The reason is that it forgot to mark dirty when splitting two extents in
ext4_ext_convert_to_initialized(). Althrough ex has been updated in
memory, it is not dirtied both in ext4_ext_convert_to_initialized() and
ext4_ext_insert_extent(). The disk layout is corrupted. Then it will
meet with a BUG_ON() when writting at the start of that extent again.

Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Xiaoyun Mao <xiaoyun.maoxy@aliyun-inc.com>
Cc: Yingbin Wang <yingbin.wangyb@aliyun-inc.com>
Cc: Jia Wan <jia.wanj@aliyun-inc.com>
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/ext4/extents.c