bcachefs: Fix an assert in copygc thread shutdown path
authorKent Overstreet <kent.overstreet@linux.dev>
Tue, 14 Mar 2023 15:48:07 +0000 (11:48 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:57 +0000 (17:09 -0400)
We're not supposed to have nested (locked) btree_trans on the stack:
this means copygc shutdown needs to exit our btree_trans before exiting
the move_ctxt, which calls bch2_write().

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/movinggc.c

index 4d8d013fe4fc1f10bd55941969ef5bcc2e2ced37..4762594f628700681bed06f2b509002ef9b29a3c 100644 (file)
@@ -334,8 +334,8 @@ static int bch2_copygc_thread(void *arg)
                wake_up(&c->copygc_running_wq);
        }
 
-       bch2_moving_ctxt_exit(&ctxt);
        bch2_trans_exit(&trans);
+       bch2_moving_ctxt_exit(&ctxt);
        free_fifo(&move_buckets);
 
        return 0;