* [PATCH] jbd2: fix invalid descriptor block checksum
@ 2019-02-26 1:31 luojiajun
2019-02-26 12:47 ` Jan Kara
0 siblings, 1 reply; 3+ messages in thread
From: luojiajun @ 2019-02-26 1:31 UTC (permalink / raw)
To: linux-ext4; +Cc: tytso, jack, yi.zhang, miaoxie
In jbd2_journal_commit_transaction(), if we are in abort mode,
we may flush the buffer without setting descriptor block checksum
by goto start_journal_io. Then fs is mounted,
jbd2_descriptor_block_csum_verify() failed.
[ 271.379811] EXT4-fs (vdd): shut down requested (2)
[ 271.381827] Aborting journal on device vdd-8.
[ 271.597136] JBD2: Invalid checksum recovering block 22199 in log
[ 271.598023] JBD2: recovery failed
[ 271.598484] EXT4-fs (vdd): error loading journal
Fix this problem by keep setting descriptor block checksum if the
descriptor buffer is not NULL.
This checksum problem can be reproduced by xfstests generic/388.
Signed-off-by: luojiajun <luojiajun3@huawei.com>
---
fs/jbd2/commit.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index 150cc03..bb47692 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -691,9 +691,11 @@ void jbd2_journal_commit_transaction(journal_t *journal)
the last tag we set up. */
tag->t_flags |= cpu_to_be16(JBD2_FLAG_LAST_TAG);
+start_journal_io:
+ if (descriptor)
+ jbd2_descriptor_block_csum_set(journal,
+ descriptor);
- jbd2_descriptor_block_csum_set(journal, descriptor);
-start_journal_io:
for (i = 0; i < bufs; i++) {
struct buffer_head *bh = wbuf[i];
/*
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] jbd2: fix invalid descriptor block checksum
2019-02-26 1:31 [PATCH] jbd2: fix invalid descriptor block checksum luojiajun
@ 2019-02-26 12:47 ` Jan Kara
2019-03-01 5:30 ` Theodore Y. Ts'o
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2019-02-26 12:47 UTC (permalink / raw)
To: luojiajun; +Cc: linux-ext4, tytso, jack, yi.zhang, miaoxie
On Tue 26-02-19 09:31:25, luojiajun wrote:
> In jbd2_journal_commit_transaction(), if we are in abort mode,
> we may flush the buffer without setting descriptor block checksum
> by goto start_journal_io. Then fs is mounted,
> jbd2_descriptor_block_csum_verify() failed.
>
> [ 271.379811] EXT4-fs (vdd): shut down requested (2)
> [ 271.381827] Aborting journal on device vdd-8.
> [ 271.597136] JBD2: Invalid checksum recovering block 22199 in log
> [ 271.598023] JBD2: recovery failed
> [ 271.598484] EXT4-fs (vdd): error loading journal
>
> Fix this problem by keep setting descriptor block checksum if the
> descriptor buffer is not NULL.
>
> This checksum problem can be reproduced by xfstests generic/388.
>
> Signed-off-by: luojiajun <luojiajun3@huawei.com>
The patch looks good to me. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/jbd2/commit.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
> index 150cc03..bb47692 100644
> --- a/fs/jbd2/commit.c
> +++ b/fs/jbd2/commit.c
> @@ -691,9 +691,11 @@ void jbd2_journal_commit_transaction(journal_t *journal)
> the last tag we set up. */
>
> tag->t_flags |= cpu_to_be16(JBD2_FLAG_LAST_TAG);
> +start_journal_io:
> + if (descriptor)
> + jbd2_descriptor_block_csum_set(journal,
> + descriptor);
>
> - jbd2_descriptor_block_csum_set(journal, descriptor);
> -start_journal_io:
> for (i = 0; i < bufs; i++) {
> struct buffer_head *bh = wbuf[i];
> /*
> --
> 2.7.4
>
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] jbd2: fix invalid descriptor block checksum
2019-02-26 12:47 ` Jan Kara
@ 2019-03-01 5:30 ` Theodore Y. Ts'o
0 siblings, 0 replies; 3+ messages in thread
From: Theodore Y. Ts'o @ 2019-03-01 5:30 UTC (permalink / raw)
To: Jan Kara; +Cc: luojiajun, linux-ext4, jack, yi.zhang, miaoxie
On Tue, Feb 26, 2019 at 01:47:10PM +0100, Jan Kara wrote:
> On Tue 26-02-19 09:31:25, luojiajun wrote:
> > In jbd2_journal_commit_transaction(), if we are in abort mode,
> > we may flush the buffer without setting descriptor block checksum
> > by goto start_journal_io. Then fs is mounted,
> > jbd2_descriptor_block_csum_verify() failed.
> >
> > [ 271.379811] EXT4-fs (vdd): shut down requested (2)
> > [ 271.381827] Aborting journal on device vdd-8.
> > [ 271.597136] JBD2: Invalid checksum recovering block 22199 in log
> > [ 271.598023] JBD2: recovery failed
> > [ 271.598484] EXT4-fs (vdd): error loading journal
> >
> > Fix this problem by keep setting descriptor block checksum if the
> > descriptor buffer is not NULL.
> >
> > This checksum problem can be reproduced by xfstests generic/388.
> >
> > Signed-off-by: luojiajun <luojiajun3@huawei.com>
>
> The patch looks good to me. You can add:
>
> Reviewed-by: Jan Kara <jack@suse.cz>
Thanks, applied.
- Ted
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-03-01 5:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-26 1:31 [PATCH] jbd2: fix invalid descriptor block checksum luojiajun
2019-02-26 12:47 ` Jan Kara
2019-03-01 5:30 ` Theodore Y. Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).