st.c & MTEOM

Laurent Pinchart <[email protected]> Fri, 9 Aug 2002 16:20:54 +0200
Newsgroups gmane.linux.tape
Organization Capflow
Message-ID <[email protected]>
Hi everybody,

Having experienced problems with the `mt eom' command which returns an 
Input/Output error, I tried to investigate what happened inside st.c

I traced the problem down to st_int_ioctl. The MTEOM code looks like this:

        case MTEOM:
                if (!STp->fast_mteom) {
                        /* space to the end of tape */
                        ioctl_result = st_int_ioctl(STp, MTFSF, 0x7fffff);
                        fileno = STps->drv_file;
                        if (STps->eof >= ST_EOD_1)
                                return 0;
                        /* The next lines would hide the number of spaced
                           FileMarks. That's why I inserted the previous 
                           lines. I had no luck with detecting EOM with FSF, 
                           so we go now to EOM.
                           Joerg Weule */
                } else
                        fileno = (-1);
                cmd[0] = SPACE;
                cmd[1] = 3;
                blkno = 0;
                at_sm = 0;
                break;

The st_int_ioctl(STp, MTFSF, 0x7fffff) function, which send its SCSI command 
synchronuously (st_do_scsi is called with do_wait set to true, and thus calls 
wait_for_completion), succeed instead of reporting a BLANK_CHECK sense key. 
Thus, STps->eof is not set to ST_EOD, and the code above falls back to SPACE 
EOM.

Then when the SPACE EOM SCSI command is sent, it receives a defered error:

st0: error code: 0x71, segment number: 0, sense key: BLANK_CHECK
st0: sense bits: VALID.
st0: undone: 0x7fffff
st0: ASC: 0x00 ASCQ: 0x05 (End of Data Detected)

which should have been received by the previous command (SPACE FileMarks). 
This causes the ioctl to return with an error code, and mt to fail with 
Input/Output error.

Does anyone have any idea regarding to why the error is received as a deferred 
error (0x71) and not a current error (0x70) ?

Any help will be appreciated.

Laurent Pinchart

-
To unsubscribe from this list: send the line "unsubscribe linux-tape" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html