This is a note to let you know that I've just added the patch titled xfs: preserve default grace interval during quotacheck to the 5.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: xfs-preserve-default-grace-interval-during-quotacheck.patch and it can be found in the queue-5.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Wed Oct 26 04:49:40 PM CEST 2022 From: Chandan Babu R <chandan.babu@xxxxxxxxxx> Date: Wed, 26 Oct 2022 11:58:33 +0530 Subject: xfs: preserve default grace interval during quotacheck To: gregkh@xxxxxxxxxxxxxxxxxxx Cc: sashal@xxxxxxxxxx, mcgrof@xxxxxxxxxx, linux-xfs@xxxxxxxxxxxxxxx, stable@xxxxxxxxxxxxxxx, djwong@xxxxxxxxxx, chandan.babu@xxxxxxxxxx, amir73il@xxxxxxxxx, leah.rumancik@xxxxxxxxx Message-ID: <20221026062843.927600-17-chandan.babu@xxxxxxxxxx> From: "Darrick J. Wong" <darrick.wong@xxxxxxxxxx> commit 5885539f0af371024d07afd14974bfdc3fff84c5 upstream. 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 intervals and warning limits 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 not resetting the root disk dquot's timer and warning fields. Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx> Reviewed-by: Christoph Hellwig <hch@xxxxxx> Acked-by: Darrick J. Wong <djwong@xxxxxxxxxx> Signed-off-by: Chandan Babu R <chandan.babu@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/xfs/xfs_qm.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) --- a/fs/xfs/xfs_qm.c +++ b/fs/xfs/xfs_qm.c @@ -875,12 +875,20 @@ xfs_qm_reset_dqcounts( ddq->d_bcount = 0; ddq->d_icount = 0; ddq->d_rtbcount = 0; - ddq->d_btimer = 0; - ddq->d_itimer = 0; - ddq->d_rtbtimer = 0; - ddq->d_bwarns = 0; - ddq->d_iwarns = 0; - ddq->d_rtbwarns = 0; + + /* + * dquot id 0 stores the default grace period and the maximum + * warning limit that were set by the administrator, so we + * should not reset them. + */ + if (ddq->d_id != 0) { + ddq->d_btimer = 0; + ddq->d_itimer = 0; + ddq->d_rtbtimer = 0; + ddq->d_bwarns = 0; + ddq->d_iwarns = 0; + ddq->d_rtbwarns = 0; + } if (xfs_sb_version_hascrc(&mp->m_sb)) { xfs_update_cksum((char *)&dqb[j], Patches currently in stable-queue which might be from chandan.babu@xxxxxxxxxx are queue-5.4/xfs-check-owner-of-dir3-blocks.patch queue-5.4/xfs-throttle-commits-on-delayed-background-cil-push.patch queue-5.4/xfs-factor-common-ail-item-deletion-code.patch queue-5.4/xfs-remove-the-xfs_dq_logitem_t-typedef.patch queue-5.4/xfs-fix-buffer-corruption-reporting-when-xfs_dir3_free_header_check-fails.patch queue-5.4/xfs-xfs_buf_corruption_error-should-take-__this_address.patch queue-5.4/xfs-open-code-insert-range-extent-split-helper.patch queue-5.4/xfs-don-t-write-a-corrupt-unmount-record-to-force-summary-counter-recalc.patch queue-5.4/xfs-check-owner-of-dir3-data-blocks.patch queue-5.4/xfs-factor-out-quotaoff-intent-ail-removal-and-memory-free.patch queue-5.4/xfs-trylock-underlying-buffer-on-dquot-flush.patch queue-5.4/xfs-remove-the-xfs_disk_dquot_t-and-xfs_dquot_t.patch queue-5.4/xfs-add-a-function-to-deal-with-corrupt-buffers-post-verifiers.patch queue-5.4/xfs-fix-use-after-free-on-cil-context-on-shutdown.patch queue-5.4/xfs-tail-updates-only-need-to-occur-when-lsn-changes.patch queue-5.4/xfs-use-scnprintf-for-avoiding-potential-buffer-overflow.patch queue-5.4/xfs-move-inode-flush-to-the-sync-workqueue.patch queue-5.4/xfs-lower-cil-flush-limit-for-large-logs.patch queue-5.4/xfs-rework-collapse-range-into-an-atomic-operation.patch queue-5.4/xfs-remove-the-xfs_qoff_logitem_t-typedef.patch queue-5.4/xfs-fix-unmount-hang-and-memory-leak-on-shutdown-during-quotaoff.patch queue-5.4/xfs-preserve-default-grace-interval-during-quotacheck.patch queue-5.4/xfs-replace-function-declaration-by-actual-definition.patch queue-5.4/xfs-rework-insert-range-into-an-atomic-operation.patch queue-5.4/xfs-factor-out-a-new-xfs_log_force_inode-helper.patch queue-5.4/xfs-reflink-should-force-the-log-out-if-mounted-with-wsync.patch