ext4, jbd2: ensure panic when aborting with zero errno
authorzhangyi (F) <yi.zhang@huawei.com>
Wed, 4 Dec 2019 12:46:12 +0000 (20:46 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Feb 2020 07:36:30 +0000 (08:36 +0100)
commit494c30b805501559cda1b92774a64150055f10c0
tree1c43efaff6336a8b0f007d4b491ebe17e8ad1955
parent8343f165f3d4543d47d4e277d01216e55edd915b
ext4, jbd2: ensure panic when aborting with zero errno

[ Upstream commit 51f57b01e4a3c7d7bdceffd84de35144e8c538e7 ]

JBD2_REC_ERR flag used to indicate the errno has been updated when jbd2
aborted, and then __ext4_abort() and ext4_handle_error() can invoke
panic if ERRORS_PANIC is specified. But if the journal has been aborted
with zero errno, jbd2_journal_abort() didn't set this flag so we can
no longer panic. Fix this by always record the proper errno in the
journal superblock.

Fixes: 4327ba52afd03 ("ext4, jbd2: ensure entering into panic after recording an error in superblock")
Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20191204124614.45424-3-yi.zhang@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/jbd2/checkpoint.c
fs/jbd2/journal.c