Subject: CVS commit: src/sys/ufs/ufs
To: None <source-changes@NetBSD.org>
From: YAMAMOTO Takashi <yamt@netbsd.org>
List: source-changes
Date: 01/14/2006 09:09:02
Module Name:	src
Committed By:	yamt
Date:		Sat Jan 14 09:09:02 UTC 2006

Modified Files:
	src/sys/ufs/ufs: ufs_lookup.c

Log Message:
pull freebsd's ufs_lookup.c rev.1.53 and 1.54.  PR/31873.

> ----------------------------
> revision 1.54
> date: 2001/08/26 01:25:12;  author: iedowse;  state: Exp;  lines: +30 -12
> 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 1.53
> date: 2001/08/22 01:35:17;  author: iedowse;  state: Exp;  lines: +2 -2
> 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().


To generate a diff of this commit:
cvs rdiff -r1.71 -r1.72 src/sys/ufs/ufs/ufs_lookup.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.