bcachefs: Fix lock ordering with snapshot_create_lock
authorKent Overstreet <kent.overstreet@linux.dev>
Thu, 19 Oct 2023 19:23:56 +0000 (15:23 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Tue, 31 Oct 2023 16:18:11 +0000 (12:18 -0400)
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>
fs/bcachefs/snapshot.c

index 4982468..5a62d2e 100644 (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,