diff options
Diffstat (limited to 'fs/ext3/super.c')
-rw-r--r-- | fs/ext3/super.c | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 4ba2683c1d44..5546ca225ffe 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -916,21 +916,24 @@ static int set_qf_name(struct super_block *sb, int qtype, substring_t *args) | |||
916 | "Not enough memory for storing quotafile name"); | 916 | "Not enough memory for storing quotafile name"); |
917 | return 0; | 917 | return 0; |
918 | } | 918 | } |
919 | if (sbi->s_qf_names[qtype] && | 919 | if (sbi->s_qf_names[qtype]) { |
920 | strcmp(sbi->s_qf_names[qtype], qname)) { | 920 | int same = !strcmp(sbi->s_qf_names[qtype], qname); |
921 | ext3_msg(sb, KERN_ERR, | 921 | |
922 | "%s quota file already specified", QTYPE2NAME(qtype)); | ||
923 | kfree(qname); | 922 | kfree(qname); |
924 | return 0; | 923 | if (!same) { |
924 | ext3_msg(sb, KERN_ERR, | ||
925 | "%s quota file already specified", | ||
926 | QTYPE2NAME(qtype)); | ||
927 | } | ||
928 | return same; | ||
925 | } | 929 | } |
926 | sbi->s_qf_names[qtype] = qname; | 930 | if (strchr(qname, '/')) { |
927 | if (strchr(sbi->s_qf_names[qtype], '/')) { | ||
928 | ext3_msg(sb, KERN_ERR, | 931 | ext3_msg(sb, KERN_ERR, |
929 | "quotafile must be on filesystem root"); | 932 | "quotafile must be on filesystem root"); |
930 | kfree(sbi->s_qf_names[qtype]); | 933 | kfree(qname); |
931 | sbi->s_qf_names[qtype] = NULL; | ||
932 | return 0; | 934 | return 0; |
933 | } | 935 | } |
936 | sbi->s_qf_names[qtype] = qname; | ||
934 | set_opt(sbi->s_mount_opt, QUOTA); | 937 | set_opt(sbi->s_mount_opt, QUOTA); |
935 | return 1; | 938 | return 1; |
936 | } | 939 | } |
@@ -945,11 +948,10 @@ static int clear_qf_name(struct super_block *sb, int qtype) { | |||
945 | " when quota turned on"); | 948 | " when quota turned on"); |
946 | return 0; | 949 | return 0; |
947 | } | 950 | } |
948 | /* | 951 | if (sbi->s_qf_names[qtype]) { |
949 | * The space will be released later when all options are confirmed | 952 | kfree(sbi->s_qf_names[qtype]); |
950 | * to be correct | 953 | sbi->s_qf_names[qtype] = NULL; |
951 | */ | 954 | } |
952 | sbi->s_qf_names[qtype] = NULL; | ||
953 | return 1; | 955 | return 1; |
954 | } | 956 | } |
955 | #endif | 957 | #endif |
@@ -2606,7 +2608,18 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data) | |||
2606 | #ifdef CONFIG_QUOTA | 2608 | #ifdef CONFIG_QUOTA |
2607 | old_opts.s_jquota_fmt = sbi->s_jquota_fmt; | 2609 | old_opts.s_jquota_fmt = sbi->s_jquota_fmt; |
2608 | for (i = 0; i < MAXQUOTAS; i++) | 2610 | for (i = 0; i < MAXQUOTAS; i++) |
2609 | old_opts.s_qf_names[i] = sbi->s_qf_names[i]; | 2611 | if (sbi->s_qf_names[i]) { |
2612 | old_opts.s_qf_names[i] = kstrdup(sbi->s_qf_names[i], | ||
2613 | GFP_KERNEL); | ||
2614 | if (!old_opts.s_qf_names[i]) { | ||
2615 | int j; | ||
2616 | |||
2617 | for (j = 0; j < i; j++) | ||
2618 | kfree(old_opts.s_qf_names[j]); | ||
2619 | return -ENOMEM; | ||
2620 | } | ||
2621 | } else | ||
2622 | old_opts.s_qf_names[i] = NULL; | ||
2610 | #endif | 2623 | #endif |
2611 | 2624 | ||
2612 | /* | 2625 | /* |
@@ -2699,9 +2712,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data) | |||
2699 | #ifdef CONFIG_QUOTA | 2712 | #ifdef CONFIG_QUOTA |
2700 | /* Release old quota file names */ | 2713 | /* Release old quota file names */ |
2701 | for (i = 0; i < MAXQUOTAS; i++) | 2714 | for (i = 0; i < MAXQUOTAS; i++) |
2702 | if (old_opts.s_qf_names[i] && | 2715 | kfree(old_opts.s_qf_names[i]); |
2703 | old_opts.s_qf_names[i] != sbi->s_qf_names[i]) | ||
2704 | kfree(old_opts.s_qf_names[i]); | ||
2705 | #endif | 2716 | #endif |
2706 | if (enable_quota) | 2717 | if (enable_quota) |
2707 | dquot_resume(sb, -1); | 2718 | dquot_resume(sb, -1); |
@@ -2715,9 +2726,7 @@ restore_opts: | |||
2715 | #ifdef CONFIG_QUOTA | 2726 | #ifdef CONFIG_QUOTA |
2716 | sbi->s_jquota_fmt = old_opts.s_jquota_fmt; | 2727 | sbi->s_jquota_fmt = old_opts.s_jquota_fmt; |
2717 | for (i = 0; i < MAXQUOTAS; i++) { | 2728 | for (i = 0; i < MAXQUOTAS; i++) { |
2718 | if (sbi->s_qf_names[i] && | 2729 | kfree(sbi->s_qf_names[i]); |
2719 | old_opts.s_qf_names[i] != sbi->s_qf_names[i]) | ||
2720 | kfree(sbi->s_qf_names[i]); | ||
2721 | sbi->s_qf_names[i] = old_opts.s_qf_names[i]; | 2730 | sbi->s_qf_names[i] = old_opts.s_qf_names[i]; |
2722 | } | 2731 | } |
2723 | #endif | 2732 | #endif |