From cmascott@world.std.com  Fri Jan  7 18:41:18 2000
Return-Path: <cmascott@world.std.com>
Received: from europe.std.com (europe.std.com [199.172.62.20])
	by hub.freebsd.org (Postfix) with ESMTP id A051B14D8F
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  7 Jan 2000 18:41:13 -0800 (PST)
	(envelope-from cmascott@world.std.com)
Received: from world.std.com (root@world-f.std.com [199.172.62.5])
	by europe.std.com (8.9.3/8.9.3) with ESMTP id VAA26384
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 7 Jan 2000 21:41:06 -0500 (EST)
Received: (from cmascott@localhost)
	by world.std.com (8.9.3/8.9.3) id VAA17638
	for FreeBSD-gnats-submit@freebsd.org; Fri, 7 Jan 2000 21:38:20 -0500 (EST)
Message-Id: <200001080238.VAA17638@world.std.com>
Date: Fri, 7 Jan 2000 21:38:20 -0500 (EST)
From: cmascott@world.std.com
Reply-To: cmascott@world.std.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: Bug in cam_periph.c:cam_periph_error()
X-Send-Pr-Version: 3.2

>Number:         15975
>Category:       kern
>Synopsis:       Bug in cam_periph.c:cam_periph_error()
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ken
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan  7 18:50:01 PST 2000
>Closed-Date:    Tue Jan 25 09:53:00 PST 2000
>Last-Modified:  Tue Jan 25 09:54:18 PST 2000
>Originator:     Carl Mascott
>Release:        FreeBSD 3.3-RELEASE i386
>Organization:
>Environment:

	FreeBSD 3.3-RELEASE i386
	FreeBSD 3.4-RELEASE i386
	FreeBSD 4.0-current as of 12/24/99

>Description:

	Inspection of source code revealed the bug shown below.
	No symptoms observed, not known how to get the kernel
	to take the path to the suspect code.
	Looks like a bug to me.
	Looks like a bug to Kenneth Merry.
	If it looks like a bug to Justin Gibbs, then please
	commit the fix below.

>How-To-Repeat:

	As stated above, no symptoms observed.

>Fix:
	
Baseline for the following patch is cam_periph.c v 1.9.2.7 (3.3-RELEASE).

*** sys/cam/cam_periph.c.org	Sun Aug 29 12:21:38 1999
--- sys/cam/cam_periph.c	Thu Dec 23 11:40:40 1999
***************
*** 1434,1454 ****
  				   SCSI_STATUS_CHECK_COND
  				&& status != CAM_AUTOSENSE_FAIL) {
  				/* no point in decrementing the retry count */
  				panic("cam_periph_error: scsi status of "
  				      "CHECK COND returned but no sense "
  				      "information is availible.  "
  				      "Controller should have returned "
  				      "CAM_AUTOSENSE_FAILED");
  				/* NOTREACHED */
  				error = EIO;
! 			} else if (ccb->ccb_h.retry_count > 0) {
  				/*
  				 * XXX KDM shouldn't there be a better
  				 * argument to return??
  				 */
  				error = EIO;
  			} else {
  				/* decrement the number of retries */
  				retry = ccb->ccb_h.retry_count > 0;
  				if (retry)
  					ccb->ccb_h.retry_count--;
--- 1434,1454 ----
  				   SCSI_STATUS_CHECK_COND
  				&& status != CAM_AUTOSENSE_FAIL) {
  				/* no point in decrementing the retry count */
  				panic("cam_periph_error: scsi status of "
  				      "CHECK COND returned but no sense "
  				      "information is availible.  "
  				      "Controller should have returned "
  				      "CAM_AUTOSENSE_FAILED");
  				/* NOTREACHED */
  				error = EIO;
! 			} else if (ccb->ccb_h.retry_count == 0) {
  				/*
  				 * XXX KDM shouldn't there be a better
  				 * argument to return??
  				 */
  				error = EIO;
  			} else {
  				/* decrement the number of retries */
  				retry = ccb->ccb_h.retry_count > 0;
  				if (retry)
  					ccb->ccb_h.retry_count--;


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed 
State-Changed-By: ken 
State-Changed-When: Fri Jan 7 19:55:17 PST 2000 
State-Changed-Why:  
I've looked at it, and it appears to be a bug. 


Responsible-Changed-From-To: freebsd-bugs->ken 
Responsible-Changed-By: ken 
Responsible-Changed-When: Fri Jan 7 19:55:17 PST 2000 
Responsible-Changed-Why:  
I'll handle this.  I asked Carl to submit a PR so I don't forget to do 
something about this. 
State-Changed-From-To: analyzed->closed 
State-Changed-By: ken 
State-Changed-When: Tue Jan 25 09:53:00 PST 2000 
State-Changed-Why:  
Patch committed in rev 1.24 of cam_periph.c in -current and rev 1.9.2.10 
of cam_periph.c in -stable. 
Thanks! 
>Unformatted:
