From patchwork Wed Feb 15 00:25:41 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: 9573073 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 62C9D600F6 for ; Wed, 15 Feb 2017 00:26:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56B35283F4 for ; Wed, 15 Feb 2017 00:26:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B8222842E; Wed, 15 Feb 2017 00:26:44 +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 D8BB9283F4 for ; Wed, 15 Feb 2017 00:26:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751238AbdBOA0m (ORCPT ); Tue, 14 Feb 2017 19:26:42 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:17288 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750908AbdBOA0k (ORCPT ); Tue, 14 Feb 2017 19:26:40 -0500 X-IronPort-AV: E=Sophos;i="5.33,348,1477929600"; d="scan'208";a="86867711" Received: from unknown (HELO milsmgep15.sandisk.com) ([63.163.107.21]) by ob1.hgst.iphmx.com with ESMTP; 15 Feb 2017 08:26:18 +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 56.E4.57638.A20A3A85; Tue, 14 Feb 2017 16:26:18 -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:15 -0800 X-AuditID: 0ac94369-26dee9800001e126-66-58a3a02a26c1 Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 87.7D.11415.720A3A85; Tue, 14 Feb 2017 16:26:15 -0800 (PST) From: Bart Van Assche To: "Nicholas A . Bellinger" CC: , Bart Van Assche , Himanshu Madhani , Quinn Tran Subject: [PATCH v6 02/33] tcm_qla2xxx: Simplify tcm_qla2xxx_aborted_task() Date: Tue, 14 Feb 2017 16:25:41 -0800 Message-ID: <20170215002612.14566-3-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+NgFrrELMWRmVeSWpSXmKPExsXCddJ5ka7WgsURBvP/KVtc2NPNaNG2+gyj xc/214wWrUvfMjmweMz4vYjF4/72I0wenzfJBTBHcdmkpOZklqUW6dslcGXMmjCBreCVUEXb kQnMDYxf+LsYOTkkBEwk3kw/xtTFyMUhJLCUSeLyznnsEM4ORon+hZ2MMFUbzndAJTYyShx9 9YIJJMEmYCTx7f1MFhBbBMhe3bMMbBSzwApGiUctU8C6hQW8JH70HWIHsVkEVCU+npkBZvMK 2Esc2vUPaoO8xK62i6wgNqeAg8SMHSeBhnIAbbOXeHTGGmSmhMAvFok9pxuYIXoFJU7OfAK2 mFlAQuLgixdgcSEBdYmTS+YzTWAUmoWkbBaSsgWMTKsYxXIzc4pz01MLDE31ihPzUjKLs/WS 83M3MUJCOnMH490n3ocYBTgYlXh4T8gujhBiTSwrrsw9xCjBwawkwstWDxTiTUmsrEotyo8v Ks1JLT7EKM3BoiTOe05maoSQQHpiSWp2ampBahFMlomDU6qBUXd+ZOGiawrFX9cZSYv9exvW rLFM9fyS6PtTNzEc/TDpifCmT/emeGQonIw9P++W/pVIM7YvG0sn7l5lJLjFdjbP8e5DZZE7 xY7M6pm469qfxxb6sunyWf3xrRoh9Vfucay4Xrdqt81T90n3bhu9+79xY2OXW9hZqyn1FZNZ Try5wsq7+dT3a5OUWIozEg21mIuKEwEmzKnJZQIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrAJMWRmVeSWpSXmKPExsXCtZGTTVd9weIIgxdLOS0O/mxjtLiwp5vR om31GUaLn+2vGS1al75lcmD1mPF7EYvH/e1HmDymrTnP5PF5k1wASxSXTUpqTmZZapG+XQJX xqwJE9gKXglVtB2ZwNzA+IW/i5GTQ0LARGLD+Q52EFtIYD2jxNR7viA2m4CRxLf3M1lAbBEg e3XPMqYuRi4OZoEVjBLrlrxhA0kIC3hJ/Og7BNbMIqAq8fHMDDCbV8BeonVbGzPEAnmJXW0X WUFsTgEHiRk7TgIN5QBaZi/x6Iz1BEbuBYwMqxjFcjNzinPTMwsMDfWKE/NSMouz9ZLzczcx QsIgcgfj04nmhxiZODilGhjtE31iO/j/esR8cU833pZqttB2b6Gj0ILkH/wb85KzXL6rSLw9 PLtrz16Xl6UnXrc2NX2QdklnrDl0kpv5q2KfqPFhRt/7ScZ9frqtUa51J1d4N794wvRe59vr mxcCO8XcPT7Jbr+VFJIRoNNt/bTuaMvpDjO7cznXPzi9mO/Pd+Xe/mtR/5VYijMSDbWYi4oT Ab+HKzSzAQAA 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 Instead of letting tcm_qla2xxx_aborted_task() figure out the command state, wait until the target core calls tcm_qla2xxx_release_cmd() and free resources from within that function. Signed-off-by: Bart Van Assche Cc: Himanshu Madhani Cc: Quinn Tran --- drivers/scsi/qla2xxx/qla_target.h | 1 - drivers/scsi/qla2xxx/tcm_qla2xxx.c | 24 ------------------------ 2 files changed, 25 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h index a7f90dcaae37..6aab4b4d5eee 100644 --- a/drivers/scsi/qla2xxx/qla_target.h +++ b/drivers/scsi/qla2xxx/qla_target.h @@ -869,7 +869,6 @@ struct qla_tgt_cmd { unsigned int cmd_in_wq:1; unsigned int aborted:1; unsigned int data_work:1; - unsigned int data_work_free:1; struct scatterlist *sg; /* cmd data buffer SG vector */ int sg_cnt; /* SG segments count */ diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 8b878a2d7304..220af969a289 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -512,7 +512,6 @@ static void tcm_qla2xxx_handle_data_work(struct work_struct *work) spin_lock_irqsave(&cmd->cmd_lock, flags); cmd->data_work = 1; if (cmd->aborted) { - cmd->data_work_free = 1; spin_unlock_irqrestore(&cmd->cmd_lock, flags); tcm_qla2xxx_free_cmd(cmd); @@ -735,31 +734,8 @@ static void tcm_qla2xxx_queue_tm_rsp(struct se_cmd *se_cmd) qlt_xmit_tm_rsp(mcmd); } -#define DATA_WORK_NOT_FREE(_cmd) (_cmd->data_work && !_cmd->data_work_free) static void tcm_qla2xxx_aborted_task(struct se_cmd *se_cmd) { - struct qla_tgt_cmd *cmd = container_of(se_cmd, - struct qla_tgt_cmd, se_cmd); - unsigned long flags; - - if (qlt_abort_cmd(cmd)) - return; - - spin_lock_irqsave(&cmd->cmd_lock, flags); - if ((cmd->state == QLA_TGT_STATE_NEW)|| - ((cmd->state == QLA_TGT_STATE_DATA_IN) && - DATA_WORK_NOT_FREE(cmd))) { - cmd->data_work_free = 1; - spin_unlock_irqrestore(&cmd->cmd_lock, flags); - /* - * cmd has not reached fw, Use this trigger to free it. - */ - tcm_qla2xxx_free_cmd(cmd); - return; - } - spin_unlock_irqrestore(&cmd->cmd_lock, flags); - return; - } static void tcm_qla2xxx_clear_sess_lookup(struct tcm_qla2xxx_lport *,