aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/super.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-04-07 20:22:20 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-04-07 20:22:20 -0400
commit93061f390f107c37bad7e3bf9eb07bda58a4a99f (patch)
tree6cd3ad605900fa7145a700c22062fabe36ccff95 /fs/ext4/super.c
parent1c915b3ac4ecf6ff67573eed24458d862e842cb6 (diff)
parentc325a67c72903e1cc30e990a15ce745bda0dbfde (diff)
Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 bugfixes from Ted Ts'o: "These changes contains a fix for overlayfs interacting with some (badly behaved) dentry code in various file systems. These have been reviewed by Al and the respective file system mtinainers and are going through the ext4 tree for convenience. This also has a few ext4 encryption bug fixes that were discovered in Android testing (yes, we will need to get these sync'ed up with the fs/crypto code; I'll take care of that). It also has some bug fixes and a change to ignore the legacy quota options to allow for xfstests regression testing of ext4's internal quota feature and to be more consistent with how xfs handles this case" * tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: ext4: ignore quota mount options if the quota feature is enabled ext4 crypto: fix some error handling ext4: avoid calling dquot_get_next_id() if quota is not enabled ext4: retry block allocation for failed DIO and DAX writes ext4: add lockdep annotations for i_data_sem ext4: allow readdir()'s of large empty directories to be interrupted btrfs: fix crash/invalid memory access on fsync when using overlayfs ext4 crypto: use dget_parent() in ext4_d_revalidate() ext4: use file_dentry() ext4: use dget_parent() in ext4_file_open() nfs: use file_dentry() fs: add file_dentry() ext4 crypto: don't let data integrity writebacks fail with ENOMEM ext4: check if in-inode xattr is corrupted in ext4_expand_extra_isize_ea()
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r--fs/ext4/super.c61
1 files changed, 47 insertions, 14 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0bb74aacb8c0..304c712dbe12 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1113,6 +1113,7 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
1113static int ext4_quota_enable(struct super_block *sb, int type, int format_id, 1113static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
1114 unsigned int flags); 1114 unsigned int flags);
1115static int ext4_enable_quotas(struct super_block *sb); 1115static int ext4_enable_quotas(struct super_block *sb);
1116static int ext4_get_next_id(struct super_block *sb, struct kqid *qid);
1116 1117
1117static struct dquot **ext4_get_dquots(struct inode *inode) 1118static struct dquot **ext4_get_dquots(struct inode *inode)
1118{ 1119{
@@ -1129,7 +1130,7 @@ static const struct dquot_operations ext4_quota_operations = {
1129 .alloc_dquot = dquot_alloc, 1130 .alloc_dquot = dquot_alloc,
1130 .destroy_dquot = dquot_destroy, 1131 .destroy_dquot = dquot_destroy,
1131 .get_projid = ext4_get_projid, 1132 .get_projid = ext4_get_projid,
1132 .get_next_id = dquot_get_next_id, 1133 .get_next_id = ext4_get_next_id,
1133}; 1134};
1134 1135
1135static const struct quotactl_ops ext4_qctl_operations = { 1136static const struct quotactl_ops ext4_qctl_operations = {
@@ -1323,9 +1324,9 @@ static int set_qf_name(struct super_block *sb, int qtype, substring_t *args)
1323 return -1; 1324 return -1;
1324 } 1325 }
1325 if (ext4_has_feature_quota(sb)) { 1326 if (ext4_has_feature_quota(sb)) {
1326 ext4_msg(sb, KERN_ERR, "Cannot set journaled quota options " 1327 ext4_msg(sb, KERN_INFO, "Journaled quota options "
1327 "when QUOTA feature is enabled"); 1328 "ignored when QUOTA feature is enabled");
1328 return -1; 1329 return 1;
1329 } 1330 }
1330 qname = match_strdup(args); 1331 qname = match_strdup(args);
1331 if (!qname) { 1332 if (!qname) {
@@ -1688,10 +1689,10 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
1688 return -1; 1689 return -1;
1689 } 1690 }
1690 if (ext4_has_feature_quota(sb)) { 1691 if (ext4_has_feature_quota(sb)) {
1691 ext4_msg(sb, KERN_ERR, 1692 ext4_msg(sb, KERN_INFO,
1692 "Cannot set journaled quota options " 1693 "Quota format mount options ignored "
1693 "when QUOTA feature is enabled"); 1694 "when QUOTA feature is enabled");
1694 return -1; 1695 return 1;
1695 } 1696 }
1696 sbi->s_jquota_fmt = m->mount_opt; 1697 sbi->s_jquota_fmt = m->mount_opt;
1697#endif 1698#endif
@@ -1756,11 +1757,11 @@ static int parse_options(char *options, struct super_block *sb,
1756#ifdef CONFIG_QUOTA 1757#ifdef CONFIG_QUOTA
1757 if (ext4_has_feature_quota(sb) && 1758 if (ext4_has_feature_quota(sb) &&
1758 (test_opt(sb, USRQUOTA) || test_opt(sb, GRPQUOTA))) { 1759 (test_opt(sb, USRQUOTA) || test_opt(sb, GRPQUOTA))) {
1759 ext4_msg(sb, KERN_ERR, "Cannot set quota options when QUOTA " 1760 ext4_msg(sb, KERN_INFO, "Quota feature enabled, usrquota and grpquota "
1760 "feature is enabled"); 1761 "mount options ignored.");
1761 return 0; 1762 clear_opt(sb, USRQUOTA);
1762 } 1763 clear_opt(sb, GRPQUOTA);
1763 if (sbi->s_qf_names[USRQUOTA] || sbi->s_qf_names[GRPQUOTA]) { 1764 } else if (sbi->s_qf_names[USRQUOTA] || sbi->s_qf_names[GRPQUOTA]) {
1764 if (test_opt(sb, USRQUOTA) && sbi->s_qf_names[USRQUOTA]) 1765 if (test_opt(sb, USRQUOTA) && sbi->s_qf_names[USRQUOTA])
1765 clear_opt(sb, USRQUOTA); 1766 clear_opt(sb, USRQUOTA);
1766 1767
@@ -5028,6 +5029,20 @@ static int ext4_quota_on_mount(struct super_block *sb, int type)
5028 EXT4_SB(sb)->s_jquota_fmt, type); 5029 EXT4_SB(sb)->s_jquota_fmt, type);
5029} 5030}
5030 5031
5032static void lockdep_set_quota_inode(struct inode *inode, int subclass)
5033{
5034 struct ext4_inode_info *ei = EXT4_I(inode);
5035
5036 /* The first argument of lockdep_set_subclass has to be
5037 * *exactly* the same as the argument to init_rwsem() --- in
5038 * this case, in init_once() --- or lockdep gets unhappy
5039 * because the name of the lock is set using the
5040 * stringification of the argument to init_rwsem().
5041 */
5042 (void) ei; /* shut up clang warning if !CONFIG_LOCKDEP */
5043 lockdep_set_subclass(&ei->i_data_sem, subclass);
5044}
5045
5031/* 5046/*
5032 * Standard function to be called on quota_on 5047 * Standard function to be called on quota_on
5033 */ 5048 */
@@ -5067,8 +5082,12 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
5067 if (err) 5082 if (err)
5068 return err; 5083 return err;
5069 } 5084 }
5070 5085 lockdep_set_quota_inode(path->dentry->d_inode, I_DATA_SEM_QUOTA);
5071 return dquot_quota_on(sb, type, format_id, path); 5086 err = dquot_quota_on(sb, type, format_id, path);
5087 if (err)
5088 lockdep_set_quota_inode(path->dentry->d_inode,
5089 I_DATA_SEM_NORMAL);
5090 return err;
5072} 5091}
5073 5092
5074static int ext4_quota_enable(struct super_block *sb, int type, int format_id, 5093static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
@@ -5095,8 +5114,11 @@ static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
5095 5114
5096 /* Don't account quota for quota files to avoid recursion */ 5115 /* Don't account quota for quota files to avoid recursion */
5097 qf_inode->i_flags |= S_NOQUOTA; 5116 qf_inode->i_flags |= S_NOQUOTA;
5117 lockdep_set_quota_inode(qf_inode, I_DATA_SEM_QUOTA);
5098 err = dquot_enable(qf_inode, type, format_id, flags); 5118 err = dquot_enable(qf_inode, type, format_id, flags);
5099 iput(qf_inode); 5119 iput(qf_inode);
5120 if (err)
5121 lockdep_set_quota_inode(qf_inode, I_DATA_SEM_NORMAL);
5100 5122
5101 return err; 5123 return err;
5102} 5124}
@@ -5253,6 +5275,17 @@ out:
5253 return len; 5275 return len;
5254} 5276}
5255 5277
5278static int ext4_get_next_id(struct super_block *sb, struct kqid *qid)
5279{
5280 const struct quota_format_ops *ops;
5281
5282 if (!sb_has_quota_loaded(sb, qid->type))
5283 return -ESRCH;
5284 ops = sb_dqopt(sb)->ops[qid->type];
5285 if (!ops || !ops->get_next_id)
5286 return -ENOSYS;
5287 return dquot_get_next_id(sb, qid);
5288}
5256#endif 5289#endif
5257 5290
5258static struct dentry *ext4_mount(struct file_system_type *fs_type, int flags, 5291static struct dentry *ext4_mount(struct file_system_type *fs_type, int flags,