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-Ev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kn6A3+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); }