From patchwork Fri Jun 22 21:52:55 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: 10483107 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 283666023A for ; Fri, 22 Jun 2018 21:53:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16BF02903C for ; Fri, 22 Jun 2018 21:53:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B6E129044; Fri, 22 Jun 2018 21:53:16 +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 AF04B2903C for ; Fri, 22 Jun 2018 21:53:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754546AbeFVVxO (ORCPT ); Fri, 22 Jun 2018 17:53:14 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:20182 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754465AbeFVVxL (ORCPT ); Fri, 22 Jun 2018 17:53:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1529704418; x=1561240418; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=XVhAOIUKhwvjrqozfqFe9vJxdd3hDs7t3MM2O92vd24=; b=AJXA0BIduIJc6fxbqdugtuI7AQUrhoQzGFOE0eQf/Nuk7fcppKXgFq6Y gbahy6mvUxjwOQHO9l4nNHKn9hMGXC6ehYT09JGKaDy/bLIcLz0dvwkKk Mc2Eo6euNvbSu4NR7ui5t5BmlLbtu5Rk5rvTsyxZK8ZL3BTsO6SrR64S7 uA/Ohjo7cw1OtGQXxDQ+yGfhp77xDUBO88GqTtsO1G+y53z2YARagASP8 YZNg8AM7Y54QnxdH/Y11ML4tkIrAYQOL7s6FxXxzQ6cQw7Vri4xIDlUJn C14eq0WzsqeVaiiQk4xooyfW27b4ERpkERJQ3fRcjF2Ia8jh+feoeYCKz w==; X-IronPort-AV: E=Sophos;i="5.51,259,1526313600"; d="scan'208";a="178351000" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Jun 2018 05:53:34 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 22 Jun 2018 14:42:56 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com ([10.111.67.248]) by uls-op-cesaip01.wdc.com with ESMTP; 22 Jun 2018 14:53:10 -0700 From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Hannes Reinecke Subject: [PATCH 08/20] target: Simplify core_tmr_handle_tas_abort() Date: Fri, 22 Jun 2018 14:52:55 -0700 Message-Id: <20180622215307.8758-9-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180622215307.8758-1-bart.vanassche@wdc.com> References: <20180622215307.8758-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 Reviewed-by: Mike Christie Cc: Hannes Reinecke Cc: Christoph Hellwig --- 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,