From owner-cvs-all Sat Aug 25 18:25:19 2001 Delivered-To: cvs-all@freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 9DC3937B40F; Sat, 25 Aug 2001 18:25:12 -0700 (PDT) (envelope-from iedowse@FreeBSD.org) Received: (from iedowse@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f7Q1PC576312; Sat, 25 Aug 2001 18:25:12 -0700 (PDT) (envelope-from iedowse) Message-Id: <200108260125.f7Q1PC576312@freefall.freebsd.org> From: Ian Dowse Date: Sat, 25 Aug 2001 18:25:12 -0700 (PDT) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/ufs/ufs ufs_lookup.c X-FreeBSD-CVS-Branch: HEAD Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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