st: clear ILI if Medium Error
authorKai Makisara <Kai.Makisara@kolumbus.fi>
Mon, 18 Apr 2016 05:47:18 +0000 (08:47 +0300)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 26 Apr 2016 02:08:16 +0000 (22:08 -0400)
Some drives set the ILI flag together with MEDIUM ERROR sense code.
Clear the ILI flag in this case so that the medium error will be
handled.  The problem was reported by Maurizio Lombardi.

Signed-off-by: Kai Mäkisara <kai.makisara@kolumbus.fi>
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/st.c

index dbf1882..7af5226 100644 (file)
@@ -1974,9 +1974,12 @@ static long read_tape(struct scsi_tape *STp, long count,
                                        transfer = (int)cmdstatp->uremainder64;
                                else
                                        transfer = 0;
-                               if (STp->block_size == 0 &&
-                                   cmdstatp->sense_hdr.sense_key == MEDIUM_ERROR)
-                                       transfer = bytes;
+                               if (cmdstatp->sense_hdr.sense_key == MEDIUM_ERROR) {
+                                       if (STp->block_size == 0)
+                                               transfer = bytes;
+                                       /* Some drives set ILI with MEDIUM ERROR */
+                                       cmdstatp->flags &= ~SENSE_ILI;
+                               }
 
                                if (cmdstatp->flags & SENSE_ILI) {      /* ILI */
                                        if (STp->block_size == 0 &&