add patch do-not-delete-unlinked-inode-from-orphan-list-on-failed-truncate
[ext4-patch-queue.git] / dont-perform-block-validity-checks-on-the-journal-inode
blob3331a75fc6f20798b187fdbd35963c1dd5aeca1c
1 ext4: don't perform block validity checks on the journal inode
3 Since the journal inode is already checked when we added it to the
4 block validity's system zone, if we check it again, we'll just trigger
5 a failure.
7 This was causing failures like this:
9 [   53.897001] EXT4-fs error (device sda): ext4_find_extent:909: inode
10 #8: comm jbd2/sda-8: pblk 121667583 bad header/extent: invalid extent entries - magic f30a, entries 8, max 340(340), depth 0(0)
11 [   53.931430] jbd2_journal_bmap: journal block not found at offset 49 on sda-8
12 [   53.938480] Aborting journal on device sda-8.
14 ... but only if the system was under enough memory pressure that
15 logical->physical mapping for the journal inode gets pushed out of the
16 extent cache.  (This is why it wasn't noticed earlier.)
18 Fixes: 345c0dbf3a30 ("ext4: protect journal inode's blocks using block_validity")
19 Reported-by: Dan Rue <dan.rue@linaro.org>
20 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
21 Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org>
22 ---
23  fs/ext4/extents.c | 12 ++++++++----
24  1 file changed, 8 insertions(+), 4 deletions(-)
26 diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
27 index f2c62e2a0c98..d40ed940001e 100644
28 --- a/fs/ext4/extents.c
29 +++ b/fs/ext4/extents.c
30 @@ -518,10 +518,14 @@ __read_extent_tree_block(const char *function, unsigned int line,
31         }
32         if (buffer_verified(bh) && !(flags & EXT4_EX_FORCE_CACHE))
33                 return bh;
34 -       err = __ext4_ext_check(function, line, inode,
35 -                              ext_block_hdr(bh), depth, pblk);
36 -       if (err)
37 -               goto errout;
38 +       if (!ext4_has_feature_journal(inode->i_sb) ||
39 +           (inode->i_ino !=
40 +            le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_journal_inum))) {
41 +               err = __ext4_ext_check(function, line, inode,
42 +                                      ext_block_hdr(bh), depth, pblk);
43 +               if (err)
44 +                       goto errout;
45 +       }
46         set_buffer_verified(bh);
47         /*
48          * If this is a leaf block, cache all of its entries