From patchwork Fri Jan 25 18:34:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10781873 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AA8A114E5 for ; Fri, 25 Jan 2019 18:35:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98A9F299B5 for ; Fri, 25 Jan 2019 18:35:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C2542D40C; Fri, 25 Jan 2019 18:35:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2EACE299B5 for ; Fri, 25 Jan 2019 18:35:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726604AbfAYSfb (ORCPT ); Fri, 25 Jan 2019 13:35:31 -0500 Received: from out002.mailprotect.be ([83.217.72.86]:43605 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726321AbfAYSfb (ORCPT ); Fri, 25 Jan 2019 13:35:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=Il7rlzKGIu1QfH9ZOzRTRWx/BBWreaGPv7XIAOCosfk=; b=Rmpi5BqeEDTg /ImID84J+KD2U9f3sLntjZ+o8YHp3Ge0c6o+A7+n6SNy7fPq4iMgg6wVTzwcktXFzp7P2+GywCJkR 8Ja03+jN5kz6SdriLbYjduA08T4+myXlLYHwpo8+GxOvah65O26eTZWRPq6yd4MaG2RP6z4CXWr9R Y8QMcc/Tu3LP1wl3rtYmO3S648D0qF+orwFSoMo9lxHxWvx0O1NbmDHpHDC+VMOztt2d3Iqgva2hH Gvx5DNl14/6Ff0SRPU7vqCMUks//mXF4DekdaP52odXXntzLy8EaxlW0nFbMsrBVzRPLPZl4QCYiY utxXGcaTFlPdlZS3Im9+qw==; Received: from smtp-auth.mailprotect.be ([178.208.39.155]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gn6Jx-00040S-7J; Fri, 25 Jan 2019 19:35:17 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id ED36FC0E49; Fri, 25 Jan 2019 19:35:12 +0100 (CET) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Hannes Reinecke , Nicholas Bellinger , Mike Christie Subject: [PATCH 03/16] target/core: Simplify the LUN RESET implementation Date: Fri, 25 Jan 2019 10:34:45 -0800 Message-Id: <20190125183458.220477-4-bvanassche@acm.org> X-Mailer: git-send-email 2.20.1.495.gaa96b0ce6b-goog In-Reply-To: <20190125183458.220477-1-bvanassche@acm.org> References: <20190125183458.220477-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.155 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts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w7iiUjw9pZ+zXcnX6m+UeFXprlCOm3BAEb JtCUfKAc5tuMY57sizcN8Ybgo6ZwKd/lAfDURVeqOwDGeVPxhaTP1H+ecpe65ERyZY5hD/iWD0V+ +qD0gbQQTy2MYhai3vEoMrcP3ydYA96eq2KM8TNRPi4PtNSv3zAgl6Rv/trjt4n+OSd+6+F6OunJ 9jihx+Za/cV70jOJzN2r4A== X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Due to the task management handling rework it is safe to wait for a TMF that is not in the active state. Hence remove the CMD_T_ACTIVE test from core_tmr_drain_tmr_list(). Additionally, call __target_check_io_state() instead of open coding it. Reviewed-by: Hannes Reinecke Cc: Nicholas Bellinger Cc: Mike Christie Cc: Christoph Hellwig Signed-off-by: Bart Van Assche --- drivers/target/target_core_tmr.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index df1ca827de68..3a1bb799a9ab 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c @@ -217,23 +217,13 @@ static void core_tmr_drain_tmr_list( continue; spin_lock(&sess->sess_cmd_lock); - spin_lock(&cmd->t_state_lock); - if (!(cmd->transport_state & CMD_T_ACTIVE) || - (cmd->transport_state & CMD_T_FABRIC_STOP)) { - spin_unlock(&cmd->t_state_lock); - spin_unlock(&sess->sess_cmd_lock); - continue; - } - cmd->transport_state |= CMD_T_ABORTED; - spin_unlock(&cmd->t_state_lock); + rc = __target_check_io_state(cmd, sess, 0); + spin_unlock(&sess->sess_cmd_lock); - rc = kref_get_unless_zero(&cmd->cmd_kref); if (!rc) { printk("LUN_RESET TMR: non-zero kref_get_unless_zero\n"); - spin_unlock(&sess->sess_cmd_lock); continue; } - spin_unlock(&sess->sess_cmd_lock); list_move_tail(&tmr_p->tmr_list, &drain_tmr_list); }