On 12/31/19 7:11 PM, Darrick J. Wong wrote: > 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. Uh, so, even with this, it seems that we don't properly set up default time limits on the first mount. Looking into it... I think we need something like this but I need to look more closely. Otherwise, xfs_qm_dqget_uncached fails if run before quotacheck has initialized things, and so we fail to set up default quotas or timers. (also, not sure if there's any point to initializing timers if that quota is not enabled...) diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c index f94f6c34ee35..f4ac69fd946e 100644 --- a/fs/xfs/xfs_qm.c +++ b/fs/xfs/xfs_qm.c @@ -663,17 +671,6 @@ xfs_qm_init_quotainfo( mp->m_qflags |= (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_CHKD); - xfs_qm_init_timelimits(mp, XFS_DQ_USER); - xfs_qm_init_timelimits(mp, XFS_DQ_GROUP); - xfs_qm_init_timelimits(mp, XFS_DQ_PROJ); - - if (XFS_IS_UQUOTA_RUNNING(mp)) - xfs_qm_set_defquota(mp, XFS_DQ_USER); - if (XFS_IS_GQUOTA_RUNNING(mp)) - xfs_qm_set_defquota(mp, XFS_DQ_GROUP); - if (XFS_IS_PQUOTA_RUNNING(mp)) - xfs_qm_set_defquota(mp, XFS_DQ_PROJ); - qinf->qi_shrinker.count_objects = xfs_qm_shrink_count; qinf->qi_shrinker.scan_objects = xfs_qm_shrink_scan; qinf->qi_shrinker.seeks = DEFAULT_SEEKS; @@ -1423,6 +1420,18 @@ xfs_qm_mount_quotas( return; } } + + xfs_qm_init_timelimits(mp, XFS_DQ_USER); + xfs_qm_init_timelimits(mp, XFS_DQ_GROUP); + xfs_qm_init_timelimits(mp, XFS_DQ_PROJ); + + if (XFS_IS_UQUOTA_RUNNING(mp)) + xfs_qm_set_defquota(mp, XFS_DQ_USER); + if (XFS_IS_GQUOTA_RUNNING(mp)) + xfs_qm_set_defquota(mp, XFS_DQ_GROUP); + if (XFS_IS_PQUOTA_RUNNING(mp)) + xfs_qm_set_defquota(mp, XFS_DQ_PROJ); + /* * If one type of quotas is off, then it will lose its * quotachecked status, since we won't be doing accounting for