From patchwork Wed Dec 27 04:34:26 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: 10133389 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 9CFA1602BD for ; Wed, 27 Dec 2017 04:35:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 859B62DA56 for ; Wed, 27 Dec 2017 04:35:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A3F32DA5E; Wed, 27 Dec 2017 04:35:11 +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 5DEF12DA56 for ; Wed, 27 Dec 2017 04:35:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751799AbdL0EfI (ORCPT ); Tue, 26 Dec 2017 23:35:08 -0500 Received: from mail-by2nam01on0087.outbound.protection.outlook.com ([104.47.34.87]:27920 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751694AbdL0EfD (ORCPT ); Tue, 26 Dec 2017 23:35:03 -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=BKKI7Qws3FsJtTyK9rQoitsZB6dqbQV72zAdcDQ3/g0=; b=fDAiP+a8bZrmDOehqs0UyQYD5LmG4xaCxY4luWGZ+42Igri4odS0FoQpmgs2/LizKENiAI4/Ic53tmNLXRpfiiu82bjZ9NIrlZ5rjtD/cALKFFuA+ko5ceu+4pDJaYRzq4tLz3I9j8n5U0vnmXsscyQ3TbXGov2CNV2o8GKnmro= Received: from CY4PR02CA0002.namprd02.prod.outlook.com (10.169.188.12) by CY1PR0201MB1836.namprd02.prod.outlook.com (10.163.55.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Wed, 27 Dec 2017 04:35:00 +0000 Received: from BL2FFO11FD049.protection.gbl (2a01:111:f400:7c09::182) by CY4PR02CA0002.outlook.office365.com (2603:10b6:903:18::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.366.8 via Frontend Transport; Wed, 27 Dec 2017 04:35:00 +0000 Authentication-Results: spf=pass (sender IP is 208.19.100.21) smtp.mailfrom=microsemi.com; wdc.com; dkim=none (message not signed) header.d=none;wdc.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 BL2FFO11FD049.mail.protection.outlook.com (10.173.161.211) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.345.12 via Frontend Transport; Wed, 27 Dec 2017 04:34:41 +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; Tue, 26 Dec 2017 20:34:53 -0800 From: Raghava Aditya Renukunta To: , , CC: , , , "Guilherme G . Piccoli" , Bart Van Assche Subject: [PATCH v2 05/30] scsi: aacraid: Fix ioctl reset hang Date: Tue, 26 Dec 2017 20:34:26 -0800 Message-ID: <20171227043451.27813-6-RaghavaAditya.Renukunta@microsemi.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20171227043451.27813-1-RaghavaAditya.Renukunta@microsemi.com> References: <20171227043451.27813-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)(376002)(39860400002)(2980300002)(438002)(189003)(199004)(53936002)(478600001)(54906003)(2906002)(51416003)(72206003)(76176011)(59450400001)(4326008)(8936002)(1076002)(76506005)(57986006)(50226002)(16586007)(36756003)(8676002)(68736007)(316002)(69596002)(110136005)(305945005)(356003)(47776003)(6666003)(48376002)(50466002)(97736004)(106466001)(81156014)(81166006)(2950100002)(106002)(77096006)(2201001)(104016004)(86362001)(5660300001)(575784001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0201MB1836; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD049; 1:+sx/6ysrKq24McyTSxTa5AzFhcEDIGX/fVOgRloGLYHMhDACWGZKCAV8UnKDNa+H+eZAEDneu8PgGvBoYwuHKklefI8npsoR7KH7lrm4AlIbmQ4vt8Yxzx+/02E7lW+K X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c14af6f2-8496-45c4-35da-08d54ce325ab X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:CY1PR0201MB1836; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB1836; 3:YSJgPb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vvmeeAaQFdVHx2HGGLfEBCXWpR7YSL7Ns5WPSlhXrR4HdSs/EktIKzIIBEkEfIGQ39FwyMOHFcCn4VqvzrJeIrbtVNVV1zdFgmPGBsKwMm/+iDFBgSSfOqn9n78ibXYh5S3WqwDjVLwa3D4/CtZff+1MXiU6KCDt4j9E7hc3ki6u7KdDoNaZ552133ZEIxD491VIUIckaGPs9J0T5OCkREh46cDoZ0v3Oft/zhmikv4rDUdAabp4SqWY1Ki/ClX5roVLzNp4yK625oLUXxGFegUAefCtZOb+KFnVIx3CdSyzDNDbQcO3kjoU62qDAjTu+DEwQmCa6iOF53JpAohVgR8A9d8pICfs8FRZgoUAfJjQwQjYs3+lANsxjpwIbURzUIUba4kmzj1bj+C3Nw5ANJHe64Taxyr8cLCsw7S8ODH4Gizi1pyn1LMp2blyf1aAJUU5OsLmMrqAR37yGxPG8iRMmPs8v9bY96uZvadJWKWbwavWD+5OyhFAbqvnc224M/07ZZkJb5KwjJCdiOGP+zZzVf3GxO45lUO7zI= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(72170198267865); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93004095)(3231023)(944501075)(6055026)(6041268)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(6072148)(201708071742011); SRVR:CY1PR0201MB1836; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY1PR0201MB1836; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB1836; 4:YyB7m0DOubR2buBP0ESsI0p90fpNaW1uF/qMJTvYbGPTO+rfo4cjPKbEqxh4xgIGQRdX92IBMd7obeEzgC25slfsYVlZBgYXQaFLpufsLlfRzVikvk9rlrCYps4DnSEVw7GLlalAklm0iZGBhx5H1/kLlF0C5hy9hELP0jV+oSrvf3YhwCDoeAYRQmTxp7s0CdhULDRvYy/sobn0YBrxJ6LHoeUHLkHj5gymP7t5TH6dlz5DWgyRGPbDVycprVcDSly1loTo+7aJGGU5N9k9iugnbEgmE4vfNsFyfrGNLKBYQ5xdRqmE0jqnWn/In5Ix X-Forefront-PRVS: 0534947130 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0201MB1836; 23:cSkQ6hi//NQBzLclmOu+bG/qJma7mVXfT1mP7By?= =?us-ascii?Q?6mouu3DXFHFUshdNqjDjEoo6bur+exaXOllE+GbCacBio0Xu/EDdE4rTNOEr?= =?us-ascii?Q?YrRa6fEumzAf0FCMtEZ6HFT3VUnv771PTNp+lszfBrJDtCwFJMibCt5PXaBP?= =?us-ascii?Q?LVMRN3fS/A8DQvh5+RWqd63kUP6FQkYSTR3hL3MfV2D0mlufS5w/Hb8XmaRz?= =?us-ascii?Q?hBP16jRQZuL68wE1zdw8tafjEQuygII40YRojZ1XkzkUdhZEK5y14zwWSR6g?= =?us-ascii?Q?0j3mU6iAfCEzUX70DmEvZXRz4tpaRlAL23BYhfQ65hx+EiMYYlhSGk4zxiQF?= =?us-ascii?Q?6mYtVCq8Ln2YdDONQ4SS1BbO8PP5HWHapTxPIT1hUXdt+VL8ogbkHzFykYDP?= =?us-ascii?Q?YwjTezaSZ59UA3YVmr528FiH59Cuj2ro1QjA0V79NgVKhGPxJclrpr7SIv0y?= =?us-ascii?Q?UusTO7MN76SB/qu3WOkLlFSjgInzNoOmgD5PjQaikIeqCX8AG4eHA8F92dWB?= =?us-ascii?Q?gbPQWEaJQzufaYJRxvTiTGT3vBwJrpS3mpwE+muHTZXHSjDD3CB+WTfU4+qa?= =?us-ascii?Q?XkftrZzcgfZBAj2/edVoAanXA7trOlAd0LHs0uTXp2sGC7nmP9gVsq69cYaV?= =?us-ascii?Q?J5yV2QKRhEf2+7kbmPHI1zEg0nyGfBsQH8PBJ1IVPY1qQvgQVDwvehB0eMSa?= =?us-ascii?Q?xPEDJA6cxkdtBqrs0fisV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KF6UeY8QBaHzr6ZmqEh3S8=; 24:0GsJRZtlY4XpKuBzz6GTdwKMlurizlgbdxBxSEFIgWmOa8TYOImzArJo58TpE8IRCTgGkdqmfw0paOKMRSnx25cJwY4wz1IpqkLBK45uqbw=; 7:SQ6iw9yE8VLVtqOVjwHPLZ6oyQMVdDATSaBeuOQNyVX6iPdQIQkqpcoBZEvfTri0UczmlqyV5DNXRhlz/0VRJ53b+Fn5YTCbk/CtFXwYeVco/PZ5TdPKzbjj9gb2Us0xVc5C4+ADTmqe1+/8Vz6lBTv9d8E29zknzdHd89kr3TpZsIjgbhp0opJfHUvqMbUD9dDcjjKxP5dpzuPtsBERiXqA07w9hujp68hTdzi8jh8VFaHTPVjm7cCDyN+Fzw6/ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2017 04:34:41.2782 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c14af6f2-8496-45c4-35da-08d54ce325ab 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: CY1PR0201MB1836 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 --- Changes in V2: None 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)