From patchwork Wed Feb 8 22:24:52 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: 9563643 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 7D02E6020F for ; Wed, 8 Feb 2017 22:28:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4FFF52852D for ; Wed, 8 Feb 2017 22:28:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 452A528531; Wed, 8 Feb 2017 22:28:05 +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 A06D22852D for ; Wed, 8 Feb 2017 22:28:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751603AbdBHW2B (ORCPT ); Wed, 8 Feb 2017 17:28:01 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:63858 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751149AbdBHW15 (ORCPT ); Wed, 8 Feb 2017 17:27:57 -0500 X-IronPort-AV: E=Sophos;i="5.35,348,1483977600"; d="scan'208";a="76618205" Received: from unknown (HELO milsmgep14.sandisk.com) ([63.163.107.225]) by ob1.hgst.iphmx.com with ESMTP; 09 Feb 2017 06:28:23 +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 F6.72.18895.CCA9B985; Wed, 8 Feb 2017 14:25:16 -0800 (PST) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Wed, 8 Feb 2017 14:25:11 -0800 X-AuditID: 0ac94371-0fadb980000049cf-fe-589b9accfbb9 Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 35.42.18148.7CA9B985; Wed, 8 Feb 2017 14:25:11 -0800 (PST) From: Bart Van Assche To: Bart Van Assche CC: , Andy Grover Subject: [PATCH v4 22/37] target: Inline transport_check_aborted_status() Date: Wed, 8 Feb 2017 14:24:52 -0800 Message-ID: <20170208222507.25715-23-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170208222507.25715-1-bart.vanassche@sandisk.com> References: <20170208222507.25715-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrILMWRmVeSWpSXmKPExsXCddJ5ke6ZWbMjDF7PULfYP+sZk0Xr0rdM Dkwe7/ddZfP4vEkugCmKyyYlNSezLLVI3y6BK+Pl+rnMBRcMKlruvWRtYLyo0cXIwSEhYCJx 42tFFyMXh5DAUiaJ/3cPM0E42xklVj7cDORwghXdObyLGcQWEtjIKNG6zhjEZhMwkvj2fiYL iC0iYCDxu/cCI4jNLOAiMe/mB1YQW1jAU2LvqoVgvSwCKhKdm/eCxXkFHCQWbjvECDFfXmJX 20WwOCdQfMLLZ4wQu+wlXh34wghykITAYxaJp5cmMkE0C0qcnPmEBWKZhMTBFy+gjlOXOLlk PtMERqFZSMpmISlbwMi0ilEsNzOnODc9tcDQRK84MS8lszhbLzk/dxMjJGALdzC+vu19iFGA g1GJh/eC9ewIIdbEsuLK3EOMEhzMSiK8KdOAQrwpiZVVqUX58UWlOanFhxilOViUxHmzZKdG CAmkJ5akZqemFqQWwWSZODilGhjzwky4fwbN2VZwL87bTi+xfP2XI87a1ZecnUSXWmU1Hmxj O836U4u5ea6q3u49rwx9WByNfzvPOZpgsSRb8cWC76mOTzSLlWrXMp9faN6kEvKxYdnDd0fj 2tZvfxjtXnpBMN2Ms99T8OYEyauHisu/LDx0qrPMZura0lTny9skY5ezdux10FNiKc5INNRi LipOBACKjP6KVAIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprAJMWRmVeSWpSXmKPExsXCtZGTTff4rNkRBn83GFjsn/WMyeLgzzZG i9alb5kcmD3e77vK5jFtzXkmj8+b5AKYo7hsUlJzMstSi/TtErgyXq6fy1xwwaCi5d5L1gbG ixpdjJwcEgImEncO72IGsYUE1jNKzL/qBmKzCRhJfHs/kwXEFhEwkPjde4Gxi5GDg1nAReLB eXGQsLCAp8TeVQvBWlkEVCVW9H1kB7F5BRwkbq2fzA4xXl5iV9tFVhCbEyg+4eUzRohV9hKv DnxhnMDIvYCRYRWjWG5mTnFuemaBoZFecWJeSmZxtl5yfu4mRoifo3YwXp9ofoiRiYNTqoHR 488GDcv2aFYxlrrT9j5v1LrCd3Le3Hkpm8V7u0jyGdkJjIWT0x3mSW44PTc8xbbKK8n6rPTN Y2cq57SzTYs5oJNwrsptwYvUGE6Nqfnx4Q2m6fay5Wax5m++Fe+7PvHOG4b5M7vsHOaff5YY 2sHwkmOd+2LGQOMUIeaWk7eyDh29Uu+t6KbEUpyRaKjFXFScCABu+ASEowEAAA== 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 Due to the previous patch the second argument of transport_check_aborted_status() is ignored and that function does no longer have any side effect. Hence remove all calls of that function that do not check the return value. Additionally, inline this function. Signed-off-by: Bart Van Assche Reviewed-by: Christoph Hellwig Reviewed-by: Sagi Grimberg Reviewed-by: Hannes Reinecke Cc: Andy Grover --- drivers/infiniband/ulp/srpt/ib_srpt.c | 3 ++- drivers/target/iscsi/iscsi_target.c | 7 +------ drivers/target/iscsi/iscsi_target_erl1.c | 8 +++----- drivers/target/target_core_transport.c | 18 +++++------------- include/target/target_core_fabric.h | 1 - 5 files changed, 11 insertions(+), 26 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index d21ba9d857c3..9241553f796d 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1161,6 +1161,7 @@ static int srpt_abort_cmd(struct srpt_send_ioctx *ioctx) * Do nothing - defer abort processing until * srpt_queue_response() is invoked. */ + WARN_ON_ONCE(!(ioctx->cmd.transport_state & CMD_T_ABORTED)); break; case SRPT_STATE_NEED_DATA: pr_debug("tag %#llx: RDMA read error\n", ioctx->cmd.tag); @@ -2289,7 +2290,7 @@ static void srpt_queue_response(struct se_cmd *cmd) } spin_unlock_irqrestore(&ioctx->spinlock, flags); - if (unlikely(transport_check_aborted_status(&ioctx->cmd, false) + if (unlikely((ioctx->cmd.transport_state & CMD_T_ABORTED) || WARN_ON_ONCE(state == SRPT_STATE_CMD_RSP_SENT))) { atomic_inc(&ch->req_lim_delta); srpt_abort_cmd(ioctx); diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index b4f1d1cbe521..02c4f3f5c2aa 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -1518,8 +1518,6 @@ iscsit_check_dataout_hdr(struct iscsi_conn *conn, unsigned char *buf, if (hdr->flags & ISCSI_FLAG_CMD_FINAL) iscsit_stop_dataout_timer(cmd); - transport_check_aborted_status(se_cmd, - (hdr->flags & ISCSI_FLAG_CMD_FINAL)); return iscsit_dump_data_payload(conn, payload_length, 1); } } else { @@ -1535,11 +1533,8 @@ iscsit_check_dataout_hdr(struct iscsi_conn *conn, unsigned char *buf, */ if (se_cmd->transport_state & CMD_T_ABORTED) { if (hdr->flags & ISCSI_FLAG_CMD_FINAL) - if (--cmd->outstanding_r2ts < 1) { + if (--cmd->outstanding_r2ts < 1) iscsit_stop_dataout_timer(cmd); - transport_check_aborted_status( - se_cmd, 1); - } return iscsit_dump_data_payload(conn, payload_length, 1); } diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c index fe9b7f1e44ac..ee6ac90b9cf5 100644 --- a/drivers/target/iscsi/iscsi_target_erl1.c +++ b/drivers/target/iscsi/iscsi_target_erl1.c @@ -951,8 +951,7 @@ int iscsit_execute_cmd(struct iscsi_cmd *cmd, int ooo) * should be sent after unsolicited data out with * ISCSI_FLAG_CMD_FINAL set in iscsi_handle_data_out() */ - if (transport_check_aborted_status(se_cmd, - (cmd->unsolicited_data == 0)) != 0) + if (se_cmd->transport_state & CMD_T_ABORTED) return 0; /* * Otherwise send CHECK_CONDITION and sense for @@ -980,8 +979,7 @@ int iscsit_execute_cmd(struct iscsi_cmd *cmd, int ooo) * WRITEs if no more unsolicitied data is * expected. */ - if (transport_check_aborted_status(se_cmd, 1) - != 0) + if (se_cmd->transport_state & CMD_T_ABORTED) return 0; iscsit_set_dataout_sequence_values(cmd); @@ -1000,7 +998,7 @@ int iscsit_execute_cmd(struct iscsi_cmd *cmd, int ooo) * Send the delayed TASK_ABORTED status for WRITEs if * no more nsolicitied data is expected. */ - if (transport_check_aborted_status(se_cmd, 1) != 0) + if (se_cmd->transport_state & CMD_T_ABORTED) return 0; iscsit_set_unsoliticed_dataout(cmd); diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 81e25fbb69fc..4fcfa37a6d2b 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1892,18 +1892,16 @@ static bool target_handle_task_attr(struct se_cmd *cmd) void target_execute_cmd(struct se_cmd *cmd) { + if (cmd->transport_state & CMD_T_ABORTED) { + transport_handle_abort(cmd); + return; + } + /* * Determine if frontend context caller is requesting the stopping of * this command for frontend exceptions. - * - * If the received CDB has aleady been aborted stop processing it here. */ spin_lock_irq(&cmd->t_state_lock); - if (__transport_check_aborted_status(cmd, 1)) { - spin_unlock_irq(&cmd->t_state_lock); - transport_handle_abort(cmd); - return; - } if (cmd->transport_state & CMD_T_STOP) { pr_debug("%s:%d CMD_T_STOP for ITT: 0x%08llx\n", __func__, __LINE__, cmd->tag); @@ -2994,12 +2992,6 @@ transport_send_check_condition_and_sense(struct se_cmd *cmd, } EXPORT_SYMBOL(transport_send_check_condition_and_sense); -bool transport_check_aborted_status(struct se_cmd *cmd, int send_status) -{ - return cmd->transport_state & CMD_T_ABORTED; -} -EXPORT_SYMBOL(transport_check_aborted_status); - static void target_tmr_work(struct work_struct *work) { struct se_cmd *cmd = container_of(work, struct se_cmd, work); diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 5b7af743fe79..4c2d6fbf5f95 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -153,7 +153,6 @@ void target_execute_cmd(struct se_cmd *cmd); int transport_generic_free_cmd(struct se_cmd *, int); bool transport_wait_for_tasks(struct se_cmd *); -bool transport_check_aborted_status(struct se_cmd *, int); int transport_send_check_condition_and_sense(struct se_cmd *, sense_reason_t, int); int target_get_sess_cmd(struct se_cmd *, bool);