aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext2/super.c')
-rw-r--r--fs/ext2/super.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 748d35afc902..111a31761ffa 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -131,7 +131,10 @@ static void ext2_put_super (struct super_block * sb)
131 131
132 dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); 132 dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
133 133
134 ext2_xattr_put_super(sb); 134 if (sbi->s_mb_cache) {
135 ext2_xattr_destroy_cache(sbi->s_mb_cache);
136 sbi->s_mb_cache = NULL;
137 }
135 if (!(sb->s_flags & MS_RDONLY)) { 138 if (!(sb->s_flags & MS_RDONLY)) {
136 struct ext2_super_block *es = sbi->s_es; 139 struct ext2_super_block *es = sbi->s_es;
137 140
@@ -1104,6 +1107,14 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
1104 ext2_msg(sb, KERN_ERR, "error: insufficient memory"); 1107 ext2_msg(sb, KERN_ERR, "error: insufficient memory");
1105 goto failed_mount3; 1108 goto failed_mount3;
1106 } 1109 }
1110
1111#ifdef CONFIG_EXT2_FS_XATTR
1112 sbi->s_mb_cache = ext2_xattr_create_cache();
1113 if (!sbi->s_mb_cache) {
1114 ext2_msg(sb, KERN_ERR, "Failed to create an mb_cache");
1115 goto failed_mount3;
1116 }
1117#endif
1107 /* 1118 /*
1108 * set up enough so that it can read an inode 1119 * set up enough so that it can read an inode
1109 */ 1120 */
@@ -1149,6 +1160,8 @@ cantfind_ext2:
1149 sb->s_id); 1160 sb->s_id);
1150 goto failed_mount; 1161 goto failed_mount;
1151failed_mount3: 1162failed_mount3:
1163 if (sbi->s_mb_cache)
1164 ext2_xattr_destroy_cache(sbi->s_mb_cache);
1152 percpu_counter_destroy(&sbi->s_freeblocks_counter); 1165 percpu_counter_destroy(&sbi->s_freeblocks_counter);
1153 percpu_counter_destroy(&sbi->s_freeinodes_counter); 1166 percpu_counter_destroy(&sbi->s_freeinodes_counter);
1154 percpu_counter_destroy(&sbi->s_dirs_counter); 1167 percpu_counter_destroy(&sbi->s_dirs_counter);
@@ -1555,20 +1568,17 @@ MODULE_ALIAS_FS("ext2");
1555 1568
1556static int __init init_ext2_fs(void) 1569static int __init init_ext2_fs(void)
1557{ 1570{
1558 int err = init_ext2_xattr(); 1571 int err;
1559 if (err) 1572
1560 return err;
1561 err = init_inodecache(); 1573 err = init_inodecache();
1562 if (err) 1574 if (err)
1563 goto out1; 1575 return err;
1564 err = register_filesystem(&ext2_fs_type); 1576 err = register_filesystem(&ext2_fs_type);
1565 if (err) 1577 if (err)
1566 goto out; 1578 goto out;
1567 return 0; 1579 return 0;
1568out: 1580out:
1569 destroy_inodecache(); 1581 destroy_inodecache();
1570out1:
1571 exit_ext2_xattr();
1572 return err; 1582 return err;
1573} 1583}
1574 1584
@@ -1576,7 +1586,6 @@ static void __exit exit_ext2_fs(void)
1576{ 1586{
1577 unregister_filesystem(&ext2_fs_type); 1587 unregister_filesystem(&ext2_fs_type);
1578 destroy_inodecache(); 1588 destroy_inodecache();
1579 exit_ext2_xattr();
1580} 1589}
1581 1590
1582MODULE_AUTHOR("Remy Card and others"); 1591MODULE_AUTHOR("Remy Card and others");