Skip to content

Commit bedd6fe

Browse files
author
Kent Overstreet
committed
bcachefs: Fix nocow locks deadlock
On trylock failure we were waiting for outstanding reads to complete - but nocow locks need to be held until the whole move is finished. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent a66ff26 commit bedd6fe

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

fs/bcachefs/data_update.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,8 @@ int bch2_data_update_init(struct btree_trans *trans,
560560
move_ctxt_wait_event(ctxt,
561561
(locked = bch2_bucket_nocow_trylock(&c->nocow_locks,
562562
PTR_BUCKET_POS(c, &p.ptr), 0)) ||
563-
!atomic_read(&ctxt->read_sectors));
563+
(!atomic_read(&ctxt->read_sectors) &&
564+
!atomic_read(&ctxt->write_sectors)));
564565

565566
if (!locked)
566567
bch2_bucket_nocow_lock(&c->nocow_locks,

0 commit comments

Comments
 (0)