From patchwork Thu Mar 1 22:26:24 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: 10252747 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 8A7C760365 for ; Thu, 1 Mar 2018 22:26:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B2E827816 for ; Thu, 1 Mar 2018 22:26:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 70171286A9; Thu, 1 Mar 2018 22:26:41 +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 1CC3927816 for ; Thu, 1 Mar 2018 22:26:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162569AbeCAW0k (ORCPT ); Thu, 1 Mar 2018 17:26:40 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:7150 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162557AbeCAW0g (ORCPT ); Thu, 1 Mar 2018 17:26:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1519943197; x=1551479197; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=y8U3EvgD5rB92Rz0URti+TMyPHDWYsDQuP21nGacL7E=; b=FAxtbDfyhajT1nf313bdWGzrU/Qs+a1R7UrEYG8zqMWeCWtpp9GKZsxZ i7i1lXnx001DepU8m9CxYQO8PRzbK71farzg3Hvfnt8op38/9DS3MdwwL PzK93b8MjVAc8G0O+/UkUgfGt5rMXMe2D5Ktoyz5bHQB/SsduWpwn/x2c PhmPLMBcEKZonUCFLU7BENK5otKgiacxbaJa3h9zeZKKQN/whTZv9RVgB 0UYJjJQK9pZkcKqb0lzYBUP61MtuhO4mQBTwg5/MKGR0A91PRaJ+tWi7Y 7ZQZW2jRR35c9cU2zneV6df335G/A6dnitwFSlmSSUlUaQy9Vugt+aTXe w==; X-IronPort-AV: E=Sophos;i="5.47,409,1515427200"; d="scan'208";a="72564594" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 02 Mar 2018 06:26:34 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 01 Mar 2018 14:20:38 -0800 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.171.236]) by uls-op-cesaip01.wdc.com with ESMTP; 01 Mar 2018 14:26:34 -0800 From: Bart Van Assche To: Nicholas Bellinger Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Hannes Reinecke , Mike Christie Subject: [PATCH 06/14] target: Simplify core_tmr_handle_tas_abort() Date: Thu, 1 Mar 2018 14:26:24 -0800 Message-Id: <20180301222632.31507-7-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180301222632.31507-1-bart.vanassche@wdc.com> References: <20180301222632.31507-1-bart.vanassche@wdc.com> 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 code that can set CMD_T_TAS is executed by the same thread as the thread that executes core_tmr_handle_tas_abort(). That means that no locking is needed to check CMD_T_TAS from inside core_tmr_handle_tas_abort(). This patch does not change any functionality. Signed-off-by: Bart Van Assche Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: Mike Christie --- drivers/target/target_core_tmr.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index da8125dd3a4c..08af053e7990 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c @@ -77,21 +77,12 @@ void core_tmr_release_req(struct se_tmr_req *tmr) static int core_tmr_handle_tas_abort(struct se_cmd *cmd, int tas) { - unsigned long flags; - bool remove = true, send_tas; - /* - * TASK ABORTED status (TAS) bit support - */ - spin_lock_irqsave(&cmd->t_state_lock, flags); - send_tas = (cmd->transport_state & CMD_T_TAS); - spin_unlock_irqrestore(&cmd->t_state_lock, flags); + bool send_tas = cmd->transport_state & CMD_T_TAS; - if (send_tas) { - remove = false; + if (send_tas) transport_send_task_abort(cmd); - } - return transport_cmd_finish_abort(cmd, remove); + return transport_cmd_finish_abort(cmd, !send_tas); } static int target_check_cdb_and_preempt(struct list_head *list,