From patchwork Wed May 10 16:39:49 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: 9719271 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 0354B60236 for ; Wed, 10 May 2017 06:24:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8D3A284D5 for ; Wed, 10 May 2017 06:24:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DDC3528552; Wed, 10 May 2017 06:24: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=-5.0 required=2.0 tests=BAYES_00, DATE_IN_FUTURE_06_12, 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 65DA3284D5 for ; Wed, 10 May 2017 06:24:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751876AbdEJGYb (ORCPT ); Wed, 10 May 2017 02:24:31 -0400 Received: from mail-bl2nam02on0083.outbound.protection.outlook.com ([104.47.38.83]:60837 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751483AbdEJGY0 (ORCPT ); Wed, 10 May 2017 02:24:26 -0400 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=Zgw940xuLyfqZZ0nIVSWO4aYTRQAyBk1z99NRQPnZec=; b=CFTAvZJlZZ6CQJY0aMDDVu6Hr1GVDoxEwxBcW6nYX4SNHKTgXTGDpKYnxsoevNFbXdBpOrg96ez/iZ9fkjlz9Rnups67vj7w9sAB6PPT1efmpQZAC+K0u4kaEhFoLhsIvMsvDCqrABr5JpIYEzg3ox3C2sncAhSgX3hqzdjF5ew= Received: from CY4PR02CA0035.namprd02.prod.outlook.com (10.175.57.149) by DM2PR0201MB0735.namprd02.prod.outlook.com (10.160.94.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1084.16; Wed, 10 May 2017 06:24:22 +0000 Received: from BN1BFFO11FD011.protection.gbl (2a01:111:f400:7c10::1:195) by CY4PR02CA0035.outlook.office365.com (2603:10b6:903:117::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1075.11 via Frontend Transport; Wed, 10 May 2017 06:24:22 +0000 Authentication-Results: spf=neutral (sender IP is 208.19.100.21) smtp.mailfrom=microsemi.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=microsemi.com; Received-SPF: Neutral (protection.outlook.com: 208.19.100.21 is neither permitted nor denied by domain of microsemi.com) Received: from avsrvexchhts1.microsemi.net (208.19.100.21) by BN1BFFO11FD011.mail.protection.outlook.com (10.58.144.74) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.1047.9 via Frontend Transport; Wed, 10 May 2017 06:24:22 +0000 Received: from localhost (10.181.72.13) by avsrvexchhts1.microsemi.net (10.100.34.105) with Microsoft SMTP Server (TLS) id 14.3.339.0; Tue, 9 May 2017 23:24:06 -0700 From: Raghava Aditya Renukunta To: , , CC: , , , Subject: [PATCH V2 15/19] aacraid: Make sure ioctl returns on controller reset Date: Wed, 10 May 2017 09:39:49 -0700 Message-ID: <1494434393-17261-16-git-send-email-RaghavaAditya.Renukunta@microsemi.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1494434393-17261-1-git-send-email-RaghavaAditya.Renukunta@microsemi.com> References: <1494434393-17261-1-git-send-email-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)(6009001)(39850400002)(39410400002)(39450400003)(39400400002)(39860400002)(39840400002)(2980300002)(189002)(199003)(9170700003)(4326008)(47776003)(54906002)(50466002)(356003)(8676002)(81166006)(2906002)(478600001)(6666003)(8936002)(5660300001)(53936002)(104016004)(2950100002)(106466001)(36756003)(2201001)(105586002)(50986999)(86362001)(50226002)(189998001)(305945005)(76506005)(57986006)(77096006)(5003940100001)(76176999)(38730400002)(107886003)(72206003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR0201MB0735; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Neutral; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD011; 1:aZJGi3Bm5Nua65STlp71Z7cvkSt17BOhgmJocadAoHppctM7wpfWTkCMmxvx0VNljV5DihFjSRghFIwPybHdZaIn031UjyYUnf3S4gPycl0tk+OUfeCudHvsNuNimwH7TK7DeMiNmshHJP38OTfEe+iF2lOGaoVspmSqI1o/4iviCnywB7Y1Ohdfl+FEZoUuWLuZ2D/AT9ujgpX0VjSqRN6dms1fXUEuAcFT1KJWGnXTDVrhdUkDUPCnep4QrRi7jEaPJucII8Q5SCvQhi9H4/lDCuHP3OpM2XtsKFIpnYCaPEh5RFUfiMHen8MgeEhSA1lCvExl7Zph34o4mB1LXx973LhbZkylsh+zy0dv0Wg4u64nDPtqMrqMO42smyW5PozifXgoKsUt0mpTiEXK2kwoBPPmr9x+OpFETCOmOak9i6cCZ0bh3/Hst4SenoBlU5/CDn9qSjerBlKCE1VcCh577011kOM486nSh7u0RkC0tGZEvAWtuH4S1QsfHBGMSgyjsZ45DycOD2mSHID5WRX6vm5oQPs5L6WWDmmGoLHyweK73I2ch7nMbiRntrtNZHFY1UMOiWNI5qLkFzTRkWkAlhvQAK2dqZl5TFvc9Pk= X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6ad6c8b0-7e1a-4e65-280f-08d4976d32f5 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(201703131423075)(201703031133081)(201702281549075); SRVR:DM2PR0201MB0735; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0201MB0735; 3:0vQiRWxmf6Blo7pdSgEKt5ec1Gu1LygcPm8Lqdg3qnQgSNn1oH83agsSHOuMj6V8qE0pXIFqAPc15/UVFwyGjcqQVD9GctiQZjNkAQCg/CpWtqzOllswic5iBXqWpHZa707IMNu43bTgbcX1Pk4cbQzw45QT4gXMYXNGOqTK+TVwCPHVSaZYoPHWZE2bUf/fP6uwloVi0XkOG+Y4E7t8UDzfz4brAqccOmhRCDH/fZs7pAF2eP8yIKTxl+m0Epc3YYKBleuMsPDvHdyCNGcoKXQuPNNBTJQ+eW7V0nKJVAxyEW4/TGbxTFheLt8ib3DhvPJEhws5CMvC4QvBCTR/pCE6sdEDxEOW/KRhG22IxRmkXVlEwr0iRv2fqKdr78Q4vDpdUnpRn0mWskBPENh8kAzjwvOqC/EaeSKJ/Tawi6S08mdrZsgm4ALnhi9KumyRC8h7VwOlf8qnZwTDtvoHWP6/FdeMkIFvwD9H4ff9Lni0Od3EgcjuEy9kz7SEA1tS X-Microsoft-Exchange-Diagnostics: 1; DM2PR0201MB0735; 25:8Ql+FO09S+5VfMQblr2yIfjx+3tiurfl2pd+q2bJzl70Xm6DuBh/XdHIuTqyfyTImevK/S68juqwXywTeZZrpf3GhF7EiYxIb+VKnI8u0mrqsW9dRUU3vp/+HQNTAOJLRX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RUzBxPYThM+zWOIxD0C2yP4r4zj4tVVeD0o5fyDndeT0yseRT3j7W9qilZRthMbd2L6ki7k9BVBzsy1QaTKMnWjtaXo77 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(72170198267865); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(13015025)(5005006)(13023025)(13024025)(13017025)(13018025)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041248)(20161123558100)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123562025)(20161123555025)(6072148); SRVR:DM2PR0201MB0735; BCL:0; PCL:0; RULEID:; SRVR:DM2PR0201MB0735; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0201MB0735; 4:R0a/Cz2wiLB5Nh4+J1aGnXJzXxVz1jo2Lr2CNG7LKZcgW/Jt/t480RnFUg8CIatP5jxbaT1WypGux/UVLV2XxM+qNVm+M3Zp4htQkmJXvQp+uLJBoyktwvmUqRYod/LIpwX87+2iwDTHjiT0FLp0B4KiO6gs4EXFEv6vth3ikFAFqzR99mQP39ozeIdE4Cs4rynsk37GWW7ksoLlbjSqdAgKtT8ZKMdM2jkMEt4YtVOYleCtf3q+/agq16sNFVjZ3YaoNj2LvewoaxDbxbgK1lKO2qUnnyrUmhCKid1b7bQjz/l2Lrjcv1yyDIv4SngpxEOYCRiLagKzgh60ka3ojILNSa/LjCoUIjDACVSqllkTIManl+LibTdRLZ+Cw6KfbNNYb9f1/L93SZVcADNFsGlCDTOGT33Wuysvc4zzfHrP/WoAGV4Ars+TIUiHdQyUXCqZWHVEFrb2vfLgDdeEw2tNoWYzYG53n3q1SZymxF+rt6EMpdeMSWLkeARkO5XsBkiwnVYUmHGuxMA7Bz07bzSJOLPWcaN7MflNn4PC/2UO9yCoUjv2M7i48p7GcVcXmjEzjf/W6kEqDUevF2+2WEbYKEIen1yT3Rbx/Kef3qD6x6//NupWrXBgnH7WLF/1jlJIlzHQeQj9iAJ1JtCMzozgJODJcuZvudmlV5u9fezDS8H5s3b6sbP6ZG1uhJNNyKClxQxMkTvv9PbCKdABHijyP/xEywUVMWS4w0VVt3ZZqzDv8+mlb9bsy6wyv8OXVT4MALdLvma5m/o5IcvPmcvVkYWl9L51fxLFZe/sVYgFUVL1CGy7MVKwjvdpgi5EtmheNGqwDm3K9+ImCpEHUwfLPAM8GKE24b3PEJmE14H1X0iNEGCkEUurhi+MIinnU2aZ81RrYDeaVa9Q8C4yV9XEFQAtBd4aLVMYtJza xX1A6vFzjH/KDdkvStHNbvqx X-Forefront-PRVS: 03030B9493 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR0201MB0735; 23:9kqJ+5657ygbyWDDd3YIV3BjRORb1zXvalKi/Iw?= =?us-ascii?Q?3saqLXuDcnvnSPs+UowOcjZP92k8K6nfE7tknlteFjr7jGGrnQKXtF9EnqTH?= =?us-ascii?Q?pn52t0o1cedI/143pKNyxbw8ZBHlkksjiUrHYioRGKkHJvRuMpXlZhtce58/?= =?us-ascii?Q?x2Bdo7pAhC4e36cwsc+V+2ntB8XjDNDTu+uU4eGE86OYDDXmHnQmTkM6DhcU?= =?us-ascii?Q?zBLHSwdFT5c3w/p64D2lSfO5A5lH9Wkl0glufGxFFE7JZKXPl56yp8iCpAFf?= =?us-ascii?Q?kbdieXliSq3Uw+DuNy3moDBt6wCoIl9AQZadSUz6hmqwPLGIJKNV9sCCv0Jp?= =?us-ascii?Q?mIUEZP1JgkFG6KgXKi2FXI2n5sQGNmbUpDsHUUQSCgpl6h4mjS3BcdEmkK4n?= =?us-ascii?Q?gI1cgN+/bEYAlmmEObcpqdob9x64sV4JfcBLzEo6UYqGb63n5jo1a6ZdZ3tS?= =?us-ascii?Q?fgWRI7DYHesPgTlmXqqAJTuMPzZ6UVBjtc0KtO9L0XkiEtQIuclTMrgX10lV?= =?us-ascii?Q?K4oeegvDugOs2EmqCaa8z51cRr3817SbQHeDmXoueAT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8o4aof65CrL0oYIvIuXTFJmsdwZXbiYsH2ct9kO9XeC1PRbNfQD6RYP7KLRQKzQihjxtW5T70mrKDZfu2KPFg1IcvNgpCdC2lhKVQIXyJgEGRmx6pQPdRE481p3mRzXFZpLx7UqaXsHQoz2qxGMdnDiU2OuNJoWwtyJ6QhrbuhMiCYsMYy1QnTq8C7GGre6c/GlzSPgxky9L+wI=; 5:2RvKeZ5DMdXiZiBnuNkHnYJiA2ceRadZV1B2DMnYdsllahc0gNIDuQaE/HA0aamUKsXHmlJDczLOgDB0ndDIn+Bz1GLBk7KVlHtvdaD2QdVJeOpGdENOZUwUSdPZq6fNVB/CJzUdti1kXz1KYZ1Jog==; 24:69a0A43twXLoeXDHaHrUga6eZNRX+cunf1tP3yxfxooj89GiMfORKIq0I+yGoo40T2wHFrVKpfWF5HAIq2J6M+J5jXnoZU7l5zWR5e9sB7o= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR0201MB0735; 7:+EX8Lf++1AaIbG/LxqHXXKYtzVv1Me+fA3NPDuQBWkyrbQdSOh6XIsm0/a024tMJL465IJN14/yxmvNNTIMTuvhM9jz6+fpt9BpL4rnVgLG2yntWXBPUZZsfvpUlsEacKvGVa8Z1var6O1+tShc07jd8nfLmKsUIVBrWhra+epNygXsbKyGx/Jt9RzGc1nyWgoi8ylprjOSnG5iW2YO8xp3i9WF5gQNMiePcV1IxUCQT1oZ2RGSxJElqhSVuStVYt+5zo4Twfdmnp+kwQfxOrcaR13YI+stF8VKb988FKUyTTDk4JlXW2Ihz0z/gpO4MiNqFAOfM1o/wOB7TPH6XTw== X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2017 06:24:22.4963 (UTC) 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: DM2PR0201MB0735 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 Made sure that ioctl commands return in case of a controller reset. Signed-off-by: Raghava Aditya Renukunta Reviewed-by: Dave Carroll --- Changes in V2: Removed incorrect up Cleared wait flag once event is received not before drivers/scsi/aacraid/commsup.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index f26543a..7bb0253 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c @@ -803,11 +803,11 @@ int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback, if (aac_check_eeh_failure(dev)) return -EFAULT; - /* Only set for first known interruptable command */ - if (down_interruptible(&fibptr->event_wait)) { + fibptr->flags |= FIB_CONTEXT_FLAG_WAIT; + if (down_interruptible(&fibptr->event_wait)) fibptr->done = 2; - up(&fibptr->event_wait); - } + fibptr->flags &= ~(FIB_CONTEXT_FLAG_WAIT); + spin_lock_irqsave(&fibptr->event_lock, flags); if ((fibptr->done == 0) || (fibptr->done == 2)) { fibptr->done = 2; /* Tell interrupt we aborted */ @@ -1514,6 +1514,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type) int jafo = 0; int bled; u64 dmamask; + int num_of_fibs = 0; /* * Assumptions: @@ -1547,10 +1548,20 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type) /* * Loop through the fibs, close the synchronous FIBS */ - for (retval = 1, index = 0; index < (aac->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); index++) { + retval = 1; + num_of_fibs = aac->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB; + for (index = 0; index < num_of_fibs; index++) { + struct fib *fib = &aac->fibs[index]; - if (!(fib->hw_fib_va->header.XferState & cpu_to_le32(NoResponseExpected | Async)) && - (fib->hw_fib_va->header.XferState & cpu_to_le32(ResponseExpected))) { + __le32 XferState = fib->hw_fib_va->header.XferState; + bool is_response_expected = false; + + if (!(XferState & cpu_to_le32(NoResponseExpected | Async)) && + (XferState & cpu_to_le32(ResponseExpected))) + is_response_expected = true; + + if (is_response_expected + || fib->flags & FIB_CONTEXT_FLAG_WAIT) { unsigned long flagv; spin_lock_irqsave(&fib->event_lock, flagv); up(&fib->event_wait);