Skip to content

Commit

Permalink
ext4: do not destroy ext4_groupinfo_caches if ext4_mb_init() fails
Browse files Browse the repository at this point in the history
Caches from 'ext4_groupinfo_caches' may be in use by other mounts,
which have already existed.  So, it is incorrect to destroy them when
newly requested mount fails.

Found by Linux File System Verification project (linuxtesting.org).

Signed-off-by: Andrey Tsyvarev <tsyvarev@ispras.ru>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
  • Loading branch information
Andrey Tsyvarev authored and Theodore Ts'o committed May 12, 2014
1 parent c197855 commit 029b10c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions fs/ext4/mballoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2617,7 +2617,7 @@ int ext4_mb_init(struct super_block *sb)
sbi->s_locality_groups = alloc_percpu(struct ext4_locality_group);
if (sbi->s_locality_groups == NULL) {
ret = -ENOMEM;
goto out_free_groupinfo_slab;
goto out;
}
for_each_possible_cpu(i) {
struct ext4_locality_group *lg;
Expand All @@ -2642,8 +2642,6 @@ int ext4_mb_init(struct super_block *sb)
out_free_locality_groups:
free_percpu(sbi->s_locality_groups);
sbi->s_locality_groups = NULL;
out_free_groupinfo_slab:
ext4_groupinfo_destroy_slabs();
out:
kfree(sbi->s_mb_offsets);
sbi->s_mb_offsets = NULL;
Expand Down

0 comments on commit 029b10c

Please sign in to comment.