[net.bugs.4bsd] Bug in bad sector remapping.

karl@cygnet.UUCP (Karl Danz) (06/09/84)

Subject:  Problem with adding entries to bad sector list.
Index:	/sys/vax/dkbad.c  4.2BSD  Fix
------------------------------------------------------------------------
Description:
        For some disks, the bad144(8) utility can be used to add entries
	to the bad sector list after a disk has been in use for a while.
	These new entries must be placed at the end of the list since the
	remapping to new sectors is based only on relative position of
	entries in the list.  The remapping routine, isbad(), assumes an
	ordered list (apparently in the interest of efficiency) and can
	exit before noticing new entries.

Repeat-By:
	Add a new entry to the bad sector list with bad144, specifying
	the "-f" flag (only allowed on RP06's, eagles, and capricorns).
	The new sector number must be smaller than the largest number
	currently in the list for the bug to manifest itself.  Somehow
	force I/O to the bad sector (e.g. copy a big file several times).
	A hard BSE (bad sector error) will be reported and no remapping
	will occur.

Fix:
	One line change to /sys/vax/dkbad.c follows.  Note that this is
	really not going to slow things down very much as isbad() will
	still bail out at the end of the active list (entries after that
	are set to -1).  Besides, BSE's typically occur infrequently.
	----------------------------------------------------------------
	RCS file: dkbad.c,v
	retrieving revision 1.1
	diff  -r1.1 dkbad.c
	25c25
	< 		if (blk < bblk || bblk < 0)
	---
	> 		if (bblk < 0)
------------------------------------------------------------------------
						Karl Danz
						Cygnet Systems