Skip to content

Commit 9dceccc

Browse files
author
Darrick J. Wong
committed
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>
1 parent 30f8ee5 commit 9dceccc

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

fs/xfs/scrub/dir.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ xchk_dir_rec(
201201
struct xchk_da_btree *ds,
202202
int level)
203203
{
204+
struct xfs_name dname = { };
204205
struct xfs_da_state_blk *blk = &ds->state->path.blk[level];
205206
struct xfs_mount *mp = ds->state->mp;
206207
struct xfs_inode *dp = ds->dargs.dp;
@@ -297,7 +298,11 @@ xchk_dir_rec(
297298
xchk_fblock_set_corrupt(ds->sc, XFS_DATA_FORK, rec_bno);
298299
goto out_relse;
299300
}
300-
calc_hash = xfs_da_hashname(dent->name, dent->namelen);
301+
302+
/* Does the directory hash match? */
303+
dname.name = dent->name;
304+
dname.len = dent->namelen;
305+
calc_hash = xfs_dir2_hashname(mp, &dname);
301306
if (calc_hash != hash)
302307
xchk_fblock_set_corrupt(ds->sc, XFS_DATA_FORK, rec_bno);
303308

0 commit comments

Comments
 (0)