diff options
| -rw-r--r-- | fs/ext4/super.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 990ceab2e2bc..b7deba7d6a44 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
| @@ -1248,6 +1248,11 @@ static int set_qf_name(struct super_block *sb, int qtype, substring_t *args) | |||
| 1248 | "quota options when quota turned on"); | 1248 | "quota options when quota turned on"); |
| 1249 | return -1; | 1249 | return -1; |
| 1250 | } | 1250 | } |
| 1251 | if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)) { | ||
| 1252 | ext4_msg(sb, KERN_ERR, "Cannot set journaled quota options " | ||
| 1253 | "when QUOTA feature is enabled"); | ||
| 1254 | return -1; | ||
| 1255 | } | ||
| 1251 | qname = match_strdup(args); | 1256 | qname = match_strdup(args); |
| 1252 | if (!qname) { | 1257 | if (!qname) { |
| 1253 | ext4_msg(sb, KERN_ERR, | 1258 | ext4_msg(sb, KERN_ERR, |
| @@ -1545,6 +1550,13 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token, | |||
| 1545 | "quota options when quota turned on"); | 1550 | "quota options when quota turned on"); |
| 1546 | return -1; | 1551 | return -1; |
| 1547 | } | 1552 | } |
| 1553 | if (EXT4_HAS_RO_COMPAT_FEATURE(sb, | ||
| 1554 | EXT4_FEATURE_RO_COMPAT_QUOTA)) { | ||
| 1555 | ext4_msg(sb, KERN_ERR, | ||
| 1556 | "Cannot set journaled quota options " | ||
| 1557 | "when QUOTA feature is enabled"); | ||
| 1558 | return -1; | ||
| 1559 | } | ||
| 1548 | sbi->s_jquota_fmt = m->mount_opt; | 1560 | sbi->s_jquota_fmt = m->mount_opt; |
| 1549 | #endif | 1561 | #endif |
| 1550 | } else { | 1562 | } else { |
| @@ -1593,6 +1605,12 @@ static int parse_options(char *options, struct super_block *sb, | |||
| 1593 | return 0; | 1605 | return 0; |
| 1594 | } | 1606 | } |
| 1595 | #ifdef CONFIG_QUOTA | 1607 | #ifdef CONFIG_QUOTA |
| 1608 | if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA) && | ||
| 1609 | (test_opt(sb, USRQUOTA) || test_opt(sb, GRPQUOTA))) { | ||
| 1610 | ext4_msg(sb, KERN_ERR, "Cannot set quota options when QUOTA " | ||
| 1611 | "feature is enabled"); | ||
| 1612 | return 0; | ||
| 1613 | } | ||
| 1596 | if (sbi->s_qf_names[USRQUOTA] || sbi->s_qf_names[GRPQUOTA]) { | 1614 | if (sbi->s_qf_names[USRQUOTA] || sbi->s_qf_names[GRPQUOTA]) { |
| 1597 | if (test_opt(sb, USRQUOTA) && sbi->s_qf_names[USRQUOTA]) | 1615 | if (test_opt(sb, USRQUOTA) && sbi->s_qf_names[USRQUOTA]) |
| 1598 | clear_opt(sb, USRQUOTA); | 1616 | clear_opt(sb, USRQUOTA); |
| @@ -3715,13 +3733,11 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
| 3715 | sb->s_export_op = &ext4_export_ops; | 3733 | sb->s_export_op = &ext4_export_ops; |
| 3716 | sb->s_xattr = ext4_xattr_handlers; | 3734 | sb->s_xattr = ext4_xattr_handlers; |
| 3717 | #ifdef CONFIG_QUOTA | 3735 | #ifdef CONFIG_QUOTA |
| 3718 | sb->s_qcop = &ext4_qctl_operations; | ||
| 3719 | sb->dq_op = &ext4_quota_operations; | 3736 | sb->dq_op = &ext4_quota_operations; |
| 3720 | 3737 | if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)) | |
| 3721 | if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA)) { | ||
| 3722 | /* Use qctl operations for hidden quota files. */ | ||
| 3723 | sb->s_qcop = &ext4_qctl_sysfile_operations; | 3738 | sb->s_qcop = &ext4_qctl_sysfile_operations; |
| 3724 | } | 3739 | else |
| 3740 | sb->s_qcop = &ext4_qctl_operations; | ||
| 3725 | #endif | 3741 | #endif |
| 3726 | memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid)); | 3742 | memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid)); |
| 3727 | 3743 | ||
| @@ -4822,9 +4838,12 @@ static int ext4_release_dquot(struct dquot *dquot) | |||
| 4822 | 4838 | ||
| 4823 | static int ext4_mark_dquot_dirty(struct dquot *dquot) | 4839 | static int ext4_mark_dquot_dirty(struct dquot *dquot) |
| 4824 | { | 4840 | { |
| 4841 | struct super_block *sb = dquot->dq_sb; | ||
| 4842 | struct ext4_sb_info *sbi = EXT4_SB(sb); | ||
| 4843 | |||
| 4825 | /* Are we journaling quotas? */ | 4844 | /* Are we journaling quotas? */ |
| 4826 | if (EXT4_SB(dquot->dq_sb)->s_qf_names[USRQUOTA] || | 4845 | if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA) || |
| 4827 | EXT4_SB(dquot->dq_sb)->s_qf_names[GRPQUOTA]) { | 4846 | sbi->s_qf_names[USRQUOTA] || sbi->s_qf_names[GRPQUOTA]) { |
| 4828 | dquot_mark_dquot_dirty(dquot); | 4847 | dquot_mark_dquot_dirty(dquot); |
| 4829 | return ext4_write_dquot(dquot); | 4848 | return ext4_write_dquot(dquot); |
| 4830 | } else { | 4849 | } else { |
