mbcache: don't BUG() if entry cache cannot be allocated

mbcache can be a module that is loaded long after startup, when someone
asks to mount an ext2 or ext4 filesystem.  Therefore it should not BUG()
if kmem_cache_create() fails, but rather just fail the module load.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
This commit is contained in:
Eric Biggers 2016-12-03 15:28:53 -05:00 коммит произвёл Theodore Ts'o
Родитель 918b7306ed
Коммит 21d0f4fa8e
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -420,7 +420,8 @@ static int __init mbcache_init(void)
mb_entry_cache = kmem_cache_create("mbcache",
sizeof(struct mb_cache_entry), 0,
SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, NULL);
BUG_ON(!mb_entry_cache);
if (!mb_entry_cache)
return -ENOMEM;
return 0;
}