From: Greg Kroah-Hartman Date: Tue, 5 Jun 2012 03:20:29 +0000 (-0700) Subject: 3.0-stable patches X-Git-Tag: v3.0.34~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=009783ead9870622306e78834905f7e3b5a504c9;p=thirdparty%2Fkernel%2Fstable-queue.git 3.0-stable patches added patches: ext4-add-ext4_mb_unload_buddy-in-the-error-path.patch ext4-add-missing-save_error_info-to-ext4_error.patch ext4-don-t-trash-state-flags-in-ext4_ioc_setflags.patch ext4-force-ro-mount-if-ext4_setup_super-fails.patch ext4-remove-mb_groups-before-tearing-down-the-buddy_cache.patch --- diff --git a/queue-3.0/ext4-add-ext4_mb_unload_buddy-in-the-error-path.patch b/queue-3.0/ext4-add-ext4_mb_unload_buddy-in-the-error-path.patch new file mode 100644 index 00000000000..7f04e571db1 --- /dev/null +++ b/queue-3.0/ext4-add-ext4_mb_unload_buddy-in-the-error-path.patch @@ -0,0 +1,30 @@ +From 02b7831019ea4e7994968c84b5826fa8b248ffc8 Mon Sep 17 00:00:00 2001 +From: Salman Qazi +Date: Thu, 31 May 2012 23:51:27 -0400 +Subject: ext4: add ext4_mb_unload_buddy in the error path + +From: Salman Qazi + +commit 02b7831019ea4e7994968c84b5826fa8b248ffc8 upstream. + +ext4_free_blocks fails to pair an ext4_mb_load_buddy with a matching +ext4_mb_unload_buddy when it fails a memory allocation. + +Signed-off-by: Salman Qazi +Signed-off-by: "Theodore Ts'o" +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/mballoc.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/fs/ext4/mballoc.c ++++ b/fs/ext4/mballoc.c +@@ -4583,6 +4583,7 @@ do_more: + */ + new_entry = kmem_cache_alloc(ext4_free_ext_cachep, GFP_NOFS); + if (!new_entry) { ++ ext4_mb_unload_buddy(&e4b); + err = -ENOMEM; + goto error_return; + } diff --git a/queue-3.0/ext4-add-missing-save_error_info-to-ext4_error.patch b/queue-3.0/ext4-add-missing-save_error_info-to-ext4_error.patch new file mode 100644 index 00000000000..0217d86ee3e --- /dev/null +++ b/queue-3.0/ext4-add-missing-save_error_info-to-ext4_error.patch @@ -0,0 +1,34 @@ +From f3fc0210c0fc91900766c995f089c39170e68305 Mon Sep 17 00:00:00 2001 +From: Theodore Ts'o +Date: Wed, 30 May 2012 23:00:16 -0400 +Subject: ext4: add missing save_error_info() to ext4_error() + +From: Theodore Ts'o + +commit f3fc0210c0fc91900766c995f089c39170e68305 upstream. + +The ext4_error() function is missing a call to save_error_info(). +Since this is the function which marks the file system as containing +an error, this oversight (which was introduced in 2.6.36) is quite +significant, and should be backported to older stable kernels with +high urgency. + +Reported-by: Ken Sumrall +Signed-off-by: "Theodore Ts'o" +Cc: ksumrall@google.com +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 +@@ -433,6 +433,7 @@ void __ext4_error(struct super_block *sb + printk(KERN_CRIT "EXT4-fs error (device %s): %s:%d: comm %s: %pV\n", + sb->s_id, function, line, current->comm, &vaf); + va_end(args); ++ save_error_info(sb, function, line); + + ext4_handle_error(sb); + } diff --git a/queue-3.0/ext4-don-t-trash-state-flags-in-ext4_ioc_setflags.patch b/queue-3.0/ext4-don-t-trash-state-flags-in-ext4_ioc_setflags.patch new file mode 100644 index 00000000000..daaef7f35ec --- /dev/null +++ b/queue-3.0/ext4-don-t-trash-state-flags-in-ext4_ioc_setflags.patch @@ -0,0 +1,52 @@ +From 79906964a187c405db72a3abc60eb9b50d804fbc Mon Sep 17 00:00:00 2001 +From: Theodore Ts'o +Date: Thu, 31 May 2012 23:46:01 -0400 +Subject: ext4: don't trash state flags in EXT4_IOC_SETFLAGS + +From: Theodore Ts'o + +commit 79906964a187c405db72a3abc60eb9b50d804fbc upstream. + +In commit 353eb83c we removed i_state_flags with 64-bit longs, But +when handling the EXT4_IOC_SETFLAGS ioctl, we replace i_flags +directly, which trashes the state flags which are stored in the high +32-bits of i_flags on 64-bit platforms. So use the the +ext4_{set,clear}_inode_flags() functions which use atomic bit +manipulation functions instead. + +Reported-by: Tao Ma +Signed-off-by: "Theodore Ts'o" +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/ioctl.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +--- a/fs/ext4/ioctl.c ++++ b/fs/ext4/ioctl.c +@@ -35,7 +35,7 @@ long ext4_ioctl(struct file *filp, unsig + handle_t *handle = NULL; + int err, migrate = 0; + struct ext4_iloc iloc; +- unsigned int oldflags; ++ unsigned int oldflags, mask, i; + unsigned int jflag; + + if (!inode_owner_or_capable(inode)) +@@ -112,8 +112,14 @@ long ext4_ioctl(struct file *filp, unsig + if (err) + goto flags_err; + +- flags = flags & EXT4_FL_USER_MODIFIABLE; +- flags |= oldflags & ~EXT4_FL_USER_MODIFIABLE; ++ for (i = 0, mask = 1; i < 32; i++, mask <<= 1) { ++ if (!(mask & EXT4_FL_USER_MODIFIABLE)) ++ continue; ++ if (mask & flags) ++ ext4_set_inode_flag(inode, i); ++ else ++ ext4_clear_inode_flag(inode, i); ++ } + ei->i_flags = flags; + + ext4_set_inode_flags(inode); diff --git a/queue-3.0/ext4-force-ro-mount-if-ext4_setup_super-fails.patch b/queue-3.0/ext4-force-ro-mount-if-ext4_setup_super-fails.patch new file mode 100644 index 00000000000..1bda591bb5d --- /dev/null +++ b/queue-3.0/ext4-force-ro-mount-if-ext4_setup_super-fails.patch @@ -0,0 +1,43 @@ +From 7e84b6216467b84cd332c8e567bf5aa113fd2f38 Mon Sep 17 00:00:00 2001 +From: Eric Sandeen +Date: Mon, 28 May 2012 14:17:25 -0400 +Subject: ext4: force ro mount if ext4_setup_super() fails + +From: Eric Sandeen + +commit 7e84b6216467b84cd332c8e567bf5aa113fd2f38 upstream. + +If ext4_setup_super() fails i.e. due to a too-high revision, +the error is logged in dmesg but the fs is not mounted RO as +indicated. + +Tested by: + +# mkfs.ext4 -r 4 /dev/sdb6 +# mount /dev/sdb6 /mnt/test +# dmesg | grep "too high" +[164919.759248] EXT4-fs (sdb6): revision level too high, forcing read-only mode +# grep sdb6 /proc/mounts +/dev/sdb6 /mnt/test2 ext4 rw,seclabel,relatime,data=ordered 0 0 + +Reviewed-by: Andreas Dilger +Signed-off-by: Eric Sandeen +Signed-off-by: "Theodore Ts'o" +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/super.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -3618,7 +3618,8 @@ no_journal: + goto failed_mount4; + } + +- ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY); ++ if (ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY)) ++ sb->s_flags |= MS_RDONLY; + + /* determine the minimum size of new large inodes, if present */ + if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) { diff --git a/queue-3.0/ext4-remove-mb_groups-before-tearing-down-the-buddy_cache.patch b/queue-3.0/ext4-remove-mb_groups-before-tearing-down-the-buddy_cache.patch new file mode 100644 index 00000000000..d346567a329 --- /dev/null +++ b/queue-3.0/ext4-remove-mb_groups-before-tearing-down-the-buddy_cache.patch @@ -0,0 +1,50 @@ +From 95599968d19db175829fb580baa6b68939b320fb Mon Sep 17 00:00:00 2001 +From: Salman Qazi +Date: Thu, 31 May 2012 23:52:14 -0400 +Subject: ext4: remove mb_groups before tearing down the buddy_cache + +From: Salman Qazi + +commit 95599968d19db175829fb580baa6b68939b320fb upstream. + +We can't have references held on pages in the s_buddy_cache while we are +trying to truncate its pages and put the inode. All the pages must be +gone before we reach clear_inode. This can only be gauranteed if we +can prevent new users from grabbing references to s_buddy_cache's pages. + +The original bug can be reproduced and the bug fix can be verified by: + +while true; do mount -t ext4 /dev/ram0 /export/hda3/ram0; \ + umount /export/hda3/ram0; done & + +while true; do cat /proc/fs/ext4/ram0/mb_groups; done + +Signed-off-by: Salman Qazi +Signed-off-by: "Theodore Ts'o" +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/mballoc.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/fs/ext4/mballoc.c ++++ b/fs/ext4/mballoc.c +@@ -2528,6 +2528,9 @@ int ext4_mb_release(struct super_block * + struct ext4_sb_info *sbi = EXT4_SB(sb); + struct kmem_cache *cachep = get_groupinfo_cache(sb->s_blocksize_bits); + ++ if (sbi->s_proc) ++ remove_proc_entry("mb_groups", sbi->s_proc); ++ + if (sbi->s_group_info) { + for (i = 0; i < ngroups; i++) { + grinfo = ext4_get_group_info(sb, i); +@@ -2575,8 +2578,6 @@ int ext4_mb_release(struct super_block * + } + + free_percpu(sbi->s_locality_groups); +- if (sbi->s_proc) +- remove_proc_entry("mb_groups", sbi->s_proc); + + return 0; + } diff --git a/queue-3.0/series b/queue-3.0/series index 6c1d935e142..cf49f4f9e46 100644 --- a/queue-3.0/series +++ b/queue-3.0/series @@ -37,3 +37,8 @@ revert-net-maintain-namespace-isolation-between-vlan-and-real-device.patch sctp-check-cached-dst-before-using-it.patch skb-avoid-unnecessary-reallocations-in-__skb_cow.patch xfrm-take-net-hdr-len-into-account-for-esp-payload-size-calculation.patch +ext4-force-ro-mount-if-ext4_setup_super-fails.patch +ext4-add-missing-save_error_info-to-ext4_error.patch +ext4-don-t-trash-state-flags-in-ext4_ioc_setflags.patch +ext4-add-ext4_mb_unload_buddy-in-the-error-path.patch +ext4-remove-mb_groups-before-tearing-down-the-buddy_cache.patch