Commit 8f021222 authored by Lukas Czerner's avatar Lukas Czerner Committed by Theodore Ts'o

ext4: unregister features interface on module unload

Ext4 features interface was not properly unregistered which led to
problems while unloading/reloading ext4 module. This commit fixes that by
adding proper kobject unregistration code into ext4_exit_fs() as well as
fail-path of ext4_init_fs()
Reported-by: default avatarEric Sandeen <sandeen@redhat.com>
Signed-off-by: default avatarLukas Czerner <lczerner@redhat.com>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
Cc: stable@kernel.org
parent 8f1f7453
...@@ -4769,7 +4769,7 @@ static struct file_system_type ext4_fs_type = { ...@@ -4769,7 +4769,7 @@ static struct file_system_type ext4_fs_type = {
.fs_flags = FS_REQUIRES_DEV, .fs_flags = FS_REQUIRES_DEV,
}; };
int __init ext4_init_feat_adverts(void) static int __init ext4_init_feat_adverts(void)
{ {
struct ext4_features *ef; struct ext4_features *ef;
int ret = -ENOMEM; int ret = -ENOMEM;
...@@ -4793,6 +4793,13 @@ int __init ext4_init_feat_adverts(void) ...@@ -4793,6 +4793,13 @@ int __init ext4_init_feat_adverts(void)
return ret; return ret;
} }
static void ext4_exit_feat_adverts(void)
{
kobject_put(&ext4_feat->f_kobj);
wait_for_completion(&ext4_feat->f_kobj_unregister);
kfree(ext4_feat);
}
static int __init ext4_init_fs(void) static int __init ext4_init_fs(void)
{ {
int err; int err;
...@@ -4839,7 +4846,7 @@ static int __init ext4_init_fs(void) ...@@ -4839,7 +4846,7 @@ static int __init ext4_init_fs(void)
out2: out2:
ext4_exit_mballoc(); ext4_exit_mballoc();
out3: out3:
kfree(ext4_feat); ext4_exit_feat_adverts();
remove_proc_entry("fs/ext4", NULL); remove_proc_entry("fs/ext4", NULL);
kset_unregister(ext4_kset); kset_unregister(ext4_kset);
out4: out4:
...@@ -4858,6 +4865,7 @@ static void __exit ext4_exit_fs(void) ...@@ -4858,6 +4865,7 @@ static void __exit ext4_exit_fs(void)
destroy_inodecache(); destroy_inodecache();
ext4_exit_xattr(); ext4_exit_xattr();
ext4_exit_mballoc(); ext4_exit_mballoc();
ext4_exit_feat_adverts();
remove_proc_entry("fs/ext4", NULL); remove_proc_entry("fs/ext4", NULL);
kset_unregister(ext4_kset); kset_unregister(ext4_kset);
ext4_exit_system_zone(); ext4_exit_system_zone();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment