From patchwork Fri Jan 25 18:34:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10781875 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5D1AE14E5 for ; Fri, 25 Jan 2019 18:35:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B71E299B5 for ; Fri, 25 Jan 2019 18:35:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E37B2D40C; Fri, 25 Jan 2019 18:35:34 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 1558E299B5 for ; Fri, 25 Jan 2019 18:35:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726321AbfAYSfc (ORCPT ); Fri, 25 Jan 2019 13:35:32 -0500 Received: from out002.mailprotect.be ([83.217.72.86]:40839 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726468AbfAYSfc (ORCPT ); Fri, 25 Jan 2019 13:35:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=TCloZxPoYW2jwZZUAyNfmx48tsg/W9uhLlv6I7y9mWA=; b=d62zv4TZmC5R 79bJ7uGW9XkRLCLP41DDLvPyW7nb7juFFYE+8vgsiA00c+eTLKMGxLnKaSlQVPlN4K2WyJWTHzvze O+pULbyVgVbcFY0w+v2EolJPTYUp1dJ+C/3Xs2G/Bat9YYUERMxVT93nI0AhcIlLIGXxqwHTjRCc8 QZqCLaX9Q4lRqa6HN3CCJVeO6xN8FEpwo3lAtOHrrrgawWqVmO5pwn+zXx5Mo2DMuIeGdVYwHZFe8 Ot6/nmNIQWU36QXDmCkoaEPKut3vFmxzi/KqCAyhJqEW8zJamvnEc4sO3Bgluq3ZFtUSnGIPprp5s o9/Jl9/1Vpuc6fJbnuoQBQ==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gn6Ju-00041F-WA; Fri, 25 Jan 2019 19:35:15 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id 52442C05E8; Fri, 25 Jan 2019 19:35:06 +0100 (CET) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Felipe Balbi , Sagi Grimberg , Andy Grover , Hannes Reinecke , "Bryant G . Ly" , Nicholas Bellinger , Mike Christie , Himanshu Madhani , Quinn Tran , Saurav Kashyap , "Michael S . Tsirkin" , Juergen Gross Subject: [PATCH 01/16] target/core: Remove the write_pending_status() callback function Date: Fri, 25 Jan 2019 10:34:43 -0800 Message-Id: <20190125183458.220477-2-bvanassche@acm.org> X-Mailer: git-send-email 2.20.1.495.gaa96b0ce6b-goog In-Reply-To: <20190125183458.220477-1-bvanassche@acm.org> References: <20190125183458.220477-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: SB/global_tokens (0.00766339236043) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5ssN1KaTZs7yMl3hM64np35602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxw8BG n378UYuScxRgVFep8dI8glVVfIe2t8rsAe+lNyAhs6YIUYQ1Yxuav2mKHP0PmwEZLddpHqHNkEgQ 9ysJ+1CHVNQQHoqx5HOPYJnU3yfGiUTjHCVIw1lBF4KHUGSFK+QPZ/RjH4qrrTi7ph218YkcVxLR gk73iEoFflBkBeFISjJ92QuvBIu1sQfMoyTco7dn75KklDQzD+PBYAwIkiMymSZvF2cFS8v2OjOy X4T214QKknuiNZuX+GQURjupggdpMDOIx1bLUbpq/l95oZVRvT/ck04cQuuirl29Bzt1XbSkTcoC 6fyx9nixK5jEw8M49vPPiy6A8IssNmWaRp9+EgYOSkyqAK4brIOslsXIACTZfelgCTAhZRnRHhe3 7dgs3o6aLku3OZR0CfOus7rNStAYAOF5iQucnWjWdOjpjQuTYKgXZGMLKCG2ZnLFf08Fxqv9SLEY ymwqWTN8eHrilbHtbFYVmmyNP/jzd7CCsJS6p7CwhX8Mp6SB5g7nSFM5szwe2goW7koci8b0tQqU 8Zf+B9qSJPzSsfZHWcrkYsDes2af78rH+mDO/mXHv8guknaFDANL6ksLAMxuhq26AVsYQvJARyY+ k0KwqeuJwPK1AHEmV66dfFn8qBQugt/MyiQBSh+DjRgphAEc3Ya5LOgeKXO25z+5NGNuywFRT1zD 59o8cPYKs494BBiYWY8F8GPFJbn8S/EVHflDn2eR9qbezVP6bx57CvQHm1eEuguJ33RH7tmvqQZv JEjqsD3dKxLhoxcmaInYbR5vlqG4Bui2GdZ3YSzSxJhF27KT7sn//RcLEIwmfxtejjVQPRRN/M5e laq5TDuiKmQ2qY87sycyZ52fyHp+T8ubRqSLBquqFzivIN5utSYJNcOXF60jiD6XqsJZtjQxlyCd sezBc9lm2TAjInAjJAH3j80sSBM9DyY9Kubw6WYQ+rWh1TQtk+0+Bx2Z1A11OXuiyWdrWJCceRba IlmpXKerwnE1lP4WSX/XM2r4jY9m2uNmuU8ofPwM2ZBSSsrQfZHreuL4nwAlrq4ws1WyevysGYbE Jwcvz6VMYEhUT3FsSRfv22gjSUe2eNZhy4aRu2lNst5PoZN5lOVFzYctrbWtCddxzII5/IgxS2dP h0uNIzc84CG7X+t1TW39Ja77LGPpOwC1Jo9FqNZS4g2UTN4WQpS4/uY9vBXRiWqdpvcaicL5/qAC F9S8aDbHydkQ8WmNVzwwNFwKBhAh7NeKYzwwwYGpxCjkLMXPZlgA+tTdWH92cZDPT8INCDdPamn1 ReEk+npz8Ne0ck6P4ivKdWmRJx+ggsYkU/p9KCFWPEq6L9mrGqFzSuEl7JM1pot2VKRrisQUCcJx PqDAEmCliEbT+wl0 X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be 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 patch that makes TMF handling synchronous the write_pending_status() callback function is no longer called. Hence remove it. Acked-by: Felipe Balbi Reviewed-by: Sagi Grimberg Reviewed-by: Andy Grover Reviewed-by: Christoph Hellwig Reviewed-by: Hannes Reinecke Reviewed-by: Bryant G. Ly Cc: Nicholas Bellinger Cc: Mike Christie Cc: Himanshu Madhani Cc: Quinn Tran Cc: Saurav Kashyap Cc: Michael S. Tsirkin Cc: Juergen Gross Signed-off-by: Bart Van Assche --- Documentation/target/tcm_mod_builder.py | 8 ----- drivers/infiniband/ulp/srpt/ib_srpt.c | 9 ------ drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 6 ---- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 31 -------------------- drivers/target/iscsi/iscsi_target_configfs.c | 13 -------- drivers/target/loopback/tcm_loop.c | 6 ---- drivers/target/sbp/sbp_target.c | 6 ---- drivers/target/target_core_configfs.c | 4 --- drivers/target/target_core_xcopy.c | 6 ---- drivers/target/tcm_fc/tcm_fc.h | 1 - drivers/target/tcm_fc/tfc_cmd.c | 7 ----- drivers/target/tcm_fc/tfc_conf.c | 1 - drivers/usb/gadget/function/f_tcm.c | 9 ------ drivers/vhost/scsi.c | 6 ---- drivers/xen/xen-scsiback.c | 6 ---- include/target/target_core_fabric.h | 1 - 16 files changed, 120 deletions(-) diff --git a/Documentation/target/tcm_mod_builder.py b/Documentation/target/tcm_mod_builder.py index 94bf6944bb1e..95d6e31f1e3a 100755 --- a/Documentation/target/tcm_mod_builder.py +++ b/Documentation/target/tcm_mod_builder.py @@ -297,7 +297,6 @@ def tcm_mod_build_configfs(proto_ident, fabric_mod_dir_var, fabric_mod_name): buf += " .sess_get_index = " + fabric_mod_name + "_sess_get_index,\n" buf += " .sess_get_initiator_sid = NULL,\n" buf += " .write_pending = " + fabric_mod_name + "_write_pending,\n" - buf += " .write_pending_status = " + fabric_mod_name + "_write_pending_status,\n" buf += " .set_default_node_attributes = " + fabric_mod_name + "_set_default_node_attrs,\n" buf += " .get_cmd_state = " + fabric_mod_name + "_get_cmd_state,\n" buf += " .queue_data_in = " + fabric_mod_name + "_queue_data_in,\n" @@ -479,13 +478,6 @@ def tcm_mod_dump_fabric_ops(proto_ident, fabric_mod_dir_var, fabric_mod_name): buf += "}\n\n" bufi += "int " + fabric_mod_name + "_write_pending(struct se_cmd *);\n" - if re.search('write_pending_status\)\(', fo): - buf += "int " + fabric_mod_name + "_write_pending_status(struct se_cmd *se_cmd)\n" - buf += "{\n" - buf += " return 0;\n" - buf += "}\n\n" - bufi += "int " + fabric_mod_name + "_write_pending_status(struct se_cmd *);\n" - if re.search('set_default_node_attributes\)\(', fo): buf += "void " + fabric_mod_name + "_set_default_node_attrs(struct se_node_acl *nacl)\n" buf += "{\n" diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index e9c336cff8f5..8cee8c6c6be9 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -2703,14 +2703,6 @@ static int srpt_rdma_cm_handler(struct rdma_cm_id *cm_id, return ret; } -static int srpt_write_pending_status(struct se_cmd *se_cmd) -{ - struct srpt_send_ioctx *ioctx; - - ioctx = container_of(se_cmd, struct srpt_send_ioctx, cmd); - return ioctx->state == SRPT_STATE_NEED_DATA; -} - /* * srpt_write_pending - Start data transfer from initiator to target (write). */ @@ -3806,7 +3798,6 @@ static const struct target_core_fabric_ops srpt_template = { .sess_get_index = srpt_sess_get_index, .sess_get_initiator_sid = NULL, .write_pending = srpt_write_pending, - .write_pending_status = srpt_write_pending_status, .set_default_node_attributes = srpt_set_default_node_attrs, .get_cmd_state = srpt_get_tcm_cmd_state, .queue_data_in = srpt_queue_data_in, diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c index cc9cae469c4b..7ca277e28d63 100644 --- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c @@ -3788,11 +3788,6 @@ static int ibmvscsis_write_pending(struct se_cmd *se_cmd) return 0; } -static int ibmvscsis_write_pending_status(struct se_cmd *se_cmd) -{ - return 0; -} - static void ibmvscsis_set_default_node_attrs(struct se_node_acl *nacl) { } @@ -4053,7 +4048,6 @@ static const struct target_core_fabric_ops ibmvscsis_ops = { .release_cmd = ibmvscsis_release_cmd, .sess_get_index = ibmvscsis_sess_get_index, .write_pending = ibmvscsis_write_pending, - .write_pending_status = ibmvscsis_write_pending_status, .set_default_node_attributes = ibmvscsis_set_default_node_attrs, .get_cmd_state = ibmvscsis_get_cmd_state, .queue_data_in = ibmvscsis_queue_data_in, diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 283e6b80abb5..8a3075d17c63 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -420,26 +420,6 @@ static int tcm_qla2xxx_write_pending(struct se_cmd *se_cmd) return qlt_rdy_to_xfer(cmd); } -static int tcm_qla2xxx_write_pending_status(struct se_cmd *se_cmd) -{ - unsigned long flags; - /* - * Check for WRITE_PENDING status to determine if we need to wait for - * CTIO aborts to be posted via hardware in tcm_qla2xxx_handle_data(). - */ - spin_lock_irqsave(&se_cmd->t_state_lock, flags); - if (se_cmd->t_state == TRANSPORT_WRITE_PENDING || - se_cmd->t_state == TRANSPORT_COMPLETE_QF_WP) { - spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); - wait_for_completion_timeout(&se_cmd->t_transport_stop_comp, - 50); - return 0; - } - spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); - - return 0; -} - static void tcm_qla2xxx_set_default_node_attrs(struct se_node_acl *nacl) { return; @@ -537,15 +517,6 @@ static void tcm_qla2xxx_handle_data_work(struct work_struct *work) cmd->qpair->tgt_counters.qla_core_ret_ctio++; if (!cmd->write_data_transferred) { - /* - * Check if se_cmd has already been aborted via LUN_RESET, and - * waiting upon completion in tcm_qla2xxx_write_pending_status() - */ - if (cmd->se_cmd.transport_state & CMD_T_ABORTED) { - complete(&cmd->se_cmd.t_transport_stop_comp); - return; - } - switch (cmd->dif_err_code) { case DIF_ERR_GRD: cmd->se_cmd.pi_err = @@ -1902,7 +1873,6 @@ static const struct target_core_fabric_ops tcm_qla2xxx_ops = { .sess_get_index = tcm_qla2xxx_sess_get_index, .sess_get_initiator_sid = NULL, .write_pending = tcm_qla2xxx_write_pending, - .write_pending_status = tcm_qla2xxx_write_pending_status, .set_default_node_attributes = tcm_qla2xxx_set_default_node_attrs, .get_cmd_state = tcm_qla2xxx_get_cmd_state, .queue_data_in = tcm_qla2xxx_queue_data_in, @@ -1943,7 +1913,6 @@ static const struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = { .sess_get_index = tcm_qla2xxx_sess_get_index, .sess_get_initiator_sid = NULL, .write_pending = tcm_qla2xxx_write_pending, - .write_pending_status = tcm_qla2xxx_write_pending_status, .set_default_node_attributes = tcm_qla2xxx_set_default_node_attrs, .get_cmd_state = tcm_qla2xxx_get_cmd_state, .queue_data_in = tcm_qla2xxx_queue_data_in, diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c index a5481dfeae8d..cac94c94ef5d 100644 --- a/drivers/target/iscsi/iscsi_target_configfs.c +++ b/drivers/target/iscsi/iscsi_target_configfs.c @@ -1389,18 +1389,6 @@ static int lio_write_pending(struct se_cmd *se_cmd) return 0; } -static int lio_write_pending_status(struct se_cmd *se_cmd) -{ - struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd); - int ret; - - spin_lock_bh(&cmd->istate_lock); - ret = !(cmd->cmd_flags & ICF_GOT_LAST_DATAOUT); - spin_unlock_bh(&cmd->istate_lock); - - return ret; -} - static int lio_queue_status(struct se_cmd *se_cmd) { struct iscsi_cmd *cmd = container_of(se_cmd, struct iscsi_cmd, se_cmd); @@ -1564,7 +1552,6 @@ const struct target_core_fabric_ops iscsi_ops = { .sess_get_index = lio_sess_get_index, .sess_get_initiator_sid = lio_sess_get_initiator_sid, .write_pending = lio_write_pending, - .write_pending_status = lio_write_pending_status, .set_default_node_attributes = lio_set_default_node_attributes, .get_cmd_state = iscsi_get_cmd_state, .queue_data_in = lio_queue_data_in, diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 7bd7c0c0db6f..89c6e3719d2b 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -560,11 +560,6 @@ static int tcm_loop_write_pending(struct se_cmd *se_cmd) return 0; } -static int tcm_loop_write_pending_status(struct se_cmd *se_cmd) -{ - return 0; -} - static int tcm_loop_queue_data_in(struct se_cmd *se_cmd) { struct tcm_loop_cmd *tl_cmd = container_of(se_cmd, @@ -1159,7 +1154,6 @@ static const struct target_core_fabric_ops loop_ops = { .release_cmd = tcm_loop_release_cmd, .sess_get_index = tcm_loop_sess_get_index, .write_pending = tcm_loop_write_pending, - .write_pending_status = tcm_loop_write_pending_status, .set_default_node_attributes = tcm_loop_set_default_node_attributes, .get_cmd_state = tcm_loop_get_cmd_state, .queue_data_in = tcm_loop_queue_data_in, diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c index 08cee13dfb9a..b0d3583998f0 100644 --- a/drivers/target/sbp/sbp_target.c +++ b/drivers/target/sbp/sbp_target.c @@ -1749,11 +1749,6 @@ static int sbp_write_pending(struct se_cmd *se_cmd) return 0; } -static int sbp_write_pending_status(struct se_cmd *se_cmd) -{ - return 0; -} - static void sbp_set_default_node_attrs(struct se_node_acl *nacl) { return; @@ -2329,7 +2324,6 @@ static const struct target_core_fabric_ops sbp_ops = { .release_cmd = sbp_release_cmd, .sess_get_index = sbp_sess_get_index, .write_pending = sbp_write_pending, - .write_pending_status = sbp_write_pending_status, .set_default_node_attributes = sbp_set_default_node_attrs, .get_cmd_state = sbp_get_cmd_state, .queue_data_in = sbp_queue_data_in, diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 72016d0dfca5..1124c84a3b7f 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c @@ -401,10 +401,6 @@ static int target_fabric_tf_ops_check(const struct target_core_fabric_ops *tfo) pr_err("Missing tfo->write_pending()\n"); return -EINVAL; } - if (!tfo->write_pending_status) { - pr_err("Missing tfo->write_pending_status()\n"); - return -EINVAL; - } if (!tfo->set_default_node_attributes) { pr_err("Missing tfo->set_default_node_attributes()\n"); return -EINVAL; diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index c2e1fc927fdf..9be1418e919f 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c @@ -442,11 +442,6 @@ static int xcopy_pt_write_pending(struct se_cmd *se_cmd) return 0; } -static int xcopy_pt_write_pending_status(struct se_cmd *se_cmd) -{ - return 0; -} - static int xcopy_pt_queue_data_in(struct se_cmd *se_cmd) { return 0; @@ -463,7 +458,6 @@ static const struct target_core_fabric_ops xcopy_pt_tfo = { .release_cmd = xcopy_pt_release_cmd, .check_stop_free = xcopy_pt_check_stop_free, .write_pending = xcopy_pt_write_pending, - .write_pending_status = xcopy_pt_write_pending_status, .queue_data_in = xcopy_pt_queue_data_in, .queue_status = xcopy_pt_queue_status, }; diff --git a/drivers/target/tcm_fc/tcm_fc.h b/drivers/target/tcm_fc/tcm_fc.h index 11d27b93b413..b8ced4458118 100644 --- a/drivers/target/tcm_fc/tcm_fc.h +++ b/drivers/target/tcm_fc/tcm_fc.h @@ -158,7 +158,6 @@ void ft_release_cmd(struct se_cmd *); int ft_queue_status(struct se_cmd *); int ft_queue_data_in(struct se_cmd *); int ft_write_pending(struct se_cmd *); -int ft_write_pending_status(struct se_cmd *); int ft_get_cmd_state(struct se_cmd *); void ft_queue_tm_resp(struct se_cmd *); void ft_aborted_task(struct se_cmd *); diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index a183d4da7db2..f0529ba58f4c 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c @@ -184,13 +184,6 @@ int ft_queue_status(struct se_cmd *se_cmd) return 0; } -int ft_write_pending_status(struct se_cmd *se_cmd) -{ - struct ft_cmd *cmd = container_of(se_cmd, struct ft_cmd, se_cmd); - - return cmd->write_data_len != se_cmd->data_length; -} - /* * Send TX_RDY (transfer ready). */ diff --git a/drivers/target/tcm_fc/tfc_conf.c b/drivers/target/tcm_fc/tfc_conf.c index 1ce49518d440..c873a052fcb0 100644 --- a/drivers/target/tcm_fc/tfc_conf.c +++ b/drivers/target/tcm_fc/tfc_conf.c @@ -437,7 +437,6 @@ static const struct target_core_fabric_ops ft_fabric_ops = { .sess_get_index = ft_sess_get_index, .sess_get_initiator_sid = NULL, .write_pending = ft_write_pending, - .write_pending_status = ft_write_pending_status, .set_default_node_attributes = ft_set_default_node_attr, .get_cmd_state = ft_get_cmd_state, .queue_data_in = ft_queue_data_in, diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index 34f5982cab78..7f01f78b1d23 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -1292,14 +1292,6 @@ static u32 usbg_sess_get_index(struct se_session *se_sess) return 0; } -/* - * XXX Error recovery: return != 0 if we expect writes. Dunno when that could be - */ -static int usbg_write_pending_status(struct se_cmd *se_cmd) -{ - return 0; -} - static void usbg_set_default_node_attrs(struct se_node_acl *nacl) { } @@ -1725,7 +1717,6 @@ static const struct target_core_fabric_ops usbg_ops = { .sess_get_index = usbg_sess_get_index, .sess_get_initiator_sid = NULL, .write_pending = usbg_send_write_request, - .write_pending_status = usbg_write_pending_status, .set_default_node_attributes = usbg_set_default_node_attrs, .get_cmd_state = usbg_get_cmd_state, .queue_data_in = usbg_send_read_response, diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 8e10ab436d1f..ad7899f99b97 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -346,11 +346,6 @@ static int vhost_scsi_write_pending(struct se_cmd *se_cmd) return 0; } -static int vhost_scsi_write_pending_status(struct se_cmd *se_cmd) -{ - return 0; -} - static void vhost_scsi_set_default_node_attrs(struct se_node_acl *nacl) { return; @@ -2298,7 +2293,6 @@ static const struct target_core_fabric_ops vhost_scsi_ops = { .sess_get_index = vhost_scsi_sess_get_index, .sess_get_initiator_sid = NULL, .write_pending = vhost_scsi_write_pending, - .write_pending_status = vhost_scsi_write_pending_status, .set_default_node_attributes = vhost_scsi_set_default_node_attrs, .get_cmd_state = vhost_scsi_get_cmd_state, .queue_data_in = vhost_scsi_queue_data_in, diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c index c9e23a126218..e59937293a32 100644 --- a/drivers/xen/xen-scsiback.c +++ b/drivers/xen/xen-scsiback.c @@ -1404,11 +1404,6 @@ static int scsiback_write_pending(struct se_cmd *se_cmd) return 0; } -static int scsiback_write_pending_status(struct se_cmd *se_cmd) -{ - return 0; -} - static void scsiback_set_default_node_attrs(struct se_node_acl *nacl) { } @@ -1818,7 +1813,6 @@ static const struct target_core_fabric_ops scsiback_ops = { .sess_get_index = scsiback_sess_get_index, .sess_get_initiator_sid = NULL, .write_pending = scsiback_write_pending, - .write_pending_status = scsiback_write_pending_status, .set_default_node_attributes = scsiback_set_default_node_attrs, .get_cmd_state = scsiback_get_cmd_state, .queue_data_in = scsiback_queue_data_in, diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index ee5ddd81cd8d..691c6b5e6520 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -74,7 +74,6 @@ struct target_core_fabric_ops { u32 (*sess_get_initiator_sid)(struct se_session *, unsigned char *, u32); int (*write_pending)(struct se_cmd *); - int (*write_pending_status)(struct se_cmd *); void (*set_default_node_attributes)(struct se_node_acl *); int (*get_cmd_state)(struct se_cmd *); int (*queue_data_in)(struct se_cmd *); From patchwork Fri Jan 25 18:34:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10781871 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B35AB746 for ; Fri, 25 Jan 2019 18:35:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A3FBA3045E for ; Fri, 25 Jan 2019 18:35:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 987953045A; Fri, 25 Jan 2019 18:35:25 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 0FBAA30437 for ; Fri, 25 Jan 2019 18:35:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726411AbfAYSfY (ORCPT ); Fri, 25 Jan 2019 13:35:24 -0500 Received: from out002.mailprotect.be ([83.217.72.86]:51793 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726321AbfAYSfY (ORCPT ); Fri, 25 Jan 2019 13:35:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=ffhO+dhUkfDZNsF77OQEXcE5c9oUiAla/1vDMLO9Bp0=; b=t7xp2hcjzYyk 0HFm4l3muItsjlZd9gxxSOTs4vHtug9M6gP5eeuyblP+TbSQwv5jaIpjsYJ5uXnL+azQu5pwQeTCB o2S0jjpAL0lA0SdQVnNdcu8Yr/8+K5TQPTw/U2hTuVq8xT+EGoGsiBVjEkGmW3t0IeGDzjyqAVcX0 QX6g3/aalXMhSflck+Za8Iza/dUxi5ESXCkYJIQe8zP/qeOpryztdIZDYqB44ns4wltGQRrUPweQK hr1qzrpP9aGpZvvb6buFTDAfgrVXm5DFvlmX9KbWYfl/Gebulf+QX9asxpKhShS1TTcmYhm76Hitd 6m3dAt3E7+DPk3hGzzQ1ZA==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gn6Jv-00040S-Ge; Fri, 25 Jan 2019 19:35:16 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id A588DC07A1; Fri, 25 Jan 2019 19:35:10 +0100 (CET) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Nicholas Bellinger , Mike Christie , Hannes Reinecke Subject: [PATCH 02/16] target/core: Remove several state tests from the TMF code Date: Fri, 25 Jan 2019 10:34:44 -0800 Message-Id: <20190125183458.220477-3-bvanassche@acm.org> X-Mailer: git-send-email 2.20.1.495.gaa96b0ce6b-goog In-Reply-To: <20190125183458.220477-1-bvanassche@acm.org> References: <20190125183458.220477-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.03) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5g/JQpFogXa1cWko2qrS9lh602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WlZa4xKvcBORT2AGmYYKfacHGRHPT1S45qX7/AQuG3+Xws3TRjaC42FtNJuTWwh7zLjlV5 cBkg2E15FOz6ftN75Z/AnPYBn4Tb+xrDrK8sE8902MBxp+G42GIBqokZAnJ5xBHkCMCjMposz65/ e+f6sz9VtXrOJenZ5zYaF/sdP+70pheH5TNN6RiG9N0Jt+0ML5i3g2GFaGQnZ3KowlU8anvoc7s0 eHtsyrH7f4vWs1KcgxQTqdSE3cxlP67ssuZxn2a3k66wqHQRkdHrnUf0XuDVW1RAVP/E7/UYy9T8 rkAMvHmBTTipZKIPq3iOj9tSKKqNUqeXR0rRzsN1a4pGQL1kekvvDc/yYbCCC8p9CUWioSPTx/yi OJKFnIIso8zn0j1QBmC0JIZXgnugZTuCZyCgxZHINA6A5+7T9o6by3MDjiILWse2C7xyo18DbRKd 6+6AB9mEpRX5vy67WwDjehIqUczFWeS6sE8e1b5/UkBg4yvMn5MBAdwJubari/j0NbttK1RyTzg9 21y9+zCxO6B1WisJdr+Oay4DE5GzXNT7h2TitJ/lm0g9VMyaI60HmFDqewO9xyOqCYO8P1aHTwaH Q1Qo4eQXu+BLLP1GOzxnZ5UDYNafOy0Jr+QbiT1CJ/k2Jo+Zn4s9cWJWa0GqPkin+M+n/jXu6/99 KOMlrjA0XAoGECHs14pjPDDBgal9xZYz2MK6AE8POx8Vj5IonlRJKeKEA6rmKWxCQuChdkd/MSkb fliH7WKoVJMVRUIU005YMQtTGkqF9DfSXeTqNQl0N82pGAaFlBh9ydCic1KxHB/etGG+jKYi/tvO WyEnBy/PpUxgSFRPcWxJF+/bZGcrdi6P9WA8qPaxL9ILtEIqJpgLAx9UBkVVtWWC7u0df68W0InH /+bTMKNm38MHe3iJ5ql2Fx06AJIYSscySZesPRxtLbAe07w72Y8M1+Qa8Q/Annoe3C1wCMjQ1GK/ MS+4ayUpOtEhdxekWDmK9g== X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be 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 Whether or not a session is being torn down does not affect whether or not SCSI commands are in the task set. Hence remove the "tearing down" checks from the TMF code. The TRANSPORT_ISTATE_PROCESSING check is left out because it is now safe to wait for a command that is in that state. The CMD_T_PRE_EXECUTE is left out because abort processing is postponed until after commands have left the pre-execute state since the patch that makes TMF processing synchronous. See also commit 1c21a48055a6 ("target: Avoid early CMD_T_PRE_EXECUTE failures during ABORT_TASK"). Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke Signed-off-by: Bart Van Assche --- drivers/target/target_core_tmr.c | 25 ------------------------- drivers/target/target_core_transport.c | 2 -- include/target/target_core_base.h | 1 - 3 files changed, 28 deletions(-) diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index ad0061e09d4c..df1ca827de68 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c @@ -114,21 +114,6 @@ static bool __target_check_io_state(struct se_cmd *se_cmd, spin_unlock(&se_cmd->t_state_lock); return false; } - if (se_cmd->transport_state & CMD_T_PRE_EXECUTE) { - if (se_cmd->scsi_status) { - pr_debug("Attempted to abort io tag: %llu early failure" - " status: 0x%02x\n", se_cmd->tag, - se_cmd->scsi_status); - spin_unlock(&se_cmd->t_state_lock); - return false; - } - } - if (sess->sess_tearing_down) { - pr_debug("Attempted to abort io tag: %llu already shutdown," - " skipping\n", se_cmd->tag); - spin_unlock(&se_cmd->t_state_lock); - return false; - } se_cmd->transport_state |= CMD_T_ABORTED; if ((tmr_sess != se_cmd->se_sess) && tas) @@ -239,16 +224,6 @@ static void core_tmr_drain_tmr_list( spin_unlock(&sess->sess_cmd_lock); continue; } - if (cmd->t_state == TRANSPORT_ISTATE_PROCESSING) { - spin_unlock(&cmd->t_state_lock); - spin_unlock(&sess->sess_cmd_lock); - continue; - } - if (sess->sess_tearing_down) { - spin_unlock(&cmd->t_state_lock); - spin_unlock(&sess->sess_cmd_lock); - continue; - } cmd->transport_state |= CMD_T_ABORTED; spin_unlock(&cmd->t_state_lock); diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index ef9e75b359d4..b25d27e8ca20 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -2056,7 +2056,6 @@ void target_execute_cmd(struct se_cmd *cmd) spin_lock_irq(&cmd->t_state_lock); cmd->t_state = TRANSPORT_PROCESSING; - cmd->transport_state &= ~CMD_T_PRE_EXECUTE; cmd->transport_state |= CMD_T_ACTIVE | CMD_T_SENT; spin_unlock_irq(&cmd->t_state_lock); @@ -2765,7 +2764,6 @@ int target_get_sess_cmd(struct se_cmd *se_cmd, bool ack_kref) ret = -ESHUTDOWN; goto out; } - se_cmd->transport_state |= CMD_T_PRE_EXECUTE; list_add_tail(&se_cmd->se_cmd_list, &se_sess->sess_cmd_list); percpu_ref_get(&se_sess->cmd_count); out: diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 69b7b955902c..19a5bf4214fc 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -502,7 +502,6 @@ struct se_cmd { #define CMD_T_STOP (1 << 5) #define CMD_T_TAS (1 << 10) #define CMD_T_FABRIC_STOP (1 << 11) -#define CMD_T_PRE_EXECUTE (1 << 12) spinlock_t t_state_lock; struct kref cmd_kref; struct completion t_transport_stop_comp; From patchwork Fri Jan 25 18:34:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10781873 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AA8A114E5 for ; Fri, 25 Jan 2019 18:35:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98A9F299B5 for ; Fri, 25 Jan 2019 18:35:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C2542D40C; Fri, 25 Jan 2019 18:35:32 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 2EACE299B5 for ; Fri, 25 Jan 2019 18:35:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726604AbfAYSfb (ORCPT ); Fri, 25 Jan 2019 13:35:31 -0500 Received: from out002.mailprotect.be ([83.217.72.86]:43605 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726321AbfAYSfb (ORCPT ); Fri, 25 Jan 2019 13:35:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=Il7rlzKGIu1QfH9ZOzRTRWx/BBWreaGPv7XIAOCosfk=; b=Rmpi5BqeEDTg /ImID84J+KD2U9f3sLntjZ+o8YHp3Ge0c6o+A7+n6SNy7fPq4iMgg6wVTzwcktXFzp7P2+GywCJkR 8Ja03+jN5kz6SdriLbYjduA08T4+myXlLYHwpo8+GxOvah65O26eTZWRPq6yd4MaG2RP6z4CXWr9R Y8QMcc/Tu3LP1wl3rtYmO3S648D0qF+orwFSoMo9lxHxWvx0O1NbmDHpHDC+VMOztt2d3Iqgva2hH Gvx5DNl14/6Ff0SRPU7vqCMUks//mXF4DekdaP52odXXntzLy8EaxlW0nFbMsrBVzRPLPZl4QCYiY utxXGcaTFlPdlZS3Im9+qw==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gn6Jx-00040S-7J; Fri, 25 Jan 2019 19:35:17 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id ED36FC0E49; Fri, 25 Jan 2019 19:35:12 +0100 (CET) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Hannes Reinecke , Nicholas Bellinger , Mike Christie Subject: [PATCH 03/16] target/core: Simplify the LUN RESET implementation Date: Fri, 25 Jan 2019 10:34:45 -0800 Message-Id: <20190125183458.220477-4-bvanassche@acm.org> X-Mailer: git-send-email 2.20.1.495.gaa96b0ce6b-goog In-Reply-To: <20190125183458.220477-1-bvanassche@acm.org> References: <20190125183458.220477-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.05) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5t0TwTvbnMf+U7WeiKZZgfR602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3Ug2Z18o1igRi0Z9AoJlXGOnPH3eHvE/+YpYUPEvK1gTBln72tSTIs46SAn15Ne84Ii1Adc cqagVZJRZnZl4d3nsD3pTS1a9o60KvNpVNZqeKfG4a+c9WQHY/ZSYGCg0KRnz36GGSOBMm+psSmc byPT+hsz8/q/OdhF13mF+CJjMsw4Oh2LkwsmIC+tUiJAU2HndEL8IbXBpRiMfP45Wz78wlk3Iika AYYay6zwzan8jJM4FJK5OR3dA6AwcnrK6eluxYvH2diC53wrDh3bCBPDF5WZp3AjdoRkErSrWMfJ QHJjKxjcJRcKJtpa3z3WiRQgMC0euyRWJ7x26Tv0oaNKsUXpeAiVHBWlM6dy+vmbeKTVDs7kesTy xgBnHEJLB92HXTxY/qMUubkMYlqd+ktCHX+vFtCJx//m0zCjZt/DB0RQrWCXPBvjQPTjIqT7lOxF QVRTn8m0sooRS7h6xdEgKTjECb0PwpN4olPuA0AI936c0SM84BxzaZIqKXfxGEKe5uvtvYPx5J/1 /DRNJM82fPZrhRHbfToy2oDKQNcS6Q/Bm+29CvnFsHM2VU25zrkhXhE4A5dz8Cr1wh5Q5fzs5tj7 5Sf4aVP7fG6vuK0FWaTbSxwffnx7O0ytw52gHEssAcmEV7hMz3mBMrH9L+m/q1FQxqV/jN1mSd2B +sBKHhmok11u89pTKgJ27pjsIdIep0kfiq020WMUa8+aHGcg2KMiuMuxKtW2dBnITX/iSMNWby+K M/KP5dqYi4FjQiXPHkrggKwRrBHirQVdi7S7U8VMX2w7iiUjw9pZ+zXcnX6m+UeFXprlCOm3BAEb JtCUfKAc5tuMY57sizcN8Ybgo6ZwKd/lAfDURVeqOwDGeVPxhaTP1H+ecpe65ERyZY5hD/iWD0V+ +qD0gbQQTy2MYhai3vEoMrcP3ydYA96eq2KM8TNRPi4PtNSv3zAgl6Rv/trjt4n+OSd+6+F6OunJ 9jihx+Za/cV70jOJzN2r4A== X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be 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 task management handling rework it is safe to wait for a TMF that is not in the active state. Hence remove the CMD_T_ACTIVE test from core_tmr_drain_tmr_list(). Additionally, call __target_check_io_state() instead of open coding it. Reviewed-by: Hannes Reinecke Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Signed-off-by: Bart Van Assche --- drivers/target/target_core_tmr.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index df1ca827de68..3a1bb799a9ab 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c @@ -217,23 +217,13 @@ static void core_tmr_drain_tmr_list( continue; spin_lock(&sess->sess_cmd_lock); - spin_lock(&cmd->t_state_lock); - if (!(cmd->transport_state & CMD_T_ACTIVE) || - (cmd->transport_state & CMD_T_FABRIC_STOP)) { - spin_unlock(&cmd->t_state_lock); - spin_unlock(&sess->sess_cmd_lock); - continue; - } - cmd->transport_state |= CMD_T_ABORTED; - spin_unlock(&cmd->t_state_lock); + rc = __target_check_io_state(cmd, sess, 0); + spin_unlock(&sess->sess_cmd_lock); - rc = kref_get_unless_zero(&cmd->cmd_kref); if (!rc) { printk("LUN_RESET TMR: non-zero kref_get_unless_zero\n"); - spin_unlock(&sess->sess_cmd_lock); continue; } - spin_unlock(&sess->sess_cmd_lock); list_move_tail(&tmr_p->tmr_list, &drain_tmr_list); } From patchwork Fri Jan 25 18:34:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10781897 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4396D746 for ; Fri, 25 Jan 2019 18:35:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 342B3299B5 for ; Fri, 25 Jan 2019 18:35:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 284782E1DB; Fri, 25 Jan 2019 18:35:53 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 9BA12299B5 for ; Fri, 25 Jan 2019 18:35:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729240AbfAYSfw (ORCPT ); Fri, 25 Jan 2019 13:35:52 -0500 Received: from out002.mailprotect.be ([83.217.72.86]:55675 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729035AbfAYSfw (ORCPT ); Fri, 25 Jan 2019 13:35:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=gr2Cy3BB5YoaLAlYiv6iPmXuuwcDWWeLIVIz+ofSTJg=; b=eP4c1Ug6q7wc lyw8V+ETDyUh1eFcryHzfBcI5hJd3SjYExu4t4g2s+0Bu3YOL+XLoYdTN4O6IiP2VdJ3qt+rtknJt MvhU7KnuQOIvn795HoD+TVXSOX5kPabY/QJHL9LfQJw3nARkjeP1Ft/HhYS6SQzfMSCEtR7LkGIqZ r1p5QyqcheT1YLSGaxqqJqu5bS57JXWddC87aYAgekgXsPJeiCStUhAB3dtYMNkdZKWBi2UabrafE 5kXnNc9W6Y1Wgf/mMusvH8lhZM+9WMqpxCEDgLG7ukfcqw4Ken39w4fyFQSrWMNGda3ljhSfRTuI5 9U089Nlt1q18RaT+shhfxQ==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gn6Jz-00041F-6y; Fri, 25 Jan 2019 19:35:24 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id 0AA06C05E8; Fri, 25 Jan 2019 19:35:14 +0100 (CET) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Hannes Reinecke , Nicholas Bellinger , Mike Christie Subject: [PATCH 04/16] target/core: Inline transport_lun_remove_cmd() Date: Fri, 25 Jan 2019 10:34:46 -0800 Message-Id: <20190125183458.220477-5-bvanassche@acm.org> X-Mailer: git-send-email 2.20.1.495.gaa96b0ce6b-goog In-Reply-To: <20190125183458.220477-1-bvanassche@acm.org> References: <20190125183458.220477-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.02) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5i6x58w9P4Xh3nFevv+gvsx602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3Ug2Z18o1igRi0Z9AoJlXGOnPH3eHvE/+YpYUPEvK1gTBln72tSTIs46SAn15Ne84Ii1Adc cqagVZJRZnZl4d3nKbnXLKV6PgqilNXCeStOb6fG4a+c9WQHY/ZSYGCg0KRnz36GGSOBMm+psSmc byPT+hsz8/q/OdhF13mF+CJjMsw4Oh2LkwsmIC+tUiJAU2HndEL8IbXBpRiMfP45Wz78wlk3Iika AYYay6zwzan8jJM4FJK5OR3dA6AwcnrK6eluxYvH2diC53wrDh3bCBPDF5WZp3AjdoRkErSrWMfJ QHJjKxjcJRcKJtpa3z3WiRQgMC0euyRWJ7x26Tv0oaNKsUXpeAiVHBWlM6dy+vmbeKTVDs7kesTy xgBnHEJLB92HXTxY/qMUubkMYlqd+ktCHX+vFtCJx//m0zCjZt/DB0RQrWCXPBvjQPTjIqT7lOxF QVRTn8m0sooRS7h6xdEgKTjECb0PwpN4olPuA0AI936c0SM84BxzaZIqKXfxGEKe5uvtvYPx5J/1 /DRNJM82fPZrhRHbfToy2oDKQNcS6UUZfR9Pm7MHzGqjesmrvl/J3zoiovuDVohDAu4bASAF5tj7 5Sf4aVP7fG6vuK0FWaTbSxwffnx7O0ytw52gHEssAcmEV7hMz3mBMrH9L+m/q1FQxqV/jN1mSd2B +sBKHhmok11u89pTKgJ27pjsIdIep0kfiq020WMUa8+aHGcg0CMad8Hsy40JMhGTdACw9DB8QZ6U 4Oy75gvIwpWZx7fPHkrggKwRrBHirQVdi7S7U8VMX2w7iiUjw9pZ+zXcnX6m+UeFXprlCOm3BAEb JtCUfKAc5tuMY57sizcN8Ybgo6ZwKd/lAfDURVeqOwDGeVPxhaTP1H+ecpe65ERyZY5hD/iWD0V+ +qD0gbQQTy2MYhai3vEoMrcP3ydYA96eq2KM8TNRPi4PtNSv3zAgl6Rv/trjt4n+OSd+6+F6OunJ 9jihx+Za/cV70jOJzN2r4A== X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be 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 Remove the code that clears .se_lun from transport_cmd_check_stop_to_fabric() such that the transport_lun_remove_cmd() call can be moved into target_release_cmd_kref(). Because this guarantees that transport_lun_remove_cmd() will be called exactly once, it is safe to change the cmpxchg() call into a test of se_cmd.lun_ref_active. Inline transport_lun_remove_cmd() because it is not worth to keep it as a separate function. Reviewed-by: Hannes Reinecke Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Signed-off-by: Bart Van Assche --- drivers/target/target_core_transport.c | 31 +++----------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index b25d27e8ca20..6471ede00336 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -664,11 +664,6 @@ static int transport_cmd_check_stop_to_fabric(struct se_cmd *cmd) target_remove_from_state_list(cmd); - /* - * Clear struct se_cmd->se_lun before the handoff to FE. - */ - cmd->se_lun = NULL; - spin_lock_irqsave(&cmd->t_state_lock, flags); /* * Determine if frontend context caller is requesting the stopping of @@ -696,17 +691,6 @@ static int transport_cmd_check_stop_to_fabric(struct se_cmd *cmd) return cmd->se_tfo->check_stop_free(cmd); } -static void transport_lun_remove_cmd(struct se_cmd *cmd) -{ - struct se_lun *lun = cmd->se_lun; - - if (!lun) - return; - - if (cmpxchg(&cmd->lun_ref_active, true, false)) - percpu_ref_put(&lun->lun_ref); -} - static void target_complete_failure_work(struct work_struct *work) { struct se_cmd *cmd = container_of(work, struct se_cmd, work); @@ -797,8 +781,6 @@ static void target_handle_abort(struct se_cmd *cmd) WARN_ON_ONCE(kref_read(&cmd->cmd_kref) == 0); - transport_lun_remove_cmd(cmd); - transport_cmd_check_stop_to_fabric(cmd); } @@ -1711,7 +1693,6 @@ static void target_complete_tmr_failure(struct work_struct *work) se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST; se_cmd->se_tfo->queue_tm_rsp(se_cmd); - transport_lun_remove_cmd(se_cmd); transport_cmd_check_stop_to_fabric(se_cmd); } @@ -1902,7 +1883,6 @@ void transport_generic_request_failure(struct se_cmd *cmd, goto queue_full; check_stop: - transport_lun_remove_cmd(cmd); transport_cmd_check_stop_to_fabric(cmd); return; @@ -2200,7 +2180,6 @@ static void transport_complete_qf(struct se_cmd *cmd) transport_handle_queue_full(cmd, cmd->se_dev, ret, false); return; } - transport_lun_remove_cmd(cmd); transport_cmd_check_stop_to_fabric(cmd); } @@ -2295,7 +2274,6 @@ static void target_complete_ok_work(struct work_struct *work) if (ret) goto queue_full; - transport_lun_remove_cmd(cmd); transport_cmd_check_stop_to_fabric(cmd); return; } @@ -2321,7 +2299,6 @@ static void target_complete_ok_work(struct work_struct *work) if (ret) goto queue_full; - transport_lun_remove_cmd(cmd); transport_cmd_check_stop_to_fabric(cmd); return; } @@ -2357,7 +2334,6 @@ static void target_complete_ok_work(struct work_struct *work) if (ret) goto queue_full; - transport_lun_remove_cmd(cmd); transport_cmd_check_stop_to_fabric(cmd); return; } @@ -2393,7 +2369,6 @@ static void target_complete_ok_work(struct work_struct *work) break; } - transport_lun_remove_cmd(cmd); transport_cmd_check_stop_to_fabric(cmd); return; @@ -2720,9 +2695,6 @@ int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) */ if (cmd->state_active) target_remove_from_state_list(cmd); - - if (cmd->se_lun) - transport_lun_remove_cmd(cmd); } if (aborted) cmd->free_compl = &compl; @@ -2794,6 +2766,9 @@ static void target_release_cmd_kref(struct kref *kref) struct completion *abrt_compl = se_cmd->abrt_compl; unsigned long flags; + if (se_cmd->lun_ref_active) + percpu_ref_put(&se_cmd->se_lun->lun_ref); + if (se_sess) { spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); list_del_init(&se_cmd->se_cmd_list); From patchwork Fri Jan 25 18:34:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10781877 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1DDE3746 for ; Fri, 25 Jan 2019 18:35:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E29F299B5 for ; Fri, 25 Jan 2019 18:35:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 021E42D40C; Fri, 25 Jan 2019 18:35:36 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 85F25299B5 for ; Fri, 25 Jan 2019 18:35:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726347AbfAYSfg (ORCPT ); Fri, 25 Jan 2019 13:35:36 -0500 Received: from out002.mailprotect.be ([83.217.72.86]:42677 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726468AbfAYSfg (ORCPT ); Fri, 25 Jan 2019 13:35:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=Ia9PN401CdZpd5j5sXgRL7+D8ITIK2WVCnEaIUITjVk=; b=fvQB6RmjvPVD AyJ43eEwS/+N9dUh74MJH4sh8Sv9n8evNmv1RT6M97N6ecmqgFccpN+BzI7TPCZQr3nMjn3SYXftm 9AiOHLoqxyAysr4sCrYDk0Z3zQ3nTLZyQfumfIIvpnIvs4aoKort2c3D9rz9rCuCQdaqpJL//oppa NiMLJtCkgHhLnmcUP+hEH+aAcJ7LoCInieC70cvnHfN9zgQf+SlCyCVcNzwkUVlWjpkT+fb21D1+L lNEPvy6i9zFsuEAWvUBhlDa0ac+hzNgw9HXgHWkgm1RZrBuBcyRkIS31s1qMnS0xklv6aSdHtc4l7 MkARa6qK54aIrA9bVtw05A==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gn6K1-00043b-1R; Fri, 25 Jan 2019 19:35:21 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id 0FA94C0E37; Fri, 25 Jan 2019 19:35:16 +0100 (CET) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Hannes Reinecke , Nicholas Bellinger , Mike Christie Subject: [PATCH 05/16] target/core: Add target_send_busy() Date: Fri, 25 Jan 2019 10:34:47 -0800 Message-Id: <20190125183458.220477-6-bvanassche@acm.org> X-Mailer: git-send-email 2.20.1.495.gaa96b0ce6b-goog In-Reply-To: <20190125183458.220477-1-bvanassche@acm.org> References: <20190125183458.220477-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.02) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5sJWPgUMGQY7+HvaJ1U4IYF602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3Ug2Z18o1igRi0Z9AoJlXGOnPH3eHvE/+YpYUPEvK1gTBln72tSTIs46SAn15Ne84Ii1Adc cqagVZJRZnZl4d3nIS6UrNZiHtAt59jy9+ozNKfG4a+c9WQHY/ZSYGCg0KRnz36GGSOBMm+psSmc byPT+hsz8/q/OdhF13mF+CJjMsw4Oh2LkwsmIC+tUiJAU2HndEL8IbXBpRiMfP45Wz78wlk3Iika AYYay6zwzan8jJM4FJK5OR3dA6AwcnrK6eluxYvH2diC53wrDh3bCBPDF5WZp3AjdoRkErSrWMfJ QHJjKxjcJRcKJtpa3z3WiRQgMC0euyRWJ7x26Tv0oaNKsUXpeAiVHBWlM6dy+vmbeKTVDs7kesTy xgBnHEJLB92HXTxY/qMUubkMYlqd+ktCHX+vFtCJx//m0zCjZt/DB0RQrWCXPBvjQPTjIqT7lOxF QVRTn8m0sooRS7h6xdEgKTjECb0PwpN4olPuA0AI936c0SM84BxzaZIqKXfxGEKe5uvtvYPx5J/1 /DRNJM82fPZrhRHbfToy2oDKQNcS6b3nFAzqVDaJcwcLq23NpoaBsPF95i7lyICvvxXyiD875tj7 5Sf4aVP7fG6vuK0FWaTbSxwffnx7O0ytw52gHEssAcmEV7hMz3mBMrH9L+m/q1FQxqV/jN1mSd2B +sBKHhmok11u89pTKgJ27pjsIdIep0kfiq020WMUa8+aHGcgs1FPpGVi/DyIOUdYNoUu3kPKlPIV leCf0Nzac2HxpxHPHkrggKwRrBHirQVdi7S7U8VMX2w7iiUjw9pZ+zXcnX6m+UeFXprlCOm3BAEb JtCUfKAc5tuMY57sizcN8Ybgo6ZwKd/lAfDURVeqOwDGeVPxhaTP1H+ecpe65ERyZY5hD/iWD0V+ +qD0gbQQTy2MYhai3vEoMrcP3ydYA96eq2KM8TNRPi4PtNSv3zAgl6Rv/trjt4n+OSd+6+F6OunJ 9jihx+Za/cV70jOJzN2r4A== X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be 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 Introduce a function that sends the SCSI status "BUSY" back to the initiator. The next patch will add a call to this function in the srpt target driver. Reviewed-by: Hannes Reinecke Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Signed-off-by: Bart Van Assche --- drivers/target/target_core_transport.c | 16 ++++++++++++++++ include/target/target_core_fabric.h | 1 + 2 files changed, 17 insertions(+) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 6471ede00336..e3f7e21e6614 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -3246,6 +3246,22 @@ transport_send_check_condition_and_sense(struct se_cmd *cmd, } EXPORT_SYMBOL(transport_send_check_condition_and_sense); +/** + * target_send_busy - Send SCSI BUSY status back to the initiator + * @cmd: SCSI command for which to send a BUSY reply. + * + * Note: Only call this function if target_submit_cmd*() failed. + */ +int target_send_busy(struct se_cmd *cmd) +{ + WARN_ON_ONCE(cmd->se_cmd_flags & SCF_SCSI_TMR_CDB); + + cmd->scsi_status = SAM_STAT_BUSY; + trace_target_cmd_complete(cmd); + return cmd->se_tfo->queue_status(cmd); +} +EXPORT_SYMBOL(target_send_busy); + 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 691c6b5e6520..8ed90407f062 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -173,6 +173,7 @@ int transport_generic_free_cmd(struct se_cmd *, int); bool transport_wait_for_tasks(struct se_cmd *); int transport_send_check_condition_and_sense(struct se_cmd *, sense_reason_t, int); +int target_send_busy(struct se_cmd *cmd); int target_get_sess_cmd(struct se_cmd *, bool); int target_put_sess_cmd(struct se_cmd *); void target_sess_cmd_list_set_waiting(struct se_session *); From patchwork Fri Jan 25 18:34:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10781883 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 27FDA746 for ; Fri, 25 Jan 2019 18:35:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16F32299B5 for ; Fri, 25 Jan 2019 18:35:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B6EC2D40C; Fri, 25 Jan 2019 18:35:42 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 A1052299B5 for ; Fri, 25 Jan 2019 18:35:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726630AbfAYSfl (ORCPT ); Fri, 25 Jan 2019 13:35:41 -0500 Received: from com-out001.mailprotect.be ([83.217.72.83]:58393 "EHLO com-out001.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726689AbfAYSfk (ORCPT ); Fri, 25 Jan 2019 13:35:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=BMNHUyaDpSEJmWIiGCibsv6/YczNEXwaJUj9wHfawVU=; b=Vg62QllJgvZ8 hBbLyBnjWa6YBrFjVPvxikhlH6HJluTq/QCwP0pepC+hen6DFbDi8YY1gLvMHZYrMHaCXGyq1de29 2Zv/+Nm0hVxaJDJ593uXEE/9bbuUwJakcphhRtwlMxfd7w1zU0WgU7POvRZ5JFoOjGWRS/DRD96Cr K7C/TnTV5emQ0lyc/FaLyI6W63TLI87zfdyAPZ3i3W9hl5PjUAzeNt5z18bDHNt/cDap2yMHjF2ao zc1mragnjeDudBMpPaQwq0JBtVcB+91ONio7ffvezAoPv/PWwKJfgmRS5ANNy+N7FdIxvK1sHYc63 JExlY0l8XmzfqeIixo2G8Q==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out001.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gn6KA-0008qM-4C; Fri, 25 Jan 2019 19:35:31 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id C5B54C0E75; Fri, 25 Jan 2019 19:35:18 +0100 (CET) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Hannes Reinecke , Doug Ledford , Jason Gunthorpe , Nicholas Bellinger , Mike Christie Subject: [PATCH 06/16] RDMA/srpt: Fix handling of command / TMF submission failure Date: Fri, 25 Jan 2019 10:34:48 -0800 Message-Id: <20190125183458.220477-7-bvanassche@acm.org> X-Mailer: git-send-email 2.20.1.495.gaa96b0ce6b-goog In-Reply-To: <20190125183458.220477-1-bvanassche@acm.org> References: <20190125183458.220477-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.10) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5u05tJNjG4e9M1yX4pIu5EZ602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfV6lLB7UkASj5+Q7Z1jo1wYoGcQZDc/NA+AYRc xIJwNJDswajEtdTx0z97RFosJ+0XX4J8p9+Z4Omt11SsRVhZc5O0+hI4m8XEgLG9kXesazurVxXh H80moATcJz9k4m0jSta6vzX6sWvOVdfPU9Q907I7wX4PVM8uRZ9JrPUGzdHRxIJlBVnNQuCDcjNk rc6VqwD+Ufwmnv2XpsoA/vlp5nL7bykX8cT9ReKnRim+apKC0G2y+Mr2ale9nnzXJ+o155gCTHdl yYtlgXnoDkY8D6BBQD2I5QH2BdbXmK3rYa8ppXum6KZe4eMUTLjXn3BvjnQnhcJex8V1sw+C2xqM rAbZykneW87JZ7jdpAlXQVADDgYNo2L2ikikIJmXA+EJKJ9CDjyJqwMkv6BJB2lztCOV7QtxJNU+ igS6jZCzGqpJmuDNJ3/L9Q9wLc4aqLRUvPEObNwbSIpq9S/jgd899z3dKxLhoxcmaInYbR5vlqFZ JlLyK2ygHNTfy41Cttvo7sn//RcLEIwmfxtejjVQPRdR7J54uCh7y/cyXn4gNizEl4GT+izmPxps 5i3VIDAVOJYVhKWF91egvasFoFaoK60jiD6XqsJZtjQxlyCdseyHOMuZZG++RlG2AEFbDFHRWlcI SpJ6e8JC6wP/8HYDL+1c8twN16nRcvZBM0i67pivXHVFggc0157Ysxlq5Z3dsksKeFRmKOHI/40C LjPihwIeoj9zwqNSJz8SHmCZ+bxCLHLD8M1AAidHW08kKeoFJwcvz6VMYEhUT3FsSRfv2/sMSIEg vIcW6VO3wxn7YUdTGesc17KK80fmShmQp5h073MzmfHyQ8SgOIU0wXK50CG7X+t1TW39Ja77LGPp OwAj6IMP28aPMtl2u6Kx+4+Huxzv1d6/j7MDIN1SScQedH2YWYgPyAz1BkOLTUiGJowwNFwKBhAh 7NeKYzwwwYGp+p2okElJG6VbPeUnGhV3sd4rxYOjbs6j0mefY0b4ffxz8Ne0ck6P4ivKdWmRJx+g ZBY48FVjzYzwQJ8NPI1L8nQzI24Mi0RodUDIJ7TXkAZ8Lg3hgpwJj9Y7nkVKceR7 X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be 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 submitting an SRP IU to the target core fails, send the SCSI response "BUSY" to the initiator instead of not sending any response. Reviewed-by: Hannes Reinecke Cc: Doug Ledford Cc: Jason Gunthorpe Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Signed-off-by: Bart Van Assche --- drivers/infiniband/ulp/srpt/ib_srpt.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 8cee8c6c6be9..4fc901d1c0c1 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1505,7 +1505,7 @@ static void srpt_handle_cmd(struct srpt_rdma_ch *ch, pr_err("0x%llx: parsing SRP descriptor table failed.\n", srp_cmd->tag); } - goto release_ioctx; + goto busy; } rc = target_submit_cmd_map_sgls(cmd, ch->sess, srp_cmd->cdb, @@ -1516,13 +1516,12 @@ static void srpt_handle_cmd(struct srpt_rdma_ch *ch, if (rc != 0) { pr_debug("target_submit_cmd() returned %d for tag %#llx\n", rc, srp_cmd->tag); - goto release_ioctx; + goto busy; } return; -release_ioctx: - send_ioctx->state = SRPT_STATE_DONE; - srpt_release_cmd(cmd); +busy: + target_send_busy(cmd); } static int srp_tmr_to_tcm(int fn) From patchwork Fri Jan 25 18:34:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10781879 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3CE1614E5 for ; Fri, 25 Jan 2019 18:35:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D31B2CFC3 for ; Fri, 25 Jan 2019 18:35:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 219302D40C; Fri, 25 Jan 2019 18:35:41 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 A6B34299B5 for ; Fri, 25 Jan 2019 18:35:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726761AbfAYSfk (ORCPT ); Fri, 25 Jan 2019 13:35:40 -0500 Received: from out002.mailprotect.be ([83.217.72.86]:58983 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726468AbfAYSfk (ORCPT ); Fri, 25 Jan 2019 13:35:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=ICxJpr93i+Nuz34RZ/by9eY7H/H0HbGwy4nq2Te7cX0=; b=dPLjXYGfpFjb YonPl10uGkeLIjwk96N9aust5ytlMQkte5FMsEmOhJDPytqKhp4hjMOYEIxy4eheMo6EN266moeml +1/K0B/FscgbPdxwyq0ukmOIj5/kphWnYnzKGz3NZPocjRFXcorbxt+c3EfgbNSWFZJimzAGUC3GN KDg+krIZmK4HkouG8dF8XiCufgDXs61FPtLU6gVuwnxEIPSRjlmFjPMxQ6ksIGzECFMciDAoIjDzx +7FgOzR/VfyRF2SAdX/P5P/Tjiu4Ne4x8bqv4Ct8jI7t7Gxb5VB2/9qlhPyYqnGxhn74PcwBl30io UvIYXKPYl6dQz3lI55RKdQ==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gn6K5-00041F-A7; Fri, 25 Jan 2019 19:35:25 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id 115A8C0E37; Fri, 25 Jan 2019 19:35:20 +0100 (CET) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Hannes Reinecke , Doug Ledford , Jason Gunthorpe , Nicholas Bellinger , Mike Christie Subject: [PATCH 07/16] RDMA/srpt: Fix handling of TMF submission failure Date: Fri, 25 Jan 2019 10:34:49 -0800 Message-Id: <20190125183458.220477-8-bvanassche@acm.org> X-Mailer: git-send-email 2.20.1.495.gaa96b0ce6b-goog In-Reply-To: <20190125183458.220477-1-bvanassche@acm.org> References: <20190125183458.220477-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.03) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5sigSefPQad3GTEzSFXcT9N602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfV6lLB7UkASj5+Q7Z1jo1wYoGcQZDc/NA+AYRc xIJwNJDswajEtdTx0z97RFosJ+0XX4J8p9+Z4Omt11SsRVhZc5O0+hI4m8XEgLG9kXesazurVxXh H80moATcJz9k4m0jSta6vzX6sWvOVdfPU9Q907I7wX4PVM8uRZ9JrPUGzdFA3jowT7Vk6IsEkXT6 JBEZqJ2jUG6iVD0cGbSjkzfIDnL7bykX8cT9ReKnRim+apKC0G2y+Mr2ale9nnzXJ+o1UDSGW782 k6dpc2+siniZEaBBQD2I5QH2BdbXmK3rYa8ppXum6KZe4eMUTLjXn3BvjnQnhcJex8V1sw+C2xqM rAbZykneW87JZ7jdpAlXQVADDgYNo2L2ikikIJmXA+EJKJ9CDjyJqwMkv6BJB2lztCOV7QtxJNU+ igS6jZCzGqpJmuDNJ3/L9Q9wLc4aqLRUvPEObNwbSIpq9S/jgd899z3dKxLhoxcmaInYbR5vlqFZ JlLyK2ygHNTfy41Cttvo7sn//RcLEIwmfxtejjVQPRdR7J54uCh7y/cyXn4gNizEl4GT+izmPxps 5i3VIDAVOJYVhKWF91egvasFoFaoK60jiD6XqsJZtjQxlyCdseyHOMuZZG++RlG2AEFbDFHRYfQQ D0IVT5dlkCOLok5OEqSW2lt5aih+W51C5Y+/8f2vXHVFggc0157Ysxlq5Z3dsksKeFRmKOHI/40C LjPihwIeoj9zwqNSJz8SHmCZ+bxCLHLD8M1AAidHW08kKeoFJwcvz6VMYEhUT3FsSRfv2/sMSIEg vIcW6VO3wxn7YUf7u61u5IuMkrMG8QweKkluR++MnGtTYbCYZvju5BZegSG7X+t1TW39Ja77LGPp OwAj6IMP28aPMtl2u6Kx+4+Huxzv1d6/j7MDIN1SScQedH2YWYgPyAz1BkOLTUiGJowwNFwKBhAh 7NeKYzwwwYGp+p2okElJG6VbPeUnGhV3sd4rxYOjbs6j0mefY0b4ffxz8Ne0ck6P4ivKdWmRJx+g ZBY48FVjzYzwQJ8NPI1L8nQzI24Mi0RodUDIJ7TXkAZ8Lg3hgpwJj9Y7nkVKceR7 X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be 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 submitting a TMF to the target core fails, send the "FUNCTION REJECTED" response to the initiator. Reviewed-by: Hannes Reinecke Cc: Doug Ledford Cc: Jason Gunthorpe Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Signed-off-by: Bart Van Assche --- drivers/infiniband/ulp/srpt/ib_srpt.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 4fc901d1c0c1..0dc2df925f76 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1581,11 +1581,9 @@ static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch, TARGET_SCF_ACK_KREF); if (rc != 0) { send_ioctx->cmd.se_tmr_req->response = TMR_FUNCTION_REJECTED; - goto fail; + cmd->se_tfo->queue_tm_rsp(cmd); } return; -fail: - transport_send_check_condition_and_sense(cmd, 0, 0); // XXX: } /** From patchwork Fri Jan 25 18:34:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10781893 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8B91C14E5 for ; Fri, 25 Jan 2019 18:35:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A5B0299B5 for ; Fri, 25 Jan 2019 18:35:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6EA902D40C; Fri, 25 Jan 2019 18:35:50 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 C506D299B5 for ; Fri, 25 Jan 2019 18:35:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728974AbfAYSft (ORCPT ); Fri, 25 Jan 2019 13:35:49 -0500 Received: from out002.mailprotect.be ([83.217.72.86]:38615 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726689AbfAYSft (ORCPT ); Fri, 25 Jan 2019 13:35:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=C2DofYuZePEuHZfcAD7TOy8xPBfdFgPlEtC6zojvl7g=; b=DvT9VkPxp7CF fwMJwxqXW1phSLzdlZY1g7MpAUfhGsm2wdLRvLnpWLWmW9ffX/eV0IaBxwlcllYrm+HB7Fs8s6TgP Rq15KtW5FR8BnrGM6ZW3I44whSL8EXJcJteOvvPIPd0DsHpxiYKDACHZPZgx8pDM/1hOIh6iKesXj SEP8Kqtt8nbjg4EDbImtDbeCBsy6YpvDOWX4+JPuMtIcatxM94Z3StSjd7Huz9aedVcsGO8ha6tV9 iB+Z5GIlJE9KOXs53iMyuOCE6qThe3ctdH7umdvP6p5h/1mXCE2b+yy6DvmiJCN7kO1ecMERe+dm+ s0rmHkzJmW8O3JvquViMJQ==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gn6K7-00041F-5b; Fri, 25 Jan 2019 19:35:27 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id 154D3C05E8; Fri, 25 Jan 2019 19:35:22 +0100 (CET) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Doug Ledford , Jason Gunthorpe , Nicholas Bellinger , Mike Christie , Hannes Reinecke Subject: [PATCH 08/16] RDMA/srpt: Rework I/O context allocation Date: Fri, 25 Jan 2019 10:34:50 -0800 Message-Id: <20190125183458.220477-9-bvanassche@acm.org> X-Mailer: git-send-email 2.20.1.495.gaa96b0ce6b-goog In-Reply-To: <20190125183458.220477-1-bvanassche@acm.org> References: <20190125183458.220477-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.01) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5gFPQmS7yB0UGkfYRuQNzMZ602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfV6lLB7UkASj5+Q7Z1jo1wYoGcQZDc/NA+AYRc xIJwNJDswajEtdTx0z97RFosJ+0XX4J8p9+Z4Omt11SsRVhZc5O0+hI4m8XEgLG9kXesazurVxXh H80moATcJz9k4m0jSta6vzX6sWvOVdfPU9Q907I7wX4PVM8uRZ9JrPUGzdHL+nwxyTuzU6NHiyz3 2CjgPash4POzTXhXrXtCoyUxYnL7bykX8cT9ReKnRim+apKC0G2y+Mr2ale9nnzXJ+o1UDSGW782 k6dpc2+siniZEaBBQD2I5QH2BdbXmK3rYa8ppXum6KZe4eMUTLjXn3BvjnQnhcJex8V1sw+C2xqM rAbZykneW87JZ7jdpAlXQVADDgYNo2L2ikikIJmXA+EJKJ9CDjyJqwMkv6BJB2lztCOV7QtxJNU+ igS6jZCzGqpJmuDNJ3/L9Q9wLc4aqLRUvPEObNwbSIpq9S/jgd899z3dKxLhoxcmaInYbR5vlqFZ JlLyK2ygHNTfy41Cttvo7sn//RcLEIwmfxtejjVQPRdR7J54uCh7y/cyXn4gNizEl4GT+izmPxps 5i3VIDAVOJYVhKWF91egvasFoFaoK60jiD6XqsJZtjQxlyCdseyHOMuZZG++RlG2AEFbDFHRYfQQ D0IVT5dlkCOLok5OEpM+qhtGEAXCDCj6buXQqievXHVFggc0157Ysxlq5Z3dsksKeFRmKOHI/40C LjPihwIeoj9zwqNSJz8SHmCZ+bxCLHLD8M1AAidHW08kKeoFJwcvz6VMYEhUT3FsSRfv2/sMSIEg vIcW6VO3wxn7YUe2npEB56Tu+3WZdyLKI7D3A2hEbVRTTjTXJKZ3p5pgpyG7X+t1TW39Ja77LGPp OwAj6IMP28aPMtl2u6Kx+4+Huxzv1d6/j7MDIN1SScQedH2YWYgPyAz1BkOLTUiGJowwNFwKBhAh 7NeKYzwwwYGp+p2okElJG6VbPeUnGhV3sd4rxYOjbs6j0mefY0b4ffxz8Ne0ck6P4ivKdWmRJx+g ZBY48FVjzYzwQJ8NPI1L8nQzI24Mi0RodUDIJ7TXkAZ8Lg3hgpwJj9Y7nkVKceR7 X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be 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 Instead of maintaining a list of free I/O contexts, use an sbitmap data structure to track which I/O contexts are in use and which are free. This makes the ib_srpt driver more consistent with other LIO drivers. Cc: Doug Ledford Cc: Jason Gunthorpe Cc: Nicholas Bellinger Cc: Mike Christie Cc: Hannes Reinecke Cc: Christoph Hellwig Signed-off-by: Bart Van Assche --- drivers/infiniband/ulp/srpt/ib_srpt.c | 47 +++++++++++---------------- drivers/infiniband/ulp/srpt/ib_srpt.h | 4 --- 2 files changed, 19 insertions(+), 32 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 0dc2df925f76..d426e01905f9 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1217,22 +1217,15 @@ static int srpt_ch_qp_err(struct srpt_rdma_ch *ch) static struct srpt_send_ioctx *srpt_get_send_ioctx(struct srpt_rdma_ch *ch) { struct srpt_send_ioctx *ioctx; - unsigned long flags; + int tag, cpu; BUG_ON(!ch); - ioctx = NULL; - spin_lock_irqsave(&ch->spinlock, flags); - if (!list_empty(&ch->free_list)) { - ioctx = list_first_entry(&ch->free_list, - struct srpt_send_ioctx, free_list); - list_del(&ioctx->free_list); - } - spin_unlock_irqrestore(&ch->spinlock, flags); - - if (!ioctx) - return ioctx; + tag = sbitmap_queue_get(&ch->sess->sess_tag_pool, &cpu); + if (tag < 0) + return NULL; + ioctx = ch->ioctx_ring[tag]; BUG_ON(ioctx->ch != ch); ioctx->state = SRPT_STATE_NEW; WARN_ON_ONCE(ioctx->recv_ioctx); @@ -1245,6 +1238,8 @@ static struct srpt_send_ioctx *srpt_get_send_ioctx(struct srpt_rdma_ch *ch) */ memset(&ioctx->cmd, 0, sizeof(ioctx->cmd)); memset(&ioctx->sense_data, 0, sizeof(ioctx->sense_data)); + ioctx->cmd.map_tag = tag; + ioctx->cmd.map_cpu = cpu; return ioctx; } @@ -2148,7 +2143,7 @@ static int srpt_cm_req_recv(struct srpt_device *const sdev, struct srpt_rdma_ch *ch = NULL; char i_port_id[36]; u32 it_iu_len; - int i, ret; + int i, tag_num, tag_size, ret; WARN_ON_ONCE(irqs_disabled()); @@ -2248,11 +2243,8 @@ static int srpt_cm_req_recv(struct srpt_device *const sdev, goto free_rsp_cache; } - INIT_LIST_HEAD(&ch->free_list); - for (i = 0; i < ch->rq_size; i++) { + for (i = 0; i < ch->rq_size; i++) ch->ioctx_ring[i]->ch = ch; - list_add_tail(&ch->ioctx_ring[i]->free_list, &ch->free_list); - } if (!sdev->use_srq) { u16 imm_data_offset = req->req_flags & SRP_IMMED_REQUESTED ? be16_to_cpu(req->imm_data_offset) : 0; @@ -2306,18 +2298,20 @@ static int srpt_cm_req_recv(struct srpt_device *const sdev, pr_debug("registering session %s\n", ch->sess_name); + tag_num = ch->rq_size; + tag_size = 1; /* ib_srpt does not use se_sess->sess_cmd_map */ if (sport->port_guid_tpg.se_tpg_wwn) - ch->sess = target_setup_session(&sport->port_guid_tpg, 0, 0, - TARGET_PROT_NORMAL, + ch->sess = target_setup_session(&sport->port_guid_tpg, tag_num, + tag_size, TARGET_PROT_NORMAL, ch->sess_name, ch, NULL); if (sport->port_gid_tpg.se_tpg_wwn && IS_ERR_OR_NULL(ch->sess)) - ch->sess = target_setup_session(&sport->port_gid_tpg, 0, 0, - TARGET_PROT_NORMAL, i_port_id, ch, - NULL); + ch->sess = target_setup_session(&sport->port_gid_tpg, tag_num, + tag_size, TARGET_PROT_NORMAL, i_port_id, + ch, NULL); /* Retry without leading "0x" */ if (sport->port_gid_tpg.se_tpg_wwn && IS_ERR_OR_NULL(ch->sess)) - ch->sess = target_setup_session(&sport->port_gid_tpg, 0, 0, - TARGET_PROT_NORMAL, + ch->sess = target_setup_session(&sport->port_gid_tpg, tag_num, + tag_size, TARGET_PROT_NORMAL, i_port_id + 2, ch, NULL); if (IS_ERR_OR_NULL(ch->sess)) { WARN_ON_ONCE(ch->sess == NULL); @@ -3279,7 +3273,6 @@ static void srpt_release_cmd(struct se_cmd *se_cmd) struct srpt_send_ioctx, cmd); struct srpt_rdma_ch *ch = ioctx->ch; struct srpt_recv_ioctx *recv_ioctx = ioctx->recv_ioctx; - unsigned long flags; WARN_ON_ONCE(ioctx->state != SRPT_STATE_DONE && !(ioctx->cmd.transport_state & CMD_T_ABORTED)); @@ -3295,9 +3288,7 @@ static void srpt_release_cmd(struct se_cmd *se_cmd) ioctx->n_rw_ctx = 0; } - spin_lock_irqsave(&ch->spinlock, flags); - list_add(&ioctx->free_list, &ch->free_list); - spin_unlock_irqrestore(&ch->spinlock, flags); + target_free_tag(se_cmd->se_sess, se_cmd); } /** diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.h b/drivers/infiniband/ulp/srpt/ib_srpt.h index 39b3e50baf3d..ee9f20e9177a 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.h +++ b/drivers/infiniband/ulp/srpt/ib_srpt.h @@ -207,7 +207,6 @@ struct srpt_rw_ctx { * @rw_ctxs: RDMA read/write contexts. * @imm_sg: Scatterlist for immediate data. * @rdma_cqe: RDMA completion queue element. - * @free_list: Node in srpt_rdma_ch.free_list. * @state: I/O context state. * @cmd: Target core command data structure. * @sense_data: SCSI sense data. @@ -227,7 +226,6 @@ struct srpt_send_ioctx { struct scatterlist imm_sg; struct ib_cqe rdma_cqe; - struct list_head free_list; enum srpt_command_state state; struct se_cmd cmd; u8 n_rdma; @@ -277,7 +275,6 @@ enum rdma_ch_state { * @req_lim_delta: Number of credits not yet sent back to the initiator. * @imm_data_offset: Offset from start of SRP_CMD for immediate data. * @spinlock: Protects free_list and state. - * @free_list: Head of list with free send I/O contexts. * @state: channel state. See also enum rdma_ch_state. * @using_rdma_cm: Whether the RDMA/CM or IB/CM is used for this channel. * @processing_wait_list: Whether or not cmd_wait_list is being processed. @@ -318,7 +315,6 @@ struct srpt_rdma_ch { atomic_t req_lim_delta; u16 imm_data_offset; spinlock_t spinlock; - struct list_head free_list; enum rdma_ch_state state; struct kmem_cache *rsp_buf_cache; struct srpt_send_ioctx **ioctx_ring; From patchwork Fri Jan 25 18:34:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10781895 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CCF7214E5 for ; Fri, 25 Jan 2019 18:35:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC812299B5 for ; Fri, 25 Jan 2019 18:35:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B0F792D40C; Fri, 25 Jan 2019 18:35:51 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 52786299B5 for ; Fri, 25 Jan 2019 18:35:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729210AbfAYSfv (ORCPT ); Fri, 25 Jan 2019 13:35:51 -0500 Received: from out002.mailprotect.be ([83.217.72.86]:50835 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726361AbfAYSfu (ORCPT ); Fri, 25 Jan 2019 13:35:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=krW+SZ+xafnEpilu58vDieUcGbHZjOVN2eQEnx0THe4=; b=I7XtgMRpQkJm RDkq/GHrzCUjdUMnTmio2eFoPLlTXv5Kk/ip72Nz6FhlOwgCez2/uQAMRq2yEw/K8MXxUB379OzR3 Br6WWSeO3OMYDgWaFn35hIdk6JGqpO1Byb43OOxqQkxnJyNiGSdT5LjVnCd9O0kgbNZEjI+7jpgyl HL1I1D51QS3eQ1l4dKKg80mSsZaBK9do9aVrgazwI8zMtG1UoFkBvnDAwDEQ8TFQxmuOR5uRbnuqq Lks0sYFTTF7SIUZEOGF+l9fzltJaEcLleVIS2mseL6ik176AwkB3SeY127DfZiaUZ2QlKW3uq3DTy XzO4HoQVT0P8+vxaVbw7bA==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gn6K9-00041F-5x; Fri, 25 Jan 2019 19:35:29 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id 04F66C07A1; Fri, 25 Jan 2019 19:35:24 +0100 (CET) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Doug Ledford , Jason Gunthorpe , Nicholas Bellinger , Mike Christie , Hannes Reinecke Subject: [PATCH 09/16] RDMA/srpt: Fix a credit leak for aborted commands Date: Fri, 25 Jan 2019 10:34:51 -0800 Message-Id: <20190125183458.220477-10-bvanassche@acm.org> X-Mailer: git-send-email 2.20.1.495.gaa96b0ce6b-goog In-Reply-To: <20190125183458.220477-1-bvanassche@acm.org> References: <20190125183458.220477-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.04) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5mv+aMKoozBnNLw2JYRkbLJ602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfV6lLB7UkASj5+Q7Z1jo1wYoGcQZDc/NA+AYRc xIJwNJDswajEtdTx0z97RFosJ+0XX4J8p9+Z4Omt11SsRVhZc5O0+hI4m8XEgLG9kXesazurVxXh H80moATcJz9k4m0jSta6vzX6sWvOVdfPU9Q907I7wX4PVM8uRZ9JrPUGzdH8MohzY4snR3KaIji8 TCpeqwD+Ufwmnv2XpsoA/vlp5nL7bykX8cT9ReKnRim+apKC0G2y+Mr2ale9nnzXJ+o1UDSGW782 k6dpc2+siniZEaBBQD2I5QH2BdbXmK3rYa8ppXum6KZe4eMUTLjXn3BvjnQnhcJex8V1sw+C2xqM rAbZykneW87JZ7jdpAlXQVADDgYNo2L2ikikIJmXA+EJKJ9CDjyJqwMkv6BJB2lztCOV7QtxJNU+ igS6jZCzGqpJmuDNJ3/L9Q9wLc4aqLRUvPEObNwbSIpq9S/jgd899z3dKxLhoxcmaInYbR5vlqFZ JlLyK2ygHNTfy41Cttvo7sn//RcLEIwmfxtejjVQPRdR7J54uCh7y/cyXn4gNizEl4GT+izmPxps 5i3VIDAVOJYVhKWF91egvasFoFaoK60jiD6XqsJZtjQxlyCdseyHOMuZZG++RlG2AEFbDFHRYfQQ D0IVT5dlkCOLok5OEhHA/eZZmmYTy+sY/CHpKeGvXHVFggc0157Ysxlq5Z3dsksKeFRmKOHI/40C LjPihwIeoj9zwqNSJz8SHmCZ+bxCLHLD8M1AAidHW08kKeoFJwcvz6VMYEhUT3FsSRfv2/sMSIEg vIcW6VO3wxn7YUf2EDYZyEwli+6nIpmk0EVL0EenctfJrl/gfo+D0ODnoCG7X+t1TW39Ja77LGPp OwAj6IMP28aPMtl2u6Kx+4+Huxzv1d6/j7MDIN1SScQedH2YWYgPyAz1BkOLTUiGJowwNFwKBhAh 7NeKYzwwwYGp+p2okElJG6VbPeUnGhV3sd4rxYOjbs6j0mefY0b4ffxz8Ne0ck6P4ivKdWmRJx+g ZBY48FVjzYzwQJ8NPI1L8nQzI24Mi0RodUDIJ7TXkAZ8Lg3hgpwJj9Y7nkVKceR7 X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be 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 Make sure that the next time a response is sent to the initiator that the credit it had allocated for the aborted request gets freed. Cc: Doug Ledford Cc: Jason Gunthorpe Cc: Nicholas Bellinger Cc: Mike Christie Cc: Hannes Reinecke Cc: Christoph Hellwig Fixes: 131e6abc674e ("target: Add TFO->abort_task for aborted task resources release") # v3.15 Signed-off-by: Bart Van Assche --- drivers/infiniband/ulp/srpt/ib_srpt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index d426e01905f9..1a039f16d315 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -2870,8 +2870,19 @@ static void srpt_queue_tm_rsp(struct se_cmd *cmd) srpt_queue_response(cmd); } +/* + * This function is called for aborted commands if no response is sent to the + * initiator. Make sure that the credits freed by aborting a command are + * returned to the initiator the next time a response is sent by incrementing + * ch->req_lim_delta. + */ static void srpt_aborted_task(struct se_cmd *cmd) { + struct srpt_send_ioctx *ioctx = container_of(cmd, + struct srpt_send_ioctx, cmd); + struct srpt_rdma_ch *ch = ioctx->ch; + + atomic_inc(&ch->req_lim_delta); } static int srpt_queue_status(struct se_cmd *cmd) From patchwork Fri Jan 25 18:34:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10781881 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 977301515 for ; Fri, 25 Jan 2019 18:35:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87404299B5 for ; Fri, 25 Jan 2019 18:35:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7BE242E1DB; Fri, 25 Jan 2019 18:35:41 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 22AD3299B5 for ; Fri, 25 Jan 2019 18:35:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726468AbfAYSfk (ORCPT ); Fri, 25 Jan 2019 13:35:40 -0500 Received: from out002.mailprotect.be ([83.217.72.86]:55733 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726630AbfAYSfk (ORCPT ); Fri, 25 Jan 2019 13:35:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=Yq083VKoq/rpKHRmJ/JxF9tOOUFh3ryf1xUvllYjmqY=; b=gBbyIpalAgYP dD4l9hz1pY1M0P8gFe/IQZgKrU9+fx73ht1HCXdTKXslaV0rr/4ezVrQqj3V9xjjVJ0nYftOJZ4KC 7bLWl7kpI+2Iw2h7xWjITqBk+fbq2UVAr2H5bKTpAFMi1uNnWnO5ERzyXJSYyJFlC1r7qPDSyBQ/c 5sdYXLsDWsNbo7l51T+q/1TVrgo3DiM6Nw7OvKUsxGrZrEhnFHIs1ELX2mySktKqijmteZsxsY1Pg FIG2fjQlLWXjiAphCKxfpdvbcv9ni2nvOvT1i8LskuxHS/k6/0iHDh47UGeB/LUPju70OQ/teOZOV 7EYeUBCy0fDFE1aNjVuykg==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gn6KA-00045D-QI; Fri, 25 Jan 2019 19:35:31 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id F3639C05E8; Fri, 25 Jan 2019 19:35:26 +0100 (CET) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Nicholas Bellinger , Mike Christie , Hannes Reinecke Subject: [PATCH 10/16] target/iscsi: Remove an incorrect comment Date: Fri, 25 Jan 2019 10:34:52 -0800 Message-Id: <20190125183458.220477-11-bvanassche@acm.org> X-Mailer: git-send-email 2.20.1.495.gaa96b0ce6b-goog In-Reply-To: <20190125183458.220477-1-bvanassche@acm.org> References: <20190125183458.220477-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.05) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5tW0sT1QyEeQ+MAocKmG+Eh602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WlZa4xKvcBORT2AGmYYKfacHGRHPT1S45qX7/AQuG3+Xws3TRjaC42FtNJuTWwh7zLjlV5 cBkg2E15FOz6ftN7V7SOd4Jxn3vWA/jySgiqt8902MBxp+G42GIBqokZAnJ5xBHkCMCjMposz65/ e+f6sz9VtXrOJenZ5zYaF/sdP+70pheH5TNN6RiG9N0Jt+0ML5i3g2GFaGQnZ3KowlU8anvoc7s0 eHtsyrH7f4vWs1KcgxQTqdSE3cxlP67ssuZxn2a3k66wqHQRkdHrnUf0XuDVW1RAVP/E7/UYy9T8 rkAMvHmBTTipZKIPq3iOj9tSKKqNUqeXR0rRzsN1a4pGQL1kekvvDc/yYbCCC8p9CUWioSPTx/yi OJKFnIIso8zn0j1QBmC0JIZXgnugZTuCZyCgxZHINA6A5+7T9o6by3MDjiILWse2C7xyo18DbRKd 6+6AB9mEpRX5vy67WwDjehIqUczFWeS6sE8e1b5/UkBg4yvMn5MBAdwJubari/j0NbttK1RyTzg9 21y9+zCxO6B1WisJdr+Oay4DE5GzXPnPeYhY+SsiPsabcWor0FoHmFDqewO9xyOqCYO8P1aHTwaH Q1Qo4eQXu+BLLP1GOzxnZ5UDYNafOy0Jr+QbiT1CJ/k2Jo+Zn4s9cWJWa0GqPkin+M+n/jXu6/99 KOMlrjA0XAoGECHs14pjPDDBgal9xZYz2MK6AE8POx8Vj5IoIgARI0tqzkORPA8/oOttt+GvX4pw eNl/rRtjBlWxM4EU005YMQtTGkqF9DfSXeTqNQl0N82pGAaFlBh9ydCic1KxHB/etGG+jKYi/tvO WyEnBy/PpUxgSFRPcWxJF+/bZGcrdi6P9WA8qPaxL9ILtEIqJpgLAx9UBkVVtWWC7u0df68W0InH /+bTMKNm38MHe3iJ5ql2Fx06AJIYSscySZesPRxtLbAe07w72Y8M1+Qa8Q/Annoe3C1wCMjQ1GK/ MS+4ayUpOtEhdxekWDmK9g== X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be 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 The single iscsit_start_nopin_response_timer() caller does not hold any locks. Hence remove the comment above this function. Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke Signed-off-by: Bart Van Assche --- drivers/target/iscsi/iscsi_target_util.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index 86987da86dd6..762448e2f8b7 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c @@ -956,9 +956,6 @@ void iscsit_mod_nopin_response_timer(struct iscsi_conn *conn) spin_unlock_bh(&conn->nopin_timer_lock); } -/* - * Called with conn->nopin_timer_lock held. - */ void iscsit_start_nopin_response_timer(struct iscsi_conn *conn) { struct iscsi_session *sess = conn->sess; From patchwork Fri Jan 25 18:34:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10781885 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 774C6746 for ; Fri, 25 Jan 2019 18:35:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65540299B5 for ; Fri, 25 Jan 2019 18:35:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 596ED2D40C; Fri, 25 Jan 2019 18:35:45 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 8FE28299B5 for ; Fri, 25 Jan 2019 18:35:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726778AbfAYSfo (ORCPT ); Fri, 25 Jan 2019 13:35:44 -0500 Received: from out002.mailprotect.be ([83.217.72.86]:43781 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726689AbfAYSfo (ORCPT ); Fri, 25 Jan 2019 13:35:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=cNQZug3nsVF4o3MwExilGvYVCwO0cIV0hyElNMtVJAo=; b=RJAhYrtFxs1Y t767NAokJls5XwAXkfgrNWopQi81O2ATde9QGNY9HbMW3Pzxpn4Kabdj9plUMGZ28kJX208L+w7LA yZHAsk0thxFRwToV6OL+2DY+YW/JE0ylFw3krAirFBp72FS+dMEcnt/+Csipb8EDpimJzoBH6018x Z7MBYJBV//HlmnRk06zeuYS+z3/ZPY+UesHUduJJw287dLj/0DaWxdxpj4mATSTQACoymaYxFW6VG IuAafrlvkAqUZpAbCVq6/lMmYH4VuEPwzZXOG/rKV+vg5nmbsOvAH3hJmrGOXeqJFL4Fo2NrXcPjC 857OX8lRhuhnPAfBJk9aqg==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gn6KC-00045D-Ga; Fri, 25 Jan 2019 19:35:32 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id 8C522C0E37; Fri, 25 Jan 2019 19:35:28 +0100 (CET) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Nicholas Bellinger , Mike Christie , Hannes Reinecke Subject: [PATCH 11/16] target/iscsi: Convert comments about locking into runtime checks Date: Fri, 25 Jan 2019 10:34:53 -0800 Message-Id: <20190125183458.220477-12-bvanassche@acm.org> X-Mailer: git-send-email 2.20.1.495.gaa96b0ce6b-goog In-Reply-To: <20190125183458.220477-1-bvanassche@acm.org> References: <20190125183458.220477-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: SB/global_tokens (9.8292712394e-05) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5t8I/CZ40ndBsB6MMpEeBm9602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WlZa4xKvcBORT2AGmYYKfacHGRHPT1S45qX7/AQuG3+Xws3TRjaC42FtNJuTWwh7zLjlV5 cBkg2E15FOz6ftN7ifzQyhDbQxW358qRfumR+c902MBxp+G42GIBqokZAnJ5xBHkCMCjMposz65/ e+f6sz9VtXrOJenZ5zYaF/sdP+70pheH5TNN6RiG9N0Jt+0ML5i3g2GFaGQnZ3KowlU8anvoc7s0 eHtsyrH7f4vWs1KcgxQTqdSE3cxlP67ssuZxn2a3k66wqHQRkdHrnUf0XuDVW1RAVP/E7/UYy9T8 rkAMvHmBTTipZKIPq3iOj9tSKKqNUqeXR0rRzsN1a4pG17niOlhFcyO9tgQb+/TkwEEqJ2YhaHYK PX4HHcW4fmLLdh/NSb/qpYVFz2DoGXALBBlIJ0WBFPu4HenOcZSI92EP+JYPRX76oPSBtBBPLYxI dE/smxj1IgWUYKeT3voJFsCJuVlVkChAavMv6VkLdtjlDHh8k6TTdHl8m1/8O/+BJ3GMOLWW0/7C m295vYiNyLS7X0NCOkhwtiYnV40XsRyzyoy6HNaz1cbsiK7PkMrF0dMvAO6kG+iQUBMy1grvR9/l ybYgCQQX5cz85NoXP3cwRpKL9rZSlplfHnvuvZVfkv4nvWz8lA+HgKkiKsBZTgka5QxI8QziNK+7 QPGUAEhNl7HGKUVz26Ejndnif9fnShMu2z+YCLdt1O36QJzTXh1YmXSTB9eWa9TZuy8muypo9Wkx fJGFb3FGo0UslHbw15tYXKL8iCC8j210S4mWnpBkO9UBwlGCoO6DYZIkF7Fm3Hpa/F8E4PqWfene xx31H/aAwarQpYDOYx/6JtUO/GqJg4E/KNK41fXYWiMK3pv7c+m0ulsMI3nr6mT+esOUkxE+SK4C kqqQuY/ADtB7MjMm/D2rEPnNAuCCnt9B91lvN+2w6IrWsFqaJSVzMeH10tfqoGlbdTkTLaWCAXLa p1cbnmh6pFmhgqKvdyLtSa8zJ25JHkf2y1fH38x/opU= X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be 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 Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke Signed-off-by: Bart Van Assche --- drivers/target/iscsi/iscsi_target.c | 10 ++++------ drivers/target/iscsi/iscsi_target_erl0.c | 5 ++--- drivers/target/iscsi/iscsi_target_erl1.c | 16 +++++++--------- drivers/target/iscsi/iscsi_target_util.c | 16 +++++++--------- drivers/target/target_core_alua.c | 5 ++--- drivers/target/target_core_device.c | 6 +++--- drivers/target/target_core_pr.c | 15 ++++++--------- 7 files changed, 31 insertions(+), 42 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 984941e036c8..98984c3adfba 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -308,9 +308,6 @@ bool iscsit_check_np_match( return false; } -/* - * Called with mutex np_lock held - */ static struct iscsi_np *iscsit_get_np( struct sockaddr_storage *sockaddr, int network_transport) @@ -318,6 +315,8 @@ static struct iscsi_np *iscsit_get_np( struct iscsi_np *np; bool match; + lockdep_assert_held(&np_lock); + list_for_each_entry(np, &g_np_list, np_list) { spin_lock_bh(&np->np_thread_lock); if (np->np_thread_state != ISCSI_NP_THREAD_ACTIVE) { @@ -2655,9 +2654,6 @@ static int iscsit_handle_immediate_data( return IMMEDIATE_DATA_NORMAL_OPERATION; } -/* - * Called with sess->conn_lock held. - */ /* #warning iscsi_build_conn_drop_async_message() only sends out on connections with active network interface */ static void iscsit_build_conn_drop_async_message(struct iscsi_conn *conn) @@ -2666,6 +2662,8 @@ static void iscsit_build_conn_drop_async_message(struct iscsi_conn *conn) struct iscsi_conn *conn_p; bool found = false; + lockdep_assert_held(&conn->sess->conn_lock); + /* * Only send a Asynchronous Message on connections whos network * interface is still functional. diff --git a/drivers/target/iscsi/iscsi_target_erl0.c b/drivers/target/iscsi/iscsi_target_erl0.c index 1193cf884a28..8890c0721053 100644 --- a/drivers/target/iscsi/iscsi_target_erl0.c +++ b/drivers/target/iscsi/iscsi_target_erl0.c @@ -802,14 +802,13 @@ void iscsit_start_time2retain_handler(struct iscsi_session *sess) jiffies + sess->sess_ops->DefaultTime2Retain * HZ); } -/* - * Called with spin_lock_bh(&struct se_portal_group->session_lock) held - */ int iscsit_stop_time2retain_timer(struct iscsi_session *sess) { struct iscsi_portal_group *tpg = sess->tpg; struct se_portal_group *se_tpg = &tpg->tpg_se_tpg; + lockdep_assert_held(&se_tpg->session_lock); + if (sess->time2retain_timer_flags & ISCSI_TF_EXPIRED) return -1; diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c index 1b54a9c70851..38210ab09887 100644 --- a/drivers/target/iscsi/iscsi_target_erl1.c +++ b/drivers/target/iscsi/iscsi_target_erl1.c @@ -797,14 +797,14 @@ static struct iscsi_ooo_cmdsn *iscsit_allocate_ooo_cmdsn(void) return ooo_cmdsn; } -/* - * Called with sess->cmdsn_mutex held. - */ static int iscsit_attach_ooo_cmdsn( struct iscsi_session *sess, struct iscsi_ooo_cmdsn *ooo_cmdsn) { struct iscsi_ooo_cmdsn *ooo_tail, *ooo_tmp; + + lockdep_assert_held(&sess->cmdsn_mutex); + /* * We attach the struct iscsi_ooo_cmdsn entry to the out of order * list in increasing CmdSN order. @@ -871,15 +871,14 @@ void iscsit_clear_ooo_cmdsns_for_conn(struct iscsi_conn *conn) mutex_unlock(&sess->cmdsn_mutex); } -/* - * Called with sess->cmdsn_mutex held. - */ int iscsit_execute_ooo_cmdsns(struct iscsi_session *sess) { int ooo_count = 0; struct iscsi_cmd *cmd = NULL; struct iscsi_ooo_cmdsn *ooo_cmdsn, *ooo_cmdsn_tmp; + lockdep_assert_held(&sess->cmdsn_mutex); + list_for_each_entry_safe(ooo_cmdsn, ooo_cmdsn_tmp, &sess->sess_ooo_cmdsn_list, ooo_list) { if (ooo_cmdsn->cmdsn != sess->exp_cmd_sn) @@ -1232,9 +1231,6 @@ void iscsit_mod_dataout_timer(struct iscsi_cmd *cmd) spin_unlock_bh(&cmd->dataout_timeout_lock); } -/* - * Called with cmd->dataout_timeout_lock held. - */ void iscsit_start_dataout_timer( struct iscsi_cmd *cmd, struct iscsi_conn *conn) @@ -1242,6 +1238,8 @@ void iscsit_start_dataout_timer( struct iscsi_session *sess = conn->sess; struct iscsi_node_attrib *na = iscsit_tpg_get_node_attrib(sess); + lockdep_assert_held(&cmd->dataout_timeout_lock); + if (cmd->dataout_timer_flags & ISCSI_TF_RUNNING) return; diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index 762448e2f8b7..58886d4b33cb 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c @@ -56,9 +56,6 @@ extern struct list_head g_tiqn_list; extern spinlock_t tiqn_lock; -/* - * Called with cmd->r2t_lock held. - */ int iscsit_add_r2t_to_list( struct iscsi_cmd *cmd, u32 offset, @@ -68,6 +65,8 @@ int iscsit_add_r2t_to_list( { struct iscsi_r2t *r2t; + lockdep_assert_held(&cmd->r2t_lock); + r2t = kmem_cache_zalloc(lio_r2t_cache, GFP_ATOMIC); if (!r2t) { pr_err("Unable to allocate memory for struct iscsi_r2t.\n"); @@ -128,11 +127,10 @@ struct iscsi_r2t *iscsit_get_r2t_from_list(struct iscsi_cmd *cmd) return NULL; } -/* - * Called with cmd->r2t_lock held. - */ void iscsit_free_r2t(struct iscsi_r2t *r2t, struct iscsi_cmd *cmd) { + lockdep_assert_held(&cmd->r2t_lock); + list_del(&r2t->r2t_list); kmem_cache_free(lio_r2t_cache, r2t); } @@ -1013,13 +1011,13 @@ void iscsit_handle_nopin_timeout(struct timer_list *t) iscsit_dec_conn_usage_count(conn); } -/* - * Called with conn->nopin_timer_lock held. - */ void __iscsit_start_nopin_timer(struct iscsi_conn *conn) { struct iscsi_session *sess = conn->sess; struct iscsi_node_attrib *na = iscsit_tpg_get_node_attrib(sess); + + lockdep_assert_held(&conn->nopin_timer_lock); + /* * NOPIN timeout is disabled. */ diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c index 6b0d9beacf90..e09f0cf86bed 100644 --- a/drivers/target/target_core_alua.c +++ b/drivers/target/target_core_alua.c @@ -910,9 +910,6 @@ static int core_alua_write_tpg_metadata( return (ret < 0) ? -EIO : 0; } -/* - * Called with tg_pt_gp->tg_pt_gp_transition_mutex held - */ static int core_alua_update_tpg_primary_metadata( struct t10_alua_tg_pt_gp *tg_pt_gp) { @@ -921,6 +918,8 @@ static int core_alua_update_tpg_primary_metadata( char *path; int len, rc; + lockdep_assert_held(&tg_pt_gp->tg_pt_gp_transition_mutex); + md_buf = kzalloc(ALUA_MD_BUF_LEN, GFP_KERNEL); if (!md_buf) { pr_err("Unable to allocate buf for ALUA metadata\n"); diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 93c56f4a9911..1f8482b6473b 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -404,9 +404,6 @@ int core_enable_device_list_for_node( return 0; } -/* - * Called with se_node_acl->lun_entry_mutex held. - */ void core_disable_device_list_for_node( struct se_lun *lun, struct se_dev_entry *orig, @@ -418,6 +415,9 @@ void core_disable_device_list_for_node( * reference to se_device->dev_group. */ struct se_device *dev = rcu_dereference_raw(lun->lun_se_dev); + + lockdep_assert_held(&nacl->lun_entry_mutex); + /* * If the MappedLUN entry is being disabled, the entry in * lun->lun_deve_list must be removed now before clearing the diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 397f38cb7f4e..1597a9ebadca 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c @@ -1290,9 +1290,6 @@ static int core_scsi3_check_implicit_release( return ret; } -/* - * Called with struct t10_reservation->registration_lock held. - */ static void __core_scsi3_free_registration( struct se_device *dev, struct t10_pr_registration *pr_reg, @@ -1308,6 +1305,8 @@ static void __core_scsi3_free_registration( struct se_dev_entry *deve; char i_buf[PR_REG_ISID_ID_LEN]; + lockdep_assert_held(&pr_tmpl->registration_lock); + memset(i_buf, 0, PR_REG_ISID_ID_LEN); core_pr_dump_initiator_port(pr_reg, i_buf, PR_REG_ISID_ID_LEN); @@ -2450,9 +2449,6 @@ core_scsi3_emulate_pro_reserve(struct se_cmd *cmd, int type, int scope, } } -/* - * Called with struct se_device->dev_reservation_lock held. - */ static void __core_scsi3_complete_pro_release( struct se_device *dev, struct se_node_acl *se_nacl, @@ -2464,6 +2460,8 @@ static void __core_scsi3_complete_pro_release( char i_buf[PR_REG_ISID_ID_LEN]; int pr_res_type = 0, pr_res_scope = 0; + lockdep_assert_held(&dev->dev_reservation_lock); + memset(i_buf, 0, PR_REG_ISID_ID_LEN); core_pr_dump_initiator_port(pr_reg, i_buf, PR_REG_ISID_ID_LEN); /* @@ -2760,9 +2758,6 @@ core_scsi3_emulate_pro_clear(struct se_cmd *cmd, u64 res_key) return 0; } -/* - * Called with struct se_device->dev_reservation_lock held. - */ static void __core_scsi3_complete_pro_preempt( struct se_device *dev, struct t10_pr_registration *pr_reg, @@ -2775,6 +2770,8 @@ static void __core_scsi3_complete_pro_preempt( const struct target_core_fabric_ops *tfo = nacl->se_tpg->se_tpg_tfo; char i_buf[PR_REG_ISID_ID_LEN]; + lockdep_assert_held(&dev->dev_reservation_lock); + memset(i_buf, 0, PR_REG_ISID_ID_LEN); core_pr_dump_initiator_port(pr_reg, i_buf, PR_REG_ISID_ID_LEN); /* From patchwork Fri Jan 25 18:34:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10781891 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7F060746 for ; Fri, 25 Jan 2019 18:35:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E93C299B5 for ; Fri, 25 Jan 2019 18:35:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 62EFE2D40C; Fri, 25 Jan 2019 18:35:49 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 C8BC1299B5 for ; Fri, 25 Jan 2019 18:35:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726996AbfAYSfs (ORCPT ); Fri, 25 Jan 2019 13:35:48 -0500 Received: from com-out001.mailprotect.be ([83.217.72.83]:44235 "EHLO com-out001.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726361AbfAYSfs (ORCPT ); Fri, 25 Jan 2019 13:35:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=mbHuBPQv+GZ5XcuLIXroWqjH0iAa87ntq8ibF6S+6ro=; b=I8J9IPNrL+yh kj3je1aBQx5LoQlnZ04/I2e7CZJESB4Vwa0nYDrfX3qYqs3a4uI93o7T8SSj0YnOaeKvUW66f1/iu DxCa3tF7hBa+TUBqOmA7ZcoU3M/9qn7JMKCqtTaXzsDACREy/QKAG3lC1RNhNCgKafeNa36Krloqw cd7pRlrd0j4QlpoZ4R5c3+Igo33K2vCpZvytlyAMrYWLCAyqgbcJMUEPauhSxb4+Eg8w2+fLAZqj4 xrDdf2oF5W/HkHR7E098rfdvL+ESpJAUkt7uL4ZoV7UCg5zp+eHHRpD3O5H/KW5XHR+nRgSPhluia L6OCCPS7GIgeUenbtjEc5g==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out001.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gn6KF-0009F4-4m; Fri, 25 Jan 2019 19:35:36 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id 58E0EC07A1; Fri, 25 Jan 2019 19:35:30 +0100 (CET) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Nicholas Bellinger , Mike Christie , Hannes Reinecke , Sagi Grimberg Subject: [PATCH 12/16] target/iscsi: Fix spelling of "unsolicited" Date: Fri, 25 Jan 2019 10:34:54 -0800 Message-Id: <20190125183458.220477-13-bvanassche@acm.org> X-Mailer: git-send-email 2.20.1.495.gaa96b0ce6b-goog In-Reply-To: <20190125183458.220477-1-bvanassche@acm.org> References: <20190125183458.220477-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: SB/global_tokens (0.00521804801149) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5iBEgwP0U8/24MuSozlajr1602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTZ8+YO8vChGFh3RuBr6W5W4O5h4uJLMxABlRvld1qhpu1Eu 64lcKqHz63MNZErwJudWk5yff3Rk+fDNWi4k1kOwGoVcY3wbOxrMjMtwniXfRzR7CJoq1J2bI9UJ ioPACykSmyGBNnfJmTlCy8beeVEqE2hbkoLQ7UByhS76rdqXXQLjAlXxlic79gjm7N64713f6uR0 cOYOSX9qUr4YuemS2Gh/Qfgu9chLVc2vRhNMlR5yHo7lQLxqL/81WSjE03ck4Ndu06h2Q8QP5GQe NUYfzfh+1hTlNmKlqsmcMQ3aemJb4oRxP5STU+xUtRhnzoXNsFlW4xzv3KSabGJbxYTPkxkQ0H6O L7P/NDQJvXLBFogkcrMa30IAuQwcvqfu8p8T9oXmckUtTiqujG9MEAys0Pj+CuspuqIywLM1+yFE 28W6VmkUOCR75FEzGh68OC8qjedQ/jV+CiBePeEy87fciSrlgXUe2FRrt3Q/saIuu1pdVjRHzTdn z3Xm0z5QCutB75tz6v0zFYS4i1UpWw5ygaEezzST01xjqhPxTIJwuN9fxN2oReTDHAyOynaY0Cm+ PwI2YaMxeYj/KjXdgZbFLz/dsiahQ1DFoGJGH4QvNEh0lEoBHTPQaV63Qos/9JI6P1rcwMMSsZjf jwi4yUtZVr0kxycN4986DZNUHKbmmuidX4Ts4xdG+C13IyWeZaKLfFcNGQN+hH6v2MZCUoDk3qNg NMAmk3h3d0Yxk7DvvAl26U8/CKhpqvcNIE1aQHIfFW/Nl0seu0hTiBgIisWwNLJZmRoviGIk2Sot /BqZFeUnH3nv19S5PjJNmPt1vwfNW+gIbKFw62y3TrcCLgFyygEwwwWe3xXNBQ8NJdm4Pu+ugEsm wDihBMcnEMSGIEaCVsMw8GaGChUSduKY8HiPxD4h/YU9zo7LMJnjzCZjOV3BDm4AHl4dGnO9CaDX urh+ZiolmOKsgKL0yrC4CoiaBb49MdftFWtSMAR8vdjN8oelp7juv/lG2QmMPRqn46/RMrw5DdwH 1AXXXLvYNFIcOQ8tJCJ9UvsROnRGuCE0jiPuAPC7flZw7vTrcKFWGYXNsFlW4xzv3KSabGJbxYTP lxzj6YTJZ+WM8ftQv6vsS35d+XgiYVsUmZV5PBFEaDiw88kdBfXcS31d5wOewMbe X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be 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 Change "unsoliticed" into "unsolicited". Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Sagi Grimberg Signed-off-by: Bart Van Assche --- drivers/infiniband/ulp/isert/ib_isert.c | 2 +- drivers/target/iscsi/cxgbit/cxgbit_target.c | 2 +- drivers/target/iscsi/iscsi_target.c | 8 ++++---- drivers/target/iscsi/iscsi_target.h | 2 +- drivers/target/iscsi/iscsi_target_erl1.c | 2 +- include/target/iscsi/iscsi_transport.h | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index e3dd13798d79..989f1ac4245c 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c @@ -1186,7 +1186,7 @@ isert_handle_scsi_cmd(struct isert_conn *isert_conn, rc = iscsit_sequence_cmd(conn, cmd, buf, hdr->cmdsn); if (!rc && dump_payload == false && unsol_data) - iscsit_set_unsoliticed_dataout(cmd); + iscsit_set_unsolicited_dataout(cmd); else if (dump_payload && imm_data) target_put_sess_cmd(&cmd->se_cmd); diff --git a/drivers/target/iscsi/cxgbit/cxgbit_target.c b/drivers/target/iscsi/cxgbit/cxgbit_target.c index 25eb3891e34b..29b350a0b58f 100644 --- a/drivers/target/iscsi/cxgbit/cxgbit_target.c +++ b/drivers/target/iscsi/cxgbit/cxgbit_target.c @@ -960,7 +960,7 @@ cxgbit_get_immediate_data(struct iscsi_cmd *cmd, struct iscsi_scsi_req *hdr, target_put_sess_cmd(&cmd->se_cmd); return 0; } else if (cmd->unsolicited_data) { - iscsit_set_unsoliticed_dataout(cmd); + iscsit_set_unsolicited_dataout(cmd); } } else if (immed_ret == IMMEDIATE_DATA_ERL1_CRC_FAILURE) { diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 98984c3adfba..7059ffdb0c20 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -1194,7 +1194,7 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, } EXPORT_SYMBOL(iscsit_setup_scsi_cmd); -void iscsit_set_unsoliticed_dataout(struct iscsi_cmd *cmd) +void iscsit_set_unsolicited_dataout(struct iscsi_cmd *cmd) { iscsit_set_dataout_sequence_values(cmd); @@ -1202,7 +1202,7 @@ void iscsit_set_unsoliticed_dataout(struct iscsi_cmd *cmd) iscsit_start_dataout_timer(cmd, cmd->conn); spin_unlock_bh(&cmd->dataout_timeout_lock); } -EXPORT_SYMBOL(iscsit_set_unsoliticed_dataout); +EXPORT_SYMBOL(iscsit_set_unsolicited_dataout); int iscsit_process_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, struct iscsi_scsi_req *hdr) @@ -1236,7 +1236,7 @@ int iscsit_process_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, */ if (!cmd->immediate_data) { if (!cmd->sense_reason && cmd->unsolicited_data) - iscsit_set_unsoliticed_dataout(cmd); + iscsit_set_unsolicited_dataout(cmd); if (!cmd->sense_reason) return 0; @@ -1308,7 +1308,7 @@ iscsit_get_immediate_data(struct iscsi_cmd *cmd, struct iscsi_scsi_req *hdr, target_put_sess_cmd(&cmd->se_cmd); return rc; } else if (cmd->unsolicited_data) - iscsit_set_unsoliticed_dataout(cmd); + iscsit_set_unsolicited_dataout(cmd); } else if (immed_ret == IMMEDIATE_DATA_ERL1_CRC_FAILURE) { /* diff --git a/drivers/target/iscsi/iscsi_target.h b/drivers/target/iscsi/iscsi_target.h index 48bac0acf8c7..c95f56a3ce31 100644 --- a/drivers/target/iscsi/iscsi_target.h +++ b/drivers/target/iscsi/iscsi_target.h @@ -31,7 +31,7 @@ extern int iscsit_reset_np_thread(struct iscsi_np *, struct iscsi_tpg_np *, struct iscsi_portal_group *, bool); extern int iscsit_del_np(struct iscsi_np *); extern int iscsit_reject_cmd(struct iscsi_cmd *cmd, u8, unsigned char *); -extern void iscsit_set_unsoliticed_dataout(struct iscsi_cmd *); +extern void iscsit_set_unsolicited_dataout(struct iscsi_cmd *); extern int iscsit_logout_closesession(struct iscsi_cmd *, struct iscsi_conn *); extern int iscsit_logout_closeconnection(struct iscsi_cmd *, struct iscsi_conn *); extern int iscsit_logout_removeconnforrecovery(struct iscsi_cmd *, struct iscsi_conn *); diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c index 38210ab09887..c27335c29640 100644 --- a/drivers/target/iscsi/iscsi_target_erl1.c +++ b/drivers/target/iscsi/iscsi_target_erl1.c @@ -979,7 +979,7 @@ int iscsit_execute_cmd(struct iscsi_cmd *cmd, int ooo) if (cmd->se_cmd.transport_state & CMD_T_ABORTED) return 0; - iscsit_set_unsoliticed_dataout(cmd); + iscsit_set_unsolicited_dataout(cmd); } return transport_handle_cdb_direct(&cmd->se_cmd); diff --git a/include/target/iscsi/iscsi_transport.h b/include/target/iscsi/iscsi_transport.h index 91948bc5b185..8b4b8ce2c1ae 100644 --- a/include/target/iscsi/iscsi_transport.h +++ b/include/target/iscsi/iscsi_transport.h @@ -53,7 +53,7 @@ extern void iscsit_put_transport(struct iscsit_transport *); */ extern int iscsit_setup_scsi_cmd(struct iscsi_conn *, struct iscsi_cmd *, unsigned char *); -extern void iscsit_set_unsoliticed_dataout(struct iscsi_cmd *); +extern void iscsit_set_unsolicited_dataout(struct iscsi_cmd *); extern int iscsit_process_scsi_cmd(struct iscsi_conn *, struct iscsi_cmd *, struct iscsi_scsi_req *); extern int From patchwork Fri Jan 25 18:34:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10781889 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D9A6414E5 for ; Fri, 25 Jan 2019 18:35:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9A332CFC3 for ; Fri, 25 Jan 2019 18:35:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDFD62D40C; Fri, 25 Jan 2019 18:35:48 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 48B0E299B5 for ; Fri, 25 Jan 2019 18:35:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728912AbfAYSfs (ORCPT ); Fri, 25 Jan 2019 13:35:48 -0500 Received: from out002.mailprotect.be ([83.217.72.86]:51261 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726996AbfAYSfr (ORCPT ); Fri, 25 Jan 2019 13:35:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=daDRZlq+zdouuB7GUF4kV0DFoWJXz1cB7PpUs/mGH9I=; b=qm6NCM09h5dK bCJbiNWriQr7zIYC8VILb1cxg8cZ4IjxAisHCitdyfqjIye6bk9uQKdMDxMFvRAZCEoNHJQsT55Mp e58DE3B18MaWTpkPwzhzq9xXT4qnnEm2L+Zw9/7r1UljEHEvCu0RgSW1iosEyQL6g5BqmU+NaZnGV EXXLY/OmlwQVWgsotj+VTe3iahFhk+nDgMfHDhwmgjIdEh1s6hS0Zpl9truyFeWHxmyM6NzKSHT8j tn1E4B5LMOeBEy//IKok+nJmC3liV/s5OAdYzAaR1z1nBOr56RNRLq8Zq/gBqg4xLD48fo7vKA+AS leiAVNR6WVWpSU62V/GCTA==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gn6KG-00045D-Ht; Fri, 25 Jan 2019 19:35:36 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id 48BE6C0E49; Fri, 25 Jan 2019 19:35:32 +0100 (CET) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Nicholas Bellinger , Mike Christie , Hannes Reinecke Subject: [PATCH 13/16] target/iscsi: Rename a function and a function pointer Date: Fri, 25 Jan 2019 10:34:55 -0800 Message-Id: <20190125183458.220477-14-bvanassche@acm.org> X-Mailer: git-send-email 2.20.1.495.gaa96b0ce6b-goog In-Reply-To: <20190125183458.220477-1-bvanassche@acm.org> References: <20190125183458.220477-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.03) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5lqMdYKaJ+3YKoKK4jYsx1t602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WlZa4xKvcBORT2AGmYYKfacHGRHPT1S45qX7/AQuG3+Xws3TRjaC42FtNJuTWwh7zLjlV5 cBkg2E15FOz6ftN7AKpPBG2jC7MMwjN3LcDHQc902MBxp+G42GIBqokZAnJ5xBHkCMCjMposz65/ e+f6sz9VtXrOJenZ5zYaF/sdP+70pheH5TNN6RiG9N0Jt+0ML5i3g2GFaGQnZ3KowlU8anvoc7s0 eHtsyrH7f4vWs1KcgxQTqdSE3cxlP67ssuZxn2a3k66wqHQRkdHrnUf0XuDVW1RAVP/E7/UYy9T8 rkAMvHmBTTipZKIPq3iOj9tSKKqNUqeXR0rRzsN1a4pGQL1kekvvDc/yYbCCC8p9CUWioSPTx/yi OJKFnIIso8zn0j1QBmC0JIZXgnugZTuCZyCgxZHINA6A5+7T9o6by3MDjiILWse2C7xyo18DbRKd 6+6AB9mEpRX5vy67WwDjehIqUczFWeS6sE8e1b5/UkBg4yvMn5MBAdwJubari/j0NbttK1RyTzg9 21y9+zCxO6B1WisJdr+Oay4DE5GzXPKGeCCEmNf8LEzslExje0gHmFDqewO9xyOqCYO8P1aHTwaH Q1Qo4eQXu+BLLP1GOzxnZ5UDYNafOy0Jr+QbiT1CJ/k2Jo+Zn4s9cWJWa0GqPkin+M+n/jXu6/99 KOMlrjA0XAoGECHs14pjPDDBgal9xZYz2MK6AE8POx8Vj5IoXdLIoMkL5h637DrNPhO54JBZ6mPH VwZHwwdV8MInXcYU005YMQtTGkqF9DfSXeTqNQl0N82pGAaFlBh9ydCic1KxHB/etGG+jKYi/tvO WyEnBy/PpUxgSFRPcWxJF+/bZGcrdi6P9WA8qPaxL9ILtEIqJpgLAx9UBkVVtWWC7u0df68W0InH /+bTMKNm38MHe3iJ5ql2Fx06AJIYSscySZesPRxtLbAe07w72Y8M1+Qa8Q/Annoe3C1wCMjQ1GK/ MS+4ayUpOtEhdxekWDmK9g== X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be 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 Having both a function and a function pointer member with the same name (iscsit_release_cmd) is confusing. Hence rename the function pointer member. Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke Signed-off-by: Bart Van Assche --- drivers/target/iscsi/cxgbit/cxgbit.h | 2 +- drivers/target/iscsi/cxgbit/cxgbit_ddp.c | 2 +- drivers/target/iscsi/cxgbit/cxgbit_main.c | 2 +- drivers/target/iscsi/iscsi_target_util.c | 4 ++-- include/target/iscsi/iscsi_transport.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/target/iscsi/cxgbit/cxgbit.h b/drivers/target/iscsi/cxgbit/cxgbit.h index 417b9e66b0cd..3cca22e19964 100644 --- a/drivers/target/iscsi/cxgbit/cxgbit.h +++ b/drivers/target/iscsi/cxgbit/cxgbit.h @@ -345,7 +345,7 @@ struct cxgbit_device *cxgbit_find_device(struct net_device *, u8 *); int cxgbit_ddp_init(struct cxgbit_device *); int cxgbit_setup_conn_pgidx(struct cxgbit_sock *, u32); int cxgbit_reserve_ttt(struct cxgbit_sock *, struct iscsi_cmd *); -void cxgbit_release_cmd(struct iscsi_conn *, struct iscsi_cmd *); +void cxgbit_unmap_cmd(struct iscsi_conn *, struct iscsi_cmd *); static inline struct cxgbi_ppm *cdev2ppm(struct cxgbit_device *cdev) diff --git a/drivers/target/iscsi/cxgbit/cxgbit_ddp.c b/drivers/target/iscsi/cxgbit/cxgbit_ddp.c index 76a262674c8d..d57fd3ed3fa5 100644 --- a/drivers/target/iscsi/cxgbit/cxgbit_ddp.c +++ b/drivers/target/iscsi/cxgbit/cxgbit_ddp.c @@ -263,7 +263,7 @@ cxgbit_get_r2t_ttt(struct iscsi_conn *conn, struct iscsi_cmd *cmd, r2t->targ_xfer_tag = ttinfo->tag; } -void cxgbit_release_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd) +void cxgbit_unmap_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd) { struct cxgbit_cmd *ccmd = iscsit_priv_cmd(cmd); diff --git a/drivers/target/iscsi/cxgbit/cxgbit_main.c b/drivers/target/iscsi/cxgbit/cxgbit_main.c index c011c826fc26..4a7bb0b49d17 100644 --- a/drivers/target/iscsi/cxgbit/cxgbit_main.c +++ b/drivers/target/iscsi/cxgbit/cxgbit_main.c @@ -678,7 +678,7 @@ static struct iscsit_transport cxgbit_transport = { .iscsit_get_r2t_ttt = cxgbit_get_r2t_ttt, .iscsit_get_rx_pdu = cxgbit_get_rx_pdu, .iscsit_validate_params = cxgbit_validate_params, - .iscsit_release_cmd = cxgbit_release_cmd, + .iscsit_unmap_cmd = cxgbit_unmap_cmd, .iscsit_aborted_task = iscsit_aborted_task, .iscsit_get_sup_prot_ops = cxgbit_get_sup_prot_ops, }; diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index 58886d4b33cb..3ac494f63a0b 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c @@ -760,8 +760,8 @@ void __iscsit_free_cmd(struct iscsi_cmd *cmd, bool check_queues) iscsit_remove_cmd_from_response_queue(cmd, conn); } - if (conn && conn->conn_transport->iscsit_release_cmd) - conn->conn_transport->iscsit_release_cmd(conn, cmd); + if (conn && conn->conn_transport->iscsit_unmap_cmd) + conn->conn_transport->iscsit_unmap_cmd(conn, cmd); } void iscsit_free_cmd(struct iscsi_cmd *cmd, bool shutdown) diff --git a/include/target/iscsi/iscsi_transport.h b/include/target/iscsi/iscsi_transport.h index 8b4b8ce2c1ae..75bee29fd7dd 100644 --- a/include/target/iscsi/iscsi_transport.h +++ b/include/target/iscsi/iscsi_transport.h @@ -26,7 +26,7 @@ struct iscsit_transport { void (*iscsit_aborted_task)(struct iscsi_conn *, struct iscsi_cmd *); int (*iscsit_xmit_pdu)(struct iscsi_conn *, struct iscsi_cmd *, struct iscsi_datain_req *, const void *, u32); - void (*iscsit_release_cmd)(struct iscsi_conn *, struct iscsi_cmd *); + void (*iscsit_unmap_cmd)(struct iscsi_conn *, struct iscsi_cmd *); void (*iscsit_get_rx_pdu)(struct iscsi_conn *); int (*iscsit_validate_params)(struct iscsi_conn *); void (*iscsit_get_r2t_ttt)(struct iscsi_conn *, struct iscsi_cmd *, From patchwork Fri Jan 25 18:34:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10781887 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7C58B14E5 for ; Fri, 25 Jan 2019 18:35:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B2CA299B5 for ; Fri, 25 Jan 2019 18:35:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F4A22D40C; Fri, 25 Jan 2019 18:35:47 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 C611F299B5 for ; Fri, 25 Jan 2019 18:35:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727955AbfAYSfq (ORCPT ); Fri, 25 Jan 2019 13:35:46 -0500 Received: from com-out001.mailprotect.be ([83.217.72.83]:41727 "EHLO com-out001.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726689AbfAYSfq (ORCPT ); Fri, 25 Jan 2019 13:35:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=lL01uxHK8llSqvPuKcOjVQW9cFx4eIVMlkl9Fg+a6fQ=; b=WliK3nTdW76J UZWW+ScetC6JIkN1qEkQ2rGevRQEmNf5kONsCXW9kFqacp58uxLPKGQMaKItTx50/EPWFtTO4Oe5h vhIYDlPtR7s9Xxr+QUHuzv0w1Akl6nV426izkP4QSeHUDBUESZTuyZGA5StIOyObKGq/+IZX4iycf +0AHQGaOT90hLnqy0V/ypgpFx6UsbRcMJIblEjMVrZA03LcWo9UQqAzgqC+Q58tyDVQbRLsjYzMgA /ZcMzeNmnzmXFu5EkizxHPVZ6M9ZAeLbcnhmFdW86g0OtZCV0Od+F+scq9oDGvvPNopr5BJh41JwN 09VDQMRO4v+TYweys12oEw==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out001.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gn6KI-0009GE-BG; Fri, 25 Jan 2019 19:35:39 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id 5AA01C05E8; Fri, 25 Jan 2019 19:35:34 +0100 (CET) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Nicholas Bellinger , Mike Christie , Hannes Reinecke , stable@vger.kernel.org Subject: [PATCH 14/16] target/iscsi: Avoid that iscsit_release_commands_from_conn() triggers a deadlock Date: Fri, 25 Jan 2019 10:34:56 -0800 Message-Id: <20190125183458.220477-15-bvanassche@acm.org> X-Mailer: git-send-email 2.20.1.495.gaa96b0ce6b-goog In-Reply-To: <20190125183458.220477-1-bvanassche@acm.org> References: <20190125183458.220477-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.03) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5imjdJnrJZSiBidG5cRewel602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WlZa4xKvcBORT2AGmYYKfa2w4nwtOiKlIdftXY5+/HTLBPB4loq3vFboQ7gxpx2K5q243j OywFphhx6RtIX3/eBU519jxvHYi8yYUXqBwxztbjuU58k6ddZEUemp+2z71k67jEmAPDI71Tk0Cy k1CfTWUth/bIg1D/4cblfXFvIrwhcbIgt0qoJA65s+aV0TP5Yeia8HRRN1XgVEyTWHpXr3OnWExh FqqXKjnbUDBzcE+0HNyHhfqG0xcyQsZuCSP9hsa4s5F3MydIviotZvNHMvzpHD6s+1ao4iJ4PfBj 2N8Vdv96d+08iDufvobw6VUavl4snG+PRn+T8pp7vQV3rpLvOUh2w8gsgLX0uFSNx2AewJvG2VR5 mIGCzCE3N/asZm+FB8yckvFZiHWxnQEMkunODYtbvP72vAmOyjpz9UIDBHPtf27+c3J1HwicUV+G pS+C6BPAIEs8PiiVo3Eb3c7KClSBOi3EV0NWbVJ1KXxqWKxJiDvSXvZvXfo2UEYR9G8HIfDm0MPW TzQicTC9GplHcpVCCoX989hgB8R+yC9G9b3yazdC1eGXzxVaKphdoW8ELRMdd5tZtqdRHw0GmDVD n/TirW1Elu8hoWoocJTIqsriZLvaiGZnz91zoAMokdMyijyrNPLF2pjbdb3MosfYiA+A0wZZjhdL 0PpC7BEVniihuDwEGDcmr6e3OPQT0DVFoMDBp5PRUiQzcTDLKXYp8mSktA5RGpHjopTdfxOQd3Im gm6h3jLPIxOgGdnV6CvgdOXv8q3UV8vherSXctgzcDoFd+96Xw4QUNtTnccFhhwn2/Dj1pgXRdkG FXkx8yzZEloA4PGimr7c647Aza3muS2OYzrgPLHf0Rbu9udKEy7bP5gIt23U7fpAnNPRUBWWBSDR x5OeloKLHRs0g0z5EfZrz6E5xburfSl74HBEn95eECKi3gxjzXac2CIo7bSWHMwv14kxH53zEku4 6CxjyQf09M5rialBcVt4x9u3hHG5f/LZAZC2bUhjWf0= X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be 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 When using SCSI passthrough in combination with the iSCSI target driver then cmd->t_state_lock may be obtained from interrupt context. Hence, all code that obtains cmd->t_state_lock from thread context must disable interrupts first. This patch avoids that lockdep reports the following: WARNING: inconsistent lock state 4.18.0-dbg+ #1 Not tainted -------------------------------- inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage. iscsi_ttx/1800 [HC1[1]:SC0[2]:HE0:SE0] takes: 000000006e7b0ceb (&(&cmd->t_state_lock)->rlock){?...}, at: target_complete_cmd+0x47/0x2c0 [target_core_mod] {HARDIRQ-ON-W} state was registered at: lock_acquire+0xd2/0x260 _raw_spin_lock+0x32/0x50 iscsit_close_connection+0x97e/0x1020 [iscsi_target_mod] iscsit_take_action_for_connection_exit+0x108/0x200 [iscsi_target_mod] iscsi_target_rx_thread+0x180/0x190 [iscsi_target_mod] kthread+0x1cf/0x1f0 ret_from_fork+0x24/0x30 irq event stamp: 1281 hardirqs last enabled at (1279): [] __local_bh_enable_ip+0xa9/0x160 hardirqs last disabled at (1281): [] interrupt_entry+0xb5/0xd0 softirqs last enabled at (1278): [] lock_sock_nested+0x51/0xc0 softirqs last disabled at (1280): [] ip6_finish_output2+0x124/0xe40 [ipv6] other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&(&cmd->t_state_lock)->rlock); lock(&(&cmd->t_state_lock)->rlock); *** DEADLOCK *** 3 locks held by iscsi_ttx/1800: *0: 00000000c3b711b7 (sk_lock-AF_INET6){+.+.}, at: tcp_sendmsg+0x1e/0x50 *1: 00000000fa81046f (rcu_read_lock){....}, at: inet6_csk_xmit+0xc7/0x2e0 [ipv6] *2: 00000000c091d70d (rcu_read_lock_bh){....}, at: ip6_finish_output2+0x124/0xe40 [ipv6] stack backtrace: CPU: 0 PID: 1800 Comm: iscsi_ttx Not tainted 4.18.0-dbg+ #1 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014 Call Trace: dump_stack+0xa4/0xf5 print_usage_bug+0x25b/0x27b mark_lock+0x70f/0x7b0 __lock_acquire+0xbc2/0x1b50 lock_acquire+0xd2/0x260 _raw_spin_lock_irqsave+0x4a/0x60 target_complete_cmd+0x47/0x2c0 [target_core_mod] target_complete_cmd_with_length+0x70/0xa0 [target_core_mod] pscsi_req_done+0x335/0x530 [target_core_pscsi] __blk_mq_end_request+0xa5/0x140 scsi_end_request+0x112/0x320 [scsi_mod] scsi_io_completion+0x183/0xa30 [scsi_mod] scsi_finish_command+0x1c0/0x280 [scsi_mod] scsi_softirq_done+0x19a/0x230 [scsi_mod] __blk_mq_complete_request_remote+0x2f/0x40 flush_smp_call_function_queue+0x12a/0x220 generic_smp_call_function_single_interrupt+0x13/0x30 smp_call_function_single_interrupt+0x7a/0x350 call_function_single_interrupt+0xf/0x20 RIP: 0010:__asan_load4+0x1e/0x80 debug_lockdep_rcu_enabled+0x26/0x40 ip6_finish_output2+0x15a/0xe40 [ipv6] ip6_finish_output+0x308/0x440 [ipv6] ip6_output+0x11d/0x3b0 [ipv6] ip6_xmit+0x639/0xc50 [ipv6] inet6_csk_xmit+0x198/0x2e0 [ipv6] __tcp_transmit_skb+0xc1b/0x15b0 tcp_write_xmit+0x42e/0x1f20 __tcp_push_pending_frames+0x59/0x150 tcp_push+0x189/0x270 tcp_sendmsg_locked+0x7b9/0x1680 tcp_sendmsg+0x2c/0x50 inet_sendmsg+0x71/0x250 sock_sendmsg+0x4c/0x60 tx_data+0x12b/0x1f0 [iscsi_target_mod] iscsit_send_tx_data+0x77/0xe0 [iscsi_target_mod] iscsit_xmit_pdu+0x2c5/0x740 [iscsi_target_mod] iscsit_response_queue+0x941/0xd40 [iscsi_target_mod] iscsi_target_tx_thread+0x23b/0x350 [iscsi_target_mod] kthread+0x1cf/0x1f0 ret_from_fork+0x24/0x30 Fixes: 064cdd2d91c2 ("target: Fix race between iscsi-target connection shutdown + ABORT_TASK") Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Signed-off-by: Bart Van Assche --- drivers/target/iscsi/iscsi_target.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 7059ffdb0c20..408d77eb717c 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -4038,9 +4038,9 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn) struct se_cmd *se_cmd = &cmd->se_cmd; if (se_cmd->se_tfo != NULL) { - spin_lock(&se_cmd->t_state_lock); + spin_lock_irq(&se_cmd->t_state_lock); se_cmd->transport_state |= CMD_T_FABRIC_STOP; - spin_unlock(&se_cmd->t_state_lock); + spin_unlock_irq(&se_cmd->t_state_lock); } } spin_unlock_bh(&conn->cmd_lock); From patchwork Fri Jan 25 18:34:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10781899 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7FA861515 for ; Fri, 25 Jan 2019 18:35:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 697EF299B5 for ; Fri, 25 Jan 2019 18:35:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D9A52D40C; Fri, 25 Jan 2019 18:35:53 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 F2C372CFC3 for ; Fri, 25 Jan 2019 18:35:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729035AbfAYSfw (ORCPT ); Fri, 25 Jan 2019 13:35:52 -0500 Received: from out002.mailprotect.be ([83.217.72.86]:36205 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726689AbfAYSfw (ORCPT ); Fri, 25 Jan 2019 13:35:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=nVWUs0voR4gZwf1IAK18djNrm1GqM0F/CgQfm/cAXJg=; b=EvqENHXgeCJc SM65XMH+BWxNQA3q+epy0pT2WUiMrmdXrMI+kAmTwJZ0HmOObjoCQfhyS+pXCEUNjWEnzFQ5RPUMy ltZXOruG0Ct2wnKDvVcJ+vslThxCSvySKTPwseP4D4aMXi+VdDbNaqUErEfASwvSx1smHBdWeEHko Iarqy0eSBtkayw3d1nSuwamFmfy8tmwr6qpsrT2BNPmXkpo9B0HHjijqGFJh4pMHWZ6/+HQtwfMPD BMBxGAFkfDXyN1UDBXqztOToNYfp2an8At07xiuflxuP6vL7FYgL9JFoOzgCig/Dibywo/JL8g/GO CqVzMhoHLtVMTasFK5Wsxw==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gn6KJ-00045D-S8; Fri, 25 Jan 2019 19:35:40 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id 1AA28C0D45; Fri, 25 Jan 2019 19:35:35 +0100 (CET) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Nicholas Bellinger , Mike Christie , Hannes Reinecke Subject: [PATCH 15/16] target/iscsi: Simplify iscsit_dump_data_payload() Date: Fri, 25 Jan 2019 10:34:57 -0800 Message-Id: <20190125183458.220477-16-bvanassche@acm.org> X-Mailer: git-send-email 2.20.1.495.gaa96b0ce6b-goog In-Reply-To: <20190125183458.220477-1-bvanassche@acm.org> References: <20190125183458.220477-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.04) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5khgcCGvK0IrOvt7SIU7nxl602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WlZa4xKvcBORT2AGmYYKfacHGRHPT1S45qX7/AQuG3+Xws3TRjaC42FtNJuTWwh7zLjlV5 cBkg2E15FOz6ftN7s8nB0C71mnNKZersMXgmlc902MBxp+G42GIBqokZAnJ5xBHkCMCjMposz65/ e+f6sz9VtXrOJenZ5zYaF/sdP+70pheH5TNN6RiG9N0Jt+0ML5i3g2GFaGQnZ3KowlU8anvoc7s0 eHtsyrH7f4vWs1KcgxQTqdSE3cxlP67ssuZxn2a3k66wqHQRkdHrnUf0XuDVW1RAVP/E7/UYy9T8 rkAMvHmBTTipZKIPq3iOj9tSKKqNUqeXR0rRzsN1a4pGQL1kekvvDc/yYbCCC8p9CUWioSPTx/yi OJKFnIIso8zn0j1QBmC0JIZXgnugZTuCZyCgxZHINA6A5+7T9o6by3MDjiILWse2C7xyo18DbRKd 6+6AB9mEpRX5vy67WwDjehIqUczFWeS6sE8e1b5/UkBg4yvMn5MBAdwJubari/j0NbttK1RyTzg9 21y9+zCxO6B1WisJdr+Oay4DE5GzXOXHTYuLZBJ7+eL2JKLs3okHmFDqewO9xyOqCYO8P1aHTwaH Q1Qo4eQXu+BLLP1GOzxnZ5UDYNafOy0Jr+QbiT1CJ/k2Jo+Zn4s9cWJWa0GqPkin+M+n/jXu6/99 KOMlrjA0XAoGECHs14pjPDDBgal9xZYz2MK6AE8POx8Vj5IoJNs8SwbJrFHDMqELMWdji6sumKDm q4xJXUDuWerVD+MU005YMQtTGkqF9DfSXeTqNQl0N82pGAaFlBh9ydCic1KxHB/etGG+jKYi/tvO WyEnBy/PpUxgSFRPcWxJF+/bZGcrdi6P9WA8qPaxL9ILtEIqJpgLAx9UBkVVtWWC7u0df68W0InH /+bTMKNm38MHe3iJ5ql2Fx06AJIYSscySZesPRxtLbAe07w72Y8M1+Qa8Q/Annoe3C1wCMjQ1GK/ MS+4ayUpOtEhdxekWDmK9g== X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be 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 Use a single loop to dump immediate data, padding and digest instead of using separate rx_data() calls for each type of data. Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke Signed-off-by: Bart Van Assche --- drivers/target/iscsi/iscsi_target_erl1.c | 41 ++++++------------------ 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c index c27335c29640..e02e1aaf63c5 100644 --- a/drivers/target/iscsi/iscsi_target_erl1.c +++ b/drivers/target/iscsi/iscsi_target_erl1.c @@ -48,14 +48,20 @@ int iscsit_dump_data_payload( u32 buf_len, int dump_padding_digest) { - char *buf, pad_bytes[4]; + char *buf; int ret = DATAOUT_WITHIN_COMMAND_RECOVERY, rx_got; - u32 length, padding, offset = 0, size; + u32 length, offset = 0, size; struct kvec iov; if (conn->sess->sess_ops->RDMAExtensions) return 0; + if (dump_padding_digest) { + buf_len = ALIGN(buf_len, 4); + if (conn->conn_ops->DataDigest) + buf_len += ISCSI_CRC_LEN; + } + length = min(buf_len, OFFLOAD_BUF_SIZE); buf = kzalloc(length, GFP_ATOMIC); @@ -75,41 +81,12 @@ int iscsit_dump_data_payload( rx_got = rx_data(conn, &iov, 1, size); if (rx_got != size) { ret = DATAOUT_CANNOT_RECOVER; - goto out; + break; } offset += size; } - if (!dump_padding_digest) - goto out; - - padding = ((-buf_len) & 3); - if (padding != 0) { - iov.iov_len = padding; - iov.iov_base = pad_bytes; - - rx_got = rx_data(conn, &iov, 1, padding); - if (rx_got != padding) { - ret = DATAOUT_CANNOT_RECOVER; - goto out; - } - } - - if (conn->conn_ops->DataDigest) { - u32 data_crc; - - iov.iov_len = ISCSI_CRC_LEN; - iov.iov_base = &data_crc; - - rx_got = rx_data(conn, &iov, 1, ISCSI_CRC_LEN); - if (rx_got != ISCSI_CRC_LEN) { - ret = DATAOUT_CANNOT_RECOVER; - goto out; - } - } - -out: kfree(buf); return ret; } From patchwork Fri Jan 25 18:34:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10781901 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6D94B14E5 for ; Fri, 25 Jan 2019 18:35:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B24D3040A for ; Fri, 25 Jan 2019 18:35:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4540F2E36F; Fri, 25 Jan 2019 18:35:54 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 D18C9299B5 for ; Fri, 25 Jan 2019 18:35:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726683AbfAYSfx (ORCPT ); Fri, 25 Jan 2019 13:35:53 -0500 Received: from com-out001.mailprotect.be ([83.217.72.83]:48107 "EHLO com-out001.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726361AbfAYSfx (ORCPT ); Fri, 25 Jan 2019 13:35:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=jQkKAXJOxbn2qd4TgBSx9tVR3ntW8Zy5dfLk39uXOcs=; b=Zllidxfq3ulq aVfAmhuBCJoFVPLwpWMAbEpYuL1U29tA3fjgX8PvYcFp8ctrD0TlWu+vFt/JHHPVLDGgkY/yBVjAy Ovdcs5eBcuAPrxNteUMxFHBTPsRI24yWQw8KEMmEd9AWnjU+1rO8pYmcXLitDXTrux/YN2YSwti5N GBmY+id2XG2i23vvJXUHU+ApnUZfnO7mKZOCyOXTz1kZN3pyAzcglZ6lM+FpDxfHqjHNHH7f78mj/ RYG2wsZZbE+RTjf4clBHj5pb3DY4RD4RT9rf3ZYOFaRU0IjzGPoKlmmmxWgTTQsEMGdxFOc6dO34v 6+McO9hgJCSwWDR4AknGTA==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out001.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gn6KL-0009H0-RB; Fri, 25 Jan 2019 19:35:42 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id A77F0C05E8; Fri, 25 Jan 2019 19:35:37 +0100 (CET) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Nicholas Bellinger , Mike Christie , Hannes Reinecke Subject: [PATCH 16/16] target/iscsi: Simplify iscsit_handle_text_cmd() Date: Fri, 25 Jan 2019 10:34:58 -0800 Message-Id: <20190125183458.220477-17-bvanassche@acm.org> X-Mailer: git-send-email 2.20.1.495.gaa96b0ce6b-goog In-Reply-To: <20190125183458.220477-1-bvanassche@acm.org> References: <20190125183458.220477-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.05) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5joicMptsGqxUKCSlZYCBgB602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WlZa4xKvcBORT2AGmYYKfacHGRHPT1S45qX7/AQuG3+Xws3TRjaC42FtNJuTWwh7zLjlV5 cBkg2E15FOz6ftN7saABbGh2SKnwJcWJuDl7bM902MBxp+G42GIBqokZAnJ5xBHkCMCjMposz65/ e+f6NiSg6RpPztwkEB6XvRg4fu70pheH5TNN6RiG9N0Jt+0ML5i3g2GFaGQnZ3KowlU8anvoc7s0 eHtsyrH7f4vWs1KcgxQTqdSE3cxlP67ssuZxn2a3k66wqHQRkdHrnUf0XuDVW1RAVP/E7/UYy9T8 rkAMvHmBTTipZKIPq3iOj9tSKKqNUqeXR0rRzsN1a4pGQL1kekvvDc/yYbCCC8p9CUWioSPTx/yi OJKFnIIso8zn0j1QBmC0JIZXgnugZTuCZyCgxZHINA6A5+7T9o6by3MDjiILWse2C7xyo18DbRKd 6+6AB9mEpRX5vy67WwDjehIqUczFWeS6sE8e1b5/UkBg4yvMn5MBAdwJubari/j0NbttK1RyTzg9 21y9+zCxEJ+kDHjc6reKBJd0yzB99FKqSxAeDvyrgwdCgrCP8rUHmFDqewO9xyOqCYO8P1aHTwaH Q1Qo4eQXu+BLLP1GOzxnZ5UDYNafOy0Jr+QbiT1CJ/k2Jo+Zn4s9cWJWa0GqPkin+M+n/jXu6/99 KOMlrjA0XAoGECHs14pjPDDBgal9xZYz2MK6AE8POx8Vj5Iop+ZphJJ47Uh7h/jVMSDA08vC04JR PiGWdW8zah0r9xYU005YMQtTGkqF9DfSXeTqNQl0N82pGAaFlBh9ydCic1KxHB/etGG+jKYi/tvO WyEnBy/PpUxgSFRPcWxJF+/bZGcrdi6P9WA8qPaxL9ILtEIqJpgLAx9UBkVVtWWC7u0df68W0InH /+bTMKNm38MHe3iJ5ql2Fx06AJIYSscySZesPRxtLbAe07w72Y8M1+Qa8Q/Annoe3C1wCMjQ1GK/ MS+4ayUpOtEhdxekWDmK9g== X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be 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 Treat text_in and padding as a single buffer instead of two buffers. Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke Signed-off-by: Bart Van Assche --- drivers/target/iscsi/iscsi_target.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 408d77eb717c..e14ac29209c8 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -2240,28 +2240,25 @@ iscsit_handle_text_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, rx_size = payload_length; if (payload_length) { u32 checksum = 0, data_crc = 0; - u32 padding = 0, pad_bytes = 0; + u32 padding = 0; int niov = 0, rx_got; - struct kvec iov[3]; + struct kvec iov[2]; - text_in = kzalloc(payload_length, GFP_KERNEL); + rx_size = ALIGN(payload_length, 4); + text_in = kzalloc(rx_size, GFP_KERNEL); if (!text_in) goto reject; cmd->text_in_ptr = text_in; - memset(iov, 0, 3 * sizeof(struct kvec)); + memset(iov, 0, sizeof(iov)); iov[niov].iov_base = text_in; - iov[niov++].iov_len = payload_length; + iov[niov++].iov_len = rx_size; - padding = ((-payload_length) & 3); - if (padding != 0) { - iov[niov].iov_base = &pad_bytes; - iov[niov++].iov_len = padding; - rx_size += padding; + padding = rx_size - payload_length; + if (padding) pr_debug("Receiving %u additional bytes" " for padding.\n", padding); - } if (conn->conn_ops->DataDigest) { iov[niov].iov_base = &checksum; iov[niov++].iov_len = ISCSI_CRC_LEN; @@ -2273,9 +2270,9 @@ iscsit_handle_text_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, goto reject; if (conn->conn_ops->DataDigest) { - iscsit_do_crypto_hash_buf(conn->conn_rx_hash, text_in, - payload_length, padding, - &pad_bytes, &data_crc); + iscsit_do_crypto_hash_buf(conn->conn_rx_hash, + text_in, rx_size, 0, NULL, + &data_crc); if (checksum != data_crc) { pr_err("Text data CRC32C DataDigest"