summary refs log tree commit diff
path: root/fs
diff options
context:
space:
mode:
authorLukas Czerner <lczerner@redhat.com>2011-02-03 14:33:33 -0500
committerTheodore Ts'o <tytso@mit.edu>2011-02-03 14:33:33 -0500
commit8f021222c1e2756ea4c9dde93b23e1d2a0a4ec37 (patch)
tree8a74b91a0b1dd27fad9c384449bac0c4b8777a74 /fs
parent8f1f745331c1b560f53c0d60e55a4f4f43f7cce5 (diff)
downloadlinux-8f021222c1e2756ea4c9dde93b23e1d2a0a4ec37.tar.gz
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: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: stable@kernel.org
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/super.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 3d8cf2cab379..4898cb1ff606 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4769,7 +4769,7 @@ static struct file_system_type ext4_fs_type = {
 	.fs_flags	= FS_REQUIRES_DEV,
 };
 
-int __init ext4_init_feat_adverts(void)
+static int __init ext4_init_feat_adverts(void)
 {
 	struct ext4_features *ef;
 	int ret = -ENOMEM;
@@ -4793,6 +4793,13 @@ out:
 	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)
 {
 	int err;
@@ -4839,7 +4846,7 @@ out1:
 out2:
 	ext4_exit_mballoc();
 out3:
-	kfree(ext4_feat);
+	ext4_exit_feat_adverts();
 	remove_proc_entry("fs/ext4", NULL);
 	kset_unregister(ext4_kset);
 out4:
@@ -4858,6 +4865,7 @@ static void __exit ext4_exit_fs(void)
 	destroy_inodecache();
 	ext4_exit_xattr();
 	ext4_exit_mballoc();
+	ext4_exit_feat_adverts();
 	remove_proc_entry("fs/ext4", NULL);
 	kset_unregister(ext4_kset);
 	ext4_exit_system_zone();