Message ID | 158388769356.939608.4585090255151116523.stgit@magnolia (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | xfs: fix errors in attr/directory scrubbers | expand |
On Tue, Mar 10, 2020 at 05:48:13PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong <darrick.wong@oracle.com> > > In xchk_xattr_listent, we attempt to validate the extended attribute > hash structures by performing a attr lookup by (hashed) name. If the > lookup returns ENODATA, that means that the hash information is corrupt. > The _process_error functions don't catch this, so we have to add that > explicitly. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > fs/xfs/scrub/attr.c | 3 +++ > 1 file changed, 3 insertions(+) > > > diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c > index d9f0dd444b80..941c09bafb35 100644 > --- a/fs/xfs/scrub/attr.c > +++ b/fs/xfs/scrub/attr.c > @@ -163,6 +163,9 @@ xchk_xattr_listent( > args.valuelen = valuelen; > > error = xfs_attr_get_ilocked(context->dp, &args); > + /* ENODATA means the hash lookup failed and the attr is bad */ > + if (error == -ENODATA) > + error = -EFSCORRUPTED; > if (!xchk_fblock_process_error(sx->sc, XFS_ATTR_FORK, args.blkno, > &error)) > goto fail_xref; Much nicer than the previous iteration :) Reviewed-by: Dave Chinner <dchinner@redhat.com>
diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c index d9f0dd444b80..941c09bafb35 100644 --- a/fs/xfs/scrub/attr.c +++ b/fs/xfs/scrub/attr.c @@ -163,6 +163,9 @@ xchk_xattr_listent( args.valuelen = valuelen; error = xfs_attr_get_ilocked(context->dp, &args); + /* ENODATA means the hash lookup failed and the attr is bad */ + if (error == -ENODATA) + error = -EFSCORRUPTED; if (!xchk_fblock_process_error(sx->sc, XFS_ATTR_FORK, args.blkno, &error)) goto fail_xref;