From patchwork Thu Dec 28 20:33:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10135895 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 72E7260318 for ; Thu, 28 Dec 2017 20:34:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 652412AD58 for ; Thu, 28 Dec 2017 20:34:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 59E8F2B88E; Thu, 28 Dec 2017 20:34:47 +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,DKIM_SIGNED, DKIM_VALID,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 C8EA52AD58 for ; Thu, 28 Dec 2017 20:34:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755342AbdL1Uem (ORCPT ); Thu, 28 Dec 2017 15:34:42 -0500 Received: from mail-cys01nam02on0042.outbound.protection.outlook.com ([104.47.37.42]:19020 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754886AbdL1UeR (ORCPT ); Thu, 28 Dec 2017 15:34:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=hetc0Fd/P9UWxbJZOIYVR+69Q6Vc0Sf8WdokTM3OLc0=; b=dvxlGwbmHu/t13aLKzw/q+LmN40nNpOzA6nxXu+mdClzreNBkfIpIoNiS2PXxLEcNS1zwYFXGojeqhmN3PASELdSqQypG+fVECoaT6rDM2Yia/kREtOWYdnd3xvoY3ZDmtFbTk6vPRNnoX/w3Z6zKikEaIEX791hjBBNP0ucMj0= Received: from BY2PR07CA0086.namprd07.prod.outlook.com (10.166.107.39) by BLUPR0701MB1937.namprd07.prod.outlook.com (10.163.121.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Thu, 28 Dec 2017 20:34:15 +0000 Received: from BN1BFFO11FD008.protection.gbl (2a01:111:f400:7c10::1:159) by BY2PR07CA0086.outlook.office365.com (2a01:111:e400:7bff::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.366.8 via Frontend Transport; Thu, 28 Dec 2017 20:34:14 +0000 Authentication-Results: spf=permerror (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=cavium.com; Received-SPF: PermError (protection.outlook.com: domain of cavium.com used an invalid SPF mechanism) Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BN1BFFO11FD008.mail.protection.outlook.com (10.58.144.71) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.345.12 via Frontend Transport; Thu, 28 Dec 2017 20:33:53 +0000 Received: from dut1171.mv.qlogic.com (172.29.51.171) by CAEXCH02.caveonetworks.com (10.17.4.29) with Microsoft SMTP Server id 14.2.347.0; Thu, 28 Dec 2017 12:33:50 -0800 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id vBSKXoab002922; Thu, 28 Dec 2017 12:33:50 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vBSKXoLo002921; Thu, 28 Dec 2017 12:33:50 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 24/37] qla2xxx: Remove session creation redundant code Date: Thu, 28 Dec 2017 12:33:32 -0800 Message-ID: <20171228203345.2702-25-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171228203345.2702-1-himanshu.madhani@cavium.com> References: <20171228203345.2702-1-himanshu.madhani@cavium.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:50.232.66.26; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(346002)(396003)(39380400002)(376002)(39860400002)(2980300002)(448002)(199004)(189003)(8676002)(80596001)(51416003)(81166006)(69596002)(81156014)(59450400001)(356003)(50226002)(2950100002)(110136005)(50466002)(54906003)(16586007)(316002)(76176011)(48376002)(42186006)(1076002)(36756003)(4326008)(47776003)(8936002)(106466001)(6666003)(86362001)(5660300001)(87636003)(72206003)(85326001)(2906002)(305945005)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1937; H:CAEXCH02.caveonetworks.com; FPR:; SPF:PermError; PTR:50-232-66-26-static.hfc.comcastbusiness.net; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD008; 1:Bn1qLJGXRH9sy6xZoxhq+DCfV9CAEgZNGzuk9nCU8DyLqswguuKC4gZoJlzkR/yBBJtxZZfRlIl0inV6EGspb0P3DNHR8UCwEhx5a0wqMV9Vwhg6m0+0fy81P4r8mXZE X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e31fd365-4b1a-4b4d-7cd4-08d54e324ff7 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:BLUPR0701MB1937; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1937; 3:UFjR3TK0vdEcev3kx5FUAdr8oR7rWtv07DNJoouOdIsmuXxM1TJjVVLyEhbNyaZx1HXZ1bykgwFDJE3CNAE5Lv5h3MZ8HUm3AhxePbYvn2NDKMev2h1vhYQEjc4CPR9XNN5cpXqiX2PjqjT7Z2O534iJPCImZQ57ikvu0XpFw73nyZHuONrD+NRc3eAeqigwhEzN3kGyjfw4d5v/8RRYtkosWkXSR6Tw1JJhCim/oxyGy/dxwnLNDmHaLNNPU3VSGlNOzkqTwUoY8ewcpa5dG2XJTNh9NcrVSTZEtl0iP6RKKirplxsXmSLY+0dM6KM3NFNFYG76CJWAtE5UpULp5Q==; 25:6HSY1xw85YHD6rWj27bOutKVY5sXqScpveWN7o1aQvzRHSV5UoyLu67FeOdO628TTMHadlixnXoZlWfWRqy1TKhvj4CHVH6cgwy4h2ZjnQHfrUWKEkt7kZLVmNoQuK9olzB9BYRf6rxyzyDP6BhaL0lb3Y/BGj4rfPhBn3kZyMpgCBpOyph78eU2/+u1/SM5f1Ejzev7CJi78IiCLs7EBRQhmk0EFX7ioxJUHWkERT/GyY4y4VFviXMw9ynpBe29QPPnF7n/CORt4ETS5SksI9XkrURCgScR6PmOOw5pyDMtRdxSNtFrWNo9xknTHxKrCJge/tEmyeIR4qcNc7/A2w==; 31:dKV4is2HvSOncugSPZT2LB4qsruOVKTPCyDO7VVi1ZRsjdAHU4yQFCeFHBuWFr7FoL69R4qkzsyKWf2KSk/5LOyIRoP3p2hwfZ3SdSYBkCMqPxqcMmk/s4nTAJeiwVLKiZShaREFUhePo4lxhtRUY//ZVDApmaAMeV2vD0s8dw/vux2DnhdbRm1PG2NHYD1HqNEkCEmvoW26r98pcrINh3bNBJyLDgD7C6gfyL5B9nc= X-MS-TrafficTypeDiagnostic: BLUPR0701MB1937: X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1937; 20:vMYrBw+tuZabLcdYkVq+8IuH88rKPGp9IQfZoE+yY1+UjO1nuahZZ74J6BG918r5vv3J7H+1cPTksb9RSEQagaCcdvfHaxdRWLnKAexvpNfHMfYc5SMImNhnJsjSYPOA5vBZE2OMIgDuq9DQK8+XPYZEfrzlny+WpeFckPJRTLeAk4yK2Dh14J8/Nwo7/zq4Dh+v/ouPtYDcEQDmcmgv8uYNdKWv8DcpegaFwQ0L1p8Q3/6hux0fjS68EGqsOYsWXFqYg4Mbyy9nwHgF/+r1MYo4+qGwHIfWZV9ZZ0ym8Kin7CHPwpHMK3ByIM+Roa47YUJte/DJEeC1qA+FC4S0TAf4fPbeyQaX7Yi7H+BTtzvkyag4y81Q6OjzQYtSSIDT0g9oesY9Y2X6bihlpBTji90eBEHBMEiCTIvAeCHUPHWShPJpC8MbqP0CIvWrLdKH4ZJ6Fg7BEuhVJ0IpshRbSc8j3z/iEFQHh9dtJuJGgmVQhoTLcyyf9FKU1Y7wS23i; 4:grqzPMrHj3BpRmzghMgV231zeRGRJuxgkKQpji23eKsZWrIN0+RDZgzJRUx1UF79IK/L2vcbUA0CLCHaz+TF+JCQCwZgAI4Y6zfL6MFO7TEcWR2mfwAvtSHCiCQsfMo8rXvH+FK723omwMy6wz8k0v4q5D5M3FQxfQO8be+0mfA8JyXkBc/HAT34IFnF/SHKPUsKbp1IIZlW67lMuHSgddDJH5oeKCjgAmFkBH3O+3s1Yax85WbcnkMIbmfkoQ0pET2sV+sPk/CxzCLofAyinA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(3231023)(944501075)(6041268)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:BLUPR0701MB1937; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BLUPR0701MB1937; X-Forefront-PRVS: 05352A48BE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1937; 23:L9kwK4SCa1Kg3+5/UQdajr3zbKtoIbkWF2+VdKp?= =?us-ascii?Q?bXhYXKvQ8z9+jr7yMsGe3AX9lZfqrawfh2sYC+gQWOTLo3Cws6tLNkqAetng?= =?us-ascii?Q?NOrKmiRBO4pRp87tGNLT62MJN1uAfdYMu6dRtKXe+OftfDWeohCWxTHLYqIi?= =?us-ascii?Q?gKDHhbbP2X9lKZIyG6O2NpAmuvy0GhB/k2B+S0FVDM9LYl11FcAm247i3qBU?= =?us-ascii?Q?Omy1PVfkZMFIayGYtR1iMHFOiZKNuiPIfM+LOij8QD9ceQe8Ksq+DiZ4XKwd?= =?us-ascii?Q?8qpeVOR+MZpTdX9a6ns37wYveBk1ovrFFmTnquiZDNNJB9DyUsCsIVrljdiX?= =?us-ascii?Q?c1dQAk5BZ1JWWc5NaV9dD8u/f+X+WCXwQJZ7/XQu7+Q6GPiapDSXtqT6LwOO?= =?us-ascii?Q?WYvMjU38zxv0e9yNKGjeHmozNHQXXNxvQo46FD15O4vlEXMQeIflyKaOkAj6?= =?us-ascii?Q?KthhPalkZI+WovpdM3SouY9CKxV2xHXwocmNOjenfGQR4iIIU7/XkW2pHaTC?= =?us-ascii?Q?JvJecV76Ra8cvre3Xflc2I/RNla2214+WPUWrfVC6e+cfeDE61dfOZlvwf4I?= =?us-ascii?Q?OWgMWAz0rPckxd1l89f7//DKvPFHOEnV/p4nR7p1f1nSBCtkRz+W1BcbbZK9?= =?us-ascii?Q?bfN4LIiMexNrqKU6bIshjqY/IH1hvyRFfZThih6vx+YVzQIMryA1TCQ7Do2C?= =?us-ascii?Q?ewnzXhyUKKajefCJ9qNOSZ+dfu+7f9IfMA98fe4zVbKDU707ZM11f6hofSqy?= =?us-ascii?Q?2LdgTloSCUl+nFbhvE1Y+sdORnu+0s9P6yLMcBhnlW/uZ3/E2KBu9jGQyc2K?= =?us-ascii?Q?Kr7SPSgcxyaWap9B9U7UAtNRMDvkSwozP0fx3oGzz84iESiYWQF7PdESyGl1?= =?us-ascii?Q?3LHbVA8PA6fZUFi/M3fFaoQtYGhX4ojHWyXyESV5jsEo3NTiL/jPdT9QQ2De?= =?us-ascii?Q?rUCyPt+n8wl+YAPMlTPcVRgLrBGOV19s0jnk3N2zoX4shEh0Rl7zXvKLroGX?= =?us-ascii?Q?+8C2SKa3MLKi91XTU5g8Mz/9t?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1937; 6:qVOyIX4y5jBcuIQwvh1gclup91+dZxdU4ZgYKrtc+lE76pP2dxH63k0zX05+8nyFBDvYddFUpq6QOg0iB9MZBZQXUsrOLlsSHPYCzf0PK6HgStq2E4KR0hMa+z2s1f3g1Wv1e63wr7ItwXVTiryzrTVDuWDOKg2AR6Rb+bL5ZYAa4BRpcsXHfPez73f5XvUCf1PhMbsl+A8NqvpoRJ+4Sl7lFarXqFceI+XVX1Ql/v7L5cYrr84Jfu9M58fq1K3DDegV5b2utAnWhfecaOcMVJiaMXtMD6URfmuKfZchl9UvQS7+gqE8szRkClOixaAeeP0qHZz97opf+QnjfodmWj6yGuKFF7l0458oFH+f6eM=; 5:ieU5TJ7f81iwYuV4e7mHDje+lX4CnKuXOFaXeNr3mtVzJFRMyM2EbUE2X00Xo66cB56mn1BzdjbMDhuiBKWNvkkJAo+Vtyr9Osmg0YeDyb9l0zyFRQeTyXHoX3BPY0JtnBnujAhRXlWCmUloHs3pWhgfcKjTeBWFqlbWcG5U/LM=; 24:1tTQL2eLdAPdczG5b2n4VYCfjq2zjy5i5NqBfwXOW//ixGdb9yUaGJXpGY5FiZGLNzzvmurK7HzusIyXTAJhh+7V9nt/v6hdFtCgRu3hHFQ=; 7:fnY5+TH8kpoS7DuHVhd7ryun2fqM47VmXsj52ChyfvWfhjbLPltP6yTKfuozOXSryxKN6pLlnQZX9jlfOHG43/g5mc06jgIdXarTVBwKF0Dndugyf51LRfjrTtL0tzD4otRx4CFFfVFuDkGiCiB0sJ7C46ABTgEUwyz0mWGcIvemla22srAHAAbj3I3yHKfdXZxjEkUvQGNvfOBusIXSBguIWqBCEDJs4sKAaQ7AkXEEGzYxXcYPCKnD1Ng7G4eD SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2017 20:33:53.6155 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e31fd365-4b1a-4b4d-7cd4-08d54e324ff7 X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=711e4ccf-2e9b-4bcf-a551-4094005b6194; Ip=[50.232.66.26]; Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1937 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Quinn Tran Current code creates a session when a new port is discovered, and a PLOGI/PRLI is received. There is no need to create session when command has arrived. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_target.c | 122 ++------------------------------------ 1 file changed, 5 insertions(+), 117 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 75474725fe59..a4783eb11711 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -2018,15 +2018,10 @@ static void qlt_24xx_handle_abts(struct scsi_qla_host *vha, ql_dbg(ql_dbg_tgt_mgt, vha, 0xf012, "qla_target(%d): task abort for non-existant session\n", vha->vp_idx); - rc = qlt_sched_sess_work(vha->vha_tgt.qla_tgt, - QLA_TGT_SESS_WORK_ABORT, abts, sizeof(*abts)); - spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); - if (rc != 0) { - qlt_24xx_send_abts_resp(ha->base_qpair, abts, - FCP_TMF_REJECTED, false); - } + qlt_24xx_send_abts_resp(ha->base_qpair, abts, FCP_TMF_REJECTED, + false); return; } spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); @@ -4246,87 +4241,6 @@ static struct qla_tgt_cmd *qlt_get_tag(scsi_qla_host_t *vha, return cmd; } -static void qlt_create_sess_from_atio(struct work_struct *work) -{ - struct qla_tgt_sess_op *op = container_of(work, - struct qla_tgt_sess_op, work); - scsi_qla_host_t *vha = op->vha; - struct qla_hw_data *ha = vha->hw; - struct fc_port *sess; - struct qla_tgt_cmd *cmd; - unsigned long flags; - uint8_t *s_id = op->atio.u.isp24.fcp_hdr.s_id; - - spin_lock_irqsave(&vha->cmd_list_lock, flags); - list_del(&op->cmd_list); - spin_unlock_irqrestore(&vha->cmd_list_lock, flags); - - if (op->aborted) { - ql_dbg(ql_dbg_tgt_mgt, vha, 0xf083, - "sess_op with tag %u is aborted\n", - op->atio.u.isp24.exchange_addr); - goto out_term; - } - - ql_dbg(ql_dbg_tgt_mgt, vha, 0xf022, - "qla_target(%d): Unable to find wwn login" - " (s_id %x:%x:%x), trying to create it manually\n", - vha->vp_idx, s_id[0], s_id[1], s_id[2]); - - if (op->atio.u.raw.entry_count > 1) { - ql_dbg(ql_dbg_tgt_mgt, vha, 0xf023, - "Dropping multy entry atio %p\n", &op->atio); - goto out_busy; - } - - sess = qlt_make_local_sess(vha, s_id); - /* sess has an extra creation ref. */ - - if (!sess) - goto out_busy; - /* - * Now obtain a pre-allocated session tag using the original op->atio - * packet header, and dispatch into __qlt_do_work() using the existing - * process context. - */ - cmd = qlt_get_tag(vha, sess, &op->atio); - if (!cmd) { - struct qla_qpair *qpair = ha->base_qpair; - - spin_lock_irqsave(qpair->qp_lock_ptr, flags); - qlt_send_busy(qpair, &op->atio, tc_sam_status); - spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); - - spin_lock_irqsave(&ha->tgt.sess_lock, flags); - ha->tgt.tgt_ops->put_sess(sess); - spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); - kfree(op); - return; - } - - /* - * __qlt_do_work() will call qlt_put_sess() to release - * the extra reference taken above by qlt_make_local_sess() - */ - __qlt_do_work(cmd); - kfree(op); - return; -out_term: - qlt_send_term_exchange(vha->hw->base_qpair, NULL, &op->atio, 0, 0); - kfree(op); - return; -out_busy: - { - struct qla_qpair *qpair = ha->base_qpair; - - spin_lock_irqsave(qpair->qp_lock_ptr, flags); - qlt_send_busy(qpair, &op->atio, qla_sam_status); - spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); - kfree(op); - } - return; -} - /* ha->hardware_lock supposed to be held on entry */ static int qlt_handle_cmd_for_atio(struct scsi_qla_host *vha, struct atio_from_isp *atio) @@ -4351,23 +4265,8 @@ static int qlt_handle_cmd_for_atio(struct scsi_qla_host *vha, return -EBUSY; sess = ha->tgt.tgt_ops->find_sess_by_s_id(vha, atio->u.isp24.fcp_hdr.s_id); - if (unlikely(!sess)) { - struct qla_tgt_sess_op *op = kzalloc(sizeof(struct qla_tgt_sess_op), - GFP_ATOMIC); - if (!op) - return -ENOMEM; - - memcpy(&op->atio, atio, sizeof(*atio)); - op->vha = vha; - - spin_lock_irqsave(&vha->cmd_list_lock, flags); - list_add_tail(&op->cmd_list, &vha->qla_sess_op_cmd_list); - spin_unlock_irqrestore(&vha->cmd_list_lock, flags); - - INIT_WORK(&op->work, qlt_create_sess_from_atio); - queue_work(qla_tgt_wq, &op->work); - return 0; - } + if (unlikely(!sess)) + return -EFAULT; /* Another WWN used to have our s_id. Our PLOGI scheduled its * session deletion, but it's still in sess_del_work wq */ @@ -4477,14 +4376,11 @@ static int qlt_handle_task_mgmt(struct scsi_qla_host *vha, void *iocb) { struct atio_from_isp *a = (struct atio_from_isp *)iocb; struct qla_hw_data *ha = vha->hw; - struct qla_tgt *tgt; struct fc_port *sess; u64 unpacked_lun; int fn; unsigned long flags; - tgt = vha->vha_tgt.qla_tgt; - fn = a->u.isp24.fcp_cmnd.task_mgmt_flags; spin_lock_irqsave(&ha->tgt.sess_lock, flags); @@ -4495,15 +4391,7 @@ static int qlt_handle_task_mgmt(struct scsi_qla_host *vha, void *iocb) unpacked_lun = scsilun_to_int((struct scsi_lun *)&a->u.isp24.fcp_cmnd.lun); - if (!sess) { - ql_dbg(ql_dbg_tgt_mgt, vha, 0xf024, - "qla_target(%d): task mgmt fn 0x%x for " - "non-existant session\n", vha->vp_idx, fn); - return qlt_sched_sess_work(tgt, QLA_TGT_SESS_WORK_TM, iocb, - sizeof(struct atio_from_isp)); - } - - if (sess->deleted) + if (sess == NULL || sess->deleted) return -EFAULT; return qlt_issue_task_mgmt(sess, unpacked_lun, fn, iocb, 0);