*BSD News Article 55619


Return to BSD News archive

Newsgroups: comp.bugs.2bsd
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!yarrina.connect.com.au!munnari.OZ.AU!news.hawaii.edu!ames!usenet.kornet.nm.kr!news.kreonet.re.kr!europa.chnt.gtegsc.com!wlbr!sms
From: sms@wlv.iipo.gtegsc.com (Steven M. Schultz)
Subject: Bug in bad sector handling in xp.c  (#278)
Sender: news@wlbr.iipo.gtegsc.com (Steven M. Schultz)
Organization: GTE Government Systems, Thousand Oaks CA USA
Message-ID: <DIFEnz.AFz@wlbr.iipo.gtegsc.com>
X-Nntp-Posting-Host: wlv.iipo.gtegsc.com
Date: Wed, 22 Nov 1995 03:50:22 GMT
Lines: 92

Subject: Bug in bad sector handling in xp.c  (#278)
Index:	pdpuba/xp.c 2.11BSD

Description:
	Enabling the bad sector handling in the SMD (xp.c) driver
	would cause the system to hang on first access to a drive.

Repeat-By:
	Set BADSECT to YES in the kernel config file, config a kernel and
	attempt to boot it.  The disk activity light will come on but nothing
	will happen.

Fix:
	When disklabels were added the closing brace ('}') around the 
	section of code which reads the badblock list was left a few
	lines too high.

	On the first access to a drive the kernel inserts into the drive
	queue a request to read the badblock list from the end of the pack.

	This is only supposed to happen once after a drive comes online,
	not before each read/write request!  The driver ended up continually
	reading the badblock list.

	Cut where indicated, saving to a file (/tmp/278).  Then:

		patch -p0 < /tmp/278

	If you are using SMD drives you may wish to recompile the kernel
	but it is not necessary.  The change will take effect if/when ever
	you enable the BADSECT option.

==================cut here=================
*** /sys/pdpuba/xp.c.old	Tue Aug 22 20:04:54 1995
--- /sys/pdpuba/xp.c	Mon Nov 20 09:20:46 1995
***************
*** 3,9 ****
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)xp.c	2.2 (2.11BSD GTE) 1995/08/21
   */
  
  /*
--- 3,9 ----
   * All rights reserved.  The Berkeley software License Agreement
   * specifies the terms and conditions for redistribution.
   *
!  *	@(#)xp.c	2.3 (2.11BSD GTE) 1995/11/20
   */
  
  /*
***************
*** 497,503 ****
  #ifdef	XPDEBUG
  		log(LOG_NOTICE, "xp%d preset done\n", unit);
  #endif
! 	}
  /*
   * XXX - The 'h' partition is used below to access the bad block area.  This
   * XXX - will almost certainly be wrong if the user has defined another 
--- 497,503 ----
  #ifdef	XPDEBUG
  		log(LOG_NOTICE, "xp%d preset done\n", unit);
  #endif
! 
  /*
   * XXX - The 'h' partition is used below to access the bad block area.  This
   * XXX - will almost certainly be wrong if the user has defined another 
***************
*** 518,523 ****
--- 518,524 ----
  		bbp->av_forw = bp;
  		bp = bbp;
  #endif BADSECT
+ 	}
  
  #if NXPD > 1
  	/*
*** /VERSION.old	Mon Oct 30 21:51:20 1995
--- /VERSION	Tue Nov 21 13:14:53 1995
***************
*** 1,4 ****
! Current Patch Level: 277
  
  2.11 BSD
  ============
--- 1,4 ----
! Current Patch Level: 278
  
  2.11 BSD
  ============