From patchwork Wed Feb 15 00:25:42 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: 9573099 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 68265600F6 for ; Wed, 15 Feb 2017 00:26:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BFF8283F4 for ; Wed, 15 Feb 2017 00:26:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 511332842B; Wed, 15 Feb 2017 00:26:55 +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 1CD8628418 for ; Wed, 15 Feb 2017 00:26:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750812AbdBOA0x (ORCPT ); Tue, 14 Feb 2017 19:26:53 -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 S1751208AbdBOA0v (ORCPT ); Tue, 14 Feb 2017 19:26:51 -0500 X-IronPort-AV: E=Sophos;i="5.33,348,1477929600"; d="scan'208";a="86867888" Received: from unknown (HELO milsmgep14.sandisk.com) ([63.163.107.225]) 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 91.FB.18895.A20A3A85; 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:15 -0800 X-AuditID: 0ac94371-d87ff700000049cf-3d-58a3a02a2d2c Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id E7.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 03/33] tcm_qla2xxx: Rework abort handling Date: Tue, 14 Feb 2017 16:25:42 -0800 Message-ID: <20170215002612.14566-4-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+NgFjrPLMWRmVeSWpSXmKPExsXCddJ5ka7ugsURBssvSVpc2NPNaNG2+gyj xc/214wWrUvfMjmweMz4vYjF4/72I0wenzfJBTBHcdmkpOZklqUW6dslcGUceNvLWPBIoGLB VtsGxkl8XYycHBICJhIzes+zdTFycQgJLGWS+HF2DpSzg1Gif2EnI0zVr7eHwGwhgY2MEtfv B4PYbAJGEt/ez2QBsUWA7NU9y5hAmpkFVjBKPGqZAtYgLGAj8WzaF7AiFgFViekXtoDZvAL2 En//LmSHWCAvsavtIiuIzSngIDFjx0mgGg6gZfYSj85YQ5T8YpH4fKYOolVQ4uTMJ2BjmAUk JA6+eMEMcZu6xMkl85kmMArNQlI2C0nZAkamVYxiuZk5xbnpqQWGJnrFiXkpmcXZesn5uZsY IcFcuIPx9W3vQ4wCHIxKPLwnZBdHCLEmlhVX5h5ilOBgVhLhZasHCvGmJFZWpRblxxeV5qQW H2KU5mBREufNkp0aISSQnliSmp2aWpBaBJNl4uCUamBMCbiaPultmHwys0HJ5oqw6d4MinzM lkxly3MapY3vTROaxKjlcObJkRnuUfay2e0+UszTD59ZcGXhoScFfau2xkxltlwoHLjny6zT xmrsSzokDnq53j6l3rWnsjMhS7bqX5SG/pakEr+IalEOzbvpcvWK8+SSmUR+uJZtb5iY7ZYV Ght9U4mlOCPRUIu5qDgRAC0OD75iAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPJMWRmVeSWpSXmKPExsXCtZGTTVd9weIIg7sruCwO/mxjtLiwp5vR om31GUaLn+2vGS1al75lcmD1mPF7EYvH/e1HmDymrTnP5PF5k1wASxSXTUpqTmZZapG+XQJX xoG3vYwFjwQqFmy1bWCcxNfFyMkhIWAi8evtIcYuRi4OIYH1jBKfn+5lBkmwCRhJfHs/kwXE FgGyV/csYwIpYhZYwSixbskbNpCEsICNxLNpX8CKWARUJaZf2AJkc3DwCthLLOhNg1ggL7Gr 7SIriM0p4CAxY8dJsBIhoJJHZ6wnMHIvYGRYxSiWm5lTnJueWWBoqFecmJeSWZytl5yfu4kR EgSROxifTjQ/xMjEwSnVwChSv232v0UPuUz/zcl7dlndSitDW1HgUMXsG5urPwlOqGVax1Ps 2Nn0/Eh2xvda1zeb2dy5q2WPF6/bXin7IDXH81Rxt7TCnCe3E/uXCh2uCP27+Emfb8l0B4aC /P9PCs5+TnJP8n3YdbqBudr6vu+HV+Veph4fGY17ykUvFire/KdmOSPrlBJLcUaioRZzUXEi AATazfiyAQAA 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_write_pending_status() wait until receiving data has finished, let the target core do that waiting. Signed-off-by: Bart Van Assche Cc: Himanshu Madhani Cc: Quinn Tran --- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 220af969a289..752a17dbeb47 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -416,21 +416,14 @@ static int tcm_qla2xxx_write_pending(struct se_cmd *se_cmd) static int tcm_qla2xxx_write_pending_status(struct se_cmd *se_cmd) { unsigned long flags; - /* - * Check for WRITE_PENDING status to determine if we need to wait for - * CTIO aborts to be posted via hardware in tcm_qla2xxx_handle_data(). - */ + bool wp; + spin_lock_irqsave(&se_cmd->t_state_lock, flags); - if (se_cmd->t_state == TRANSPORT_WRITE_PENDING || - se_cmd->t_state == TRANSPORT_COMPLETE_QF_WP) { - spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); - wait_for_completion_timeout(&se_cmd->t_transport_stop_comp, - 50); - return 0; - } + wp = se_cmd->t_state == TRANSPORT_WRITE_PENDING || + se_cmd->t_state == TRANSPORT_COMPLETE_QF_WP; spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); - return 0; + return wp; } static void tcm_qla2xxx_set_default_node_attrs(struct se_node_acl *nacl) @@ -521,15 +514,6 @@ static void tcm_qla2xxx_handle_data_work(struct work_struct *work) cmd->vha->tgt_counters.qla_core_ret_ctio++; if (!cmd->write_data_transferred) { - /* - * Check if se_cmd has already been aborted via LUN_RESET, and - * waiting upon completion in tcm_qla2xxx_write_pending_status() - */ - if (cmd->se_cmd.transport_state & CMD_T_ABORTED) { - complete(&cmd->se_cmd.t_transport_stop_comp); - return; - } - if (cmd->se_cmd.pi_err) transport_generic_request_failure(&cmd->se_cmd, cmd->se_cmd.pi_err);