Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit e20b269

Browse files
committed
Merge tag 'bcachefs-2024-06-05' of https://evilpiepirate.org/git/bcachefs
Pull bcachefs fixes from Kent Overstreet: "Just a few small fixes" * tag 'bcachefs-2024-06-05' of https://evilpiepirate.org/git/bcachefs: bcachefs: Fix trans->locked assert bcachefs: Rereplicate now moves data off of durability=0 devices bcachefs: Fix GFP_KERNEL allocation in break_cycle()
2 parents 558dc49 + 319fef2 commit e20b269

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

fs/bcachefs/btree_locking.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ static noinline int break_cycle(struct lock_graph *g, struct printbuf *cycle)
215215

216216
if (unlikely(!best)) {
217217
struct printbuf buf = PRINTBUF;
218+
buf.atomic++;
218219

219220
prt_printf(&buf, bch2_fmt(g->g->trans->c, "cycle of nofail locks"));
220221

fs/bcachefs/move.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ static int bch2_move_data_btree(struct moving_context *ctxt,
547547
ctxt->stats->pos = BBPOS(btree_id, start);
548548
}
549549

550+
bch2_trans_begin(trans);
550551
bch2_trans_iter_init(trans, &iter, btree_id, start,
551552
BTREE_ITER_prefetch|
552553
BTREE_ITER_all_snapshots);
@@ -920,7 +921,20 @@ static bool rereplicate_pred(struct bch_fs *c, void *arg,
920921
? c->opts.metadata_replicas
921922
: io_opts->data_replicas;
922923

923-
if (!nr_good || nr_good >= replicas)
924+
rcu_read_lock();
925+
struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k);
926+
unsigned i = 0;
927+
bkey_for_each_ptr(ptrs, ptr) {
928+
struct bch_dev *ca = bch2_dev_rcu(c, ptr->dev);
929+
if (!ptr->cached &&
930+
(!ca || !ca->mi.durability))
931+
data_opts->kill_ptrs |= BIT(i);
932+
i++;
933+
}
934+
rcu_read_unlock();
935+
936+
if (!data_opts->kill_ptrs &&
937+
(!nr_good || nr_good >= replicas))
924938
return false;
925939

926940
data_opts->target = 0;

0 commit comments

Comments
 (0)