summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0061-ext4-don-t-let-i_reserved_meta_blocks-go-negative.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0061-ext4-don-t-let-i_reserved_meta_blocks-go-negative.patch')
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0061-ext4-don-t-let-i_reserved_meta_blocks-go-negative.patch55
1 files changed, 55 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0061-ext4-don-t-let-i_reserved_meta_blocks-go-negative.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0061-ext4-don-t-let-i_reserved_meta_blocks-go-negative.patch
new file mode 100644
index 00000000..428571df
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.25/0061-ext4-don-t-let-i_reserved_meta_blocks-go-negative.patch
@@ -0,0 +1,55 @@
1From a09474d4d4bba3e468ff96d826b90b5551f98111 Mon Sep 17 00:00:00 2001
2From: Brian Foster <bfoster@redhat.com>
3Date: Sun, 22 Jul 2012 23:59:40 -0400
4Subject: [PATCH 61/73] ext4: don't let i_reserved_meta_blocks go negative
5
6commit 97795d2a5b8d3c8dc4365d4bd3404191840453ba upstream.
7
8If we hit a condition where we have allocated metadata blocks that
9were not appropriately reserved, we risk underflow of
10ei->i_reserved_meta_blocks. In turn, this can throw
11sbi->s_dirtyclusters_counter significantly out of whack and undermine
12the nondelalloc fallback logic in ext4_nonda_switch(). Warn if this
13occurs and set i_allocated_meta_blocks to avoid this problem.
14
15This condition is reproduced by xfstests 270 against ext2 with
16delalloc enabled:
17
18Mar 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
19Mar 28 08:58:02 localhost kernel: [ 171.526346] EXT4-fs (loop1): This should not happen!! Data will be lost
20
21270 ultimately fails with an inconsistent filesystem and requires an
22fsck to repair. The cause of the error is an underflow in
23ext4_da_update_reserve_space() due to an unreserved meta block
24allocation.
25
26Signed-off-by: Brian Foster <bfoster@redhat.com>
27Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
28Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
29---
30 fs/ext4/inode.c | 9 +++++++++
31 1 files changed, 9 insertions(+), 0 deletions(-)
32
33diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
34index d0dc109..03373c3 100644
35--- a/fs/ext4/inode.c
36+++ b/fs/ext4/inode.c
37@@ -277,6 +277,15 @@ void ext4_da_update_reserve_space(struct inode *inode,
38 used = ei->i_reserved_data_blocks;
39 }
40
41+ if (unlikely(ei->i_allocated_meta_blocks > ei->i_reserved_meta_blocks)) {
42+ ext4_msg(inode->i_sb, KERN_NOTICE, "%s: ino %lu, allocated %d "
43+ "with only %d reserved metadata blocks\n", __func__,
44+ inode->i_ino, ei->i_allocated_meta_blocks,
45+ ei->i_reserved_meta_blocks);
46+ WARN_ON(1);
47+ ei->i_allocated_meta_blocks = ei->i_reserved_meta_blocks;
48+ }
49+
50 /* Update per-inode reservations */
51 ei->i_reserved_data_blocks -= used;
52 ei->i_reserved_meta_blocks -= ei->i_allocated_meta_blocks;
53--
541.7.7.6
55