Re: [PATCH 07/20] xfs: refactor verifier callers to print address of failing check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 22, 2017 at 05:07:48PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> 
> Refactor the callers of verifiers to print the instruction address of a
> failing check.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
.....
> @@ -2455,13 +2461,16 @@ xfs_agf_read_verify(
>  	struct xfs_buf	*bp)
>  {
>  	struct xfs_mount *mp = bp->b_target->bt_mount;
> +	xfs_failaddr_t	fa;
>  
>  	if (xfs_sb_version_hascrc(&mp->m_sb) &&
>  	    !xfs_buf_verify_cksum(bp, XFS_AGF_CRC_OFF))
> -		xfs_verifier_error(bp, -EFSBADCRC);
> -	else if (XFS_TEST_ERROR(xfs_agf_verify(mp, bp), mp,
> -				XFS_ERRTAG_ALLOC_READ_AGF))
> -		xfs_verifier_error(bp, -EFSCORRUPTED);
> +		xfs_verifier_error(bp, -EFSBADCRC, __this_address);
> +	else {
> +		fa = xfs_agf_verify(mp, bp);
> +		if (XFS_TEST_ERROR(fa, mp, XFS_ERRTAG_ALLOC_READ_AGF))
> +			xfs_verifier_error(bp, -EFSCORRUPTED, fa);
> +	}
>  }

That's much nicer than the last iteration :)

.....

> diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
> index c0a98c4..7e58a99 100644
> --- a/fs/xfs/xfs_error.c
> +++ b/fs/xfs/xfs_error.c
> @@ -348,15 +348,18 @@ xfs_corruption_error(
>  void
>  xfs_verifier_error(
>  	struct xfs_buf		*bp,
> -	int			error)
> +	int			error,
> +	xfs_failaddr_t		failaddr)
>  {
>  	struct xfs_mount *mp = bp->b_target->bt_mount;
> +	xfs_failaddr_t		fa;
>  
> -	__xfs_buf_ioerror(bp, error, __return_address);
> +	fa = failaddr ? failaddr : __return_address;
> +	__xfs_buf_ioerror(bp, error, failaddr);

I'm a little unsure of this. Why pass failaddr to
__xfs_buf_ioerror() rather than fa?

Otherwise, everything looks good.

Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx>
-- 
Dave Chinner
david@xxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux