On Wed, Sep 25, 2024 at 09:53:00PM GMT, Edward Adam Davis wrote: > Syzbot report a kernel BUG in vfs_get_tree. > The root cause is that read_btree_nodes() returned 1 and returned -EINTR > due to kthread_run() execution failure. > > The -EINTR needs to be returnned to bch2_fs_recovery(), not return to > "ret = IS_ERR_OR_NULL(t)". > > Reported-and-tested-by: syzbot+c0360e8367d6d8d04a66@xxxxxxxxxxxxxxxxxxxxxxxxx > Closes: https://syzkaller.appspot.com/bug?extid=c0360e8367d6d8d04a66 > Signed-off-by: Edward Adam Davis <eadavis@xxxxxx> > --- > fs/bcachefs/btree_node_scan.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/fs/bcachefs/btree_node_scan.c b/fs/bcachefs/btree_node_scan.c > index b28c649c6838..df7090ca1e81 100644 > --- a/fs/bcachefs/btree_node_scan.c > +++ b/fs/bcachefs/btree_node_scan.c > @@ -281,6 +281,10 @@ static int read_btree_nodes(struct find_btree_nodes *f) > closure_put(&cl); > f->ret = ret; > bch_err(c, "error starting kthread: %i", ret); > + if (IS_ERR(t)) { > + closure_sync(&cl); > + return PTR_ERR(t); > + } > break; > } > } > -- > 2.43.0 > I fixed this last night with the patch below... commit c1a6f5ca052b7f8609917d13cd11fc60c94396aa Author: Kent Overstreet <kent.overstreet@xxxxxxxxx> Date: Tue Sep 24 19:31:22 2024 -0400 bcachefs: Fix incorrect IS_ERR_OR_NULL usage Returning a positive integer instead of an error code causes error paths to become very confused. Closes: syzbot+c0360e8367d6d8d04a66@xxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Kent Overstreet <kent.overstreet@xxxxxxxxx> diff --git a/fs/bcachefs/btree_node_scan.c b/fs/bcachefs/btree_node_scan.c index b28c649c6838..1e694fedc5da 100644 --- a/fs/bcachefs/btree_node_scan.c +++ b/fs/bcachefs/btree_node_scan.c @@ -275,7 +275,7 @@ static int read_btree_nodes(struct find_btree_nodes *f) w->ca = ca; t = kthread_run(read_btree_nodes_worker, w, "read_btree_nodes/%s", ca->name); - ret = IS_ERR_OR_NULL(t); + ret = PTR_ERR_OR_ZERO(t); if (ret) { percpu_ref_put(&ca->io_ref); closure_put(&cl);