summaryrefslogtreecommitdiff
path: root/fs/mbcache.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2016-12-03 23:28:53 +0300
committerTheodore Ts'o <tytso@mit.edu>2016-12-03 23:28:53 +0300
commit21d0f4fa8e7b026cdae988f99f4c3aab154d5b7c (patch)
tree87b17f432155f7664d478d5a23588fdda388eadd /fs/mbcache.c
parent918b7306edacbcc8a9ca318a5a34d73954e1705d (diff)
downloadlinux-21d0f4fa8e7b026cdae988f99f4c3aab154d5b7c.tar.xz
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>
Diffstat (limited to 'fs/mbcache.c')
-rw-r--r--fs/mbcache.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/mbcache.c b/fs/mbcache.c
index 31e54c25d16f..c56ab2164d6b 100644
--- a/fs/mbcache.c
+++ b/fs/mbcache.c
@@ -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;
}