summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2001-08-22 01:35:17 +0000
committeriedowse <iedowse@FreeBSD.org>2001-08-22 01:35:17 +0000
commitc37a1a02282151b7b262d0a4b1c6640d6b267a23 (patch)
tree54d0784b18a50f60e2cde51949e5fbefa4e6f840 /sys/ufs
parent58e247fcc429356ba8d8fe81cb9750c74a98d9bc (diff)
downloadFreeBSD-src-c37a1a02282151b7b262d0a4b1c6640d6b267a23.zip
FreeBSD-src-c37a1a02282151b7b262d0a4b1c6640d6b267a23.tar.gz
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().
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ufs/ufs_lookup.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c
index 1e023d6..f968388 100644
--- a/sys/ufs/ufs/ufs_lookup.c
+++ b/sys/ufs/ufs/ufs_lookup.c
@@ -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
OpenPOWER on IntegriCloud