Re: [PATCH 4/4] xfs: check owner of dir3 blocks

Darrick J. Wong
2020-03-05T17:49:01Z

On Thu, Mar 05, 2020 at 08:51:28AM -0800, Christoph Hellwig wrote:
> On Fri, Feb 28, 2020 at 05:49:01PM -0800, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> >
> > Check the owner field of dir3 block headers.
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
>
> Looks good,
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
>
> > + xfs_verifier_error(*bpp, -EFSCORRUPTED, fa);
> > + (*bpp)->b_flags &= ~XBF_DONE;
> > + xfs_trans_brelse(tp, *bpp);
> > + *bpp = NULL;
> > + return -EFSCORRUPTED;
>
> Although I wonder if we should factor this repeated sniplet into a
> helper..

Yes. Dave and I were discussing in patch 1 that
xfs_buf_corruption_error() is the correct function to call for a buffer
that we've decided is corrupt outside of a read verifier, so this all
becomes:

if (fa) {
xfs_buf_corruption_error(*bpp...);
xfs_trans_brelse(tp, *bpp);
*bpp = NULL;
return -EFSCORRUPTED;
}

(We also observed that xfs_buf_corruption_error ought to stale the
corrupt buffer to get it out of the system asap.)

--D