From patchwork Thu Mar 30 17:12:44 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: 9654857 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 E0B3460350 for ; Thu, 30 Mar 2017 17:12:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB8E6285BD for ; Thu, 30 Mar 2017 17:12:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C04F0285C1; Thu, 30 Mar 2017 17:12:59 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 4907F285C0 for ; Thu, 30 Mar 2017 17:12:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933157AbdC3RM7 (ORCPT ); Thu, 30 Mar 2017 13:12:59 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:16797 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933206AbdC3RM4 (ORCPT ); Thu, 30 Mar 2017 13:12:56 -0400 X-IronPort-AV: E=Sophos;i="5.36,247,1486396800"; d="scan'208";a="7351635" Received: from mail-sn1nam02lp0019.outbound.protection.outlook.com (HELO NAM02-SN1-obe.outbound.protection.outlook.com) ([216.32.180.19]) by ob1.hgst.iphmx.com with ESMTP; 31 Mar 2017 01:12:55 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector1-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=uzgUdLO1KT93Wru2mRrtyf7wgeYlQjVMFtzbtfx1hkU=; b=jpuHGQq0cF12EkRKlqmNY8XIaA/S9PpG9xgwsmZPIx3XkvF0gzm0oBzHhqQrQ8YUbFMImQxhaZUPb/HYHX/Tca8vEj3uwHkUVO2yRFEhq/CvOBQzVLEjBehBPRs85NiESKAcz74uep60jsVjfusruw2THqPVBgV0mKQVMlYlbaA= Received: from BN3PR04CA0006.namprd04.prod.outlook.com (10.166.70.144) by BLUPR04MB386.namprd04.prod.outlook.com (10.141.26.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.991.14; Thu, 30 Mar 2017 17:12:52 +0000 Received: from BN3NAM04FT009.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4e::204) by BN3PR04CA0006.outlook.office365.com (2a01:111:e400:7a4f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1005.10 via Frontend Transport; Thu, 30 Mar 2017 17:12:52 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.21 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.21; helo=milsmgep15.sandisk.com; Received: from milsmgep15.sandisk.com (63.163.107.21) by BN3NAM04FT009.mail.protection.outlook.com (10.152.92.126) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1005.5 via Frontend Transport; Thu, 30 Mar 2017 17:12:52 +0000 Received: from MILHUBIP03.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 14.BD.29323.29C3DD85; Thu, 30 Mar 2017 10:12:50 -0700 (PDT) Received: from milsmgip12.sandisk.com (10.177.9.6) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.319.2; Thu, 30 Mar 2017 10:12:48 -0700 X-AuditID: 0ac94369-548749800000728b-4d-58dd3c926386 Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 2D.29.18148.09C3DD85; Thu, 30 Mar 2017 10:12:48 -0700 (PDT) From: Bart Van Assche To: Nicholas Bellinger CC: , Bart Van Assche Subject: [PATCH 6/6] target/iscsi: Fix shutdown logic in iscsit_free_cmd() Date: Thu, 30 Mar 2017 10:12:44 -0700 Message-ID: <20170330171244.8346-7-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170330171244.8346-1-bart.vanassche@sandisk.com> References: <20170330171244.8346-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrELMWRmVeSWpSXmKPExsXCddJ5ke4km7sRBhtX6lq0rT7DaNG69C2T A5PH/e1HmDw+b5ILYIrisklJzcksSy3St0vgylhx8QxrQYtAxdMXU5gbGNfzdjFyckgImEic /ryAHcQWEljKJNGxhqOLkQvI3sYo8bLhLQtM0coHGxkhEpsZJWZ1L2cGSbAJGEl8ez8TrEhE QEdi1t0XYJOYBYIk/u3aBxYXFvCS2LzmOZjNIqAqcWvbAzCbV8BOYt7xE+wQC+QlFm2aARbn FLCXuHBtEdRFdhLv2vvYQRZLCDxnkfg8/xdUs6DEyZlPWCCWSUgcfPGCGaJBXeLkkvlMExiF ZiEpm4WkbAEj0ypGsdzMnOLc9NQCQ1O94sS8lMzibL3k/NxNjJCQzdzBePeJ9yFGAQ5GJR7e HYJ3I4RYE8uKK3MPMUpwMCuJ8HZYA4V4UxIrq1KL8uOLSnNSiw8xSnOwKInznpOZGiEkkJ5Y kpqdmlqQWgSTZeLglGpglNpxjrM2n1n0k2Cwwzx56fYEn5TL67aHXVp7t32S3PGTUSeW9fD/ zHrqm3M0btrlZKnDk9xOvT656Voob/TDeaf2pYvt9vRl2n+qQT/io3nED+56ziNstkWafmFb /j5RLE75Kecf6mIQZdnZtOH5tdt/Smb8SVYXj/N98fNp1LuEbYkbNrtEKLEUZyQaajEXFScC AP3oqy1VAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprEJMWRmVeSWpSXmKPExsXCtZEjRXeCzd0Ig5XH5SwO/mxjtGhbfYbR onXpWyYHZo/7248weUxbc57J4/MmuQDmKC6blNSczLLUIn27BK6MFRfPsBa0CFQ8fTGFuYFx PW8XIyeHhICJxMoHGxm7GLk4hAQ2MkrcmrKBBSTBJmAk8e39TDBbREBHYtbdF+wgNrNAgMSx WS1MILawgJfE5jXPwWpYBFQlbm17AGbzCthJTD9+nxFigbzEok0zwOKcAvYSF64tApsjBFTz rr2PfQIj9wJGhlWMYrmZOcW56ZkFhkZ6xYl5KZnF2XrJ+bmbGMG+5ozawXh9ovkhRiYOTqkG xjpzwdPBSi65xmx5v5lYcj/N4T++dn5ewFuzj1ONV+neliiYUlD7fd/Lj0UpU5XvP/b1Wr0r 3O7HsarLko9WaVx4afaAbdWV2fveHTu/9eN8u4ksa988495Yq60x31rQqf7JJj6dBKm/TAVp 8/IFTk+++vbtxTPmzy9lajreZVNMePrzw00vWR4lluKMREMt5qLiRAC2Og8upQEAAA== MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(39840400002)(39400400002)(39410400002)(39860400002)(39850400002)(39450400003)(2980300002)(438002)(189002)(199003)(9170700003)(53936002)(77096006)(54906002)(50986999)(76176999)(4326008)(305945005)(106466001)(5003940100001)(50226002)(189998001)(8936002)(356003)(38730400002)(107886003)(110136004)(1076002)(33646002)(5660300001)(8676002)(2950100002)(6916009)(6666003)(2906002)(48376002)(81166006)(47776003)(36756003)(50466002)(86362001); DIR:OUT; SFP:1102; SCL:1; SRVR:BLUPR04MB386; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN3NAM04FT009; 1:fOWivoqAAFhbmQqQH1bW3AveSchFzM7BBRCiU2zlUGmUU+3pmN3jgAE1J8Ef/x+t8aZJUrLpqMSxAe0SJIozsTu6xHecEo9dRXDZF+cW0EqkXmxNk88pA7oNBQRiA1vE4Cyly/750X9TLa1bbAudEOXPhRwj/EsZxzcn2kam/XKvxhac9/5xcRHpiJ1xrTj335xbeyNB0FN4nwDfsrm+ZZ8wduENRAMZzmZCFITJiBLuTcAHUvEqgb6H4D1dd1T4AVA89GacN09mCT3ZXYx9BSVhDWINaz7WcQ8TwbMT0Xlp+THadS57zhYV0yuezOVebsjS09uuyyKeZlnqcE95aNkjbblTjLQzxUna9FuZpj5NNyEW7EQzSPpa/HSkuUCsTPo3fbv6XKSj8GOJ7Au5Chw6PbFKC2BMzSV5mo09I7GeQmL6UZRir1gVhSnUkGM2C4+aJrcBPy7rOamanLZHrw5a//M7bjs6DDL0+1UI5oX0m5hPLlQvVZYjEjFJeB6E1DIxyOKE5EOFRdWK5730WucAhPRymp3w/X5+b8xDYRs= X-MS-Office365-Filtering-Correlation-Id: 0f0ced88-c883-4b3d-cc2e-08d47790000b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081); SRVR:BLUPR04MB386; X-Microsoft-Exchange-Diagnostics: 1; BLUPR04MB386; 3:FVTCTqLstwioloHYxEMM5LXEF9RfZv48d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9VzSJDG4H4PBw27Plsxa/BSqlRxY02KUwdoSSag/Ma7Z096so3i74IDn7XSOAUTK+JVMC/hepg9Okr1oF1/jq8MqDx3VP4iRsysNOK4vNtbue/nx6aPdE/g9q2p2g4t3P3Y5bF4p60bsMWnn6oud7o0FyT7fiyYNeB6BRhwU/9liobBhoCpqZg== WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Exchange-Diagnostics: 1; BLUPR04MB386; 20:RaoUVdSiNQJyggp0wPQz9l8k1VBYEAfP3S5dhMwM3X1HXopoS4Xrk25AnVjD/Jih0TULO2JaL6XKvDv1f4T5twKGyfsH7OpDDQSceLjoaAc7qhHv9mQb+XDvGJJj26N2Iu4Qn8CFT0gJGpQZw2vLhaK7fJDHaMFdC2zM020SQ7sz5uEJrxR6JzARgRtJzQqlCVfnKdrnP1nxBEaRM91F0CvQH4q/Rk/8ECpOzxeIHaJhjj5phbxIPPSaE7mdr3cqcH4dkK7i/yv5yupQ1RPkNKcm3TSTzC3j61O35ELyccf8SayLfDzw+eMWsnONl95NCtPFbI5PHDCeNWVib/qsQX7Bm3Sjr2i/EBDM09m8G8e9EBWZz6sYYyFyvpRf+pWOEV7VMF97BtebOt94T/ZIr+ZJgnntONRiQ0XdO2XeFxtxJABRRdKKfQWuhwJYYkQxvzU/LYZRKFAuOGMRihTKb0BiSsbQBbI0W1zCGdB2QmX/MvSP9s7aubbNiR26aZdQ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569)(17755550239193); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(13018025)(13016025)(5005006)(3002001)(10201501046)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(20161123564025)(20161123560025)(20161123562025)(20161123555025)(6072148); SRVR:BLUPR04MB386; BCL:0; PCL:0; RULEID:; SRVR:BLUPR04MB386; X-Microsoft-Exchange-Diagnostics: 1; BLUPR04MB386; 4:m/8CVAnywDQisjQ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9vHuiS7TYd9xCpcVdkfuN4WSI3P+CX+L3?= =?us-ascii?Q?mFn14=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR04MB386; 6:ehHIotttCwih20nbhSFRwwZHonz6dKqGbBhW1V1x4gMyli2f6xiksNQCzlYPDGB224bHSFlqQFJzrF1cNsHC799oVr10N3Xgs7sShRiTSljORw1wjFYVxUdjiVQMesHXhByqPFrXWVnq1b68Y5bmm6fbOfR18k1CV7bkmnnzFQhuMkFReTUNhVJoGxFSRzWL9DLsHObDxbSVt5lZwasNYEuiNf44VZp/8QcYUEmiqJQPtAjQKLuqTii30+zLqWzQWJilUNKjZpMX3CBv2i5StVy2LF94GVwGkpc8VkS7t3J9HSq/ZjIfRwXhigwUkcMprPmzcjc+VncCLr81s6lPDyuJ/ES8hatcQcGKh6ueU6FkK4OhekUF1vkOkVjLV/2e12nGeXE++9XGApoXckf+09M7uHMFIDAxcmyctkATQL8=; 5:pC45/iH0ORv4BOTxF2LB2YdCCmuLas+kwribnvhILP7sDNjF9Wq5q46fiwM4EfnJQ8kFuyIs4YNWv5HQ8LU9lBS82sI73MaCEFUerxH8e/qYSO7jKyoiUDb0sriPvZ1Md1Xxq6cgiQE3HhMfR5xnTQ==; 24:UOK6650LriwKEa3bZNkTO9yesAGSZqb/STnh04ON8ZNTsf4nwkhsVQiNzeVhz3hiod8qRRnGYt9IPmhk/eub60PyG3ofuYzRdSMFd+3lAxk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR04MB386; 7:y8unmP1s7INJeWGNO/k4RGOpH1iaM7l57eyz+PfnMDd1D6Gc2h1M35y+vOpODnrQjNIaQ4TXdIw7FFHd6sVEQU1GHhuB1wwBq77FXXeFxHALPslp+gsxMXv91DsCDbDtCOZ4jRz3b3uN6/wjpe3ZdVZiFt2noGx0BttSiOvyGqAfpT1nKDzgV6RfLIXVNwTexgp6dmbFfCqvZhfxdxsru4l8nzwkOZCDnirtrPlE1YyDhiTwsCnaKAbrErcSxFz5OljWfUmsppP/tJdE8Tmj1Ag2mLxdMiIVu05VupwOUfVqu6bgdZ3iq4AyaNph3M36TGk5qFVJZusMt2drkNhXaw==; 20:meGSU6zx05d34jmJ9+1dSkdNhJzm6AB18z9hKQvmr4/cRubv9CtuyPrppd7fVbjwauOdnDBHVu92hKaJNHDGoshKoL1Rue2h7Iz1x18gj5eD1GLak5eBX+1UtEEIN1PG8/lPjRrmDt6lNDYOTER9b4xAJcyNZm19l3SAJJgbe60= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2017 17:12:52.2882 (UTC) X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=b61c8803-16f3-4c35-9b17-6f65f441df86; Ip=[63.163.107.21]; Helo=[milsmgep15.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR04MB386 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 The approach in the iSCSI target driver with regard to command reference counting is as follows: - When a command or TMF is submitted to the LIO core, target_get_sess_cmd() is called with the second argument set to true such that cmd_kref is initialized to two. - During regular execution of a command target_put_sess_cmd() is called once. However, if a connection is shut down it is not sure that target_put_sess_cmd() has already been called. - If the 'shutdown' argument of iscsit_free_cmd() is true, this function is responsible for calling target_put_sess_cmd() if that has not yet happened before that function was called. Since it is not possible to determine whether or not target_put_sess_cmd() has already been called by examining the CMD_T_ABORTED flag and cmd_kref only (e.g. if a LUN RESET is in progress concurrently with iscsit_free_cmd()), use the refcount that was introduced by the previous patch to figure out whether or not target_put_sess_cmd() has to be called from inside iscsit_free_cmd(). Signed-off-by: Bart Van Assche --- drivers/target/iscsi/iscsi_target_util.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index 1cacfe1003e3..04c7356e4402 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c @@ -770,12 +770,11 @@ void __iscsit_free_cmd(struct iscsi_cmd *cmd, bool check_queues) void iscsit_free_cmd(struct iscsi_cmd *cmd, bool shutdown) { struct se_cmd *se_cmd = cmd->se_cmd.se_tfo ? &cmd->se_cmd : NULL; - int rc; __iscsit_free_cmd(cmd, shutdown); if (se_cmd) { - rc = transport_generic_free_cmd(&cmd->se_cmd, shutdown); - if (!rc && shutdown && se_cmd && se_cmd->se_sess) { + transport_generic_free_cmd(&cmd->se_cmd, shutdown); + if (shutdown && atomic_read(&cmd->refcnt)) { __iscsit_free_cmd(cmd, shutdown); iscsit_put_cmd(cmd); }