libxfs: verifier should set buffer error when da block has a bad magic number

Darrick J. Wong darrick.wong at oracle.com
Mon Aug 24 23:31:24 CDT 2015


On Tue, Aug 25, 2015 at 02:23:02PM +1000, Dave Chinner wrote:
> 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 at oracle.com>
> > ---
> >  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....

Aha, I missed that.  Thank you.

--D

> 
> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david at fromorbit.com
> 
> _______________________________________________
> xfs mailing list
> xfs at oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs



More information about the xfs mailing list