History

Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs

Pull quota interface unification and misc cleanups from Jan Kara: "The first part of the series unifying XFS and VFS quota interfaces. This part unifies turning quotas on and off so quota-tools and xfs_quota can be used to manage any filesystem. This is useful so that userspace doesn't have to distinguish which filesystem it is working with. As a result we can then easily reuse tests for project quotas in XFS for ext4. This also contains minor cleanups and fixes for udf, isofs, and ext3" * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: (23 commits) udf: remove bool assignment to 0/1 udf: use bool for done quota: Store maximum space limit in bytes quota: Remove quota_on_meta callback ocfs2: Use generic helpers for quotaon and quotaoff ext4: Use generic helpers for quotaon and quotaoff quota: Add ->quota_{enable,disable} callbacks for VFS quotas quota: Wire up ->quota_{enable,disable} callbacks into Q_QUOTA{ON,OFF} quota: Split ->set_xstate callback into two xfs: Remove some pointless quota checks xfs: Remove some useless flags tests xfs: Remove useless test quota: Verify flags passed to Q_SETINFO quota: Cleanup flags definitions ocfs2: Move OLQF_CLEAN flag out of generic quota flags quota: Don't store flags for v2 quota format jbd: drop jbd_ENOSYS debug udf: destroy sbi mutex in put_super udf: Check length of extended attributes and allocation descriptors udf: Remove repeated loads blocksize ...

Linus Torvalds committed 11 years ago

Commit c5452a52 parents 4b4f858 698149821 files · +284 −244Browse files

Unified · Split

21 files
  1. fs/ext3/super.c +2 −0
  2. fs/ext4/super.c +1 −41
  3. fs/isofs/util.c +4 −14
  4. fs/ocfs2/quota.h +1 −0
  5. fs/ocfs2/quota_local.c +7 −7
  6. fs/ocfs2/super.c +1 −31
  7. fs/quota/dquot.c +98 −9
  8. fs/quota/quota.c +42 −10
  9. fs/quota/quota_v1.c +2 −2
  10. fs/quota/quota_v2.c +9 −7
  11. fs/udf/Kconfig +6 −4
  12. fs/udf/inode.c +19 −13
  13. fs/udf/super.c +3 −2
  14. fs/xfs/xfs_qm_syscalls.c +24 −50
  15. fs/xfs/xfs_quotaops.c +37 −22
  16. include/linux/dqblk_v1.h +0 −3
  17. include/linux/jbd.h +0 −9
  18. include/linux/jbd2.h +0 −9
  19. include/linux/quota.h +12 −10
  20. include/linux/quotaops.h +3 −0
  21. include/uapi/linux/quota.h +13 −1
fs/ext3/super.c+2−0
@@ -466,6 +466,8 @@ static void ext3_put_super (struct super_block * sb) · 465 unmodified lines
466466 }
467467 sb->s_fs_info = NULL;
468468 kfree(sbi->s_blockgroup_lock);
469+ mutex_destroy(&sbi->s_orphan_lock);
470+ mutex_destroy(&sbi->s_resize_lock);
469471 kfree(sbi);
470472 }
471473
fs/ext4/super.c+1−41
@@ -1046,10 +1046,7 @@ static int ext4_mark_dquot_dirty(struct dquot *dquot); · 1045 unmodified lines
10461046 static int ext4_write_info(struct super_block *sb, int type);
10471047 static int ext4_quota_on(struct super_block *sb, int type, int format_id,
10481048 struct path *path);
1049−static int ext4_quota_on_sysfile(struct super_block *sb, int type,
1050− int format_id);
10511049 static int ext4_quota_off(struct super_block *sb, int type);
1052−static int ext4_quota_off_sysfile(struct super_block *sb, int type);
10531050 static int ext4_quota_on_mount(struct super_block *sb, int type);
10541051 static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data,
10551052 size_t len, loff_t off);
@@ -1084,16 +1081,6 @@ static const struct quotactl_ops ext4_qctl_operations = { · 28 unmodified lines
10841081 .get_dqblk = dquot_get_dqblk,
10851082 .set_dqblk = dquot_set_dqblk
10861083 };
1087−
1088−static const struct quotactl_ops ext4_qctl_sysfile_operations = {
1089− .quota_on_meta = ext4_quota_on_sysfile,
1090− .quota_off = ext4_quota_off_sysfile,
1091− .quota_sync = dquot_quota_sync,
1092− .get_info = dquot_get_dqinfo,
1093− .set_info = dquot_set_dqinfo,
1094− .get_dqblk = dquot_get_dqblk,
1095− .set_dqblk = dquot_set_dqblk
1096−};
10971084 #endif
10981085
10991086 static const struct super_operations ext4_sops = {
@@ -3935,7 +3922,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) · 2835 unmodified lines
39353922 #ifdef CONFIG_QUOTA
39363923 sb->dq_op = &ext4_quota_operations;
39373924 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA))
3938− sb->s_qcop = &ext4_qctl_sysfile_operations;
3925+ sb->s_qcop = &dquot_quotactl_sysfile_ops;
39393926 else
39403927 sb->s_qcop = &ext4_qctl_operations;
39413928 sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP;
@@ -5288,21 +5275,6 @@ static int ext4_enable_quotas(struct super_block *sb) · 1346 unmodified lines
52885275 return 0;
52895276 }
52905277
5291−/*
5292− * quota_on function that is used when QUOTA feature is set.
5293− */
5294−static int ext4_quota_on_sysfile(struct super_block *sb, int type,
5295− int format_id)
5296−{
5297− if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA))
5298− return -EINVAL;
5299−
5300− /*
5301− * USAGE was enabled at mount time. Only need to enable LIMITS now.
5302− */
5303− return ext4_quota_enable(sb, type, format_id, DQUOT_LIMITS_ENABLED);
5304−}
5305−
53065278 static int ext4_quota_off(struct super_block *sb, int type)
53075279 {
53085280 struct inode *inode = sb_dqopt(sb)->files[type];
@@ -5329,18 +5301,6 @@ out: · 20 unmodified lines
53295301 return dquot_quota_off(sb, type);
53305302 }
53315303
5332−/*
5333− * quota_off function that is used when QUOTA feature is set.
5334− */
5335−static int ext4_quota_off_sysfile(struct super_block *sb, int type)
5336−{
5337− if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_QUOTA))
5338− return -EINVAL;
5339−
5340− /* Disable only the limits. */
5341− return dquot_disable(sb, type, DQUOT_LIMITS_ENABLED);
5342−}
5343−
53445304 /* Read data from quotafile - avoid pagecache and such because we cannot afford
53455305 * acquiring the locks... As quota files are never truncated and quota code
53465306 * itself serializes the operations (and no one else should touch the files)
fs/isofs/util.c+4−14
@@ -2,6 +2,7 @@ · 1 unmodified line
22 * linux/fs/isofs/util.c
33 */
44
5+#include <linux/time.h>
56 #include "isofs.h"
67
78 /*
@@ -17,9 +18,9 @@ · 9 unmodified lines
1718 int iso_date(char * p, int flag)
1819 {
1920 int year, month, day, hour, minute, second, tz;
20− int crtime, days, i;
21+ int crtime;
2122
22− year = p[0] - 70;
23+ year = p[0];
2324 month = p[1];
2425 day = p[2];
2526 hour = p[3];
@@ -31,18 +32,7 @@ int iso_date(char * p, int flag) · 5 unmodified lines
3132 if (year < 0) {
3233 crtime = 0;
3334 } else {
34− int monlen[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
35−
36− days = year * 365;
37− if (year > 2)
38− days += (year+1) / 4;
39− for (i = 1; i < month; i++)
40− days += monlen[i-1];
41− if (((year+2) % 4) == 0 && month > 2)
42− days++;
43− days += day - 1;
44− crtime = ((((days * 24) + hour) * 60 + minute) * 60)
45− + second;
35+ crtime = mktime64(year+1900, month, day, hour, minute, second);
4636
4737 /* sign extend */
4838 if (tz & 0x80)
fs/ocfs2/quota.h+1−0
@@ -48,6 +48,7 @@ struct ocfs2_quota_recovery { · 47 unmodified lines
4848 /* In-memory structure with quota header information */
4949 struct ocfs2_mem_dqinfo {
5050 unsigned int dqi_type; /* Quota type this structure describes */
51+ unsigned int dqi_flags; /* Flags OLQF_* */
5152 unsigned int dqi_chunks; /* Number of chunks in local quota file */
5253 unsigned int dqi_blocks; /* Number of blocks allocated for local quota file */
5354 unsigned int dqi_syncms; /* How often should we sync with other nodes */
fs/ocfs2/quota_local.c+7−7
@@ -292,7 +292,7 @@ static void olq_update_info(struct buffer_head *bh, void *private) · 291 unmodified lines
292292 ldinfo = (struct ocfs2_local_disk_dqinfo *)(bh->b_data +
293293 OCFS2_LOCAL_INFO_OFF);
294294 spin_lock(&dq_data_lock);
295− ldinfo->dqi_flags = cpu_to_le32(info->dqi_flags & DQF_MASK);
295+ ldinfo->dqi_flags = cpu_to_le32(oinfo->dqi_flags);
296296 ldinfo->dqi_chunks = cpu_to_le32(oinfo->dqi_chunks);
297297 ldinfo->dqi_blocks = cpu_to_le32(oinfo->dqi_blocks);
298298 spin_unlock(&dq_data_lock);
@@ -701,8 +701,8 @@ static int ocfs2_local_read_info(struct super_block *sb, int type) · 402 unmodified lines
701701 /* We don't need the lock and we have to acquire quota file locks
702702 * which will later depend on this lock */
703703 mutex_unlock(&sb_dqopt(sb)->dqio_mutex);
704− info->dqi_maxblimit = 0x7fffffffffffffffLL;
705− info->dqi_maxilimit = 0x7fffffffffffffffLL;
704+ info->dqi_max_spc_limit = 0x7fffffffffffffffLL;
705+ info->dqi_max_ino_limit = 0x7fffffffffffffffLL;
706706 oinfo = kmalloc(sizeof(struct ocfs2_mem_dqinfo), GFP_NOFS);
707707 if (!oinfo) {
708708 mlog(ML_ERROR, "failed to allocate memory for ocfs2 quota"
@@ -737,13 +737,13 @@ static int ocfs2_local_read_info(struct super_block *sb, int type) · 28 unmodified lines
737737 }
738738 ldinfo = (struct ocfs2_local_disk_dqinfo *)(bh->b_data +
739739 OCFS2_LOCAL_INFO_OFF);
740− info->dqi_flags = le32_to_cpu(ldinfo->dqi_flags);
740+ oinfo->dqi_flags = le32_to_cpu(ldinfo->dqi_flags);
741741 oinfo->dqi_chunks = le32_to_cpu(ldinfo->dqi_chunks);
742742 oinfo->dqi_blocks = le32_to_cpu(ldinfo->dqi_blocks);
743743 oinfo->dqi_libh = bh;
744744
745745 /* We crashed when using local quota file? */
746− if (!(info->dqi_flags & OLQF_CLEAN)) {
746+ if (!(oinfo->dqi_flags & OLQF_CLEAN)) {
747747 rec = OCFS2_SB(sb)->quota_rec;
748748 if (!rec) {
749749 rec = ocfs2_alloc_quota_recovery();
@@ -772,7 +772,7 @@ static int ocfs2_local_read_info(struct super_block *sb, int type) · 22 unmodified lines
772772 }
773773
774774 /* Now mark quota file as used */
775− info->dqi_flags &= ~OLQF_CLEAN;
775+ oinfo->dqi_flags &= ~OLQF_CLEAN;
776776 status = ocfs2_modify_bh(lqinode, bh, olq_update_info, info);
777777 if (status < 0) {
778778 mlog_errno(status);
@@ -857,7 +857,7 @@ static int ocfs2_local_free_info(struct super_block *sb, int type) · 78 unmodified lines
857857 goto out;
858858
859859 /* Mark local file as clean */
860− info->dqi_flags |= OLQF_CLEAN;
860+ oinfo->dqi_flags |= OLQF_CLEAN;
861861 status = ocfs2_modify_bh(sb_dqopt(sb)->files[type],
862862 oinfo->dqi_libh,
863863 olq_update_info,
fs/ocfs2/super.c+1−31
@@ -1000,36 +1000,6 @@ static void ocfs2_disable_quotas(struct ocfs2_super *osb) · 999 unmodified lines
10001000 }
10011001 }
10021002
1003−/* Handle quota on quotactl */
1004−static int ocfs2_quota_on(struct super_block *sb, int type, int format_id)
1005−{
1006− unsigned int feature[OCFS2_MAXQUOTAS] = {
1007− OCFS2_FEATURE_RO_COMPAT_USRQUOTA,
1008− OCFS2_FEATURE_RO_COMPAT_GRPQUOTA};
1009−
1010− if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type]))
1011− return -EINVAL;
1012−
1013− return dquot_enable(sb_dqopt(sb)->files[type], type,
1014− format_id, DQUOT_LIMITS_ENABLED);
1015−}
1016−
1017−/* Handle quota off quotactl */
1018−static int ocfs2_quota_off(struct super_block *sb, int type)
1019−{
1020− return dquot_disable(sb, type, DQUOT_LIMITS_ENABLED);
1021−}
1022−
1023−static const struct quotactl_ops ocfs2_quotactl_ops = {
1024− .quota_on_meta = ocfs2_quota_on,
1025− .quota_off = ocfs2_quota_off,
1026− .quota_sync = dquot_quota_sync,
1027− .get_info = dquot_get_dqinfo,
1028− .set_info = dquot_set_dqinfo,
1029− .get_dqblk = dquot_get_dqblk,
1030− .set_dqblk = dquot_set_dqblk,
1031−};
1032−
10331003 static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
10341004 {
10351005 struct dentry *root;
@@ -2079,7 +2049,7 @@ static int ocfs2_initialize_super(struct super_block *sb, · 1043 unmodified lines
20792049 sb->s_op = &ocfs2_sops;
20802050 sb->s_d_op = &ocfs2_dentry_ops;
20812051 sb->s_export_op = &ocfs2_export_ops;
2082− sb->s_qcop = &ocfs2_quotactl_ops;
2052+ sb->s_qcop = &dquot_quotactl_sysfile_ops;
20832053 sb->dq_op = &ocfs2_quota_operations;
20842054 sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP;
20852055 sb->s_xattr = ocfs2_xattr_handlers;
fs/quota/dquot.c+98−9
@@ -1248,7 +1248,7 @@ static int ignore_hardlimit(struct dquot *dquot) · 1247 unmodified lines
12481248
12491249 return capable(CAP_SYS_RESOURCE) &&
12501250 (info->dqi_format->qf_fmt_id != QFMT_VFS_OLD ||
1251− !(info->dqi_flags & V1_DQF_RSQUASH));
1251+ !(info->dqi_flags & DQF_ROOT_SQUASH));
12521252 }
12531253
12541254 /* needs dq_data_lock */
@@ -2385,14 +2385,84 @@ out: · 1130 unmodified lines
23852385 }
23862386 EXPORT_SYMBOL(dquot_quota_on_mount);
23872387
2388−static inline qsize_t qbtos(qsize_t blocks)
2388+static int dquot_quota_enable(struct super_block *sb, unsigned int flags)
23892389 {
2390− return blocks << QIF_DQBLKSIZE_BITS;
2390+ int ret;
2391+ int type;
2392+ struct quota_info *dqopt = sb_dqopt(sb);
2393+
2394+ if (!(dqopt->flags & DQUOT_QUOTA_SYS_FILE))
2395+ return -ENOSYS;
2396+ /* Accounting cannot be turned on while fs is mounted */
2397+ flags &= ~(FS_QUOTA_UDQ_ACCT | FS_QUOTA_GDQ_ACCT | FS_QUOTA_PDQ_ACCT);
2398+ if (!flags)
2399+ return -EINVAL;
2400+ for (type = 0; type < MAXQUOTAS; type++) {
2401+ if (!(flags & qtype_enforce_flag(type)))
2402+ continue;
2403+ /* Can't enforce without accounting */
2404+ if (!sb_has_quota_usage_enabled(sb, type))
2405+ return -EINVAL;
2406+ ret = dquot_enable(dqopt->files[type], type,
2407+ dqopt->info[type].dqi_fmt_id,
2408+ DQUOT_LIMITS_ENABLED);
2409+ if (ret < 0)
2410+ goto out_err;
2411+ }
2412+ return 0;
2413+out_err:
2414+ /* Backout enforcement enablement we already did */
2415+ for (type--; type >= 0; type--) {
2416+ if (flags & qtype_enforce_flag(type))
2417+ dquot_disable(sb, type, DQUOT_LIMITS_ENABLED);
2418+ }
2419+ /* Error code translation for better compatibility with XFS */
2420+ if (ret == -EBUSY)
2421+ ret = -EEXIST;
2422+ return ret;
23912423 }
23922424
2393−static inline qsize_t stoqb(qsize_t space)
2425+static int dquot_quota_disable(struct super_block *sb, unsigned int flags)
23942426 {
2395− return (space + QIF_DQBLKSIZE - 1) >> QIF_DQBLKSIZE_BITS;
2427+ int ret;
2428+ int type;
2429+ struct quota_info *dqopt = sb_dqopt(sb);
2430+
2431+ if (!(dqopt->flags & DQUOT_QUOTA_SYS_FILE))
2432+ return -ENOSYS;
2433+ /*
2434+ * We don't support turning off accounting via quotactl. In principle
2435+ * quota infrastructure can do this but filesystems don't expect
2436+ * userspace to be able to do it.
2437+ */
2438+ if (flags &
2439+ (FS_QUOTA_UDQ_ACCT | FS_QUOTA_GDQ_ACCT | FS_QUOTA_PDQ_ACCT))
2440+ return -EOPNOTSUPP;
2441+
2442+ /* Filter out limits not enabled */
2443+ for (type = 0; type < MAXQUOTAS; type++)
2444+ if (!sb_has_quota_limits_enabled(sb, type))
2445+ flags &= ~qtype_enforce_flag(type);
2446+ /* Nothing left? */
2447+ if (!flags)
2448+ return -EEXIST;
2449+ for (type = 0; type < MAXQUOTAS; type++) {
2450+ if (flags & qtype_enforce_flag(type)) {
2451+ ret = dquot_disable(sb, type, DQUOT_LIMITS_ENABLED);
2452+ if (ret < 0)
2453+ goto out_err;
2454+ }
2455+ }
2456+ return 0;
2457+out_err:
2458+ /* Backout enforcement disabling we already did */
2459+ for (type--; type >= 0; type--) {
2460+ if (flags & qtype_enforce_flag(type))
2461+ dquot_enable(dqopt->files[type], type,
2462+ dqopt->info[type].dqi_fmt_id,
2463+ DQUOT_LIMITS_ENABLED);
2464+ }
2465+ return ret;
23962466 }
23972467
23982468 /* Generic routine for getting common part of quota structure */
@@ -2444,13 +2514,13 @@ static int do_set_dqblk(struct dquot *dquot, struct qc_dqblk *di) · 45 unmodified lines
24442514 return -EINVAL;
24452515
24462516 if (((di->d_fieldmask & QC_SPC_SOFT) &&
2447− stoqb(di->d_spc_softlimit) > dqi->dqi_maxblimit) ||
2517+ di->d_spc_softlimit > dqi->dqi_max_spc_limit) ||
24482518 ((di->d_fieldmask & QC_SPC_HARD) &&
2449− stoqb(di->d_spc_hardlimit) > dqi->dqi_maxblimit) ||
2519+ di->d_spc_hardlimit > dqi->dqi_max_spc_limit) ||
24502520 ((di->d_fieldmask & QC_INO_SOFT) &&
2451− (di->d_ino_softlimit > dqi->dqi_maxilimit)) ||
2521+ (di->d_ino_softlimit > dqi->dqi_max_ino_limit)) ||
24522522 ((di->d_fieldmask & QC_INO_HARD) &&
2453− (di->d_ino_hardlimit > dqi->dqi_maxilimit)))
2523+ (di->d_ino_hardlimit > dqi->dqi_max_ino_limit)))
24542524 return -ERANGE;
24552525
24562526 spin_lock(&dq_data_lock);
@@ -2577,6 +2647,14 @@ int dquot_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii) · 120 unmodified lines
25772647 goto out;
25782648 }
25792649 mi = sb_dqopt(sb)->info + type;
2650+ if (ii->dqi_valid & IIF_FLAGS) {
2651+ if (ii->dqi_flags & ~DQF_SETINFO_MASK ||
2652+ (ii->dqi_flags & DQF_ROOT_SQUASH &&
2653+ mi->dqi_format->qf_fmt_id != QFMT_VFS_OLD)) {
2654+ err = -EINVAL;
2655+ goto out;
2656+ }
2657+ }
25802658 spin_lock(&dq_data_lock);
25812659 if (ii->dqi_valid & IIF_BGRACE)
25822660 mi->dqi_bgrace = ii->dqi_bgrace;
@@ -2606,6 +2684,17 @@ const struct quotactl_ops dquot_quotactl_ops = { · 23 unmodified lines
26062684 };
26072685 EXPORT_SYMBOL(dquot_quotactl_ops);
26082686
2687+const struct quotactl_ops dquot_quotactl_sysfile_ops = {
2688+ .quota_enable = dquot_quota_enable,
2689+ .quota_disable = dquot_quota_disable,
2690+ .quota_sync = dquot_quota_sync,
2691+ .get_info = dquot_get_dqinfo,
2692+ .set_info = dquot_set_dqinfo,
2693+ .get_dqblk = dquot_get_dqblk,
2694+ .set_dqblk = dquot_set_dqblk
2695+};
2696+EXPORT_SYMBOL(dquot_quotactl_sysfile_ops);
2697+
26092698 static int do_proc_dqstats(struct ctl_table *table, int write,
26102699 void __user *buffer, size_t *lenp, loff_t *ppos)
26112700 {
fs/quota/quota.c+42−10
@@ -66,18 +66,40 @@ static int quota_sync_all(int type) · 65 unmodified lines
6666 return ret;
6767 }
6868
69+unsigned int qtype_enforce_flag(int type)
70+{
71+ switch (type) {
72+ case USRQUOTA:
73+ return FS_QUOTA_UDQ_ENFD;
74+ case GRPQUOTA:
75+ return FS_QUOTA_GDQ_ENFD;
76+ case PRJQUOTA:
77+ return FS_QUOTA_PDQ_ENFD;
78+ }
79+ return 0;
80+}
81+
6982 static int quota_quotaon(struct super_block *sb, int type, int cmd, qid_t id,
7083 struct path *path)
7184 {
72− if (!sb->s_qcop->quota_on && !sb->s_qcop->quota_on_meta)
85+ if (!sb->s_qcop->quota_on && !sb->s_qcop->quota_enable)
7386 return -ENOSYS;
74− if (sb->s_qcop->quota_on_meta)
75− return sb->s_qcop->quota_on_meta(sb, type, id);
87+ if (sb->s_qcop->quota_enable)
88+ return sb->s_qcop->quota_enable(sb, qtype_enforce_flag(type));
7689 if (IS_ERR(path))
7790 return PTR_ERR(path);
7891 return sb->s_qcop->quota_on(sb, type, id, path);
7992 }
8093
94+static int quota_quotaoff(struct super_block *sb, int type)
95+{
96+ if (!sb->s_qcop->quota_off && !sb->s_qcop->quota_disable)
97+ return -ENOSYS;
98+ if (sb->s_qcop->quota_disable)
99+ return sb->s_qcop->quota_disable(sb, qtype_enforce_flag(type));
100+ return sb->s_qcop->quota_off(sb, type);
101+}
102+
81103 static int quota_getfmt(struct super_block *sb, int type, void __user *addr)
82104 {
83105 __u32 fmt;
@@ -208,15 +230,26 @@ static int quota_setquota(struct super_block *sb, int type, qid_t id, · 124 unmodified lines
208230 return sb->s_qcop->set_dqblk(sb, qid, &fdq);
209231 }
210232
211−static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr)
233+static int quota_enable(struct super_block *sb, void __user *addr)
212234 {
213235 __u32 flags;
214236
215237 if (copy_from_user(&flags, addr, sizeof(flags)))
216238 return -EFAULT;
217− if (!sb->s_qcop->set_xstate)
239+ if (!sb->s_qcop->quota_enable)
218240 return -ENOSYS;
219− return sb->s_qcop->set_xstate(sb, flags, cmd);
241+ return sb->s_qcop->quota_enable(sb, flags);
242+}
243+
244+static int quota_disable(struct super_block *sb, void __user *addr)
245+{
246+ __u32 flags;
247+
248+ if (copy_from_user(&flags, addr, sizeof(flags)))
249+ return -EFAULT;
250+ if (!sb->s_qcop->quota_disable)
251+ return -ENOSYS;
252+ return sb->s_qcop->quota_disable(sb, flags);
220253 }
221254
222255 static int quota_getxstate(struct super_block *sb, void __user *addr)
@@ -429,9 +462,7 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id, · 206 unmodified lines
429462 case Q_QUOTAON:
430463 return quota_quotaon(sb, type, cmd, id, path);
431464 case Q_QUOTAOFF:
432− if (!sb->s_qcop->quota_off)
433− return -ENOSYS;
434− return sb->s_qcop->quota_off(sb, type);
465+ return quota_quotaoff(sb, type);
435466 case Q_GETFMT:
436467 return quota_getfmt(sb, type, addr);
437468 case Q_GETINFO:
@@ -447,8 +478,9 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id, · 9 unmodified lines
447478 return -ENOSYS;
448479 return sb->s_qcop->quota_sync(sb, type);
449480 case Q_XQUOTAON:
481+ return quota_enable(sb, addr);
450482 case Q_XQUOTAOFF:
451− return quota_setxstate(sb, cmd, addr);
483+ return quota_disable(sb, addr);
452484 case Q_XQUOTARM:
453485 return quota_rmxquota(sb, addr);
454486 case Q_XGETQSTAT:
fs/quota/quota_v1.c+2−2
@@ -169,8 +169,8 @@ static int v1_read_file_info(struct super_block *sb, int type) · 168 unmodified lines
169169 }
170170 ret = 0;
171171 /* limits are stored as unsigned 32-bit data */
172− dqopt->info[type].dqi_maxblimit = 0xffffffff;
173− dqopt->info[type].dqi_maxilimit = 0xffffffff;
172+ dqopt->info[type].dqi_max_spc_limit = 0xffffffffULL << QUOTABLOCK_BITS;
173+ dqopt->info[type].dqi_max_ino_limit = 0xffffffff;
174174 dqopt->info[type].dqi_igrace =
175175 dqblk.dqb_itime ? dqblk.dqb_itime : MAX_IQ_TIME;
176176 dqopt->info[type].dqi_bgrace =
fs/quota/quota_v2.c+9−7
@@ -117,16 +117,17 @@ static int v2_read_file_info(struct super_block *sb, int type) · 116 unmodified lines
117117 qinfo = info->dqi_priv;
118118 if (version == 0) {
119119 /* limits are stored as unsigned 32-bit data */
120− info->dqi_maxblimit = 0xffffffff;
121− info->dqi_maxilimit = 0xffffffff;
120+ info->dqi_max_spc_limit = 0xffffffffULL << QUOTABLOCK_BITS;
121+ info->dqi_max_ino_limit = 0xffffffff;
122122 } else {
123− /* used space is stored as unsigned 64-bit value */
124− info->dqi_maxblimit = 0xffffffffffffffffULL; /* 2^64-1 */
125− info->dqi_maxilimit = 0xffffffffffffffffULL;
123+ /* used space is stored as unsigned 64-bit value in bytes */
124+ info->dqi_max_spc_limit = 0xffffffffffffffffULL; /* 2^64-1 */
125+ info->dqi_max_ino_limit = 0xffffffffffffffffULL;
126126 }
127127 info->dqi_bgrace = le32_to_cpu(dinfo.dqi_bgrace);
128128 info->dqi_igrace = le32_to_cpu(dinfo.dqi_igrace);
129− info->dqi_flags = le32_to_cpu(dinfo.dqi_flags);
129+ /* No flags currently supported */
130+ info->dqi_flags = 0;
130131 qinfo->dqi_sb = sb;
131132 qinfo->dqi_type = type;
132133 qinfo->dqi_blocks = le32_to_cpu(dinfo.dqi_blocks);
@@ -157,7 +158,8 @@ static int v2_write_file_info(struct super_block *sb, int type) · 24 unmodified lines
157158 info->dqi_flags &= ~DQF_INFO_DIRTY;
158159 dinfo.dqi_bgrace = cpu_to_le32(info->dqi_bgrace);
159160 dinfo.dqi_igrace = cpu_to_le32(info->dqi_igrace);
160− dinfo.dqi_flags = cpu_to_le32(info->dqi_flags & DQF_MASK);
161+ /* No flags currently supported */
162+ dinfo.dqi_flags = cpu_to_le32(0);
161163 spin_unlock(&dq_data_lock);
162164 dinfo.dqi_blocks = cpu_to_le32(qinfo->dqi_blocks);
163165 dinfo.dqi_free_blk = cpu_to_le32(qinfo->dqi_free_blk);
fs/udf/Kconfig+6−4
@@ -2,10 +2,12 @@ config UDF_FS · 1 unmodified line
22 tristate "UDF file system support"
33 select CRC_ITU_T
44 help
5− This is the new file system used on some CD-ROMs and DVDs. Say Y if
6− you intend to mount DVD discs or CDRW's written in packet mode, or
7− if written to by other UDF utilities, such as DirectCD.
8− Please read <file:Documentation/filesystems/udf.txt>.
5+ This is a file system used on some CD-ROMs and DVDs. Since the
6+ file system is supported by multiple operating systems and is more
7+ compatible with standard unix file systems, it is also suitable for
8+ removable USB disks. Say Y if you intend to mount DVD discs or CDRW's
9+ written in packet mode, or if you want to use UDF for removable USB
10+ disks. Please read <file:Documentation/filesystems/udf.txt>.
911
1012 To compile this file system support as a module, choose M here: the
1113 module will be called udf.
fs/udf/inode.c+19−13
@@ -750,7 +750,7 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, · 749 unmodified lines
750750 /* Are we beyond EOF? */
751751 if (etype == -1) {
752752 int ret;
753− isBeyondEOF = 1;
753+ isBeyondEOF = true;
754754 if (count) {
755755 if (c)
756756 laarr[0] = laarr[1];
@@ -792,7 +792,7 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, · 35 unmodified lines
792792 endnum = c + 1;
793793 lastblock = 1;
794794 } else {
795− isBeyondEOF = 0;
795+ isBeyondEOF = false;
796796 endnum = startnum = ((count > 2) ? 2 : count);
797797
798798 /* if the current extent is in position 0,
@@ -1288,6 +1288,7 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode) · 489 unmodified lines
12881288 struct kernel_lb_addr *iloc = &iinfo->i_location;
12891289 unsigned int link_count;
12901290 unsigned int indirections = 0;
1291+ int bs = inode->i_sb->s_blocksize;
12911292 int ret = -EIO;
12921293
12931294 reread:
@@ -1374,38 +1375,35 @@ reread: · 80 unmodified lines
13741375 if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_EFE)) {
13751376 iinfo->i_efe = 1;
13761377 iinfo->i_use = 0;
1377− ret = udf_alloc_i_data(inode, inode->i_sb->s_blocksize -
1378+ ret = udf_alloc_i_data(inode, bs -
13781379 sizeof(struct extendedFileEntry));
13791380 if (ret)
13801381 goto out;
13811382 memcpy(iinfo->i_ext.i_data,
13821383 bh->b_data + sizeof(struct extendedFileEntry),
1383− inode->i_sb->s_blocksize -
1384− sizeof(struct extendedFileEntry));
1384+ bs - sizeof(struct extendedFileEntry));
13851385 } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_FE)) {
13861386 iinfo->i_efe = 0;
13871387 iinfo->i_use = 0;
1388− ret = udf_alloc_i_data(inode, inode->i_sb->s_blocksize -
1389− sizeof(struct fileEntry));
1388+ ret = udf_alloc_i_data(inode, bs - sizeof(struct fileEntry));
13901389 if (ret)
13911390 goto out;
13921391 memcpy(iinfo->i_ext.i_data,
13931392 bh->b_data + sizeof(struct fileEntry),
1394− inode->i_sb->s_blocksize - sizeof(struct fileEntry));
1393+ bs - sizeof(struct fileEntry));
13951394 } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_USE)) {
13961395 iinfo->i_efe = 0;
13971396 iinfo->i_use = 1;
13981397 iinfo->i_lenAlloc = le32_to_cpu(
13991398 ((struct unallocSpaceEntry *)bh->b_data)->
14001399 lengthAllocDescs);
1401− ret = udf_alloc_i_data(inode, inode->i_sb->s_blocksize -
1400+ ret = udf_alloc_i_data(inode, bs -
14021401 sizeof(struct unallocSpaceEntry));
14031402 if (ret)
14041403 goto out;
14051404 memcpy(iinfo->i_ext.i_data,
14061405 bh->b_data + sizeof(struct unallocSpaceEntry),
1407− inode->i_sb->s_blocksize -
1408− sizeof(struct unallocSpaceEntry));
1406+ bs - sizeof(struct unallocSpaceEntry));
14091407 return 0;
14101408 }
14111409
@@ -1489,6 +1487,15 @@ reread: · 77 unmodified lines
14891487 }
14901488 inode->i_generation = iinfo->i_unique;
14911489
1490+ /*
1491+ * Sanity check length of allocation descriptors and extended attrs to
1492+ * avoid integer overflows
1493+ */
1494+ if (iinfo->i_lenEAttr > bs || iinfo->i_lenAlloc > bs)
1495+ goto out;
1496+ /* Now do exact checks */
1497+ if (udf_file_entry_alloc_offset(inode) + iinfo->i_lenAlloc > bs)
1498+ goto out;
14921499 /* Sanity checks for files in ICB so that we don't get confused later */
14931500 if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
14941501 /*
@@ -1498,8 +1505,7 @@ reread: · 3 unmodified lines
14981505 if (iinfo->i_lenAlloc != inode->i_size)
14991506 goto out;
15001507 /* File in ICB has to fit in there... */
1501− if (inode->i_size > inode->i_sb->s_blocksize -
1502− udf_file_entry_alloc_offset(inode))
1508+ if (inode->i_size > bs - udf_file_entry_alloc_offset(inode))
15031509 goto out;
15041510 }
15051511
fs/udf/super.c+3−2
@@ -1599,7 +1599,7 @@ static noinline int udf_process_sequence( · 1598 unmodified lines
15991599 struct udf_vds_record *curr;
16001600 struct generic_desc *gd;
16011601 struct volDescPtr *vdp;
1602− int done = 0;
1602+ bool done = false;
16031603 uint32_t vdsn;
16041604 uint16_t ident;
16051605 long next_s = 0, next_e = 0;
@@ -1680,7 +1680,7 @@ static noinline int udf_process_sequence( · 74 unmodified lines
16801680 lastblock = next_e;
16811681 next_s = next_e = 0;
16821682 } else
1683− done = 1;
1683+ done = true;
16841684 break;
16851685 }
16861686 brelse(bh);
@@ -2300,6 +2300,7 @@ static void udf_put_super(struct super_block *sb) · 613 unmodified lines
23002300 udf_close_lvid(sb);
23012301 brelse(sbi->s_lvid_bh);
23022302 udf_sb_free_partitions(sb);
2303+ mutex_destroy(&sbi->s_alloc_mutex);
23032304 kfree(sb->s_fs_info);
23042305 sb->s_fs_info = NULL;
23052306 }
fs/xfs/xfs_qm_syscalls.c+24−50
@@ -329,22 +329,16 @@ xfs_qm_scall_quotaon( · 328 unmodified lines
329329 return -EINVAL;
330330 }
331331
332− /* No fs can turn on quotas with a delayed effect */
333− ASSERT((flags & XFS_ALL_QUOTA_ACCT) == 0);
334−
335332 /*
336333 * Can't enforce without accounting. We check the superblock
337334 * qflags here instead of m_qflags because rootfs can have
338335 * quota acct on ondisk without m_qflags' knowing.
339336 */
340− if (((flags & XFS_UQUOTA_ACCT) == 0 &&
341− (mp->m_sb.sb_qflags & XFS_UQUOTA_ACCT) == 0 &&
337+ if (((mp->m_sb.sb_qflags & XFS_UQUOTA_ACCT) == 0 &&
342338 (flags & XFS_UQUOTA_ENFD)) ||
343− ((flags & XFS_GQUOTA_ACCT) == 0 &&
344− (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) == 0 &&
339+ ((mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) == 0 &&
345340 (flags & XFS_GQUOTA_ENFD)) ||
346− ((flags & XFS_PQUOTA_ACCT) == 0 &&
347− (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) == 0 &&
341+ ((mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) == 0 &&
348342 (flags & XFS_PQUOTA_ENFD))) {
349343 xfs_debug(mp,
350344 "%s: Can't enforce without acct, flags=%x sbflags=%x",
@@ -383,8 +377,7 @@ xfs_qm_scall_quotaon( · 32 unmodified lines
383377 ((mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) !=
384378 (mp->m_qflags & XFS_PQUOTA_ACCT)) ||
385379 ((mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) !=
386− (mp->m_qflags & XFS_GQUOTA_ACCT)) ||
387− (flags & XFS_ALL_QUOTA_ENFD) == 0)
380+ (mp->m_qflags & XFS_GQUOTA_ACCT)))
388381 return 0;
389382
390383 if (! XFS_IS_QUOTA_RUNNING(mp))
@@ -421,20 +414,12 @@ xfs_qm_scall_getqstat( · 30 unmodified lines
421414 memset(out, 0, sizeof(fs_quota_stat_t));
422415
423416 out->qs_version = FS_QSTAT_VERSION;
424− if (!xfs_sb_version_hasquota(&mp->m_sb)) {
425− out->qs_uquota.qfs_ino = NULLFSINO;
426− out->qs_gquota.qfs_ino = NULLFSINO;
427− return 0;
428− }
429−
430417 out->qs_flags = (__uint16_t) xfs_qm_export_flags(mp->m_qflags &
431418 (XFS_ALL_QUOTA_ACCT|
432419 XFS_ALL_QUOTA_ENFD));
433− if (q) {
434− uip = q->qi_uquotaip;
435− gip = q->qi_gquotaip;
436− pip = q->qi_pquotaip;
437− }
420+ uip = q->qi_uquotaip;
421+ gip = q->qi_gquotaip;
422+ pip = q->qi_pquotaip;
438423 if (!uip && mp->m_sb.sb_uquotino != NULLFSINO) {
439424 if (xfs_iget(mp, NULL, mp->m_sb.sb_uquotino,
440425 0, 0, &uip) == 0)
@@ -480,14 +465,13 @@ xfs_qm_scall_getqstat( · 39 unmodified lines
480465 if (temppqip)
481466 IRELE(pip);
482467 }
483− if (q) {
484− out->qs_incoredqs = q->qi_dquots;
485− out->qs_btimelimit = q->qi_btimelimit;
486− out->qs_itimelimit = q->qi_itimelimit;
487− out->qs_rtbtimelimit = q->qi_rtbtimelimit;
488− out->qs_bwarnlimit = q->qi_bwarnlimit;
489− out->qs_iwarnlimit = q->qi_iwarnlimit;
490− }
468+ out->qs_incoredqs = q->qi_dquots;
469+ out->qs_btimelimit = q->qi_btimelimit;
470+ out->qs_itimelimit = q->qi_itimelimit;
471+ out->qs_rtbtimelimit = q->qi_rtbtimelimit;
472+ out->qs_bwarnlimit = q->qi_bwarnlimit;
473+ out->qs_iwarnlimit = q->qi_iwarnlimit;
474+
491475 return 0;
492476 }
493477
@@ -508,13 +492,6 @@ xfs_qm_scall_getqstatv( · 14 unmodified lines
508492 bool tempgqip = false;
509493 bool temppqip = false;
510494
511− if (!xfs_sb_version_hasquota(&mp->m_sb)) {
512− out->qs_uquota.qfs_ino = NULLFSINO;
513− out->qs_gquota.qfs_ino = NULLFSINO;
514− out->qs_pquota.qfs_ino = NULLFSINO;
515− return 0;
516− }
517−
518495 out->qs_flags = (__uint16_t) xfs_qm_export_flags(mp->m_qflags &
519496 (XFS_ALL_QUOTA_ACCT|
520497 XFS_ALL_QUOTA_ENFD));
@@ -522,11 +499,9 @@ xfs_qm_scall_getqstatv( · 1 unmodified line
522499 out->qs_gquota.qfs_ino = mp->m_sb.sb_gquotino;
523500 out->qs_pquota.qfs_ino = mp->m_sb.sb_pquotino;
524501
525− if (q) {
526− uip = q->qi_uquotaip;
527− gip = q->qi_gquotaip;
528− pip = q->qi_pquotaip;
529− }
502+ uip = q->qi_uquotaip;
503+ gip = q->qi_gquotaip;
504+ pip = q->qi_pquotaip;
530505 if (!uip && mp->m_sb.sb_uquotino != NULLFSINO) {
531506 if (xfs_iget(mp, NULL, mp->m_sb.sb_uquotino,
532507 0, 0, &uip) == 0)
@@ -561,14 +536,13 @@ xfs_qm_scall_getqstatv( · 28 unmodified lines
561536 if (temppqip)
562537 IRELE(pip);
563538 }
564− if (q) {
565− out->qs_incoredqs = q->qi_dquots;
566− out->qs_btimelimit = q->qi_btimelimit;
567− out->qs_itimelimit = q->qi_itimelimit;
568− out->qs_rtbtimelimit = q->qi_rtbtimelimit;
569− out->qs_bwarnlimit = q->qi_bwarnlimit;
570− out->qs_iwarnlimit = q->qi_iwarnlimit;
571− }
539+ out->qs_incoredqs = q->qi_dquots;
540+ out->qs_btimelimit = q->qi_btimelimit;
541+ out->qs_itimelimit = q->qi_itimelimit;
542+ out->qs_rtbtimelimit = q->qi_rtbtimelimit;
543+ out->qs_bwarnlimit = q->qi_bwarnlimit;
544+ out->qs_iwarnlimit = q->qi_iwarnlimit;
545+
572546 return 0;
573547 }
574548
fs/xfs/xfs_quotaops.c+37−22
@@ -64,19 +64,10 @@ xfs_fs_get_xstatev( · 63 unmodified lines
6464 return xfs_qm_scall_getqstatv(mp, fqs);
6565 }
6666
67−STATIC int
68−xfs_fs_set_xstate(
69− struct super_block *sb,
70− unsigned int uflags,
71− int op)
67+static unsigned int
68+xfs_quota_flags(unsigned int uflags)
7269 {
73− struct xfs_mount *mp = XFS_M(sb);
74− unsigned int flags = 0;
75−
76− if (sb->s_flags & MS_RDONLY)
77− return -EROFS;
78− if (op != Q_XQUOTARM && !XFS_IS_QUOTA_RUNNING(mp))
79− return -ENOSYS;
70+ unsigned int flags = 0;
8071
8172 if (uflags & FS_QUOTA_UDQ_ACCT)
8273 flags |= XFS_UQUOTA_ACCT;
@@ -91,16 +82,39 @@ xfs_fs_set_xstate( · 8 unmodified lines
9182 if (uflags & FS_QUOTA_PDQ_ENFD)
9283 flags |= XFS_PQUOTA_ENFD;
9384
94− switch (op) {
95− case Q_XQUOTAON:
96− return xfs_qm_scall_quotaon(mp, flags);
97− case Q_XQUOTAOFF:
98− if (!XFS_IS_QUOTA_ON(mp))
99− return -EINVAL;
100− return xfs_qm_scall_quotaoff(mp, flags);
101− }
85+ return flags;
86+}
87+
88+STATIC int
89+xfs_quota_enable(
90+ struct super_block *sb,
91+ unsigned int uflags)
92+{
93+ struct xfs_mount *mp = XFS_M(sb);
94+
95+ if (sb->s_flags & MS_RDONLY)
96+ return -EROFS;
97+ if (!XFS_IS_QUOTA_RUNNING(mp))
98+ return -ENOSYS;
99+
100+ return xfs_qm_scall_quotaon(mp, xfs_quota_flags(uflags));
101+}
102+
103+STATIC int
104+xfs_quota_disable(
105+ struct super_block *sb,
106+ unsigned int uflags)
107+{
108+ struct xfs_mount *mp = XFS_M(sb);
109+
110+ if (sb->s_flags & MS_RDONLY)
111+ return -EROFS;
112+ if (!XFS_IS_QUOTA_RUNNING(mp))
113+ return -ENOSYS;
114+ if (!XFS_IS_QUOTA_ON(mp))
115+ return -EINVAL;
102116
103− return -EINVAL;
117+ return xfs_qm_scall_quotaoff(mp, xfs_quota_flags(uflags));
104118 }
105119
106120 STATIC int
@@ -166,7 +180,8 @@ xfs_fs_set_dqblk( · 59 unmodified lines
166180 const struct quotactl_ops xfs_quotactl_operations = {
167181 .get_xstatev = xfs_fs_get_xstatev,
168182 .get_xstate = xfs_fs_get_xstate,
169− .set_xstate = xfs_fs_set_xstate,
183+ .quota_enable = xfs_quota_enable,
184+ .quota_disable = xfs_quota_disable,
170185 .rm_xquota = xfs_fs_rm_xquota,
171186 .get_dqblk = xfs_fs_get_dqblk,
172187 .set_dqblk = xfs_fs_set_dqblk,
include/linux/dqblk_v1.h+0−3
@@ -5,9 +5,6 @@ · 4 unmodified lines
55 #ifndef _LINUX_DQBLK_V1_H
66 #define _LINUX_DQBLK_V1_H
77
8−/* Root squash turned on */
9−#define V1_DQF_RSQUASH 1
10−
118 /* Numbers of blocks needed for updates */
129 #define V1_INIT_ALLOC 1
1310 #define V1_INIT_REWRITE 1
include/linux/jbd.h+0−9
@@ -956,15 +956,6 @@ void __log_wait_for_space(journal_t *journal); · 955 unmodified lines
956956 extern void __journal_drop_transaction(journal_t *, transaction_t *);
957957 extern int cleanup_journal_tail(journal_t *);
958958
959−/* Debugging code only: */
960−
961−#define jbd_ENOSYS() \
962−do { \
963− printk (KERN_ERR "JBD unimplemented function %s\n", __func__); \
964− current->state = TASK_UNINTERRUPTIBLE; \
965− schedule(); \
966−} while (1)
967−
968959 /*
969960 * is_journal_abort
970961 *
include/linux/jbd2.h+0−9
@@ -1251,15 +1251,6 @@ void __jbd2_log_wait_for_space(journal_t *journal); · 1250 unmodified lines
12511251 extern void __jbd2_journal_drop_transaction(journal_t *, transaction_t *);
12521252 extern int jbd2_cleanup_journal_tail(journal_t *);
12531253
1254−/* Debugging code only: */
1255−
1256−#define jbd_ENOSYS() \
1257−do { \
1258− printk (KERN_ERR "JBD unimplemented function %s\n", __func__); \
1259− current->state = TASK_UNINTERRUPTIBLE; \
1260− schedule(); \
1261−} while (1)
1262−
12631254 /*
12641255 * is_journal_abort
12651256 *
include/linux/quota.h+12−10
@@ -216,19 +216,21 @@ struct mem_dqinfo { · 215 unmodified lines
216216 unsigned long dqi_flags;
217217 unsigned int dqi_bgrace;
218218 unsigned int dqi_igrace;
219− qsize_t dqi_maxblimit;
220− qsize_t dqi_maxilimit;
219+ qsize_t dqi_max_spc_limit;
220+ qsize_t dqi_max_ino_limit;
221221 void *dqi_priv;
222222 };
223223
224224 struct super_block;
225225
226−#define DQF_MASK 0xffff /* Mask for format specific flags */
227−#define DQF_GETINFO_MASK 0x1ffff /* Mask for flags passed to userspace */
228−#define DQF_SETINFO_MASK 0xffff /* Mask for flags modifiable from userspace */
229−#define DQF_SYS_FILE_B 16
230−#define DQF_SYS_FILE (1 << DQF_SYS_FILE_B) /* Quota file stored as system file */
231−#define DQF_INFO_DIRTY_B 31
226+/* Mask for flags passed to userspace */
227+#define DQF_GETINFO_MASK (DQF_ROOT_SQUASH | DQF_SYS_FILE)
228+/* Mask for flags modifiable from userspace */
229+#define DQF_SETINFO_MASK DQF_ROOT_SQUASH
230+
231+enum {
232+ DQF_INFO_DIRTY_B = DQF_PRIVATE,
233+};
232234 #define DQF_INFO_DIRTY (1 << DQF_INFO_DIRTY_B) /* Is info dirty? */
233235
234236 extern void mark_info_dirty(struct super_block *sb, int type);
@@ -367,15 +369,15 @@ struct qc_dqblk { · 132 unmodified lines
367369 /* Operations handling requests from userspace */
368370 struct quotactl_ops {
369371 int (*quota_on)(struct super_block *, int, int, struct path *);
370− int (*quota_on_meta)(struct super_block *, int, int);
371372 int (*quota_off)(struct super_block *, int);
373+ int (*quota_enable)(struct super_block *, unsigned int);
374+ int (*quota_disable)(struct super_block *, unsigned int);
372375 int (*quota_sync)(struct super_block *, int);
373376 int (*get_info)(struct super_block *, int, struct if_dqinfo *);
374377 int (*set_info)(struct super_block *, int, struct if_dqinfo *);
375378 int (*get_dqblk)(struct super_block *, struct kqid, struct qc_dqblk *);
376379 int (*set_dqblk)(struct super_block *, struct kqid, struct qc_dqblk *);
377380 int (*get_xstate)(struct super_block *, struct fs_quota_stat *);
378− int (*set_xstate)(struct super_block *, unsigned int, int);
379381 int (*get_xstatev)(struct super_block *, struct fs_quota_statv *);
380382 int (*rm_xquota)(struct super_block *, unsigned int);
381383 };
include/linux/quotaops.h+3−0
@@ -166,6 +166,7 @@ static inline bool sb_has_quota_active(struct super_block *sb, int type) · 165 unmodified lines
166166 */
167167 extern const struct dquot_operations dquot_operations;
168168 extern const struct quotactl_ops dquot_quotactl_ops;
169+extern const struct quotactl_ops dquot_quotactl_sysfile_ops;
169170
170171 #else
171172
@@ -386,4 +387,6 @@ static inline void dquot_release_reservation_block(struct inode *inode, · 214 unmodified lines
386387 __dquot_free_space(inode, nr << inode->i_blkbits, DQUOT_SPACE_RESERVE);
387388 }
388389
390+unsigned int qtype_enforce_flag(int type);
391+
389392 #endif /* _LINUX_QUOTAOPS_ */
include/uapi/linux/quota.h+13−1
@@ -126,10 +126,22 @@ struct if_dqblk { · 125 unmodified lines
126126 #define IIF_FLAGS 4
127127 #define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
128128
129+enum {
130+ DQF_ROOT_SQUASH_B = 0,
131+ DQF_SYS_FILE_B = 16,
132+ /* Kernel internal flags invisible to userspace */
133+ DQF_PRIVATE
134+};
135+
136+/* Root squash enabled (for v1 quota format) */
137+#define DQF_ROOT_SQUASH (1 << DQF_ROOT_SQUASH_B)
138+/* Quota stored in a system file */
139+#define DQF_SYS_FILE (1 << DQF_SYS_FILE_B)
140+
129141 struct if_dqinfo {
130142 __u64 dqi_bgrace;
131143 __u64 dqi_igrace;
132− __u32 dqi_flags;
144+ __u32 dqi_flags; /* DFQ_* */
133145 __u32 dqi_valid;
134146 };
135147