From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> When quotacheck runs, it zeroes all the timer fields in every dquot. Unfortunately, it also does this to the root dquot, which erases any preconfigured grace interval that the administrator may have set. Worse yet, the incore copies of those variables remain set. This cache coherence problem manifests itself as the grace interval mysteriously being reset back to the defaults at the /next/ mount. Fix it by resetting the root disk dquot's timer fields to the incore values. Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> --- fs/xfs/xfs_qm.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c index 0ce334c51d73..d4a9765c9502 100644 --- a/fs/xfs/xfs_qm.c +++ b/fs/xfs/xfs_qm.c @@ -842,6 +842,23 @@ xfs_qm_qino_alloc( return error; } +/* Save the grace period intervals when zeroing dquots for quotacheck. */ +static inline void +xfs_qm_reset_dqintervals( + struct xfs_mount *mp, + struct xfs_disk_dquot *ddq) +{ + struct xfs_quotainfo *qinf = mp->m_quotainfo; + + if (qinf->qi_btimelimit != XFS_QM_BTIMELIMIT) + ddq->d_btimer = cpu_to_be32(qinf->qi_btimelimit); + + if (qinf->qi_itimelimit != XFS_QM_ITIMELIMIT) + ddq->d_itimer = cpu_to_be32(qinf->qi_itimelimit); + + if (qinf->qi_rtbtimelimit != XFS_QM_RTBTIMELIMIT) + ddq->d_rtbtimer = cpu_to_be32(qinf->qi_rtbtimelimit); +} STATIC void xfs_qm_reset_dqcounts( @@ -895,6 +912,8 @@ xfs_qm_reset_dqcounts( ddq->d_bwarns = 0; ddq->d_iwarns = 0; ddq->d_rtbwarns = 0; + if (!ddq->d_id) + xfs_qm_reset_dqintervals(mp, ddq); if (xfs_sb_version_hascrc(&mp->m_sb)) { xfs_update_cksum((char *)&dqb[j],