All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] xfs: preserve default grace interval during quotacheck
@ 2020-03-24 21:01 Darrick J. Wong
  2020-03-24 23:19 ` Dave Chinner
  2020-03-25  7:13 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: Darrick J. Wong @ 2020-03-24 21:01 UTC (permalink / raw)
  To: xfs; +Cc: Eric Sandeen

From: Darrick J. Wong <darrick.wong@oracle.com>

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@oracle.com>
---
v2: just use a branch
---
 fs/xfs/xfs_qm.c |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index 0ce334c51d73..ee175617630e 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -889,12 +889,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],

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] xfs: preserve default grace interval during quotacheck
  2020-03-24 21:01 [PATCH v2] xfs: preserve default grace interval during quotacheck Darrick J. Wong
@ 2020-03-24 23:19 ` Dave Chinner
  2020-03-25  7:13 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Dave Chinner @ 2020-03-24 23:19 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: xfs, Eric Sandeen

On Tue, Mar 24, 2020 at 02:01:46PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> 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@oracle.com>

Looks fine.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] xfs: preserve default grace interval during quotacheck
  2020-03-24 21:01 [PATCH v2] xfs: preserve default grace interval during quotacheck Darrick J. Wong
  2020-03-24 23:19 ` Dave Chinner
@ 2020-03-25  7:13 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2020-03-25  7:13 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: xfs, Eric Sandeen

On Tue, Mar 24, 2020 at 02:01:46PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> 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@oracle.com>

Looks good, although a comment in the code about the special nature
of qid 0 might be useful.  Otherwise:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-25  7:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-24 21:01 [PATCH v2] xfs: preserve default grace interval during quotacheck Darrick J. Wong
2020-03-24 23:19 ` Dave Chinner
2020-03-25  7:13 ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.