linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Eric Sandeen <sandeen@redhat.com>, linux-xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH 2/6] xfs: pass xfs_dqblk to xfs_dquot_verify/xfs_dquot_repair
Date: Tue, 10 Apr 2018 20:28:58 -0700	[thread overview]
Message-ID: <20180411032858.GX7500@magnolia> (raw)
In-Reply-To: <5c02fc77-28b6-4665-82f3-699fda82688c@sandeen.net>

On Wed, Apr 04, 2018 at 11:13:03PM -0500, Eric Sandeen wrote:
> On 4/4/18 10:52 PM, Darrick J. Wong wrote:
> > On Wed, Apr 04, 2018 at 01:54:26PM -0500, Eric Sandeen wrote:
> >> In order to validate the UUID in xfs_dquot_verify, we need
> >> the full xfs_qblk, not just the xfs_disk_dquot_t (which is
> > 
> >           ^^^^^^^^^ xfs_dqblk, right?
> 
> yup
> 
> ...
> 
> >> @@ -192,14 +191,10 @@
> > 
> > Any way you can get your diff generator to add -p to spit out the
> > alleged function this chunk is supposed to land in?  It makes reviewing
> > patches somewhat easier for me. :)
> 
> No doubt ... I don't know why it doesn't do so, sorry.  :/  Will try
> to figure that out.  Sorry about that.
> 
> >>  	 * buffer so corruptions could point to the wrong dquot in this case.
> >>  	 */
> >>  	for (i = 0; i < ndquots; i++) {
> >> -		struct xfs_disk_dquot	*ddq;
> >> -
> >> -		ddq = &d[i].dd_diskdq;
> >> -
> >>  		if (i == 0)
> >> -			id = be32_to_cpu(ddq->d_id);
> >> +			id = be32_to_cpu(d[i].dd_diskdq.d_id);
> >>  
> >> -		fa = xfs_dquot_verify(mp, ddq, id + i, 0);
> >> +		fa = xfs_dquot_verify(mp, &d[i], id + i, 0);
> >>  		if (fa)
> >>  			return fa;
> >>  	}
> 
> ...
> 
> >> @@ -1013,9 +1018,6 @@
> >>  		return -EIO;
> >>  	}
> >>  
> >> -	/* This is the only portion of data that needs to persist */
> >> -	memcpy(ddqp, &dqp->q_core, sizeof(xfs_disk_dquot_t));
> > 
> > About this memcpy() -- isn't the point of this function that we verify
> > the contents of the in-core q_core and only memcpy the contents into the
> > xfs_buf if it actually passes validation?
> 
> yeah, but if it fails here we release the buffer & shut down the filesystem ;)
> 
> > I guess the _dquot_verify
> > function needs the entire on-disk buffer so that it can validate the crc
> 
> narrator:  xfs_dquot_verify doesn't verify the crc ;)

Sorry, my brain was all discombobulated last week. :(

> > and the uuid on a read, but we update the crc on dqflush and
> > (presumably) can set the uuid on write (quotacheck) or fail the dquot
> > read everywhere else, right?
> > 
> > Put another way, why not have xfs_dquot_buf_verify check the uuid?
> > xfs_dquot_repair seems to reset the uuid if it's garbage.
> 
> Well, the above path (xfs_qm_dqflush) isn't going to do repair...
> 
> But OK, xfs_dquot_buf_verify does the entire dqblk; it iterates over
> each dquot calling xfs_dquot_verify.  I figured the easiest way to
> get uuid validation was to put it into xfs_dquot_verify.
> 
> But I guess you're suggesting a separate uuid check in xfs_dquot_buf_verify 
> to validate the uuid, given that it has the full on-disk dquot?  Ok that
> might make sense...

Eh, now that I've figured out what all these patches are trying to do
(and figured out what hunks are modifying which functions) this is a lot
clearer to me.  The UUID check should be in the structure verifier, not
the crc verifier, as you point out.

So the more I reread this series the more I think they're ok, though you
might want to fix the things Christoph pointed out on this patch.

(I'll review the repair side of things whenever you get to that.)

--D

> Thanks,
> -Eric
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2018-04-11  3:29 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-04 18:47 [PATCH 0/6] xfs: quota fixes and enhancements Eric Sandeen
2018-04-04 18:49 ` [PATCH 1/6] xfs: remove unused flags arg from xfs_dquot_verify Eric Sandeen
2018-04-05  7:11   ` Christoph Hellwig
2018-05-01 16:13   ` Darrick J. Wong
2018-04-04 18:54 ` [PATCH 2/6] xfs: pass xfs_dqblk to xfs_dquot_verify/xfs_dquot_repair Eric Sandeen
2018-04-05  3:52   ` Darrick J. Wong
2018-04-05  4:13     ` Eric Sandeen
2018-04-05 22:40       ` Dave Chinner
2018-04-06  2:50         ` Eric Sandeen
2018-04-06  3:30           ` Dave Chinner
2018-04-11  3:28       ` Darrick J. Wong [this message]
2018-04-05  7:14   ` Christoph Hellwig
2018-05-01 16:25     ` Darrick J. Wong
2018-05-01 18:58   ` [PATCH 2/6 V2] " Eric Sandeen
2018-04-04 19:00 ` [PATCH 3/6] xfs: validate UUID and type in xfs_dquot_verify Eric Sandeen
2018-04-05  7:14   ` Christoph Hellwig
2018-05-01 16:13   ` Darrick J. Wong
2018-05-02 16:20     ` Darrick J. Wong
2018-04-04 19:06 ` [PATCH 4/6] xfs: quieter quota initialization with bad dquots Eric Sandeen
2018-04-05  7:14   ` Christoph Hellwig
2018-05-01 16:23   ` Darrick J. Wong
2018-04-04 19:10 ` [PATCH 5/6] xfs: factor out quota time limit initialization Eric Sandeen
2018-04-05  7:15   ` Christoph Hellwig
2018-04-05 12:36     ` Eric Sandeen
2018-04-05 22:49       ` Dave Chinner
2018-05-01 16:23   ` Darrick J. Wong
2018-05-01 19:00   ` [PATCH 5/6 V2] " Eric Sandeen
2018-04-04 19:12 ` [PATCH 6/6] xfs: delay quota timelimit init until after quotacheck Eric Sandeen
2018-04-05  7:16   ` Christoph Hellwig
2018-05-01 16:24   ` Darrick J. Wong
2018-04-07 22:00 ` [PATCH 0/6] xfs: quota fixes and enhancements Eric Sandeen
2018-04-08  1:37   ` Darrick J. Wong
2018-04-08  1:48     ` Eric Sandeen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180411032858.GX7500@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@redhat.com \
    --cc=sandeen@sandeen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).