diff options
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.patch | 55 |
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 @@ | |||
1 | From a09474d4d4bba3e468ff96d826b90b5551f98111 Mon Sep 17 00:00:00 2001 | ||
2 | From: Brian Foster <bfoster@redhat.com> | ||
3 | Date: Sun, 22 Jul 2012 23:59:40 -0400 | ||
4 | Subject: [PATCH 61/73] ext4: don't let i_reserved_meta_blocks go negative | ||
5 | |||
6 | commit 97795d2a5b8d3c8dc4365d4bd3404191840453ba upstream. | ||
7 | |||
8 | If we hit a condition where we have allocated metadata blocks that | ||
9 | were not appropriately reserved, we risk underflow of | ||
10 | ei->i_reserved_meta_blocks. In turn, this can throw | ||
11 | sbi->s_dirtyclusters_counter significantly out of whack and undermine | ||
12 | the nondelalloc fallback logic in ext4_nonda_switch(). Warn if this | ||
13 | occurs and set i_allocated_meta_blocks to avoid this problem. | ||
14 | |||
15 | This condition is reproduced by xfstests 270 against ext2 with | ||
16 | delalloc enabled: | ||
17 | |||
18 | 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 | ||
19 | Mar 28 08:58:02 localhost kernel: [ 171.526346] EXT4-fs (loop1): This should not happen!! Data will be lost | ||
20 | |||
21 | 270 ultimately fails with an inconsistent filesystem and requires an | ||
22 | fsck to repair. The cause of the error is an underflow in | ||
23 | ext4_da_update_reserve_space() due to an unreserved meta block | ||
24 | allocation. | ||
25 | |||
26 | Signed-off-by: Brian Foster <bfoster@redhat.com> | ||
27 | Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> | ||
28 | Signed-off-by: Ben Hutchings <ben@decadent.org.uk> | ||
29 | --- | ||
30 | fs/ext4/inode.c | 9 +++++++++ | ||
31 | 1 files changed, 9 insertions(+), 0 deletions(-) | ||
32 | |||
33 | diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c | ||
34 | index 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 | -- | ||
54 | 1.7.7.6 | ||
55 | |||