diff options
Diffstat (limited to 'fs/ext3/super.c')
-rw-r--r-- | fs/ext3/super.c | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 599dbfe504c3..26aa64dee6aa 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -67,7 +67,6 @@ static const char *ext3_decode_error(struct super_block * sb, int errno, | |||
67 | static int ext3_remount (struct super_block * sb, int * flags, char * data); | 67 | static int ext3_remount (struct super_block * sb, int * flags, char * data); |
68 | static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf); | 68 | static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf); |
69 | static int ext3_unfreeze(struct super_block *sb); | 69 | static int ext3_unfreeze(struct super_block *sb); |
70 | static void ext3_write_super (struct super_block * sb); | ||
71 | static int ext3_freeze(struct super_block *sb); | 70 | static int ext3_freeze(struct super_block *sb); |
72 | 71 | ||
73 | /* | 72 | /* |
@@ -399,6 +398,8 @@ static void ext3_put_super (struct super_block * sb) | |||
399 | struct ext3_super_block *es = sbi->s_es; | 398 | struct ext3_super_block *es = sbi->s_es; |
400 | int i, err; | 399 | int i, err; |
401 | 400 | ||
401 | lock_kernel(); | ||
402 | |||
402 | ext3_xattr_put_super(sb); | 403 | ext3_xattr_put_super(sb); |
403 | err = journal_destroy(sbi->s_journal); | 404 | err = journal_destroy(sbi->s_journal); |
404 | sbi->s_journal = NULL; | 405 | sbi->s_journal = NULL; |
@@ -447,7 +448,8 @@ static void ext3_put_super (struct super_block * sb) | |||
447 | sb->s_fs_info = NULL; | 448 | sb->s_fs_info = NULL; |
448 | kfree(sbi->s_blockgroup_lock); | 449 | kfree(sbi->s_blockgroup_lock); |
449 | kfree(sbi); | 450 | kfree(sbi); |
450 | return; | 451 | |
452 | unlock_kernel(); | ||
451 | } | 453 | } |
452 | 454 | ||
453 | static struct kmem_cache *ext3_inode_cachep; | 455 | static struct kmem_cache *ext3_inode_cachep; |
@@ -761,7 +763,6 @@ static const struct super_operations ext3_sops = { | |||
761 | .dirty_inode = ext3_dirty_inode, | 763 | .dirty_inode = ext3_dirty_inode, |
762 | .delete_inode = ext3_delete_inode, | 764 | .delete_inode = ext3_delete_inode, |
763 | .put_super = ext3_put_super, | 765 | .put_super = ext3_put_super, |
764 | .write_super = ext3_write_super, | ||
765 | .sync_fs = ext3_sync_fs, | 766 | .sync_fs = ext3_sync_fs, |
766 | .freeze_fs = ext3_freeze, | 767 | .freeze_fs = ext3_freeze, |
767 | .unfreeze_fs = ext3_unfreeze, | 768 | .unfreeze_fs = ext3_unfreeze, |
@@ -1696,7 +1697,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1696 | goto failed_mount; | 1697 | goto failed_mount; |
1697 | } | 1698 | } |
1698 | 1699 | ||
1699 | hblock = bdev_hardsect_size(sb->s_bdev); | 1700 | hblock = bdev_logical_block_size(sb->s_bdev); |
1700 | if (sb->s_blocksize != blocksize) { | 1701 | if (sb->s_blocksize != blocksize) { |
1701 | /* | 1702 | /* |
1702 | * Make sure the blocksize for the filesystem is larger | 1703 | * Make sure the blocksize for the filesystem is larger |
@@ -1785,7 +1786,6 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1785 | #else | 1786 | #else |
1786 | es->s_flags |= cpu_to_le32(EXT2_FLAGS_SIGNED_HASH); | 1787 | es->s_flags |= cpu_to_le32(EXT2_FLAGS_SIGNED_HASH); |
1787 | #endif | 1788 | #endif |
1788 | sb->s_dirt = 1; | ||
1789 | } | 1789 | } |
1790 | 1790 | ||
1791 | if (sbi->s_blocks_per_group > blocksize * 8) { | 1791 | if (sbi->s_blocks_per_group > blocksize * 8) { |
@@ -2021,6 +2021,7 @@ failed_mount: | |||
2021 | brelse(bh); | 2021 | brelse(bh); |
2022 | out_fail: | 2022 | out_fail: |
2023 | sb->s_fs_info = NULL; | 2023 | sb->s_fs_info = NULL; |
2024 | kfree(sbi->s_blockgroup_lock); | ||
2024 | kfree(sbi); | 2025 | kfree(sbi); |
2025 | lock_kernel(); | 2026 | lock_kernel(); |
2026 | return ret; | 2027 | return ret; |
@@ -2119,7 +2120,7 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb, | |||
2119 | } | 2120 | } |
2120 | 2121 | ||
2121 | blocksize = sb->s_blocksize; | 2122 | blocksize = sb->s_blocksize; |
2122 | hblock = bdev_hardsect_size(bdev); | 2123 | hblock = bdev_logical_block_size(bdev); |
2123 | if (blocksize < hblock) { | 2124 | if (blocksize < hblock) { |
2124 | printk(KERN_ERR | 2125 | printk(KERN_ERR |
2125 | "EXT3-fs: blocksize too small for journal device.\n"); | 2126 | "EXT3-fs: blocksize too small for journal device.\n"); |
@@ -2264,7 +2265,6 @@ static int ext3_load_journal(struct super_block *sb, | |||
2264 | if (journal_devnum && | 2265 | if (journal_devnum && |
2265 | journal_devnum != le32_to_cpu(es->s_journal_dev)) { | 2266 | journal_devnum != le32_to_cpu(es->s_journal_dev)) { |
2266 | es->s_journal_dev = cpu_to_le32(journal_devnum); | 2267 | es->s_journal_dev = cpu_to_le32(journal_devnum); |
2267 | sb->s_dirt = 1; | ||
2268 | 2268 | ||
2269 | /* Make sure we flush the recovery flag to disk. */ | 2269 | /* Make sure we flush the recovery flag to disk. */ |
2270 | ext3_commit_super(sb, es, 1); | 2270 | ext3_commit_super(sb, es, 1); |
@@ -2307,7 +2307,6 @@ static int ext3_create_journal(struct super_block * sb, | |||
2307 | EXT3_SET_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL); | 2307 | EXT3_SET_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL); |
2308 | 2308 | ||
2309 | es->s_journal_inum = cpu_to_le32(journal_inum); | 2309 | es->s_journal_inum = cpu_to_le32(journal_inum); |
2310 | sb->s_dirt = 1; | ||
2311 | 2310 | ||
2312 | /* Make sure we flush the recovery flag to disk. */ | 2311 | /* Make sure we flush the recovery flag to disk. */ |
2313 | ext3_commit_super(sb, es, 1); | 2312 | ext3_commit_super(sb, es, 1); |
@@ -2353,7 +2352,6 @@ static void ext3_mark_recovery_complete(struct super_block * sb, | |||
2353 | if (EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER) && | 2352 | if (EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER) && |
2354 | sb->s_flags & MS_RDONLY) { | 2353 | sb->s_flags & MS_RDONLY) { |
2355 | EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER); | 2354 | EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER); |
2356 | sb->s_dirt = 0; | ||
2357 | ext3_commit_super(sb, es, 1); | 2355 | ext3_commit_super(sb, es, 1); |
2358 | } | 2356 | } |
2359 | unlock_super(sb); | 2357 | unlock_super(sb); |
@@ -2412,29 +2410,14 @@ int ext3_force_commit(struct super_block *sb) | |||
2412 | return 0; | 2410 | return 0; |
2413 | 2411 | ||
2414 | journal = EXT3_SB(sb)->s_journal; | 2412 | journal = EXT3_SB(sb)->s_journal; |
2415 | sb->s_dirt = 0; | ||
2416 | ret = ext3_journal_force_commit(journal); | 2413 | ret = ext3_journal_force_commit(journal); |
2417 | return ret; | 2414 | return ret; |
2418 | } | 2415 | } |
2419 | 2416 | ||
2420 | /* | ||
2421 | * Ext3 always journals updates to the superblock itself, so we don't | ||
2422 | * have to propagate any other updates to the superblock on disk at this | ||
2423 | * point. (We can probably nuke this function altogether, and remove | ||
2424 | * any mention to sb->s_dirt in all of fs/ext3; eventual cleanup...) | ||
2425 | */ | ||
2426 | static void ext3_write_super (struct super_block * sb) | ||
2427 | { | ||
2428 | if (mutex_trylock(&sb->s_lock) != 0) | ||
2429 | BUG(); | ||
2430 | sb->s_dirt = 0; | ||
2431 | } | ||
2432 | |||
2433 | static int ext3_sync_fs(struct super_block *sb, int wait) | 2417 | static int ext3_sync_fs(struct super_block *sb, int wait) |
2434 | { | 2418 | { |
2435 | tid_t target; | 2419 | tid_t target; |
2436 | 2420 | ||
2437 | sb->s_dirt = 0; | ||
2438 | if (journal_start_commit(EXT3_SB(sb)->s_journal, &target)) { | 2421 | if (journal_start_commit(EXT3_SB(sb)->s_journal, &target)) { |
2439 | if (wait) | 2422 | if (wait) |
2440 | log_wait_commit(EXT3_SB(sb)->s_journal, target); | 2423 | log_wait_commit(EXT3_SB(sb)->s_journal, target); |
@@ -2450,7 +2433,6 @@ static int ext3_freeze(struct super_block *sb) | |||
2450 | { | 2433 | { |
2451 | int error = 0; | 2434 | int error = 0; |
2452 | journal_t *journal; | 2435 | journal_t *journal; |
2453 | sb->s_dirt = 0; | ||
2454 | 2436 | ||
2455 | if (!(sb->s_flags & MS_RDONLY)) { | 2437 | if (!(sb->s_flags & MS_RDONLY)) { |
2456 | journal = EXT3_SB(sb)->s_journal; | 2438 | journal = EXT3_SB(sb)->s_journal; |
@@ -2508,7 +2490,10 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data) | |||
2508 | int i; | 2490 | int i; |
2509 | #endif | 2491 | #endif |
2510 | 2492 | ||
2493 | lock_kernel(); | ||
2494 | |||
2511 | /* Store the original options */ | 2495 | /* Store the original options */ |
2496 | lock_super(sb); | ||
2512 | old_sb_flags = sb->s_flags; | 2497 | old_sb_flags = sb->s_flags; |
2513 | old_opts.s_mount_opt = sbi->s_mount_opt; | 2498 | old_opts.s_mount_opt = sbi->s_mount_opt; |
2514 | old_opts.s_resuid = sbi->s_resuid; | 2499 | old_opts.s_resuid = sbi->s_resuid; |
@@ -2616,6 +2601,8 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data) | |||
2616 | old_opts.s_qf_names[i] != sbi->s_qf_names[i]) | 2601 | old_opts.s_qf_names[i] != sbi->s_qf_names[i]) |
2617 | kfree(old_opts.s_qf_names[i]); | 2602 | kfree(old_opts.s_qf_names[i]); |
2618 | #endif | 2603 | #endif |
2604 | unlock_super(sb); | ||
2605 | unlock_kernel(); | ||
2619 | return 0; | 2606 | return 0; |
2620 | restore_opts: | 2607 | restore_opts: |
2621 | sb->s_flags = old_sb_flags; | 2608 | sb->s_flags = old_sb_flags; |
@@ -2632,6 +2619,8 @@ restore_opts: | |||
2632 | sbi->s_qf_names[i] = old_opts.s_qf_names[i]; | 2619 | sbi->s_qf_names[i] = old_opts.s_qf_names[i]; |
2633 | } | 2620 | } |
2634 | #endif | 2621 | #endif |
2622 | unlock_super(sb); | ||
2623 | unlock_kernel(); | ||
2635 | return err; | 2624 | return err; |
2636 | } | 2625 | } |
2637 | 2626 | ||