Subject: Re: kern/29369
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Frank Kardel <Frank.Kardel@Acrys.COM>
List: netbsd-bugs
Date: 02/16/2005 16:56:01
The following reply was made to PR kern/29369; it has been noted by GNATS.

From: Frank Kardel <Frank.Kardel@Acrys.COM>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/29369
Date: Wed, 16 Feb 2005 17:55:41 +0100

 Analysis gives following observations:
 1) Hardcoded(!) timeout for PREVENT/ALLOW was not sufficient.
      For Overland Tape Libraries significant longer timeouts are needed.
 2) The HP Ultrium Drive does not detect EOM by the presence
      of two file marks. Nevertheless the st driver assumes this and
      a single written file turns out to be the file and an empty file
      upon read. Also 2 "mt fsf" are possible. This behavior
      is very irritating to backup programs like bacula.
 
 A patch for review with a driver fix on quirk basis is below:
 
 Shouldn't scsi commend timeout be settable by sysctl interface?
 
 Anyhow the issue with processes being hung after a scsi timeout still
 remains for the ahc driver and poses a significant productional risk.
 
 Handle HP Ultrium 2-SCSI drive (quirk):
 Index: st.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/scsipi/st.c,v
 retrieving revision 1.163.4.1
 diff -c -c -r1.163.4.1 st.c
 *** st.c        11 Sep 2004 12:58:36 -0000      1.163.4.1
 --- st.c        16 Feb 2005 16:47:48 -0000
 ***************
 *** 309,314 ****
 --- 309,321 ----
                 {0, 0, 0},                             /* minor 8-11 */
                 {0, 0, 0}                              /* minor 12-15 */
         }}},
 +       {{T_SEQUENTIAL, T_REMOV,
 +        "HP", "Ultrium 2-SCSI", ""},     {ST_Q_NO2FMATEOM, 0, {
 +               {0, 0, 0},                             /* minor 0-3 */
 +               {0, 0, 0},                             /* minor 4-7 */
 +               {0, 0, 0},                             /* minor 8-11 */
 +               {0, 0, 0}                              /* minor 12-15 */
 +       }}},
   };
  
   #define NOEJECT 0
 ***************
 *** 923,928 ****
 --- 930,942 ----
                         return (error);
                 }
         }
 +       if (st->quirks & ST_Q_NO2FMATEOM) {
 +               st->flags &= ~ST_2FM_AT_EOD;
 +               SC_DEBUG(st->sc_periph, SCSIPI_DB3,
 +                   ("EOM not signalled by 2 FM\n"));
 +       } else {
 +               st->flags |= ST_2FM_AT_EOD;
 +       }
         st->flags &= ~ST_NEW_MOUNT;
         st->flags |= ST_MOUNTED;
         periph->periph_flags |= PERIPH_MEDIA_LOADED;    /* move earlier? */
 ***************
 *** 2328,2334 ****
                     (periph->periph_flags & PERIPH_MEDIA_LOADED) == 0) {
                         /* still starting */
                         st->blksize -= 512;
 !               } else if (!(st->flags & (ST_2FM_AT_EOD | ST_BLANK_READ))) {
                         st->flags |= ST_BLANK_READ;
                         xs->resid = xs->datalen;
                         if (bp) {
 --- 2342,2348 ----
                     (periph->periph_flags & PERIPH_MEDIA_LOADED) == 0) {
                         /* still starting */
                         st->blksize -= 512;
 !               } else if (!((st->flags & (ST_2FM_AT_EOD | 
 ST_BLANK_READ)) || (st->quirks & ST_Q_NO2FMATEOM))) {
                         st->flags |= ST_BLANK_READ;
                         xs->resid = xs->datalen;
                         if (bp) {
 Index: stvar.h
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/scsipi/stvar.h,v
 retrieving revision 1.6.8.1
 diff -c -c -r1.6.8.1 stvar.h
 *** stvar.h     11 Sep 2004 12:59:29 -0000      1.6.8.1
 --- stvar.h     16 Feb 2005 16:47:48 -0000
 ***************
 *** 86,91 ****
 --- 86,93 ----
   #define       ST_Q_NOPREVENT          0x0020  /* does not support 
 PREVENT */
   #define       ST_Q_ERASE_NOIMM        0x0040  /* drive rejects ERASE/w 
 Immed bit */
   #define       ST_Q_NOFILEMARKS        0x0080  /* can only write 0 
 filemarks */
 + #define ST_Q_NO2FMATEOM               0x0100  /* EOM is not signaledd 
 by 2 FM - QIC
 +                                            like behaviour - used for 
 LTO */
         u_int page_0_size;
   #define       MAX_PAGE_0_SIZE 64
         struct modes modes[4];
 
 Frank