diff options
-rw-r--r-- | fs/hfs/mdb.c | 5 | ||||
-rw-r--r-- | fs/hfs/super.c | 8 | ||||
-rw-r--r-- | fs/hfsplus/super.c | 6 |
3 files changed, 13 insertions, 6 deletions
diff --git a/fs/hfs/mdb.c b/fs/hfs/mdb.c index 4efb640c4d0c..217e32f37e0b 100644 --- a/fs/hfs/mdb.c +++ b/fs/hfs/mdb.c | |||
@@ -333,6 +333,8 @@ void hfs_mdb_close(struct super_block *sb) | |||
333 | * Release the resources associated with the in-core MDB. */ | 333 | * Release the resources associated with the in-core MDB. */ |
334 | void hfs_mdb_put(struct super_block *sb) | 334 | void hfs_mdb_put(struct super_block *sb) |
335 | { | 335 | { |
336 | if (!HFS_SB(sb)) | ||
337 | return; | ||
336 | /* free the B-trees */ | 338 | /* free the B-trees */ |
337 | hfs_btree_close(HFS_SB(sb)->ext_tree); | 339 | hfs_btree_close(HFS_SB(sb)->ext_tree); |
338 | hfs_btree_close(HFS_SB(sb)->cat_tree); | 340 | hfs_btree_close(HFS_SB(sb)->cat_tree); |
@@ -340,4 +342,7 @@ void hfs_mdb_put(struct super_block *sb) | |||
340 | /* free the buffers holding the primary and alternate MDBs */ | 342 | /* free the buffers holding the primary and alternate MDBs */ |
341 | brelse(HFS_SB(sb)->mdb_bh); | 343 | brelse(HFS_SB(sb)->mdb_bh); |
342 | brelse(HFS_SB(sb)->alt_mdb_bh); | 344 | brelse(HFS_SB(sb)->alt_mdb_bh); |
345 | |||
346 | kfree(HFS_SB(sb)); | ||
347 | sb->s_fs_info = NULL; | ||
343 | } | 348 | } |
diff --git a/fs/hfs/super.c b/fs/hfs/super.c index 1e2c193134cc..ab783f6afa3b 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c | |||
@@ -297,7 +297,7 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent) | |||
297 | res = -EINVAL; | 297 | res = -EINVAL; |
298 | if (!parse_options((char *)data, sbi)) { | 298 | if (!parse_options((char *)data, sbi)) { |
299 | hfs_warn("hfs_fs: unable to parse mount options.\n"); | 299 | hfs_warn("hfs_fs: unable to parse mount options.\n"); |
300 | goto bail3; | 300 | goto bail; |
301 | } | 301 | } |
302 | 302 | ||
303 | sb->s_op = &hfs_super_operations; | 303 | sb->s_op = &hfs_super_operations; |
@@ -310,7 +310,7 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent) | |||
310 | hfs_warn("VFS: Can't find a HFS filesystem on dev %s.\n", | 310 | hfs_warn("VFS: Can't find a HFS filesystem on dev %s.\n", |
311 | hfs_mdb_name(sb)); | 311 | hfs_mdb_name(sb)); |
312 | res = -EINVAL; | 312 | res = -EINVAL; |
313 | goto bail2; | 313 | goto bail; |
314 | } | 314 | } |
315 | 315 | ||
316 | /* try to get the root inode */ | 316 | /* try to get the root inode */ |
@@ -340,10 +340,8 @@ bail_iput: | |||
340 | iput(root_inode); | 340 | iput(root_inode); |
341 | bail_no_root: | 341 | bail_no_root: |
342 | hfs_warn("hfs_fs: get root inode failed.\n"); | 342 | hfs_warn("hfs_fs: get root inode failed.\n"); |
343 | bail: | ||
343 | hfs_mdb_put(sb); | 344 | hfs_mdb_put(sb); |
344 | bail2: | ||
345 | bail3: | ||
346 | kfree(sbi); | ||
347 | return res; | 345 | return res; |
348 | } | 346 | } |
349 | 347 | ||
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index 5f8044664a3c..d55ad67b8e42 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c | |||
@@ -208,7 +208,9 @@ static void hfsplus_write_super(struct super_block *sb) | |||
208 | static void hfsplus_put_super(struct super_block *sb) | 208 | static void hfsplus_put_super(struct super_block *sb) |
209 | { | 209 | { |
210 | dprint(DBG_SUPER, "hfsplus_put_super\n"); | 210 | dprint(DBG_SUPER, "hfsplus_put_super\n"); |
211 | if (!(sb->s_flags & MS_RDONLY)) { | 211 | if (!sb->s_fs_info) |
212 | return; | ||
213 | if (!(sb->s_flags & MS_RDONLY) && HFSPLUS_SB(sb).s_vhdr) { | ||
212 | struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr; | 214 | struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr; |
213 | 215 | ||
214 | vhdr->modify_date = hfsp_now2mt(); | 216 | vhdr->modify_date = hfsp_now2mt(); |
@@ -226,6 +228,8 @@ static void hfsplus_put_super(struct super_block *sb) | |||
226 | brelse(HFSPLUS_SB(sb).s_vhbh); | 228 | brelse(HFSPLUS_SB(sb).s_vhbh); |
227 | if (HFSPLUS_SB(sb).nls) | 229 | if (HFSPLUS_SB(sb).nls) |
228 | unload_nls(HFSPLUS_SB(sb).nls); | 230 | unload_nls(HFSPLUS_SB(sb).nls); |
231 | kfree(sb->s_fs_info); | ||
232 | sb->s_fs_info = NULL; | ||
229 | } | 233 | } |
230 | 234 | ||
231 | static int hfsplus_statfs(struct super_block *sb, struct kstatfs *buf) | 235 | static int hfsplus_statfs(struct super_block *sb, struct kstatfs *buf) |