We can't allocate memory with GFP_FS while holding the btree cache lock,
and vfree() can allocate memory.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
{
struct btree_cache *bc = &c->btree_cache;
struct btree *b;
- unsigned i;
+ unsigned i, flags;
if (bc->shrink.list.next)
unregister_shrinker(&bc->shrink);
+ /* vfree() can allocate memory: */
+ flags = memalloc_nofs_save();
mutex_lock(&bc->lock);
#ifdef CONFIG_BCACHEFS_DEBUG
}
mutex_unlock(&bc->lock);
+ memalloc_nofs_restore(flags);
if (bc->table_init_done)
rhashtable_destroy(&bc->table);