Subject: kern/3007: SCSI error handling bug.
To: None <gnats-bugs@gnats.netbsd.org>
From: =?ISO-2022-JP?B?Ik1JTk9VUkEgTWFrb3RvIC8gGyRCTCcxOhsoQiAbJEI/PxsoQiI=?= <minoura@kw.netlaputa.or.jp>
List: netbsd-bugs
Date: 12/08/1996 17:43:15
>Number:         3007
>Category:       kern
>Synopsis:       SCSI error handling bug.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec  8 04:05:01 1996
>Last-Modified:
>Originator:     Naofumi HONDA / MINOURA Makoto
>Organization:
NetBSD/pc98 Core Team
>Release:        Dec. 7
>Environment:
System: NetBSD daisy 1.2B NetBSD 1.2B (DAISY) #7: Sat Dec 7 19:09:41 JST 1996 root@daisy:/usr/src/sys/arch/i386/compile/DAISY i386


>Description:
	When the media is unloaded, ??start aborts.
	Here, buffer's b_resid should be set appropriately.
>How-To-Repeat:
>Fix:
diff -rc scsi.ORIG/cd.c scsi/cd.c
*** scsi.ORIG/cd.c	Thu Dec  5 21:19:57 1996
--- scsi/cd.c	Sun Dec  8 17:33:33 1996
***************
*** 538,543 ****
--- 538,544 ----
  		if ((sc_link->flags & SDEV_MEDIA_LOADED) == 0) {
  			bp->b_error = EIO;
  			bp->b_flags |= B_ERROR;
+ 			bp->b_resid = bp->b_bcount;
  			biodone(bp);
  			continue;
  		}
diff -rc scsi.ORIG/sd.c scsi/sd.c
*** scsi.ORIG/sd.c	Thu Dec  5 21:19:58 1996
--- scsi/sd.c	Sun Dec  8 17:34:22 1996
***************
*** 563,568 ****
--- 563,569 ----
  		if ((sc_link->flags & SDEV_MEDIA_LOADED) == 0) {
  			bp->b_error = EIO;
  			bp->b_flags |= B_ERROR;
+ 			bp->b_resid = bp->b_bcount;
  			biodone(bp);
  			continue;
  		}
*** scsi.ORIG/st.c	Thu Dec  5 21:19:59 1996
--- scsi/st.c	Sun Dec  8 17:34:54 1996
***************
*** 957,962 ****
--- 957,963 ----
  			sc_link->flags &= ~SDEV_MEDIA_LOADED;
  			bp->b_flags |= B_ERROR;
  			bp->b_error = EIO;
+ 			bp->b_resid = bp->b_bcount;
  			biodone(bp);
  			continue;
  		}
>Audit-Trail:
>Unformatted: