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:
iedowse 2001-08-22 01:35:17 +00:00
parent 58e247fcc4
commit c37a1a0228

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