bcachefs: Fix another lockdep splat
vfree() can allocate memory, so we need to call memalloc_nofs_save(). Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
505b7a4c28
commit
97c0e19502
|
@ -253,7 +253,7 @@ static unsigned long bch2_btree_cache_scan(struct shrinker *shrink,
|
|||
unsigned long can_free;
|
||||
unsigned long touched = 0;
|
||||
unsigned long freed = 0;
|
||||
unsigned i;
|
||||
unsigned i, flags;
|
||||
|
||||
if (btree_shrinker_disabled(c))
|
||||
return SHRINK_STOP;
|
||||
|
@ -264,6 +264,8 @@ static unsigned long bch2_btree_cache_scan(struct shrinker *shrink,
|
|||
else if (!mutex_trylock(&bc->lock))
|
||||
return -1;
|
||||
|
||||
flags = memalloc_nofs_save();
|
||||
|
||||
/*
|
||||
* It's _really_ critical that we don't free too many btree nodes - we
|
||||
* have to always leave ourselves a reserve. The reserve is how we
|
||||
|
@ -327,6 +329,7 @@ restart:
|
|||
clear_btree_node_accessed(b);
|
||||
}
|
||||
|
||||
memalloc_nofs_restore(flags);
|
||||
mutex_unlock(&bc->lock);
|
||||
out:
|
||||
return (unsigned long) freed * btree_pages(c);
|
||||
|
|
Loading…
Reference in New Issue