diff options
author | Jan Kara <jack@suse.cz> | 2008-07-25 04:46:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-25 13:53:32 -0400 |
commit | d06bf1d252fe16f5f0d13e04da7a9913420aa1cf (patch) | |
tree | 2b552d620b0a114d3085ddee3f9a1929040d8bf0 /fs/ext3 | |
parent | 99aeaf639f61ab6be1967e5f92e2e28dafad8383 (diff) |
ext3: correct mount option parsing to detect when quota options can be changed
We should not allow user to change quota mount options when quota is just
suspended. I would make mount options and internal quota state inconsistent.
Also we should not allow user to change quota format when quota is turned on.
On the other hand we can just silently ignore when some option is set to the
value it already has (mount does this on remount).
Cc: <linux-ext4@vger.kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ext3')
-rw-r--r-- | fs/ext3/super.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 0a1bf82845c..615788c6843 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -842,7 +842,7 @@ static int parse_options (char *options, struct super_block *sb, | |||
842 | int data_opt = 0; | 842 | int data_opt = 0; |
843 | int option; | 843 | int option; |
844 | #ifdef CONFIG_QUOTA | 844 | #ifdef CONFIG_QUOTA |
845 | int qtype; | 845 | int qtype, qfmt; |
846 | char *qname; | 846 | char *qname; |
847 | #endif | 847 | #endif |
848 | 848 | ||
@@ -1018,7 +1018,9 @@ static int parse_options (char *options, struct super_block *sb, | |||
1018 | case Opt_grpjquota: | 1018 | case Opt_grpjquota: |
1019 | qtype = GRPQUOTA; | 1019 | qtype = GRPQUOTA; |
1020 | set_qf_name: | 1020 | set_qf_name: |
1021 | if (sb_any_quota_enabled(sb)) { | 1021 | if ((sb_any_quota_enabled(sb) || |
1022 | sb_any_quota_suspended(sb)) && | ||
1023 | !sbi->s_qf_names[qtype]) { | ||
1022 | printk(KERN_ERR | 1024 | printk(KERN_ERR |
1023 | "EXT3-fs: Cannot change journaled " | 1025 | "EXT3-fs: Cannot change journaled " |
1024 | "quota options when quota turned on.\n"); | 1026 | "quota options when quota turned on.\n"); |
@@ -1056,7 +1058,9 @@ set_qf_name: | |||
1056 | case Opt_offgrpjquota: | 1058 | case Opt_offgrpjquota: |
1057 | qtype = GRPQUOTA; | 1059 | qtype = GRPQUOTA; |
1058 | clear_qf_name: | 1060 | clear_qf_name: |
1059 | if (sb_any_quota_enabled(sb)) { | 1061 | if ((sb_any_quota_enabled(sb) || |
1062 | sb_any_quota_suspended(sb)) && | ||
1063 | sbi->s_qf_names[qtype]) { | ||
1060 | printk(KERN_ERR "EXT3-fs: Cannot change " | 1064 | printk(KERN_ERR "EXT3-fs: Cannot change " |
1061 | "journaled quota options when " | 1065 | "journaled quota options when " |
1062 | "quota turned on.\n"); | 1066 | "quota turned on.\n"); |
@@ -1069,10 +1073,20 @@ clear_qf_name: | |||
1069 | sbi->s_qf_names[qtype] = NULL; | 1073 | sbi->s_qf_names[qtype] = NULL; |
1070 | break; | 1074 | break; |
1071 | case Opt_jqfmt_vfsold: | 1075 | case Opt_jqfmt_vfsold: |
1072 | sbi->s_jquota_fmt = QFMT_VFS_OLD; | 1076 | qfmt = QFMT_VFS_OLD; |
1073 | break; | 1077 | goto set_qf_format; |
1074 | case Opt_jqfmt_vfsv0: | 1078 | case Opt_jqfmt_vfsv0: |
1075 | sbi->s_jquota_fmt = QFMT_VFS_V0; | 1079 | qfmt = QFMT_VFS_V0; |
1080 | set_qf_format: | ||
1081 | if ((sb_any_quota_enabled(sb) || | ||
1082 | sb_any_quota_suspended(sb)) && | ||
1083 | sbi->s_jquota_fmt != qfmt) { | ||
1084 | printk(KERN_ERR "EXT3-fs: Cannot change " | ||
1085 | "journaled quota options when " | ||
1086 | "quota turned on.\n"); | ||
1087 | return 0; | ||
1088 | } | ||
1089 | sbi->s_jquota_fmt = qfmt; | ||
1076 | break; | 1090 | break; |
1077 | case Opt_quota: | 1091 | case Opt_quota: |
1078 | case Opt_usrquota: | 1092 | case Opt_usrquota: |
@@ -1084,7 +1098,8 @@ clear_qf_name: | |||
1084 | set_opt(sbi->s_mount_opt, GRPQUOTA); | 1098 | set_opt(sbi->s_mount_opt, GRPQUOTA); |
1085 | break; | 1099 | break; |
1086 | case Opt_noquota: | 1100 | case Opt_noquota: |
1087 | if (sb_any_quota_enabled(sb)) { | 1101 | if (sb_any_quota_enabled(sb) || |
1102 | sb_any_quota_suspended(sb)) { | ||
1088 | printk(KERN_ERR "EXT3-fs: Cannot change quota " | 1103 | printk(KERN_ERR "EXT3-fs: Cannot change quota " |
1089 | "options when quota turned on.\n"); | 1104 | "options when quota turned on.\n"); |
1090 | return 0; | 1105 | return 0; |