From patchwork Fri Feb 10 01:28:38 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: 9565777 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 C325C60572 for ; Fri, 10 Feb 2017 01:29:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4E8D28532 for ; Fri, 10 Feb 2017 01:29:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A9C542853B; Fri, 10 Feb 2017 01:29:37 +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 2924A28532 for ; Fri, 10 Feb 2017 01:29:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751465AbdBJB3g (ORCPT ); Thu, 9 Feb 2017 20:29:36 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:36294 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751404AbdBJB30 (ORCPT ); Thu, 9 Feb 2017 20:29:26 -0500 X-IronPort-AV: E=Sophos;i="5.33,348,1477929600"; d="scan'208";a="82349490" Received: from unknown (HELO milsmgep15.sandisk.com) ([63.163.107.21]) by ob1.hgst.iphmx.com with ESMTP; 10 Feb 2017 09:28:59 +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 4F.87.57638.B571D985; Thu, 9 Feb 2017 17:28:59 -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; Thu, 9 Feb 2017 17:28:55 -0800 X-AuditID: 0ac94369-26dee9800001e126-fb-589d175bc74d Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 94.9F.11415.7571D985; Thu, 9 Feb 2017 17:28:55 -0800 (PST) From: Bart Van Assche To: "Nicholas A . Bellinger" CC: , Bart Van Assche , Andy Grover Subject: [PATCH v5 08/22] target: Inline transport_check_aborted_status() Date: Thu, 9 Feb 2017 17:28:38 -0800 Message-ID: <20170210012852.15735-9-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170210012852.15735-1-bart.vanassche@sandisk.com> References: <20170210012852.15735-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrFLMWRmVeSWpSXmKPExsXCddJ5kW60+NwIg5u3dC32z3rGZNG2+gyj RevSt0wOzB73tx9h8ni/7yqbx+dNcgHMUVw2Kak5mWWpRfp2CVwZVxp2sBacMqhofLOdtYHx tEYXIweHhICJxO695l2MXBxCAkuZJPZMX8oK4WxllJj39zFbFyMnWNHT91OYIRIbGSV+dXcy giTYBIwkvr2fyQJiiwDZq3uWMYHYzAIlEov/3wGzhQU8JRb/uAVmswioSHzY/BisnlfAXuLs 5YcsEAvkJXa1XWQFsTkFHCRezb7OCnKdEFDNjl0GECXfWCTmPi6BaBWUODnzCQvEKgmJgy9e MIPYQgLqEieXzGeawCg0C0nZLCRlCxiZVjGK5WbmFOempxYYmuoVJ+alZBZn6yXn525ihIRw 5g7Gu0+8DzEKcDAq8fC+qJkTIcSaWFZcmXuIUYKDWUmE9z7f3Agh3pTEyqrUovz4otKc1OJD jNIcLErivOdkpkYICaQnlqRmp6YWpBbBZJk4OKUaGKfZiezZfWcSuy77I9397jw3Pyknswob 5S4/e4vd/ZRmfX9iTMP7j4cn95wS/L1v/bGaNVUPZ70zfs394tFXs53L5GZc/sx3pHi2x8xA lvs78zVqJ3PeDnt/XeKQNvei32ZdWcylG8Jaf67njPAvTHBPVswOqgx8u7LPuXjZy1vL0n5l BlxMO67EUpyRaKjFXFScCABubRe5XQIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNJMWRmVeSWpSXmKPExsXCtZGTTTdcfG6EQdsvIYv9s54xWRz82cZo 0bb6DKNF69K3TA4sHve3H2HyeL/vKpvHtDXnmTw+b5ILYInisklJzcksSy3St0vgyrjSsIO1 4JRBReOb7awNjKc1uhg5OSQETCSevp/C3MXIxSEksJ5R4vr2q6wgCTYBI4lv72eygNgiQPbq nmVMIDazQInEu56D7CC2sICnxOIft8DiLAKqEts/nwar5xWwl5h79CMLxAJ5iV1tF8Fmcgo4 SLyafR3I5gBaZi+xY5fBBEbuBYwMqxjFcjNzinPTMwsMDfWKE/NSMouz9ZLzczcxQrwfuYPx 6UTzQ4xMHJxSDYwOppeUDs+/pjBtlsfhLwsvqn58rsm2on/+NM8P8ydKrqsSOutptOIR67KS nNNlt0qttyT/5ZnSwvVvablR6CqbnyfOTVj+/ci96Jq5lsdOO4kUB/7WCrW+/vfm1PVyoSnR JXqfW3Nakr4HMzuUCs3zejs9vcPbc8W9BNnsY8aXgtq2bHy6N41RiaU4I9FQi7moOBEAhG7q Da4BAAA= 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 d2cd7906a4a8..dd30a8c098aa 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1906,18 +1906,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) { + target_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); - target_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); @@ -3090,12 +3088,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);