bcachefs: Don't leak lock pcpu counts memory

This fixes a small memory leak.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2022-08-30 11:40:03 -04:00
parent f5178b34b9
commit c919f53f3b

View File

@ -238,8 +238,6 @@ btree_key_cache_create(struct bch_fs *c,
} else { } else {
if (btree_id == BTREE_ID_subvolumes) if (btree_id == BTREE_ID_subvolumes)
six_lock_pcpu_alloc(&ck->c.lock); six_lock_pcpu_alloc(&ck->c.lock);
else
six_lock_pcpu_free(&ck->c.lock);
} }
ck->c.level = 0; ck->c.level = 0;
@ -688,6 +686,7 @@ static unsigned long bch2_btree_key_cache_scan(struct shrinker *shrink,
break; break;
list_del(&ck->list); list_del(&ck->list);
six_lock_pcpu_free(&ck->c.lock);
kmem_cache_free(bch2_key_cache, ck); kmem_cache_free(bch2_key_cache, ck);
atomic_long_dec(&bc->nr_freed); atomic_long_dec(&bc->nr_freed);
scanned++; scanned++;