From patchwork Wed Apr 25 13:08:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dupuis, Chad" X-Patchwork-Id: 10363179 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 612536032C for ; Wed, 25 Apr 2018 13:09:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E7D728DF1 for ; Wed, 25 Apr 2018 13:09:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 431B128DFA; Wed, 25 Apr 2018 13:09:50 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI 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 2601428DF1 for ; Wed, 25 Apr 2018 13:09:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754041AbeDYNJd (ORCPT ); Wed, 25 Apr 2018 09:09:33 -0400 Received: from mail-bl2nam02on0046.outbound.protection.outlook.com ([104.47.38.46]:7506 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753919AbeDYNJY (ORCPT ); Wed, 25 Apr 2018 09:09:24 -0400 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=OUI59NsjAMNpkNVkWCHzgVmpbOYlA2oFZmySHu9z4DA=; b=VLItHMqQ1ehanlu1x5vfHdKizjjKORv0LU+TJ/bQShnzcoF/p3OQ9A0wHIir1zmPpcJCzE7PHULSltsZzjvaXnOw70fTJzx2Yyw/VB8g7JMof/ZoVWOrLV7tOtZPD2VrhioxzDhDS11XDg8BcD9A3rY0L1eEK/8py7vR7s6QFBE= Received: from BY2PR07CA0020.namprd07.prod.outlook.com (2a01:111:e400:7bff::15) by CY1PR07MB1512.namprd07.prod.outlook.com (2a01:111:e400:50ed::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.15; Wed, 25 Apr 2018 13:09:23 +0000 Received: from BN1AFFO11FD013.protection.gbl (2a01:111:f400:7c10::197) by BY2PR07CA0020.outlook.office365.com (2a01:111:e400:7bff::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.696.13 via Frontend Transport; Wed, 25 Apr 2018 13:09:22 +0000 Authentication-Results: spf=pass (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; oracle.com; dkim=none (message not signed) header.d=none;oracle.com; dmarc=bestguesspass action=none header.from=cavium.com; Received-SPF: Pass (protection.outlook.com: domain of cavium.com designates 50.232.66.26 as permitted sender) receiver=protection.outlook.com; client-ip=50.232.66.26; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BN1AFFO11FD013.mail.protection.outlook.com (10.58.52.73) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.653.14 via Frontend Transport; Wed, 25 Apr 2018 13:09:22 +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; Wed, 25 Apr 2018 06:09:22 -0700 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 w3PD97ol006456; Wed, 25 Apr 2018 06:09:07 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id w3PD97fI006455; Wed, 25 Apr 2018 06:09:07 -0700 From: Chad Dupuis To: CC: , , Subject: [PATCH 09/21] qedf: Release RRQ reference correctly when RRQ command times out. Date: Wed, 25 Apr 2018 06:08:53 -0700 Message-ID: <20180425130905.6385-10-chad.dupuis@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180425130905.6385-1-chad.dupuis@cavium.com> References: <20180425130905.6385-1-chad.dupuis@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)(39850400004)(346002)(376002)(39380400002)(2980300002)(438002)(189003)(199004)(356003)(2906002)(6916009)(50226002)(4326008)(72206003)(8676002)(47776003)(478600001)(81166006)(87636003)(305945005)(6666003)(81156014)(1076002)(16586007)(42186006)(106466001)(8936002)(48376002)(50466002)(336012)(51416003)(107886003)(59450400001)(186003)(2351001)(54906003)(86362001)(106002)(76176011)(5660300001)(69596002)(36756003)(44832011)(486006)(2616005)(26005)(11346002)(126002)(80596001)(446003)(316002)(476003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB1512; H:CAEXCH02.caveonetworks.com; FPR:; SPF:Pass; LANG:en; PTR:50-232-66-26-static.hfc.comcastbusiness.net; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD013; 1:oj2xEnH+MiJ7QqPqNwzjUziaL0VueVVPpHuA62Wtwsg5PS4q3v13t8o7u1fKybXumMgxO1F+NeLmlRBOlc3YP58RMkyVGniw7ISqdKuJZMwsGJwfi8Tm3SUad5kgptem X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4608076)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060); SRVR:CY1PR07MB1512; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB1512; 3:s7Wj4JWT3v89xXcdr51IxUFVeqVqqmsLYMtYzOZySX0iBc75xsDI0RA5orakyfCz2TXQQERieV5uywApN2FGa1W1wrI1UgEvnfNi9LvMZu5ytEzVEvva0fb9AZa5wfsRiM6DRNqlTGOdYRXe4yyaWTKIyjCkVjz2SnY/5fV1aq1AN7KLhB+thoESiJ4RRWxSCsEuYsG7RMphgclNo/i9fTjAFv+j5VX0OPZubhY9Ov2ugDFelZ3EmC513p3kX7GNiksff2+ZkUkE5Ho1fm4lf24/Q/auKqLpAPVK7H4JNoBiwbVrLf83z5G2xuPuHcuZ1ppOtbgTGg8Gm+ko1VvgHQD4VRNkZISGKXPxKCV3E2A=; 25:m2aaPb1XmVP5BL5vOSif0JRfgWaOigfquqK7cGfgfSyETYOFIzItjBKdwQTfdiUv/dh6mIzK34KhpLEnO8A+8FWv8vGJwONufUlC4BGOf7vrHh56c7sh6kSY1rAa8hmohU/4Ni+tkpK1dea0bfHBbFqn9Ayf9G2eZ7l5TO73hYHxMgxDgE92aUEQF+HUTGM9C+r9XIvtg7+oTsgh7mysO+HtiQ1Bmzhz84z+q4IsqkH54DqZ/4Hft6UFRT2hTDYLzMgF+9kfM1Tq+9/mr64uh77EctoAo+XSatguXMWVH9td51U4zItSzTp3kyh1HCiedj95Sm88/siaWjTN5jF8tA== X-MS-TrafficTypeDiagnostic: CY1PR07MB1512: X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB1512; 31:bkvMkEZaTNy0N6qGrPtrFTjSqGhnMa283vmG0QunraL5nrOT8OrQxvP1uQlEX8xW+X4d6RWu9m6BUEs0dphJb8ONJ5eInBZeooi6SyvlX8UWiwJlxeXZ7+T46yLPq3lvm5fdlA6PhK/ByxL16NxlPfm7j3DYcWtBu4MZvono4MpsN1RCkTpSzHEU0GBDcKOFzn6jqQrnuuRle450TmQhm5nnRn2rWeYum+WGK6T1Hgs=; 20:3cPFinoF+yYbfiwwUwC2wDh6QRmksMtlokM+6gOWYe9FHpy6i9lDVqQsEz7LCo5MHRLgWfFlAf9kM8nS8kLGo6PtovXVEasEhV2xihyum8BdN2CgSDV5qcM0iGlNz3cPdgJwvibbRY1uzyvXmXjtxIHU8H9UxGfVg9lZOvQoEoTJvc6+qqrN1afDsRPok0qGTuhiKkwn86LjXn2dhU5Nli2zDYZDMJvvrFyF/i1eJ1kT0LQAKy1eQpujAiI6jeKV9hm5k3TCj6SSavTH2M1ObBvM2TMUy0trOFUZq/kcHZgzAY1gkwSzkACykpFkEOArEJpMD3ftPo8ykY85DT5PzRU7PD6CEln6HMxh7ifcnuimyxKZgrU13yCllORzDAnKf82k9LKkr+C3mLCiH5ot+Acp6ayAb/S0/n4KbUFdK4WZmv2HEQJRTebCSTLWi2SdgWQoiy4SBroW2zaaGmXFrVf0/W/3YhTEcVaKNT/gbpKb1Q0VufBSxE/Oh3/J6un6 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93004095)(3231232)(944501410)(52105095)(3002001)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:CY1PR07MB1512; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB1512; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB1512; 4:DXLfQkiXwJ22HzKsUuj5qUNj4c0NOl8OpBzb+DADAIi4Pozdnp0rRfTcOKA1i5ryniKN7lkj1AzP2BdCPIkWnTBqI2c6e7ooWO2iGeLaaPEhLA14fvy6rDz1NHroCCmucOjJg3UWcaZVjEAEW/7KSEES+3bIz7pey6CSjxt1QYqCaVyke8Qh6wd2Q/qe2mooclBnnccT/ZcU/5BRqVhVjW0/BXeCEuygljvDy3V5ZdZ9fIoNHeNTZaHwwUpehUp7uUtx/0lZaMCir+8gUdNKEQ== X-Forefront-PRVS: 06530126A4 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB1512; 23:6tML1U3g6UCd+AU9tNsPuiFLliGajsj3mEC8014Bj?= =?us-ascii?Q?fxsttWuQwFo2459BjystJrpAUTC28x/oFjaTKKPy/cePyd67nlV7/mrziIxk?= =?us-ascii?Q?jeXTSZU9gSL9opc9TmaCqm2sx4QY6DIPR+K6y3Lq7DVCPbXvwF+8yoeymSza?= =?us-ascii?Q?Dr9WWvjdxHYjmDDRodZPOsw2WzGzywUg8QhW52EVjt+RNoxkT4xMpxHVvX6T?= =?us-ascii?Q?LEAjeurhi7TZ6zqUBIcW/m8H/Ht7mOKclf67/rCG1Nj+RNUdeDYfz7YuSl57?= =?us-ascii?Q?ZJqJyW75LZkdq9GBdTFyIHmXWimy1jM2QfOADTxdou9JUtnPkr6k6HyRdqf9?= =?us-ascii?Q?Hcrm+QmELemZ6mrZxHFm4hCuPaiSd8ztaTIkuhBkJ2rIrdI4h7qFJPbLXQaH?= =?us-ascii?Q?rPIm3CyArb6WFWE4qwHmQOqG5QE0o2RF7M6npukrfHH/H8LgASAM5HXEnT1x?= =?us-ascii?Q?DcuI+iHWvQ/3hyXDVPpHVEoUN8XKWDb9MqNs6MV63TliczBoYpiOzjXEORqp?= =?us-ascii?Q?YNoibafEshpIA3LViRULsgANB0rpuGuc6L8WDFVybJ6v2YCM4uNfe1eLNOEM?= =?us-ascii?Q?xh/dVqbNghj7LPDD7KfcxfYG1K8jJ21S3mziiO4Wk8LCfcfU8wXqNfGseqUn?= =?us-ascii?Q?c4RhwJiGn3wlBRtErgLVj1BnAWZj/4Ech+WcOwlLxV3GXb2OF4932c3+yuEh?= =?us-ascii?Q?Hv5RcmlrAeIHmUG808rBNtbWj63+7n8lz77P8ltt+GVa1VC2OZnZolzTE4In?= =?us-ascii?Q?kViR4NYRE4tF12jbe5foynjYE0KsHtfeHjJWNihH1u56T7gKHX+Lm1Cezm+A?= =?us-ascii?Q?TdZeSpYG155khEIFsyu5mPugz3cDFXU+6sxbZNc+/qFLg28FjnDf0xh6Vbu6?= =?us-ascii?Q?mN1bpLqTkiyWKjhna5YqPYIn1n6kDB90eJMGhe9Bi8YLzxGZScCEULPZjsZX?= =?us-ascii?Q?j65yRDfBHfPLBBSwjsxRzYUyBv2OGyF0bQ+sE2+8XYCnrpkv0uRyAyedJnIH?= =?us-ascii?Q?v7sEigNqm8ZRUh+QvGESfeFwZsd5vWxdJT9ktqg0j9va2WkP4vVcraJiPnVF?= =?us-ascii?Q?f4v5sLb6paUa9vEImfOgFohzsm2yeuW5WavyBZvYI7EV6SOqm2SCvRXKXpJW?= =?us-ascii?Q?Q1ULifyibzpWIIttv+ynXUR5d/uGh7DhqQ/o7UrbntejFYotYmRPR96xHO3G?= =?us-ascii?Q?DGXwtcVQHc1Uyk=3D?= X-Microsoft-Antispam-Message-Info: v4FDKOLDipXASpUgrqgdUpsE5YiylFS1sYY34shQmwhX7VevUQ7RztuUfI4k99R6qM/p44De/KYCQDhRAxnySrIwJo97qHDvncX4NmI0dA72QxmIJw6L92j6PhAjoSWU1mdYsyY3ot4FeLPg2L3H3BoNXTnqYaIN1lH6nn2syVD2e3z/As9JCJdMBDChQ9HA X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB1512; 6:p6VXsUsyTFmjkpq/2k/Wzp00tcVJoOx6F1RDTRYJdHkx0w6R0NrvmsCiUI+uuIcX9JX+xFCN5Mt7GfPT8RN4O4ycLweJR5rVNkt/z1BGB3EOwbWJ9D7tNt0saNGhqw6j8qMdeo0fX1V/JLMFyvTKFXhB6ssBv8x1kGHCypWyLYTEn6b0KNLPYlb5bjg6qkDhSnOwCfAsETgwsI2Yi+goV07WZ0FxWjS3xhr4ygeMbaIOzFStOeP2z86GwKTR/rKa7cz58VmV27/Afk5IJ06gmpa+YzJFIPtuOgYM9eQhjOYsdraZkqdw0WL3y0HzbP0QDC0PcfNMD7qpjtENrTM9F3Oydogh/2R85M/M3s0jSe3q2Jwmk8HCCnttq+LqXUx3X3fSLiSrje586hQ0iRJN+wqbBpqfqd08f6z+pnVCqvhuVgz1CJ9X0dhAxg2pEaBEPF+JffsCfwJiRRF/8otkNA==; 5:Uuh8UGBh2omjW3Uay21G0AJVFEd3mEu5T/+DiTrY+HrniVm3KXsfs5g8KaJQat95bwzSsr+n3F+kUyBSdnbLIJhrFCW+8SrKKIibj7VNvfdQrJezHdyCxxrgFjfaTLkq7Qhr+tpuIQaWz0vU5fFhdspGYytV43/RwQYpfCPHUF8=; 24:QRYmujY7xLCFRQCUNZZhG4ETge+aoT/a1+k1Kf2/lAcyo8hvyZRsKCvGztXRR/KHnbh3HMrjLbuc+rZNksHxfDNpW/WalLW395Q0iESvy0U= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB1512; 7:Erh3A0d4w3V755cFfzZXP+DCVBAHvyAgNa0fDIna2AmoKGt4ttWvx0qu6hPblnAbUuMrVcFBw/Q9cUVagK6T3fMqFhwBABnrALRXTZV1fPv7ZJ3rYnWZFTUd+2cOXxVuFqwSnb/a2PcnQMkX9h1zNAFXQQUk8Fa0h+jUi6+OKQ62SPdJhF7NQP8xjFe5bVVUXqqMq0R2MJ4QSGUVdMOop8laBxh5xde5V0iKs8vXrF7fieSBCwD2w7n4jKIBpZE4 X-MS-Office365-Filtering-Correlation-Id: da08bf70-9de5-4a88-8ff1-08d5aaadc37e X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2018 13:09:22.5276 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: da08bf70-9de5-4a88-8ff1-08d5aaadc37e 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: CY1PR07MB1512 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 When an RRQ request times out the reference is not getting decremented correctly as there are still ELS commands leftover when we flush any pending I/Os during offload: [ 281.788553] [0000:21:00.3]:[qedf_cmd_timeout:58]:4: ELS timeout, xid=0x96a. ... [ 281.788553] [0000:21:00.3]:[qedf_cmd_timeout:58]:4: ELS timeout, xid=0x96a. [ 281.788772] [0000:21:00.3]:[qedf_rrq_compl:182]:4: Entered. [ 281.788774] [0000:21:00.3]:[qedf_rrq_compl:200]:4: rrq_compl: orig io = ffffc90004c556f8, orig xid = 0x81b, rrq_xid = 0x96a, refcount=1 ... [ 331.448032] [0000:21:00.3]:[qedf_flush_els_req:1512]:4: Flushing ELS request xid=0x96a refcount=2. The fix is to call kref_put on the rrq_req in case of timeout as the timeout handler will call rrq_compl directly vs. a normal completion where it is call from els_compl. Signed-off-by: Chad Dupuis --- drivers/scsi/qedf/qedf_els.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/scsi/qedf/qedf_els.c b/drivers/scsi/qedf/qedf_els.c index 7024a2154ed1..816f693ef4a8 100644 --- a/drivers/scsi/qedf/qedf_els.c +++ b/drivers/scsi/qedf/qedf_els.c @@ -201,6 +201,14 @@ static void qedf_rrq_compl(struct qedf_els_cb_arg *cb_arg) kref_put(&orig_io_req->refcount, qedf_release_cmd); out_free: + /* + * Release a reference to the rrq request if we timed out as the + * rrq completion handler is called directly from the timeout handler + * and not from els_compl where the reference would have normally been + * released. + */ + if (rrq_req->event == QEDF_IOREQ_EV_ELS_TMO) + kref_put(&rrq_req->refcount, qedf_release_cmd); kfree(cb_arg); }