diff options
Diffstat (limited to 'fs/ext4/super.c')
| -rw-r--r-- | fs/ext4/super.c | 148 |
1 files changed, 85 insertions, 63 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index ba191dae8730..e72d3235b2fd 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
| @@ -68,7 +68,21 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf); | |||
| 68 | static int ext4_unfreeze(struct super_block *sb); | 68 | static int ext4_unfreeze(struct super_block *sb); |
| 69 | static void ext4_write_super(struct super_block *sb); | 69 | static void ext4_write_super(struct super_block *sb); |
| 70 | static int ext4_freeze(struct super_block *sb); | 70 | static int ext4_freeze(struct super_block *sb); |
| 71 | static int ext4_get_sb(struct file_system_type *fs_type, int flags, | ||
| 72 | const char *dev_name, void *data, struct vfsmount *mnt); | ||
| 71 | 73 | ||
| 74 | #if !defined(CONFIG_EXT3_FS) && !defined(CONFIG_EXT3_FS_MODULE) && defined(CONFIG_EXT4_USE_FOR_EXT23) | ||
| 75 | static struct file_system_type ext3_fs_type = { | ||
| 76 | .owner = THIS_MODULE, | ||
| 77 | .name = "ext3", | ||
| 78 | .get_sb = ext4_get_sb, | ||
| 79 | .kill_sb = kill_block_super, | ||
| 80 | .fs_flags = FS_REQUIRES_DEV, | ||
| 81 | }; | ||
| 82 | #define IS_EXT3_SB(sb) ((sb)->s_bdev->bd_holder == &ext3_fs_type) | ||
| 83 | #else | ||
| 84 | #define IS_EXT3_SB(sb) (0) | ||
| 85 | #endif | ||
| 72 | 86 | ||
| 73 | ext4_fsblk_t ext4_block_bitmap(struct super_block *sb, | 87 | ext4_fsblk_t ext4_block_bitmap(struct super_block *sb, |
| 74 | struct ext4_group_desc *bg) | 88 | struct ext4_group_desc *bg) |
| @@ -227,6 +241,7 @@ handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks) | |||
| 227 | if (sb->s_flags & MS_RDONLY) | 241 | if (sb->s_flags & MS_RDONLY) |
| 228 | return ERR_PTR(-EROFS); | 242 | return ERR_PTR(-EROFS); |
| 229 | 243 | ||
| 244 | vfs_check_frozen(sb, SB_FREEZE_WRITE); | ||
| 230 | /* Special case here: if the journal has aborted behind our | 245 | /* Special case here: if the journal has aborted behind our |
| 231 | * backs (eg. EIO in the commit thread), then we still need to | 246 | * backs (eg. EIO in the commit thread), then we still need to |
| 232 | * take the FS itself readonly cleanly. */ | 247 | * take the FS itself readonly cleanly. */ |
| @@ -631,6 +646,8 @@ static void ext4_put_super(struct super_block *sb) | |||
| 631 | struct ext4_super_block *es = sbi->s_es; | 646 | struct ext4_super_block *es = sbi->s_es; |
| 632 | int i, err; | 647 | int i, err; |
| 633 | 648 | ||
| 649 | dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); | ||
| 650 | |||
| 634 | flush_workqueue(sbi->dio_unwritten_wq); | 651 | flush_workqueue(sbi->dio_unwritten_wq); |
| 635 | destroy_workqueue(sbi->dio_unwritten_wq); | 652 | destroy_workqueue(sbi->dio_unwritten_wq); |
| 636 | 653 | ||
| @@ -927,6 +944,8 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
| 927 | seq_puts(seq, test_opt(sb, BARRIER) ? "1" : "0"); | 944 | seq_puts(seq, test_opt(sb, BARRIER) ? "1" : "0"); |
| 928 | if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) | 945 | if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) |
| 929 | seq_puts(seq, ",journal_async_commit"); | 946 | seq_puts(seq, ",journal_async_commit"); |
| 947 | else if (test_opt(sb, JOURNAL_CHECKSUM)) | ||
| 948 | seq_puts(seq, ",journal_checksum"); | ||
| 930 | if (test_opt(sb, NOBH)) | 949 | if (test_opt(sb, NOBH)) |
| 931 | seq_puts(seq, ",nobh"); | 950 | seq_puts(seq, ",nobh"); |
| 932 | if (test_opt(sb, I_VERSION)) | 951 | if (test_opt(sb, I_VERSION)) |
| @@ -1045,7 +1064,7 @@ static int ext4_release_dquot(struct dquot *dquot); | |||
| 1045 | static int ext4_mark_dquot_dirty(struct dquot *dquot); | 1064 | static int ext4_mark_dquot_dirty(struct dquot *dquot); |
| 1046 | static int ext4_write_info(struct super_block *sb, int type); | 1065 | static int ext4_write_info(struct super_block *sb, int type); |
| 1047 | static int ext4_quota_on(struct super_block *sb, int type, int format_id, | 1066 | static int ext4_quota_on(struct super_block *sb, int type, int format_id, |
| 1048 | char *path, int remount); | 1067 | char *path); |
| 1049 | static int ext4_quota_on_mount(struct super_block *sb, int type); | 1068 | static int ext4_quota_on_mount(struct super_block *sb, int type); |
| 1050 | static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data, | 1069 | static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data, |
| 1051 | size_t len, loff_t off); | 1070 | size_t len, loff_t off); |
| @@ -1067,12 +1086,12 @@ static const struct dquot_operations ext4_quota_operations = { | |||
| 1067 | 1086 | ||
| 1068 | static const struct quotactl_ops ext4_qctl_operations = { | 1087 | static const struct quotactl_ops ext4_qctl_operations = { |
| 1069 | .quota_on = ext4_quota_on, | 1088 | .quota_on = ext4_quota_on, |
| 1070 | .quota_off = vfs_quota_off, | 1089 | .quota_off = dquot_quota_off, |
| 1071 | .quota_sync = vfs_quota_sync, | 1090 | .quota_sync = dquot_quota_sync, |
| 1072 | .get_info = vfs_get_dqinfo, | 1091 | .get_info = dquot_get_dqinfo, |
| 1073 | .set_info = vfs_set_dqinfo, | 1092 | .set_info = dquot_set_dqinfo, |
| 1074 | .get_dqblk = vfs_get_dqblk, | 1093 | .get_dqblk = dquot_get_dqblk, |
| 1075 | .set_dqblk = vfs_set_dqblk | 1094 | .set_dqblk = dquot_set_dqblk |
| 1076 | }; | 1095 | }; |
| 1077 | #endif | 1096 | #endif |
| 1078 | 1097 | ||
| @@ -2037,7 +2056,7 @@ static void ext4_orphan_cleanup(struct super_block *sb, | |||
| 2037 | /* Turn quotas off */ | 2056 | /* Turn quotas off */ |
| 2038 | for (i = 0; i < MAXQUOTAS; i++) { | 2057 | for (i = 0; i < MAXQUOTAS; i++) { |
| 2039 | if (sb_dqopt(sb)->files[i]) | 2058 | if (sb_dqopt(sb)->files[i]) |
| 2040 | vfs_quota_off(sb, i, 0); | 2059 | dquot_quota_off(sb, i); |
| 2041 | } | 2060 | } |
| 2042 | #endif | 2061 | #endif |
| 2043 | sb->s_flags = s_flags; /* Restore MS_RDONLY status */ | 2062 | sb->s_flags = s_flags; /* Restore MS_RDONLY status */ |
| @@ -2199,7 +2218,7 @@ static unsigned long ext4_get_stripe_size(struct ext4_sb_info *sbi) | |||
| 2199 | struct ext4_attr { | 2218 | struct ext4_attr { |
| 2200 | struct attribute attr; | 2219 | struct attribute attr; |
| 2201 | ssize_t (*show)(struct ext4_attr *, struct ext4_sb_info *, char *); | 2220 | ssize_t (*show)(struct ext4_attr *, struct ext4_sb_info *, char *); |
| 2202 | ssize_t (*store)(struct ext4_attr *, struct ext4_sb_info *, | 2221 | ssize_t (*store)(struct ext4_attr *, struct ext4_sb_info *, |
| 2203 | const char *, size_t); | 2222 | const char *, size_t); |
| 2204 | int offset; | 2223 | int offset; |
| 2205 | }; | 2224 | }; |
| @@ -2416,6 +2435,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
| 2416 | __releases(kernel_lock) | 2435 | __releases(kernel_lock) |
| 2417 | __acquires(kernel_lock) | 2436 | __acquires(kernel_lock) |
| 2418 | { | 2437 | { |
| 2438 | char *orig_data = kstrdup(data, GFP_KERNEL); | ||
| 2419 | struct buffer_head *bh; | 2439 | struct buffer_head *bh; |
| 2420 | struct ext4_super_block *es = NULL; | 2440 | struct ext4_super_block *es = NULL; |
| 2421 | struct ext4_sb_info *sbi; | 2441 | struct ext4_sb_info *sbi; |
| @@ -2539,7 +2559,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
| 2539 | * enable delayed allocation by default | 2559 | * enable delayed allocation by default |
| 2540 | * Use -o nodelalloc to turn it off | 2560 | * Use -o nodelalloc to turn it off |
| 2541 | */ | 2561 | */ |
| 2542 | set_opt(sbi->s_mount_opt, DELALLOC); | 2562 | if (!IS_EXT3_SB(sb)) |
| 2563 | set_opt(sbi->s_mount_opt, DELALLOC); | ||
| 2543 | 2564 | ||
| 2544 | if (!parse_options((char *) data, sb, &journal_devnum, | 2565 | if (!parse_options((char *) data, sb, &journal_devnum, |
| 2545 | &journal_ioprio, NULL, 0)) | 2566 | &journal_ioprio, NULL, 0)) |
| @@ -2778,24 +2799,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
| 2778 | get_random_bytes(&sbi->s_next_generation, sizeof(u32)); | 2799 | get_random_bytes(&sbi->s_next_generation, sizeof(u32)); |
| 2779 | spin_lock_init(&sbi->s_next_gen_lock); | 2800 | spin_lock_init(&sbi->s_next_gen_lock); |
| 2780 | 2801 | ||
| 2781 | err = percpu_counter_init(&sbi->s_freeblocks_counter, | ||
| 2782 | ext4_count_free_blocks(sb)); | ||
| 2783 | if (!err) { | ||
| 2784 | err = percpu_counter_init(&sbi->s_freeinodes_counter, | ||
| 2785 | ext4_count_free_inodes(sb)); | ||
| 2786 | } | ||
| 2787 | if (!err) { | ||
| 2788 | err = percpu_counter_init(&sbi->s_dirs_counter, | ||
| 2789 | ext4_count_dirs(sb)); | ||
| 2790 | } | ||
| 2791 | if (!err) { | ||
| 2792 | err = percpu_counter_init(&sbi->s_dirtyblocks_counter, 0); | ||
| 2793 | } | ||
| 2794 | if (err) { | ||
| 2795 | ext4_msg(sb, KERN_ERR, "insufficient memory"); | ||
| 2796 | goto failed_mount3; | ||
| 2797 | } | ||
| 2798 | |||
| 2799 | sbi->s_stripe = ext4_get_stripe_size(sbi); | 2802 | sbi->s_stripe = ext4_get_stripe_size(sbi); |
| 2800 | sbi->s_max_writeback_mb_bump = 128; | 2803 | sbi->s_max_writeback_mb_bump = 128; |
| 2801 | 2804 | ||
| @@ -2895,6 +2898,20 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
| 2895 | set_task_ioprio(sbi->s_journal->j_task, journal_ioprio); | 2898 | set_task_ioprio(sbi->s_journal->j_task, journal_ioprio); |
| 2896 | 2899 | ||
| 2897 | no_journal: | 2900 | no_journal: |
| 2901 | err = percpu_counter_init(&sbi->s_freeblocks_counter, | ||
| 2902 | ext4_count_free_blocks(sb)); | ||
| 2903 | if (!err) | ||
| 2904 | err = percpu_counter_init(&sbi->s_freeinodes_counter, | ||
| 2905 | ext4_count_free_inodes(sb)); | ||
| 2906 | if (!err) | ||
| 2907 | err = percpu_counter_init(&sbi->s_dirs_counter, | ||
| 2908 | ext4_count_dirs(sb)); | ||
| 2909 | if (!err) | ||
| 2910 | err = percpu_counter_init(&sbi->s_dirtyblocks_counter, 0); | ||
| 2911 | if (err) { | ||
| 2912 | ext4_msg(sb, KERN_ERR, "insufficient memory"); | ||
| 2913 | goto failed_mount_wq; | ||
| 2914 | } | ||
| 2898 | if (test_opt(sb, NOBH)) { | 2915 | if (test_opt(sb, NOBH)) { |
| 2899 | if (!(test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)) { | 2916 | if (!(test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)) { |
| 2900 | ext4_msg(sb, KERN_WARNING, "Ignoring nobh option - " | 2917 | ext4_msg(sb, KERN_WARNING, "Ignoring nobh option - " |
| @@ -2986,14 +3003,14 @@ no_journal: | |||
| 2986 | err = ext4_setup_system_zone(sb); | 3003 | err = ext4_setup_system_zone(sb); |
| 2987 | if (err) { | 3004 | if (err) { |
| 2988 | ext4_msg(sb, KERN_ERR, "failed to initialize system " | 3005 | ext4_msg(sb, KERN_ERR, "failed to initialize system " |
| 2989 | "zone (%d)\n", err); | 3006 | "zone (%d)", err); |
| 2990 | goto failed_mount4; | 3007 | goto failed_mount4; |
| 2991 | } | 3008 | } |
| 2992 | 3009 | ||
| 2993 | ext4_ext_init(sb); | 3010 | ext4_ext_init(sb); |
| 2994 | err = ext4_mb_init(sb, needs_recovery); | 3011 | err = ext4_mb_init(sb, needs_recovery); |
| 2995 | if (err) { | 3012 | if (err) { |
| 2996 | ext4_msg(sb, KERN_ERR, "failed to initalize mballoc (%d)", | 3013 | ext4_msg(sb, KERN_ERR, "failed to initialize mballoc (%d)", |
| 2997 | err); | 3014 | err); |
| 2998 | goto failed_mount4; | 3015 | goto failed_mount4; |
| 2999 | } | 3016 | } |
| @@ -3025,9 +3042,11 @@ no_journal: | |||
| 3025 | } else | 3042 | } else |
| 3026 | descr = "out journal"; | 3043 | descr = "out journal"; |
| 3027 | 3044 | ||
| 3028 | ext4_msg(sb, KERN_INFO, "mounted filesystem with%s", descr); | 3045 | ext4_msg(sb, KERN_INFO, "mounted filesystem with%s. " |
| 3046 | "Opts: %s", descr, orig_data); | ||
| 3029 | 3047 | ||
| 3030 | lock_kernel(); | 3048 | lock_kernel(); |
| 3049 | kfree(orig_data); | ||
| 3031 | return 0; | 3050 | return 0; |
| 3032 | 3051 | ||
| 3033 | cantfind_ext4: | 3052 | cantfind_ext4: |
| @@ -3044,6 +3063,10 @@ failed_mount_wq: | |||
| 3044 | jbd2_journal_destroy(sbi->s_journal); | 3063 | jbd2_journal_destroy(sbi->s_journal); |
| 3045 | sbi->s_journal = NULL; | 3064 | sbi->s_journal = NULL; |
| 3046 | } | 3065 | } |
| 3066 | percpu_counter_destroy(&sbi->s_freeblocks_counter); | ||
| 3067 | percpu_counter_destroy(&sbi->s_freeinodes_counter); | ||
| 3068 | percpu_counter_destroy(&sbi->s_dirs_counter); | ||
| 3069 | percpu_counter_destroy(&sbi->s_dirtyblocks_counter); | ||
| 3047 | failed_mount3: | 3070 | failed_mount3: |
| 3048 | if (sbi->s_flex_groups) { | 3071 | if (sbi->s_flex_groups) { |
| 3049 | if (is_vmalloc_addr(sbi->s_flex_groups)) | 3072 | if (is_vmalloc_addr(sbi->s_flex_groups)) |
| @@ -3051,10 +3074,6 @@ failed_mount3: | |||
| 3051 | else | 3074 | else |
| 3052 | kfree(sbi->s_flex_groups); | 3075 | kfree(sbi->s_flex_groups); |
| 3053 | } | 3076 | } |
| 3054 | percpu_counter_destroy(&sbi->s_freeblocks_counter); | ||
| 3055 | percpu_counter_destroy(&sbi->s_freeinodes_counter); | ||
| 3056 | percpu_counter_destroy(&sbi->s_dirs_counter); | ||
| 3057 | percpu_counter_destroy(&sbi->s_dirtyblocks_counter); | ||
| 3058 | failed_mount2: | 3077 | failed_mount2: |
| 3059 | for (i = 0; i < db_count; i++) | 3078 | for (i = 0; i < db_count; i++) |
| 3060 | brelse(sbi->s_group_desc[i]); | 3079 | brelse(sbi->s_group_desc[i]); |
| @@ -3074,6 +3093,7 @@ out_fail: | |||
| 3074 | kfree(sbi->s_blockgroup_lock); | 3093 | kfree(sbi->s_blockgroup_lock); |
| 3075 | kfree(sbi); | 3094 | kfree(sbi); |
| 3076 | lock_kernel(); | 3095 | lock_kernel(); |
| 3096 | kfree(orig_data); | ||
| 3077 | return ret; | 3097 | return ret; |
| 3078 | } | 3098 | } |
| 3079 | 3099 | ||
| @@ -3365,7 +3385,7 @@ static int ext4_commit_super(struct super_block *sb, int sync) | |||
| 3365 | if (!(sb->s_flags & MS_RDONLY)) | 3385 | if (!(sb->s_flags & MS_RDONLY)) |
| 3366 | es->s_wtime = cpu_to_le32(get_seconds()); | 3386 | es->s_wtime = cpu_to_le32(get_seconds()); |
| 3367 | es->s_kbytes_written = | 3387 | es->s_kbytes_written = |
| 3368 | cpu_to_le64(EXT4_SB(sb)->s_kbytes_written + | 3388 | cpu_to_le64(EXT4_SB(sb)->s_kbytes_written + |
| 3369 | ((part_stat_read(sb->s_bdev->bd_part, sectors[1]) - | 3389 | ((part_stat_read(sb->s_bdev->bd_part, sectors[1]) - |
| 3370 | EXT4_SB(sb)->s_sectors_written_start) >> 1)); | 3390 | EXT4_SB(sb)->s_sectors_written_start) >> 1)); |
| 3371 | ext4_free_blocks_count_set(es, percpu_counter_sum_positive( | 3391 | ext4_free_blocks_count_set(es, percpu_counter_sum_positive( |
| @@ -3470,8 +3490,10 @@ int ext4_force_commit(struct super_block *sb) | |||
| 3470 | return 0; | 3490 | return 0; |
| 3471 | 3491 | ||
| 3472 | journal = EXT4_SB(sb)->s_journal; | 3492 | journal = EXT4_SB(sb)->s_journal; |
| 3473 | if (journal) | 3493 | if (journal) { |
| 3494 | vfs_check_frozen(sb, SB_FREEZE_WRITE); | ||
| 3474 | ret = ext4_journal_force_commit(journal); | 3495 | ret = ext4_journal_force_commit(journal); |
| 3496 | } | ||
| 3475 | 3497 | ||
| 3476 | return ret; | 3498 | return ret; |
| 3477 | } | 3499 | } |
| @@ -3520,18 +3542,16 @@ static int ext4_freeze(struct super_block *sb) | |||
| 3520 | * the journal. | 3542 | * the journal. |
| 3521 | */ | 3543 | */ |
| 3522 | error = jbd2_journal_flush(journal); | 3544 | error = jbd2_journal_flush(journal); |
| 3523 | if (error < 0) { | 3545 | if (error < 0) |
| 3524 | out: | 3546 | goto out; |
| 3525 | jbd2_journal_unlock_updates(journal); | ||
| 3526 | return error; | ||
| 3527 | } | ||
| 3528 | 3547 | ||
| 3529 | /* Journal blocked and flushed, clear needs_recovery flag. */ | 3548 | /* Journal blocked and flushed, clear needs_recovery flag. */ |
| 3530 | EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); | 3549 | EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); |
| 3531 | error = ext4_commit_super(sb, 1); | 3550 | error = ext4_commit_super(sb, 1); |
| 3532 | if (error) | 3551 | out: |
| 3533 | goto out; | 3552 | /* we rely on s_frozen to stop further updates */ |
| 3534 | return 0; | 3553 | jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal); |
| 3554 | return error; | ||
| 3535 | } | 3555 | } |
| 3536 | 3556 | ||
| 3537 | /* | 3557 | /* |
| @@ -3548,7 +3568,6 @@ static int ext4_unfreeze(struct super_block *sb) | |||
| 3548 | EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); | 3568 | EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); |
| 3549 | ext4_commit_super(sb, 1); | 3569 | ext4_commit_super(sb, 1); |
| 3550 | unlock_super(sb); | 3570 | unlock_super(sb); |
| 3551 | jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal); | ||
| 3552 | return 0; | 3571 | return 0; |
| 3553 | } | 3572 | } |
| 3554 | 3573 | ||
| @@ -3559,12 +3578,14 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) | |||
| 3559 | ext4_fsblk_t n_blocks_count = 0; | 3578 | ext4_fsblk_t n_blocks_count = 0; |
| 3560 | unsigned long old_sb_flags; | 3579 | unsigned long old_sb_flags; |
| 3561 | struct ext4_mount_options old_opts; | 3580 | struct ext4_mount_options old_opts; |
| 3581 | int enable_quota = 0; | ||
| 3562 | ext4_group_t g; | 3582 | ext4_group_t g; |
| 3563 | unsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO; | 3583 | unsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO; |
| 3564 | int err; | 3584 | int err; |
| 3565 | #ifdef CONFIG_QUOTA | 3585 | #ifdef CONFIG_QUOTA |
| 3566 | int i; | 3586 | int i; |
| 3567 | #endif | 3587 | #endif |
| 3588 | char *orig_data = kstrdup(data, GFP_KERNEL); | ||
| 3568 | 3589 | ||
| 3569 | lock_kernel(); | 3590 | lock_kernel(); |
| 3570 | 3591 | ||
| @@ -3615,6 +3636,10 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) | |||
| 3615 | } | 3636 | } |
| 3616 | 3637 | ||
| 3617 | if (*flags & MS_RDONLY) { | 3638 | if (*flags & MS_RDONLY) { |
| 3639 | err = dquot_suspend(sb, -1); | ||
| 3640 | if (err < 0) | ||
| 3641 | goto restore_opts; | ||
| 3642 | |||
| 3618 | /* | 3643 | /* |
| 3619 | * First of all, the unconditional stuff we have to do | 3644 | * First of all, the unconditional stuff we have to do |
| 3620 | * to disable replay of the journal when we next remount | 3645 | * to disable replay of the journal when we next remount |
| @@ -3683,6 +3708,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) | |||
| 3683 | goto restore_opts; | 3708 | goto restore_opts; |
| 3684 | if (!ext4_setup_super(sb, es, 0)) | 3709 | if (!ext4_setup_super(sb, es, 0)) |
| 3685 | sb->s_flags &= ~MS_RDONLY; | 3710 | sb->s_flags &= ~MS_RDONLY; |
| 3711 | enable_quota = 1; | ||
| 3686 | } | 3712 | } |
| 3687 | } | 3713 | } |
| 3688 | ext4_setup_system_zone(sb); | 3714 | ext4_setup_system_zone(sb); |
| @@ -3698,6 +3724,11 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) | |||
| 3698 | #endif | 3724 | #endif |
| 3699 | unlock_super(sb); | 3725 | unlock_super(sb); |
| 3700 | unlock_kernel(); | 3726 | unlock_kernel(); |
| 3727 | if (enable_quota) | ||
| 3728 | dquot_resume(sb, -1); | ||
| 3729 | |||
| 3730 | ext4_msg(sb, KERN_INFO, "re-mounted. Opts: %s", orig_data); | ||
| 3731 | kfree(orig_data); | ||
| 3701 | return 0; | 3732 | return 0; |
| 3702 | 3733 | ||
| 3703 | restore_opts: | 3734 | restore_opts: |
| @@ -3719,6 +3750,7 @@ restore_opts: | |||
| 3719 | #endif | 3750 | #endif |
| 3720 | unlock_super(sb); | 3751 | unlock_super(sb); |
| 3721 | unlock_kernel(); | 3752 | unlock_kernel(); |
| 3753 | kfree(orig_data); | ||
| 3722 | return err; | 3754 | return err; |
| 3723 | } | 3755 | } |
| 3724 | 3756 | ||
| @@ -3891,24 +3923,21 @@ static int ext4_write_info(struct super_block *sb, int type) | |||
| 3891 | */ | 3923 | */ |
| 3892 | static int ext4_quota_on_mount(struct super_block *sb, int type) | 3924 | static int ext4_quota_on_mount(struct super_block *sb, int type) |
| 3893 | { | 3925 | { |
| 3894 | return vfs_quota_on_mount(sb, EXT4_SB(sb)->s_qf_names[type], | 3926 | return dquot_quota_on_mount(sb, EXT4_SB(sb)->s_qf_names[type], |
| 3895 | EXT4_SB(sb)->s_jquota_fmt, type); | 3927 | EXT4_SB(sb)->s_jquota_fmt, type); |
| 3896 | } | 3928 | } |
| 3897 | 3929 | ||
| 3898 | /* | 3930 | /* |
| 3899 | * Standard function to be called on quota_on | 3931 | * Standard function to be called on quota_on |
| 3900 | */ | 3932 | */ |
| 3901 | static int ext4_quota_on(struct super_block *sb, int type, int format_id, | 3933 | static int ext4_quota_on(struct super_block *sb, int type, int format_id, |
| 3902 | char *name, int remount) | 3934 | char *name) |
| 3903 | { | 3935 | { |
| 3904 | int err; | 3936 | int err; |
| 3905 | struct path path; | 3937 | struct path path; |
| 3906 | 3938 | ||
| 3907 | if (!test_opt(sb, QUOTA)) | 3939 | if (!test_opt(sb, QUOTA)) |
| 3908 | return -EINVAL; | 3940 | return -EINVAL; |
| 3909 | /* When remounting, no checks are needed and in fact, name is NULL */ | ||
| 3910 | if (remount) | ||
| 3911 | return vfs_quota_on(sb, type, format_id, name, remount); | ||
| 3912 | 3941 | ||
| 3913 | err = kern_path(name, LOOKUP_FOLLOW, &path); | 3942 | err = kern_path(name, LOOKUP_FOLLOW, &path); |
| 3914 | if (err) | 3943 | if (err) |
| @@ -3947,7 +3976,7 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id, | |||
| 3947 | } | 3976 | } |
| 3948 | } | 3977 | } |
| 3949 | 3978 | ||
| 3950 | err = vfs_quota_on_path(sb, type, format_id, &path); | 3979 | err = dquot_quota_on_path(sb, type, format_id, &path); |
| 3951 | path_put(&path); | 3980 | path_put(&path); |
| 3952 | return err; | 3981 | return err; |
| 3953 | } | 3982 | } |
| @@ -4068,7 +4097,7 @@ static int ext4_get_sb(struct file_system_type *fs_type, int flags, | |||
| 4068 | return get_sb_bdev(fs_type, flags, dev_name, data, ext4_fill_super,mnt); | 4097 | return get_sb_bdev(fs_type, flags, dev_name, data, ext4_fill_super,mnt); |
| 4069 | } | 4098 | } |
| 4070 | 4099 | ||
| 4071 | #if !defined(CONTIG_EXT2_FS) && !defined(CONFIG_EXT2_FS_MODULE) && defined(CONFIG_EXT4_USE_FOR_EXT23) | 4100 | #if !defined(CONFIG_EXT2_FS) && !defined(CONFIG_EXT2_FS_MODULE) && defined(CONFIG_EXT4_USE_FOR_EXT23) |
| 4072 | static struct file_system_type ext2_fs_type = { | 4101 | static struct file_system_type ext2_fs_type = { |
| 4073 | .owner = THIS_MODULE, | 4102 | .owner = THIS_MODULE, |
| 4074 | .name = "ext2", | 4103 | .name = "ext2", |
| @@ -4095,15 +4124,7 @@ static inline void register_as_ext2(void) { } | |||
| 4095 | static inline void unregister_as_ext2(void) { } | 4124 | static inline void unregister_as_ext2(void) { } |
| 4096 | #endif | 4125 | #endif |
| 4097 | 4126 | ||
| 4098 | #if !defined(CONTIG_EXT3_FS) && !defined(CONFIG_EXT3_FS_MODULE) && defined(CONFIG_EXT4_USE_FOR_EXT23) | 4127 | #if !defined(CONFIG_EXT3_FS) && !defined(CONFIG_EXT3_FS_MODULE) && defined(CONFIG_EXT4_USE_FOR_EXT23) |
| 4099 | static struct file_system_type ext3_fs_type = { | ||
| 4100 | .owner = THIS_MODULE, | ||
| 4101 | .name = "ext3", | ||
| 4102 | .get_sb = ext4_get_sb, | ||
| 4103 | .kill_sb = kill_block_super, | ||
| 4104 | .fs_flags = FS_REQUIRES_DEV, | ||
| 4105 | }; | ||
| 4106 | |||
| 4107 | static inline void register_as_ext3(void) | 4128 | static inline void register_as_ext3(void) |
| 4108 | { | 4129 | { |
| 4109 | int err = register_filesystem(&ext3_fs_type); | 4130 | int err = register_filesystem(&ext3_fs_type); |
| @@ -4134,6 +4155,7 @@ static int __init init_ext4_fs(void) | |||
| 4134 | { | 4155 | { |
| 4135 | int err; | 4156 | int err; |
| 4136 | 4157 | ||
| 4158 | ext4_check_flag_values(); | ||
| 4137 | err = init_ext4_system_zone(); | 4159 | err = init_ext4_system_zone(); |
| 4138 | if (err) | 4160 | if (err) |
| 4139 | return err; | 4161 | return err; |
