summaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2023-04-11 19:00:16 -0700
committerDarrick J. Wong <djwong@kernel.org>2023-04-11 19:00:16 -0700
commit9dceccc5822f2ecea12a89f24d7cad1f3e5eab7c (patch)
tree9ed1442fa8c784c0c092592ed5ecdaa50bc6bad0 /fs/xfs
parent30f8ee5e7e0ccce396dff209c6cbce49d0d7e167 (diff)
downloadlinux-9dceccc5822f2ecea12a89f24d7cad1f3e5eab7c.tar.gz
linux-9dceccc5822f2ecea12a89f24d7cad1f3e5eab7c.tar.bz2
linux-9dceccc5822f2ecea12a89f24d7cad1f3e5eab7c.zip
xfs: use the directory name hash function for dir scrubbing
The directory code has a directory-specific hash computation function that includes a modified hash function for case-insensitive lookups. Hence we must use that function (and not the raw da_hashname) when checking the dabtree structure. Found by accidentally breaking xfs/188 to create an abnormally huge case-insensitive directory and watching scrub break. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/scrub/dir.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/xfs/scrub/dir.c b/fs/xfs/scrub/dir.c
index b6081a3e1b91..1b1830576dcd 100644
--- a/fs/xfs/scrub/dir.c
+++ b/fs/xfs/scrub/dir.c
@@ -201,6 +201,7 @@ xchk_dir_rec(
struct xchk_da_btree *ds,
int level)
{
+ struct xfs_name dname = { };
struct xfs_da_state_blk *blk = &ds->state->path.blk[level];
struct xfs_mount *mp = ds->state->mp;
struct xfs_inode *dp = ds->dargs.dp;
@@ -297,7 +298,11 @@ xchk_dir_rec(
xchk_fblock_set_corrupt(ds->sc, XFS_DATA_FORK, rec_bno);
goto out_relse;
}
- calc_hash = xfs_da_hashname(dent->name, dent->namelen);
+
+ /* Does the directory hash match? */
+ dname.name = dent->name;
+ dname.len = dent->namelen;
+ calc_hash = xfs_dir2_hashname(mp, &dname);
if (calc_hash != hash)
xchk_fblock_set_corrupt(ds->sc, XFS_DATA_FORK, rec_bno);