]> Git Repo - linux.git/commitdiff
bcachefs: Fix shutdown ordering
authorKent Overstreet <[email protected]>
Wed, 22 May 2024 23:53:03 +0000 (19:53 -0400)
committerKent Overstreet <[email protected]>
Wed, 22 May 2024 23:54:03 +0000 (19:54 -0400)
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]>
fs/bcachefs/printbuf.c
fs/bcachefs/super.c

index 8b0369185f5cfd41c61b4a79449d0abb3463a129..9f529e4c1b16a8e7de6fdefdc074e9c32f697036 100644 (file)
@@ -45,6 +45,13 @@ int bch2_printbuf_make_room(struct printbuf *out, unsigned extra)
 
        unsigned new_size = roundup_pow_of_two(out->size + extra);
 
+       /* Sanity check... */
+       if (new_size > PAGE_SIZE << MAX_PAGE_ORDER) {
+               out->allocation_failure = true;
+               out->overflow = true;
+               return -ENOMEM;
+       }
+
        /*
         * Note: output buffer must be freeable with kfree(), it's not required
         * that the user use printbuf_exit().
index 294a9d35a9f251629299672b97af4189b15fe72c..2206a8dee693ab1ce183ec621860c72fcf5bb7e9 100644 (file)
@@ -551,9 +551,9 @@ static void __bch2_fs_free(struct bch_fs *c)
        bch2_fs_io_read_exit(c);
        bch2_fs_buckets_waiting_for_journal_exit(c);
        bch2_fs_btree_interior_update_exit(c);
-       bch2_fs_btree_iter_exit(c);
        bch2_fs_btree_key_cache_exit(&c->btree_key_cache);
        bch2_fs_btree_cache_exit(c);
+       bch2_fs_btree_iter_exit(c);
        bch2_fs_replicas_exit(c);
        bch2_fs_journal_exit(&c->journal);
        bch2_io_clock_exit(&c->io_clock[WRITE]);
This page took 0.070981 seconds and 4 git commands to generate.