On Mon, Jul 01, 2024 at 10:36:06PM GMT, Lizhi Xu wrote:
> Error logs:
> [ T5078] invalid journal entry, version=1.7: mi_btree_bitmap type=btree_keys 
> in superblock: k->u64s 0, shutting down
> [ T5078] invalid journal entry, version=1.7: mi_btree_bitmap type=btree_keys 
> in superblock: k->u64s 0, shutting down
> [ T5078] invalid journal entry, version=1.7: mi_btree_bitmap type=btree_keys 
> in superblock: k->u64s 0, shutting down
> 
> When hit -BCH_ERR_fsck_errors_not_fixed in journal_entry_err, it will make
> journal_entry_btree_keys_validate output too many same error log, and it will 
> block
> bch2_fs_start to release state_lock.
> 
> Reported-and-tested-by: [email protected]
> Closes: https://syzkaller.appspot.com/bug?extid=8996d8f176cf946ef641
> Signed-off-by: Lizhi Xu <[email protected]>
> ---
>  fs/bcachefs/journal_io.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c
> index 492426c8d869..67c3f09162e4 100644
> --- a/fs/bcachefs/journal_io.c
> +++ b/fs/bcachefs/journal_io.c
> @@ -415,6 +415,8 @@ static int journal_entry_btree_keys_validate(struct 
> bch_fs *c,
>                                              flags|BCH_VALIDATE_journal);
>               if (ret == FSCK_DELETED_KEY)
>                       continue;
> +             else if (ret == -BCH_ERR_fsck_errors_not_fixed)
> +                     break;

Actually, this is wrong: we need to return the error


commit b2879202fa55861d05088bbffdb529cf5d5ba7f8
Author: Kent Overstreet <[email protected]>
Date:   Thu Jul 4 21:18:06 2024 -0400

    bcachefs: Fix missing error check in journal_entry_btree_keys_validate()
    
    Closes: https://syzkaller.appspot.com/bug?extid=8996d8f176cf946ef641
    Signed-off-by: Kent Overstreet <[email protected]>

diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c
index 40ed7a619594..7a833a3f1c63 100644
--- a/fs/bcachefs/journal_io.c
+++ b/fs/bcachefs/journal_io.c
@@ -415,6 +415,8 @@ static int journal_entry_btree_keys_validate(struct bch_fs 
*c,
                                               flags|BCH_VALIDATE_journal);
                if (ret == FSCK_DELETED_KEY)
                        continue;
+               else if (ret)
+                       return ret;
 
                k = bkey_next(k);
        }

Reply via email to