From patchwork Thu Dec 21 17:33:57 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: 10128097 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 9141060390 for ; Thu, 21 Dec 2017 17:34:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EFDD29CE3 for ; Thu, 21 Dec 2017 17:34:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7335629D1B; Thu, 21 Dec 2017 17:34:50 +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 131D629CE3 for ; Thu, 21 Dec 2017 17:34:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754210AbdLURes (ORCPT ); Thu, 21 Dec 2017 12:34:48 -0500 Received: from mail-dm3nam03on0056.outbound.protection.outlook.com ([104.47.41.56]:48617 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753855AbdLUReg (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=2Xzc02WLkZUubrS/jlTiCMuDmLUxSAoB1IRiqLcmvN0=; b=LyGJYGwalaZSrzwxVxUL0wN1/QkvlhYz7FSgea9kej+9nEjyomSPbwfrT8hDY5q5x4OwDLbH62JLjdBokSdOAw55+QD0pYMywSSCX1OxRze0IMhs5Scj+tU5+tn6EmVwGkppjE8hONeW7PiMJJ1tGGnh4/hKxqwIWhwvqVIh4XQ= Received: from MWHPR02CA0042.namprd02.prod.outlook.com (10.164.133.31) by CY1PR0201MB0748.namprd02.prod.outlook.com (10.160.141.150) 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 BN1BFFO11FD036.protection.gbl (2a01:111:f400:7c10::1:177) by MWHPR02CA0042.outlook.office365.com (2603:10b6:301:60::31) 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:34 +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 BN1BFFO11FD036.mail.protection.outlook.com (10.58.144.99) 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:19 +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:22 -0800 From: Raghava Aditya Renukunta To: , , CC: , , , "Guilherme G . Piccoli" Subject: [PATCH 06/29] scsi: aacraid: Allow reset_host sysfs var to recover Panicked Fw Date: Thu, 21 Dec 2017 09:33:57 -0800 Message-ID: <20171221173420.8213-7-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)(39860400002)(346002)(396003)(39380400002)(376002)(2980300002)(438002)(189003)(199004)(50466002)(110136005)(5660300001)(48376002)(81166006)(81156014)(8936002)(16586007)(54906003)(68736007)(47776003)(76176011)(4326008)(50226002)(51416003)(106466001)(1076002)(8676002)(104016004)(316002)(106002)(69596002)(356003)(59450400001)(305945005)(76506005)(53936002)(77096006)(57986006)(478600001)(72206003)(36756003)(2906002)(6666003)(97736004)(86362001)(2201001)(2950100002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0201MB0748; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD036; 1:Sx5e/idXeVk5KqTzmmuw7qpG4U8qBAc9pZq4Yeg5MvSk/JKrhkBUNbICuGwffyzvdy4OmfBB95S8UQFAISOsYU7iSH7wQryaVo+W+RWW5kEx001XJC+AnAp2KwLiiH3b X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d1e70380-5b5f-43b0-1112-08d548991116 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:CY1PR0201MB0748; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB0748; 3: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j3+XVgYSHjpshcUhbrhzdjkq2JSn3mazhFdEHaropfkjKLMxXglqIHGzJjsyO284Nmc4vB4XmamWwTU+BNEAev8TbgSz/0gpc7GGDysx5bp1SMWcsvMhPvupDc6D8hGkKZrg8pRQUbGiZi1r+WIF7+QT5YIWV5KM+7TTcVBfkcPjlLtUW7mO2WgssUEmk29QCwSBulHPMON61fQR+TsdBJfx8pTxWMmdr6v5EDCLtQmZyEV4anEt89YhDQrc1RACf7kFAMb6kEpLat8S/8jPZgiE6s953gOVDJ+GbYKqGWAcPnk3zstoQ+Vy5ypHvkx2+vpyQsVg+J4FopBLgRWUXyVVylgCbl8keTU8Hq98eM3FGzWRMhlWghu3rwrtvf3jkT11sbi6AmGAPKchRH1tblrV3Cg22lv2n3mHWZfD9BJMr+xSH8Ywnez42IgoKfLWBdI0pW9kzlyznLzwmd6HUPLKMuBxEoX3DaOdNGq1RM1EDpmtFvfJMSRVWbctJCnyDOedc/WAZAiQALSi9RN7A+/Bcp92oBqOrvQfPrXAm9S4b3/xbP28uzkfE6Eya/jRziSjYs= 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)(93006095)(93004095)(3231023)(10201501046)(6055026)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:CY1PR0201MB0748; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY1PR0201MB0748; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB0748; 4:wnTPcHex5Ugi5OcBKvd5BL7TjNvyaLeq0owEejRTTfAx9mZn90ERenLWXqgniVg/d7xPMHOh3HWEYE3J2F1PYhP5ZDLOaIRzyXV7C+l31cm1cX6W1LGJ0+mf21ukYZ+LPMdJOGF9oFhCpwC4o3iOi1rhQ1e64eppiz4sHlNeyduv5b3PlYwTGGkcV8eIUMj0LsoEMlmZnZz7WldxqePb6ROP1FXcmI+Vqb8Q/aUrucJpnSc+7EJ3OBcq8e+hUVh37sCr43AXYozONBk5oG7EyRa+Qlt4dbceOxfg+NrZG++QWHVf2JqOBfJQ1lBbQ5Ph X-Forefront-PRVS: 0528942FD8 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0201MB0748; 23:lY7n/B0kMdQ2i+HKk4UM/BYcEtrayANl3qY4tl2?= =?us-ascii?Q?lktTF8sjZ66Ni/phaATcAbhPw+sN1AaNy82Z++SNG7nBlNcjrRBdchBr6HVE?= =?us-ascii?Q?T1SjPo9+diGjwx4jlFVcMbfHQTYviHep4t2EyqWhQbN4CuWGjSioXhQZfqkc?= =?us-ascii?Q?R5evU2YFuswqscCvi+hAOEbSCYzfEtzL2rdwJcXW9VIZtbtLh7y5zMiQShwp?= =?us-ascii?Q?BWEBAQjFtTZ689N8b//hUpUpfEZEpaJqcMm/EVGvycHF4XZuH6GmsCuZ/5pH?= =?us-ascii?Q?wuEzZ3TJa6kc96B8mTmbFRz6Y2uNQgrWqxmIEGsCppO3dcUs00gctruEuytL?= =?us-ascii?Q?4er/9/M5mAdYgbP3tUjs+03BsgDJvUtTa61+gsqoJ6a7vvfRHjz3LL8knyQe?= =?us-ascii?Q?B0LqdzK6cAeq4j9RKCLN1XXBg0Yc5bKFIi3YG9uqlxP6uwlQkEzZ+NUM8WVz?= =?us-ascii?Q?585LQnlkH8s6crN9HA8SKWPdK9kHknC9h6Oq6WmO31EnATVgCNRAKMZoVmgK?= =?us-ascii?Q?rTAqaTlNKc4rbsqaK5WPeco4/garynpyLbj0RyhUhwhcZ1J9MfFbXW4lJOgN?= =?us-ascii?Q?7/q1+FC9gGwNkDXd0h2hj8sZlUGNAL3IUPddVfabGLssiDfLF6B1ePEBrllB?= =?us-ascii?Q?pPMQ4gEesE7L1CuwHoFJaGwY8+LONte+72OUhXBnT4f2kf4jQRc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nci9fFtEB+ScB1lEOq7E6pgR+kep5UA0Aki5KbCSyZ9O3wn0SGPj6mM=; 24:cTQ2BrnoEzLoECDvEubJtFz0rEgZlG1e+ZlhvFs4iJJ3grrsp+Fgdo88z+FaFcMmIbFLjraoHviNnzpRna30QYeG1Re+Pu9zCagxHW4gJy0=; 7:fiFslLNFFNer1dcMQhElvvifhso8gsq4qZZcmhayxI0kjhXMxrxvpILOCMXMUnCNElS6/cXEs+oUxKyZfJlADhQMguLcKLzd4tSIOmJM+4ix5FWHdeWH/0ElCHC8UsEPNTCqayEEIt+zRF5gV236xzhrzAcrpv8u/177Z9g70Yx3UdlTIL4WMhu8n/VTL+Z0Gsae4X8Q87MdsX+VQm0Y/XU++d/q3oJLeCIUjd7y/HE2rMJxYxELCu4g8oix613d SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2017 17:34:19.3216 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d1e70380-5b5f-43b0-1112-08d548991116 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: CY1PR0201MB0748 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 It is possible to restart the controller via the use of the reset_host sysfs variable. This does work for controllers that can no longer respond, since driver will attempt to send down a shutdown in this path. Check if the controller is able to receive commands before sending down a shutdown Signed-off-by: Raghava Aditya Renukunta --- drivers/scsi/aacraid/comminit.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c index 1bc623a..9eff246 100644 --- a/drivers/scsi/aacraid/comminit.c +++ b/drivers/scsi/aacraid/comminit.c @@ -295,12 +295,10 @@ int aac_send_shutdown(struct aac_dev * dev) { struct fib * fibctx; struct aac_close *cmd; - int status; + int status = 0; - fibctx = aac_fib_alloc(dev); - if (!fibctx) - return -ENOMEM; - aac_fib_init(fibctx); + if (aac_adapter_check_health(dev)) + return status; if (!dev->adapter_shutdown) { mutex_lock(&dev->ioctl_mutex); @@ -308,6 +306,11 @@ int aac_send_shutdown(struct aac_dev * dev) mutex_unlock(&dev->ioctl_mutex); } + fibctx = aac_fib_alloc(dev); + if (!fibctx) + return -ENOMEM; + aac_fib_init(fibctx); + cmd = (struct aac_close *) fib_data(fibctx); cmd->command = cpu_to_le32(VM_CloseAll); cmd->cid = cpu_to_le32(0xfffffffe);