xfs
[Top] [All Lists]

Re: libxfs: verifier should set buffer error when da block has a bad mag

To: "Darrick J. Wong" <darrick.wong@xxxxxxxxxx>
Subject: Re: libxfs: verifier should set buffer error when da block has a bad magic number
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Tue, 25 Aug 2015 14:23:02 +1000
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20150825040609.GT10043@xxxxxxxxxxxxxxxx>
References: <20150825040609.GT10043@xxxxxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Mon, Aug 24, 2015 at 09:06:09PM -0700, Darrick J. Wong wrote:
> If xfs_da3_node_read_verify() doesn't recognize the magic number of a
> buffer it's just read, set the buffer error to -EFSCORRUPTED so that
> the error can be sent up to userspace.  Without this patch we'll
> ASSERT on the bad magic eventually while trying to traverse or change
> the block, but we really ought to fail fast in the verifier.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> ---
>  fs/xfs/libxfs/xfs_da_btree.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
> index 2385f8c..ec4a5a1 100644
> --- a/fs/xfs/libxfs/xfs_da_btree.c
> +++ b/fs/xfs/libxfs/xfs_da_btree.c
> @@ -238,6 +238,7 @@ xfs_da3_node_read_verify(
>  
>       /* corrupt block */
>       xfs_verifier_error(bp);
> +     xfs_buf_ioerror(bp, -EFSCORRUPTED);
>  }

That should be in the default block of the switch statement,
otherwise it will overwrite the error from the node format crc/
verifier failures....

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>