Subject: [vas@plesnik.de: Patch for st.c (fwd)]
To: None <tech-kern@NetBSD.ORG>
From: Gordon W. Ross <gwr@mc.com>
List: tech-kern
Date: 10/29/1997 13:50:01
Can anyone comments on the correctness of this fix?

Thanks,
Gordon

------- Start of forwarded message -------
Date: Thu, 23 Oct 1997 11:27:01 +0200 (MET DST)
From: Volker Seebode <vas@plesnik.de>
To: gwr@NetBSD.ORG
Subject: Patch for st.c

Hi Gordon,

I think I've found a bug in st.c:
My tape drive often returns the "soft error" condition. This shouldn't
do any harm, because the error is corrected by the tape drive itself.
But NetBSD stops with "strategy broken". I was told, that other
NetBSD users with sun3 machines have the same problem.

The reason is, that in "st.c" the additional information of the sense
code is used to calculate the blocksize of the tape device. The results
are really huge or negativ values, nonsense.
"sys/kern/kern_physio.c/physio()" detects "done < 0" or "done > todoo"
and panics.

My patch (only one additional if statement) now works fine for one year,
so it really seems to fix the problem.

BTW: There seems to be another bug in the SCSI state machine, which makes
it impossible to use a tape drive with si_obio_options=7
(disconnect enabled). Do you know anything about it?

Thanks for your sun3 port of NetBSD!

Regards
 Volker

- --
Volker Seebode                          |  Phone: 0049- 241/930482  |
Ing.-Buro Dr. Plesnik GmbH	        |  Fax:   0049- 241/175542  |
Roermonder Strasse 615                  |  Email: vas@plesnik.de    |
52072 Aachen       Germany              |                           |

- -
If you want to build a ship, don't drum up people
together to collect wood and don't assign them tasks
and work, but rather teach them to long for the endless
immensity of the sea. -- Antoine de Saint Exupery

- ---1463811740-1427567072-877598821=:7468

*** st.old.c	Wed Sep 18 23:12:52 1996
- --- st.c	Mon Nov 18 01:12:23 1996
***************
*** 1688,1692 ****
  		return -1;	/* let the generic code handle it */
  	if (st->flags & ST_FIXEDBLOCKS) {
! 		xs->resid = info * st->blksize;
  		if (sense->flags & SSD_EOM) {
  			st->flags |= ST_EIO_PENDING;
- --- 1688,1696 ----
  		return -1;	/* let the generic code handle it */
  	if (st->flags & ST_FIXEDBLOCKS) {
! #if 1
! 		/* calc resid only if not fixed blocks VS960921 */
! 		if (sense->error_code & SSD_ERRCODE_VALID)
! #endif
! 			xs->resid = info * st->blksize;
  		if (sense->flags & SSD_EOM) {
  			st->flags |= ST_EIO_PENDING;

- ---1463811740-1427567072-877598821=:7468--
------- End of forwarded message -------