]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/jbd2-fix-invalid-descriptor-block-checksum.patch
Linux 4.14.111
[thirdparty/kernel/stable-queue.git] / queue-4.19 / jbd2-fix-invalid-descriptor-block-checksum.patch
1 From 185dd1843fdd9fb85606e1bc858e307355d23392 Mon Sep 17 00:00:00 2001
2 From: luojiajun <luojiajun3@huawei.com>
3 Date: Fri, 1 Mar 2019 00:30:00 -0500
4 Subject: jbd2: fix invalid descriptor block checksum
5
6 [ Upstream commit 6e876c3dd205d30b0db6850e97a03d75457df007 ]
7
8 In jbd2_journal_commit_transaction(), if we are in abort mode,
9 we may flush the buffer without setting descriptor block checksum
10 by goto start_journal_io. Then fs is mounted,
11 jbd2_descriptor_block_csum_verify() failed.
12
13 [ 271.379811] EXT4-fs (vdd): shut down requested (2)
14 [ 271.381827] Aborting journal on device vdd-8.
15 [ 271.597136] JBD2: Invalid checksum recovering block 22199 in log
16 [ 271.598023] JBD2: recovery failed
17 [ 271.598484] EXT4-fs (vdd): error loading journal
18
19 Fix this problem by keep setting descriptor block checksum if the
20 descriptor buffer is not NULL.
21
22 This checksum problem can be reproduced by xfstests generic/388.
23
24 Signed-off-by: luojiajun <luojiajun3@huawei.com>
25 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
26 Reviewed-by: Jan Kara <jack@suse.cz>
27 Signed-off-by: Sasha Levin <sashal@kernel.org>
28 ---
29 fs/jbd2/commit.c | 6 ++++--
30 1 file changed, 4 insertions(+), 2 deletions(-)
31
32 diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
33 index 150cc030b4d7..65ea0355a4f6 100644
34 --- a/fs/jbd2/commit.c
35 +++ b/fs/jbd2/commit.c
36 @@ -691,9 +691,11 @@ void jbd2_journal_commit_transaction(journal_t *journal)
37 the last tag we set up. */
38
39 tag->t_flags |= cpu_to_be16(JBD2_FLAG_LAST_TAG);
40 -
41 - jbd2_descriptor_block_csum_set(journal, descriptor);
42 start_journal_io:
43 + if (descriptor)
44 + jbd2_descriptor_block_csum_set(journal,
45 + descriptor);
46 +
47 for (i = 0; i < bufs; i++) {
48 struct buffer_head *bh = wbuf[i];
49 /*
50 --
51 2.19.1
52