Merge 7302e91f39 ("mm/slab_common: use WARN() if cache still has objects on destroy") into android-mainline

Steps on the way to 5.17-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ibf6aeaa6786612e2964fbbaa5adf5e4966d868ec
This commit is contained in:
Greg Kroah-Hartman 2022-02-09 14:42:58 +01:00
commit 6e4ec1bf0e

View File

@ -489,8 +489,6 @@ void slab_kmem_cache_release(struct kmem_cache *s)
void kmem_cache_destroy(struct kmem_cache *s)
{
int err;
if (unlikely(!s))
return;
@ -501,12 +499,9 @@ void kmem_cache_destroy(struct kmem_cache *s)
if (s->refcount)
goto out_unlock;
err = shutdown_cache(s);
if (err) {
pr_err("%s %s: Slab cache still has objects\n",
__func__, s->name);
dump_stack();
}
WARN(shutdown_cache(s),
"%s %s: Slab cache still has objects when called from %pS",
__func__, s->name, (void *)_RET_IP_);
out_unlock:
mutex_unlock(&slab_mutex);
cpus_read_unlock();