Date: Sat, 25 Aug 2001 18:25:12 -0700 (PDT) From: Ian Dowse <iedowse@FreeBSD.org> To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/ufs/ufs ufs_lookup.c Message-ID: <200108260125.f7Q1PC576312@freefall.freebsd.org>
index | next in thread | raw e-mail
iedowse 2001/08/25 18:25:12 PDT
Modified files:
sys/ufs/ufs ufs_lookup.c
Log:
When compacting directories, ufs_direnter() always trusted DIRSIZ()
to supply the number of bytes to be bcopy()'d to move an entry. If
d_ino == 0 however, DIRSIZ() is not guaranteed to return a sensible
length, so ufs_direnter could end up corrupting a directory during
compaction. In practice I believe this can only happen after fsck_ffs
has fixed a previously-corrupted directory.
We now deal with any mid-block unused entries specially to avoid
using DIRSIZ() or bcopy() on such entries. We also ensure that the
variables 'dsize' and 'spacefree' contain meaningful values at all
times. Add a few comments to describe better this intricate piece
of code.
The special handling of mid-block unused entries makes the dirhash-
specific bugfix in the previous revision (1.53) now uncecessary,
so this change removes it.
Reviewed by: mckusick
Revision Changes Path
1.54 +30 -12 src/sys/ufs/ufs/ufs_lookup.c
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200108260125.f7Q1PC576312>
