From patchwork Wed Feb 15 00:25:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9573123 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AA6F0600F6 for ; Wed, 15 Feb 2017 00:27:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DC23205D6 for ; Wed, 15 Feb 2017 00:27:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 925EA28438; Wed, 15 Feb 2017 00:27:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52993205D6 for ; Wed, 15 Feb 2017 00:27:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751460AbdBOA11 (ORCPT ); Tue, 14 Feb 2017 19:27:27 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:10192 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750923AbdBOA1Z (ORCPT ); Tue, 14 Feb 2017 19:27:25 -0500 X-IronPort-AV: E=Sophos;i="5.35,163,1483977600"; d="scan'208";a="81774827" Received: from unknown (HELO milsmgep15.sandisk.com) ([63.163.107.21]) by ob1.hgst.iphmx.com with ESMTP; 15 Feb 2017 08:43:10 +0800 Received: from MILHUBIP04.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id D6.E4.57638.A20A3A85; Tue, 14 Feb 2017 16:26:18 -0800 (PST) Received: from milsmgip11.sandisk.com (10.177.9.6) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Tue, 14 Feb 2017 16:26:15 -0800 X-AuditID: 0ac94369-26dee9800001e126-68-58a3a02a2586 Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 09.7D.11415.720A3A85; Tue, 14 Feb 2017 16:26:15 -0800 (PST) From: Bart Van Assche To: "Nicholas A . Bellinger" CC: , Bart Van Assche , Hannes Reinecke , Christoph Hellwig , David Disseldorp Subject: [PATCH v6 06/33] target: Fix handling of aborted failed commands Date: Tue, 14 Feb 2017 16:25:45 -0800 Message-ID: <20170215002612.14566-7-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170215002612.14566-1-bart.vanassche@sandisk.com> References: <20170215002612.14566-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPLMWRmVeSWpSXmKPExsXCddJ5ka7WgsURBv82Glp8/T+dxWLBm71s FitXH2WyaFt9htGidelbJgdWj/vbjzB57L7ZwOaxfstVFo/Np6s9Pm+SC2CN4rJJSc3JLEst 0rdL4Mo4+XM1U8Eazoqz296xNzB+Ze9i5OSQEDCRmNL8mxXEFhJYyiTR9kisi5ELyN7GKPHi 0mdGmKInz3YxQyQ2Mkq82XyTBSTBJmAk8e39TDBbBMhe3bOMCaSIWWA7o8T1KW/BEsICnhL/ f34DW8EioCox8fAtsDivgL3En1lHWSA2yEvsarsIVsMp4CAxY8dJoDgH0DZ7iUdnrEFmSghM YpV4s2g2M0SvoMTJmU/AepkFJCQOvnjBDPGCusTJJfOZJjAKzUJSNgtJ2QJGplWMYrmZOcW5 6akFhqZ6xYl5KZnF2XrJ+bmbGCHBnrmD8e4T70OMAhyMSjy8J2QXRwixJpYVV+YeYpTgYFYS 4WWrBwrxpiRWVqUW5ccXleakFh9ilOZgURLnPSczNUJIID2xJDU7NbUgtQgmy8TBKdXAOM/5 5hNPwXkZIu9YAsqmtHY+tbk759HavqyD66ayics/Cg1Z/LfvaopNl9/jCeHPH64qr1rKkJzp YXDM7P+3jf8eJvqsZFcUvyL5PK99zrq5W84LnQpv0dtaVBHy23zd89/bd3zzPXbZUDUkS7vS 9VPTQvbvEXnlUzJ9fLedWX5weeeWkw7fJymxFGckGmoxFxUnAgAvh8/zcgIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrPJMWRmVeSWpSXmKPExsXCtZGTTVd9weIIg72XeC0O/mxjtPj6fzqL xYI3e9ksVq4+ymTRtvoMo0Xr0rdMDmwe97cfYfLYfbOBzWPamvNMHuu3XGXx2Hy62uPzJrkA tigum5TUnMyy1CJ9uwSujJM/VzMVrOGsOLvtHXsD41f2LkZODgkBE4knz3YxdzFycQgJrGeU OD7/NhtIgk3ASOLb+5ksILYIkL26ZxkTSBGzwE5GiR1npjKBJIQFPCX+//zGCmKzCKhKTDx8 C6yBV8BeYsrudiaIDfISu9ougtVwCjhIzNhxEqiGA2ibvcSjM9YTGLkXMDKsYhTLzcwpzk3P LDA01CtOzEvJLM7WS87P3cQICZLIHYxPJ5ofYmTi4JRqYCyRbO5Lv9RqfG3DuzPVfjt9ysxm 5uqKqmV6h90y/HjBS1kmb0dvS0ifv/GB47X8rGv+KGYx1qUXeXRb3rF7I72sItR4k+mlFMXC 0/N+ndt1hm1O9Q/PEGXvGj4z8xPi8bHHF5Wwmn1w9oxd1ic/U0S0ku+6X/lRng3cm5Mmrled 6/1S3dVBiaU4I9FQi7moOBEAlDRr+cIBAAA= MIME-Version: 1.0 Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If a target driver (e.g. tcm_qla2xxx) calls transport_generic_request_failure() to report that receiving data has failed and that SCSI command has already been aborted by the initiator, ensure that the SCSI status ABORTED is sent back to the initiator instead of the sense code provided by the target driver. Signed-off-by: Bart Van Assche Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: David Disseldorp --- drivers/target/target_core_transport.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 22190003534d..efb9e6f38201 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1647,6 +1647,9 @@ void transport_generic_request_failure(struct se_cmd *cmd, { int ret = 0, post_ret = 0; + if (transport_check_aborted_status(cmd, 1)) + return; + pr_debug("-----[ Storage Engine Exception for cmd: %p ITT: 0x%08llx" " CDB: 0x%02x\n", cmd, cmd->tag, cmd->t_task_cdb[0]); pr_debug("-----[ i_state: %d t_state: %d sense_reason: %d\n",