diff options
Diffstat (limited to 'fs/jfs/super.c')
-rw-r--r-- | fs/jfs/super.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 5856866e24fc..0812005364a1 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
@@ -210,6 +210,10 @@ static void jfs_put_super(struct super_block *sb) | |||
210 | unload_nls(sbi->nls_tab); | 210 | unload_nls(sbi->nls_tab); |
211 | sbi->nls_tab = NULL; | 211 | sbi->nls_tab = NULL; |
212 | 212 | ||
213 | truncate_inode_pages(sbi->direct_inode->i_mapping, 0); | ||
214 | iput(sbi->direct_inode); | ||
215 | sbi->direct_inode = NULL; | ||
216 | |||
213 | kfree(sbi); | 217 | kfree(sbi); |
214 | } | 218 | } |
215 | 219 | ||
@@ -358,6 +362,12 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data) | |||
358 | } | 362 | } |
359 | 363 | ||
360 | if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) { | 364 | if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) { |
365 | /* | ||
366 | * Invalidate any previously read metadata. fsck may have | ||
367 | * changed the on-disk data since we mounted r/o | ||
368 | */ | ||
369 | truncate_inode_pages(JFS_SBI(sb)->direct_inode->i_mapping, 0); | ||
370 | |||
361 | JFS_SBI(sb)->flag = flag; | 371 | JFS_SBI(sb)->flag = flag; |
362 | return jfs_mount_rw(sb, 1); | 372 | return jfs_mount_rw(sb, 1); |
363 | } | 373 | } |
@@ -428,12 +438,26 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) | |||
428 | sb->s_op = &jfs_super_operations; | 438 | sb->s_op = &jfs_super_operations; |
429 | sb->s_export_op = &jfs_export_operations; | 439 | sb->s_export_op = &jfs_export_operations; |
430 | 440 | ||
441 | /* | ||
442 | * Initialize direct-mapping inode/address-space | ||
443 | */ | ||
444 | inode = new_inode(sb); | ||
445 | if (inode == NULL) | ||
446 | goto out_kfree; | ||
447 | inode->i_ino = 0; | ||
448 | inode->i_nlink = 1; | ||
449 | inode->i_size = sb->s_bdev->bd_inode->i_size; | ||
450 | inode->i_mapping->a_ops = &jfs_metapage_aops; | ||
451 | mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS); | ||
452 | |||
453 | sbi->direct_inode = inode; | ||
454 | |||
431 | rc = jfs_mount(sb); | 455 | rc = jfs_mount(sb); |
432 | if (rc) { | 456 | if (rc) { |
433 | if (!silent) { | 457 | if (!silent) { |
434 | jfs_err("jfs_mount failed w/return code = %d", rc); | 458 | jfs_err("jfs_mount failed w/return code = %d", rc); |
435 | } | 459 | } |
436 | goto out_kfree; | 460 | goto out_mount_failed; |
437 | } | 461 | } |
438 | if (sb->s_flags & MS_RDONLY) | 462 | if (sb->s_flags & MS_RDONLY) |
439 | sbi->log = NULL; | 463 | sbi->log = NULL; |
@@ -482,6 +506,13 @@ out_no_rw: | |||
482 | if (rc) { | 506 | if (rc) { |
483 | jfs_err("jfs_umount failed with return code %d", rc); | 507 | jfs_err("jfs_umount failed with return code %d", rc); |
484 | } | 508 | } |
509 | out_mount_failed: | ||
510 | filemap_fdatawrite(sbi->direct_inode->i_mapping); | ||
511 | filemap_fdatawait(sbi->direct_inode->i_mapping); | ||
512 | truncate_inode_pages(sbi->direct_inode->i_mapping, 0); | ||
513 | make_bad_inode(sbi->direct_inode); | ||
514 | iput(sbi->direct_inode); | ||
515 | sbi->direct_inode = NULL; | ||
485 | out_kfree: | 516 | out_kfree: |
486 | if (sbi->nls_tab) | 517 | if (sbi->nls_tab) |
487 | unload_nls(sbi->nls_tab); | 518 | unload_nls(sbi->nls_tab); |