From patchwork Tue May 23 23:48:32 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: 9744437 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 66CB36037F for ; Tue, 23 May 2017 23:49:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 599B328818 for ; Tue, 23 May 2017 23:49:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E4DE2885B; Tue, 23 May 2017 23:49:28 +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 7E85B28818 for ; Tue, 23 May 2017 23:49:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968633AbdEWXt0 (ORCPT ); Tue, 23 May 2017 19:49:26 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:17952 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1765537AbdEWXtI (ORCPT ); Tue, 23 May 2017 19:49:08 -0400 X-IronPort-AV: E=Sophos;i="5.38,383,1491235200"; d="scan'208";a="21079201" Received: from mail-cys01nam02lp0054.outbound.protection.outlook.com (HELO NAM02-CY1-obe.outbound.protection.outlook.com) ([207.46.163.54]) by ob1.hgst.iphmx.com with ESMTP; 24 May 2017 07:49:07 +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=Jo01Yt6wbX9Sv0p4yY+HwiKWY99QBpgcaqX/+M8ae8U=; b=RMgFyH+AvR6FIFAF+n3S5Fn2i4QfyhgYijez+tDX1AMr9yS76dVdYEAkU2o8cKqJc/i9sT0mEM4J90iRjxfPyjyH0/b2VTplBIqHGApBq/ep4d5M8qmWnErcoZ8vmfLNpClk9aEf8641RxVdlmTiDcp+4ed0HSjccojFweEda1Q= Received: from BN6PR04CA0009.namprd04.prod.outlook.com (10.172.194.19) by MWHPR04MB0513.namprd04.prod.outlook.com (10.173.49.14) 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:05 +0000 Received: from CO1NAM04FT041.eop-NAM04.prod.protection.outlook.com (2a01:111:f400:7e4d::201) by BN6PR04CA0009.outlook.office365.com (2603:10b6:404:cb::19) 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:03 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.225) smtp.mailfrom=sandisk.com; linux-iscsi.org; dkim=none (message not signed) header.d=none;linux-iscsi.org; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.225 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.225; helo=milsmgep14.sandisk.com; Received: from milsmgep14.sandisk.com (63.163.107.225) by CO1NAM04FT041.mail.protection.outlook.com (10.152.91.18) 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:02 +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 4C.64.19026.D6AC4295; Tue, 23 May 2017 16:49:02 -0700 (PDT) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.319.2; Tue, 23 May 2017 16:48:58 -0700 X-AuditID: 0ac94371-41ba798000004a52-06-5924ca6dc97b Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 5B.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 , "David Disseldorp" Subject: [PATCH 11/33] target: Avoid that parsing an XCOPY command triggers a deadlock Date: Tue, 23 May 2017 16:48:32 -0700 Message-ID: <20170523234854.21452-12-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+NgFrrGLMWRmVeSWpSXmKPExsXCddJ5kW7eKZVIg6mzuSy+/p/OYrHgzV42 i7bVZxgtWpe+ZXJg8bi//QiTx/otV1k8Np+u9vi8SS6AJYrLJiU1J7MstUjfLoEr40n7Q5aC p7YVLX1XGRsYf5l2MXJySAiYSCx/NIm1i5GLQ0hgKZPEuX9X2CGcHYwS73o3sMNU9S06wQKR 2MgocXTxThaQBJuAkcS39zPBbBEBHYlZd1+AdTMLTGeU2Ny+iRUkISwQJvF9wwE2EJtFQFVi 9+d1YFN5BRwkenYehNogL3F2y05mEJsTKL5yzzYgmwNom73E5e/KIDMlBNpYJW4/OcsE0Sso cXLmE7DFzAISEgdfvADrFRJQlzi5ZD7TBEahWUjKZiEpW8DItIpRLDczpzg3PbXA0ESvODEv JbM4Wy85P3cTIyS0C3cwvr7tfYhRgINRiYc3wUElUog1say4MvcQowQHs5II7/INQCHelMTK qtSi/Pii0pzU4kOM0hwsSuK8WbJTI4QE0hNLUrNTUwtSi2CyTBycUg2MCTnzilYbi5/4VlT8 +UdKgHlLgIKkoHdr0kSZtRLVVzPzA7qb5lhk9WzyMRDO7J9m7S/h9n/zUmvVGRueVvM2Rkms 5/YIK4xo1DxYVKpYdlL74a5t13ZFeLS//rk811Egp7jhPkfgjV9/2BUP3TnBzbNqB/fV43dM Qhp3p2t17rWy+Vry6YMSS3FGoqEWc1FxIgC5C1WSaQIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKJMWRmVeSWpSXmKPExsXCtZGTTTfrlEqkwa1PchYHf7YxWnz9P53F YsGbvWwWbavPMFq0Ln3L5MDqcX/7ESaPaWvOM3ms33KVxWPz6WqPz5vkAlijuGxSUnMyy1KL 9O0SuDKetD9kKXhqW9HSd5WxgfGXaRcjJ4eEgIlE36ITLF2MXBxCAusZJSb8mMsGkmATMJL4 9n4mC4gtIqAjMevuC3aQImaB6YwSp87uAEsIC4RJfN9wAKyBRUBVYvfndewgNq+Ag8Tiiw9Y ITbIS5zdspMZxOYEiq/csw3I5gDaZi9x+bvyBEbuBYwMqxjFcjNzinPTMwsMjfSKE/NSMouz 9ZLzczcxQgIiagfj9YnmhxiZODilGhh3ex+VV35cobxne33Ckr4Vt+8uDHXoD1QO+PY8JuSL +qoNEwWP+2YX1mbW9Ts/Dz5r3af7XuaKjdyRstP/9fc8s/Pc+3++pKUoD1dijYNv076PHBc+ 8nGkyRw795Hxrobb7ZzuF8zy31NrKkwM7ujuieyVad1xdY/rGdvwM+ul5eb//XQmyFWJpTgj 0VCLuag4EQBkay7DuAEAAA== MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.225; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(39840400002)(39450400003)(39860400002)(39400400002)(39410400002)(39850400002)(2980300002)(438002)(199003)(189002)(9170700003)(189998001)(47776003)(5003940100001)(2906002)(305945005)(4326008)(77096006)(36756003)(72206003)(54906002)(478600001)(6916009)(50466002)(33646002)(53936002)(38730400002)(106466001)(110136004)(5660300001)(86362001)(2950100002)(8936002)(356003)(1076002)(8676002)(50226002)(50986999)(6666003)(76176999)(48376002)(81166006); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR04MB0513; H:milsmgep14.sandisk.com; FPR:; SPF:Pass; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM04FT041; 1:IKMLOraNZkh6eKl0Z34dslRt5tsiVhRt6TS/T1a3WHXUhAoL8QiTyuN1l5WbX6qlo7psKEZESWJXTmwFa9d2+/en1zQAz2jAYaaEQ6xGSl2GwOGpo5y2q8KfxTHKH9TvFGzWzYZ3tIn2X1NPJ8zs+bid0YAOJXLcjsDIVBjh8tJ/erATinW6S/bzFAR4IiBOG0eGp/AeNAdjwloob3v6S4cM1//SvsBlHStzxkD9S/9far/MziJi31fuI/ms8R+vQOW/LqcpocKf9T5RH1zdqeZz00A177qI7p17kKKwNwg3HThNhQQ9cqLBmItRqIiNlHIaaRGQ9VdYJg6D+SKiHzqHpW+WDqrwDjfX7JpcJTWvdrTYHY/qiGYQUEvA2IC6X4MVKhrAHZbX7tLLV3yEHN/ITd5VmlEU7uWx6HXbAXis4D2ToZgY/sy1tBP1iBGO5mY8KZh6vioaBjfYrAKpfo4BJOueVoXUj3YvwFv8FPH9PqoBv2Z8RMXVRT+1VrLp X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR04MB0513: X-MS-Office365-Filtering-Correlation-Id: 5b0e9d98-6653-402f-099c-08d4a2364ab8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133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iJDP+1GircCCI4a0=; 31:vJt8gZ1d7uUnQtfq7/LrAQPapx0JA9+Vjb7FWxcD9fI03x6JLBEwvqbv7iSpzPqG55Hq6JZ/A7RSwaZiOH13LNrzSeW7wbHjFazRty8DKysxS4SXIjKgQh/14Cekgq7WwL1z6vbXuE4bLh9DKhIR+0bvbcQ5JxmeitKE9uTlViN2XUtWBzz4wFjaFUa/LVuxutT2Yn9I5wuiEFvxcHwN1zqVTeVrVpUgbjGs/eVHjvryLh91Li8xwyGkZyQA0Mf6 WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Exchange-Diagnostics: 1; MWHPR04MB0513; 20:AG4qD3bFKvEZUsUdPUXCczz+7OdgYT9yRJB4P2HnhqtJCXDLdvQlIqSeuChoyCluuc/XTRIBzPu4U10/QeG3WyKmRgG4dGFk8Gb0IjllWiRuUvdj1WO++aE6EWmh2dANdqDxADyEk65cUb+t04O1L2zOTIQl94TeK6UtcPY0cujmHHB2NYp2QvBVuix5sTzDJLL520MIb3UNQo/ZjNSorAYiBqgq0iHn4ApPbiIfpcjBJJkHokQWsPEdsHJl9hQ2ru1KHpPP+k5m1YCZsJ41jmDGxxBx8871nLe4OwE2ixEXFfHPjltwmG1WjFdSfcghhxq7kEfvnR+lWcTpjTwp14fYngEYcKY0lbXE6JNnnkzVXsCb6hUzj55Sx/hUKk+VWlG3k7fTodsK6OgvHu4JQxu8SAedSr8CG4/YaKOvVBohfwTtnpSIKO9UN6Ux5iJ4rUc2gXNTuaT4W5IWpRaSgXMZscCRuggXhtc4jOk6E0y5iDrHtJG/fbdvkFxSTYsO X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(20558992708506)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(13016025)(13018025)(8121501046)(93006095)(93004095)(3002001)(10201501046)(6055026)(6041248)(20161123555025)(20161123560025)(20161123564025)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148); SRVR:MWHPR04MB0513; BCL:0; PCL:0; RULEID:; SRVR:MWHPR04MB0513; X-Microsoft-Exchange-Diagnostics: 1; MWHPR04MB0513; 4:Z6avO9m07J/4qrd8PB2al/bakIpruF4b8WpzoHpbHfQC0A2bfA8anLRqfOUjPRl8tXm6AuuWSWL3uDCFJYlD6m+luPsQpDS684wgDsw0E9kG9Bk8JqrZycbveXUGIpIO4FwmJq9ARKzi0zJRFIr6Sp+L5Umn4w/0F7H69OVKNLfZCqVmh5hjoYBGve9x8Eyx1xcPGN2kmm+ERe8TqSeKh3gWw1E0vTJWaB34vNpllURN5+JI4NdWDtLDtm8OXrkbil8aF9Wymi7zQiPX08pRmHu2ZZOxy2+9Z1kFF5cx14HXgZ515Fb5kdRfI+gdpfnCB9c4zAIN3tDdc6O+7RGra8EoyPQRNwB89UjhTBc0vR37PwiDpUahAdGEStv7pmZmisCA9WH0MIh3deKniJkb8Y/J/A2ElFg/dXF9qwt2Me7yftZlm2ZMBBd4VUy4pM0++8PdZvGYl+j3OV6/FBge68bpRFXJTmLNaB9lcApyk0xCCgQRDqeLBxNwUj1VjZtnOiwL9WWFSc4DmtOfSD96XMqx2cRuKd2ATcyJ5MloYcTYLx/C3tbGW99ojQUtNupMbSOH4s2enaM0VfbPv17wSWsOWMP2oTTc9JprfXrCCx0bV+8VnWSkCogUE1k6vYxdi7a7oBTLsRnx3JAxgufh3OYIxOhgHVzDzLsYaPASrhSCIcMOzYKWatzF8mh2U04tQsnVAZjDeE39B9NGBQ15P58ADwAhdRP3jhxxu8VpxOUAnR0t+0nb35Wm5BXBhAbVx4ZdG3RDFoVWTWE1/g7BJi49PUfNZMD4Fkq3i8hC8CWloyhA/n0n0PpwrsNmnpHs03xYN8q6HsftyJid4chYNDoMhyB7zenGqZtk/0psecxS3wTBWVMnx7C6Q2jhIOs42n8m8JYyrXV1hwfkQ5nBZrlydA2GGmsNyDR2cG/zk+ Y= X-Forefront-PRVS: 0316567485 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR04MB0513; 23:k5MD++wXyl68D22pN6bEg7UQci68ShGn+/NqaFaJi?= =?us-ascii?Q?hpL2VwoB/FC70afS4M+/tDWfhRIx2nUkRjF0ONDZYn44+rqVKGroeEfYiYT8?= =?us-ascii?Q?jRG6jDFmLIzfEr9HntoBdgthIiEOUgaDFZv2ySjI+9Ff62YhS9bWFF6/vwbz?= =?us-ascii?Q?w5MFQ1lBG1uR93T8tD8/jM4N3jTUCBcxUfIjX0BPZ66at4bhYaCr0GpI1767?= =?us-ascii?Q?oJ5uhgk0IaCHodMzOGSao0e2mGEwhtxfRTdhFBDEHClBjmUrE8pAZyBzRJ7F?= =?us-ascii?Q?YljX/TRZ+Sgv17BUAVVeAPJled7HSEi7dLGabRgWidgp4hUE3MDLCjG93KyP?= =?us-ascii?Q?9t5MNxm3UW3+mUgTMbu3+kYvsn5yU4wQ7/9tf7spiJyUupmPPey8ShOKMzr6?= =?us-ascii?Q?ircTOdgMCg5JZrruHj12j77M4kGR6p42PWqZM+fzAHdou1+VQDO+6CoUYLoq?= =?us-ascii?Q?CsIthXCXN2dAks/4fy8qgwfQ3B8OEPNpI37IBMwsCymmwDj0NFCguMC2aEev?= =?us-ascii?Q?RRwWahPSOOQCxA/qRr6SINre4sOeK4tXNRWrWPD/YMrKJz1N5oZrIek6840e?= =?us-ascii?Q?cNmzXPH6kafKH8DH1g5igs82cFXic+T72uCbzXcJXsmsdl9Ku0QRsv75LfmN?= =?us-ascii?Q?ndTh2AGsMttCuqyUaRYha/V2EKlaOcJ3lhPN0BYLPsQ9BHobxHYWkTCbRqx9?= =?us-ascii?Q?uGUzmci7feOVxZ7cL3Yfh5eeWsFNUAIE1nJv5yGLJoP4Xe8R0B21KcMjuCyJ?= =?us-ascii?Q?3wefYN8s1HK4uDhJclXmPPkrJrtA93F2A16w1WJCnTAeoLrbAFSvknANg1ix?= =?us-ascii?Q?Hfqcz0wTPKJ6zT2191PbIpeS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w==; 24:TcM2eKCEfe2dFw1oxhyeUNPjoC5bXN4mb9ePnyJz7m18KPVxbtyWuf1POTB/8vs8UIXeQ7hcsel1dniSOLxNTvAhNQO3llbrczvoBenjlpw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR04MB0513; 7:QrQ35ldlFoRdta1+c3XB4hgvmGzBg2OXUuuWqlAsTXrwSDxj4GAdM5imv2/Pbp8c0wcXgt2li9MkycFfGlidWl/0O71k5Sbv6e2V8w1mVwBY/lGEpRC5taME9oJZHtZ1k+GnxqoUxa+cbgbWZFB34KYNs+Fo1y2VZT79lBRlxLmLmZZGsMmZS381D9xnQu/y1yJcQJ1clCayfqCyLWAWdnbsWHAvwKQYjP1vZhrYZc11UQtM2PEGWCh9JrgJ33FlbYLo5VpYf3/mr47Kz7wK2Gs52/jtAtnmoA3k4uIi2QuXvNvtX/cs5glC2Ks06MBMwZfXQ2p9MDVBZEEl+P6t9A==; 20:1GyilenES5nCeqTpwAV52sIVtKK+M63e3aKDR81V2560V8q9CXUPLenS7+VexFU6a2BUKDQbC1F627M/AVX/lF/dOa9i8oFXoTIxRomIp84axK/8v/rhwHPSqD4eVgDDpLPB2eo6/f3qOMFuFk2VmtoOJmGznyjBgCQaBO4YxUA= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2017 23:49:02.8778 (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.225]; Helo=[milsmgep14.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR04MB0513 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 target_depend_item() call out of the critical section. This patch avoids that lockdep reports the following: Reviewed-by: Mike Christie ====================================================== [ INFO: possible circular locking dependency detected ] 4.10.0-rc4-debug+ #1 Not tainted ------------------------------------------------------- rmdir/1799 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#15){++++++}, at: [] vfs_rmdir+0x50/0x140 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&sb->s_type->i_mutex_key#15){++++++}: [] 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+0xdb/0x1a0 [target_core_mod] [] target_do_xcopy+0x31c/0x8b0 [target_core_mod] [] __target_execute_cmd+0x22/0xa0 [target_core_mod] [] target_execute_cmd.part.20+0x1e9/0x290 [target_core_mod] [] target_execute_cmd+0x13/0x20 [target_core_mod] [] iscsit_execute_cmd+0x1d2/0x230 [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 -> #1 (g_device_mutex){+.+...}: [] lock_acquire+0x71/0x90 [] mutex_lock_nested+0x5f/0x670 [] target_xcopy_locate_se_dev_e4+0x23/0x1a0 [target_core_mod] [] target_do_xcopy+0x31c/0x8b0 [target_core_mod] [] __target_execute_cmd+0x22/0xa0 [target_core_mod] [] target_execute_cmd.part.20+0x1e9/0x290 [target_core_mod] [] target_execute_cmd+0x13/0x20 [target_core_mod] [] iscsit_execute_cmd+0x1d2/0x230 [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: Chain exists of: &sess->cmdsn_mutex --> g_device_mutex --> &sb->s_type->i_mutex_key#15 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&sb->s_type->i_mutex_key#15); lock(g_device_mutex); lock(&sb->s_type->i_mutex_key#15); lock(&sess->cmdsn_mutex); *** DEADLOCK *** 3 locks held by rmdir/1799: #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#15){++++++}, at: [] vfs_rmdir+0x50/0x140 stack backtrace: CPU: 1 PID: 1799 Comm: rmdir Not tainted 4.10.0-rc4-debug+ #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.1-0-gb3ef39f-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 Reviewed-by: Christoph Hellwig Cc: Hannes Reinecke Cc: David Disseldorp --- drivers/target/target_core_xcopy.c | 43 ++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index 56738a41e346..27414ab01b24 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c @@ -62,6 +62,8 @@ static int target_xcopy_locate_se_dev_e4(const unsigned char *dev_wwn, unsigned char tmp_dev_wwn[XCOPY_NAA_IEEE_REGEX_LEN]; int rc; + *found_dev = NULL; + mutex_lock(&g_device_mutex); list_for_each_entry(se_dev, &g_device_list, g_dev_node) { @@ -71,32 +73,33 @@ static int target_xcopy_locate_se_dev_e4(const unsigned char *dev_wwn, memset(&tmp_dev_wwn[0], 0, XCOPY_NAA_IEEE_REGEX_LEN); target_xcopy_gen_naa_ieee(se_dev, &tmp_dev_wwn[0]); - rc = memcmp(&tmp_dev_wwn[0], dev_wwn, XCOPY_NAA_IEEE_REGEX_LEN); - if (rc != 0) + if (memcmp(&tmp_dev_wwn[0], dev_wwn, XCOPY_NAA_IEEE_REGEX_LEN)) continue; - *found_dev = se_dev; - pr_debug("XCOPY 0xe4: located se_dev: %p\n", se_dev); + if (target_get_device(se_dev)) + *found_dev = se_dev; + break; + } + mutex_unlock(&g_device_mutex); - rc = target_depend_item(&se_dev->dev_group.cg_item); - if (rc != 0) { - pr_err("configfs_depend_item attempt failed:" - " %d for se_dev: %p\n", rc, se_dev); - mutex_unlock(&g_device_mutex); - return rc; - } + if (*found_dev == NULL) { + pr_debug_ratelimited("Unable to locate 0xe4 descriptor for EXTENDED_COPY\n"); + return -EINVAL; + } - pr_debug("Called configfs_depend_item for se_dev: %p" - " se_dev->se_dev_group: %p\n", se_dev, - &se_dev->dev_group); + pr_debug("XCOPY 0xe4: located se_dev: %p\n", se_dev); - mutex_unlock(&g_device_mutex); - return 0; - } - mutex_unlock(&g_device_mutex); + rc = target_depend_item(&se_dev->dev_group.cg_item); + if (rc != 0) + pr_err("configfs_depend_item attempt failed: %d for se_dev: %p\n", + rc, se_dev); + else + pr_debug("Called configfs_depend_item for se_dev: %p se_dev->se_dev_group: %p\n", + se_dev, &se_dev->dev_group); - pr_debug_ratelimited("Unable to locate 0xe4 descriptor for EXTENDED_COPY\n"); - return -EINVAL; + target_put_device(se_dev); + + return rc; } static int target_xcopy_parse_tiddesc_e4(struct se_cmd *se_cmd, struct xcopy_op *xop,