From patchwork Mon Apr 18 05:47:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Kai_M=C3=A4kisara_=28Kolumbus=29?= X-Patchwork-Id: 8868031 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9667D9F36E for ; Mon, 18 Apr 2016 05:55:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 18405201DD for ; Mon, 18 Apr 2016 05:55:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B77622015A for ; Mon, 18 Apr 2016 05:55:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751174AbcDRFzY (ORCPT ); Mon, 18 Apr 2016 01:55:24 -0400 Received: from vs19.mail.saunalahti.fi ([62.142.117.200]:50241 "EHLO vs19.mail.saunalahti.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750931AbcDRFzX (ORCPT ); Mon, 18 Apr 2016 01:55:23 -0400 X-Greylist: delayed 475 seconds by postgrey-1.27 at vger.kernel.org; Mon, 18 Apr 2016 01:55:23 EDT Received: from vams (localhost [127.0.0.1]) by vs19.mail.saunalahti.fi (Postfix) with SMTP id 0628D28014F; Mon, 18 Apr 2016 08:47:26 +0300 (EEST) Received: from gw02.mail.saunalahti.fi (gw02.mail.saunalahti.fi [195.197.172.116]) by vs19.mail.saunalahti.fi (Postfix) with ESMTP id D0945280143; Mon, 18 Apr 2016 08:47:25 +0300 (EEST) Received: from kai.makisara.private (a88-115-178-128.elisa-laajakaista.fi [88.115.178.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gw02.mail.saunalahti.fi (Postfix) with ESMTPSA id A37084005E; Mon, 18 Apr 2016 08:47:23 +0300 (EEST) Date: Mon, 18 Apr 2016 08:47:18 +0300 (EEST) From: Kai Makisara To: linux-scsi@vger.kernel.org cc: mlombard@redhat.com Subject: [PATCH] st: clear ILI if Medium Error Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/scsi/st.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/drivers/scsi/st.c 2016-04-17 21:22:15.671897001 +0300 +++ b/drivers/scsi/st.c 2016-04-17 22:25:39.234321293 +0300 @@ -1974,9 +1974,12 @@ static long read_tape(struct scsi_tape * 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 &&