[kernel/f14] Add fix for ext4 BUG_ON backtrace (rhbz 747948)

Josh Boyer jwboyer at fedoraproject.org
Fri Oct 21 15:19:16 UTC 2011


commit 379959bc82a5f01c5d8767f1a2fa3d72c6bb282e
Author: Josh Boyer <jwboyer at redhat.com>
Date:   Fri Oct 21 10:17:13 2011 -0400

    Add fix for ext4 BUG_ON backtrace (rhbz 747948)

 ext4-fix-BUG_ON-in-ext4_ext_insert_extent.patch |   62 +++++++++++++++++++++++
 kernel.spec                                     |   11 ++++-
 2 files changed, 72 insertions(+), 1 deletions(-)
---
diff --git a/ext4-fix-BUG_ON-in-ext4_ext_insert_extent.patch b/ext4-fix-BUG_ON-in-ext4_ext_insert_extent.patch
new file mode 100644
index 0000000..abd1201
--- /dev/null
+++ b/ext4-fix-BUG_ON-in-ext4_ext_insert_extent.patch
@@ -0,0 +1,62 @@
+BZ 742091
+https://bugzilla.redhat.com/show_bug.cgi?id=742091
+
+This bug was never properly fixed upstream since the code got
+reorganized in:
+
+667eff35a1f56fa74ce98a0c7c29a40adc1ba4e3 ext4: reimplement convert and
+split_unwritten
+
+This fix has proposed by Zheng Liu <wenqing.lz at taobao.com>, then updated,
+reviewed and tested by me.
+
+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.
+
+Originally-from: Zheng Liu <wenqing.lz at taobao.com>
+Signed-off-by: Lukas Czerner <lczerner at redhat.com>
+---
+ fs/ext4/extents.c |    2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+Index: linux-2.6.35.noarch/fs/ext4/extents.c
+===================================================================
+--- linux-2.6.35.noarch.orig/fs/ext4/extents.c
++++ linux-2.6.35.noarch/fs/ext4/extents.c
+@@ -2687,6 +2687,7 @@ static int ext4_ext_convert_to_initializ
+ 		ex1 = ex;
+ 		ex1->ee_len = cpu_to_le16(map->m_lblk - ee_block);
+ 		ext4_ext_mark_uninitialized(ex1);
++		ext4_ext_dirty(handle, inode, path + depth);
+ 		ex2 = &newex;
+ 	}
+ 	/*
+@@ -2850,6 +2851,7 @@ static int ext4_ext_convert_to_initializ
+ 		ex1 = ex;
+ 		ex1->ee_len = cpu_to_le16(map->m_lblk - ee_block);
+ 		ext4_ext_mark_uninitialized(ex1);
++		ext4_ext_dirty(handle, inode, path + depth);
+ 		ex2 = &newex;
+ 	}
+ 	/* ex2: map->m_lblk to map->m_lblk + maxblocks-1 : initialised */
diff --git a/kernel.spec b/kernel.spec
index 5617817..e2b8ccf 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -48,7 +48,7 @@ Summary: The Linux kernel
 # reset this by hand to 1 (or to 0 and then use rpmdev-bumpspec).
 # scripts/rebase.sh should be made to do that for you, actually.
 #
-%global baserelease 99
+%global baserelease 100
 %global fedora_build %{baserelease}
 
 # base_sublevel is the kernel version we're starting with and patching
@@ -897,6 +897,9 @@ Patch14061: TPM-Zero-buffer-after-copying-to-userspace.patch
 Patch14062: 0001-EHCI-don-t-rescan-interrupt-QHs-needlessly.patch
 Patch14063: 0002-USB-EHCI-go-back-to-using-the-system-clock-for-QH-un.patch
 
+#rhbz 747948
+Patch14064: ext4-fix-BUG_ON-in-ext4_ext_insert_extent.patch
+
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1697,6 +1700,9 @@ ApplyPatch TPM-Zero-buffer-after-copying-to-userspace.patch
 ApplyPatch 0001-EHCI-don-t-rescan-interrupt-QHs-needlessly.patch
 ApplyPatch 0002-USB-EHCI-go-back-to-using-the-system-clock-for-QH-un.patch
 
+#rhbz 747948
+ApplyPatch ext4-fix-BUG_ON-in-ext4_ext_insert_extent.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -2283,6 +2289,9 @@ fi
 # and build.
 
 %changelog
+* Fri Oct 20 2011 Josh Boyer <jwboyer at redhat.com>
+- Add fix for ext4 BUG_ON backtrace (rhbz 747948)
+
 * Wed Oct 19 2011 Dave Jones <davej at redhat.com>
 - Add Sony VGN-FW21E to nonvs blacklist. (rhbz 641789)
 


More information about the scm-commits mailing list