From patchwork Mon Jul 6 13:15:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 6723681 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5C0DCC05AC for ; Mon, 6 Jul 2015 13:16:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 84DF1205DA for ; Mon, 6 Jul 2015 13:16:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 42F58205E1 for ; Mon, 6 Jul 2015 13:16:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755185AbbGFNQB (ORCPT ); Mon, 6 Jul 2015 09:16:01 -0400 Received: from [193.47.165.129] ([193.47.165.129]:53560 "EHLO mellanox.co.il" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1755260AbbGFNP6 (ORCPT ); Mon, 6 Jul 2015 09:15:58 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from sagig@mellanox.com) with ESMTPS (AES256-SHA encrypted); 6 Jul 2015 16:14:52 +0300 Received: from r-vnc05.mtr.labs.mlnx (r-vnc05.mtr.labs.mlnx [10.208.0.115]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id t66DFDtL010561; Mon, 6 Jul 2015 16:15:13 +0300 Received: from r-vnc05.mtr.labs.mlnx (localhost [127.0.0.1]) by r-vnc05.mtr.labs.mlnx (8.14.4/8.14.4) with ESMTP id t66DFD5e002623; Mon, 6 Jul 2015 16:15:13 +0300 Received: (from sagig@localhost) by r-vnc05.mtr.labs.mlnx (8.14.4/8.14.4/Submit) id t66DFDRT002622; Mon, 6 Jul 2015 16:15:13 +0300 From: Sagi Grimberg To: target-devel@vger.kernel.org, linux-scsi@vger.kernel.org Cc: "Nicholas A. Bellinger" , Bart Van Assche , Christoph Hellwig , Hannes Reinecke Subject: [PATCH v3 5/5] target: Fix wrong setting of sense format for PI errors Date: Mon, 6 Jul 2015 16:15:08 +0300 Message-Id: <1436188508-1539-6-git-send-email-sagig@mellanox.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1436188508-1539-1-git-send-email-sagig@mellanox.com> References: <1436188508-1539-1-git-send-email-sagig@mellanox.com> 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.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 PI errors should be reported in a descriptor format sense data. Fix that by adding a desc_format flag to struct sense_info and pass it to scsi_build_sense_buffer() to do the right thing. Signed-off-by: Sagi Grimberg --- drivers/target/target_core_transport.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 0181f8b..79bb8d1 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -2625,6 +2625,7 @@ struct sense_info { u8 asc; u8 ascq; bool add_sector_info; + int desc_format; }; static const struct sense_info sense_info_table[] = { @@ -2708,18 +2709,21 @@ static const struct sense_info sense_info_table[] = { .asc = 0x10, .ascq = 0x01, /* LOGICAL BLOCK GUARD CHECK FAILED */ .add_sector_info = true, + .desc_format = 1, }, [TCM_LOGICAL_BLOCK_APP_TAG_CHECK_FAILED] = { .key = ILLEGAL_REQUEST, .asc = 0x10, .ascq = 0x02, /* LOGICAL BLOCK APPLICATION TAG CHECK FAILED */ .add_sector_info = true, + .desc_format = 1, }, [TCM_LOGICAL_BLOCK_REF_TAG_CHECK_FAILED] = { .key = ILLEGAL_REQUEST, .asc = 0x10, .ascq = 0x03, /* LOGICAL BLOCK REFERENCE TAG CHECK FAILED */ .add_sector_info = true, + .desc_format = 1, }, [TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE] = { /* @@ -2758,7 +2762,7 @@ static void translate_sense_reason(struct se_cmd *cmd, sense_reason_t reason) ascq = si->ascq; } - scsi_build_sense_buffer(0, buffer, si->key, asc, ascq); + scsi_build_sense_buffer(si->desc_format, buffer, si->key, asc, ascq); if (si->add_sector_info) scsi_set_sense_information(buffer, cmd->bad_sector); }