When doing a goto End Of Data operation using an fsf(1) loop, sd does a read() on each iteration to check whether it reached EOD yet. It expects two things: 1. read() to return 0 bytes, meaning EOF. 2. read to return error ENOSPC which is, according to the code comment, what IBM drivers tended to do.
Problem is, according to this text http://wiki.zmanda.com/index.php/Tape_Driver_Semantics#Read "What happens when you try to read past EOM varies by kernel driver. Some will continue to return EOF. Others will return an error (typically EIO)." An EIO error would also be likely. And that's exactly what ibm's open source lin_tape driver (which I'm using for my ts2900 autoloader) is doing. It would be possible to patch up lin_tape to return something saner than EIO, however that's not that great a solution – it'd be better if bacula supported such tape drivers out of the box. What I did for my own purposes amounts to this: --- bacula-5.2.13.orig/src/stored/dev.c 2013-02-19 20:21:35.000000000 +0100 +++ bacula-5.2.13/src/stored/dev.c 2013-07-02 17:19:27.775246812 +0200 @@ -1198,6 +1198,8 @@ */ } else if (at_eof() && errno == ENOSPC) { stat = 0; + } else if (errno == EIO) { /* && has_cap(CAP_IOERRATEOM) */ + stat = 0; } else { berrno be; set_eot(); however that has the potential to hide actual io errors, so were it mergeable, CAP_IOERRATEOM would need to default to off. The prefered solution imho would be for sd to check scsi sense data on EIO, cause there's a flag there that would clearly indicate whether the problem is real or if it's just trying to read past EOD. However I don't know if linux has a generic sense data reading api, not to mention there existing a cross- platform one. Or am I missing something? Also, no matter what the preferred solution here would be, btape should, on detecting those EIO's (and it sees them when running the standard tape test checks), suggest possible solutions. --mmazur (Below are some keywords for people with similar issues to be able to find this email via google, please ignore.) ibm ts2900 ts3310 lin_taped: tape_check_result SenseKey: 08 ASC: 00 ASCQ: 05. tape_check_result: Information field: 64512 tape_check_result Encountered EOD. btape: btape: dev.c:716-0 Enter eod btape: dev.c:598-0 rewind res=0 fd=3 "tapeDrive" (/dev/IBMtape0n) btape: dev.c:809-0 eod: doing fsf 1 btape: dev.c:1136-0 fsf btape: dev.c:1181-0 FSF has cap_fsf btape: dev.c:1191-0 Doing read before fsf btape: dev.c:1229-0 Doing MTFSF btape: dev.c:1262-0 Return 0 from FSF btape: dev.c:1264-0 ST_EOF set on exit FSF btape: dev.c:1269-0 Return from FSF file=1 btape: dev.c:809-0 eod: doing fsf 1 btape: dev.c:1133-0 ST_EOF set on entry to FSF btape: dev.c:1136-0 fsf btape: dev.c:1181-0 FSF has cap_fsf btape: dev.c:1191-0 Doing read before fsf btape: dev.c:1206-0 Set ST_EOT read errno=5. ERR=Input/output error btape: dev.c:1209-0 dev.c:1208 read error on "tapeDrive" (/dev/IBMtape0n). ERR=Input/output error. dir job email: JobId 411: 3304 Issuing autochanger "load slot 1, drive 0" command. JobId 411: 3305 Autochanger "load slot 1, drive 0", status is OK. JobId 411: Error: dev.c:1208 read error on "tapeDrive" (/dev/IBMtape0n). ERR=Input/output error. JobId 411: Volume "269BCML5" previously written, moving to end of data. JobId 411: Error: Unable to position to end of data on device "tapeDrive" (/dev/IBMtape0n): ERR=dev.c:1208 read error on "tapeDrive" (/dev/IBMtape0n). ERR=Input/output error. JobId 411: Marking Volume "269BCML5" in Error in Catalog. JobId 411: 3307 Issuing autochanger "unload slot 1, drive 0" command. dir job email with fixed block size (beats me why): bak-sd JobId 533: Error: Bacula cannot write on tape Volume "269BCML5" because: The number of files mismatch! Volume=5 Catalog=6 Also google: [Bacula-devel] TS3310 - possible solution Mariusz Czulada 2007 ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Bacula-devel mailing list Bacula-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-devel