Skip to content

Commit d293ece

Browse files
author
Kent Overstreet
committed
bcachefs: Fix shutdown ordering
the btree key cache uses the srcu struct created/destroyed by btree_iter.c; btree_iter needs to be exited last. Reported-by: [email protected] Signed-off-by: Kent Overstreet <[email protected]>
1 parent 2195b75 commit d293ece

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

fs/bcachefs/printbuf.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ int bch2_printbuf_make_room(struct printbuf *out, unsigned extra)
4545

4646
unsigned new_size = roundup_pow_of_two(out->size + extra);
4747

48+
/* Sanity check... */
49+
if (new_size > PAGE_SIZE << MAX_PAGE_ORDER) {
50+
out->allocation_failure = true;
51+
out->overflow = true;
52+
return -ENOMEM;
53+
}
54+
4855
/*
4956
* Note: output buffer must be freeable with kfree(), it's not required
5057
* that the user use printbuf_exit().

fs/bcachefs/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,9 +551,9 @@ static void __bch2_fs_free(struct bch_fs *c)
551551
bch2_fs_io_read_exit(c);
552552
bch2_fs_buckets_waiting_for_journal_exit(c);
553553
bch2_fs_btree_interior_update_exit(c);
554-
bch2_fs_btree_iter_exit(c);
555554
bch2_fs_btree_key_cache_exit(&c->btree_key_cache);
556555
bch2_fs_btree_cache_exit(c);
556+
bch2_fs_btree_iter_exit(c);
557557
bch2_fs_replicas_exit(c);
558558
bch2_fs_journal_exit(&c->journal);
559559
bch2_io_clock_exit(&c->io_clock[WRITE]);

0 commit comments

Comments
 (0)