From patchwork Wed Feb 8 22:24:56 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: 9563673 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 8D5F36020F for ; Wed, 8 Feb 2017 22:28:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60D86284F2 for ; Wed, 8 Feb 2017 22:28:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5574D2852C; Wed, 8 Feb 2017 22:28:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9B2C284F2 for ; Wed, 8 Feb 2017 22:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751890AbdBHW1y (ORCPT ); Wed, 8 Feb 2017 17:27:54 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:63832 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751355AbdBHW1w (ORCPT ); Wed, 8 Feb 2017 17:27:52 -0500 X-IronPort-AV: E=Sophos;i="5.35,348,1483977600"; d="scan'208";a="76618169" Received: from unknown (HELO milsmgep15.sandisk.com) ([63.163.107.21]) by ob1.hgst.iphmx.com with ESMTP; 09 Feb 2017 06:28:20 +0800 Received: from MILHUBIP03.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 95.54.57638.ACA9B985; Wed, 8 Feb 2017 14:25:14 -0800 (PST) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.319.2; Wed, 8 Feb 2017 14:25:11 -0800 X-AuditID: 0ac94369-26dee9800001e126-f8-589b9acaaf1b Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 96.42.18148.7CA9B985; Wed, 8 Feb 2017 14:25:11 -0800 (PST) From: Bart Van Assche To: Bart Van Assche CC: , Christoph Hellwig , Andy Grover , David Disseldorp Subject: [PATCH v4 26/37] target: Simplify LUN RESET implementation Date: Wed, 8 Feb 2017 14:24:56 -0800 Message-ID: <20170208222507.25715-27-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170208222507.25715-1-bart.vanassche@sandisk.com> References: <20170208222507.25715-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKLMWRmVeSWpSXmKPExsXCddJ5ke6pWbMjDG7utLDYP+sZk8XX/9NZ LFauPspk0br0LZMDi8fumw1sHu/3XWXz2Hy62uPzJrkAligum5TUnMyy1CJ9uwSujM61rAVT eCpW/XdvYFzI1cXIySEhYCJxr28SaxcjF4eQwFImieenf7BDONsZJZZP2sYMU9W15y4bRGIj o8Su46fAEmwCRhLf3s9kAbFFBAwkfvdeYAQpYhboYJSY3/OMFSQhLOAs8e7HKzYQm0VARWLD lZ1gNq+Ag8TN11PYITbIS+xquwhWzwkUn/DyGSOILSRgL/HqwBewoRICbawSK9Z9YYRoFpQ4 OfMJ2GZmAQmJgy9eMEM0qEucXDKfaQKj0CwkZbOQlC1gZFrFKJabmVOcm55aYGiqV5yYl5JZ nK2XnJ+7iRES2Jk7GO8+8T7EKMDBqMTDW2E5O0KINbGsuDL3EKMEB7OSCG/KNKAQb0piZVVq UX58UWlOavEhRmkOFiVx3nMyUyOEBNITS1KzU1MLUotgskwcnFINjJyc2VZXWCp+3rhedrzk xqPWP1VddQscv36+7bmu61LmpjoDLZEnW6X+vfK79t27/2uaiXPiUc0XKrsXzDsSzaZ7dv+S qO2fXrS8FXNVPPVr+Y3yE6/lRLe9eSS6KeTMKtX4LTc8nbjD45t3azJNLehcJqf6/P0j0939 TywCC1m6fnnO57Vw4FJiKc5INNRiLipOBABf+JqOaAIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrCJMWRmVeSWpSXmKPExsXCtZGTTff4rNkRBnu7TS32z3rGZHHwZxuj xdf/01ksVq4+ymTRuvQtkwOrx+6bDWwe7/ddZfOYtuY8k8fm09UenzfJBbBGcdmkpOZklqUW 6dslcGV0rmUtmMJTseq/ewPjQq4uRk4OCQETia49d9m6GLk4hATWM0ocalzCBpJgEzCS+PZ+ JguILSJgIPG79wIjSBGzQBejxKYzp9hBEsICzhLvfrwCa2ARUJXY3NDBBGLzCjhITF13nx1i g7zErraLrCA2J1B8wstnjCC2kIC9xKsDXxgnMHIvYGRYxSiWm5lTnJueWWBopFecmJeSWZyt l5yfu4kREg5ROxivTzQ/xMjEwSnVwDjv9OJbgrK/P11h7/iXVHHgXoKmWW5hJredcbCK/+7O qUusVRzeSM/pf+5WMfGQZ8Dld59+7uUy970zYaJ21Z45C1bfCws9ulImhKWN+9jyzSpB31zC 43csv39OnWuW4lMeJc/U1gNmOSlKcZWqU7v/eW7X6k5KXv5qfsnt3ugLX0JCN9/jYVNiKc5I NNRiLipOBADl9Q7stwEAAA== MIME-Version: 1.0 Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Due to the 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: Christoph Hellwig Cc: Andy Grover Cc: David Disseldorp --- drivers/target/target_core_tmr.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index e4c8ebbcb20c..b31735c77621 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c @@ -227,22 +227,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)) { - spin_unlock(&cmd->t_state_lock); - spin_unlock(&sess->sess_cmd_lock); - continue; - } - cmd->transport_state |= CMD_T_ABORTED; - spin_unlock(&cmd->t_state_lock); + rc = __target_check_io_state(cmd, sess, 0); + spin_unlock(&sess->sess_cmd_lock); - rc = kref_get_unless_zero(&cmd->cmd_kref); if (!rc) { printk("LUN_RESET TMR: non-zero kref_get_unless_zero\n"); - spin_unlock(&sess->sess_cmd_lock); continue; } - spin_unlock(&sess->sess_cmd_lock); list_move_tail(&tmr_p->tmr_list, &drain_tmr_list); }