From: Greg Kroah-Hartman Date: Fri, 17 Aug 2012 17:36:54 +0000 (-0700) Subject: 3.4-stable patches X-Git-Tag: v3.5.3~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=54a6ec428865c74325a82cad6f47f28e546321ae;p=thirdparty%2Fkernel%2Fstable-queue.git 3.4-stable patches added patches: ext4-avoid-kmemcheck-complaint-from-reading-uninitialized-memory.patch ext4-fix-kernel-bug-on-large-scale-rm-rf-commands.patch ext4-fix-long-mount-times-on-very-big-file-systems.patch ext4-make-sure-the-journal-sb-is-written-in-ext4_clear_journal_err.patch --- diff --git a/queue-3.4/ext4-avoid-kmemcheck-complaint-from-reading-uninitialized-memory.patch b/queue-3.4/ext4-avoid-kmemcheck-complaint-from-reading-uninitialized-memory.patch new file mode 100644 index 00000000000..1a2c43d413d --- /dev/null +++ b/queue-3.4/ext4-avoid-kmemcheck-complaint-from-reading-uninitialized-memory.patch @@ -0,0 +1,37 @@ +From 7e731bc9a12339f344cddf82166b82633d99dd86 Mon Sep 17 00:00:00 2001 +From: Theodore Ts'o +Date: Sun, 5 Aug 2012 23:28:16 -0400 +Subject: ext4: avoid kmemcheck complaint from reading uninitialized memory + +From: Theodore Ts'o + +commit 7e731bc9a12339f344cddf82166b82633d99dd86 upstream. + +Commit 03179fe923 introduced a kmemcheck complaint in +ext4_da_get_block_prep() because we save and restore +ei->i_da_metadata_calc_last_lblock even though it is left +uninitialized in the case where i_da_metadata_calc_len is zero. + +This doesn't hurt anything, but silencing the kmemcheck complaint +makes it easier for people to find real bugs. + +Addresses https://bugzilla.kernel.org/show_bug.cgi?id=45631 +(which is marked as a regression). + +Signed-off-by: "Theodore Ts'o" +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/super.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -932,6 +932,7 @@ static struct inode *ext4_alloc_inode(st + ei->i_reserved_meta_blocks = 0; + ei->i_allocated_meta_blocks = 0; + ei->i_da_metadata_calc_len = 0; ++ ei->i_da_metadata_calc_last_lblock = 0; + spin_lock_init(&(ei->i_block_reservation_lock)); + #ifdef CONFIG_QUOTA + ei->i_reserved_quota = 0; diff --git a/queue-3.4/ext4-fix-kernel-bug-on-large-scale-rm-rf-commands.patch b/queue-3.4/ext4-fix-kernel-bug-on-large-scale-rm-rf-commands.patch new file mode 100644 index 00000000000..b4b6ba9cdfb --- /dev/null +++ b/queue-3.4/ext4-fix-kernel-bug-on-large-scale-rm-rf-commands.patch @@ -0,0 +1,65 @@ +From 89a4e48f8479f8145eca9698f39fe188c982212f Mon Sep 17 00:00:00 2001 +From: Theodore Ts'o +Date: Fri, 17 Aug 2012 08:54:52 -0400 +Subject: ext4: fix kernel BUG on large-scale rm -rf commands +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Theodore Ts'o + +commit 89a4e48f8479f8145eca9698f39fe188c982212f upstream. + +Commit 968dee7722: "ext4: fix hole punch failure when depth is greater +than 0" introduced a regression in v3.5.1/v3.6-rc1 which caused kernel +crashes when users ran run "rm -rf" on large directory hierarchy on +ext4 filesystems on RAID devices: + + BUG: unable to handle kernel NULL pointer dereference at 0000000000000028 + + Process rm (pid: 18229, threadinfo ffff8801276bc000, task ffff880123631710) + Call Trace: + [] ? __ext4_handle_dirty_metadata+0x83/0x110 + [] ext4_ext_truncate+0x193/0x1d0 + [] ? ext4_mark_inode_dirty+0x7f/0x1f0 + [] ext4_truncate+0xf5/0x100 + [] ext4_evict_inode+0x461/0x490 + [] evict+0xa2/0x1a0 + [] iput+0x103/0x1f0 + [] do_unlinkat+0x154/0x1c0 + [] ? sys_newfstatat+0x2a/0x40 + [] sys_unlinkat+0x1b/0x50 + [] system_call_fastpath+0x16/0x1b + Code: 8b 4d 20 0f b7 41 02 48 8d 04 40 48 8d 04 81 49 89 45 18 0f b7 49 02 48 83 c1 01 49 89 4d 00 e9 ae f8 ff ff 0f 1f 00 49 8b 45 28 <48> 8b 40 28 49 89 45 20 e9 85 f8 ff ff 0f 1f 80 00 00 00 + + RIP [] ext4_ext_remove_space+0xa34/0xdf0 + +This could be reproduced as follows: + +The problem in commit 968dee7722 was that caused the variable 'i' to +be left uninitialized if the truncate required more space than was +available in the journal. This resulted in the function +ext4_ext_truncate_extend_restart() returning -EAGAIN, which caused +ext4_ext_remove_space() to restart the truncate operation after +starting a new jbd2 handle. + +Reported-by: Maciej Żenczykowski +Reported-by: Marti Raudsepp +Tested-by: Fengguang Wu +Signed-off-by: "Theodore Ts'o" +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/extents.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/fs/ext4/extents.c ++++ b/fs/ext4/extents.c +@@ -2596,6 +2596,7 @@ cont: + } + path[0].p_depth = depth; + path[0].p_hdr = ext_inode_hdr(inode); ++ i = 0; + + if (ext4_ext_check(inode, path[0].p_hdr, depth)) { + err = -EIO; diff --git a/queue-3.4/ext4-fix-long-mount-times-on-very-big-file-systems.patch b/queue-3.4/ext4-fix-long-mount-times-on-very-big-file-systems.patch new file mode 100644 index 00000000000..a67c819757b --- /dev/null +++ b/queue-3.4/ext4-fix-long-mount-times-on-very-big-file-systems.patch @@ -0,0 +1,35 @@ +From 0548bbb85337e532ca2ed697c3e9b227ff2ed4b4 Mon Sep 17 00:00:00 2001 +From: Theodore Ts'o +Date: Thu, 16 Aug 2012 11:59:04 -0400 +Subject: ext4: fix long mount times on very big file systems + +From: Theodore Ts'o + +commit 0548bbb85337e532ca2ed697c3e9b227ff2ed4b4 upstream. + +Commit 8aeb00ff85a: "ext4: fix overhead calculation used by +ext4_statfs()" introduced a O(n**2) calculation which makes very large +file systems take forever to mount. Fix this with an optimization for +non-bigalloc file systems. (For bigalloc file systems the overhead +needs to be set in the the superblock.) + +Signed-off-by: "Theodore Ts'o" +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/super.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -2969,6 +2969,10 @@ static int count_overhead(struct super_b + ext4_group_t i, ngroups = ext4_get_groups_count(sb); + int s, j, count = 0; + ++ if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_BIGALLOC)) ++ return (ext4_bg_has_super(sb, grp) + ext4_bg_num_gdb(sb, grp) + ++ sbi->s_itb_per_group + 2); ++ + first_block = le32_to_cpu(sbi->s_es->s_first_data_block) + + (grp * EXT4_BLOCKS_PER_GROUP(sb)); + last_block = first_block + EXT4_BLOCKS_PER_GROUP(sb) - 1; diff --git a/queue-3.4/ext4-make-sure-the-journal-sb-is-written-in-ext4_clear_journal_err.patch b/queue-3.4/ext4-make-sure-the-journal-sb-is-written-in-ext4_clear_journal_err.patch new file mode 100644 index 00000000000..6a8738c4754 --- /dev/null +++ b/queue-3.4/ext4-make-sure-the-journal-sb-is-written-in-ext4_clear_journal_err.patch @@ -0,0 +1,70 @@ +From d796c52ef0b71a988364f6109aeb63d79c5b116b Mon Sep 17 00:00:00 2001 +From: Theodore Ts'o +Date: Sun, 5 Aug 2012 19:04:57 -0400 +Subject: ext4: make sure the journal sb is written in ext4_clear_journal_err() + +From: Theodore Ts'o + +commit d796c52ef0b71a988364f6109aeb63d79c5b116b upstream. + +After we transfer set the EXT4_ERROR_FS bit in the file system +superblock, it's not enough to call jbd2_journal_clear_err() to clear +the error indication from journal superblock --- we need to call +jbd2_journal_update_sb_errno() as well. Otherwise, when the root file +system is mounted read-only, the journal is replayed, and the error +indicator is transferred to the superblock --- but the s_errno field +in the jbd2 superblock is left set (since although we cleared it in +memory, we never flushed it out to disk). + +This can end up confusing e2fsck. We should make e2fsck more robust +in this case, but the kernel shouldn't be leaving things in this +confused state, either. + +Signed-off-by: "Theodore Ts'o" +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/super.c | 1 + + fs/jbd2/journal.c | 3 ++- + include/linux/jbd2.h | 1 + + 3 files changed, 4 insertions(+), 1 deletion(-) + +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -4227,6 +4227,7 @@ static void ext4_clear_journal_err(struc + ext4_commit_super(sb, 1); + + jbd2_journal_clear_err(journal); ++ jbd2_journal_update_sb_errno(journal); + } + } + +--- a/fs/jbd2/journal.c ++++ b/fs/jbd2/journal.c +@@ -1340,7 +1340,7 @@ static void jbd2_mark_journal_empty(jour + * Update a journal's errno. Write updated superblock to disk waiting for IO + * to complete. + */ +-static void jbd2_journal_update_sb_errno(journal_t *journal) ++void jbd2_journal_update_sb_errno(journal_t *journal) + { + journal_superblock_t *sb = journal->j_superblock; + +@@ -1352,6 +1352,7 @@ static void jbd2_journal_update_sb_errno + + jbd2_write_superblock(journal, WRITE_SYNC); + } ++EXPORT_SYMBOL(jbd2_journal_update_sb_errno); + + /* + * Read the superblock for a given journal, performing initial +--- a/include/linux/jbd2.h ++++ b/include/linux/jbd2.h +@@ -1091,6 +1091,7 @@ extern int jbd2_journal_destroy (j + extern int jbd2_journal_recover (journal_t *journal); + extern int jbd2_journal_wipe (journal_t *, int); + extern int jbd2_journal_skip_recovery (journal_t *); ++extern void jbd2_journal_update_sb_errno(journal_t *); + extern void jbd2_journal_update_sb_log_tail (journal_t *, tid_t, + unsigned long, int); + extern void __jbd2_journal_abort_hard (journal_t *); diff --git a/queue-3.4/series b/queue-3.4/series index 562e8454136..c797f98d60f 100644 --- a/queue-3.4/series +++ b/queue-3.4/series @@ -13,3 +13,7 @@ drm-radeon-do-not-reenable-crtc-after-moving-vram-start-address.patch drm-radeon-add-some-new-si-pci-ids.patch drm-radeon-fix-bank-tiling-parameters-on-cayman.patch drm-radeon-fix-bank-tiling-parameters-on-evergreen.patch +ext4-make-sure-the-journal-sb-is-written-in-ext4_clear_journal_err.patch +ext4-avoid-kmemcheck-complaint-from-reading-uninitialized-memory.patch +ext4-fix-long-mount-times-on-very-big-file-systems.patch +ext4-fix-kernel-bug-on-large-scale-rm-rf-commands.patch