From: Christoph Hellwig <hch@infradead.org>
To: Eric Sandeen <sandeen@redhat.com>
Cc: linux-xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH 2/6] xfs: pass xfs_dqblk to xfs_dquot_verify/xfs_dquot_repair
Date: Thu, 5 Apr 2018 00:14:12 -0700 [thread overview]
Message-ID: <20180405071412.GB17256@infradead.org> (raw)
In-Reply-To: <c92cfdb8-88c2-0f5b-7383-e5208fef6f5e@redhat.com>
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
> a subset).
>
> Do the same for xfs_dquot_repair, for the same reasons.
> Casting a xfs_disk_dquot to a xfs_qblk is risky if the source
> pointer wasn't a full xfs_dqblk, so enforce that by changing
> the arguments to these functions.
>
> In xfs_qm_dqflush we move the memcpy up so that we have
> a full (and updated) xfs_dqblk to test.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
> fs/xfs/libxfs/xfs_dquot_buf.c | 23 +++++++++--------------
> fs/xfs/libxfs/xfs_quota_defs.h | 4 ++--
> fs/xfs/xfs_dquot.c | 12 +++++++-----
> fs/xfs/xfs_log_recover.c | 6 ++++--
> fs/xfs/xfs_qm.c | 6 +++---
> 5 files changed, 25 insertions(+), 26 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_dquot_buf.c b/fs/xfs/libxfs/xfs_dquot_buf.c
> index a926058..f94e8c2 100644
> --- a/fs/xfs/libxfs/xfs_dquot_buf.c
> +++ b/fs/xfs/libxfs/xfs_dquot_buf.c
> @@ -44,11 +44,13 @@
> */
> xfs_failaddr_t
> xfs_dquot_verify(
> - struct xfs_mount *mp,
> - xfs_disk_dquot_t *ddq,
> - xfs_dqid_t id,
> - uint type) /* used only when IO_dorepair is true */
> + struct xfs_mount *mp,
> + struct xfs_dqblk *dqb,
> + xfs_dqid_t id,
> + uint type) /* used only during quota rebuild */
> {
> + struct xfs_disk_dquot *ddq = &dqb->dd_diskdq;
> +
> /*
> * We can encounter an uninitialized dquot buffer for 2 reasons:
> * 1. If we crash while deleting the quotainode(s), and those blks got
> @@ -104,13 +106,10 @@
> int
> xfs_dquot_repair(
> struct xfs_mount *mp,
> - struct xfs_disk_dquot *ddq,
> + struct xfs_dqblk *d,
Rename this to dqblks to make it clear that it is an array?
> 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);
Can we either use only array indices or only pointer arithmetics and
not mix the two? (personall I prefer the pointer arithmetics).
Functionally the patch looks fine to me.
next prev parent reply other threads:[~2018-04-05 7:14 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
2018-04-05 7:14 ` Christoph Hellwig [this message]
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=20180405071412.GB17256@infradead.org \
--to=hch@infradead.org \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.com \
/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).