Skip to content

Commit

Permalink
bcachefs: Fix srcu lock warning in btree_update_nodes_written()
Browse files Browse the repository at this point in the history
We don't want to be holding the srcu lock while waiting on btree write
completions - easily fixed.

Reported-by: Janpieter Sollie <janpieter.sollie@edpnet.be>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
  • Loading branch information
Kent Overstreet committed Feb 19, 2025
1 parent 4fd509c commit b04974f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/bcachefs/btree_update_interior.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,9 +681,11 @@ static void btree_update_nodes_written(struct btree_update *as)

b = as->old_nodes[i];

bch2_trans_begin(trans);
btree_node_lock_nopath_nofail(trans, &b->c, SIX_LOCK_read);
seq = b->data ? b->data->keys.seq : 0;
six_unlock_read(&b->c.lock);
bch2_trans_unlock_long(trans);

if (seq == as->old_nodes_seq[i])
wait_on_bit_io(&b->flags, BTREE_NODE_write_in_flight_inner,
Expand Down

0 comments on commit b04974f

Please sign in to comment.