Commit ff3944df authored by Theodore Ts'o's avatar Theodore Ts'o Committed by Kamal Mostafa

ext4: ignore quota mount options if the quota feature is enabled

commit c325a67c upstream.

Previously, ext4 would fail the mount if the file system had the quota
feature enabled and quota mount options (used for the older quota
setups) were present.  This broke xfstests, since xfs silently ignores
the usrquote and grpquota mount options if they are specified.  This
commit changes things so that we are consistent with xfs; having the
mount options specified is harmless, so no sense break users by
forbidding them.
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
[ kamal: backport to 4.2-stable: context ]
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent f0c3d556
...@@ -1279,9 +1279,9 @@ static int set_qf_name(struct super_block *sb, int qtype, substring_t *args) ...@@ -1279,9 +1279,9 @@ static int set_qf_name(struct super_block *sb, int qtype, substring_t *args)
return -1; return -1;
} }
if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)) { if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)) {
ext4_msg(sb, KERN_ERR, "Cannot set journaled quota options " ext4_msg(sb, KERN_INFO, "Journaled quota options "
"when QUOTA feature is enabled"); "ignored when QUOTA feature is enabled");
return -1; return 1;
} }
qname = match_strdup(args); qname = match_strdup(args);
if (!qname) { if (!qname) {
...@@ -1622,10 +1622,10 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token, ...@@ -1622,10 +1622,10 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
} }
if (EXT4_HAS_RO_COMPAT_FEATURE(sb, if (EXT4_HAS_RO_COMPAT_FEATURE(sb,
EXT4_FEATURE_RO_COMPAT_QUOTA)) { EXT4_FEATURE_RO_COMPAT_QUOTA)) {
ext4_msg(sb, KERN_ERR, ext4_msg(sb, KERN_INFO,
"Cannot set journaled quota options " "Quota format mount options ignored "
"when QUOTA feature is enabled"); "when QUOTA feature is enabled");
return -1; return 1;
} }
sbi->s_jquota_fmt = m->mount_opt; sbi->s_jquota_fmt = m->mount_opt;
#endif #endif
...@@ -1677,11 +1677,11 @@ static int parse_options(char *options, struct super_block *sb, ...@@ -1677,11 +1677,11 @@ static int parse_options(char *options, struct super_block *sb,
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA) && if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA) &&
(test_opt(sb, USRQUOTA) || test_opt(sb, GRPQUOTA))) { (test_opt(sb, USRQUOTA) || test_opt(sb, GRPQUOTA))) {
ext4_msg(sb, KERN_ERR, "Cannot set quota options when QUOTA " ext4_msg(sb, KERN_INFO, "Quota feature enabled, usrquota and grpquota "
"feature is enabled"); "mount options ignored.");
return 0; clear_opt(sb, USRQUOTA);
} clear_opt(sb, GRPQUOTA);
if (sbi->s_qf_names[USRQUOTA] || sbi->s_qf_names[GRPQUOTA]) { } else if (sbi->s_qf_names[USRQUOTA] || sbi->s_qf_names[GRPQUOTA]) {
if (test_opt(sb, USRQUOTA) && sbi->s_qf_names[USRQUOTA]) if (test_opt(sb, USRQUOTA) && sbi->s_qf_names[USRQUOTA])
clear_opt(sb, USRQUOTA); clear_opt(sb, USRQUOTA);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment