When compressing directory blocks, the dirhash code didn't check

that the directory entry was in use before attempting to find it
in the hash structures to change its offset. Normally, unused
entries do not need to be moved, but fsck can leave behind some
unused entries that do. A dirhash sanity panic resulted when the
entry to be moved was not found. Add a check that stops entries
with d_ino == 0 from being passed to ufsdirhash_move().
This commit is contained in:
Ian Dowse 2001-08-22 01:35:17 +00:00
parent b0e3ad758b
commit 7dfb550e0c

View File

@ -884,7 +884,7 @@ ufs_direnter(dvp, tvp, dirp, cnp, newdirbp)
dsize = DIRSIZ(OFSFMT(dvp), nep);
spacefree += nep->d_reclen - dsize;
#ifdef UFS_DIRHASH
if (dp->i_dirhash != NULL)
if (dp->i_dirhash != NULL && nep->d_ino)
ufsdirhash_move(dp, nep, dp->i_offset + loc,
dp->i_offset + ((char *)ep - dirbuf));
#endif