Re: [PATCH 4.4 49/91] ext4: preserve the needs_recovery flag when the journal is aborted

From: Ben Hutchings
Date: Fri Mar 10 2017 - 11:58:54 EST


On Fri, 2017-03-10 at 10:08 +0100, Greg Kroah-Hartman wrote:
> 4.4-stable review patch.ÂÂIf anyone has any objections, please let me know.
>
> ------------------
>
> From: Theodore Ts'o <tytso@xxxxxxx>
>
> commit 97abd7d4b5d9c48ec15c425485f054e1c15e591b upstream.
>
> If the journal is aborted, the needs_recovery feature flag should not
> be removed.ÂÂOtherwise, it's the journal might not get replayed and
> this could lead to more data getting lost.
>
> Signed-off-by: Theodore Ts'o <tytso@xxxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>
> ---
> Âfs/ext4/super.c |ÂÂÂÂ6 ++++--
> Â1 file changed, 4 insertions(+), 2 deletions(-)
>
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
[...]
> @@ -802,9 +803,10 @@ static void ext4_put_super(struct super_
> Â destroy_workqueue(sbi->rsv_conversion_wq);
> Â
> Â if (sbi->s_journal) {
> + aborted = is_journal_aborted(sbi->s_journal);
> Â err = jbd2_journal_destroy(sbi->s_journal);
> Â sbi->s_journal = NULL;
> - if (err < 0)
> + if ((err < 0) && !aborted)
> Â ext4_abort(sb, "Couldn't clean up the journal");
[...]

Shouldn't the aborted flag also be set here when err < 0?

Ben.

--
Ben Hutchings
If you seem to know what you are doing, you'll be given more to do.

Attachment: signature.asc
Description: This is a digitally signed message part