From patchwork Wed Feb 15 00:25:54 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: 9573083 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 B928A6045F for ; Wed, 15 Feb 2017 00:26:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD023283F4 for ; Wed, 15 Feb 2017 00:26:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A21CB2842B; Wed, 15 Feb 2017 00:26:47 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 51B5C283F4 for ; Wed, 15 Feb 2017 00:26:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750816AbdBOA0q (ORCPT ); Tue, 14 Feb 2017 19:26:46 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:17288 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750930AbdBOA0o (ORCPT ); Tue, 14 Feb 2017 19:26:44 -0500 X-IronPort-AV: E=Sophos;i="5.33,348,1477929600"; d="scan'208";a="86867831" Received: from unknown (HELO milsmgep15.sandisk.com) ([63.163.107.21]) by ob1.hgst.iphmx.com with ESMTP; 15 Feb 2017 08:26:20 +0800 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 4B.E4.57638.C20A3A85; Tue, 14 Feb 2017 16:26:20 -0800 (PST) Received: from milsmgip11.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Tue, 14 Feb 2017 16:26:15 -0800 X-AuditID: 0ac94369-26dee9800001e126-74-58a3a02c4d74 Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id CC.7D.11415.720A3A85; Tue, 14 Feb 2017 16:26:15 -0800 (PST) From: Bart Van Assche To: "Nicholas A . Bellinger" CC: , Bart Van Assche , Hannes Reinecke , Christoph Hellwig , David Disseldorp , Subject: [PATCH v6 15/33] target: Avoid circular waits between LUN resets Date: Tue, 14 Feb 2017 16:25:54 -0800 Message-ID: <20170215002612.14566-16-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170215002612.14566-1-bart.vanassche@sandisk.com> References: <20170215002612.14566-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrILMWRmVeSWpSXmKPExsXCddJ5ka7OgsURBh8Pq1t8/T+dxWLBm71s FitXH2WyaFt9htFiwcZHjBatS98yObB53N9+hMlj980GNo/1W66yeGw+Xe3xeZNcAGsUl01K ak5mWWqRvl0CV8a9BUYFF7kqvt1YxdbA+Jyji5GTQ0LARGJb03TGLkYuDiGBpUwSvy7dZIZw djBK9C/sBMpwgFVtbpSEiG9klNi8ZgYrSDebgJHEt/czWUBsESB7dc8yJpAiZoHLjBI31l1n A2kWFvCUuHWUFcRkEVCVONqcBlLOK+Ag8WrfG0aII+QldrVdBBvJCRSfseMkC0i5kIC9xKMz 1iATJQRmsUos3nqfGaJXUOLkzCdga5kFJCQOvngBFhcSUJc4uWQ+0wRGoVlIymYhKVvAyLSK USw3M6c4Nz21wNBUrzgxLyWzOFsvOT93EyMk4DN3MN594n2IUYCDUYmH94Ts4ggh1sSy4src Q4wSHMxKIrxs9UAh3pTEyqrUovz4otKc1OJDjNIcLErivOdkpkYICaQnlqRmp6YWpBbBZJk4 OKUaGEvDbjQwrWSteHM0XvpibMmts6ePGiZ22rb6H1Bf22Kb9cxxbgaD5uGr3Vk7XCc92iRz OXXJ7SCBp5vPXvrX9L3WUUOs/8AqNzeZ4qodew4y3zrrK5d+p81q7zEW00dfa4RKJ8jvn9vc xeTbUvKzu+MmV5DKTQWjjyf+xs46Z76blU23NPPOCiWW4oxEQy3mouJEAAM/TYR0AgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrAJMWRmVeSWpSXmKPExsXCtZGTTVd9weIIgzUbpCwO/mxjtPj6fzqL xYI3e9ksVq4+ymTRtvoMo8WCjY8YLVqXvmVyYPe4v/0Ik8fumw1sHtPWnGfyWL/lKovH5tPV Hp83yQWwRXHZpKTmZJalFunbJXBl3FtgVHCRq+LbjVVsDYzPOboYOTgkBEwkNjdKdjFycQgJ rGeU6H32ib2LkZODTcBI4tv7mSwgtgiQvbpnGRNIEbPAZUaJvtMNTCDNwgKeEreOsoKYLAKq Ekeb00DKeQUcJKZ/mM0GYksIyEvsarvICmJzAsVn7DjJAlIuJGAv8eiM9QRG7gWMDKsYxXIz c4pz0zMLDA31ihPzUjKLs/WS83M3MULCJHIH49OJ5ocYmTg4pRoYT1kE6DD3njfj1tjXo9h4 +aDZhWCFCd5iBkJxO32Wt2VdWr4jvyq6O3b3IS7TE97PRJ5rHRc9e2Blt/5BtfwJ67n5T7E+ eydX9zGYufCq5dIlTtdD7D3cOF+3v9xUlPAvuCPoQKaXTl6uKfOG9s3lnVvNzPb+WKwaeneJ ter7m08Lbeo/H7+lxFKckWioxVxUnAgAJDxVx8MBAAA= MIME-Version: 1.0 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 If an initiator submits a LUN reset while a previous LUN reset is still being processed, both LUN resets will be added to dev_tmr_list. Avoid that this results in a circular wait between the two LUN resets by removing a LUN reset from dev_tmr_list before scanning that list for TMFs to wait for. Signed-off-by: Bart Van Assche Fixes: c66ac9db8d4a ("target: Add LIO target core to kernel v2.6.38") Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: David Disseldorp Cc: --- drivers/target/target_core_tmr.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index 5eb164dac5cc..5c671fa67339 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c @@ -230,13 +230,8 @@ static void core_tmr_drain_tmr_list( * LUN_RESET tmr.. */ spin_lock_irqsave(&dev->se_tmr_lock, flags); + list_del_init(&tmr->tmr_list); list_for_each_entry_safe(tmr_p, tmr_pp, &dev->dev_tmr_list, tmr_list) { - /* - * Allow the received TMR to return with FUNCTION_COMPLETE. - */ - if (tmr_p == tmr) - continue; - cmd = tmr_p->task_cmd; if (!cmd) { pr_err("Unable to locate struct se_cmd for TMR\n");