From patchwork Thu Feb 2 00:58:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9550945 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0C4F260236 for ; Thu, 2 Feb 2017 00:59:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB4452845B for ; Thu, 2 Feb 2017 00:59:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E00602845F; Thu, 2 Feb 2017 00:59:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, 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 0C31F28456 for ; Thu, 2 Feb 2017 00:59:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751365AbdBBA7l (ORCPT ); Wed, 1 Feb 2017 19:59:41 -0500 Received: from mail-cys01nam02on0055.outbound.protection.outlook.com ([104.47.37.55]:1857 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751393AbdBBA7h (ORCPT ); Wed, 1 Feb 2017 19:59:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sandiskcorp.onmicrosoft.com; s=selector1-sandisk-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=XRFtq6JuagciQ8NujWeKR5+kLL/5QOEQj1qgPLXzGH4=; b=r+LTfI8o5tRWKVn95IwnkeA6t6ucx3P15KEMRMw29yTLTz8SZNDz/XWqhDh7++o76TySZxUhvmKONuq59tKGMVXeWm/IIFvH2bzfgJNa7s1tLUEOJBpD6ElrNWaZC6ab4BZUPSXJxqBAChP2RZKlPizMNDADPjjlIzJk/kd0ZQg= Received: from BN6PR02CA0059.namprd02.prod.outlook.com (10.175.94.149) by BLUPR02MB035.namprd02.prod.outlook.com (10.242.191.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.874.12; Thu, 2 Feb 2017 00:59:04 +0000 Received: from BL2FFO11FD029.protection.gbl (2a01:111:f400:7c09::122) by BN6PR02CA0059.outlook.office365.com (2603:10b6:404:f9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.874.12 via Frontend Transport; Thu, 2 Feb 2017 00:59:04 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.225) smtp.mailfrom=sandisk.com; lst.de; dkim=none (message not signed) header.d=none;lst.de; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.225 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.225; helo=milsmgep14.sandisk.com; Received: from milsmgep14.sandisk.com (63.163.107.225) by BL2FFO11FD029.mail.protection.outlook.com (10.173.160.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.874.2 via Frontend Transport; Thu, 2 Feb 2017 00:59:03 +0000 Received: from MILHUBIP04.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id 1B.BC.01420.E0282985; Wed, 1 Feb 2017 16:49:18 -0800 (PST) Received: from milsmgip11.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Wed, 1 Feb 2017 16:58:57 -0800 X-AuditID: 0ac94371-7ee9b9800001058c-a3-5892820e8a3a Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id A0.73.16817.15482985; Wed, 1 Feb 2017 16:58:57 -0800 (PST) From: Bart Van Assche To: Bart Van Assche CC: , Christoph Hellwig , "Sagi Grimberg" , Andy Grover Subject: [PATCH v2 20/36] target: Simplify session shutdown code Date: Wed, 1 Feb 2017 16:58:37 -0800 Message-ID: <20170202005853.23456-21-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170202005853.23456-1-bart.vanassche@sandisk.com> References: <20170202005853.23456-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKLMWRmVeSWpSXmKPExsXCddJ5kS5f06QIg/0vzSz2z3rGZLFy9VEm ixttD9gsWpe+ZXJg8dh9s4HN49n0w0we7/ddZfP4vEkugCWKyyYlNSezLLVI3y6BK+PyrE3s BXM9Kxr+PGNqYOyw62Lk5JAQMJFoer6XFcQWEljKJLH8uxyEvZ1RYt61TJia0/9uM3UxcgHF NzNK9C5rYwZJsAkYSXx7P5MFxBYRMJD43XuBEaSIWaCLUeLNsv1MIAlhAQeJ250LwWwWARWJ U+8OsIHYvEDx56susUBskJfY1XYR7ApOoPji4xBDhQTsJb79OQpV08Yqse0DE0SvoMTJmU/A 4swCEhIHX7xghqhXlzi5ZD7TBEahWUjKZiEpW8DItIpRLDczpzg3PbXA0ESvODEvJbM4Wy85 P3cTIySwC3cwvr7tfYhRgINRiYdXQGRShBBrYllxZe4hRgkOZiURXt9GoBBvSmJlVWpRfnxR aU5q8SFGaQ4WJXHe1tf9EUIC6YklqdmpqQWpRTBZJg5OqQbG7EVP/p908nzwqrL32QmBbtuM Gbdv85/+lFNV/+W9JIPaH6E/ogxbNpYKTOw8tnA90/x/m8UcNpxvNgjRN3/z6pPzlg1Sy09w ebUFT+PbqVLR/9rt1qSJB//90Dw8X7vsTcZrTX37rHiWNUkLq0KsSnM05jvvTH4dEPqyoCX+ 6aQLv124t0uaKrEUZyQaajEXFScCACwzyxxoAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGJMWRmVeSWpSXmKPExsXCtZEjRTewZVKEwbN2MYv9s54xWRz82cZo sXL1USaLG20P2Cxal75lcmD12H2zgc3j2fTDTB7v911l85i25jyTx+dNcgGsUVw2Kak5mWWp Rfp2CVwZl2dtYi+Y61nR8OcZUwNjh10XIyeHhICJxOl/t5m6GLk4hAQ2MkocaZrJBpJgEzCS +PZ+JguILSJgIPG79wIjiM0s0MMocXaPBogtLOAgcbtzIROIzSKgKnFz8wZmEJsXKL7zwl9W iAXyErvaLoLZnEDxxcchZgoJ2Et8+3OUZQIj9wJGhlWMYrmZOcW56ZkFhoZ6xYl5KZnF2XrJ +bmbGMEhwRm5g/HpRPNDjEwcnFINjOknzz29eKE+6nfovBi+WR0sD6xZWmKt0me5S2+pWq8l OqnVUWP7xZ1qhzt4z+3S2XFYmqW7SLjj7+1V1l863tcmbKpgD3izcsm3OTnbTu0MuLR4U4JS YuM+nTaxGsNTfCqa6m31BevPqpz9/Hrfl1XfxN80pu16deRzbcDnSQ3Gze7TPRcEzlRiKc5I NNRiLipOBAADhloMuQEAAA== MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.225; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(39410400002)(39850400002)(39450400003)(39840400002)(39860400002)(2980300002)(438002)(189002)(199003)(356003)(2906002)(33646002)(50466002)(92566002)(575784001)(48376002)(5003940100001)(38730400001)(8676002)(1076002)(8936002)(97736004)(47776003)(6200100001)(189998001)(50226002)(7049001)(81166006)(86362001)(81156014)(2950100002)(76176999)(305945005)(2270400002)(50986999)(110136003)(4326007)(77096006)(6862003)(626004)(1691005)(68736007)(106466001)(36756003)(69596002)(54906002)(6666003)(5660300001)(53936002)(6306002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR02MB035; H:milsmgep14.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD029; 1:x6lTr2y7DHt0I4MfiYPx84CrA9/YOt2ACreUxx8xUshrh63/kIEjN1iLD3jNabB7ItjSNJ5z/gpIGaadRLjzgq9OXnv0npggmZHyjLyKukcs7sy15cQvn7+1FQrBLQgVF0CGrMseb4bYPEDKO9Pc4iqm5lH/3AYBOKiz3E1JAfUiLDQYeMQLPDCocCTaLsozjFv0EU8x+/qnZSU6JPiqjNHLmMzob5EcdD2UTOEI8jmnzjgW4BEMZRvdX2uaL/n3IzqbtK+kLeMqG03BddHacvyvv3zS73VS6SY8tZAgqc3FI1xuut2nHG/7TVlKVDbOvgCcaRJRteC2QF+BcN4PTZncVAJh8pgE8ZHJDTIKtMofv/SGuC8GV9/12Uu2JDTfjXGIanUUG8fBnKFKmNs2rVOU4IFKmOy/6fnYKiv+tmn2Lj7IuIlX9EGkOoTkM7Z7xyOxfb4xzwSJHMEOR7sDwWkjgS/sBjZlpxUTCu7SziPdHRQ4FdX8JjXMJf4YZD//agwRiGQTtFX+SNzEv8oiig== X-MS-Office365-Filtering-Correlation-Id: 3ffc8571-dfa5-4ccc-ec30-08d44b06aeeb X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002); SRVR:BLUPR02MB035; X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB035; 3:YJZ8gRnffdb5CeHv4Ar1ebjtwMubUDs8uFTQ3tZi/JuKjw6Im2W3iU53DhhgGU0mDi8GnG5XVMey5ZQXG6XK9Gt4dKN42cDUgUIfQmeBBdtIhGuYoNP4h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D5o7/VMa2cNwoaKPWwPeAsxIu4GHAW67mGFyNQ9iN86QqfG6AKIgt3pohYzlu2cZxXoDQh34+EZGzauZzjBwRe+RCsDYAJeMPvygbUL7BWas7wtcvOv9T6MUVzvWFB6yGog= X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB035; 31:/JkldcRgJPf+VhRxt80PVpsB3ke2mtOO8Kos4TPsP6cFm45YG6bn2fmFBrbC0zB/jnJfxgEbngCJOln6ZFO2ajS5CNrZNQ70wwaxsJ2lXyxS7bv3yxYQd2oSoEMcBWOePFgd0x9qH2tTrZSWB9xnrR6QU3fhu5a93/0KJlEFjtIiYvR9pPbuNxlUdgQsq4LD+gQP1jX052uoSts//1frNLd+W1lZfN0B2o44Xe+RH+0fck/1kdLPZ9/9U5Kuo9xx7KwWirIzZdUtl58kj02TktFRg5zRbmifthSwjvDuvC8=; 20:Eh32TaGh1kI5DAatx9NAVRjsJRld49krlyImY/sFgoF7XeLTIWdEBYsyTuyYEIipfkuZk52w515OARdNmHUZ5rRiS+A/Oc7vfbMlBallFXrj8+4wPhcN7evsuYWZL4HeHzfgP/Vt8D3AM7Y1Tqlsl9QYauJaYmjQoWj+m3pdEGE4NFT5f+Rf00Ofvag01O+CA4flE8pLLc53eRPc1Lm/hNnzUSK4KlIobvpqThurZq5LB6qzWQoURAXUTzJRkgn6ppf0+ZkphQiCPawvvOrP8h7p1yDoSaBAIMzT/8SuFO+225w9+Er2q7FidGYBKLcnCfzM8LTWKvf/0/42N8qNUD/ABo1DR81eA1Ah9SfuzmT26xwTEgUCMAX1Rgr2iILiLbrAWPn9jn1Ga/OfQi5NF+ChDFw/NN+ikHkRDTOpCSpwN6ADMmXUutG9ywddwK8n5bUqi6cVvcGoNfpjPgzG0z0T8hVTuSbohffXUhC2b1NyvYf5xxsvWugKqcIlUmn+ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(166708455590820)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(13018025)(5005006)(8121501046)(13016025)(10201501046)(3002001)(6055026)(6041248)(20161123558025)(20161123562025)(20161123555025)(20161123560025)(20161123564025)(6072148); SRVR:BLUPR02MB035; BCL:0; PCL:0; RULEID:; SRVR:BLUPR02MB035; X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB035; 4:Y/wEQRd4LNd20LorvndpPlrNG83cvLClf+WtX+qDAHY6R+n8hdRq8XUUAeV553BRHUVtcYXu0jNtsnf8WGObIcBARwI/ZLIFJICy2urFfV4l5Sg26rEW7vdB00rUuqguwIkAEsxF7F0OEJMvOp79nghR/i6XpcA8EvzwFUfZbAl8Ir78spQXdwUe8xvjDQhE8aWXEldgn9r3s4IGb4SQ8ut3tfPOFPs9USsYDkmvYhohf9Lv0SKVOQx7X7EZbQ5TUsmSCV1j5PodbPAm7MBi+G6ZS6ni3LkIsiv+fK7awXGhcdV7SeQJ1pu3Nh26GrJ2LK71OYWCCfvh2KJuisyLIcvPq5RUBMl6ywX7YCWiMcoQkaYLDLwi6S3xc/VcSFYJ8DTFRWJTIEwee/OWAWIJCL1LV+wag154vGpH/GsR1PRSv3iH5Uz7lVYXLySyfgYaQnsdxPMs/VgWwq151MhHKxCYjp4jLODVUBlauqSVxmctVURYbWV9FLuKaLabRfj6XB7rI9A1OK4zMjp1ucw6w2feZHo4Eh+8PZxqqw8l+ecbJms+keZ+rjoOdodReCLFOOYZ4oLYlNQHXdQEFFOUZMMwCBDfVkGk3nFOphAMJssUqbBh7G9z01gqFiAunLuAuL7P4hzl1Z5qGUOcy3wi/wAYzBYQfebXYCGdFtPIyMkU83/YOvbq5e8xOqeW1F10UG7vCC5u/Vwinvd9dXpzh2dTdc+zZiEsfCRqf5ufDYGcar7pABVBtz6XZmr1JyIS X-Forefront-PRVS: 02065A9E77 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR02MB035; 23:g3/8/JjK6prgyjzZKK9LKjPHnXPf2oope18LkbOerC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ragtVxnk999X3+tQQjxf2C3risie4A8776vf5Ay0=; 24:9BXb9T3Mq0yeyCAqlFS2mCg7+PhKA7MqOkdNbPgOOdc7udKd7NbFAmzzD6w117lsUdDYLn6Cr1lJIIsFZaGqKUbLzCY8P5kVqo6Cd7YYY8g= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB035; 7:Gbfdg+Gl7IqdkKYWP4GMhGsfflYErUHHYl+W9XI8j0pUT50vla5TLuerMXvnJWA668tyOYDOY0IM+0RHQlv62f0QdLNzXUiS55sYCAl/0hmLaXjpLpPyK9dWRjU2g2RNP6CEmMZoAX5mYrxviu9UcQVtQLuAqshJxabG3K9XG4jnGyR7bdONVzYMbkEq0TVqELAHid4sMow1NKLLVOwSoc/c31xvv4BamdofxUPR0U51Mw+pGqSstL66ly65TQqxnO2zOfGXLUMe5N7Mj5pi3tzr1BhwoQ8YkGN0W0Ai14e2AYqYEoY+7PNB+9OLdhANPitxxo03foxQY33gE+EE7s4dmShHiOuyn1e3HPuzCXQWtV4ECyeR/t//+dPMlk01N2kZvy05Q6MK29cm3qhHzXWI0NMsDMMan7FQJ5HR4RqmLANBLHVh2Blqa2YCc+c5RACrUP0THvzDUa3bPsAaT3j0bCLMYmIKIu2lUrthNmELEQaljQtHVEqsrKYIT19gsZLK81WAmwT+QCeKc0hFPoyMG/vECUiuGc6ex6gfxqPmB42Ixc2yoFCl7Ojq9W5S X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2017 00:59:03.8142 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d; Ip=[63.163.107.225]; Helo=[milsmgep14.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR02MB035 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 Target drivers must call target_sess_cmd_list_set_waiting() and target_wait_for_sess_cmds() before freeing a session. Instead of setting a flag in each pending command from the former function and waiting in the latter function on a per-command completion, only set a per-session flag in the former function and wait on a per-session completion in the latter function. Note: this patch changes the behavior from aborting outstanding commands back to waiting for command completion. See also commit 0f4a943168f3 ("target: Fix remote-port TMR ABORT + se_cmd fabric stop"). This patch is based on the following two patches: * Bart Van Assche, target: Simplify session shutdown code, February 19, 2015 (https://github.com/bvanassche/linux/commit/8df5463d7d7619f2f1b70cfe5172eaef0aa52815). * Christoph Hellwig, target: Rework session shutdown code, December 7, 2015 (http://thread.gmane.org/gmane.linux.scsi.target.devel/10695). Signed-off-by: Bart Van Assche Reviewed-by: Hannes Reinecke Cc: Christoph Hellwig Cc: Sagi Grimberg Cc: Andy Grover Reviewed-by: Christoph Hellwig --- drivers/target/target_core_tmr.c | 4 +- drivers/target/target_core_transport.c | 106 ++++++++------------------------- include/target/target_core_base.h | 4 +- 3 files changed, 29 insertions(+), 85 deletions(-) diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index bc07e059fb22..95f8e7d0cf46 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c @@ -114,7 +114,7 @@ static bool __target_check_io_state(struct se_cmd *se_cmd, spin_unlock(&se_cmd->t_state_lock); return false; } - if (sess->sess_tearing_down || se_cmd->cmd_wait_set) { + 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); @@ -247,7 +247,7 @@ static void core_tmr_drain_tmr_list( spin_unlock(&sess->sess_cmd_lock); continue; } - if (sess->sess_tearing_down || cmd->cmd_wait_set) { + if (sess->sess_tearing_down) { spin_unlock(&cmd->t_state_lock); spin_unlock(&sess->sess_cmd_lock); continue; diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 8506ecc0d6c0..82930960e722 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -237,8 +237,8 @@ struct se_session *transport_init_session(enum target_prot_op sup_prot_ops) INIT_LIST_HEAD(&se_sess->sess_list); INIT_LIST_HEAD(&se_sess->sess_acl_list); INIT_LIST_HEAD(&se_sess->sess_cmd_list); - INIT_LIST_HEAD(&se_sess->sess_wait_list); spin_lock_init(&se_sess->sess_cmd_lock); + init_waitqueue_head(&se_sess->cmd_list_wq); se_sess->sup_prot_ops = sup_prot_ops; return se_sess; @@ -1237,7 +1237,6 @@ 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); - init_completion(&cmd->cmd_wait_comp); init_completion(&cmd->finished); spin_lock_init(&cmd->t_state_lock); kref_init(&cmd->cmd_kref); @@ -2538,16 +2537,6 @@ int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) if (cmd->se_lun) transport_lun_remove_cmd(cmd); } - /* - * If the task has been internally aborted due to TMR ABORT_TASK - * or LUN_RESET, target_core_tmr.c is responsible for performing - * the remaining calls to target_put_sess_cmd(), and not the - * callers of this function. - */ - if (aborted) { - pr_debug("Detected CMD_T_ABORTED for ITT: %llu\n", cmd->tag); - wait_for_completion(&cmd->cmd_wait_comp); - } return transport_put_cmd(cmd); } EXPORT_SYMBOL(transport_generic_free_cmd); @@ -2605,25 +2594,15 @@ 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; unsigned long flags; - bool fabric_stop; complete_all(&se_cmd->finished); spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); - - spin_lock(&se_cmd->t_state_lock); - fabric_stop = (se_cmd->transport_state & CMD_T_FABRIC_STOP) && - (se_cmd->transport_state & CMD_T_ABORTED); - spin_unlock(&se_cmd->t_state_lock); - - if (se_cmd->cmd_wait_set || fabric_stop) { - list_del_init(&se_cmd->se_cmd_list); - spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); - target_free_cmd_mem(se_cmd); - complete(&se_cmd->cmd_wait_comp); - return; + if (likely(!list_empty(&se_cmd->se_cmd_list))) { + list_del(&se_cmd->se_cmd_list); + if (list_empty(&se_sess->sess_cmd_list)) + wake_up(&se_sess->cmd_list_wq); } - list_del_init(&se_cmd->se_cmd_list); spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); target_free_cmd_mem(se_cmd); @@ -2646,77 +2625,44 @@ int target_put_sess_cmd(struct se_cmd *se_cmd) } EXPORT_SYMBOL(target_put_sess_cmd); -/* target_sess_cmd_list_set_waiting - Flag all commands in - * sess_cmd_list to complete cmd_wait_comp. Set - * sess_tearing_down so no more commands are queued. +/** + * target_sess_cmd_list_set_waiting - Prevent new commands to be queued * @se_sess: session to flag */ void target_sess_cmd_list_set_waiting(struct se_session *se_sess) { - struct se_cmd *se_cmd, *tmp_cmd; unsigned long flags; - int rc; spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); - if (se_sess->sess_tearing_down) { - spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); - return; - } se_sess->sess_tearing_down = 1; - list_splice_init(&se_sess->sess_cmd_list, &se_sess->sess_wait_list); - - list_for_each_entry_safe(se_cmd, tmp_cmd, - &se_sess->sess_wait_list, se_cmd_list) { - rc = kref_get_unless_zero(&se_cmd->cmd_kref); - if (rc) { - se_cmd->cmd_wait_set = 1; - spin_lock(&se_cmd->t_state_lock); - se_cmd->transport_state |= CMD_T_FABRIC_STOP; - spin_unlock(&se_cmd->t_state_lock); - } else - list_del_init(&se_cmd->se_cmd_list); - } - spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); } EXPORT_SYMBOL(target_sess_cmd_list_set_waiting); -/* target_wait_for_sess_cmds - Wait for outstanding descriptors +/** + * target_wait_for_sess_cmds - Wait for outstanding commands * @se_sess: session to wait for active I/O */ void target_wait_for_sess_cmds(struct se_session *se_sess) { - struct se_cmd *se_cmd, *tmp_cmd; - unsigned long flags; - bool tas; - - list_for_each_entry_safe(se_cmd, tmp_cmd, - &se_sess->sess_wait_list, se_cmd_list) { - pr_debug("Waiting for se_cmd: %p t_state: %d, fabric state:" - " %d\n", se_cmd, se_cmd->t_state, - se_cmd->se_tfo->get_cmd_state(se_cmd)); - - spin_lock_irqsave(&se_cmd->t_state_lock, flags); - tas = (se_cmd->transport_state & CMD_T_TAS); - spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); - - if (!target_put_sess_cmd(se_cmd)) { - if (tas) - target_put_sess_cmd(se_cmd); - } - - wait_for_completion(&se_cmd->cmd_wait_comp); - pr_debug("After cmd_wait_comp: se_cmd: %p t_state: %d" - " fabric state: %d\n", se_cmd, se_cmd->t_state, - se_cmd->se_tfo->get_cmd_state(se_cmd)); - - target_put_sess_cmd(se_cmd); - } - - spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); - WARN_ON(!list_empty(&se_sess->sess_cmd_list)); - spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); + struct se_cmd *cmd; + int ret; + 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); + list_for_each_entry(cmd, &se_sess->sess_cmd_list, se_cmd_list) + pr_debug("%s: ITT %#llx dir %d i_state %d t_state %d len %d\n", + __func__, cmd->tag, cmd->data_direction, + cmd->se_tfo->get_cmd_state(cmd), cmd->t_state, + cmd->data_length); + } 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 e690ce36e592..d6d4465b1694 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -441,7 +441,6 @@ struct se_cmd { u8 scsi_asc; u8 scsi_ascq; u16 scsi_sense_length; - unsigned cmd_wait_set:1; unsigned unknown_data_length:1; bool state_active:1; bool send_abort_response:1; @@ -474,7 +473,6 @@ struct se_cmd { struct se_session *se_sess; struct se_tmr_req *se_tmr_req; struct list_head se_cmd_list; - struct completion cmd_wait_comp; 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 *); @@ -605,8 +603,8 @@ struct se_session { struct list_head sess_list; struct list_head sess_acl_list; struct list_head sess_cmd_list; - struct list_head sess_wait_list; spinlock_t sess_cmd_lock; + wait_queue_head_t cmd_list_wq; void *sess_cmd_map; struct percpu_ida sess_tag_pool; struct workqueue_struct *tmf_wq;