diff options
author | Jan Kara <jack@suse.cz> | 2008-05-13 19:11:51 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-05-13 19:11:51 -0400 |
commit | dfc5d03f12e706c19ee37734184ea96582ef931d (patch) | |
tree | 66397d0933ba3307a9de99db298ae790dda90336 | |
parent | 8f40f672e6bb071812f61bfbd30efc3fc1263ad1 (diff) |
ext4: 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. It 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: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | fs/ext4/super.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 52dd0679a4e2..686ebcc2e6c7 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -979,7 +979,7 @@ static int parse_options (char *options, struct super_block *sb, | |||
979 | int data_opt = 0; | 979 | int data_opt = 0; |
980 | int option; | 980 | int option; |
981 | #ifdef CONFIG_QUOTA | 981 | #ifdef CONFIG_QUOTA |
982 | int qtype; | 982 | int qtype, qfmt; |
983 | char *qname; | 983 | char *qname; |
984 | #endif | 984 | #endif |
985 | 985 | ||
@@ -1162,7 +1162,9 @@ static int parse_options (char *options, struct super_block *sb, | |||
1162 | case Opt_grpjquota: | 1162 | case Opt_grpjquota: |
1163 | qtype = GRPQUOTA; | 1163 | qtype = GRPQUOTA; |
1164 | set_qf_name: | 1164 | set_qf_name: |
1165 | if (sb_any_quota_enabled(sb)) { | 1165 | if ((sb_any_quota_enabled(sb) || |
1166 | sb_any_quota_suspended(sb)) && | ||
1167 | !sbi->s_qf_names[qtype]) { | ||
1166 | printk(KERN_ERR | 1168 | printk(KERN_ERR |
1167 | "EXT4-fs: Cannot change journalled " | 1169 | "EXT4-fs: Cannot change journalled " |
1168 | "quota options when quota turned on.\n"); | 1170 | "quota options when quota turned on.\n"); |
@@ -1200,7 +1202,9 @@ set_qf_name: | |||
1200 | case Opt_offgrpjquota: | 1202 | case Opt_offgrpjquota: |
1201 | qtype = GRPQUOTA; | 1203 | qtype = GRPQUOTA; |
1202 | clear_qf_name: | 1204 | clear_qf_name: |
1203 | if (sb_any_quota_enabled(sb)) { | 1205 | if ((sb_any_quota_enabled(sb) || |
1206 | sb_any_quota_suspended(sb)) && | ||
1207 | sbi->s_qf_names[qtype]) { | ||
1204 | printk(KERN_ERR "EXT4-fs: Cannot change " | 1208 | printk(KERN_ERR "EXT4-fs: Cannot change " |
1205 | "journalled quota options when " | 1209 | "journalled quota options when " |
1206 | "quota turned on.\n"); | 1210 | "quota turned on.\n"); |
@@ -1213,10 +1217,20 @@ clear_qf_name: | |||
1213 | sbi->s_qf_names[qtype] = NULL; | 1217 | sbi->s_qf_names[qtype] = NULL; |
1214 | break; | 1218 | break; |
1215 | case Opt_jqfmt_vfsold: | 1219 | case Opt_jqfmt_vfsold: |
1216 | sbi->s_jquota_fmt = QFMT_VFS_OLD; | 1220 | qfmt = QFMT_VFS_OLD; |
1217 | break; | 1221 | goto set_qf_format; |
1218 | case Opt_jqfmt_vfsv0: | 1222 | case Opt_jqfmt_vfsv0: |
1219 | sbi->s_jquota_fmt = QFMT_VFS_V0; | 1223 | qfmt = QFMT_VFS_V0; |
1224 | set_qf_format: | ||
1225 | if ((sb_any_quota_enabled(sb) || | ||
1226 | sb_any_quota_suspended(sb)) && | ||
1227 | sbi->s_jquota_fmt != qfmt) { | ||
1228 | printk(KERN_ERR "EXT4-fs: Cannot change " | ||
1229 | "journaled quota options when " | ||
1230 | "quota turned on.\n"); | ||
1231 | return 0; | ||
1232 | } | ||
1233 | sbi->s_jquota_fmt = qfmt; | ||
1220 | break; | 1234 | break; |
1221 | case Opt_quota: | 1235 | case Opt_quota: |
1222 | case Opt_usrquota: | 1236 | case Opt_usrquota: |