From patchwork Thu Dec 21 17:33:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raghava Aditya Renukunta X-Patchwork-Id: 10128093 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 DD31E60390 for ; Thu, 21 Dec 2017 17:34:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAEAB29CE3 for ; Thu, 21 Dec 2017 17:34:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BFD5529D1B; Thu, 21 Dec 2017 17:34:43 +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,DKIM_SIGNED, DKIM_VALID,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 3B1F929CE3 for ; Thu, 21 Dec 2017 17:34:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754040AbdLURel (ORCPT ); Thu, 21 Dec 2017 12:34:41 -0500 Received: from mail-bn3nam01on0083.outbound.protection.outlook.com ([104.47.33.83]:20350 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753849AbdLUReg (ORCPT ); Thu, 21 Dec 2017 12:34:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mscc365.onmicrosoft.com; s=selector1-microsemi-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=O9y1Vi3jUkGgtrH8KhsazRab9HF+wCbexD8cv8c7Ebs=; b=GRG5eYO1i8qUklV2FOEt/hV0q6qerLhPTQp7859aRv74aNc4/R0kafp12roMPdP/8mMVW4v3wq2SCJL8lxy2gwRaD8nbXZlo44VmlpjWAdpr0yIqHVHoZknY948q1ZRS2VNu/PJpyYmrqdEfdgza2W8hm7aND6SFDzNF+2zKnWg= Received: from MWHPR0201CA0065.namprd02.prod.outlook.com (10.167.160.42) by BLUPR02MB129.namprd02.prod.outlook.com (10.242.189.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.345.14; Thu, 21 Dec 2017 17:34:34 +0000 Received: from BN1BFFO11FD012.protection.gbl (2a01:111:f400:7c10::1:173) by MWHPR0201CA0065.outlook.office365.com (2603:10b6:301:73::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.345.14 via Frontend Transport; Thu, 21 Dec 2017 17:34:33 +0000 Authentication-Results: spf=pass (sender IP is 208.19.100.21) smtp.mailfrom=microsemi.com; linux.vnet.ibm.com; dkim=none (message not signed) header.d=none; linux.vnet.ibm.com; dmarc=bestguesspass action=none header.from=microsemi.com; Received-SPF: Pass (protection.outlook.com: domain of microsemi.com designates 208.19.100.21 as permitted sender) receiver=protection.outlook.com; client-ip=208.19.100.21; helo=avsrvexchhts1.microsemi.net; Received: from avsrvexchhts1.microsemi.net (208.19.100.21) by BN1BFFO11FD012.mail.protection.outlook.com (10.58.144.75) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.302.6 via Frontend Transport; Thu, 21 Dec 2017 17:34:18 +0000 Received: from localhost (10.181.72.13) by avsrvexchhts1.microsemi.net (10.100.34.105) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 21 Dec 2017 09:34:21 -0800 From: Raghava Aditya Renukunta To: , , CC: , , , "Guilherme G . Piccoli" Subject: [PATCH 05/29] scsi: aacraid: Fix ioctl reset hang Date: Thu, 21 Dec 2017 09:33:56 -0800 Message-ID: <20171221173420.8213-6-RaghavaAditya.Renukunta@microsemi.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20171221173420.8213-1-RaghavaAditya.Renukunta@microsemi.com> References: <20171221173420.8213-1-RaghavaAditya.Renukunta@microsemi.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:208.19.100.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39380400002)(396003)(346002)(39860400002)(376002)(2980300002)(438002)(199004)(189003)(575784001)(76506005)(5660300001)(86362001)(6666003)(2950100002)(59450400001)(72206003)(47776003)(36756003)(68736007)(106466001)(106002)(69596002)(104016004)(77096006)(8936002)(8676002)(81156014)(1076002)(81166006)(478600001)(110136005)(54906003)(48376002)(50466002)(76176011)(4326008)(51416003)(50226002)(57986006)(2906002)(97736004)(316002)(2201001)(16586007)(305945005)(356003)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR02MB129; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD012; 1:BoXgx9PLhUHEuk+5g4zIl/V10X5FOZjpEyxHu3PMr4n14zfwp70nU0Aqn44DRVfkwZVE5BRhHyQKJhgHdi5Hpt/0IPyoOgaGD41Ebip/bbo1qtH566bKZ8Q23CvLSawR X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e81f6289-556d-4cec-eded-08d5489910cf X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:BLUPR02MB129; X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB129; 3:cNLbXDGjIsQ9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vb36S80Ur/b2S35ML4P975j1/2+kRTUALcVb/lWbBArInR5SI12/VsnGnHj4IwTB+uAZwRwrzgQDd4PJeJ2XHDcgKCmRPG/7eLvxefb4LTBPasZrfiqhQdTjkvojM0vkhOFrn5BAQiAwfL9JuBSiGP7f1kTMhx9Prw6hsK3NUzOexRGDXW9g2tnN5z+UqZ1Xtn3N+nwBhevUbpHfoO70MypgUBSObOInrOICuMp3oQT60q6IyuU1Kf82stfdngQmK4SSR3bpellOWzbDu3YNR0q8jgwD0TOm7OheuDLCTo8QpxjB1thqL2/I9Cu1EA/oiS+7owiAmJdfOjU8KKtp0oYDYRh+hycNo/WvO6QF7T5t2qA1w5Cvd0yqvsB7L9ADddGBEWWOGJgXA1gGiYT6+9FaT74x0qXXjx0fb04JR1hi/9SLnc6U1+W06EGW3bZRX+s2eeOpcEk4Z0DRNdsMiSNcmKSl9d2/R2N0tgclbP8GsXQIB+w512yoQ/V/7Z19x17qvyGiI+XYBRT6lJHPGvjguCwOFqNqn7cdblUTiM= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(72170198267865); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(93006095)(93004095)(3231023)(3002001)(10201501046)(6055026)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(6072148)(201708071742011); SRVR:BLUPR02MB129; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BLUPR02MB129; X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB129; 4:5eIBdyG0ALLkP8auFXhVglbcwNoOWYdDXicKXz348CVgC5CTAxkdWusiNejEYrIUaPrzXyOlseSEb+yB2385UPVaxU3synq7j/Oh3P321k1tczZRN1TZxW0HFO/nJkX+CB9FzRAokkGap9ad4ByOXOnWuldcuFVby/aG6WVki2BlJ971Z3gZZuIPyI0bp1Y7Ixf0ZcCSB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ozG2GMDeqgNyTgZKv/uEPCCMN/NUMcPPimsVjiaUJ6O4=; 24:AiQLmeJitfDTEHxMtFnsB0Zka6mTpEyJyfZhRQ3cqNu+wLJVdfhhXTSosWl01fQCvrSbWUZL2A0loXb0KKgnLxUBh1QH+pHNfY/CbEST8gA=; 7:3rNAXD1BhS6fuZnC8YqFnbIq/Rg2ERxPdbreMj+t/1S3lapAyLI13g/aaKpX9f4Wf3Piom6n/aEJ3XIwU/W1jFybPA8bH2sPGViCK6s8Z5GhxvYaPoOQw/8JJS1iS/ySsDkBDTmW677b7VT5dgzYJ+3quq5aX1kKlPfFL4qhQEoUFIWrYajJrQC1tO1EWkYzLfsw8LT0qxOXaXTfpqUwW1usYPDw79k3KOW6q0lwJv2389z7Has/D+joUXDQ4iIu SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2017 17:34:18.8619 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e81f6289-556d-4cec-eded-08d5489910cf X-MS-Exchange-CrossTenant-Id: f267a5c8-86d8-4cc9-af71-1fd2c67c8fad X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f267a5c8-86d8-4cc9-af71-1fd2c67c8fad; Ip=[208.19.100.21]; Helo=[avsrvexchhts1.microsemi.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR02MB129 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Driver would hang when attempting to send reset from the ioctl interface, since it would wait to retrieve the ioctl mutex at send shutdown. Set adapter shutdown and unlock mutex before sending down reset request. Signed-off-by: Raghava Aditya Renukunta --- drivers/scsi/aacraid/commctrl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c index 9ab0fa9..a2b3430 100644 --- a/drivers/scsi/aacraid/commctrl.c +++ b/drivers/scsi/aacraid/commctrl.c @@ -1052,9 +1052,13 @@ static int aac_send_reset_adapter(struct aac_dev *dev, void __user *arg) if (copy_from_user((void *)&reset, arg, sizeof(struct aac_reset_iop))) return -EFAULT; + dev->adapter_shutdown = 1; + + mutex_unlock(&dev->ioctl_mutex); retval = aac_reset_adapter(dev, 0, reset.reset_type); - return retval; + mutex_lock(&dev->ioctl_mutex); + return retval; } int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg)