From patchwork Wed Dec 13 23:50:24 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: 10111185 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 16960603ED for ; Wed, 13 Dec 2017 23:50:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0728229677 for ; Wed, 13 Dec 2017 23:50:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F046029755; Wed, 13 Dec 2017 23:50:38 +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 83A8729677 for ; Wed, 13 Dec 2017 23:50:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751326AbdLMXuf (ORCPT ); Wed, 13 Dec 2017 18:50:35 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:25093 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751098AbdLMXud (ORCPT ); Wed, 13 Dec 2017 18:50:33 -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=1513209033; x=1544745033; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=AinSRBZTlEEn2tRCJ3AdjJaVrvjL0iV9wr0+9ozB0GQ=; b=mknBq4vtxjXYU2pgj7C/Tt8tA3TSpMEpObjkm/noJN46jgOxq+eiZT4j SMw058lSwA77BDn8y8ESrq308/urah3WDauIacv3nXnd6l47Ya3Jb0Lmo seGNTvAIBh1AgsXtKEpGH1DLt3y8dnQFIJ07fbv8OU8vahA+loijKLbWO Rj9jsEsqcpzYjD8/t899PIL6u5XI51m0R4lEI7EFusyXQ+tg24sTo/Ihm EcjQWhQ5ggpXm6d4d4EC+H6RxMZmattKmZFSUiqkiRmm/XpEqWmmmfgg/ nEr+KldYMONNSS16iCzGic7ZfIlLRwGQVjr7uVhttqCCTQHJMaCl5xPL6 Q==; X-IronPort-AV: E=Sophos;i="5.45,398,1508774400"; d="scan'208";a="65384147" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 14 Dec 2017 07:50:31 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 13 Dec 2017 15:46:55 -0800 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.166.51]) by uls-op-cesaip02.wdc.com with ESMTP; 13 Dec 2017 15:50:32 -0800 From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: Nicholas Bellinger , Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Hannes Reinecke , Mike Christie Subject: [PATCH 06/11] target: Simplify core_tmr_handle_tas_abort() Date: Wed, 13 Dec 2017 15:50:24 -0800 Message-Id: <20171213235029.581-7-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171213235029.581-1-bart.vanassche@wdc.com> References: <20171213235029.581-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: Nicholas Bellinger Cc: Christoph Hellwig Cc: Hannes Reinecke 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,