From patchwork Thu Feb 2 00:58:53 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: 9550929 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 E92D260236 for ; Thu, 2 Feb 2017 00:59:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3DA028456 for ; Thu, 2 Feb 2017 00:59:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C87562845B; Thu, 2 Feb 2017 00:59:33 +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 131352844A for ; Thu, 2 Feb 2017 00:59:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751338AbdBBA7c (ORCPT ); Wed, 1 Feb 2017 19:59:32 -0500 Received: from mail-bl2nam02on0075.outbound.protection.outlook.com ([104.47.38.75]:50848 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751342AbdBBA7L (ORCPT ); Wed, 1 Feb 2017 19:59:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sandiskcorp.onmicrosoft.com; s=selector1-sandisk-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=z/zAd5sWuCEJu3Y0ZrIfNiTVz7ILNpFMIyX0xRC6+VM=; b=KWO7xhCXjMDaoResOfwFBl+y1nVs8HqemTIUDfet2ORIkVAXRnAwcwxhANoz1iUo4YP4Pv/au76c+UYNAyvEcriWTcNwA2mKvBlO7jx9XKiSUF2cUIFW8Kx3T0rWDOhFin+GkySaRPwMqmsS7HgAlKLnVk2NMdeihdsJSObsslQ= Received: from BN1PR02CA0049.namprd02.prod.outlook.com (10.141.56.49) by BY2PR02MB1282.namprd02.prod.outlook.com (10.162.79.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16; Thu, 2 Feb 2017 00:59:05 +0000 Received: from BL2FFO11FD053.protection.gbl (2a01:111:f400:7c09::103) by BN1PR02CA0049.outlook.office365.com (2a01:111:e400:2a::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.874.12 via Frontend Transport; Thu, 2 Feb 2017 00:59:05 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.225) 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.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 BL2FFO11FD053.mail.protection.outlook.com (10.173.161.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.874.2 via Frontend Transport; Thu, 2 Feb 2017 00:59: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 2E.BC.01420.F0282985; Wed, 1 Feb 2017 16:49:19 -0800 (PST) Received: from milsmgip11.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; Wed, 1 Feb 2017 16:58:57 -0800 X-AuditID: 0ac94371-7ee9b9800001058c-ac-5892820f1c46 Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id 36.73.16817.15482985; Wed, 1 Feb 2017 16:58:57 -0800 (PST) From: Bart Van Assche To: Bart Van Assche CC: , Christoph Hellwig , "David Disseldorp" Subject: [PATCH v2 36/36] target: Avoid that XCOPY commands trigger a deadlock Date: Wed, 1 Feb 2017 16:58:53 -0800 Message-ID: <20170202005853.23456-37-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170202005853.23456-1-bart.vanassche@sandisk.com> References: <20170202005853.23456-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrJLMWRmVeSWpSXmKPExsXCddJ5kS5/06QIg/crrSy+/p/OYrFy9VEm i9alb5kcmD1232xg89h8utrj8ya5AOYoLpuU1JzMstQifbsEroxpB76xFLy2rnjYOYO5gXGu SRcjB4eEgInEikvMXYxcHEICS5kk3q/axtLFyAnkbGWU6FgTDGKD1My8epIFomgzULztFhtI gk3ASOLb+5lgDSICBhK/ey8wgtjMAmkS97f/ZAKxhQX8JLom/mADWcYioCLR9DgQJMwr4CAx +10TG8R8eYldbRdZQWxOoPji4zOhbrCX+PbnKNheCYFvLBK/7u1lhmgWlDg58wkLxC4JiYMv XjBDNKhLnFwyn2kCo9AsJGWzkJQtYGRaxSiWm5lTnJueWmBoolecmJeSWZytl5yfu4kREsCF Oxhf3/Y+xCjAwajEwysgMilCiDWxrLgy9xCjBAezkgivbyNQiDclsbIqtSg/vqg0J7X4EKM0 B4uSOG/r6/4IIYH0xJLU7NTUgtQimCwTB6dUA2PTAhPP1Nr/4Q3Ja4OL9lTEx63p7CsU/t5W pBq+1v17pO4E3mphHuOXpcqPEx9ULzr3anWTyNEDLnbe965Xc7hujbD4lXbtd/qxgo6ag646 eixTXIVDmwxstyn/eDpdrW+iq5hSzoL8BYeZLKTMVZ+/n9mr1c3I3iHxO09a9q6vcObSmKC5 SizFGYmGWsxFxYkA/EY1Y1wCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNJMWRmVeSWpSXmKPExsXCtZEjRTewZVKEwcolWhYHf7YxWnz9P53F YuXqo0wWrUvfMjmweOy+2cDmMW3NeSaPzaerPT5vkgtgieKySUnNySxLLdK3S+DKmHbgG0vB a+uKh50zmBsY55p0MXJySAiYSMy8epKli5GLQ0hgI6PE/62bmEESbAJGEt/ez2QBsUUEDCR+ 915gBLGZBdIkrn64xgpiCwv4SXRN/MEGYrMIqEocnvgErJ5XwEHi4uQORogF8hK72i6C1XMC xRcfh5gpJGAv8e3PUZYJjNwLGBlWMYrlZuYU56ZnFhga6hUn5qVkFmfrJefnbmIEe58zcgfj 04nmhxiZODilGhj3rHFneT9jr+PJEqaCSc88LrotPRogHxN5tv1JkDnHUvbL17ofZ7/4sVDb bKuN0uM2zvVBVv485nsr5zfa7f57u+/fazZLvVC+sx67sh6viJRmyS7PKpU3MUu4c1/r/4eL YdtzGcyW8y02ED7YKZsor7ScofubxML1GVe8fzEJ7Yi/mmZfv16JpTgj0VCLuag4EQBYChmB rgEAAA== 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:(10009020)(6009001)(7916002)(39450400003)(39860400002)(39840400002)(39410400002)(39850400002)(2980300002)(438002)(189002)(199003)(6862003)(97736004)(50226002)(53936002)(189998001)(8936002)(305945005)(356003)(7049001)(6200100001)(33646002)(626004)(8676002)(81156014)(4326007)(1076002)(2906002)(68736007)(77096006)(54906002)(38730400001)(81166006)(47776003)(92566002)(5003940100001)(50986999)(76176999)(1691005)(86362001)(36756003)(2270400002)(2950100002)(6666003)(5660300001)(48376002)(69596002)(106466001)(50466002)(110136003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR02MB1282; H:milsmgep14.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD053; 1:mBzMNyVNTPn3oyjZRWT1XODmgtS4r0RGQTbW8mBFYfhQ61Vhc3R0JdP3NBgxh2Ima1LjYdEkOWUDrFxXkinh3HTELw4uCp6XlgvAUVIei5gEzvubbQkd93fomqawZS/TGzXXdu+hkSJQX8LYhjBXUjE0atwYcBAQvqpBfC43TnajTzgAq5Hv4GXTCevtnla7RPzmxHNp9wPw8r8ACyTKcV82tR4U4Vmx49cHx3suvtdf1ccCdc9xLlyRttnREeVLcTNpO+sEtEXzvdw5vbWOC6CsmZEK10M3BzBipqJhFceaR6SOdAz/aU+QwCcdW49Nvu+RNOBt31LzSNF0LsqetJ4epIKezJmxCR0dmf/isQML2f/7kxgD2ZPfDCn+YFD84sMkHZT7dMbZ4NEskV6GrsaYevdzuwJxcWSGy2hzKq1cv6fK3vQNCep6C8z4gRD86Ng+0Cb+Sc8aD07HbMmY+TY/nwLQC1Tr821HYu0l0/Ul6eEXFnl6nW7a+7Pw+NPg X-MS-Office365-Filtering-Correlation-Id: dc96445a-a7ae-40dd-8fa9-08d44b06af75 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002); SRVR:BY2PR02MB1282; X-Microsoft-Exchange-Diagnostics: 1; BY2PR02MB1282; 3:bUUSTnsDu7UHou0k9UqjvcEf6775gRVH1rZFbKIAP7vUTUKctoJ6xT1D2X5+qQirwr6mPjhjdMD3n0Xa3cqlqApini4cFCACTqPrJDzCoFfj9ALE+BDLFj6noaUXtLorIvZZ+LIsMCGn9P5frEkB0ki3bUJ/HYsiQuhREatps46FAQ/7IELAj4S0BSx47jqCUVLFrEgGhkzpi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ivcRTGHyO3Lr/O8PH3tmciVHyWYsMROxV9xGXdfgRwK9qDAZukYRekKFZQ6mtqGI8lRwrYsWu4Hi8PWA+pQ8ZjFPkOay4cS42En5DoU0FbG+Eiu1sHy8CgQ7CkemE3BzUu5oVCL/PtCLkIQ5Yd+ApERr7638riC+bnZY7B6h9/WLJx2yjlmIY/2EJYkBgXNk0+87NJOaXli5R1ErPf9gNDBbyvq3VfmBLHTUDKA+hbzmMZI0OtxuJCQ/70DZl0z9DicZ21rCBAZ0QphntjUO4A+APrg53nnDqxSkSE6UTnEzljpjJhMQtMea+eLkIWWiEp3xSfKynaqoPMfudZWJJcm48JcjoQ7ezVNT4+UwSbV07dZmWMoSZXFXrfENwJ/GIZ58gJkOJX4ah2sJVxeBQIal/iqQGaTondsHfwqmja X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(20558992708506)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(13016025)(5005006)(13018025)(10201501046)(3002001)(6055026)(6041248)(20161123560025)(20161123562025)(20161123555025)(20161123558025)(20161123564025)(6072148); SRVR:BY2PR02MB1282; BCL:0; PCL:0; RULEID:; SRVR:BY2PR02MB1282; X-Microsoft-Exchange-Diagnostics: 1; BY2PR02MB1282; 4:CAPMu+g61A3HvNK+leNQZMPqocBVBNnI3MAQrWxVn+4NmiK8NMoBiIbWcrkzcfKP87+0LpAnUo+2uTEX2NtCWPWun1zBnOdOFMDPZ2H5luVkfkFTC6LRtuUjfx3gZ4zdbIvlulSOgQlbTOl8e4jQrAZFeYiqWzKEsWMTWUHVIbwv5re+xi/11ATpLVuIw2vLFGXhFTBBGt3uvh6H06/F7IdP2j70rfMKl2AlBAbrC12yZbg4HRn6XaQbLH65TVld9r31OsWpJQ4+G+vUYgUAv2vM3tz9+v6BTkRFRi7gjiyxtOM9k+U1BFgzMnEnsRjK06Lc+BEq6Skh5yIUUsGZ6TBift2n5D9b2wbcWorZWJYVSmndpp0HLcc5hzIYppGAkiUx2p3+dT4chpqBGmghR8k2bTchT+Hldmtg7Pbrmma/B37guK+LwmYQykC2Qc3pIN2cp0PoGVDeIkuS5Ndd5Vu/K9UcwVcly2q5TkO2V/bN3QBhGkDcjszyg6xJ2GI6ftQL6DQaTQeCmwFFLABgetyvdfRSTLQ2zvXGpYT9mzocofzRHRMjxvjSifTTRVmCGk1DVYg5c2pHlnV7CnH5yQ1AjvmrplCAqXyWlqPJYwtTX7XVBqDbERMYC82xajr+YMj5JooHLk1HatKyoEaI851KURos/ljwt85pp3aNRLHszaKJtO1CnyE+0zBfk0iYZnaObCInQ6If3k05csnXceQLv3iePaex1GKzUKrFFxLmhIEz7++oLZKNVHrdVPj9 X-Forefront-PRVS: 02065A9E77 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR02MB1282; 23:CVo9yNqy5zIfGLq/khngijQBR6nCKWWvWfdmdjxEe?= =?us-ascii?Q?K2akpjI8vChiEZHH2p3TDWDZAzq4HhYIn6nszR6RLujzCCc3mVLksH9brjbC?= =?us-ascii?Q?7dtn2l2gb027T+pJf7VFHat8vxAOnejr844wsvtmAmHcSA8VJiHGTJ2uAvO1?= =?us-ascii?Q?tFtwMx2tOprtTs4iID6SxHgCjUKDpft2mY99c+f1mDxYYxRE2wcZ6hTdEmjE?= =?us-ascii?Q?HAZzFZBgpUdOSYxK/54LN677CovoC8/DTBvW/AoR9P728TngAVtHNzrWDVnO?= =?us-ascii?Q?rSBaImsLU/zoYvSFBSckneR6rKrc7j8XemNi/081tYNCY2BgIyrXRxsS5ILg?= =?us-ascii?Q?RAN6MwijhD2NU1IiHYsivR2kfo3WG7jQWhKUNR6xeVXF2TikLIVp1GDd60zl?= =?us-ascii?Q?/BgVM3pMddkmRLmgojOmZJ7KmCF+EX8BFfbx2kB7VKAM6heeY0g1LGDjKxjZ?= =?us-ascii?Q?CaI1tjnkfd944R8LP9gJyzo56N0gx+IVtie79/rANGsyqD43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WUnC4f16Hr1Kcup2xibe39SOIUCDdcArwjmJQfjTLj0AC2lOAaCMsqx75IultH40Vl5oOsTbo7WjQf6ZGkX0dTnr6z8aDFy8ssp+sopkMT6ZP0vlsy/3YtcocvjjmWA0Wpg== X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2017 00:59:04.8098 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d; Ip=[63.163.107.225]; Helo=[milsmgep14.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR02MB1282 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: Christoph Hellwig ====================================================== [ 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: Hannes Reinecke Cc: Christoph Hellwig Cc: David Disseldorp --- drivers/target/target_core_xcopy.c | 40 ++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index 180d8d718db5..760a19c5b516 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c @@ -58,7 +58,7 @@ static int target_xcopy_locate_se_dev_e4(const unsigned char *dev_wwn, { struct se_device *se_dev; unsigned char tmp_dev_wwn[XCOPY_NAA_IEEE_REGEX_LEN]; - int rc; + int rc = -1; mutex_lock(&g_device_mutex); list_for_each_entry(se_dev, &g_device_list, g_dev_node) { @@ -73,28 +73,30 @@ static int target_xcopy_locate_se_dev_e4(const unsigned char *dev_wwn, if (rc != 0) continue; - *found_dev = se_dev; - pr_debug("XCOPY 0xe4: located se_dev: %p\n", se_dev); + target_get_device(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 (rc != 0) { + 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); + *found_dev = se_dev; + 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,