linux-bcachefs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kent Overstreet <kent.overstreet@linux.dev>
To: linux-bcachefs@vger.kernel.org
Cc: Kent Overstreet <kent.overstreet@linux.dev>,
	syzbot+c5e7a66b3b23ae65d44f@syzkaller.appspotmail.com
Subject: [PATCH 5/7] bcachefs: Don't build aux search tree when still repairing node
Date: Wed, 16 Jul 2025 12:01:39 -0400	[thread overview]
Message-ID: <20250716160141.1158722-5-kent.overstreet@linux.dev> (raw)
In-Reply-To: <20250716160141.1158722-1-kent.overstreet@linux.dev>

bch2_btree_node_drop_keys_outside_node() will (re)build aux search
trees, because it's also called by topology repair.

bch2_btree_node_read_done() was calling it before validating individual
keys; invalid ones have to be dropped.

If we call drop_keys_outside_node() first, then
bch2_bset_build_aux_tree() doesn't run because the node already has an
aux search tree - which was invalidated by the repair.

Reported-by: syzbot+c5e7a66b3b23ae65d44f@syzkaller.appspotmail.com
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
---
 fs/bcachefs/btree_io.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c
index a4cc72986e36..590cd29f3e86 100644
--- a/fs/bcachefs/btree_io.c
+++ b/fs/bcachefs/btree_io.c
@@ -1295,9 +1295,6 @@ int bch2_btree_node_read_done(struct bch_fs *c, struct bch_dev *ca,
 
 	btree_bounce_free(c, btree_buf_bytes(b), used_mempool, sorted);
 
-	if (updated_range)
-		bch2_btree_node_drop_keys_outside_node(b);
-
 	i = &b->data->keys;
 	for (k = i->start; k != vstruct_last(i);) {
 		struct bkey tmp;
@@ -1335,6 +1332,9 @@ int bch2_btree_node_read_done(struct bch_fs *c, struct bch_dev *ca,
 
 	btree_node_reset_sib_u64s(b);
 
+	if (updated_range)
+		bch2_btree_node_drop_keys_outside_node(b);
+
 	/*
 	 * XXX:
 	 *
-- 
2.50.0


  parent reply	other threads:[~2025-07-16 16:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-16 16:01 [PATCH 1/7] bcachefs: io_read: remove from async obj list in rbio_done() Kent Overstreet
2025-07-16 16:01 ` [PATCH 2/7] bcachefs: async_objs: update iter pos after obj printed Kent Overstreet
2025-07-16 16:01 ` [PATCH 3/7] bcachefs: Fix triggering of discard by the journal path Kent Overstreet
2025-07-16 16:01 ` [PATCH 4/7] bcachefs: Tweak threshold for allocator triggering discards Kent Overstreet
2025-07-16 16:01 ` Kent Overstreet [this message]
2025-07-16 16:01 ` [PATCH 6/7] bcachefs: Fix reference to invalid bucket in copygc Kent Overstreet
2025-07-16 16:01 ` [PATCH 7/7] bcachefs: Fix build when CONFIG_UNICODE=n Kent Overstreet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250716160141.1158722-5-kent.overstreet@linux.dev \
    --to=kent.overstreet@linux.dev \
    --cc=linux-bcachefs@vger.kernel.org \
    --cc=syzbot+c5e7a66b3b23ae65d44f@syzkaller.appspotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).