Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xfs: quota: move to time64_t interfaces

As a preparation for removing the 32-bit time_t type and
all associated interfaces, change xfs to use time64_t and
ktime_get_real_seconds() for the quota housekeeping.

This avoids one difference between 32-bit and 64-bit kernels,
raising the theoretical limit for the quota grace period
to year 2106 on 32-bit instead of year 2038.

Note that common user space tools using the XFS quotactl
interface instead of the generic one still use the y2038
dates.

To fix quotas properly, both the on-disk format and user
space still need to be changed.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

authored by

Arnd Bergmann and committed by
Darrick J. Wong
b8a0880a 3b62f000

+14 -12
+3 -3
fs/xfs/xfs_dquot.c
··· 137 137 (d->d_blk_hardlimit && 138 138 (be64_to_cpu(d->d_bcount) > 139 139 be64_to_cpu(d->d_blk_hardlimit)))) { 140 - d->d_btimer = cpu_to_be32(get_seconds() + 140 + d->d_btimer = cpu_to_be32(ktime_get_real_seconds() + 141 141 mp->m_quotainfo->qi_btimelimit); 142 142 } else { 143 143 d->d_bwarns = 0; ··· 160 160 (d->d_ino_hardlimit && 161 161 (be64_to_cpu(d->d_icount) > 162 162 be64_to_cpu(d->d_ino_hardlimit)))) { 163 - d->d_itimer = cpu_to_be32(get_seconds() + 163 + d->d_itimer = cpu_to_be32(ktime_get_real_seconds() + 164 164 mp->m_quotainfo->qi_itimelimit); 165 165 } else { 166 166 d->d_iwarns = 0; ··· 183 183 (d->d_rtb_hardlimit && 184 184 (be64_to_cpu(d->d_rtbcount) > 185 185 be64_to_cpu(d->d_rtb_hardlimit)))) { 186 - d->d_rtbtimer = cpu_to_be32(get_seconds() + 186 + d->d_rtbtimer = cpu_to_be32(ktime_get_real_seconds() + 187 187 mp->m_quotainfo->qi_rtbtimelimit); 188 188 } else { 189 189 d->d_rtbwarns = 0;
+3 -3
fs/xfs/xfs_qm.h
··· 64 64 struct xfs_inode *qi_pquotaip; /* project quota inode */ 65 65 struct list_lru qi_lru; 66 66 int qi_dquots; 67 - time_t qi_btimelimit; /* limit for blks timer */ 68 - time_t qi_itimelimit; /* limit for inodes timer */ 69 - time_t qi_rtbtimelimit;/* limit for rt blks timer */ 67 + time64_t qi_btimelimit; /* limit for blks timer */ 68 + time64_t qi_itimelimit; /* limit for inodes timer */ 69 + time64_t qi_rtbtimelimit;/* limit for rt blks timer */ 70 70 xfs_qwarncnt_t qi_bwarnlimit; /* limit for blks warnings */ 71 71 xfs_qwarncnt_t qi_iwarnlimit; /* limit for inodes warnings */ 72 72 xfs_qwarncnt_t qi_rtbwarnlimit;/* limit for rt blks warnings */
+3 -3
fs/xfs/xfs_quotaops.c
··· 37 37 tstate->flags |= QCI_SYSFILE; 38 38 tstate->blocks = ip->i_d.di_nblocks; 39 39 tstate->nextents = ip->i_d.di_nextents; 40 - tstate->spc_timelimit = q->qi_btimelimit; 41 - tstate->ino_timelimit = q->qi_itimelimit; 42 - tstate->rt_spc_timelimit = q->qi_rtbtimelimit; 40 + tstate->spc_timelimit = (u32)q->qi_btimelimit; 41 + tstate->ino_timelimit = (u32)q->qi_itimelimit; 42 + tstate->rt_spc_timelimit = (u32)q->qi_rtbtimelimit; 43 43 tstate->spc_warnlimit = q->qi_bwarnlimit; 44 44 tstate->ino_warnlimit = q->qi_iwarnlimit; 45 45 tstate->rt_spc_warnlimit = q->qi_rtbwarnlimit;
+5 -3
fs/xfs/xfs_trans_dquot.c
··· 580 580 { 581 581 xfs_qcnt_t hardlimit; 582 582 xfs_qcnt_t softlimit; 583 - time_t timer; 583 + time64_t timer; 584 584 xfs_qwarncnt_t warns; 585 585 xfs_qwarncnt_t warnlimit; 586 586 xfs_qcnt_t total_count; ··· 635 635 goto error_return; 636 636 } 637 637 if (softlimit && total_count > softlimit) { 638 - if ((timer != 0 && get_seconds() > timer) || 638 + if ((timer != 0 && 639 + ktime_get_real_seconds() > timer) || 639 640 (warns != 0 && warns >= warnlimit)) { 640 641 xfs_quota_warn(mp, dqp, 641 642 QUOTA_NL_BSOFTLONGWARN); ··· 663 662 goto error_return; 664 663 } 665 664 if (softlimit && total_count > softlimit) { 666 - if ((timer != 0 && get_seconds() > timer) || 665 + if ((timer != 0 && 666 + ktime_get_real_seconds() > timer) || 667 667 (warns != 0 && warns >= warnlimit)) { 668 668 xfs_quota_warn(mp, dqp, 669 669 QUOTA_NL_ISOFTLONGWARN);