From patchwork Wed Dec 20 06:56:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10125103 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 588586019C for ; Wed, 20 Dec 2017 06:57:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5026B29649 for ; Wed, 20 Dec 2017 06:57:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4505B2964F; Wed, 20 Dec 2017 06:57:53 +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 B2F6829649 for ; Wed, 20 Dec 2017 06:57:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932462AbdLTG5v (ORCPT ); Wed, 20 Dec 2017 01:57:51 -0500 Received: from mail-dm3nam03on0042.outbound.protection.outlook.com ([104.47.41.42]:4985 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932477AbdLTG5V (ORCPT ); Wed, 20 Dec 2017 01:57:21 -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=+Mtq5DWowXvSTHOuUqXjeAXo3ixtQedvgEmpGUXpD8w=; b=Lle2xqL9wh2uyoWFEJGkzpTkgXzj+QYHBPLRKdinWRAZMvijVaL4FuOeq8hHiIxOArfNBFd8PUN/Zt8No0B1zouy3HGkvI9Ib6L5GhNM4EyRjym8MczIGPJxW+Hnc+3Soc2qyR1SlQlOSF+JrhHYqTAGosnYZB1BqgM2rtmFETY= Received: from CO2PR07CA0067.namprd07.prod.outlook.com (10.174.192.35) by BLUPR0701MB1939.namprd07.prod.outlook.com (10.163.121.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.323.15; Wed, 20 Dec 2017 06:57:19 +0000 Received: from BN1AFFO11FD043.protection.gbl (2a01:111:f400:7c10::176) by CO2PR07CA0067.outlook.office365.com (2603:10b6:100::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.323.15 via Frontend Transport; Wed, 20 Dec 2017 06:57:18 +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 BN1AFFO11FD043.mail.protection.outlook.com (10.58.52.190) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.302.6 via Frontend Transport; Wed, 20 Dec 2017 06:57:05 +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; Tue, 19 Dec 2017 22:56: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 vBK6uo1C021658; Tue, 19 Dec 2017 22:56:50 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vBK6uoYR021657; Tue, 19 Dec 2017 22:56:50 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH 28/43] qla2xxx: Remove session creation redundant code Date: Tue, 19 Dec 2017 22:56:29 -0800 Message-ID: <20171220065644.21511-29-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171220065644.21511-1-himanshu.madhani@cavium.com> References: <20171220065644.21511-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)(396003)(376002)(39860400002)(346002)(39380400002)(2980300002)(448002)(199004)(189003)(478600001)(50466002)(50226002)(8936002)(72206003)(16586007)(316002)(69596002)(110136005)(305945005)(42186006)(81156014)(80596001)(87636003)(48376002)(54906003)(106466001)(47776003)(81166006)(2950100002)(36756003)(1076002)(6666003)(51416003)(4326008)(2906002)(76176011)(5660300001)(59450400001)(8676002)(85326001)(356003)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1939; 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; BN1AFFO11FD043; 1:FlAKFVjaiyMtVArGCh7/23WRs5Oz37qHy9zSHuaZ2hhjy1aau3C9hcWS9H2wTJGS1jUCJko+I5MhgnuOy5CEsF5DdCs0ceYINKsM+NKKXI3ppAQjNtjGIU5i/W4MOjl8 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 16a0b5fa-f1b8-4999-0baa-08d54776e164 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:BLUPR0701MB1939; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1939; 3:S09DpCGRH9jerxthbQdoU0R8Vo9ftgcUf4Mtc1ehil3pheaP2TbPfo8yf6pIWUuo45jT5NbfR3wnuAscvimeku6GeZYmU0mfziFwRv8RJCoSi0XVSAQRDrKYtToSBj1m7GMQBeQ5aktfYiHFEDjxQZSAiOWQUd1IGityM4ptM6R6YDNLskTrOrXFp8pHXGTJTFpVrSbKoL/LBHtTQRNgLCHr88K+bEQ7fgh2L14b2mWo11Kj1o7oS754UNOiCseP9qfG4TuPz515nnC/0zN6xuExiS39y6fr74u7wIkInnFb9UbOGPyH9c0YWRb/i0KI6TyxS28PUKgTKlnzWlM4o5LXVRfiWQDLn4oGotM8vMI=; 25:QFZ+02Nu/LrrUsPR1Jglz4JWFh01YNjrXYMx0h2g+3/51bCRDc3uCyhT4L6LqGZpByd1B9c6U19N+bCGQo6xvExSiRwsuu4qDaCwHz8RVQyUqUotospu199u/o5RPPB6KWpF5YbskER9aBXasvhumUT9i0Tp7zcjZF88331iXaQY68IE6saAPhMSiRqXxw+HTiL5G5yd83FSvXraelSNXFnSaSXDi6YitYt2vqXiERkoaUtjbbr2hlm+M5CKhqQ8ziG6VsL8uBnZk2hvrVCAJEIRQbx8SQJzG7aKhlZJskfpP1fOiP/qmjLJh37ezfoPkGaHbUXuUrnTzc1dytwL2SNIKOsOcr82jpmvWzHi+4k= X-MS-TrafficTypeDiagnostic: BLUPR0701MB1939: X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1939; 31:qGDEl/fVl5ZuG2Ip83DCWB8ud3vJOx6zy/8/LvFz2IDJp9eBf1rfooJbxBf9hA8bGb+pkYsG7orj0X8nBC8vEK84A+CIGC5cc5501O9bGddjhXSWmVbcoLjtWSWqncQxtvUcOO6i9GHNfGIlCOOj1RqWoF6Ggw3iw4rr6R3iu0gcF0tITStyLntcbnrueVEtT0XM9Ams0nq6z5amg1hSAM7Ij8CkNYeDSr3TolAQWgE=; 20:WYIh+SU+2mVS4VPIuV8/Pm7SkCz6HJOq6fj75XDJyzUTdQ/7elTxQSg9iisnE1t0hVuJC8/ZnAZFimTF6kLxId4mFcMTaEIlFKONlXcICSToRIg6lT63ygz9QSwuHMRtxkBiQpxY5/0AR9Hk0txiA9AMJbjxGWApHp5JLUVmqdmazPz4XDqTut3aFbuPMmA5e11Dc65b9ir81CpmfwS0SofcISbyXL3XGPuDispf/+sIo/px4KGPvtwahD05pLQ3FpM/Im9qz6hCViowgaZIgpnSZnFE1kSbMxL6lcNEhrm5ortQOC5rOQ7uWkv6/DHrsxcApJSZ+y/MeqGpoLtrmibzAE0IHyBNCp3KUjnj1F9VOrgn0CZbW7rCZayM8aSuavPhq1LJzwVWbGDJY6zAQE+kMVT/5PH84vm9CKwbHrh1IFKaoDIeephIy9pKdBspIbmCvXyQnA6ShnQ2ajAMyRDK/P/vOl9UQdd7U2pAFUtdIOiOEbLsjtt4irzekNlo X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(3002001)(10201501046)(93006095)(93001095)(6041268)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:BLUPR0701MB1939; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BLUPR0701MB1939; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1939; 4:t6Lfbfrg7XNRgXkazwOS3oRI72kdru0UdWv+zT2Q2Mo7gu8WO0CHJXmLFpPHEQMfd6UwhJ03sUs+f67RAg+k5TA46UcS/D0vCAh8NAMrsHwaS20jTm07FQWjhCmEYIOO9/Lq1eDk1ZWFXu8mZP+MCY0bz8xWqqTTJzZlap5f+cAyK0MQrtx9H9lxmnPvAaVdE4gxVupg83lDqJksNkSf9bnyecqEs+ToDzL8uRw1A7x5hz2niQeMCBWz1EG8fPmJqSVfErlzhEG5m4i3jj7hDw== X-Forefront-PRVS: 0527DFA348 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1939; 23:48lR1Rnzqt8sVLFEe0NYCgA63CYGeXFSLIkcWfF?= =?us-ascii?Q?rQDvMU5WuHZe95/UmilpB7anYtQ0ZKhAo6a24EwoOZxgiVnCFq1R1qBT1Foe?= =?us-ascii?Q?GvR+FH4vJznG3WRhX6eR1o7+xX2h+FFDA3gRhX76J9LGekptxIbcNufo8sGA?= =?us-ascii?Q?OIax0/7DuNBR+i2V4Sw0nylT7HPjjYAzuUjC/QQpUQBhQlkfU+qv5Fjnz3So?= =?us-ascii?Q?Kt925a91mfmA3tn0KzqxlmBG8v93/I3Ur4LdhCeRhUVyxagYccW3XuwnezWQ?= =?us-ascii?Q?4Ap3czGCY+yznKd4vY+hQCtI4T8pk76Z2oBm68rIlV4r9BshWp/RYSaxTccV?= =?us-ascii?Q?WdwDGqjiYPq+YZsVAMJeBco/bU1HLUQhJ8p2Vk75Ulzcb0oJoFJDOwfKpHw/?= =?us-ascii?Q?QWViRdL/KePlrgpJveKZeePONvrPrbRrCsvE9xnK8aDtEJvp4mCvkAxGmvD+?= =?us-ascii?Q?TgxDh45H+21s3zhT2Q1JV7ZeJNnVT4X0Y9J1BjIIYWtln0HDOYOeRj6syDTg?= =?us-ascii?Q?Oc0MkYyt3PNxNZWykaQd2W0ObTS3BIiOK7P5Isnd72+UcpCxiHt1FgvRPgDS?= =?us-ascii?Q?8pX7uoDjEMCJ2qV0yI0LqNlMNZMLastvt1p2a54+yFDag4Rk6DWXC3nGd5wS?= =?us-ascii?Q?ikr1pyJbRpMnCAlRs+0+opkZrdzx91R2TctouhxJqFY+vBHFuGszKwJMO9JL?= =?us-ascii?Q?JCgoT7n0lBbWs5sAT2itoB2mfxwSPw/Yw1BRA73p4ekKHVtQ4eJsaipZVgBe?= =?us-ascii?Q?orTUDKRwfIWrMV3Xst6Tug2J3/N+VO/binXHzi33+0gyQuhSbZUcq4SmOIDL?= =?us-ascii?Q?2bwtCcn+FPBxzXQIXPAlWj9vPY2bUm9ChSvh03H+z6i161MtTfoPZt/xA7+h?= =?us-ascii?Q?/kb9PwmtFw7X/6WdwPVAEXYGD5mWormd1AMcKF4D3I03X7+KWlV4kBiwKdmt?= =?us-ascii?Q?vDFTO9j3aTnL9SjcspToYng+AfyjZgi8URTbW8KGrc9fITw5wwVb007kJqZR?= =?us-ascii?Q?vO2IOma4Io6rZLAg10y+LYW+P?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1939; 6:XjNcI0TkIWN9NADsYpOBrEAABRLTsTn/0NvplQOQU/FZQMXCrWFiR6BSrgfMFfxwDIwvHJee0I5zB46glU7O44PWu/iZcja9zck/Z0MtHpRix/0SN/k7xlspblH1qxvAxj6V95Q5tCtpPBW0Wl3hGA05Ibmp0fSV/lbuf/BexUO0ghqpa1v108dd4FuxUsdvNHGCAFVJPfLQ6LtWxN3zslKi+nF1o7fjNWEaz2OzKaWsTPLEO10PRnPV3483HEaZ8Av4pLA2NzkcKZPcTlCGprg3MQ2PNC/fUMoSKgIvTUbLudAYGdQvay/ETNYiDBbmRnkr80ZdFWuUcpeJe4OiWP1RcdclS4j+NPAuwVdePvU=; 5:TVfWH9ppPaadlKiskqyZLmxmjY2THpteZ1VQoUQlZskkcft+VaraD/ixecZmto/JPwki03EJnfLHvCy/XLDjs+lD9mOdOnc0q++OGsEUfsm9KOSdYbTuyTfFCZID8TKxnoxe3n52I2WxlIHY+1XGnbwH1cKKn1e6h6pT8l/Qds8=; 24:wUJI01vwhUHWP+z80hpxvLHNa523NBQmY8BZqhRcLrMcY/LrQrCK/jvvr2W2TYteLKi9dkKs0ELfunW4AUkDXOSD90q2mDRMkMhp7BVm22U=; 7:NRFj9QDydGPB4WbYyVU/cM8ZH9LQXiDuKjPaxX/PQVe9gEr4s7yn/uzQ8IboyJIOKt2dLdi3YUPy+sfiVO9SOhD0eWm4ng5qxg+jEPk2zsNzRaPPyhIFeJuhgCvTZBRlUobw/PLX7ajKukWcWVmA0ul9utLKQiUh0FjOjy8wfHEI2qRIiXxgZdo6BE2AiIitD6rlsAI4S7JzSmqaelB9WihaehaL+BjmKsfVh8vTQIhiJ1pVZLJKwSo/LGbPRwRk SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2017 06:57:05.2504 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 16a0b5fa-f1b8-4999-0baa-08d54776e164 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: BLUPR0701MB1939 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 93910e56643d..598ec3481a8c 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -2016,15 +2016,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); @@ -4265,87 +4260,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) @@ -4370,23 +4284,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 */ @@ -4496,14 +4395,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); @@ -4514,15 +4410,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);