Commit 7fff3f7f authored by Darrick J. Wong's avatar Darrick J. Wong Committed by Greg Kroah-Hartman

xfs: mark dir corrupt when lookup-by-hash fails

[ Upstream commit 2e107cf8 ]

In xchk_dir_actor, we attempt to validate the directory hash structures
by performing a directory entry lookup by (hashed) name.  If the lookup
returns ENOENT, 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: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 6ab959f1
...@@ -156,6 +156,9 @@ xchk_dir_actor( ...@@ -156,6 +156,9 @@ xchk_dir_actor(
xname.type = XFS_DIR3_FT_UNKNOWN; xname.type = XFS_DIR3_FT_UNKNOWN;
error = xfs_dir_lookup(sdc->sc->tp, ip, &xname, &lookup_ino, NULL); error = xfs_dir_lookup(sdc->sc->tp, ip, &xname, &lookup_ino, NULL);
/* ENOENT means the hash lookup failed and the dir is corrupt */
if (error == -ENOENT)
error = -EFSCORRUPTED;
if (!xchk_fblock_process_error(sdc->sc, XFS_DATA_FORK, offset, if (!xchk_fblock_process_error(sdc->sc, XFS_DATA_FORK, offset,
&error)) &error))
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment