summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZheng Liu <wenqing.lz@taobao.com>2011-10-28 20:34:02 +0800
committerWilly Tarreau <w@1wt.eu>2012-02-11 15:37:53 +0100
commitc7e75cb58189a535671183de1d00ee4f1d9a40cb (patch)
tree86e2c824165bcc4165af0817674657b38e50e456
parent3c87aca6dc9691b010dc4f06b24902fd35965520 (diff)
downloadlinux-stable-c7e75cb58189a535671183de1d00ee4f1d9a40cb.tar.gz
linux-stable-c7e75cb58189a535671183de1d00ee4f1d9a40cb.tar.bz2
linux-stable-c7e75cb58189a535671183de1d00ee4f1d9a40cb.zip
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> Signed-off-by: Willy Tarreau <w@1wt.eu>
-rw-r--r--fs/ext4/extents.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index f99635ae56a5..d85ffd7ea8b7 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2327,6 +2327,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
ex1 = ex;
ex1->ee_len = cpu_to_le16(iblock - ee_block);
ext4_ext_mark_uninitialized(ex1);
+ ext4_ext_dirty(handle, inode, path + depth);
ex2 = &newex;
}
/*