From patchwork Tue May 23 23:48:29 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: 9744475 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 8F0856037F for ; Tue, 23 May 2017 23:49:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8170C28818 for ; Tue, 23 May 2017 23:49:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7625B2885B; Tue, 23 May 2017 23:49: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 7A14028818 for ; Tue, 23 May 2017 23:49:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031934AbdEWXt5 (ORCPT ); Tue, 23 May 2017 19:49:57 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:5121 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030861AbdEWXtf (ORCPT ); Tue, 23 May 2017 19:49:35 -0400 X-IronPort-AV: E=Sophos;i="5.38,383,1491235200"; d="scan'208";a="21079235" Received: from mail-cys01nam02lp0053.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([207.46.163.53]) by ob1.hgst.iphmx.com with ESMTP; 24 May 2017 07:49:09 +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=1O/VmW549ecP42kKGTHmCLCaPnJ3494EUhw6gXdvT80=; b=ZBA5o3bsPQX7oCGn0qrsVi4f+E/kwz4bjlDX6zQmeA9IXWrmng+WdJ5ilz5ZqnC5iKJIYZCQaUBzYIab5Hp68xVZ17SsQPnqVTTTIh0F8Ezv18zJ94tZGTsWPJhtG5zYCz+FqLE6cu98aDrU7gzFPcYshsSepXNW89jLS117qPY= Received: from CY4PR04CA0040.namprd04.prod.outlook.com (10.172.133.26) by BN6PR04MB0355.namprd04.prod.outlook.com (10.173.198.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.14; Tue, 23 May 2017 23:49:07 +0000 Received: from BN3NAM04FT032.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4e::200) by CY4PR04CA0040.outlook.office365.com (2603:10b6:903:c6::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1124.9 via Frontend Transport; Tue, 23 May 2017 23:49:06 +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 BN3NAM04FT032.mail.protection.outlook.com (10.152.92.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1075.5 via Frontend Transport; Tue, 23 May 2017 23:49:04 +0000 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 B7.D1.45291.E6AC4295; Tue, 23 May 2017 16:49:02 -0700 (PDT) Received: from milsmgip12.sandisk.com (10.177.9.6) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Tue, 23 May 2017 16:48:58 -0700 X-AuditID: 0ac94369-166ac9800001b0eb-f8-5924ca6e2555 Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id E9.F2.18148.A6AC4295; Tue, 23 May 2017 16:48:58 -0700 (PDT) From: Bart Van Assche To: Nicholas Bellinger CC: , Bart Van Assche , Hannes Reinecke , "Christoph Hellwig" , Andy Grover , David Disseldorp , Subject: [PATCH 08/33] target: Fix a deadlock between the XCOPY code and iSCSI session shutdown Date: Tue, 23 May 2017 16:48:29 -0700 Message-ID: <20170523234854.21452-9-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170523234854.21452-1-bart.vanassche@sandisk.com> References: <20170523234854.21452-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHLMWRmVeSWpSXmKPExsXCddJ5kW7eKZVIg3lzhC32z3rGZPH1/3QW iwVv9rJZrFx9lMmibfUZRosFGx8xWrQufcvkwO5xf/sRJo/dNxvYPN7vu8rmsX7LVRaPzaer PT5vkgtgi+KySUnNySxLLdK3S+DKuHP3KXPBBc+KRc97WBsYf9l2MXJySAiYSGw7voyxi5GL Q0hgKZPE3IOb2CCcbYwSx8/tBspwgFVt/FIOEd/IKPFy5gdGkG42ASOJb+9nsoDYIgI6ErPu vmAHKWIW+Moo0bj3LxNIQlggXmLqwSfsIDaLgKrEm6lzwZp5BewlfnxfzAJxhrzE2S07mUFs TgEHiZV7tjGDLBYCqrn8XRlkpoTAOl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ME-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)(39860400002)(39450400003)(39410400002)(39850400002)(39400400002)(2980300002)(438002)(199003)(189002)(9170700003)(305945005)(72206003)(33646002)(356003)(1076002)(106466001)(8936002)(86362001)(50466002)(50226002)(36756003)(48376002)(575784001)(189998001)(76176999)(38730400002)(50986999)(110136004)(5660300001)(77096006)(4326008)(478600001)(47776003)(2906002)(6666003)(6916009)(5003940100001)(81166006)(2950100002)(53936002)(8676002)(54906002); DIR:OUT; SFP:1102; SCL:1; SRVR:BN6PR04MB0355; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN3NAM04FT032; 1:h8AeGx8YWYVODYYXoHABuTAjbS1paF2uSOzbKbuECqE5l/GxvcXGPSJ1RD3v+jMYmG0NsHl3wpN8Pyo6+zgDLA241AVyPkfPZvXCSrd9XugFGYhpDN7RC0Lb1Vb9iVDFdw2JYuu8uNU9eFxP+DCpzlkgJfCC6nL9ww9Swd/mHQONVW2aIzIjXaDOk9uQ0e/twsVL4dVHtxbGp9IqBdUGhUnsVPJqzE382GKp7NEGQb7zAL3d/ys6WRkCLsBOLbX246eVidgQRhzabq31BheZrIZCqqIwJL253iT28qEwx0QjOnmdTVi2niBBkzFGiBXuIJ2i0I8lCuxqJ/124vsYPLV7ypt++Pc8zxryHA6WPbPXWD7gEgRdjxRsgjhqJ5tw+VbkYpnbEEfaCfn1J1LD56w6tVVasbgxzDXcoSlVkQKBAQL2WcddYLnrZRgIAFDZlr1x4FpgUG38boZ8j4bdz9PzBaDbSm78y9ydbwt6JqHCgnJXe1r6qse/gaQr8J/CbYSC4AEcOCBMZWHZYqOCMeLe2ZQYh+T5nG5u3TnmgMc= X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN6PR04MB0355: X-MS-Office365-Filtering-Correlation-Id: 9255b78e-dd12-41f3-9475-08d4a2364c32 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081)(201702281549075); SRVR:BN6PR04MB0355; X-Microsoft-Exchange-Diagnostics: 1; BN6PR04MB0355; 3:iVgOAN++3bqafkbTgz84PXHEyywLEGhoUlWig7kNiFxTFIegUua8EEKCYI7k95uFRghHLIZOHKjPKlKX6vi3UIhY8y0+lddordcDHBBB75In/+FTb5dxCEt4fRYoRBY6HGnzxQVayDLk4erFzXpfKdRDAFR022Im4J8esKsUTvKut8EVhi3bdfMOZUlBNuWJtcRVYj7KliTC0FBH1MrOtSUJheIOXGsIZoMrt7Asdvzyeb4HhODk6wynfJR9wjYAR1ZZ2dfo/UOqNi3daCDlvZgmmztC9QzHFbiY+hIkGwundMagXtq8WvLXXmn86K73ZLCvGGhFpfqneoglZdW1009DoYLKCPorynlSsrxdVrV1HkRUHNXUYNyRPdsdflvpt/BxwCceUmxk4DmdMLfRTT5MEpK6zl59+uAyuB8VEyutVjKJVYs4DdMOSDp1OuG0jtiZ525qA5njt3suGIEkCRwpuf+ZHfH30B6XGyjZNLZ9BLAX80zkcR7lN3ird5UT6TESBR7vFdpryMKLqJPc3g== X-Microsoft-Exchange-Diagnostics: 1; BN6PR04MB0355; 25:c5alool9Dg4V8pGeTuBcFr10ukFl88ND5LEzDCGjrMN8MQJnvpXzfTVbQuqy2KtteK8l7jQla44LtYwIH2QG1jOQnurh0RJC40Pe0cYRFNYgxzX1OAYKAuSngRT/yk9Gm3+iufU9Dm9TirX9UFggGDOCxzuMli8mf4C47rY+nfdjiTfxfsR9sqqTdu8ekoHVDd2j/iPOmOjqM/1FSDCfM4TO65bNYGHUd9PEyp8Bjwy+2BnQw08nS6z8/tdbgBqPG8dWrWIuUPSISqDCKvNTHBPFS+OWPpA6yXCJq/8peeRX530Vor22p94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UriScan:(9452136761055)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(13016025)(8121501046)(13018025)(93006095)(93004095)(10201501046)(3002001)(6055026)(6041248)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(20161123564025)(6072148); SRVR:BN6PR04MB0355; BCL:0; PCL:0; RULEID:; SRVR:BN6PR04MB0355; X-Microsoft-Exchange-Diagnostics: 1; BN6PR04MB0355; 4:MwZTKN8JenO7tkZRiCLDMn2Ry3W7nMbrkmmmkzl1MEKxeDnQ2ZPlRdUpsxYKdwff2E05R1eV+Tyu5bb20i5JicKmhlTzkqga8UzbERYIMJbq6ZLUhnOwaLWnvMZkXjE0JiMGDcWGLCXlEWwml8shGo+7U8uJlbLtD/syqyiyj1Ihp/SCGMHmMx7J0iTq1qAdF/gYVTSSH1COrG6n03EkDXT2jGgTK8NNUJCzWggEXms3C2PCI05R2sP4Ziq/bYCGUnquKt5RjJ5976jvYgeotuJt3MJOJor9uxKqEG2UiWMrBvW82HJKlCIIndxiwcv930SKqWdianevgbsYoT4ZxSbbmXU155lD1Mg/AzhFhTXpSgfSoQP90+LKSCCcuT4CrENK68gGu3+LMQlaliLP4jCG6MG6acjTg29+rfsSmmuVl3Ueazbp2E40eVQgxGkyZzsoXZlq7LBnlWbK3Pa8Yh3gG2LuczKI29HycgEYhuuYn2gGH7NEVxIMXVKQnreuawtumjX53/R+jC51G+qndd4fKlfTvnaJx4jy6YiaPUdymRHjTir1w+RUU7JUhUVE2YbLCGXLdCf6w/41+KcrEYQNmf5VxLgR48rbffButJAzKZOytG3LU7Je+t4pb6P5bMaIgnshwSm+UZu0PDz2O98cwB6PxVQQOKHD+p53c967E7F1kv1JEcBxldzHoQM5PZ9Cf3NrLEgaBsVAigyK1SmiejEYsBeraWXjcedtJ2K3bGCqBsAmLJoAINV8Unh1M5KgnN3W7+RfJLy4muqlEs5B4M/5Jij8sVOZQ5NWrsTksW+ea2wdjhN1pgaa9fCI0gnnZBeatK4BymDJ2Jqkt8MepJaUwkTstHNgDwnZI9vLbMBoq2zAbOWqt2BBg6hh8iLCfNJDnyFMvJuBB/0sM5WeUsszN/sdYyyJ19OcJP E= X-Forefront-PRVS: 0316567485 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR04MB0355; 23:udDN19Dbe5dFOaQjBWFXhbGr5oi+0n05VZieSfxKx?= =?us-ascii?Q?4l0D6sMM+N1YRWpQHzItwoJXXj17XPq+5JC6kLSIiNtGjXyvHdXAUvdiys1U?= =?us-ascii?Q?dOs6r4coPztvUtt/HFYRAlzelHpIeII48UR9JhsBA+OzfEqoZ51bZkXVwPOs?= =?us-ascii?Q?BV2CkH+HFZcdhk7+qd8L02yMsiLqtGatKiGwLxmd+0XCpgXUjBqXT0twDzHs?= =?us-ascii?Q?AI1WTmLRykgS+18ncKt5hJ1aOgjMJj90cl8oApA6Grpe4DYczwOzkwWIohoo?= =?us-ascii?Q?jxxJRILN0JMWW34NH8LsBJ2dRQ4+N3wS5Vr/7GcD+6AHVwGcMJ2TNkK8lsTy?= =?us-ascii?Q?9Q32iFxX18W77wBF4nIzIvlGPpAk60d4FxwPFBqBqIHu4+Bitou/zNdMk3g3?= =?us-ascii?Q?CAEEH72GkRzQ8cqaSPMT8FlIKqKRChtOIFwbSIxNJFLXu/qYUjB95DFLtml9?= =?us-ascii?Q?g/D8szwmB4swsHvuw5oxSgJns3NrlLB4zAFJsJO+9nwlI0qxikCsCjQlyCnf?= =?us-ascii?Q?UKHi3USjx+WDBwDi3elsZKspEjuNBmAZXUhZDgikYxHssnh79LnQK6N7IB6H?= =?us-ascii?Q?jR8wpJ7rWaroX3fjK/ZoQYtaMEZa3aJnK3vXdbw57XXNpG4j9L5rjZs7bCo9?= =?us-ascii?Q?a2ztmQJHVENpRfKeDGXaq2ivMKE3uHreF5nE/AR9qZex1jlf3f5ObvEQ80Rx?= =?us-ascii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0vlI2rOX+ITvm8uNDwP2/siDghSRUo4ueFa3saUUvJxtc=; 5:owMvziNId8XakIyeAdLM074geXLPxEydbiM0DZb0iSQyXuwvnSKZG+p7chN3y9h8OvR1Cfi2iip0prEcbwkULrVMZLkZz8J7YWWl05pB3shlYn96H2z49fpUkkssEscLoFW3RyErhHIKy/RfVpPP+A==; 24:ujjq6ygnVDNBxoehSKvQ4nsUGa13QvATCOGEUhZkD7oiAAl+cnH9k1Zy2krurGFfxBsyKxLqkmVWhaIo6FHakBHZseS4TX3EFu3jMLxzA5I= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR04MB0355; 7:Olf6Yfgcqky2az/Gs3aZXBgy4d33i0Ehh8L30ulWW7S1ye/rvJ2rFY/Hl3kpNg6DRgSSUlG3M9u+pMgz6/3bSn3izV98ZTxqFh0cbBN2h0FA5dRo5n/eEpX76f9CiDnFR6za73E9VRgokH6nOJXDD+RrxzjgWQyn9nCHaUnlx0RIDO06I3KmH9ABBVlZpSkQQ7o9aXXZYh9sVwGNnEbUTcn8XBdWvmJpsu3jJuSnOyqXOD47d73Z8EzZE/qb3h1cE5RJghvZ9aRluq/gCOvYyEydYvhhUrzXLB8XKpuSPtQ9UeVvMkP7zqojBV4ws9SIasihyYiW4oao0uaroKDcyw==; 20:O2KF3YsFMgQyZ4TGnoPLbqNc4xSYwVJM23eEfPOmUJAXPjNamKHSglQEtgmJpu+qrKeY5LJsm4TWYSNeEMbTj17UdM/3lmy92EKZBLxL1sbJqaZxyBSy8eDW67jgEFSM4koZE1rLUvvjJFkU+qCvhMM8IK5MxV1+3rRhRSVUWSw= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2017 23:49:04.8118 (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: BN6PR04MB0355 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 Move the code for parsing an XCOPY command from the context of the iSCSI receiver thread to the context of the XCOPY workqueue. Keep the simple XCOPY checks in the context of the iSCSI receiver thread. Move the code for allocating and freeing struct xcopy_op from the code that parses an XCOPY command to its caller. This patch fixes the following deadlock: ====================================================== [ INFO: possible circular locking dependency detected ] 4.10.0-rc7-dbg+ #1 Not tainted ------------------------------------------------------- rmdir/13321 is trying to acquire lock: (&sess->cmdsn_mutex){+.+.+.}, at: [] iscsit_free_all_ooo_cmdsns+0x2d/0xb0 [iscsi_target_mod] but task is already holding lock: (&sb->s_type->i_mutex_key#14){++++++}, at: [] vfs_rmdir+0x50/0x140 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&sb->s_type->i_mutex_key#14){++++++}: lock_acquire+0x71/0x90 down_write+0x3f/0x70 configfs_depend_item+0x3a/0xb0 [configfs] target_depend_item+0x13/0x20 [target_core_mod] target_xcopy_locate_se_dev_e4+0xdd/0x1a0 [target_core_mod] target_do_xcopy+0x34b/0x970 [target_core_mod] __target_execute_cmd+0x22/0xa0 [target_core_mod] target_execute_cmd+0x233/0x2c0 [target_core_mod] iscsit_execute_cmd+0x208/0x270 [iscsi_target_mod] iscsit_sequence_cmd+0x10b/0x190 [iscsi_target_mod] iscsit_get_rx_pdu+0x37d/0xcd0 [iscsi_target_mod] iscsi_target_rx_thread+0x6e/0xa0 [iscsi_target_mod] kthread+0x102/0x140 ret_from_fork+0x31/0x40 -> #0 (&sess->cmdsn_mutex){+.+.+.}: __lock_acquire+0x10e6/0x1260 lock_acquire+0x71/0x90 mutex_lock_nested+0x5f/0x670 iscsit_free_all_ooo_cmdsns+0x2d/0xb0 [iscsi_target_mod] iscsit_close_session+0xac/0x200 [iscsi_target_mod] lio_tpg_close_session+0x9f/0xb0 [iscsi_target_mod] target_shutdown_sessions+0xc3/0xd0 [target_core_mod] core_tpg_del_initiator_node_acl+0x91/0x140 [target_core_mod] target_fabric_nacl_base_release+0x20/0x30 [target_core_mod] config_item_release+0x5a/0xc0 [configfs] config_item_put+0x1d/0x1f [configfs] configfs_rmdir+0x1a6/0x300 [configfs] vfs_rmdir+0xb7/0x140 do_rmdir+0x1f4/0x200 SyS_rmdir+0x11/0x20 entry_SYSCALL_64_fastpath+0x23/0xc6 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&sb->s_type->i_mutex_key#14); lock(&sess->cmdsn_mutex); lock(&sb->s_type->i_mutex_key#14); lock(&sess->cmdsn_mutex); *** DEADLOCK *** 3 locks held by rmdir/13321: #0: (sb_writers#10){.+.+.+}, at: [] mnt_want_write+0x1f/0x50 #1: (&default_group_class[depth - 1]#2/1){+.+.+.}, at: [] do_rmdir+0x15e/0x200 #2: (&sb->s_type->i_mutex_key#14){++++++}, at: [] vfs_rmdir+0x50/0x140 stack backtrace: CPU: 2 PID: 13321 Comm: rmdir Not tainted 4.10.0-rc7-dbg+ #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014 Call Trace: dump_stack+0x86/0xc3 print_circular_bug+0x1c7/0x220 __lock_acquire+0x10e6/0x1260 lock_acquire+0x71/0x90 mutex_lock_nested+0x5f/0x670 iscsit_free_all_ooo_cmdsns+0x2d/0xb0 [iscsi_target_mod] iscsit_close_session+0xac/0x200 [iscsi_target_mod] lio_tpg_close_session+0x9f/0xb0 [iscsi_target_mod] target_shutdown_sessions+0xc3/0xd0 [target_core_mod] core_tpg_del_initiator_node_acl+0x91/0x140 [target_core_mod] target_fabric_nacl_base_release+0x20/0x30 [target_core_mod] config_item_release+0x5a/0xc0 [configfs] config_item_put+0x1d/0x1f [configfs] configfs_rmdir+0x1a6/0x300 [configfs] vfs_rmdir+0xb7/0x140 do_rmdir+0x1f4/0x200 SyS_rmdir+0x11/0x20 entry_SYSCALL_64_fastpath+0x23/0xc6 Signed-off-by: Bart Van Assche Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: Andy Grover Cc: David Disseldorp Cc: --- drivers/target/target_core_xcopy.c | 110 +++++++++++++++++++++++-------------- 1 file changed, 69 insertions(+), 41 deletions(-) diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index f12cf0c12531..56738a41e346 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c @@ -40,6 +40,8 @@ static struct workqueue_struct *xcopy_wq = NULL; +static sense_reason_t target_parse_xcopy_cmd(struct xcopy_op *xop); + static int target_xcopy_gen_naa_ieee(struct se_device *dev, unsigned char *buf) { int off = 0; @@ -779,13 +781,24 @@ static int target_xcopy_write_destination( static void target_xcopy_do_work(struct work_struct *work) { struct xcopy_op *xop = container_of(work, struct xcopy_op, xop_work); - struct se_device *src_dev = xop->src_dev, *dst_dev = xop->dst_dev; struct se_cmd *ec_cmd = xop->xop_se_cmd; - sector_t src_lba = xop->src_lba, dst_lba = xop->dst_lba, end_lba; + struct se_device *src_dev, *dst_dev; + sector_t src_lba, dst_lba, end_lba; unsigned int max_sectors; - int rc; - unsigned short nolb = xop->nolb, cur_nolb, max_nolb, copied_nolb = 0; + int rc = 0; + unsigned short nolb, cur_nolb, max_nolb, copied_nolb = 0; + + if (target_parse_xcopy_cmd(xop) != TCM_NO_SENSE) + goto err_free; + if (WARN_ON_ONCE(!xop->src_dev) || WARN_ON_ONCE(!xop->dst_dev)) + goto err_free; + + src_dev = xop->src_dev; + dst_dev = xop->dst_dev; + src_lba = xop->src_lba; + dst_lba = xop->dst_lba; + nolb = xop->nolb; end_lba = src_lba + nolb; /* * Break up XCOPY I/O into hw_max_sectors sized I/O based on the @@ -853,6 +866,8 @@ static void target_xcopy_do_work(struct work_struct *work) out: xcopy_pt_undepend_remotedev(xop); + +err_free: kfree(xop); /* * Don't override an error scsi status if it has already been set @@ -865,48 +880,22 @@ static void target_xcopy_do_work(struct work_struct *work) target_complete_cmd(ec_cmd, ec_cmd->scsi_status); } -sense_reason_t target_do_xcopy(struct se_cmd *se_cmd) +/* + * Returns TCM_NO_SENSE upon success or a sense code != TCM_NO_SENSE if parsing + * fails. + */ +static sense_reason_t target_parse_xcopy_cmd(struct xcopy_op *xop) { - struct se_device *dev = se_cmd->se_dev; - struct xcopy_op *xop = NULL; + struct se_cmd *se_cmd = xop->xop_se_cmd; unsigned char *p = NULL, *seg_desc; - unsigned int list_id, list_id_usage, sdll, inline_dl, sa; + unsigned int list_id, list_id_usage, sdll, inline_dl; sense_reason_t ret = TCM_INVALID_PARAMETER_LIST; int rc; unsigned short tdll; - if (!dev->dev_attrib.emulate_3pc) { - pr_err("EXTENDED_COPY operation explicitly disabled\n"); - return TCM_UNSUPPORTED_SCSI_OPCODE; - } - - sa = se_cmd->t_task_cdb[1] & 0x1f; - if (sa != 0x00) { - pr_err("EXTENDED_COPY(LID4) not supported\n"); - return TCM_UNSUPPORTED_SCSI_OPCODE; - } - - if (se_cmd->data_length == 0) { - target_complete_cmd(se_cmd, SAM_STAT_GOOD); - return TCM_NO_SENSE; - } - if (se_cmd->data_length < XCOPY_HDR_LEN) { - pr_err("XCOPY parameter truncation: length %u < hdr_len %u\n", - se_cmd->data_length, XCOPY_HDR_LEN); - return TCM_PARAMETER_LIST_LENGTH_ERROR; - } - - xop = kzalloc(sizeof(struct xcopy_op), GFP_KERNEL); - if (!xop) { - pr_err("Unable to allocate xcopy_op\n"); - return TCM_OUT_OF_RESOURCES; - } - xop->xop_se_cmd = se_cmd; - p = transport_kmap_data_sg(se_cmd); if (!p) { pr_err("transport_kmap_data_sg() failed in target_do_xcopy\n"); - kfree(xop); return TCM_OUT_OF_RESOURCES; } @@ -975,18 +964,57 @@ sense_reason_t target_do_xcopy(struct se_cmd *se_cmd) pr_debug("XCOPY: Processed %d target descriptors, length: %u\n", rc, rc * XCOPY_TARGET_DESC_LEN); transport_kunmap_data_sg(se_cmd); - - INIT_WORK(&xop->xop_work, target_xcopy_do_work); - queue_work(xcopy_wq, &xop->xop_work); return TCM_NO_SENSE; out: if (p) transport_kunmap_data_sg(se_cmd); - kfree(xop); return ret; } +sense_reason_t target_do_xcopy(struct se_cmd *se_cmd) +{ + struct se_device *dev = se_cmd->se_dev; + struct xcopy_op *xop; + unsigned int sa; + + if (!dev->dev_attrib.emulate_3pc) { + pr_err("EXTENDED_COPY operation explicitly disabled\n"); + return TCM_UNSUPPORTED_SCSI_OPCODE; + } + + sa = se_cmd->t_task_cdb[1] & 0x1f; + if (sa != 0x00) { + pr_err("EXTENDED_COPY(LID4) not supported\n"); + return TCM_UNSUPPORTED_SCSI_OPCODE; + } + + if (se_cmd->data_length == 0) { + target_complete_cmd(se_cmd, SAM_STAT_GOOD); + return TCM_NO_SENSE; + } + if (se_cmd->data_length < XCOPY_HDR_LEN) { + pr_err("XCOPY parameter truncation: length %u < hdr_len %u\n", + se_cmd->data_length, XCOPY_HDR_LEN); + return TCM_PARAMETER_LIST_LENGTH_ERROR; + } + + xop = kzalloc(sizeof(struct xcopy_op), GFP_KERNEL); + if (!xop) + goto err; + xop->xop_se_cmd = se_cmd; + INIT_WORK(&xop->xop_work, target_xcopy_do_work); + if (WARN_ON_ONCE(!queue_work(xcopy_wq, &xop->xop_work))) + goto free; + return TCM_NO_SENSE; + +free: + kfree(xop); + +err: + return TCM_OUT_OF_RESOURCES; +} + static sense_reason_t target_rcr_operating_parameters(struct se_cmd *se_cmd) { unsigned char *p;