From patchwork Wed Feb 15 00:26:05 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: 9573097 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 C8C296045F for ; Wed, 15 Feb 2017 00:26:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCB34283F4 for ; Wed, 15 Feb 2017 00:26:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B19AD2842E; Wed, 15 Feb 2017 00:26:54 +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.9 required=2.0 tests=BAYES_00,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 4C7142842B for ; Wed, 15 Feb 2017 00:26:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751451AbdBOA0x (ORCPT ); Tue, 14 Feb 2017 19:26:53 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:61609 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750902AbdBOA0w (ORCPT ); Tue, 14 Feb 2017 19:26:52 -0500 X-IronPort-AV: E=Sophos;i="5.33,348,1477929600"; d="scan'208";a="86867898" Received: from unknown (HELO milsmgep15.sandisk.com) ([63.163.107.21]) by ob1.hgst.iphmx.com with ESMTP; 15 Feb 2017 08:26:21 +0800 Received: from MILHUBIP04.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id BD.E4.57638.D20A3A85; Tue, 14 Feb 2017 16:26:21 -0800 (PST) Received: from milsmgip11.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Tue, 14 Feb 2017 16:26:16 -0800 X-AuditID: 0ac94369-26dee9800001e126-7a-58a3a02d20a9 Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id D1.8D.11415.720A3A85; Tue, 14 Feb 2017 16:26:15 -0800 (PST) From: Bart Van Assche To: "Nicholas A . Bellinger" CC: , Bart Van Assche , Christoph Hellwig , Andy Grover , David Disseldorp Subject: [PATCH v6 26/33] target: Simplify LUN RESET implementation Date: Tue, 14 Feb 2017 16:26:05 -0800 Message-ID: <20170215002612.14566-27-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170215002612.14566-1-bart.vanassche@sandisk.com> References: <20170215002612.14566-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrALMWRmVeSWpSXmKPExsXCddJ5ka7ugsURBsdPWVjsn/WMyeLr/+ks FitXH2WyaFt9htGidelbJgdWj/vbjzB57L7ZwObxft9VNo/Np6s9Pm+SC2CN4rJJSc3JLEst 0rdL4Mo49mMLa8F5nopNa+8zNTCe5+pi5OSQEDCRmHm/mb2LkYtDSGApk8SD7RNZIJwdjBKt 536zwVSd39XGCpHYyCjRtvoCK0iCTcBI4tv7mSwgtgiQvbpnGRNIETNI98SVu9lBEsICzhJP ti1mBrFZBFQlut68YgSxeQUcJFYeX8gCsUFeYlfbRbChnEDxGTtOAsU5gLbZSzw6Yw0yU0Jg EqvEgncnWSB6BSVOznwCZjMLSEgcfPECbL6QgLrEySXzmSYwCs1CUjYLSdkCRqZVjGK5mTnF uempBYamesWJeSmZxdl6yfm5mxgh4Z65g/HuE+9DjAIcjEo8vCdkF0cIsSaWFVfmHmKU4GBW EuFlqwcK8aYkVlalFuXHF5XmpBYfYpTmYFES5z0nMzVCSCA9sSQ1OzW1ILUIJsvEwSnVwJgg H+C689UUxz3nde5zL/rYp1rZt+bzV6m/2Xb7XD1yolZUSGU+/P1e5+DtutPfrA0TpnqE7H1r d0Gc/yrDtHdMQd8Wv+K/+iLZLCP1nQNDf7/nTLeImu239sg4R3Bvi9fr3nym8XHrEadTLNul 3PK/tX5k/bbN8XrirkBmLeFv7NYzGKseWSuxFGckGmoxFxUnAgCj+F91cwIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrPJMWRmVeSWpSXmKPExsXCtZGTTVd9weIIg/8P9S32z3rGZHHwZxuj xdf/01ksVq4+ymTRtvoMo0Xr0rdMDmwe97cfYfLYfbOBzeP9vqtsHtPWnGfy2Hy62uPzJrkA tigum5TUnMyy1CJ9uwSujGM/trAWnOep2LT2PlMD43muLkZODgkBE4nzu9pYuxi5OIQE1jNK /H12iwUkwSZgJPHt/UwwWwTIXt2zjAmkiFlgF6PE5AknwBLCAs4ST7YtZgaxWQRUJbrevGIE sXkFHCQ+POphh9ggL7Gr7SIriM0JFJ+x4yRQLwfQNnuJR2esJzByL2BkWMUolpuZU5ybnllg aKhXnJiXklmcrZecn7uJERIkkTsYn040P8TIxMEp1cC40NCnxPyziIRJ8Ns2hjecHU81Jk6/ vq33oYDa/V080z/wzt7utSzYY4pSVd+h9ZbX17utWXMuu2n+88y/zGneXpNNu85mtnkeVnoz kTeIpdm4fMvOrnRjg7nxMYYCXoqqRn8tOg73mIreW/ropElp7OvZszKzvs83NUtfq9csuipg pmaOUawSS3FGoqEWc1FxIgDTIXGlwgEAAA== MIME-Version: 1.0 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: Christoph Hellwig Cc: Andy Grover Cc: David Disseldorp --- 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 bd5ada93c434..22fce906ea17 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c @@ -225,23 +225,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); }