From patchwork Mon Sep 17 21:35:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10603491 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 CA86C157B for ; Mon, 17 Sep 2018 22:19:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCFC82A76B for ; Mon, 17 Sep 2018 22:19:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B15C22A771; Mon, 17 Sep 2018 22:19:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5ACF22A76B for ; Mon, 17 Sep 2018 22:19:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728467AbeIRDs4 (ORCPT ); Mon, 17 Sep 2018 23:48:56 -0400 Received: from com-out001.mailprotect.be ([83.217.72.83]:42681 "EHLO com-out001.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728023AbeIRDs4 (ORCPT ); Mon, 17 Sep 2018 23:48:56 -0400 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=2+m0D/UBRDwGrKCECQo6AOEHfvWNcPVph7Yt7S2kUSY=; b=iNst3v5j79QW iGPehg3NwNjuF0u5C5d5TQzOJLOyOVJ+hetitZSTdCROR8ELNvRtN+3nauBd1LCoE6me/mT3FmVJr JhaQgS2+XuBp1nHqnvJ2gxeZSoaUed67bFAFCrPx5nIenclPcEzDEDAZRHYQbf04jZaooRdmlV5FL P87mvyWlwTX5ecJmkYHigEY9q+FEx/XRIP8Gie2juhLArOsleqBg0OCeag6npRbb8fStQilPKfWfO LzQsaLkaOxarVSqW9C3W3V+eUk9VXQpOikFtJwaLV7PHqP8YSMekB5HSPJVhPihZFlIwPsKuNIEh+ o5hlocwrBN8OJ1nLkxNq+w==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out001.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1g21Bl-000Apr-Ce; Mon, 17 Sep 2018 23:36:14 +0200 Received: from asus.hsd1.ca.comcast.net (c-174-62-111-89.hsd1.ca.comcast.net [174.62.111.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 9011CC075C; Mon, 17 Sep 2018 23:36:09 +0200 (CEST) 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 01/17] target/core: Fix spelling in two source code comments Date: Mon, 17 Sep 2018 14:35:38 -0700 Message-Id: <20180917213554.987-2-bvanassche@acm.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180917213554.987-1-bvanassche@acm.org> References: <20180917213554.987-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: EX5BVjFpneJeBchSMxfU5lBx27r4HnMD14VMNjtM5KN602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WlZa4xKvcBORT2AGmYYKfacHGRHPT1S45qX7/AQuG3+Xws3TRjaC42FtNJuTWwh7zLjlV5 cBkg2E15FOz6ftN7Tr5Oxo0srlie8t0OteQzn8902MBxp+G42GIBqokZAnJ5xBHkCMCjMposz65/ e+f6NiSg6RpPztwkEB6XvRg4fu70pheH5TNN6RiG9N0Jt+0ML5i3g2GFaGQnZ3KowlU8anvoc7s0 eHtsyrH7f4vWsxE/6wnSTdYMIbg1/h42t37X7D3r+yzaf09FesHDYiVh+mW6KLAhhg63cf8hhJ+u kSXGkMRHqahP8I2z5Z6Oaau3r5afqv7IHvnvd2pvgvBc+yIcNf9mmCdHYvplLFSG4KBSfNBRSHvO tj6BxxAeW8VFuiO6yCEAclVLBw8e/TPckDkXGJvniGivX1Fq/UQDdfRWNiJbKFZUCBFMj3aVfRTy mM4V+dYvw3zgaX5MC+SYhClGQqBaLo/4e5RWTejdpMF40MajfsURz8L4dmQLKmXZ4ciB+h1c4Cwq mt5tbitpDjKIx3H3dmYdnoX9+S6u9LkZk+lv2Czqm2ed7meys2nUL1JgezUdWQ05VsGirfnatW1x D7NPHFVkxC5YVnU16UjwG05S+hO4GQ05Y/WP30Hdn+cousT5+gFGAcOaNJ6l53AchVbc0JpeNrhF rx64zcw4Oh2LkwsmIC+tUiJAU2GWfmVpiJkOE4Udd79N8qTYSgW/Ewd0ofze/77QmRCu6xxwEiTV JqDh0qKoKsXx5lnwVAtFIjOqBVBmDBo6d1b4QpW0dpxIo9d2WgcHzHNTu4W3OyTlA5uhTP73RN8y cSzpfj5sSQhb3cc4IkKXIhy+I6DM7/owTL8J95f1/+MXnOL6CZv+n8/wRksD+x9JjG1O+eyolGM4 l8rlxuGfhU+34hrNm42X2UZAYRVVEuFqpn0Wcxxec4eIhtK5Pi2eqhlDMrilbtDDvtO4rayUOwaR 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 Signed-off-by: Bart Van Assche Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke Reviewed-by: Christoph Hellwig --- drivers/target/target_core_transport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 86c0156e6c88..2c0d8626d57d 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -2012,7 +2012,7 @@ void target_execute_cmd(struct se_cmd *cmd) * Determine if frontend context caller is requesting the stopping of * this command for frontend exceptions. * - * If the received CDB has aleady been aborted stop processing it here. + * If the received CDB has already been aborted stop processing it here. */ spin_lock_irq(&cmd->t_state_lock); if (__transport_check_aborted_status(cmd, 1)) { @@ -2516,7 +2516,7 @@ transport_generic_new_cmd(struct se_cmd *cmd) } /* - * Determine is the TCM fabric module has already allocated physical + * Determine if the TCM fabric module has already allocated physical * memory, and is directly calling transport_generic_map_mem_to_cmd() * beforehand. */ From patchwork Mon Sep 17 21:35:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10603489 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 9D5FF157B for ; Mon, 17 Sep 2018 22:19:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90CCF2A76B for ; Mon, 17 Sep 2018 22:19:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84F462A771; Mon, 17 Sep 2018 22:19:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B9122A76B for ; Mon, 17 Sep 2018 22:19:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728438AbeIRDsy (ORCPT ); Mon, 17 Sep 2018 23:48:54 -0400 Received: from com-out001.mailprotect.be ([83.217.72.83]:56097 "EHLO com-out001.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728023AbeIRDsy (ORCPT ); Mon, 17 Sep 2018 23:48:54 -0400 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=ysw3pTEVYELj5D2bweXt9Cs9dZxpgzZ/iErS2797ONc=; b=KKWGODURGrok EkNSt2jxk2KOJAjroAnT+xCV4sBK3zFFg9ZF/GVqVozStGx24EOYxp4TzVGnfW+liPOzw3a8/PiKn +cmE0iqrRzT3i9IWNwEyRb2SxxAS5xwIqDcYQwa0sZnKHaVjf1ZQRuyI/nmhXw78euqc9KJcbdG2P +rj8soT4HajQWtNP3AiHwQ6j5jnuySjLUZH4t1GSZdf70RyAGLJ6HGoxG/mz6hwmk45ZiZMj0QQMf WY9d1KNFviHvW0bm2Q+iT7rRuqnvECVYrV3gid3x4Cg5fnbqoTD348uRVvlPZxvoeNbBWR48HMwjd ZYOQmHtvCJM3OpZXUbIsSw==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out001.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1g21Bl-000AqB-Lt; Mon, 17 Sep 2018 23:36:14 +0200 Received: from asus.hsd1.ca.comcast.net (c-174-62-111-89.hsd1.ca.comcast.net [174.62.111.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 98DFFC0718; Mon, 17 Sep 2018 23:36:11 +0200 (CEST) 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/17] target/core: Use the SECTOR_SHIFT constant Date: Mon, 17 Sep 2018 14:35:39 -0700 Message-Id: <20180917213554.987-3-bvanassche@acm.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180917213554.987-1-bvanassche@acm.org> References: <20180917213554.987-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: EX5BVjFpneJeBchSMxfU5hxEB/CDAVjS3yJTmuoRi8t602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WlZa4xKvcBORT2AGmYYKfacHGRHPT1S45qX7/AQuG3+Xws3TRjaC42FtNJuTWwh7zLjlV5 cBkg2E15FOz6ftN7ONN5wnDHzd31Bcrx2ln6uc902MBxp+G42GIBqokZAnJ5xBHkCMCjMposz65/ e+f6NiSg6RpPztwkEB6XvRg4fu70pheH5TNN6RiG9N0Jt+0ML5i3g2GFaGQnZ3KowlU8anvoc7s0 eHtsyrH7f4vWsxE/6wnSTdYMIbg1/h42t37X7D3r+yzaf09FesHDYiVh+mW6KLAhhg63cf8hhJ+u kSXGkMRHqahP8I2z5Z6Oaau3r5afqv7IHvnvd2pvgvBc+yIcNf9mmCdHYvplLFSG4KBSfNBRSHvO tj6BxxAeW8VFuiO6yCEAclVLBw8e/TPckDkXGJvniGivX1Fq/UQDdfRWNiJbKFZUCBFMj3aVfRTy mM4V+dYvw3zgaX5MC+SYhClGQqBaLo/4e5RWTejdpMF40MajfsURz8L4dmQLKmXZ4ciB+h1c4Cwq mt5tbitpDjKIx3H3dmYdnoX9+S6u9NrmZRQ2PJvlf5sKJzghYQnUL1JgezUdWQ05VsGirfnatW1x D7NPHFVkxC5YVnU16UjwG05S+hO4GQ05Y/WP30Hdn+cousT5+gFGAcOaNJ6l53AchVbc0JpeNrhF rx64zcw4Oh2LkwsmIC+tUiJAU2GWfmVpiJkOE4Udd79N8qTYOy/aWG3Yx/sIj3PDi7J/PhxwEiTV JqDh0qKoKsXx5lnwVAtFIjOqBVBmDBo6d1b4QpW0dpxIo9d2WgcHzHNTu4W3OyTlA5uhTP73RN8y cSzpfj5sSQhb3cc4IkKXIhy+I6DM7/owTL8J95f1/+MXnOL6CZv+n8/wRksD+x9JjG1O+eyolGM4 l8rlxuGfhU+34hrNm42X2UZAYRVVEuFqpn0Wcxxec4eIhtK5Pi2eqhlDMrilbtDDvtO4rayUOwaR 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 duplicating the SECTOR_SHIFT definition from , use it. This patch does not change any functionality. Signed-off-by: Bart Van Assche Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke Reviewed-by: Christoph Hellwig --- drivers/target/target_core_iblock.c | 4 ++-- drivers/target/target_core_iblock.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index ce1321a5cb7b..1bc9b14236d8 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -514,7 +514,7 @@ iblock_execute_write_same(struct se_cmd *cmd) } /* Always in 512 byte units for Linux/Block */ - block_lba += sg->length >> IBLOCK_LBA_SHIFT; + block_lba += sg->length >> SECTOR_SHIFT; sectors -= 1; } @@ -757,7 +757,7 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, } /* Always in 512 byte units for Linux/Block */ - block_lba += sg->length >> IBLOCK_LBA_SHIFT; + block_lba += sg->length >> SECTOR_SHIFT; sg_num--; } diff --git a/drivers/target/target_core_iblock.h b/drivers/target/target_core_iblock.h index 9cc3843404d4..cefc641145b3 100644 --- a/drivers/target/target_core_iblock.h +++ b/drivers/target/target_core_iblock.h @@ -9,7 +9,6 @@ #define IBLOCK_VERSION "4.0" #define IBLOCK_MAX_CDBS 16 -#define IBLOCK_LBA_SHIFT 9 struct iblock_req { refcount_t pending; From patchwork Mon Sep 17 21:35:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10603529 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 1B46F6CB for ; Mon, 17 Sep 2018 22:38:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C00629D4E for ; Mon, 17 Sep 2018 22:38:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F308D29E8C; Mon, 17 Sep 2018 22:38:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E01329D4E for ; Mon, 17 Sep 2018 22:38:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727054AbeIREHr (ORCPT ); Tue, 18 Sep 2018 00:07:47 -0400 Received: from com-out001.mailprotect.be ([83.217.72.83]:58845 "EHLO com-out001.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725787AbeIREHr (ORCPT ); Tue, 18 Sep 2018 00:07:47 -0400 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=SXMXBQC2VfjgRQjthYzbBJqatiQvV/P4QRc8TmvQO64=; b=jOl1sORxr5AX t66gJV4aOYYsj6dtJgg6yVndYV8wNJXlfYaUOlq2iLs40wcz6NAlg/tJA0KjBTZ23MX5hdBH+O4Kg 0NQYBCsyHG490iB95Us3P0EZDVh/5scFqyLgIxG95vkAhIkUTcMUYgzuD29lsyw3uWvmFswXfgNQQ ceFaTGBNJ+WiL5ytBrSy8KUvk3d0sSpRu0SLU0fT58N7k/iAVgh7SqWHY0qniCedOSfU7TRf78pzi ozJI38MRnItiixbdBt8LZkhFlUEtbg+rhtS7+QkTfXmEWxFpn3zhR4Mkd/n64tiTZDDe8SQCoGN8S yMpDBXb6g/2GtFyc+G2qow==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out001.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1g21Bn-000AqP-My; Mon, 17 Sep 2018 23:36:16 +0200 Received: from asus.hsd1.ca.comcast.net (c-174-62-111-89.hsd1.ca.comcast.net [174.62.111.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 803A6C0771; Mon, 17 Sep 2018 23:36:13 +0200 (CEST) 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 03/17] target/core: Remove an unused data member from struct xcopy_pt_cmd Date: Mon, 17 Sep 2018 14:35:40 -0700 Message-Id: <20180917213554.987-4-bvanassche@acm.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180917213554.987-1-bvanassche@acm.org> References: <20180917213554.987-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: EX5BVjFpneJeBchSMxfU5rz6SLsHtmYh0Ls9jRdwpZl602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WlZa4xKvcBORT2AGmYYKfacHGRHPT1S45qX7/AQuG3+Xws3TRjaC42FtNJuTWwh7zLjlV5 cBkg2E15FOz6ftN7+ES5B2X9BSRmzsaTHypbBc902MBxp+G42GIBqokZAnJ5xBHkCMCjMposz65/ e+f6NiSg6RpPztwkEB6XvRg4fu70pheH5TNN6RiG9N0Jt+0ML5i3g2GFaGQnZ3KowlU8anvoc7s0 eHtsyrH7f4vWsxE/6wnSTdYMIbg1/h42t37X7D3r+yzaf09FesHDYiVh+mW6KLAhhg63cf8hhJ+u kSXGkMRHqahP8I2z5Z6Oaau3r5afqv7IHvnvd2pvgvBc+yIcNf9mmCdHYvplLFSG4KBSfNBRSHvO tj6BxxAeW8VFuiO6yCEAclVLBw8e/TPckDkXGJvniGivX1Fq/UQDdfRWNiJbKFZUCBFMj3aVfRTy mM4V+dYvw3zgaX5MC+SYhClGQqBaLo/4e5RWTejdpMF40MajfsURz8L4dmQLKmXZ4ciB+h1c4Cwq mt5tbitpDjKIx3H3dmYdnoX9+S6u9FJi9v/WJYVKjheG7aOrzmjUL1JgezUdWQ05VsGirfnatW1x D7NPHFVkxC5YVnU16UjwG05S+hO4GQ05Y/WP30Hdn+cousT5+gFGAcOaNJ6l53AchVbc0JpeNrhF rx64zcw4Oh2LkwsmIC+tUiJAU2GWfmVpiJkOE4Udd79N8qTYzypxBWfxh+dvLIDeter4VRxwEiTV JqDh0qKoKsXx5lnwVAtFIjOqBVBmDBo6d1b4QpW0dpxIo9d2WgcHzHNTu4W3OyTlA5uhTP73RN8y cSzpfj5sSQhb3cc4IkKXIhy+I6DM7/owTL8J95f1/+MXnOL6CZv+n8/wRksD+x9JjG1O+eyolGM4 l8rlxuGfhU+34hrNm42X2UZAYRVVEuFqpn0Wcxxec4eIhtK5Pi2eqhlDMrilbtDDvtO4rayUOwaR 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 A value is assigned to the xcopy_op member of struct xcopy_pt_cmd but that value is never used. Hence remove the xcopy_op member. Signed-off-by: Bart Van Assche Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke Reviewed-by: Christoph Hellwig --- drivers/target/target_core_xcopy.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index 2718a933c0c6..70adcfdca8d1 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c @@ -391,7 +391,6 @@ static int target_xcopy_parse_segment_descriptors(struct se_cmd *se_cmd, struct xcopy_pt_cmd { bool remote_port; struct se_cmd se_cmd; - struct xcopy_op *xcopy_op; struct completion xpt_passthrough_sem; unsigned char sense_buffer[TRANSPORT_SENSE_BUFFER]; }; @@ -596,8 +595,6 @@ static int target_xcopy_setup_pt_cmd( * X-COPY PUSH or X-COPY PULL based upon where the CDB was received. */ target_xcopy_init_pt_lun(se_dev, cmd, remote_port); - - xpt_cmd->xcopy_op = xop; target_xcopy_setup_pt_port(xpt_cmd, xop, remote_port); cmd->tag = 0; From patchwork Mon Sep 17 21:35:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10603485 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 C06BA1508 for ; Mon, 17 Sep 2018 22:19:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD1F92A769 for ; Mon, 17 Sep 2018 22:19:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0AD62A771; Mon, 17 Sep 2018 22:19: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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B1DE2A769 for ; Mon, 17 Sep 2018 22:19:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728202AbeIRDss (ORCPT ); Mon, 17 Sep 2018 23:48:48 -0400 Received: from com-out001.mailprotect.be ([83.217.72.83]:47211 "EHLO com-out001.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728023AbeIRDss (ORCPT ); Mon, 17 Sep 2018 23:48:48 -0400 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=cANx23MfagyZkk5lokPjbnH4DmfhrzVjkjhJA5MGTlQ=; b=CitJhY2696Gz 5/vzbzHYJjsDYppaHb8W4HSAFr/giUt/vDNKr9PM3rIni2Syp/9h/evd0Zf2MfValeJ6sD0BrRJjW gPm70CC7Cgr0fmmk3FaSuBoETj2N4n7eRBQz1sr80CqvRO835rfhuIk0z7+HQrf7JIkept22JxL10 n8AdEARqeBsIhnI05ZJWr05mNChkXjmkpMV9pxpHXt7l521Ob/mEwgcVGp6VZSc5AbwyQeaMdVt6O HWhUE7CJkil4gCZed78LWTe74t9KWJI22pQtnQpBfs6UdaOY3tfmLJVyp7VLK3rWnBkthKMa7E83T mRdXKgWgufS/ii5GZL2W2w==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out001.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1g21Bp-000Aqq-JT; Mon, 17 Sep 2018 23:36:18 +0200 Received: from asus.hsd1.ca.comcast.net (c-174-62-111-89.hsd1.ca.comcast.net [174.62.111.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 849D4C0718; Mon, 17 Sep 2018 23:36:15 +0200 (CEST) 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 04/17] target/core: Change the return type of transport_init_session from void to int Date: Mon, 17 Sep 2018 14:35:41 -0700 Message-Id: <20180917213554.987-5-bvanassche@acm.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180917213554.987-1-bvanassche@acm.org> References: <20180917213554.987-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.00302830772372) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5mMB0HYYerFNJys+bgBV30F602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WlZa4xKvcBORT2AGmYYKfacHGRHPT1S45qX7/AQuG3+Xws3TRjaC42FtNJuTWwh7zLjlV5 cBkg2E15FOz6ftN7DeYhznVP/hHedXEXThVsO8902MBxp+G42GIBqokZAnJ5xBHkCMCjMposz65/ e+f6NiSg6RpPztwkEB6XvRg4fu70pheH5TNN6RiG9N0Jt+0ML5i3g2GFaGQnZ3KowlU8anvoc7s0 eHtsyrH7f4vWsxE/6wnSTdYMIbg1/h42t37X7D3r+yzaf09FesHDYiVh+mW6KLAhhg63cf8hhJ+u kSXGkMRHqahP8I2z5Z6Oaau3r5afqv7IHvnvd2pvgvBc58Ll8a8FpFadZ7pYW176HUcFBAvuf345 Nnfstl8j+xbfRhkyBRfpnhOGU4XFO7gtKC2E20DCkTOs2+ui7lx1JaQBJ7TPMihJUfmPOEFZaWM/ T5itzfIn+EMb8n8rPGwij/JciTrXxhUmnmMzaRlxSAc9RvDsJWk2iVzNKhO4mxGcQ2xIQII6zLiS K1DYRU43uqYyuJysWxxCMQNM9mabIB0IiaU4gAI/mVwx8NCEKdHPrEjKCQJ0RwcvM0tk+e9c6n99 h0QCFy8UsY0CLj0GXrB5qPrmLnSSifG4ucd7W6Uv3SLeYSvLqlmLas2NEyjp4Q+z8HkVHYPFDbqs chOAY1Vdc2K+waea2lUOnotr/fNQvy23SZXSfMZ7RzHGH1l2naPKc3yQvxQmzKsAiXiBbGB3kq59 Hfp5AEkboNOV6PUf4ngLmK0LObbZiXBeyQEpViU4oE+ncQYpfHQGnNPTwRxrN3XQ8ABQoz/Q6PkR ZAZ326zBXCRRkPNZOeZhl83ItgZkcRkCnoMzps1w8ZlyWp5OlwYUQ1ejeQ1GJqZGMW0WCHtA05KY Hui9AUj7nFxAZyCgxZHINA6A5+7T9o6byzvDwAcft/nzfIptzPRrK2/ShgkK/IUjCNCeBQgjifLR QVNUvx4T911LgXOuhzWRBTEvuGslKTrRIXcXpFg5ivY= 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 This patch does not change any functionality but makes the next patch in this series easier to read. Signed-off-by: Bart Van Assche Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke --- drivers/target/target_core_transport.c | 10 ++++++++-- drivers/target/target_core_xcopy.c | 6 +++++- include/target/target_core_fabric.h | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 2c0d8626d57d..94e9d03af99d 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -230,13 +230,14 @@ void transport_subsystem_check_init(void) * * The caller must have zero-initialized @se_sess before calling this function. */ -void transport_init_session(struct se_session *se_sess) +int transport_init_session(struct se_session *se_sess) { INIT_LIST_HEAD(&se_sess->sess_list); INIT_LIST_HEAD(&se_sess->sess_acl_list); INIT_LIST_HEAD(&se_sess->sess_cmd_list); spin_lock_init(&se_sess->sess_cmd_lock); init_waitqueue_head(&se_sess->cmd_list_wq); + return 0; } EXPORT_SYMBOL(transport_init_session); @@ -247,6 +248,7 @@ EXPORT_SYMBOL(transport_init_session); struct se_session *transport_alloc_session(enum target_prot_op sup_prot_ops) { struct se_session *se_sess; + int ret; se_sess = kmem_cache_zalloc(se_sess_cache, GFP_KERNEL); if (!se_sess) { @@ -254,7 +256,11 @@ struct se_session *transport_alloc_session(enum target_prot_op sup_prot_ops) " se_sess_cache\n"); return ERR_PTR(-ENOMEM); } - transport_init_session(se_sess); + ret = transport_init_session(se_sess); + if (ret < 0) { + kfree(se_sess); + return ERR_PTR(ret); + } se_sess->sup_prot_ops = sup_prot_ops; return se_sess; diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index 70adcfdca8d1..124495f953fa 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c @@ -479,6 +479,8 @@ static const struct target_core_fabric_ops xcopy_pt_tfo = { int target_xcopy_setup_pt(void) { + int ret; + xcopy_wq = alloc_workqueue("xcopy_wq", WQ_MEM_RECLAIM, 0); if (!xcopy_wq) { pr_err("Unable to allocate xcopy_wq\n"); @@ -496,7 +498,9 @@ int target_xcopy_setup_pt(void) INIT_LIST_HEAD(&xcopy_pt_nacl.acl_list); INIT_LIST_HEAD(&xcopy_pt_nacl.acl_sess_list); memset(&xcopy_pt_sess, 0, sizeof(struct se_session)); - transport_init_session(&xcopy_pt_sess); + ret = transport_init_session(&xcopy_pt_sess); + if (ret < 0) + return ret; xcopy_pt_nacl.se_tpg = &xcopy_pt_tpg; xcopy_pt_nacl.nacl_sess = &xcopy_pt_sess; diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index f4147b398431..eb9d0923c55c 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -116,7 +116,7 @@ struct se_session *target_setup_session(struct se_portal_group *, struct se_session *, void *)); void target_remove_session(struct se_session *); -void transport_init_session(struct se_session *); +int transport_init_session(struct se_session *se_sess); struct se_session *transport_alloc_session(enum target_prot_op); int transport_alloc_session_tags(struct se_session *, unsigned int, unsigned int); From patchwork Mon Sep 17 21:35:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10603493 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 1E9351508 for ; Mon, 17 Sep 2018 22:19:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 119832A76B for ; Mon, 17 Sep 2018 22:19:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05E9C2A771; Mon, 17 Sep 2018 22:19: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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 794142A76B for ; Mon, 17 Sep 2018 22:19:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728475AbeIRDtA (ORCPT ); Mon, 17 Sep 2018 23:49:00 -0400 Received: from com-out001.mailprotect.be ([83.217.72.83]:36861 "EHLO com-out001.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728023AbeIRDtA (ORCPT ); Mon, 17 Sep 2018 23:49:00 -0400 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=E8veB/kZVZudCFUug/8eTrq84I9Xx4qKGU1eEKsPGUc=; b=A4Y/xc24vUef VNCslpwMobaB/UD4cwYsr2XFE+sGSDmDzOvCJv04xI6db7KonWapLeJ9U8xw6dZCBIYRkKbmFddMP jBJvQ/l51yufGV2vwJ0pU7THsFkOnLLpnlkVd+ioUKgdmxGjUGdz5IVPqyYvRpVGdHuChCxZ91DRK WTA9cy8cSwrfa1Def9O/snx2B7UR6ePwGwLUu8DIRj+Vl6tOGE+hb/3S5P0fHSv5u9xz+QFIYzpIL qV2bO38PtvhOs8azAaP4M0EPlkcV07OPijS/zNAwPf82hmOywulea5UrcqRUVIcOqMQy0z6Q9XBxz erFH4WqN8OC4FR3xmsEDdw==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out001.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1g21Br-000ArF-Fw; Mon, 17 Sep 2018 23:36:20 +0200 Received: from asus.hsd1.ca.comcast.net (c-174-62-111-89.hsd1.ca.comcast.net [174.62.111.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 6A670C0771; Mon, 17 Sep 2018 23:36:17 +0200 (CEST) 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 05/17] target/core: Make sure that target_wait_for_sess_cmds() waits long enough Date: Mon, 17 Sep 2018 14:35:42 -0700 Message-Id: <20180917213554.987-6-bvanassche@acm.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180917213554.987-1-bvanassche@acm.org> References: <20180917213554.987-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: EX5BVjFpneJeBchSMxfU5guRRbidmbWvwWnFk6LV9uF602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WlZa4xKvcBORT2AGmYYKfacHGRHPT1S45qX7/AQuG3+Xws3TRjaC42FtNJuTWwh7zLjlV5 cBkg2E15FOz6ftN7WN260MwZf1g7kEhu0P/R6s902MBxp+G42GIBqokZAnJ5xBHkCMCjMposz65/ e+f6NiSg6RpPztwkEB6XvRg4fu70pheH5TNN6RiG9N0Jt+0ML5i3g2GFaGQnZ3KowlU8anvoc7s0 eHtsyrH7f4vWsxE/6wnSTdYMIbg1/h42t37X7D3r+yzaf09FesHDYiVh+mW6KLAhhg63cf8hhJ+u kSXGkMRHqahP8I2z5Z6Oaau3r5afqv7IHvnvd2pvgvBc+yIcNf9mmCdHYvplLFSG4KBSfNBRSHvO tj6BxxAeW8VFuiO6yCEAclVLBw8e/TPckDkXGJvniGivX1Fq/UQDdfRWNiJbKFZUCBFMj3aVfRTy mM4V+dYvw3zgaX5MC+SYhClGQqBaLo/4e5RWTejdpMF40MajfsURz8L4dmQLKmXZ4ciB+h1c4Cwq mt5tbitpDjKIx3H3dmYdnoX9+S6u9FHoNcKBKpwOsM0bgp36P+fUL1JgezUdWQ05VsGirfnatW1x D7NPHFVkxC5YVnU16UjwG05S+hO4GQ05Y/WP30Hdn+cousT5+gFGAcOaNJ6l53AchVbc0JpeNrhF rx64zcw4Oh2LkwsmIC+tUiJAU2GWfmVpiJkOE4Udd79N8qTYcd4qMwgBY2sSVlk3aKxhghxwEiTV JqDh0qKoKsXx5lnwVAtFIjOqBVBmDBo6d1b4QpW0dpxIo9d2WgcHzHNTu4W3OyTlA5uhTP73RN8y cSzpfj5sSQhb3cc4IkKXIhy+I6DM7/owTL8J95f1/+MXnOL6CZv+n8/wRksD+x9JjG1O+eyolGM4 l8rlxuGfhU+34hrNm42X2UZAYRVVEuFqpn0Wcxxec4eIhtK5Pi2eqhlDMrilbtDDvtO4rayUOwaR 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 A session must only be released after all code that accesses the session structure has finished. Make sure that this is the case by introducing a new command counter per session that is only decremented after the .release_cmd() callback has finished. Signed-off-by: Bart Van Assche Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke --- drivers/target/target_core_transport.c | 27 +++++++++++++++++--------- include/target/target_core_base.h | 1 + 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 94e9d03af99d..54ccd8f56a57 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -224,6 +224,13 @@ void transport_subsystem_check_init(void) sub_api_initialized = 1; } +static void target_release_sess_cmd_refcnt(struct percpu_ref *ref) +{ + struct se_session *sess = container_of(ref, typeof(*sess), cmd_count); + + wake_up(&sess->cmd_list_wq); +} + /** * transport_init_session - initialize a session object * @se_sess: Session object pointer. @@ -237,7 +244,8 @@ int transport_init_session(struct se_session *se_sess) INIT_LIST_HEAD(&se_sess->sess_cmd_list); spin_lock_init(&se_sess->sess_cmd_lock); init_waitqueue_head(&se_sess->cmd_list_wq); - return 0; + return percpu_ref_init(&se_sess->cmd_count, + target_release_sess_cmd_refcnt, 0, GFP_KERNEL); } EXPORT_SYMBOL(transport_init_session); @@ -587,6 +595,7 @@ void transport_free_session(struct se_session *se_sess) sbitmap_queue_free(&se_sess->sess_tag_pool); kvfree(se_sess->sess_cmd_map); } + percpu_ref_exit(&se_sess->cmd_count); kmem_cache_free(se_sess_cache, se_sess); } EXPORT_SYMBOL(transport_free_session); @@ -2730,6 +2739,7 @@ int target_get_sess_cmd(struct se_cmd *se_cmd, bool ack_kref) } 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: spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); @@ -2760,8 +2770,6 @@ static void target_release_cmd_kref(struct kref *kref) if (se_sess) { spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); list_del_init(&se_cmd->se_cmd_list); - if (list_empty(&se_sess->sess_cmd_list)) - wake_up(&se_sess->cmd_list_wq); spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); } @@ -2769,6 +2777,8 @@ static void target_release_cmd_kref(struct kref *kref) se_cmd->se_tfo->release_cmd(se_cmd); if (compl) complete(compl); + + percpu_ref_put(&se_sess->cmd_count); } /** @@ -2897,6 +2907,8 @@ void target_sess_cmd_list_set_waiting(struct se_session *se_sess) spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); se_sess->sess_tearing_down = 1; spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); + + percpu_ref_kill_and_confirm(&se_sess->cmd_count, NULL); } EXPORT_SYMBOL(target_sess_cmd_list_set_waiting); @@ -2911,17 +2923,14 @@ void target_wait_for_sess_cmds(struct se_session *se_sess) WARN_ON_ONCE(!se_sess->sess_tearing_down); - spin_lock_irq(&se_sess->sess_cmd_lock); do { - ret = wait_event_interruptible_lock_irq_timeout( - se_sess->cmd_list_wq, - list_empty(&se_sess->sess_cmd_list), - se_sess->sess_cmd_lock, 180 * HZ); + ret = wait_event_timeout(se_sess->cmd_list_wq, + percpu_ref_is_zero(&se_sess->cmd_count), + 180 * HZ); list_for_each_entry(cmd, &se_sess->sess_cmd_list, se_cmd_list) target_show_cmd("session shutdown: still waiting for ", cmd); } while (ret <= 0); - spin_unlock_irq(&se_sess->sess_cmd_lock); } EXPORT_SYMBOL(target_wait_for_sess_cmds); diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 7a4ee7852ca4..2cfd3b4573b0 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -602,6 +602,7 @@ struct se_session { struct se_node_acl *se_node_acl; struct se_portal_group *se_tpg; void *fabric_sess_ptr; + struct percpu_ref cmd_count; struct list_head sess_list; struct list_head sess_acl_list; struct list_head sess_cmd_list; From patchwork Mon Sep 17 21:35:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10603527 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 EF9636CB for ; Mon, 17 Sep 2018 22:36:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0DC32A771 for ; Mon, 17 Sep 2018 22:36:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D43402A844; Mon, 17 Sep 2018 22:36:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68FF42A771 for ; Mon, 17 Sep 2018 22:36:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725859AbeIREF2 (ORCPT ); Tue, 18 Sep 2018 00:05:28 -0400 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 S1725787AbeIREF1 (ORCPT ); Tue, 18 Sep 2018 00:05:27 -0400 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=/hsyH4ME31li6PvP+nHvW5hMl0OLR+rDTBcEyTtyTp0=; b=MFZ5NCFQatjE TtZaJl59QX9X9Y6nkv95Se0T+LeEGiqnJLgGRCvwG4hnokzYmJKnY+3xGJVtNcp74gLdYHZTU4ota yrvmrsDmTXwsA4sF2xPduIcNyV5Km2/1VNVkNU3ahTrDUiDylVEANuhobrl5jiUHYnsqdkJ+uxl+1 JKPIhw40qSQllV9WdYC88UbAaHTddzM+40P/CHvIsjb+SrviM+yuchp7oJV4+JF7WmXoAQMXqo3xT 6mpwP9E8tP61/7OzsWSuQei+7jOXTK9dIYGAeM0qypv18QqkyUjztPLSwLsdSSSpBch0y5EMxzA5f ugKavInQGxILg4WM5yZNCA==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1g21Bt-0002hm-Ng; Mon, 17 Sep 2018 23:36:22 +0200 Received: from asus.hsd1.ca.comcast.net (c-174-62-111-89.hsd1.ca.comcast.net [174.62.111.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 50472C0718; Mon, 17 Sep 2018 23:36:19 +0200 (CEST) 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 06/17] target/core: Use sg_alloc_table() instead of open-coding it Date: Mon, 17 Sep 2018 14:35:43 -0700 Message-Id: <20180917213554.987-7-bvanassche@acm.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180917213554.987-1-bvanassche@acm.org> References: <20180917213554.987-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.06) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5q8mE5fyACuRwcocs459OcR602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WlZa4xKvcBORT2AGmYYKfacHGRHPT1S45qX7/AQuG3+Xws3TRjaC42FtNJuTWwh7zLjlV5 cBkg2E15FOz6ftN77h++v08fShq+FkGatOIWms902MBxp+G42GIBqokZAnJ5xBHkCMCjMposz65/ e+f6sz9VtXrOJenZ5zYaF/sdP+70pheH5TNN6RiG9N0Jt+0ML5i3g2GFaGQnZ3KowlU8anvoc7s0 eHtsyrH7f4vWsxE/6wnSTdYMIbg1/h42t37X7D3r+yzaf09FesHDYiVh+mW6KLAhhg63cf8hhJ+u kSXGkMRHqahP8I2z5Z6Oaau3r5afqv7IHvnvd2pvgvBc+yIcNf9mmCdHYvplLFSG4KBSfNBRSHvO tj6BxxAeW8VFuiO6yCEAclVLBw8e/TPckDkXGJvniGivX1Fq/UQDdfRWNiJbKFZUCBFMj3aVfRTy mM4V+dYvw3zgaX5MC+SYhClGQqBaLo/4e5RWTejdpMF40MajfsURz8L4dmQLKmXZ4ciB+h1c4Cwq mt5tbitpbYxvJ34ZFW/Nsw5JzXRzZGbePoTkK9fc71SC4aarzQrUL1JgezUdWQ05VsGirfnatW1x D7NPHFVkxC5YVnU16UjwG05S+hO4GQ05Y/WP30Hdn+cousT5+gFGAcOaNJ6l53AchVbc0JpeNrhF rx64zcw4Oh2LkwsmIC+tUiJAU2GWfmVpiJkOE4Udd79N8qTY2lvWYGa/0r5liFlFluIkAxxwEiTV JqDh0qKoKsXx5lnwVAtFIjOqBVBmDBo6d1b4QpW0dpxIo9d2WgcHzHNTu4W3OyTlA5uhTP73RN8y cSzpfj5sSQhb3cc4IkKXIhy+I6DM7/owTL8J95f1/+MXnOL6CZv+n8/wRksD+x9JjG1O+eyolGM4 l8rlxuGfhU+34hrNm42X2UZAYRVVEuFqpn0Wcxxec4eIhtK5Pi2eqhlDMrilbtDDvtO4rayUOwaR 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 purpose of sg_alloc_table() is to allocate and initialize an sg-list. Use that function instead of open-coding it. Signed-off-by: Bart Van Assche Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke --- drivers/target/target_core_sbc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index ebac2b49b9c6..689ba6da9a0f 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c @@ -453,7 +453,8 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd, bool succes int *post_ret) { struct se_device *dev = cmd->se_dev; - struct scatterlist *write_sg = NULL, *sg; + struct sg_table write_tbl = { }; + struct scatterlist *write_sg, *sg; unsigned char *buf = NULL, *addr; struct sg_mapping_iter m; unsigned int offset = 0, len; @@ -494,14 +495,12 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd, bool succes goto out; } - write_sg = kmalloc_array(cmd->t_data_nents, sizeof(*write_sg), - GFP_KERNEL); - if (!write_sg) { + if (sg_alloc_table(&write_tbl, cmd->t_data_nents, GFP_KERNEL) < 0) { pr_err("Unable to allocate compare_and_write sg\n"); ret = TCM_OUT_OF_RESOURCES; goto out; } - sg_init_table(write_sg, cmd->t_data_nents); + write_sg = write_tbl.sgl; /* * Setup verify and write data payloads from total NumberLBAs. */ @@ -597,7 +596,7 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd, bool succes * sbc_compare_and_write() before the original READ I/O submission. */ up(&dev->caw_sem); - kfree(write_sg); + sg_free_table(&write_tbl); kfree(buf); return ret; } From patchwork Mon Sep 17 21:35:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10603501 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 C94C117D5 for ; Mon, 17 Sep 2018 22:24:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCCFB2A2E6 for ; Mon, 17 Sep 2018 22:24:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B06F12A78C; Mon, 17 Sep 2018 22:24: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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40CE12A2E6 for ; Mon, 17 Sep 2018 22:24:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728481AbeIRDxv (ORCPT ); Mon, 17 Sep 2018 23:53:51 -0400 Received: from out002.mailprotect.be ([83.217.72.86]:54889 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728202AbeIRDxv (ORCPT ); Mon, 17 Sep 2018 23:53:51 -0400 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=wuXV10K4rPsGcahCJeVvRnpiSc25gqohzbo4UsfmCuA=; b=boizqqLaUA2v JlstOdIauMErkAtPLElhUn8BTGEaOzGHZQxnf/qvy7N1//lzhssc78LHjhLWf8Lc8CSXfx7tah3v1 RIYji58pw1d0/e7Lo8pLjKrw2IG9tn//ELjo6M5V5YZoBCqMV1bzpRrMQNojC/OxUtkarOHBsi5TK pIt7vYmRvpilyXx1o/l/pzIt4TkUVdcHidstQ3tL4IBo2qoGSZWW3vst1ICs4gsG7YhRRVe/TKwIW u5uHEqWc0zEc5hS4cYxbdKD9t31g4VbkK0DB9+G7zvcMsNJKOcuFkcmGL32JbFx1uI1x3PC1blOxQ sb7OHtt+4CrjSgc08dH3wg==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1g21Bv-0002i4-Cl; Mon, 17 Sep 2018 23:36:23 +0200 Received: from asus.hsd1.ca.comcast.net (c-174-62-111-89.hsd1.ca.comcast.net [174.62.111.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 34CCFC075C; Mon, 17 Sep 2018 23:36:21 +0200 (CEST) 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 07/17] target/core: Use system workqueues for TMF Date: Mon, 17 Sep 2018 14:35:44 -0700 Message-Id: <20180917213554.987-8-bvanassche@acm.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180917213554.987-1-bvanassche@acm.org> References: <20180917213554.987-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: EX5BVjFpneJeBchSMxfU5mMyJBZ1mk2OL7rpVB+uc5l602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WlZa4xKvcBORT2AGmYYKfacHGRHPT1S45qX7/AQuG3+Xws3TRjaC42FtNJuTWwh7zLjlV5 cBkg2E15FOz6ftN7fSFl1BDDIYUkRV9SedsCEc902MBxp+G42GIBqokZAnJ5xBHkCMCjMposz65/ e+f6sz9VtXrOJenZ5zYaF/sdP+70pheH5TNN6RiG9N0Jt+0ML5i3g2GFaGQnZ3KowlU8anvoc7s0 eHtsyrH7f4vWsxE/6wnSTdYMIbg1/h42t37X7D3r+yzaf09FesHDYiVh+mW6KLAhhg63cf8hhJ+u kSXGkMRHqahP8I2z5Z6Oaau3r5afqv7IHvnvd2pvgvBc+yIcNf9mmCdHYvplLFSG4KBSfNBRSHvO tj6BxxAeW8VFuiO6yCEAclVLBw8e/TPckDkXGJvniGivX1Fq/UQDdfRWNiJbKFZUCBFMj3aVfRTy mM4V+dYvw3zgaX5MC+SYhClGQqBaLo/4e5RWTejdpMF40MajfsURz8L4dmQLKmXZ4ciB+h1c4Cwq mt5tbitpbYxvJ34ZFW/Nsw5JzXRzZCjSqlslkFWcEX/O+LdIBCHUL1JgezUdWQ05VsGirfnatW1x D7NPHFVkxC5YVnU16UjwG05S+hO4GQ05Y/WP30Hdn+cousT5+gFGAcOaNJ6l53AchVbc0JpeNrhF rx64zcw4Oh2LkwsmIC+tUiJAU2GWfmVpiJkOE4Udd79N8qTYvHR1UkEn25nc7iDR9LIuzRxwEiTV JqDh0qKoKsXx5lnwVAtFIjOqBVBmDBo6d1b4QpW0dpxIo9d2WgcHzHNTu4W3OyTlA5uhTP73RN8y cSzpfj5sSQhb3cc4IkKXIhy+I6DM7/owTL8J95f1/+MXnOL6CZv+n8/wRksD+x9JjG1O+eyolGM4 l8rlxuGfhU+34hrNm42X2UZAYRVVEuFqpn0Wcxxec4eIhtK5Pi2eqhlDMrilbtDDvtO4rayUOwaR 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 A quote from SAM-5: "The order in which task management requests are processed is not specified by the SCSI architecture model. The SCSI architecture model does not require in-order delivery of such task management requests or processing by the task manager in the order received. To guarantee the processing order of task management requests referencing sent to a specific logical unit, an application client should not have more than one such task management request pending to that logical unit." This means that it is safe to use the system workqueues instead of tmr_wq for processing TMFs. An intended side effect of this patch is that it enables concurrent processing of TMFs. Signed-off-by: Bart Van Assche Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke Reviewed-by: Christoph Hellwig --- drivers/target/target_core_device.c | 16 ---------------- drivers/target/target_core_transport.c | 2 +- include/target/target_core_base.h | 1 - 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 47b5ef153135..2340dab5ac2f 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -986,18 +986,6 @@ int target_configure_device(struct se_device *dev) if (ret) goto out_destroy_device; - /* - * Startup the struct se_device processing thread - */ - dev->tmr_wq = alloc_workqueue("tmr-%s", WQ_MEM_RECLAIM | WQ_UNBOUND, 1, - dev->transport->name); - if (!dev->tmr_wq) { - pr_err("Unable to create tmr workqueue for %s\n", - dev->transport->name); - ret = -ENOMEM; - goto out_free_alua; - } - /* * Setup work_queue for QUEUE_FULL */ @@ -1026,8 +1014,6 @@ int target_configure_device(struct se_device *dev) return 0; -out_free_alua: - core_alua_free_lu_gp_mem(dev); out_destroy_device: dev->transport->destroy_device(dev); out_free_index: @@ -1046,8 +1032,6 @@ void target_free_device(struct se_device *dev) WARN_ON(!list_empty(&dev->dev_sep_list)); if (target_dev_configured(dev)) { - destroy_workqueue(dev->tmr_wq); - dev->transport->destroy_device(dev); mutex_lock(&device_mutex); diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 54ccd8f56a57..ec3cb16b9e0e 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -3445,7 +3445,7 @@ int transport_generic_handle_tmr( } INIT_WORK(&cmd->work, target_tmr_work); - queue_work(cmd->se_dev->tmr_wq, &cmd->work); + schedule_work(&cmd->work); return 0; } EXPORT_SYMBOL(transport_generic_handle_tmr); diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 2cfd3b4573b0..d084479fbe18 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -796,7 +796,6 @@ struct se_device { struct t10_pr_registration *dev_pr_res_holder; struct list_head dev_sep_list; struct list_head dev_tmr_list; - struct workqueue_struct *tmr_wq; struct work_struct qf_work_queue; struct list_head delayed_cmd_list; struct list_head state_list; From patchwork Mon Sep 17 21:35:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10603503 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 252D51508 for ; Mon, 17 Sep 2018 22:24:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17C6B2A2E6 for ; Mon, 17 Sep 2018 22:24:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C00E2A78C; Mon, 17 Sep 2018 22:24: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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC28F2A2E6 for ; Mon, 17 Sep 2018 22:24:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728644AbeIRDxx (ORCPT ); Mon, 17 Sep 2018 23:53:53 -0400 Received: from out002.mailprotect.be ([83.217.72.86]:58455 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728202AbeIRDxx (ORCPT ); Mon, 17 Sep 2018 23:53:53 -0400 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=8pay4VD5fZVIpnQUsLDXY0yhqOsfz39N+w8yLNrKc5o=; b=Cyb7Ahv+Dx1v QgCdiv7glORABPxSKscywFRNCKc1rW3EyT8DoBuY2At7xPq8UvEnrbrcY6VrkoaVZZ7Bpepiyq9A/ nt39/0omgCRCoGunX6fLs0sZnKovOtejZtUzvp7c4YnYTomWwPNyEGJucbVaUtCSggqKYWFngLazU 9eJbe6md3oIX7RYOa3PhPaw3IBNQOV9FWvgdl6N49ogZCTewIa8KdOxjdv+TqNHoR1oL9oHJMBtLB 8j5reYezP3V7poMGQQ2PaviOHYl09ayHwbH7fnVTLwS6iwKkPqz+4rgtAGRze1qESLi6AC+2lh59N QkMZDjjqlJczsRs/3LOGOw==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1g21Bx-0002iM-9C; Mon, 17 Sep 2018 23:36:25 +0200 Received: from asus.hsd1.ca.comcast.net (c-174-62-111-89.hsd1.ca.comcast.net [174.62.111.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 3950EC0718; Mon, 17 Sep 2018 23:36:23 +0200 (CEST) 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 08/17] target/core: Make compare_and_write_callback() accept NULL as third argument Date: Mon, 17 Sep 2018 14:35:45 -0700 Message-Id: <20180917213554.987-9-bvanassche@acm.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180917213554.987-1-bvanassche@acm.org> References: <20180917213554.987-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.11) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5jDuo+nbBtYleAdj2q9wMoh602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WlZa4xKvcBORT2AGmYYKfacHGRHPT1S45qX7/AQuG3+Xws3TRjaC42FtNJuTWwh7zLjlV5 cBkg2E15FOz6ftN74vu16J/zX2Hyz8xNF69Mn8902MBxp+G42GIBqokZAnJ5xBHkCMCjMposz65/ e+f6sz9VtXrOJenZ5zYaF/sdP+70pheH5TNN6RiG9N0Jt+0ML5i3g2GFaGQnZ3KowlU8anvoc7s0 eHtsyrH7f4vWsxE/6wnSTdYMIbg1/h42t37X7D3r+yzaf09FesHDYiVh+mW6KLAhhg63cf8hhJ+u kSXGkMRHqahP8I2z5Z6Oaau3r5afqv7IHvnvd2pvgvBc+yIcNf9mmCdHYvplLFSG4KBSfNBRSHvO tj6BxxAeW8VFuiO6yCEAclVLBw8e/TPckDkXGJvniGivX1Fq/UQDdfRWNiJbKFZUCBFMj3aVfRTy mM4V+dYvw3zgaX5MC+SYhClGQqBaLo/4e5RWTejdpMF40MajfsURz8L4dmQLKmXZ4ciB+h1c4Cwq mt5tbitpbYxvJ34ZFW/Nsw5JzXRzZMtjjXGOVy0QNNB+6SLrZz3UL1JgezUdWQ05VsGirfnatW1x D7NPHFVkxC5YVnU16UjwG05S+hO4GQ05Y/WP30Hdn+cousT5+gFGAcOaNJ6l53AchVbc0JpeNrhF rx64zcw4Oh2LkwsmIC+tUiJAU2GWfmVpiJkOE4Udd79N8qTYS2E48kPKp1kITwVFCCpWRBxwEiTV JqDh0qKoKsXx5lnwVAtFIjOqBVBmDBo6d1b4QpW0dpxIo9d2WgcHzHNTu4W3OyTlA5uhTP73RN8y cSzpfj5sSQhb3cc4IkKXIhy+I6DM7/owTL8J95f1/+MXnOL6CZv+n8/wRksD+x9JjG1O+eyolGM4 l8rlxuGfhU+34hrNm42X2UZAYRVVEuFqpn0Wcxxec4eIhtK5Pi2eqhlDMrilbtDDvtO4rayUOwaR 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 This patch does not change any functionality. A later patch in this series, namely "Make ABORT and LUN RESET handling synchronous", depends on this patch. Signed-off-by: Bart Van Assche Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke --- drivers/target/target_core_sbc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 689ba6da9a0f..4719e6a98430 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c @@ -482,7 +482,8 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd, bool succes if (cmd->scsi_status) { pr_debug("compare_and_write_callback: non zero scsi_status:" " 0x%02x\n", cmd->scsi_status); - *post_ret = 1; + if (post_ret) + *post_ret = 1; if (cmd->scsi_status == SAM_STAT_CHECK_CONDITION) ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; goto out; From patchwork Mon Sep 17 21:35:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10603499 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 713F8157B for ; Mon, 17 Sep 2018 22:24:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 616A72A2E6 for ; Mon, 17 Sep 2018 22:24:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 540362A78C; Mon, 17 Sep 2018 22:24:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D722D2A2E6 for ; Mon, 17 Sep 2018 22:24:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728641AbeIRDxs (ORCPT ); Mon, 17 Sep 2018 23:53:48 -0400 Received: from com-out001.mailprotect.be ([83.217.72.83]:38161 "EHLO com-out001.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728202AbeIRDxs (ORCPT ); Mon, 17 Sep 2018 23:53:48 -0400 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=4onZYYHNEI66MfIbwQbLPbaSy3ek1q6X4yUitvLpkew=; b=Dh6tFlITmUaO PMG7CbPl7kkWycQqDVdDWOo9ipP9pqDymGLhsRHSsHdSp1TWoYpXUm+ytfDTmihPg9cVMCQMWhLrY tXRPoOP+MDjcTChmnq4yfjBEXJt+NpbxXKgl3P+SXQ3N4itRju3aJKD/G9twJhYjIPhSBziJPSO+2 iAa0DR3d195Ji+Gs/5/usSIXnjMuB/1qMFjciZx2bntO0hLR952g6z2v8g/FyQ/q4YabU4MvA0sPa F+vih6ITHAokzeXcg08H9ZBi4486zlxDFQF9jNx9kZEQXQmrqanUaMSyQm9BFVx1/UJkhGjw91UNw XNAUW8dz/TnlmlKHhRaykQ==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out001.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1g21Bz-000As6-5z; Mon, 17 Sep 2018 23:36:27 +0200 Received: from asus.hsd1.ca.comcast.net (c-174-62-111-89.hsd1.ca.comcast.net [174.62.111.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 1E85DC075C; Mon, 17 Sep 2018 23:36:24 +0200 (CEST) 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 09/17] target/core: Always call transport_complete_callback() upon failure Date: Mon, 17 Sep 2018 14:35:46 -0700 Message-Id: <20180917213554.987-10-bvanassche@acm.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180917213554.987-1-bvanassche@acm.org> References: <20180917213554.987-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.07) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5oZXdFeYiLhuFAz/7abe8Qx602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WlZa4xKvcBORT2AGmYYKfacHGRHPT1S45qX7/AQuG3+Xws3TRjaC42FtNJuTWwh7zLjlV5 cBkg2E15FOz6ftN7xa9V1Yr6JrnUaUAn87oFyM902MBxp+G42GIBqokZAnJ5xBHkCMCjMposz65/ e+f6NiSg6RpPztwkEB6XvRg4fu70pheH5TNN6RiG9N0Jt+0ML5i3g2GFaGQnZ3KowlU8anvoc7s0 eHtsyrH7f4vWsxE/6wnSTdYMIbg1/h42t37X7D3r+yzaf09FesHDYiVh+mW6KLAhhg63cf8hhJ+u kSXGkMRHqahP8I2z5Z6Oaau3r5afqv7IHvnvd2pvgvBc+yIcNf9mmCdHYvplLFSG4KBSfNBRSHvO tj6BxxAeW8VFuiO6yCEAclVLBw8e/TPckDkXGJvniGivX1Fq/UQDdfRWNiJbKFZUCBFMj3aVfRTy mM4V+dYvw3zgaX5MC+SYhClGQqBaLo/4e5RWTejdpMF40MajfsURz8L4dmQLKmXZ4ciB+h1c4Cwq mt5tbitpDjKIx3H3dmYdnoX9+S6u9BPLYaTklcnZaw5fAPhuZfHUL1JgezUdWQ05VsGirfnatW1x D7NPHFVkxC5YVnU16UjwG05S+hO4GQ05Y/WP30Hdn+cousT5+gFGAcOaNJ6l53AchVbc0JpeNrhF rx64zcw4Oh2LkwsmIC+tUiJAU2GWfmVpiJkOE4Udd79N8qTYCmeMQCrHfXi1EmgbsPNmfRxwEiTV JqDh0qKoKsXx5lnwVAtFIjOqBVBmDBo6d1b4QpW0dpxIo9d2WgcHzHNTu4W3OyTlA5uhTP73RN8y cSzpfj5sSQhb3cc4IkKXIhy+I6DM7/owTL8J95f1/+MXnOL6CZv+n8/wRksD+x9JjG1O+eyolGM4 l8rlxuGfhU+34hrNm42X2UZAYRVVEuFqpn0Wcxxec4eIhtK5Pi2eqhlDMrilbtDDvtO4rayUOwaR 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 Call transport_complete_callback() not only if COMPARE AND WRITE fails but also if XDWRITEREAD fails. This makes the code more systematic. Signed-off-by: Bart Van Assche Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke Reviewed-by: Christoph Hellwig Reviewed-by: Nicholas Bellinger --- drivers/target/target_core_sbc.c | 6 +++++- drivers/target/target_core_transport.c | 11 +++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 4719e6a98430..c155e12ae8b9 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c @@ -360,6 +360,10 @@ static sense_reason_t xdreadwrite_callback(struct se_cmd *cmd, bool success, unsigned int offset; sense_reason_t ret = TCM_NO_SENSE; int i, count; + + if (!success) + return 0; + /* * From sbc3r22.pdf section 5.48 XDWRITEREAD (10) command * @@ -431,7 +435,7 @@ static sense_reason_t compare_and_write_post(struct se_cmd *cmd, bool success, * sent to the backend driver. */ spin_lock_irq(&cmd->t_state_lock); - if (cmd->transport_state & CMD_T_SENT) { + if (success) { cmd->se_cmd_flags |= SCF_COMPARE_AND_WRITE_POST; *post_ret = 1; diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index ec3cb16b9e0e..79fa79afcdc2 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1793,7 +1793,7 @@ EXPORT_SYMBOL(target_submit_tmr); void transport_generic_request_failure(struct se_cmd *cmd, sense_reason_t sense_reason) { - int ret = 0, post_ret = 0; + int ret = 0; pr_debug("-----[ Storage Engine Exception; sense_reason %d\n", sense_reason); @@ -1804,13 +1804,8 @@ void transport_generic_request_failure(struct se_cmd *cmd, */ transport_complete_task_attr(cmd); - /* - * Handle special case for COMPARE_AND_WRITE failure, where the - * callback is expected to drop the per device ->caw_sem. - */ - if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) && - cmd->transport_complete_callback) - cmd->transport_complete_callback(cmd, false, &post_ret); + if (cmd->transport_complete_callback) + cmd->transport_complete_callback(cmd, false, NULL); if (transport_check_aborted_status(cmd, 1)) return; From patchwork Mon Sep 17 21:35:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10603483 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 825BD157B for ; Mon, 17 Sep 2018 22:16:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A4162A22D for ; Mon, 17 Sep 2018 22:16:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D6D82A358; Mon, 17 Sep 2018 22:16:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 383C92A22D for ; Mon, 17 Sep 2018 22:16:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728594AbeIRDpg (ORCPT ); Mon, 17 Sep 2018 23:45:36 -0400 Received: from out002.mailprotect.be ([83.217.72.86]:36135 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728415AbeIRDpg (ORCPT ); Mon, 17 Sep 2018 23:45:36 -0400 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=PqlQN6g08nMAe59B/5L6wvT+TuBIcX5BodjCxzLiEqY=; b=kn0bBAIC8Hjh yfY65vSoFjJO5PWHek3KJ6g5pNXagZxzJi8mHEH5P3jPKNBjpUVegGbXGsPIqJtF9D9T/8lQkQ0hf StIXVcBDjLSBd4/RZz1NMmV4FlAAu065hvLDjRrNQTxHaUDbD6Gdp+q0W57aeSZZm9kuuaD5o110s Z3cn/B6vFfnZYxQne7KVvWzKiAr3l/o1BSKNhasGnz368u/09bFJeH3AGP32XQLW8XnW09gPMR58a 8r6sLx81BuJTAGdgR+xSFK7I7FKV7lyqSLJ2KxoptCaF+S8uFlhIW7GSv0LObyPno81iwXOMxFD+K KC4taFIGwK7FkvTKtc4s7w==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1g21C1-0002ii-2M; Mon, 17 Sep 2018 23:36:29 +0200 Received: from asus.hsd1.ca.comcast.net (c-174-62-111-89.hsd1.ca.comcast.net [174.62.111.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 04820C0718; Mon, 17 Sep 2018 23:36:26 +0200 (CEST) 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/17] target/core: Make it possible to wait from more than one context for command completion Date: Mon, 17 Sep 2018 14:35:47 -0700 Message-Id: <20180917213554.987-11-bvanassche@acm.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180917213554.987-1-bvanassche@acm.org> References: <20180917213554.987-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: EX5BVjFpneJeBchSMxfU5mThhNTaXYfb2vxkOm11aYp602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WlZa4xKvcBORT2AGmYYKfacHGRHPT1S45qX7/AQuG3+Xws3TRjaC42FtNJuTWwh7zLjlV5 cBkg2E15FOz6ftN78URJJlir+8zY8KeL+GORT8902MBxp+G42GIBqokZAnJ5xBHkCMCjMposz65/ e+f6sz9VtXrOJenZ5zYaF/sdP+70pheH5TNN6RiG9N0Jt+0ML5i3g2GFaGQnZ3KowlU8anvoc7s0 eHtsyrH7f4vWsxE/6wnSTdYMIbg1/h42t37X7D3r+yzaf09FesHDYiVh+mW6KLAhhg63cf8hhJ+u kSXGkMRHqahP8I2z5Z6Oaau3r5afqv7IHvnvd2pvgvBc+yIcNf9mmCdHYvplLFSG4KBSfNBRSHvO tj6BxxAeW8VFuiO6yCEAclVLBw8e/TPckDkXGJvniGivX1Fq/UQDdfRWNiJbKFZUCBFMj3aVfRTy mM4V+dYvw3zgaX5MC+SYhClGQqBaLo/4e5RWTejdpMF40MajfsURz8L4dmQLKmXZ4ciB+h1c4Cwq mt5tbitpbYxvJ34ZFW/Nsw5JzXRzZPYX0tf63x9sq/QlldnCqOXUL1JgezUdWQ05VsGirfnatW1x D7NPHFVkxC5YVnU16UjwG05S+hO4GQ05Y/WP30Hdn+cousT5+gFGAcOaNJ6l53AchVbc0JpeNrhF rx64zcw4Oh2LkwsmIC+tUiJAU2GWfmVpiJkOE4Udd79N8qTY3xvsweHV8I3eQk32rA3oXBxwEiTV JqDh0qKoKsXx5lnwVAtFIjOqBVBmDBo6d1b4QpW0dpxIo9d2WgcHzHNTu4W3OyTlA5uhTP73RN8y cSzpfj5sSQhb3cc4IkKXIhy+I6DM7/owTL8J95f1/+MXnOL6CZv+n8/wRksD+x9JjG1O+eyolGM4 l8rlxuGfhU+34hrNm42X2UZAYRVVEuFqpn0Wcxxec4eIhtK5Pi2eqhlDMrilbtDDvtO4rayUOwaR 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 This patch does not change any functionality but makes the next patch easier to read. Signed-off-by: Bart Van Assche Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke Signed-off-by: Bart Van Assche --- drivers/target/target_core_transport.c | 69 ++++++++++++++++++++++---- include/target/target_core_base.h | 2 +- 2 files changed, 60 insertions(+), 11 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 79fa79afcdc2..1fecd2bb53af 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1331,7 +1331,7 @@ void transport_init_se_cmd( INIT_LIST_HEAD(&cmd->se_cmd_list); INIT_LIST_HEAD(&cmd->state_list); init_completion(&cmd->t_transport_stop_comp); - cmd->compl = NULL; + init_waitqueue_head(&cmd->release_wq); spin_lock_init(&cmd->t_state_lock); INIT_WORK(&cmd->work, NULL); kref_init(&cmd->cmd_kref); @@ -2649,6 +2649,47 @@ static void target_wait_free_cmd(struct se_cmd *cmd, bool *aborted, bool *tas) spin_unlock_irqrestore(&cmd->t_state_lock, flags); } +static void __target_put_cmd_and_wait(struct se_cmd *cmd, bool put) +{ + DEFINE_WAIT(wait); + long ret; + + prepare_to_wait(&cmd->release_wq, &wait, TASK_UNINTERRUPTIBLE); + if (put) + target_put_sess_cmd(cmd); + for (;;) { + if (list_empty_careful(&wait.entry)) + break; + set_current_state(TASK_UNINTERRUPTIBLE); + if (list_empty_careful(&wait.entry)) { + set_current_state(TASK_RUNNING); + break; + } + ret = schedule_timeout(180 * HZ); + if (ret == 0) + target_show_cmd("still waiting for ", cmd); + } +} + +/* + * Call target_put_sess_cmd() and wait until target_release_cmd_kref(@cmd) has + * finished. + */ +static void target_put_cmd_and_wait(struct se_cmd *cmd) +{ + __target_put_cmd_and_wait(cmd, true); +} + +/* + * Wait until target_release_cmd_kref(@cmd) has finished. Calling this function + * is only safe if the release function does not free the memory allocated for + * @cmd. This is e.g. the case for the iSCSI target driver. + */ +static void target_wait_for_cmd(struct se_cmd *cmd) +{ + __target_put_cmd_and_wait(cmd, false); +} + /* * This function is called by frontend drivers after processing of a command * has finished. @@ -2672,7 +2713,6 @@ static void target_wait_free_cmd(struct se_cmd *cmd, bool *aborted, bool *tas) */ int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) { - DECLARE_COMPLETION_ONSTACK(compl); int ret = 0; bool aborted = false, tas = false; @@ -2691,14 +2731,17 @@ int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) if (cmd->se_lun) transport_lun_remove_cmd(cmd); } - if (aborted) - cmd->compl = &compl; - if (!aborted || tas) - ret = target_put_sess_cmd(cmd); if (aborted) { pr_debug("Detected CMD_T_ABORTED for ITT: %llu\n", cmd->tag); - wait_for_completion(&compl); + if (tas) { + target_put_cmd_and_wait(cmd); + } else { + WARN_ON_ONCE(!wait_for_tasks); + target_wait_for_cmd(cmd); + } ret = 1; + } else { + ret = target_put_sess_cmd(cmd); } return ret; } @@ -2759,9 +2802,16 @@ static void target_release_cmd_kref(struct kref *kref) { struct se_cmd *se_cmd = container_of(kref, struct se_cmd, cmd_kref); struct se_session *se_sess = se_cmd->se_sess; - struct completion *compl = se_cmd->compl; + struct wait_queue_head release_wq; unsigned long flags; + init_waitqueue_head(&release_wq); + /* + * No locking is required since we are in the release function and + * adding to release_wq is only allowed while holding a reference. + */ + list_splice_init(&se_cmd->release_wq.head, &release_wq.head); + if (se_sess) { spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); list_del_init(&se_cmd->se_cmd_list); @@ -2770,8 +2820,7 @@ static void target_release_cmd_kref(struct kref *kref) target_free_cmd_mem(se_cmd); se_cmd->se_tfo->release_cmd(se_cmd); - if (compl) - complete(compl); + wake_up_all(&release_wq); percpu_ref_put(&se_sess->cmd_count); } diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index d084479fbe18..d93ec20710c2 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -475,7 +475,7 @@ struct se_cmd { struct se_session *se_sess; struct se_tmr_req *se_tmr_req; struct list_head se_cmd_list; - struct completion *compl; + struct wait_queue_head release_wq; const struct target_core_fabric_ops *se_tfo; sense_reason_t (*execute_cmd)(struct se_cmd *); sense_reason_t (*transport_complete_callback)(struct se_cmd *, bool, int *); From patchwork Mon Sep 17 21:35:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10603523 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 7953D17D5 for ; Mon, 17 Sep 2018 22:27:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A0382A2E6 for ; Mon, 17 Sep 2018 22:27:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5CC5B2A78C; Mon, 17 Sep 2018 22:27:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E39182A2E6 for ; Mon, 17 Sep 2018 22:27:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728338AbeIRD4o (ORCPT ); Mon, 17 Sep 2018 23:56:44 -0400 Received: from out002.mailprotect.be ([83.217.72.86]:40595 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728009AbeIRD4n (ORCPT ); Mon, 17 Sep 2018 23:56:43 -0400 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=6S/eZbqRQ0WA5b3GuM5eiSxQTcMcyd1tol/aGx6WzWo=; b=EoWpwlYxflg4 /CJTqlkOYkWnGuqFAacgeh0RkV95a6JwLrB+5oiv9vcAJLTxNxFinNhzMGChvjzEPO2bU3SKDqQ1o NKjfIiD0H8524Q/nUqQ/0zrQ14O30gqP2RdgYcmcWKfB3DEnm1UBqdZcs2J44ULWdoJoAxtC5JnlR rqmJUBEVs2ri5axja0gu+dnkexHFu4l920649ahQ4XPRG9K+pwMRHypl5TENjl7q+bPC6vqmgUBf9 U15ZVly2+zL91fP5Ssc0ZX/TtdDpop+FSyOnlKO0PHmcHmohmOZ/E86mT+R5QKLN8DtaVPOn/u9tM AXcKuF8TDWBuZmDxDyuNWA==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1g21C3-0002j2-7m; Mon, 17 Sep 2018 23:36:32 +0200 Received: from asus.hsd1.ca.comcast.net (c-174-62-111-89.hsd1.ca.comcast.net [174.62.111.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 DF184C075C; Mon, 17 Sep 2018 23:36:28 +0200 (CEST) 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/17] target/core: Make ABORT and LUN RESET handling synchronous Date: Mon, 17 Sep 2018 14:35:48 -0700 Message-Id: <20180917213554.987-12-bvanassche@acm.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180917213554.987-1-bvanassche@acm.org> References: <20180917213554.987-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.00205262864288) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5vAXUgV5mQIYxk4u65v2peJ602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WlZa4xKvcBORT2AGmYYKfacHGRHPT1S45qX7/AQuG3+Xws3TRjaC42FtNJuTWwh7zLjlV5 cBkg2E15FOz6ftN74WNF1CJoRRk7u7kp+uSSJs902MBxp+G42GIBqokZAnJ5xBHkCMCjMposz65/ e+f6sz9VtXrOJenZ5zYaF/sdP+70pheH5TNN6RiG9N0Jt+0ML5i3g2GFaGQnZ3KowlU8anvoc7s0 eHtsyrH7f4vWsxE/6wnSTdYMIbg1/h42t37X7D3r+yzaf09FesHDYiVh+mW6KLAhhg63cf8hhJ+u kSXGkMRHqahP8I2z5Z6Oaau3r5afqv7IHvnvd2pvgvBc58Ll8a8FpFadZ7pYW176HUcFBAvuf345 Nnfstl8j+xbfRhkyBRfpnhOGU4XFO7gtKC2E20DCkTOs2+ui7lx1JaQBJ7TPMihJUfmPOEFZaWM/ T5itzfIn+EMb8n8rPGwij/JciTrXxhUmnmMzaRlxSAc9RvDsJWk2iVzNKhO4mxGcQ2xIQII6zLiS K1DYRU43uqYyuJysWxxCMQNM9mabIC/9tZZK4Y7Nn55Iwehdk6GiG2qOm8+/eyKuWTEizORy6n99 h0QCFy8UsY0CLj0GXrB5qPrmLnSSifG4ucd7W6Uv3SLeYSvLqlmLas2NEyjp4Q+z8HkVHYPFDbqs chOAY1Vdc2K+waea2lUOnotr/fNQvy23SZXSfMZ7RzHGH1l2naPKc3yQvxQmzKsAiXiBbLnVHkYS +khoXt5VMYYD7dof4ngLmK0LObbZiXBeyQEpViU4oE+ncQYpfHQGnNPTwRxrN3XQ8ABQoz/Q6PkR ZAZ326zBXCRRkPNZOeZhl83ItgZkcRkCnoMzps1w8ZlyWp5OlwYUQ1ejeQ1GJqZGMW0WCHtA05KY Hui9AUj7nFxAZyCgxZHINA6A5+7T9o6byzvDwAcft/nzfIptzPRrK2/ShgkK/IUjCNCeBQgjifLR QVNUvx4T911LgXOuhzWRBTEvuGslKTrRIXcXpFg5ivY= 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 invoking target driver callback functions from the context that handles an abort or LUN RESET task management function, only set the abort flag from that context and perform the actual abort handling from the context of the regular command processing flow. This approach has the following advantages: - The task management function code becomes much easier to read and to verify since the number of potential race conditions against the command processing flow is strongly reduced. - It is no longer needed to store the command state into the command itself since that information is no longer needed from the context where a task management function is processed. Notes: - With this patch applied for SCSI commands the CMD_T_ABORTED flag is checked at two stages by the target core during command execution: just before local execution of a command starts (see also target_execute_cmd()) and also just before the response is sent (see also target_complete_cmd()). - The SCF_SEND_DELAYED_TAS has been removed. This flag was used to make the second transport_check_aborted_status() call send the command status back to the initiator. The new approach is that the CMD_T_ABORTED flag is checked from inside target_complete_cmd(). If that flag is set when that function is called, appropriate action is taken - either send the TASK ABORTED status back to the initiator or abort the command without sending a response. Signed-off-by: Bart Van Assche Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke --- drivers/target/target_core_internal.h | 2 - drivers/target/target_core_tmr.c | 49 ++-- drivers/target/target_core_transport.c | 304 ++++++++++--------------- include/target/target_core_base.h | 1 - include/target/target_core_fabric.h | 1 + 5 files changed, 153 insertions(+), 204 deletions(-) diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h index 0c6635587930..853344415963 100644 --- a/drivers/target/target_core_internal.h +++ b/drivers/target/target_core_internal.h @@ -138,7 +138,6 @@ int init_se_kmem_caches(void); void release_se_kmem_caches(void); u32 scsi_get_new_index(scsi_index_t); void transport_subsystem_check_init(void); -int transport_cmd_finish_abort(struct se_cmd *); unsigned char *transport_dump_cmd_direction(struct se_cmd *); void transport_dump_dev_state(struct se_device *, char *, int *); void transport_dump_dev_info(struct se_device *, struct se_lun *, @@ -148,7 +147,6 @@ int transport_dump_vpd_assoc(struct t10_vpd *, unsigned char *, int); int transport_dump_vpd_ident_type(struct t10_vpd *, unsigned char *, int); int transport_dump_vpd_ident(struct t10_vpd *, unsigned char *, int); void transport_clear_lun_ref(struct se_lun *); -void transport_send_task_abort(struct se_cmd *); sense_reason_t target_cmd_size_check(struct se_cmd *cmd, unsigned int size); void target_qf_do_work(struct work_struct *work); bool target_check_wce(struct se_device *dev); diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index 6d1179a7f043..2750a2c7b563 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c @@ -170,11 +170,15 @@ void core_tmr_abort_task( spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); - cancel_work_sync(&se_cmd->work); - transport_wait_for_tasks(se_cmd); + /* + * Ensure that this ABORT request is visible to the LU RESET + * code. + */ + if (!tmr->tmr_dev) + WARN_ON_ONCE(transport_lookup_tmr_lun(tmr->task_cmd, + se_cmd->orig_fe_lun) < 0); - if (!transport_cmd_finish_abort(se_cmd)) - target_put_sess_cmd(se_cmd); + target_put_cmd_and_wait(se_cmd); printk("ABORT_TASK: Sending TMR_FUNCTION_COMPLETE for" " ref_tag: %llu\n", ref_tag); @@ -268,14 +272,28 @@ static void core_tmr_drain_tmr_list( (preempt_and_abort_list) ? "Preempt" : "", tmr_p, tmr_p->function, tmr_p->response, cmd->t_state); - cancel_work_sync(&cmd->work); - transport_wait_for_tasks(cmd); - - if (!transport_cmd_finish_abort(cmd)) - target_put_sess_cmd(cmd); + target_put_cmd_and_wait(cmd); } } +/** + * core_tmr_drain_state_list() - abort SCSI commands associated with a device + * + * @dev: Device for which to abort outstanding SCSI commands. + * @prout_cmd: Pointer to the SCSI PREEMPT AND ABORT if this function is called + * to realize the PREEMPT AND ABORT functionality. + * @tmr_sess: Session through which the LUN RESET has been received. + * @tas: Task Aborted Status (TAS) bit from the SCSI control mode page. + * A quote from SPC-4, paragraph "7.5.10 Control mode page": + * "A task aborted status (TAS) bit set to zero specifies that + * aborted commands shall be terminated by the device server + * without any response to the application client. A TAS bit set + * to one specifies that commands aborted by the actions of an I_T + * nexus other than the I_T nexus on which the command was + * received shall be completed with TASK ABORTED status." + * @preempt_and_abort_list: For the PREEMPT AND ABORT functionality, a list + * with registrations that will be preempted. + */ static void core_tmr_drain_state_list( struct se_device *dev, struct se_cmd *prout_cmd, @@ -350,18 +368,7 @@ static void core_tmr_drain_state_list( cmd->tag, (preempt_and_abort_list) ? "preempt" : "", cmd->pr_res_key); - /* - * If the command may be queued onto a workqueue cancel it now. - * - * This is equivalent to removal from the execute queue in the - * loop above, but we do it down here given that - * cancel_work_sync may block. - */ - cancel_work_sync(&cmd->work); - transport_wait_for_tasks(cmd); - - if (!transport_cmd_finish_abort(cmd)) - target_put_sess_cmd(cmd); + target_put_cmd_and_wait(cmd); } } diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 1fecd2bb53af..230a46b03925 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -710,32 +710,6 @@ static void transport_lun_remove_cmd(struct se_cmd *cmd) percpu_ref_put(&lun->lun_ref); } -int transport_cmd_finish_abort(struct se_cmd *cmd) -{ - bool send_tas = cmd->transport_state & CMD_T_TAS; - bool ack_kref = (cmd->se_cmd_flags & SCF_ACK_KREF); - int ret = 0; - - if (send_tas) - transport_send_task_abort(cmd); - - if (cmd->se_cmd_flags & SCF_SE_LUN_CMD) - transport_lun_remove_cmd(cmd); - /* - * Allow the fabric driver to unmap any resources before - * releasing the descriptor via TFO->release_cmd() - */ - if (!send_tas) - cmd->se_tfo->aborted_task(cmd); - - if (transport_cmd_check_stop_to_fabric(cmd)) - return 1; - if (!send_tas && ack_kref) - ret = target_put_sess_cmd(cmd); - - return ret; -} - static void target_complete_failure_work(struct work_struct *work) { struct se_cmd *cmd = container_of(work, struct se_cmd, work); @@ -785,12 +759,76 @@ void transport_copy_sense_to_cmd(struct se_cmd *cmd, unsigned char *sense) } EXPORT_SYMBOL(transport_copy_sense_to_cmd); +static void target_handle_abort(struct se_cmd *cmd) +{ + bool tas = cmd->transport_state & CMD_T_TAS; + bool ack_kref = cmd->se_cmd_flags & SCF_ACK_KREF; + int ret; + + pr_debug("tag %#llx: send_abort_response = %d\n", cmd->tag, tas); + + if (cmd->transport_complete_callback) + cmd->transport_complete_callback(cmd, false, NULL); + + if (tas) { + if (!(cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)) { + cmd->scsi_status = SAM_STAT_TASK_ABORTED; + pr_debug("Setting SAM_STAT_TASK_ABORTED status for CDB: 0x%02x, ITT: 0x%08llx\n", + cmd->t_task_cdb[0], cmd->tag); + trace_target_cmd_complete(cmd); + ret = cmd->se_tfo->queue_status(cmd); + if (ret) { + transport_handle_queue_full(cmd, cmd->se_dev, + ret, false); + return; + } + } else { + cmd->se_tmr_req->response = TMR_FUNCTION_REJECTED; + cmd->se_tfo->queue_tm_rsp(cmd); + } + } else { + /* + * Allow the fabric driver to unmap any resources before + * releasing the descriptor via TFO->release_cmd(). + */ + cmd->se_tfo->aborted_task(cmd); + if (ack_kref) + WARN_ON_ONCE(target_put_sess_cmd(cmd) != 0); + /* + * To do: establish a unit attention condition on the I_T + * nexus associated with cmd. See also the paragraph "Aborting + * commands" in SAM. + */ + } + + WARN_ON_ONCE(kref_read(&cmd->cmd_kref) == 0); + + transport_lun_remove_cmd(cmd); + + transport_cmd_check_stop_to_fabric(cmd); +} + +static void target_abort_work(struct work_struct *work) +{ + struct se_cmd *cmd = container_of(work, struct se_cmd, work); + + target_handle_abort(cmd); +} + +/* May be called from interrupt context so must not sleep. */ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status) { - struct se_device *dev = cmd->se_dev; int success; unsigned long flags; + if (cmd->transport_state & CMD_T_ABORTED) { + INIT_WORK(&cmd->work, target_abort_work); + goto queue_work; + } else if (cmd->transport_state & CMD_T_STOP) { + complete_all(&cmd->t_transport_stop_comp); + return; + } + cmd->scsi_status = scsi_status; spin_lock_irqsave(&cmd->t_state_lock, flags); @@ -806,25 +844,7 @@ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status) break; } - /* - * Check for case where an explicit ABORT_TASK has been received - * and transport_wait_for_tasks() will be waiting for completion.. - */ - if (cmd->transport_state & CMD_T_ABORTED || - cmd->transport_state & CMD_T_STOP) { - spin_unlock_irqrestore(&cmd->t_state_lock, flags); - /* - * If COMPARE_AND_WRITE was stopped by __transport_wait_for_tasks(), - * release se_device->caw_sem obtained by sbc_compare_and_write() - * since target_complete_ok_work() or target_complete_failure_work() - * won't be called to invoke the normal CAW completion callbacks. - */ - if (cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) { - up(&dev->caw_sem); - } - complete_all(&cmd->t_transport_stop_comp); - return; - } else if (!success) { + if (!success) { INIT_WORK(&cmd->work, target_complete_failure_work); } else { INIT_WORK(&cmd->work, target_complete_ok_work); @@ -834,6 +854,7 @@ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status) cmd->transport_state |= (CMD_T_COMPLETE | CMD_T_ACTIVE); spin_unlock_irqrestore(&cmd->t_state_lock, flags); +queue_work: if (cmd->se_cmd_flags & SCF_USE_CPUID) queue_work_on(cmd->cpuid, target_completion_wq, &cmd->work); else @@ -1804,12 +1825,15 @@ void transport_generic_request_failure(struct se_cmd *cmd, */ transport_complete_task_attr(cmd); + if (cmd->transport_state & CMD_T_ABORTED) { + INIT_WORK(&cmd->work, target_abort_work); + queue_work(target_completion_wq, &cmd->work); + return; + } + if (cmd->transport_complete_callback) cmd->transport_complete_callback(cmd, false, NULL); - if (transport_check_aborted_status(cmd, 1)) - return; - switch (sense_reason) { case TCM_NON_EXISTENT_LUN: case TCM_UNSUPPORTED_SCSI_OPCODE: @@ -2014,8 +2038,6 @@ static bool target_handle_task_attr(struct se_cmd *cmd) return true; } -static int __transport_check_aborted_status(struct se_cmd *, int); - void target_execute_cmd(struct se_cmd *cmd) { /* @@ -2024,11 +2046,13 @@ void target_execute_cmd(struct se_cmd *cmd) * * If the received CDB has already been aborted stop processing it here. */ - spin_lock_irq(&cmd->t_state_lock); - if (__transport_check_aborted_status(cmd, 1)) { - spin_unlock_irq(&cmd->t_state_lock); + if (cmd->transport_state & CMD_T_ABORTED) { + INIT_WORK(&cmd->work, target_abort_work); + queue_work(target_completion_wq, &cmd->work); return; } + + spin_lock_irq(&cmd->t_state_lock); if (cmd->transport_state & CMD_T_STOP) { pr_debug("%s:%d CMD_T_STOP for ITT: 0x%08llx\n", __func__, __LINE__, cmd->tag); @@ -2675,7 +2699,7 @@ static void __target_put_cmd_and_wait(struct se_cmd *cmd, bool put) * Call target_put_sess_cmd() and wait until target_release_cmd_kref(@cmd) has * finished. */ -static void target_put_cmd_and_wait(struct se_cmd *cmd) +void target_put_cmd_and_wait(struct se_cmd *cmd) { __target_put_cmd_and_wait(cmd, true); } @@ -2694,10 +2718,13 @@ static void target_wait_for_cmd(struct se_cmd *cmd) * This function is called by frontend drivers after processing of a command * has finished. * - * The protocol for ensuring that either the regular flow or the TMF - * code drops one reference is as follows: + * The protocol for ensuring that either the regular frontend command + * processing flow or target_handle_abort() code drops one reference is as + * follows: * - Calling .queue_data_in(), .queue_status() or queue_tm_rsp() will cause - * the frontend driver to drop one reference, synchronously or asynchronously. + * the frontend driver to call this function synchronously or asynchronously. + * Unless CMD_T_ABORTED has been set and CMD_T_TAS has not been set, that will + * cause one reference to be dropped. * - During regular command processing the target core sets CMD_T_COMPLETE * before invoking one of the .queue_*() functions. * - The code that aborts commands skips commands and TMFs for which @@ -2709,7 +2736,7 @@ static void target_wait_for_cmd(struct se_cmd *cmd) * - For aborted commands for which CMD_T_TAS has been set .queue_status() will * be called and will drop a reference. * - For aborted commands for which CMD_T_TAS has not been set .aborted_task() - * will be called. transport_cmd_finish_abort() will drop the final reference. + * will be called. target_handle_abort() will drop the final reference. */ int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) { @@ -3293,6 +3320,13 @@ transport_send_check_condition_and_sense(struct se_cmd *cmd, { unsigned long flags; + WARN_ON_ONCE(cmd->se_cmd_flags & SCF_SCSI_TMR_CDB); + + if (cmd->transport_state & CMD_T_ABORTED) { + target_handle_abort(cmd); + return 0; + } + spin_lock_irqsave(&cmd->t_state_lock, flags); if (cmd->se_cmd_flags & SCF_SENT_CHECK_CONDITION) { spin_unlock_irqrestore(&cmd->t_state_lock, flags); @@ -3309,114 +3343,33 @@ transport_send_check_condition_and_sense(struct se_cmd *cmd, } EXPORT_SYMBOL(transport_send_check_condition_and_sense); -static int __transport_check_aborted_status(struct se_cmd *cmd, int send_status) - __releases(&cmd->t_state_lock) - __acquires(&cmd->t_state_lock) -{ - int ret; - - assert_spin_locked(&cmd->t_state_lock); - WARN_ON_ONCE(!irqs_disabled()); - - if (!(cmd->transport_state & CMD_T_ABORTED)) - return 0; - /* - * If cmd has been aborted but either no status is to be sent or it has - * already been sent, just return - */ - if (!send_status || !(cmd->se_cmd_flags & SCF_SEND_DELAYED_TAS)) { - if (send_status) - cmd->se_cmd_flags |= SCF_SEND_DELAYED_TAS; - return 1; - } - - pr_debug("Sending delayed SAM_STAT_TASK_ABORTED status for CDB:" - " 0x%02x ITT: 0x%08llx\n", cmd->t_task_cdb[0], cmd->tag); - - cmd->se_cmd_flags &= ~SCF_SEND_DELAYED_TAS; - cmd->scsi_status = SAM_STAT_TASK_ABORTED; - trace_target_cmd_complete(cmd); - - spin_unlock_irq(&cmd->t_state_lock); - ret = cmd->se_tfo->queue_status(cmd); - if (ret) - transport_handle_queue_full(cmd, cmd->se_dev, ret, false); - spin_lock_irq(&cmd->t_state_lock); - - return 1; -} - +/** + * transport_check_aborted_status - return 1 if the command has been aborted + * @cmd: SCSI command to check the status of. + * @send_status: Ignored. + * + * Note: if this function is called while SCSI WRITE data frames are being + * received, the target driver will call target_execute_cmd() after all WRITE + * data frames have been received. That function will check the CMD_T_ABORTED + * flag again and will handle the abort. At least for the iSCSI target driver + * it is essential that an abort is only processed after all WRITE data frames + * have been received. + */ int transport_check_aborted_status(struct se_cmd *cmd, int send_status) { - int ret; - - spin_lock_irq(&cmd->t_state_lock); - ret = __transport_check_aborted_status(cmd, send_status); - spin_unlock_irq(&cmd->t_state_lock); - - return ret; + return cmd->transport_state & CMD_T_ABORTED; } EXPORT_SYMBOL(transport_check_aborted_status); -void transport_send_task_abort(struct se_cmd *cmd) -{ - unsigned long flags; - int ret; - - spin_lock_irqsave(&cmd->t_state_lock, flags); - if (cmd->se_cmd_flags & (SCF_SENT_CHECK_CONDITION)) { - spin_unlock_irqrestore(&cmd->t_state_lock, flags); - return; - } - spin_unlock_irqrestore(&cmd->t_state_lock, flags); - - /* - * If there are still expected incoming fabric WRITEs, we wait - * until until they have completed before sending a TASK_ABORTED - * response. This response with TASK_ABORTED status will be - * queued back to fabric module by transport_check_aborted_status(). - */ - if (cmd->data_direction == DMA_TO_DEVICE) { - if (cmd->se_tfo->write_pending_status(cmd) != 0) { - spin_lock_irqsave(&cmd->t_state_lock, flags); - if (cmd->se_cmd_flags & SCF_SEND_DELAYED_TAS) { - spin_unlock_irqrestore(&cmd->t_state_lock, flags); - goto send_abort; - } - cmd->se_cmd_flags |= SCF_SEND_DELAYED_TAS; - spin_unlock_irqrestore(&cmd->t_state_lock, flags); - return; - } - } -send_abort: - cmd->scsi_status = SAM_STAT_TASK_ABORTED; - - transport_lun_remove_cmd(cmd); - - pr_debug("Setting SAM_STAT_TASK_ABORTED status for CDB: 0x%02x, ITT: 0x%08llx\n", - cmd->t_task_cdb[0], cmd->tag); - - trace_target_cmd_complete(cmd); - ret = cmd->se_tfo->queue_status(cmd); - if (ret) - transport_handle_queue_full(cmd, cmd->se_dev, ret, false); -} - static void target_tmr_work(struct work_struct *work) { struct se_cmd *cmd = container_of(work, struct se_cmd, work); struct se_device *dev = cmd->se_dev; struct se_tmr_req *tmr = cmd->se_tmr_req; - unsigned long flags; int ret; - spin_lock_irqsave(&cmd->t_state_lock, flags); - if (cmd->transport_state & CMD_T_ABORTED) { - tmr->response = TMR_FUNCTION_REJECTED; - spin_unlock_irqrestore(&cmd->t_state_lock, flags); - goto check_stop; - } - spin_unlock_irqrestore(&cmd->t_state_lock, flags); + if (cmd->transport_state & CMD_T_ABORTED) + goto aborted; switch (tmr->function) { case TMR_ABORT_TASK: @@ -3450,44 +3403,35 @@ static void target_tmr_work(struct work_struct *work) break; } - spin_lock_irqsave(&cmd->t_state_lock, flags); - if (cmd->transport_state & CMD_T_ABORTED) { - spin_unlock_irqrestore(&cmd->t_state_lock, flags); - goto check_stop; - } - spin_unlock_irqrestore(&cmd->t_state_lock, flags); + if (cmd->transport_state & CMD_T_ABORTED) + goto aborted; cmd->se_tfo->queue_tm_rsp(cmd); -check_stop: - transport_lun_remove_cmd(cmd); transport_cmd_check_stop_to_fabric(cmd); + return; + +aborted: + target_handle_abort(cmd); } -int transport_generic_handle_tmr( - struct se_cmd *cmd) +int transport_generic_handle_tmr(struct se_cmd *cmd) { unsigned long flags; - bool aborted = false; - spin_lock_irqsave(&cmd->t_state_lock, flags); if (cmd->transport_state & CMD_T_ABORTED) { - aborted = true; - } else { - cmd->t_state = TRANSPORT_ISTATE_PROCESSING; - cmd->transport_state |= CMD_T_ACTIVE; - } - spin_unlock_irqrestore(&cmd->t_state_lock, flags); - - if (aborted) { - pr_warn_ratelimited("handle_tmr caught CMD_T_ABORTED TMR %d" - "ref_tag: %llu tag: %llu\n", cmd->se_tmr_req->function, - cmd->se_tmr_req->ref_task_tag, cmd->tag); - transport_lun_remove_cmd(cmd); - transport_cmd_check_stop_to_fabric(cmd); + pr_warn_ratelimited("handle_tmr caught CMD_T_ABORTED TMR %d ref_tag: %llu tag: %llu\n", + cmd->se_tmr_req->function, + cmd->se_tmr_req->ref_task_tag, cmd->tag); + target_handle_abort(cmd); return 0; } + spin_lock_irqsave(&cmd->t_state_lock, flags); + cmd->t_state = TRANSPORT_ISTATE_PROCESSING; + cmd->transport_state |= CMD_T_ACTIVE; + spin_unlock_irqrestore(&cmd->t_state_lock, flags); + INIT_WORK(&cmd->work, target_tmr_work); schedule_work(&cmd->work); return 0; diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index d93ec20710c2..833567125905 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -134,7 +134,6 @@ enum se_cmd_flags_table { SCF_SENT_CHECK_CONDITION = 0x00000800, SCF_OVERFLOW_BIT = 0x00001000, SCF_UNDERFLOW_BIT = 0x00002000, - SCF_SEND_DELAYED_TAS = 0x00004000, SCF_ALUA_NON_OPTIMIZED = 0x00008000, SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00020000, SCF_COMPARE_AND_WRITE = 0x00080000, diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index eb9d0923c55c..792149993859 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -149,6 +149,7 @@ int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, int transport_handle_cdb_direct(struct se_cmd *); sense_reason_t transport_generic_new_cmd(struct se_cmd *); +void target_put_cmd_and_wait(struct se_cmd *cmd); void target_execute_cmd(struct se_cmd *cmd); int transport_generic_free_cmd(struct se_cmd *, int); From patchwork Mon Sep 17 21:35:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10603525 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 953D017D5 for ; Mon, 17 Sep 2018 22:29:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8516E2A7A9 for ; Mon, 17 Sep 2018 22:29:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7961C2A7B8; Mon, 17 Sep 2018 22:29:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1863F2A7A9 for ; Mon, 17 Sep 2018 22:29:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728023AbeIRD6j (ORCPT ); Mon, 17 Sep 2018 23:58:39 -0400 Received: from out002.mailprotect.be ([83.217.72.86]:40359 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728009AbeIRD6j (ORCPT ); Mon, 17 Sep 2018 23:58:39 -0400 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=qjfWyN11YsVK/Qc1QudcHo+Qzb6RrhOE6gE6e5+dByU=; b=U90MvcvlXmHw jprnnIxJ8iwmbxdyWj+KLxjkzFLL9wFsFgNOwqyr+xKo5rSEf/uhtw7k7nU46M/8BQJH1C7nW+Kol wpg4+eZ/aAaK+H6JeUPxv9Ydk8tHOySQ1G1X5YdEZW2w3yoptyautYRN9lBl0q45Ld+NzPLUV9yaI 8KIvIg0U84sEr45XkIfxeFL7RfnsotLIGstVuDvY9XxnRp255ocohB1jwYbf23FZn56J3sYETR8sR 53tTAWcvnyo0EGRZDt0yDHECJA164RKUU7tr1azji/inVCTO15sB/pK8c/+9UMXa0Fti12Nog9PiA BaR+dqptyFt+Pmsd60xNsw==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1g21C5-0002jD-3k; Mon, 17 Sep 2018 23:36:33 +0200 Received: from asus.hsd1.ca.comcast.net (c-174-62-111-89.hsd1.ca.comcast.net [174.62.111.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 10F91C0718; Mon, 17 Sep 2018 23:36:30 +0200 (CEST) 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 12/17] target/core: Reduce the amount of code executed with a spinlock held Date: Mon, 17 Sep 2018 14:35:49 -0700 Message-Id: <20180917213554.987-13-bvanassche@acm.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180917213554.987-1-bvanassche@acm.org> References: <20180917213554.987-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: EX5BVjFpneJeBchSMxfU5pHm5EkaOSN6fVrxNKv7x29602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WlZa4xKvcBORT2AGmYYKfacHGRHPT1S45qX7/AQuG3+Xws3TRjaC42FtNJuTWwh7zLjlV5 cBkg2E15FOz6ftN7zFVbYl2Q8BeWfusMxYo0Ic902MBxp+G42GIBqokZAnJ5xBHkCMCjMposz65/ e+f6sz9VtXrOJenZ5zYaF/sdP+70pheH5TNN6RiG9N0Jt+0ML5i3g2GFaGQnZ3KowlU8anvoc7s0 eHtsyrH7f4vWsxE/6wnSTdYMIbg1/h42t37X7D3r+yzaf09FesHDYiVh+mW6KLAhhg63cf8hhJ+u kSXGkMRHqahP8I2z5Z6Oaau3r5afqv7IHvnvd2pvgvBc+yIcNf9mmCdHYvplLFSG4KBSfNBRSHvO tj6BxxAeW8VFuiO6yCEAclVLBw8e/TPckDkXGJvniGivX1Fq/UQDdfRWNiJbKFZUCBFMj3aVfRTy mM4V+dYvw3zgaX5MC+SYhClGQqBaLo/4e5RWTejdpMF40MajfsURz8L4dmQLKmXZ4ciB+h1c4Cwq mt5tbitpbYxvJ34ZFW/Nsw5JzXRzZEcXs9k1Vv4/wuhiUpySElbUL1JgezUdWQ05VsGirfnatW1x D7NPHFVkxC5YVnU16UjwG05S+hO4GQ05Y/WP30Hdn+cousT5+gFGAcOaNJ6l53AchVbc0JpeNrhF rx64zcw4Oh2LkwsmIC+tUiJAU2GWfmVpiJkOE4Udd79N8qTY09KR2GTFS33diNWD4eqHkBxwEiTV JqDh0qKoKsXx5lnwVAtFIjOqBVBmDBo6d1b4QpW0dpxIo9d2WgcHzHNTu4W3OyTlA5uhTP73RN8y cSzpfj5sSQhb3cc4IkKXIhy+I6DM7/owTL8J95f1/+MXnOL6CZv+n8/wRksD+x9JjG1O+eyolGM4 l8rlxuGfhU+34hrNm42X2UZAYRVVEuFqpn0Wcxxec4eIhtK5Pi2eqhlDMrilbtDDvtO4rayUOwaR 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 "make ABORT and LUN RESET handling synchronous" patch, cmd->work is only modified from the regular command execution path and no longer asynchronously by the code that executes task management functions. Since the regular command execution code is sequential per command, no locking is required to manipulate cmd->work. Hence stop protecting cmd->work manipulations with locking. Signed-off-by: Bart Van Assche Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke --- drivers/target/target_core_transport.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 230a46b03925..e76dace0ddb4 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -844,16 +844,13 @@ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status) break; } - if (!success) { - INIT_WORK(&cmd->work, target_complete_failure_work); - } else { - INIT_WORK(&cmd->work, target_complete_ok_work); - } - cmd->t_state = TRANSPORT_COMPLETE; cmd->transport_state |= (CMD_T_COMPLETE | CMD_T_ACTIVE); spin_unlock_irqrestore(&cmd->t_state_lock, flags); + INIT_WORK(&cmd->work, success ? target_complete_ok_work : + target_complete_failure_work); + queue_work: if (cmd->se_cmd_flags & SCF_USE_CPUID) queue_work_on(cmd->cpuid, target_completion_wq, &cmd->work); From patchwork Mon Sep 17 21:35:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10603497 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 6BF471508 for ; Mon, 17 Sep 2018 22:20:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E8E72A835 for ; Mon, 17 Sep 2018 22:20:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 531982A7B0; Mon, 17 Sep 2018 22:20: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=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD1272A76B for ; Mon, 17 Sep 2018 22:20:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728202AbeIRDt1 (ORCPT ); Mon, 17 Sep 2018 23:49:27 -0400 Received: from out002.mailprotect.be ([83.217.72.86]:36931 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728023AbeIRDt1 (ORCPT ); Mon, 17 Sep 2018 23:49:27 -0400 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=227ZhvLDPT6kbAc7yXMDneFwaiqr/l/EeS7UAUBotSc=; b=TTv5D2sI5553 CxvOZoRwRd0BLI6orueO3msRh/aNFvJsbohwfi4PUaWeZcHtlKu94J88cPCuOBZUaFPBo6nMvV2cx XO3bfBo95Sf/qKn39kNrCrl+bUENlhJTftk5i7jw/oGkjQKaaJN9YMPqo/LoWuUxJERk4S1pedlVQ Xae5nPA4vvAX8qj0aNa7m4LMZRx2W03SR/9+noeaGjdZTbOV7DCZO8Aa7o9Lp+fHQ+X5/w3RMmNxJ N6MkopddXKDKMRwn5Am3vPpyfmkt4ldeI+DxpH03PMQKqCrTYBfi8FSoHDTh2lIcMuSOLEoVyQyVc g65UbKJisWcVfLt4uEGo5Q==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1g21C7-0002jU-5L; Mon, 17 Sep 2018 23:36:35 +0200 Received: from asus.hsd1.ca.comcast.net (c-174-62-111-89.hsd1.ca.comcast.net [174.62.111.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 E8BF5C0771; Mon, 17 Sep 2018 23:36:32 +0200 (CEST) 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 13/17] target/core: Avoid that LUN reset sporadically triggers data corruption Date: Mon, 17 Sep 2018 14:35:50 -0700 Message-Id: <20180917213554.987-14-bvanassche@acm.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180917213554.987-1-bvanassche@acm.org> References: <20180917213554.987-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: EX5BVjFpneJeBchSMxfU5kVqA2dtAWGPMJ2Mihl7xJF602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WlZa4xKvcBORT2AGmYYKfa2w4nwtOiKlIdftXY5+/HTLBPB4loq3vFboQ7gxpx2K5q243j OywFphhx6RtIX3/eBU519jxvHYi8yYUXqBwxztbjuU58k6ddZEUemp+2z708nJwgsskeL6jfWDvk QqiSTWUth/bIg1D/4cblfXFvIrwhcbIgt0qoJA65s+aV0TNSu4Q1sJN0pTPPGPEcb1FCr3OnWExh FqqXKjnbUDBzcE+0HNyHhfqG0xcyQsZuCSPCjEi4ZwcU35NfL3zG7gtHj8xG2HbE6AX2FmEJ2JNQ xdpvnw+pYth8G0cQXB2J3taT9DS0dkB4Cnwl7xB5kr0QjBtk6zyNLmG5bRMyUWLGmHSsrvE5ol3t DswyoeVJL6fJ0IdteI/zTbpcDI9MsmV317NirEYyqwqMBGrw8ELiqO024LKrdtbNRVNrB1ymm5TN sFlW4xzv3KSabGJbxYTPMIwgbvzZDfnPtxft9hhq2K+cGqR018mIinnrbkyUvY39mkdHzbUjd6PR fLJZDPRgASJFC/49WOPBr5nlEUI4xL3dT292+RbQjttUVlvdrnQK1sSC7J3Hv785O0oOR7DFJ8f1 27NbbfLBGyoHMieTevVmyL2W0wef24nctTTtGWg/yUagnQaXyaC6KIW3Zw2W4ALym497HobEjrNo 920r6J7h+6WGdIozr5wlI+42MBS2BmRxGQKegzOmzXDxmXJaEt/rrhd0Ad/KzJc3ipVTvDLBaj7x n3y04yFb3o8g6ZY8w82pDoLhPk/lf5mMYW2AUV8ShebT8U8Xw9HTDfreWc6MR/KF9WYMVDiJkeBJ ugHtjJJ9zWA1YcmbfLIiESkK13UupgL/nVjDr83pKqAAV1C/LbdJldJ8xntHMcYfWXY/0ZGUgCz6 J0vyjCq2codJfJXroJbe3tWHWhaZBVomye7J//0XCxCMJn8bXo41UD1l14eTZ9+J4NUPiLLTxmKL KRxciOek6ii6SBLP4eECdy8Q8VZY22my9mmJfVrcFBg= 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 on an initiator system a LUN reset is issued while I/O is in progress with queue depth > 1, avoid that data corruption occurs as follows: - The initiator submits a READ (a). - The initiator submits a LUN reset before READ (a) completes. - The target responds that the LUN reset succeeded after READ (a) has been marked as CMD_T_COMPLETE and before .queue_status() has been called. - The initiator receives the LUN reset response and frees the tag used by READ (a). - The initiator submits READ (b) and reuses the tag of READ (a). - The initiator receives the response for READ (a) and interprets this as a completion for READ (b). - The initiator receives the completion for READ (b) and discards it. With the SRP initiator and target drivers and when running fio concurrently with sg_reset -d it only takes a few minutes to reproduce this. Signed-off-by: Bart Van Assche Fixes: commit febe562c20df ("target: Fix LUN_RESET active I/O handling for ACK_KREF") Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: --- drivers/target/target_core_tmr.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index 2750a2c7b563..6e419396c1e4 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c @@ -90,7 +90,7 @@ static int target_check_cdb_and_preempt(struct list_head *list, return 1; } -static bool __target_check_io_state(struct se_cmd *se_cmd, +static bool __target_check_io_state(struct se_cmd *se_cmd, u32 skip_flags, struct se_session *tmr_sess, int tas) { struct se_session *sess = se_cmd->se_sess; @@ -108,7 +108,7 @@ static bool __target_check_io_state(struct se_cmd *se_cmd, * long as se_cmd->cmd_kref is still active unless zero. */ spin_lock(&se_cmd->t_state_lock); - if (se_cmd->transport_state & (CMD_T_COMPLETE | CMD_T_FABRIC_STOP)) { + if (se_cmd->transport_state & (skip_flags | CMD_T_FABRIC_STOP)) { pr_debug("Attempted to abort io tag: %llu already complete or" " fabric stop, skipping\n", se_cmd->tag); spin_unlock(&se_cmd->t_state_lock); @@ -165,7 +165,8 @@ void core_tmr_abort_task( printk("ABORT_TASK: Found referenced %s task_tag: %llu\n", se_cmd->se_tfo->get_fabric_name(), ref_tag); - if (!__target_check_io_state(se_cmd, se_sess, 0)) + if (!__target_check_io_state(se_cmd, CMD_T_COMPLETE, se_sess, + 0)) continue; spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); @@ -349,7 +350,7 @@ static void core_tmr_drain_state_list( continue; spin_lock(&sess->sess_cmd_lock); - rc = __target_check_io_state(cmd, tmr_sess, tas); + rc = __target_check_io_state(cmd, 0, tmr_sess, tas); spin_unlock(&sess->sess_cmd_lock); if (!rc) continue; From patchwork Mon Sep 17 21:35:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10603481 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 9F6285A4 for ; Mon, 17 Sep 2018 22:01:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 933DE2A804 for ; Mon, 17 Sep 2018 22:01:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 870F12A851; Mon, 17 Sep 2018 22:01:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 014862A804 for ; Mon, 17 Sep 2018 22:01:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728582AbeIRDaM (ORCPT ); Mon, 17 Sep 2018 23:30:12 -0400 Received: from out002.mailprotect.be ([83.217.72.86]:53033 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727698AbeIRDaM (ORCPT ); Mon, 17 Sep 2018 23:30:12 -0400 X-Greylist: delayed 1490 seconds by postgrey-1.27 at vger.kernel.org; Mon, 17 Sep 2018 23:30:11 EDT 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=mpjh938bUwNZQwUhp2duNZBvS2pHSH4OMxMjc5rM8SY=; b=WAmQBcu9kxJD CkcKqvEpa/yOuEF4VlUhxBRLyFcCpw4LRdX0fpn1VLCqO7IV6KmZVTRHUKi7YH69X7ColMvCFi0Fa GpWULYK+6ey6lG/X+tVtnDBLTgPjXQAkAWIdoyZdMhiba4e8MqZhFE47RqMO1wqueuyNWJK54/wuf 9MKYjoey6LgLmbe3F4WuptkaN9qLap0JZ79NktYZ4ZSkM2Z3+v1+M4OZ2EghBLV9Nft0BjwXh4x5a /zBobhPM46xuSq2nnGbLaebo8ZjctTEQeoQYo54AuOvmoUti/Xw7IQvvbZu+dRIDjctmfEFhA+B13 aD0RYJ0XEMQv1BNeXo1EtQ==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1g21C9-0002k1-La; Mon, 17 Sep 2018 23:36:38 +0200 Received: from asus.hsd1.ca.comcast.net (c-174-62-111-89.hsd1.ca.comcast.net [174.62.111.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 0033FC0718; Mon, 17 Sep 2018 23:36:34 +0200 (CEST) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Himanshu Madhani , Quinn Tran , Nicholas Bellinger , Mike Christie , Hannes Reinecke Subject: [PATCH 14/17] target/qla2xxx: Simplify the code for handling aborted commands Date: Mon, 17 Sep 2018 14:35:51 -0700 Message-Id: <20180917213554.987-15-bvanassche@acm.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180917213554.987-1-bvanassche@acm.org> References: <20180917213554.987-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: EX5BVjFpneJeBchSMxfU5nAmT78rSLeu4M+xvsRf6St602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTarjontMPw7f3NqDIrNV7pphXnBH4p08Ft9j1x3N/nLOyf9 76Q8ME2y5t8SHn73bTVr9cki/cijgcjDudGXg1LvOfazYb+rZRy9j5buyuObExSA8kjykoxVeXIO Vdz6dyioNvuH3nkWxL720WI6OU276t4Cj2DeKQ8ek/hqJuy0LxTXjZFxr0jZe/JypqFN0y5AqSsi KknCB77qmgCwiSsgJ7CjLTdBOtRpl1zkoNWegatXFeEfzSagBNwnP2TibSPGN0ExaDjCWJE9qkQd cN59UgJfD4bYz/GQCCl4kh0/KXTFgIfDMShmlQFqCr5hA8xy+28pF/HE/UXip0YpvmqSgtBtsvjK 9mpXvZ581yfqNVA0hlu/NpOnaXNvrIp4mRGgQUA9iOUB9gXW15it62GvKaV7puimXuHjFEy4159w bwEyzRfGbE8wCAa/6a8qkRhRVDBpguHd2Lz1b+OLmJqHIKAmDK/3e0LrVxuItiXdEKrwWp752KLQ 41i9PLuPBg4KEgxQF7G4ajroXShVPl5sItIRrXZlz+x5FiFWc3U/6s9i6Cp0W99UEIBJTcXgWdPl gTl6fJxyntEfhZCKje4ZHniVSmUCsheQO6X6HmaTkrI0q854skGDr1SFWz9TrEZQLgVqEDmqiK0l c17lHF9hQdumSwX5R/88G6ikH5H4tYHVHhzxKltKX/MiaOmx+aXxYXZV7IIcbpaDH/GiU/Hyil7X mbvPqtn3ZUs8zFLZJ7h93vt70VDNfKA9uS3gblHK8lTxaMmH7lgoalhCs8Biro56EJ1hdSsu2wzH a4u51SMJkHPV65dcRBgf/KQMl0AIhOvRcVLFhnx3XZQZL7+iK582OZJyAnMYNm2kqfVM4+l+PmxJ CFvdxzgiQpciHL5SExdGbsJC7MlhFtW/e+P6R/MvjbxdatYzIrok54Pw0rdYfvMVhkojKSyfViOo T2khlHXXr2xkw2MCcR8/LqlugStYx12aCdmJgllbwzHk4r6jX0Is2t8eEL3ZqG06Zzq2j64UVzq4 LQ+CdMU6UAEjzDg6HYuTCyYgL61SIkBTYZdM7f/xrp24ZnU4njv1I+BTNmCylqzc+LDeC5QO2gQo Lz/dsiahQ1DFoGJGH4QvNFk+tnqwh8ck65CgmBGw7T+FW23ixm1lnD8tuNiaIwOmNh0GIh9D7pp1 2abOL5tbNw== 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 Since the target core waits anyway until a target driver has finished processing a command, remove similar waiting code from the tcm_qla2xxx driver. With this change applied command abortion works as follows: * tcm_qla2xxx receives an ABTS and calls target_submit_tmr(). * The target core calls core_tmr_abort_task(). That function sets the CMD_T_ABORTED flag and next calls transport_wait_for_tasks(). * If CMD_T_ACTIVE is still set, __transport_wait_for_tasks() sets CMD_T_STOP and waits for t_transport_stop_comp. * When tcm_qla2xxx_handle_data_work() gets called, it either invokes transport_generic_request_failure() or target_execute_cmd(). * Both functions start with calling __transport_check_aborted_status() and return 1 if CMD_T_ABORTED was set. Otherwise the command that is being executed is completed and target_complete_cmd() completes t_transport_stop_comp. * Once transport_wait_for_tasks() returns the target core considers the TMF as finished. Signed-off-by: Bart Van Assche Cc: Himanshu Madhani Cc: Quinn Tran Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke Acked-by: Himanshu Madhani --- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index e03d12a5f986..2cedfd4f15a3 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -414,21 +414,14 @@ static int tcm_qla2xxx_write_pending(struct se_cmd *se_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(). - */ + bool wp; + 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; - } + wp = se_cmd->t_state == TRANSPORT_WRITE_PENDING || + se_cmd->t_state == TRANSPORT_COMPLETE_QF_WP; spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); - return 0; + return wp; } static void tcm_qla2xxx_set_default_node_attrs(struct se_node_acl *nacl) @@ -508,15 +501,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 = From patchwork Mon Sep 17 21:35:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10603495 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 022AB1508 for ; Mon, 17 Sep 2018 22:19:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7CDF2A76F for ; Mon, 17 Sep 2018 22:19:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB2E12A77C; Mon, 17 Sep 2018 22:19: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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEF292A76F for ; Mon, 17 Sep 2018 22:19:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728478AbeIRDtH (ORCPT ); Mon, 17 Sep 2018 23:49:07 -0400 Received: from com-out001.mailprotect.be ([83.217.72.83]:42169 "EHLO com-out001.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728023AbeIRDtH (ORCPT ); Mon, 17 Sep 2018 23:49:07 -0400 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=b7oV3lSHji938sN7D6CJrY6KmgI/OCn7KlYxyfnb5lw=; b=qcpiooR8Wd7t LiWB51H0+D4UyTBzu4XRxYOcPgPLhYYwcbY2tFcCZ08ElBFH6InfatxIWiWtUupfOjPynp3Wm+BkT il9khqrAwOatLfjUKXccADT/a7CH30Vck97GSqDEwa2ySMCyweD7Jg9z1xuv8LmhgwpDV5UX7f8x3 X599pG+ssUek2phzCgnDh8LSDVrZZdpWKQfHtEkDDj4Tkw85ShlUYx230X+idIJnJqrsoqogIicVE 7pYvIUNmCz/jXKbp3QAph9vJ6StJGn5WXN7Sysxfs0dHLpANVg7HI+eFz0b41G1jgdtQR0D0T1Tca L5yTsRz0z1DUZbOxdl4uqQ==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out001.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1g21CC-000Atf-1V; Mon, 17 Sep 2018 23:36:40 +0200 Received: from asus.hsd1.ca.comcast.net (c-174-62-111-89.hsd1.ca.comcast.net [174.62.111.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 389AFC075C; Mon, 17 Sep 2018 23:36:37 +0200 (CEST) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Nicholas Bellinger , Mike Christie , Himanshu Madhani , Quinn Tran , Saurav Kashyap , "Michael S . Tsirkin" , Juergen Gross Subject: [PATCH 15/17] target/core: Remove the write_pending_status() callback function Date: Mon, 17 Sep 2018 14:35:52 -0700 Message-Id: <20180917213554.987-16-bvanassche@acm.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180917213554.987-1-bvanassche@acm.org> References: <20180917213554.987-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.00364448372481) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5qMg8xCI1yeqUsC9vKEFPyx602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfV5zK0ZCNvW/eM94SABF09Dni1LXu42mjsJeh2 EdTJgmT57it6l1XqkwCgA3kImXX8qZcqdYyLxw8AB+e+9ts3cCSiLEgEXPc+4Ns+RT3D0nCI7jOT v5BwDSvPJ2NYa8F11iK4chPQn4AfvFL+7Kn3KN0KqSZRqj6dWNW/FREnshwYh6JhrJ5CEOdqAIi0 BqE8lxfSECMOawLKD4hs6KWXa2rbjeM7LAWmGHHpG0hff96xyq2rnFf/lRGL5VUh4DmhdScroiOT n1+iIZ7zMwoBJmY8wNtv7/plTDhys0Cd8cES+oP/EiYZ3a6nk/+0gUvIU4IfTAERgKeuSl4l+HBG jvlh6JrwdFE3VeBUTJNYelfp37u5hJSACV5AK6O33N/CHw6B2C24kAdgswNWOvTqzjJaG7EM1yxs Ox3AieRK6IvGq2SbQLkS4VB2lHb58TPhGQQW9WgK2APejrjOpEYB2o42YyMXVyy5tv34/kB1CyOM G2TrPI0uYbltEzJRYsaY7qvJTeeEuPncACn4PYmZinXY4k41PGavVjtzW9FsPCGnF38z7Aq6s8ZG IzrQdDfjvCrJPmnnTHzVkpybMK7ZTSbFK9BEEGkEBFE0XhILzkVz8Ne0ck6P4ivKdWmRJx+gzapy s5++VegFBycN529HboMq2YcJoSMAND/ZyKWQbHIe1CfAftihRlEBnuSMdlqNaIfVaCHpEB6cFH6W JxE4ZkVv/HhCBka+foHd4yRSnL/wBIxP9SGQN+EkJQmGDdLLqftX44nn8x2Ms03oey/MORQPoGIt fo/ID+mTPr3hg0INNMeyQlcIUHBECjkdzAAMxR9X6xcp/n2uQUrHbeU8IYsEMysPur9wmiDBurOy 6iQiyUf6wX2RqLo3qci18B3OUiU4c0rZwfME1A5DGNVpyV7IMWUHCatsBk8rh8muZqHwEkRbOSMV TThFRDDTXtUuZuM7jUXIESohoO51xWmU8YNDW5j/aq+jP67L3jmyrIin3FRqvsl6wyWm5ZYRRmZH pcX0rHw4RcZC5nwQLEaYFBmok11u89pTKgJ27pjsIdKWWDADGa7Nas3yJeMpMlpPQTgP6AhJfgXn UXQCI5R61YalL4LoE8AgSzw+KJWjcRsT65dhYczOmRc78HD/E9azkm8JqMHHOm41e5VRt3j5DNmM Uk9LHOSKXNE4RHkYp04= 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. Signed-off-by: Bart Van Assche 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 --- 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 | 15 --------------- 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, 104 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 f37cbad022a2..015442c63209 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -2607,14 +2607,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). */ @@ -3691,7 +3683,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 fac377320158..7f9ee6272dc3 100644 --- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c @@ -3795,11 +3795,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) { } @@ -4061,7 +4056,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 2cedfd4f15a3..fc75f123b7ca 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -411,19 +411,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; - bool wp; - - spin_lock_irqsave(&se_cmd->t_state_lock, flags); - wp = se_cmd->t_state == TRANSPORT_WRITE_PENDING || - se_cmd->t_state == TRANSPORT_COMPLETE_QF_WP; - spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); - - return wp; -} - static void tcm_qla2xxx_set_default_node_attrs(struct se_node_acl *nacl) { return; @@ -1894,7 +1881,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, @@ -1936,7 +1922,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 95d0a22b2ad6..1ce137a43b86 100644 --- a/drivers/target/iscsi/iscsi_target_configfs.c +++ b/drivers/target/iscsi/iscsi_target_configfs.c @@ -1394,18 +1394,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); @@ -1569,7 +1557,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 bc8918f382e4..d71108abfc27 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -565,11 +565,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, @@ -1165,7 +1160,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 3d10189ecedc..fe13af057a55 100644 --- a/drivers/target/sbp/sbp_target.c +++ b/drivers/target/sbp/sbp_target.c @@ -1754,11 +1754,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; @@ -2335,7 +2330,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 f6b1549f4142..355b3ef292e9 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c @@ -395,10 +395,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 124495f953fa..e300a07d0e76 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c @@ -447,11 +447,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; @@ -468,7 +463,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 e55c4d537592..b32d5fc4a5ef 100644 --- a/drivers/target/tcm_fc/tfc_conf.c +++ b/drivers/target/tcm_fc/tfc_conf.c @@ -443,7 +443,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 106988a6661a..c8e4c840f88b 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -1297,14 +1297,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) { } @@ -1731,7 +1723,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 c24bb690680b..454323ba26ad 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -338,11 +338,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; @@ -2072,7 +2067,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 14a3d4cbc2a7..803d49679bbc 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) { } @@ -1824,7 +1819,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 792149993859..d1eb42c58ac4 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -64,7 +64,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 Mon Sep 17 21:35:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10603531 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 714B16CB for ; Mon, 17 Sep 2018 22:38:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 617A22A7EB for ; Mon, 17 Sep 2018 22:38:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5553E2A7F1; Mon, 17 Sep 2018 22:38: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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7DCF2A7EB for ; Mon, 17 Sep 2018 22:38:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727117AbeIREHw (ORCPT ); Tue, 18 Sep 2018 00:07:52 -0400 Received: from com-out001.mailprotect.be ([83.217.72.83]:37231 "EHLO com-out001.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725787AbeIREHw (ORCPT ); Tue, 18 Sep 2018 00:07:52 -0400 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=2Dech2EiYNfYqQkNshV1YQyZ/H2y3ErWE8zPdX62y7I=; b=nl5/nO4NCBpw PqBHIVKcnCXu77SH1XhI38oMQLd1VJ89kjkhsaiCzzdjdj2cNhZThFj/ZTuVd2Fbz8XbOBHbqlAwK 7Hm5fuJoAadMQtQFTk9u4rPltbAn2lB1mQcefPG4MpYpxdZuY0yssPsO6No7O1CuI4RkHBDXUHHmq e1cxUM9vIEPlqjBrt9l2o3JpufxNCasLUNe54LulyoMTIHH2UncZioUwGEtHGGM5rQhppf5p+mnWi tr/0yJt3pFiJ6TZmGs00iyjgYv4wNVC9tIiHDB7+b5CJNA7kPzoGqIFOhGdsQpg58Mf52Yevx/j/7 3qAR5+AsnNRpkREX00Oo7g==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out001.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1g21CD-000Atx-TX; Mon, 17 Sep 2018 23:36:42 +0200 Received: from asus.hsd1.ca.comcast.net (c-174-62-111-89.hsd1.ca.comcast.net [174.62.111.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 C53C6C0718; Mon, 17 Sep 2018 23:36:39 +0200 (CEST) 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/17] target/core: Remove several state tests from the TMF code Date: Mon, 17 Sep 2018 14:35:53 -0700 Message-Id: <20180917213554.987-17-bvanassche@acm.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180917213554.987-1-bvanassche@acm.org> References: <20180917213554.987-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: EX5BVjFpneJeBchSMxfU5iWsz/qi5OKnA8Rm4QTWRjt602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WlZa4xKvcBORT2AGmYYKfacHGRHPT1S45qX7/AQuG3+Xws3TRjaC42FtNJuTWwh7zLjlV5 cBkg2E15FOz6ftN7QyW5ej/DaM2khuDrsl5T/c902MBxp+G42GIBqokZAnJ5xBHkCMCjMposz65/ e+f6NiSg6RpPztwkEB6XvRg4fu70pheH5TNN6RiG9N0Jt+0ML5i3g2GFaGQnZ3KowlU8anvoc7s0 eHtsyrH7f4vWsxE/6wnSTdYMIbg1/h42t37X7D3r+yzaf09FesHDYiVh+mW6KLAhhg63cf8hhJ+u kSXGkMRHqahP8I2z5Z6Oaau3r5afqv7IHvnvd2pvgvBc+yIcNf9mmCdHYvplLFSG4KBSfNBRSHvO tj6BxxAeW8VFuiO6yCEAclVLBw8e/TPckDkXGJvniGivX1Fq/UQDdfRWNiJbKFZUCBFMj3aVfRTy mM4V+dYvw3zgaX5MC+SYhClGQqBaLo/4e5RWTejdpMF40MajfsURz8L4dmQLKmXZ4ciB+h1c4Cwq mt5tbitpDjKIx3H3dmYdnoX9+S6u9LeJtH1XOT4TpaoLD42JUzHUL1JgezUdWQ05VsGirfnatW1x D7NPHFVkxC5YVnU16UjwG05S+hO4GQ05Y/WP30Hdn+cousT5+gFGAcOaNJ6l53AchVbc0JpeNrhF rx64zcw4Oh2LkwsmIC+tUiJAU2GWfmVpiJkOE4Udd79N8qTYKIrHOcg1ChrH34fYzN6O7xxwEiTV JqDh0qKoKsXx5lnwVAtFIjOqBVBmDBo6d1b4QpW0dpxIo9d2WgcHzHNTu4W3OyTlA5uhTP73RN8y cSzpfj5sSQhb3cc4IkKXIhy+I6DM7/owTL8J95f1/+MXnOL6CZv+n8/wRksD+x9JjG1O+eyolGM4 l8rlxuGfhU+34hrNm42X2UZAYRVVEuFqpn0Wcxxec4eIhtK5Pi2eqhlDMrilbtDDvtO4rayUOwaR 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"). Signed-off-by: Bart Van Assche Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Cc: Hannes Reinecke --- 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 6e419396c1e4..7b22a62e4193 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, u32 skip_flags, 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 e76dace0ddb4..446cb458242f 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -2060,7 +2060,6 @@ void target_execute_cmd(struct se_cmd *cmd) } 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); @@ -2799,7 +2798,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 833567125905..afac85fd00e7 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -492,7 +492,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 Mon Sep 17 21:35:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10603487 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 E9ED71508 for ; Mon, 17 Sep 2018 22:19:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD3672A76B for ; Mon, 17 Sep 2018 22:19:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D18152A771; Mon, 17 Sep 2018 22:19:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 982842A76B for ; Mon, 17 Sep 2018 22:19:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728338AbeIRDsv (ORCPT ); Mon, 17 Sep 2018 23:48:51 -0400 Received: from com-out001.mailprotect.be ([83.217.72.83]:58273 "EHLO com-out001.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728023AbeIRDsu (ORCPT ); Mon, 17 Sep 2018 23:48:50 -0400 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=SfAxHagn49CXGG9rqjPlOkAsBPhGF3TmYGB0Eh1TZEI=; b=vddLeY/2GDXW zxpk2b6fwRUC9G0fUHe8MHONUPuZIDGzYL5c0iVufiSkGqw6seKgdJTwN7aclldH9jPyv2x8llx2B NMpKl3GL/cBwnOet4QDlgUbNH7JvqU8Vl4CsFVp6DUedegQkeg/gdlVd3Zd5zoHvtt1BKnRGoavMQ Rkl2jcONr05oCOclQqnhEUouUBKAukPzexl8785k0v3CT/7VSGjAZhVcL/7GCrjIaubdsLSWx2JFY 4/vtPcIkgQcIGPEAEnwCuDWRJQ/fPOFBrQ5mtYBHrrSzJz5TZPNetHNXTfsTHwLVJ3d7UlSp1X+ae xcIf0FsVfChHpPgJLtMHBg==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out001.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1g21CF-000Au7-JX; Mon, 17 Sep 2018 23:36:44 +0200 Received: from asus.hsd1.ca.comcast.net (c-174-62-111-89.hsd1.ca.comcast.net [174.62.111.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 ACBDBC075C; Mon, 17 Sep 2018 23:36:41 +0200 (CEST) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Nicholas Bellinger , Mike Christie Subject: [PATCH 17/17] target/core: Simplify the LUN RESET implementation Date: Mon, 17 Sep 2018 14:35:54 -0700 Message-Id: <20180917213554.987-18-bvanassche@acm.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180917213554.987-1-bvanassche@acm.org> References: <20180917213554.987-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: EX5BVjFpneJeBchSMxfU5nX6s5TYlwEIZSiRBOgAy8R602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3WuE/Tp4+l3BNO7LZ4AjfrIfCzdNGNoLjYW00m5NbCHvBqMcsqWKFCe7rdEeuBGsJYxXvzj IV2KzGocBcr3J6Nd+2dIiExwgKdlQnaZYUsGeBQ6V51u76v35b1wNe/MvdI2JKDpGk/O3CQQHpe9 GDh+6RtEyOTlr8s/KA4rPNjQVMztdQUSqk/AeLi65+4s/LrywTM2yEHEhvC9Izsy/NENfx9RXrVr 49ap5wWXhuSP55YIiHqfCgG4wrA3w4/kQTYKxDHA9JN9J4k4XZq11JQkdOHEEHFZXgEmmqOYHQ1J ISwdLe5BVNzi0bqETfj8uSNQef6Ceaw0tyEeHKZjklTreHL+whhAdKuW1jHRpItetrkwRG1Ozag+ aLypWu8oc+mQORcYm+eIaK9fUWr9RAN1zrBRbmp0eFAiJgYeu3yAkNQmV5Z+1S6WRsLXYNyKI5QB DLdZGhaGMngAFGniylMEqwf9bMTvxYH7osomSTjBYDRH07DPc71PJTVXI1+34gG6q1M80y9vWj2i mx08laHaJ595scsRO6bC+LWmd8u7xiqH7Y4POaW28MNCV3Ee0ga1bXEPs08cVWTELlhWdTXpOp0Y FgXIlZVUUW3bM2RbLqntKr6+crm+rffkaQ6ZgOiefSpVnKbpam6x/YW5cGxszDg6HYuTCyYgL61S IkBTYVRriXXIXx4lO2fz1pI1dgVpem2kOkD+LUPaGAhJcyNdHHASJNUmoOHSoqgqxfHmWXt6oCtK fTa/tHA9eCvHO2yDTbOcFigTu+v0psq1vYCIqUIsWXIoi6q1Q/z1kn6A3+l+PmxJCFvdxzgiQpci HL4orzY0475SioCnWKQvNuLmsXw4MOrC86Zbws/yHKkfE0757KiUYziXyuXG4Z+FT7fctuG6KQ7F UJu4bGno4HcWzTM+8NvWuEOaBFVKkIT35Qca9/LxmVk3n6Ce51Hb9nM= 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. Signed-off-by: Bart Van Assche Reviewed-by: Hannes Reinecke Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig --- 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 7b22a62e4193..909dc9847110 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, 0, 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); }