]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.0-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Aug 2012 21:44:57 +0000 (14:44 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Aug 2012 21:44:57 +0000 (14:44 -0700)
added patches:
ext4-don-t-let-i_reserved_meta_blocks-go-negative.patch

queue-3.0/ext4-don-t-let-i_reserved_meta_blocks-go-negative.patch [new file with mode: 0644]
queue-3.0/series

diff --git a/queue-3.0/ext4-don-t-let-i_reserved_meta_blocks-go-negative.patch b/queue-3.0/ext4-don-t-let-i_reserved_meta_blocks-go-negative.patch
new file mode 100644 (file)
index 0000000..e06f07c
--- /dev/null
@@ -0,0 +1,53 @@
+From 97795d2a5b8d3c8dc4365d4bd3404191840453ba Mon Sep 17 00:00:00 2001
+From: Brian Foster <bfoster@redhat.com>
+Date: Sun, 22 Jul 2012 23:59:40 -0400
+Subject: ext4: don't let i_reserved_meta_blocks go negative
+
+From: Brian Foster <bfoster@redhat.com>
+
+commit 97795d2a5b8d3c8dc4365d4bd3404191840453ba upstream.
+
+If we hit a condition where we have allocated metadata blocks that
+were not appropriately reserved, we risk underflow of
+ei->i_reserved_meta_blocks.  In turn, this can throw
+sbi->s_dirtyclusters_counter significantly out of whack and undermine
+the nondelalloc fallback logic in ext4_nonda_switch().  Warn if this
+occurs and set i_allocated_meta_blocks to avoid this problem.
+
+This condition is reproduced by xfstests 270 against ext2 with
+delalloc enabled:
+
+Mar 28 08:58:02 localhost kernel: [  171.526344] EXT4-fs (loop1): delayed block allocation failed for inode 14 at logical offset 64486 with max blocks 64 with error -28
+Mar 28 08:58:02 localhost kernel: [  171.526346] EXT4-fs (loop1): This should not happen!! Data will be lost
+
+270 ultimately fails with an inconsistent filesystem and requires an
+fsck to repair.  The cause of the error is an underflow in
+ext4_da_update_reserve_space() due to an unreserved meta block
+allocation.
+
+Signed-off-by: Brian Foster <bfoster@redhat.com>
+Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ext4/inode.c |    9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+--- a/fs/ext4/inode.c
++++ b/fs/ext4/inode.c
+@@ -1134,6 +1134,15 @@ void ext4_da_update_reserve_space(struct
+               used = ei->i_reserved_data_blocks;
+       }
++      if (unlikely(ei->i_allocated_meta_blocks > ei->i_reserved_meta_blocks)) {
++              ext4_msg(inode->i_sb, KERN_NOTICE, "%s: ino %lu, allocated %d "
++                       "with only %d reserved metadata blocks\n", __func__,
++                       inode->i_ino, ei->i_allocated_meta_blocks,
++                       ei->i_reserved_meta_blocks);
++              WARN_ON(1);
++              ei->i_allocated_meta_blocks = ei->i_reserved_meta_blocks;
++      }
++
+       /* Update per-inode reservations */
+       ei->i_reserved_data_blocks -= used;
+       ei->i_reserved_meta_blocks -= ei->i_allocated_meta_blocks;
index 974c1dc9b2449f941e2184d6fb49ac0d3cdb2d7e..e0a95d5330913824b4deb87888258cdca6e45e7d 100644 (file)
@@ -24,3 +24,4 @@ drm-radeon-on-hotplug-force-link-training-to-happen-v2.patch
 nfsd4-our-filesystems-are-normally-case-sensitive.patch
 nfs-skip-commit-in-releasepage-if-we-re-freeing-memory-for-fs-related-reasons.patch
 ext4-pass-a-char-to-ext4_count_free-instead-of-a-buffer_head-ptr.patch
+ext4-don-t-let-i_reserved_meta_blocks-go-negative.patch