[PATCH] bcachefs: mark invalid_btree_id autofix

Bharadwaj Raju posted 1 patch 3 months, 1 week ago
fs/bcachefs/sb-errors_format.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] bcachefs: mark invalid_btree_id autofix
Posted by Bharadwaj Raju 3 months, 1 week ago
Checking for invalid IDs was introduced in 9e7cfb35e266 ("bcachefs: Check for invalid btree IDs")
to prevent an invalid shift later, but since 141526548052 ("bcachefs: Bad btree roots are now autofix")
which made btree_root_bkey_invalid autofix, the fsck_err_on call didn't
do anything.

We can mark this err type (invalid_btree_id) autofix as well, so it gets
handled.

Reported-by: syzbot+029d1989099aa5ae3e89@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=029d1989099aa5ae3e89
Fixes: 141526548052 ("bcachefs: Bad btree roots are now autofix")

Signed-off-by: Bharadwaj Raju <bharadwaj.raju777@gmail.com>
---
 fs/bcachefs/sb-errors_format.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/bcachefs/sb-errors_format.h b/fs/bcachefs/sb-errors_format.h
index 0641fb634bd4..d154b7651d28 100644
--- a/fs/bcachefs/sb-errors_format.h
+++ b/fs/bcachefs/sb-errors_format.h
@@ -314,7 +314,7 @@ enum bch_fsck_flags {
 	x(accounting_mismatch,					272,	FSCK_AUTOFIX)	\
 	x(accounting_replicas_not_marked,			273,	0)		\
 	x(accounting_to_invalid_device,				289,	0)		\
-	x(invalid_btree_id,					274,	0)		\
+	x(invalid_btree_id,					274,	FSCK_AUTOFIX)		\
 	x(alloc_key_io_time_bad,				275,	0)		\
 	x(alloc_key_fragmentation_lru_wrong,			276,	FSCK_AUTOFIX)	\
 	x(accounting_key_junk_at_end,				277,	FSCK_AUTOFIX)	\
-- 
2.50.0
Re: [PATCH] bcachefs: mark invalid_btree_id autofix
Posted by Kent Overstreet 3 months, 1 week ago
On Fri, Jun 27, 2025 at 10:11:29PM +0530, Bharadwaj Raju wrote:
> Checking for invalid IDs was introduced in 9e7cfb35e266 ("bcachefs: Check for invalid btree IDs")
> to prevent an invalid shift later, but since 141526548052 ("bcachefs: Bad btree roots are now autofix")
> which made btree_root_bkey_invalid autofix, the fsck_err_on call didn't
> do anything.
> 
> We can mark this err type (invalid_btree_id) autofix as well, so it gets
> handled.

Thanks, applied

> Reported-by: syzbot+029d1989099aa5ae3e89@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=029d1989099aa5ae3e89
> Fixes: 141526548052 ("bcachefs: Bad btree roots are now autofix")
> 
> Signed-off-by: Bharadwaj Raju <bharadwaj.raju777@gmail.com>
> ---
>  fs/bcachefs/sb-errors_format.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/bcachefs/sb-errors_format.h b/fs/bcachefs/sb-errors_format.h
> index 0641fb634bd4..d154b7651d28 100644
> --- a/fs/bcachefs/sb-errors_format.h
> +++ b/fs/bcachefs/sb-errors_format.h
> @@ -314,7 +314,7 @@ enum bch_fsck_flags {
>  	x(accounting_mismatch,					272,	FSCK_AUTOFIX)	\
>  	x(accounting_replicas_not_marked,			273,	0)		\
>  	x(accounting_to_invalid_device,				289,	0)		\
> -	x(invalid_btree_id,					274,	0)		\
> +	x(invalid_btree_id,					274,	FSCK_AUTOFIX)		\
>  	x(alloc_key_io_time_bad,				275,	0)		\
>  	x(alloc_key_fragmentation_lru_wrong,			276,	FSCK_AUTOFIX)	\
>  	x(accounting_key_junk_at_end,				277,	FSCK_AUTOFIX)	\
> -- 
> 2.50.0
>