bcachefs: Fix btree for nonexistent tree depth
authorKent Overstreet <kent.overstreet@linux.dev>
Thu, 3 Jul 2025 19:53:51 +0000 (15:53 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Fri, 4 Jul 2025 19:47:13 +0000 (15:47 -0400)
commitc72d628469b8f46251b3afc361269cb15de0c988
treeee4f337639705166d304e93e4a99cf1e3c50f33a
parentddb9680a7226d6081b42869d2875715a17ecb51d
bcachefs: Fix btree for nonexistent tree depth

The fix for when we should increase tree depth in journal replay was
entirely bogus.

We should only increase the tree depth in journal replay when recovery
from btree node scan, and then only for keys found by btree node scan.

This needs additional work - we should be shooting down existing
interior node pointers when recovery from scan, they shouldn't be
showing up here.

Fixes: b47a82ff4772 ("bcachefs: Only run 'increase_depth' for keys from btree node csan")
Cc: Alan Huang <mmpgouride@gmail.com>
Reported-by: syzbot+8deb6ff4415db67a9f18@syzkaller.appspotmail.com
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/recovery.c