[1824] in linux-scsi channel archive

home help back first fref pref prev next nref lref last post

Incorrect block number returned by MTIOCGET?

daemon@ATHENA.MIT.EDU (Jan Echternach)
Wed May 7 12:20:44 1997

Date: 	Wed, 7 May 1997 14:14:05 +0200
From: Jan Echternach <echter@informatik.uni-rostock.de>
To: linux-scsi@vger.rutgers.edu
Reply-To: Jan Echternach <jan.echternach@informatik.uni-rostock.de>

Hi,

When I was tracking down a problem with taper (seeking didn't work
somehow), I found out that MTIOCGET can return a block number that
seems incorrect to me:

1. open rewinding device
2. write some data, write filemark, write more data
3. close
4. open non-rewinding device
3. seek to filemark
4. close
5. open rewinding device
6. MTIOCPOS -> block 12
7. MTIOCGET -> block 0  (Is this correct?)


Now something different: When I was browsing through st.c, I found
this code:

> scsi_tape_open():
>     if ((STp->buffer)->last_result_fatal != 0) {
>       if ((SCpnt->sense_buffer[0] & 0x70) == 0x70 &&
>           (SCpnt->sense_buffer[2] & 0x0f) == NO_TAPE) {
>         (STp->mt_status)->mt_fileno = STp->drv_block = 0 ;
>         STp->ready = ST_NO_TAPE;
>       } else {
>         (STp->mt_status)->mt_fileno = STp->drv_block = (-1);
>         STp->ready = ST_NOT_READY;
>       }
>       SCpnt->request.rq_status = RQ_INACTIVE;  /* Mark as not busy */
>       STp->density = 0;         /* Clear the erroneous "residue" */
>       STp->write_prot = 0;
>       STp->block_size = 0;
>       STp->eof = ST_NOEOF;
>       (STp->mt_status)->mt_fileno = STp->drv_block = 0;
>       STp->partition = STp->new_partition = 0;
>       STp->door_locked = ST_UNLOCKED;
>       STp->in_use = 1;
>       return 0;
>     }

It looks like this:

if (c1) {
  if (c2) {
    drv_block = 0;
    ...
  } else {
    drv_block = -1;
    ...
  }
  ...
  drv_block = 0;
  ...
}

Is this a bug?


System:
  Linux-2.0.30
  Buslogic BT-948
  SDT-7000 DDS-2 DAT drive, SCSI-2

--
Jan

home help back first fref pref prev next nref lref last post