From patchwork Fri Jun 22 21:53:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10483125 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 0F0AA60388 for ; Fri, 22 Jun 2018 21:53:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F197C2903B for ; Fri, 22 Jun 2018 21:53:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6A5529043; Fri, 22 Jun 2018 21:53:20 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 8F0412903C for ; Fri, 22 Jun 2018 21:53:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754240AbeFVVxT (ORCPT ); Fri, 22 Jun 2018 17:53:19 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:20182 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754552AbeFVVxO (ORCPT ); Fri, 22 Jun 2018 17:53:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1529704422; x=1561240422; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=rpH8yLL0XsclP8SPkwO54Uatw/31TZ/59WPiafYY2ck=; b=iMXHCNAOG7Xlg/yLez0WJoOy4yz15QM3CzHVcmmNtHOQo6obPGy9/NUZ yISLK8aPfGrY1Ux5EzudjRQiVWtCAcLeTCYJhHVFrYA1sYr/qUD9L4TbN Td3UDij+JUfGt5TOH+WEhHd+74N/eOYg0RlJRcvZh82cwDJlYOVxbFb6U Sn83+1t1yAOoJxv9Q+x8I4RcRPhgijPOMDDf6+oX1m1KKSSzlbEYG/gmt Fb0iYLONa580u9LE/WNQAs9U6uuKZIv/6Tgo7e+ksqbes6tT7qHrn5KMG Mk99t2jBczY75078CE+calkHgyKa3mr+8Z8biZvS+IAr07KZCKDUicVIO Q==; X-IronPort-AV: E=Sophos;i="5.51,259,1526313600"; d="scan'208";a="178351023" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Jun 2018 05:53:38 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 22 Jun 2018 14:42:59 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com ([10.111.67.248]) by uls-op-cesaip01.wdc.com with ESMTP; 22 Jun 2018 14:53:12 -0700 From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Mike Christie , Hannes Reinecke Subject: [PATCH 17/20] target: Do not duplicate the code that marks that a command has sense data Date: Fri, 22 Jun 2018 14:53:04 -0700 Message-Id: <20180622215307.8758-18-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180622215307.8758-1-bart.vanassche@wdc.com> References: <20180622215307.8758-1-bart.vanassche@wdc.com> 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 This patch does not change any functionality. Signed-off-by: Bart Van Assche Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke --- drivers/target/target_core_transport.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index cb48dbc2c9ba..ebbc7e321cf3 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -2121,9 +2121,6 @@ static void transport_complete_qf(struct se_cmd *cmd) if (cmd->scsi_status) goto queue_status; - cmd->se_cmd_flags |= SCF_EMULATED_TASK_SENSE; - cmd->scsi_status = SAM_STAT_CHECK_CONDITION; - cmd->scsi_sense_length = TRANSPORT_SENSE_BUFFER; translate_sense_reason(cmd, TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE); goto queue_status; } @@ -3199,6 +3196,9 @@ static int translate_sense_reason(struct se_cmd *cmd, sense_reason_t reason) ascq = si->ascq; } + cmd->se_cmd_flags |= SCF_EMULATED_TASK_SENSE; + cmd->scsi_status = SAM_STAT_CHECK_CONDITION; + cmd->scsi_sense_length = TRANSPORT_SENSE_BUFFER; scsi_build_sense_buffer(desc_format, buffer, si->key, asc, ascq); if (si->add_sector_info) return scsi_set_sense_information(buffer, @@ -3225,9 +3225,6 @@ transport_send_check_condition_and_sense(struct se_cmd *cmd, if (!from_transport) { int rc; - cmd->se_cmd_flags |= SCF_EMULATED_TASK_SENSE; - cmd->scsi_status = SAM_STAT_CHECK_CONDITION; - cmd->scsi_sense_length = TRANSPORT_SENSE_BUFFER; rc = translate_sense_reason(cmd, reason); if (rc) return rc;