Hi all,

I didn't give up so made my own investigation. Now it seems I found the 
source of my problem. I'll describe what I discovered. I need your help 
to verify if it is a good way and how to include required changes into 
bacula code.

First reference materials:

Programming reference (PRGOGREF):
  ftp://ftp.software.ibm.com/storage/devdrvr/Doc/IBM_Tape_Driver_PROGREF.pdf
Setup and operator guide (SOG):
  ftp://ftp.software.ibm.com/storage/3576R1_SOG.pdf

And a remainder of my environment:

 I use an IBM xSeries host with CentOS 4.3. DDS-5 internal drive (working
 perfectly), and IBM TS3310 tape library, with two LTO-3 drives connected
 directly (i mean without FC switch) to two QLogic QLA2460 HBA. IBM tape
 drivers taken from IBM site. Catalog is created in PostgreSQL 8.1.5.
 Bacula 2.0.2. Both pg and bacula compiled from sources.

-----------------

In my case, SD returned errno=5 (EIO) while executing DEVICE::fsf(). Not 
very specific, just "something wrong" message. But, in PROGREF, p. 161 I 
found:

[...]
  For error code EIO, an application can retrieve more information from the
  device itself. Issue the STIOCQRYSENSE ioctl command when the
  sense_type equals LASTERROR, or the SIOC_REQSENSE ioctl command, to
  retrieve sense data. Then analyze the sense data using the appropriate
  hardware or SCSI reference for that device.
[...]

So went to SIOC_REQSENSE chapter for linux driver (p.123). There is an 
example code I added in dev.c:

[...]
  } else if (at_eof() && errno == ENOSPC) {
     stat = 0;
  } else {
     // ************** MQ - begin
     struct request_sense sense_data;
     int rc;
     printf("Issuing request sense...\n");
     memset(&sense_data, 0, sizeof(struct request_sense));
     rc = ioctl(m_fd, SIOC_REQSENSE, &sense_data);
     if (rc == 0)
     {
        if(!sense_data.err_code)
           printf("No valid sense data returned.\n");
        else
        {
          /* print out data fields */
          printf("Information Field Valid Bit-----%d\n", sense_data.valid);
          printf("Error Code----------------------0x%02x\n", 
sense_data.err_code);
          printf("Segment Number------------------0x%02x\n", sense_data.segnum);
          printf("filemark Detected Bit----------%d\n", sense_data.fm);
          printf("End Of Medium Bit---------------%d\n", sense_data.eom);
          printf("Illegal Length Indicator Bit----%d\n", sense_data.ili);
          printf("Sense Key-----------------------0x%02x\n", sense_data.key);
          if(sense_data.valid)
            printf("Information Bytes-------------0x%02x 0x%02x 0x%02x 
0x%02x\n",
                   sense_data.info >> 24, sense_data.info >> 16,
                   sense_data.info >> 8, sense_data.info & 0xFF);
          printf("Additional Sense Length---------0x%02x\n", sense_data.addlen);
          printf("Command Specific Information----0x%02x 0x%02x 0x%02x 
0x%02x\n",
                    sense_data.cmdinfo >> 24, sense_data.cmdinfo >> 16,
                    sense_data.cmdinfo >> 8, sense_data.cmdinfo & 0xFF);
          printf("Additional Sense Code-----------0x%02x\n", sense_data.asc);
          printf("Additional Sense Code Qualifier-0x%02x\n", sense_data.ascq);
          printf("Field Replaceable Unit Code-----0x%02x\n", sense_data.fru);
          printf("Sense Key Specific Valid Bit----%d\n", sense_data.sksv);
          if(sense_data.sksv)
            {
              printf("Command Data Block Bit--%d\n", sense_data.cd);
              printf("Bit Pointer Valid Bit---%d\n", sense_data.bpv);
              if(sense_data.bpv)
                printf("System Information Message-0x%02x\n", sense_data.sim);
              printf("Field Pointer----------------0x%02x%02x\n",
                       sense_data.field[0], sense_data.field[1]);
             }
          //dump_bytes(sense_data.vendor, 109, "Vendor");
        }
     }
     // ************** MQ - end
     berrno be;
     set_eot();
[...]

Almost copy/paste. Also added #include <sys/IBMtape.h>. 'make', then 
'make install'. Then started SD again with -d999 -f. And in the 
problematic code I got following log:

[...]
       Issuing request sense...
       Information Field Valid Bit-----1
       Error Code----------------------0x70
       Segment Number------------------0x00
       filemark Detected Bit----------0
       End Of Medium Bit---------------0
       Illegal Length Indicator Bit----0
       Sense Key-----------------------0x08
       Information Bytes-------------0x00 0x00 0xfc 0x00
       Additional Sense Length---------0x58
       Command Specific Information----0x00 0x00 0x00 0x00
       Additional Sense Code-----------0x00
       Additional Sense Code Qualifier-0x05
       Field Replaceable Unit Code-----0x30
       Sense Key Specific Valid Bit----0
[...]

So I have:
- sense key: 8
- ASC/ASCQ: 00/05

"Drive sense data" chapter in SOG (p.C-8) describes this case as:

[...]
  00 05 - EOD &#8212; Read or Space command terminated early
          because End of Data was encountered
[...]

IMHO it means that it is not *real* error, rather it is a special case 
which shows that EOT was reached. So DEVICE::fsf() should continue it's 
work...

---------------------------------------

At this moment I'd like to ask you to verify if it seems correct and can 
be coded as Yet Another Special Case.


TIA for your comments,

Mariusz Czułada

----------------------------------------------------
Już w ten piątek Ty i Ona o godz. 16:00 w Sopocie na molo! Będziesz?
http://klik.wp.pl/?adr=http%3A%2F%2Fadv.reklama.wp.pl%2Fas%2Fd118.html&sid=1225



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bacula-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to