Re: [PATCH 5.4 bp v2] ext4: don't remount read-only with errors=continue on reboot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri 01-01-21 17:03:21, Jinoh Kang wrote:
> From: Jan Kara <jack@xxxxxxx>
> 
> commit b08070eca9e247f60ab39d79b2c25d274750441f upstream.
> 
> ext4_handle_error() with errors=continue mount option can accidentally
> remount the filesystem read-only when the system is rebooting. Fix that.
> 
> Fixes: 1dc1097ff60e ("ext4: avoid panic during forced reboot")
> Signed-off-by: Jan Kara <jack@xxxxxxx>
> Reviewed-by: Andreas Dilger <adilger@xxxxxxxxx>
> Cc: stable@xxxxxxxxxx
> Link: https://lore.kernel.org/r/20201127113405.26867-2-jack@xxxxxxx
> Signed-off-by: Theodore Ts'o <tytso@xxxxxxx>
> [jinoh: backport accounting for missing
>   commit 9b5f6c9b83d9 ("ext4: make s_mount_flags modifications atomic")]
> Signed-off-by: Jinoh Kang <jinoh.kang.kr@xxxxxxxxx>
> ---
> v1 --> v2: added missing comment and signoff
> Apologies for wasted traffic...
> 
> Please disregard the previous mail, which was in a wrong thread:
> - <5611c936-5913-d570-36a4-2b2ed209cd88@xxxxxxxxx> [PATCH 5.4 bp]
> That said, the patches for 4.19 and 5.4 have the same patch ID.

The backport looks good to me. Thanks!

								Honza

> ---
>  fs/ext4/super.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 920658ca8777..06568467b0c2 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -455,19 +455,17 @@ static bool system_going_down(void)
>  
>  static void ext4_handle_error(struct super_block *sb)
>  {
> +	journal_t *journal = EXT4_SB(sb)->s_journal;
> +
>  	if (test_opt(sb, WARN_ON_ERROR))
>  		WARN_ON_ONCE(1);
>  
> -	if (sb_rdonly(sb))
> +	if (sb_rdonly(sb) || test_opt(sb, ERRORS_CONT))
>  		return;
>  
> -	if (!test_opt(sb, ERRORS_CONT)) {
> -		journal_t *journal = EXT4_SB(sb)->s_journal;
> -
> -		EXT4_SB(sb)->s_mount_flags |= EXT4_MF_FS_ABORTED;
> -		if (journal)
> -			jbd2_journal_abort(journal, -EIO);
> -	}
> +	EXT4_SB(sb)->s_mount_flags |= EXT4_MF_FS_ABORTED;
> +	if (journal)
> +		jbd2_journal_abort(journal, -EIO);
>  	/*
>  	 * We force ERRORS_RO behavior when system is rebooting. Otherwise we
>  	 * could panic during 'reboot -f' as the underlying device got already
> -- 
> 2.26.2
> 
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux