bcachefs: Fix lock ordering with snapshot_create_lock

We must not hold btree locks while taking snapshot_create_lock - this
fixes a lockdep splat.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2023-10-19 15:23:56 -04:00
parent 20e425d301
commit 0dd092bf10

View file

@ -1447,6 +1447,7 @@ int bch2_delete_dead_snapshots(struct bch_fs *c)
}
}
bch2_trans_unlock(trans);
down_write(&c->snapshot_create_lock);
for_each_btree_key(trans, iter, BTREE_ID_snapshots,