public inbox for linux-xfs@vger.kernel.org
 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 5/5] xfs: print specific dqblk that failed verifiers
Date: Fri, 4 May 2018 15:10:16 -0700	[thread overview]
Message-ID: <20180504221016.GS26569@magnolia> (raw)
In-Reply-To: <9d126a83-c4ef-00a2-dbb6-510e2c41de73@sandeen.net>

On Fri, May 04, 2018 at 12:35:40PM -0500, Eric Sandeen wrote:
> Rather than printing the top of the buffer that held a corrupted dqblk,
> restructure things to print out the specific one that failed by pushing
> the calls to the verifier_error function down into the verifier which
> iterates over the buffer and detects the error.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/libxfs/xfs_dquot_buf.c | 41 +++++++++++++++++++----------------
>  1 file changed, 22 insertions(+), 19 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_dquot_buf.c b/fs/xfs/libxfs/xfs_dquot_buf.c
> index d71c0b53536b..fb23d941e799 100644
> --- a/fs/xfs/libxfs/xfs_dquot_buf.c
> +++ b/fs/xfs/libxfs/xfs_dquot_buf.c
> @@ -152,7 +152,8 @@ xfs_dqblk_repair(
>  STATIC bool
>  xfs_dquot_buf_verify_crc(
>  	struct xfs_mount	*mp,
> -	struct xfs_buf		*bp)
> +	struct xfs_buf		*bp,
> +	bool			readahead)
>  {
>  	struct xfs_dqblk	*d = (struct xfs_dqblk *)bp->b_addr;
>  	int			ndquots;
> @@ -173,8 +174,12 @@ xfs_dquot_buf_verify_crc(
>  
>  	for (i = 0; i < ndquots; i++, d++) {
>  		if (!xfs_verify_cksum((char *)d, sizeof(struct xfs_dqblk),
> -				 XFS_DQUOT_CRC_OFF))
> +				 XFS_DQUOT_CRC_OFF)) {
> +			if (!readahead)
> +				xfs_buf_verifier_error(bp, -EFSBADCRC, __func__,
> +					d, sizeof(*d), __this_address);
>  			return false;
> +		}
>  	}
>  	return true;
>  }
> @@ -182,7 +187,8 @@ xfs_dquot_buf_verify_crc(
>  STATIC xfs_failaddr_t
>  xfs_dquot_buf_verify(
>  	struct xfs_mount	*mp,
> -	struct xfs_buf		*bp)
> +	struct xfs_buf		*bp,
> +	bool			readahead)
>  {
>  	struct xfs_dqblk	*dqb = (struct xfs_dqblk *)bp->b_addr;
>  	xfs_failaddr_t		fa;
> @@ -216,8 +222,13 @@ xfs_dquot_buf_verify(
>  			id = be32_to_cpu(ddq->d_id);
>  
>  		fa = xfs_dqblk_verify(mp, &dqb[i], id + i, 0);
> -		if (fa)
> +		if (fa) {
> +			if (!readahead)
> +				xfs_buf_verifier_error(bp, -EFSCORRUPTED,
> +					__func__, &dqb[i],
> +					sizeof(struct xfs_dqblk), fa);
>  			return fa;
> +		}
>  	}
>  
>  	return NULL;
> @@ -229,7 +240,7 @@ xfs_dquot_buf_verify_struct(
>  {
>  	struct xfs_mount	*mp = bp->b_target->bt_mount;
>  
> -	return xfs_dquot_buf_verify(mp, bp);
> +	return xfs_dquot_buf_verify(mp, bp, false);
>  }
>  
>  static void
> @@ -237,15 +248,10 @@ xfs_dquot_buf_read_verify(
>  	struct xfs_buf		*bp)
>  {
>  	struct xfs_mount	*mp = bp->b_target->bt_mount;
> -	xfs_failaddr_t		fa;
>  
> -	if (!xfs_dquot_buf_verify_crc(mp, bp))
> -		xfs_verifier_error(bp, -EFSBADCRC, __this_address);
> -	else {
> -		fa = xfs_dquot_buf_verify(mp, bp);
> -		if (fa)
> -			xfs_verifier_error(bp, -EFSCORRUPTED, __this_address);
> -	}
> +	if (!xfs_dquot_buf_verify_crc(mp, bp, false))
> +		return;
> +	xfs_dquot_buf_verify(mp, bp, false);
>  }
>  
>  /*
> @@ -260,8 +266,8 @@ xfs_dquot_buf_readahead_verify(
>  {
>  	struct xfs_mount	*mp = bp->b_target->bt_mount;
>  
> -	if (!xfs_dquot_buf_verify_crc(mp, bp) ||
> -	    xfs_dquot_buf_verify(mp, bp) != NULL) {
> +	if (!xfs_dquot_buf_verify_crc(mp, bp, true) ||
> +	    xfs_dquot_buf_verify(mp, bp, true) != NULL) {
>  		xfs_buf_ioerror(bp, -EIO);
>  		bp->b_flags &= ~XBF_DONE;
>  	}
> @@ -277,11 +283,8 @@ xfs_dquot_buf_write_verify(
>  	struct xfs_buf		*bp)
>  {
>  	struct xfs_mount	*mp = bp->b_target->bt_mount;
> -	xfs_failaddr_t		fa;
>  
> -	fa = xfs_dquot_buf_verify(mp, bp);
> -	if (fa)
> -		xfs_verifier_error(bp, -EFSCORRUPTED, __this_address);
> +	xfs_dquot_buf_verify(mp, bp, false);
>  }
>  
>  const struct xfs_buf_ops xfs_dquot_buf_ops = {
> -- 
> 2.17.0
> 
> 
> --
> 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-05-04 22:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-04 17:33 [PATCH 0/5] xfs: quota verifier/repair improvements take 2 Eric Sandeen
2018-05-04 17:34 ` [PATCH 1/5] xfs: remove unused flags arg from xfs_dquot_verify Eric Sandeen
2018-05-04 17:34 ` [PATCH 2/5] xfs: check type in quota verifier during quotacheck Eric Sandeen
2018-05-04 22:08   ` Darrick J. Wong
2018-05-07 15:07   ` Christoph Hellwig
2018-05-04 17:34 ` [PATCH 3/5] xfs: repair full xfs_dqblk " Eric Sandeen
2018-05-04 22:09   ` Darrick J. Wong
2018-05-07 15:09   ` Christoph Hellwig
2018-05-07 15:22   ` [PATCH 3/5 V2] xfs: pass full xfs_dqblk to repair " Eric Sandeen
2018-05-07 16:15     ` Darrick J. Wong
2018-05-04 17:35 ` [PATCH 4/5] xfs: add full xfs_dqblk verifier Eric Sandeen
2018-05-04 22:09   ` Darrick J. Wong
2018-05-07 15:10   ` Christoph Hellwig
2018-05-07 15:20   ` [PATCH 4/5 V2] " Eric Sandeen
2018-05-04 17:35 ` [PATCH 5/5] xfs: print specific dqblk that failed verifiers Eric Sandeen
2018-05-04 21:46   ` [PATCH 6/5] xfs: make several functions void Eric Sandeen
2018-05-04 22:29     ` Darrick J. Wong
2018-05-04 22:36       ` Eric Sandeen
2018-05-04 22:10   ` Darrick J. Wong [this message]
2018-05-07 15:11   ` [PATCH 5/5] xfs: print specific dqblk that failed verifiers Christoph Hellwig

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=20180504221016.GS26569@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