Subject: please review: fix for kern/2727
To: None <tech-kern@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-kern
Date: 01/05/2002 15:31:15
--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii

Hi,
kern/2727 describe a problem with fixed block tape drives, when an error occurs
and sense->info isn't valid (panic because done < 0). I believe the problem
is still here, and if I understood things properly, it's because when info
isn't valid we set info to xs->datalen, which is in byte where the code
for fixed block assume it's in blocks. I think the attached patch fixes the
problem. Can someone else have a look ?

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
--

--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff-st

Index: st.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/scsipi/st.c,v
retrieving revision 1.148
diff -u -r1.148 st.c
--- st.c	2001/12/07 11:26:30	1.148
+++ st.c	2002/01/05 14:32:00
@@ -2007,7 +2007,8 @@
 	if (sense->error_code & SSD_ERRCODE_VALID)
 		info = _4btol(sense->info);
 	else
-		info = xs->datalen;	/* bad choice if fixed blocks */
+		info = (st->flags & ST_FIXEDBLOCKS) ?
+		    xs->datalen / st->blksize : xs->datalen;
 	key = sense->flags & SSD_KEY;
 	st->mt_erreg = key;
 	st->asc = sense->add_sense_code;

--azLHFNyN32YCQGCU--