Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Apr 1995 00:50:01 -0700
From:      edward@edcom.com
To:        freebsd-bugs
Subject:   kern/331: SCSI tape short-read failure
Message-ID:  <199504100750.AAA00666@freefall.cdrom.com>
In-Reply-To: Your message of Mon, 10 Apr 1995 00:45:50 -0700 <199504100745.AAA01711@edcom.com>

next in thread | previous in thread | raw e-mail | index | archive | help

>Number:         331
>Category:       kern
>Synopsis:       a read that returns short on a SCSI tape fails
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs (FreeBSD bugs mailing list)
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 10 00:50:00 1995
>Originator:     Edward Wang
>Organization:
feh!
>Release:        FreeBSD 2.1.0-Development i386
>Environment:

	2.0-950322-SNAP

>Description:

	On a SCSI tape (and really other devices with similar
	characteristics), a read of a record smaller than
	the request size always fails.

>How-To-Repeat:

	find a SCSI tape drive
	put a tape in
	do
		dd if=/dev/zero of=/dev/rst0 bs=1b count=1
		dd if=/dev/rst0 of=/dev/null bs=1k count=1
	the read fails when it should return 512 bytes

>Fix:
	
*** scsi_base.c.dist	Tue Mar 21 03:21:01 1995
--- scsi_base.c	Sun Apr  9 22:56:52 1995
***************
*** 593,604 ****
  				xs->flags &= ~ITSDONE;
  				goto retry;
  			}
  		}
- 		retval = EIO;	/* Too many retries */
  
  		if (bp) {
  			bp->b_error = 0;
- 			bp->b_resid = 0;
  			if (retval) {
  				bp->b_flags |= B_ERROR;
  				bp->b_error = retval;
--- 593,603 ----
  				xs->flags &= ~ITSDONE;
  				goto retry;
  			}
+ 			retval = EIO;	/* Too many retries */
  		}
  
  		if (bp) {
  			bp->b_error = 0;
  			if (retval) {
  				bp->b_flags |= B_ERROR;
  				bp->b_error = retval;


The first change (position of retval = EIO) is the bug.
The second change is to return the correct b_resid.
The second problem seems to be in the 1.1.5.1 code as well.
It's less used so possibly nobody noticed.  I can't be sure
it doesn't affect something else -- something that doesn't
set b_resid correctly and relies on this to clear it.
However, I'm running this on a machine with SCSI disks and tapes.
They seem to work.
>Audit-Trail:
>Unformatted:





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199504100750.AAA00666>