From patchwork Mon Jun 18 18:22:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 10472495 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 BEAB460532 for ; Mon, 18 Jun 2018 18:22:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B29BC28BC8 for ; Mon, 18 Jun 2018 18:22:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A6B9828BCE; Mon, 18 Jun 2018 18:22:55 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, 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 22D0828BC8 for ; Mon, 18 Jun 2018 18:22:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935806AbeFRSWy (ORCPT ); Mon, 18 Jun 2018 14:22:54 -0400 Received: from mail-bl2nam02on0057.outbound.protection.outlook.com ([104.47.38.57]:1857 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935726AbeFRSWx (ORCPT ); Mon, 18 Jun 2018 14:22:53 -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:X-MS-Exchange-SenderADCheck; bh=muXCFo6Tzs6dCBLQjVcBmC4zz1T2FNuaLMGrfk+V6Yk=; b=L0EgBrBV2Zeo8Tp7eL1hI9AkKwWiNKZAqmF9QKqzNesiZbJfjcdlshTjeZfuH5mx0ITZzYZRS4K6sqn8+0EcDnR2OA3hv2teg4GQJk0RMPVLQC7W1kIIawHzousdrKQwbYQN5I288BfOdzukiUWxPxFvnoFTCuJPsI/JbiMgpmU= Received: from BY2PR02CA0098.namprd02.prod.outlook.com (2a01:111:e400:5261::24) by BYAPR02MB4904.namprd02.prod.outlook.com (2603:10b6:a03:47::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.19; Mon, 18 Jun 2018 18:22:50 +0000 Received: from BL2FFO11FD005.protection.gbl (2a01:111:f400:7c09::142) by BY2PR02CA0098.outlook.office365.com (2a01:111:e400:5261::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.863.17 via Frontend Transport; Mon, 18 Jun 2018 18:22:50 +0000 Authentication-Results: spf=pass (sender IP is 208.19.99.222) smtp.mailfrom=microsemi.com; hpe.com; dkim=none (message not signed) header.d=none;hpe.com; dmarc=bestguesspass action=none header.from=microsemi.com; Received-SPF: Pass (protection.outlook.com: domain of microsemi.com designates 208.19.99.222 as permitted sender) receiver=protection.outlook.com; client-ip=208.19.99.222; helo=AUSMBX2.microsemi.net; Received: from AUSMBX2.microsemi.net (208.19.99.222) by BL2FFO11FD005.mail.protection.outlook.com (10.173.161.1) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.20.820.5 via Frontend Transport; Mon, 18 Jun 2018 18:22:50 +0000 Received: from AUSMBX1.microsemi.net (10.201.34.31) by AUSMBX2.microsemi.net (10.201.34.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Mon, 18 Jun 2018 13:22:48 -0500 Received: from [127.0.1.1] (10.238.32.34) by ausmbx1.microsemi.net (10.201.34.31) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Mon, 18 Jun 2018 13:22:48 -0500 Subject: [PATCH 2/5] smartpqi: improve error checking for sync requests From: Don Brace To: , , , , , , , , , , CC: Date: Mon, 18 Jun 2018 13:22:48 -0500 Message-ID: <152934616829.16668.1149112435212858262.stgit@brunhilda> In-Reply-To: <152934612702.16668.1224961030482066219.stgit@brunhilda> References: <152934612702.16668.1224961030482066219.stgit@brunhilda> User-Agent: StGit/0.18-56-g3329 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:208.19.99.222; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(7916004)(396003)(376002)(39380400002)(346002)(39860400002)(2980300002)(438002)(189003)(199004)(478600001)(106466001)(81166006)(86362001)(8936002)(5660300001)(76176011)(446003)(9686003)(103116003)(69596002)(11346002)(8676002)(2201001)(97736004)(2486003)(23676004)(81156014)(230700001)(33896004)(47776003)(50466002)(68736007)(186003)(53936002)(77096007)(59450400001)(4326008)(33716001)(44832011)(316002)(356003)(106002)(296002)(58126008)(110136005)(16576012)(476003)(126002)(26005)(336012)(486006)(2906002)(305945005)(921003)(1121003)(2101003)(83996005); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR02MB4904; H:AUSMBX2.microsemi.net; FPR:; SPF:Pass; LANG:en; PTR:InfoDomainNonexistent; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD005; 1:NdIUnc90zRpfZ0oeJejE6lFdeGyMEXVlzGVe4reUZ/ibPpan9SokLNtCevM6Kfk+qTTAdA/6LOa44d9LxlQ/kLLMddfVdTj7ShGLl7Hh3EcFQJGQntb+HUejRuVEfWiS X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a09e240d-88af-4819-8057-08d5d5487fed X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(711020)(4608076)(2017052603328)(7153060); SRVR:BYAPR02MB4904; X-Microsoft-Exchange-Diagnostics: 1; BYAPR02MB4904; 3:GsFS03J4iOqH6eFVXuS3WbZ1ADDGtLLsitOsFVSfGN4BEiEx3CHghH5RJ6TgPjRQq/on6eSt4ptytZ2xS4ZtOBu7R5acbQ6sVjJWsSO6m36vq0wWCjm3J+ZTiM7jUD9gtlMlkItIB6uhHTASX/NOQJQ1rUvxgpHy+nAdaU/3xqX8iNU2mQ4EaoxTRf6EPe1i/0JWPVQFtow3Pyxvaut3FY4pA6PCKsgpQyMnZERdPU1EgpuXVLew8iWHolxTDJu+xP2i/G57aAtDALOKwDHW2lBuymVkhjpNmRTeZALtszRVTytxawJsD4G6sw14NNw+HT6vNf2b0reKZOsiwQhUYY3UooZpFVevVVAZyTSkd4Y=; 25:tRM7TmR4QAUfgPGwr0ko10NPTd0k//EPbgwuupppXqcdxH10jVyje7JwLx+WeTELH5HEQxrbHsfubi1yvf69PuvSPHfenKpUogrJiHQQ6mY7TqrR/yDN6S8XronBan13on45G63mDDG4+a+EpPkebUfFjDc7EcswWoVATE1vzzaqJz5s0yGYFmqIgCwJLh5sS7cypaWg0swlbf5z6tQuvNwY2fPPW+jmpOAWGHHYZehDEccHqfr2I7sxWDUUnan9whDKsYGccgXj0G0Een2qtgO3Bztp5LhXi/b6pnAPe90+iiN2G+xaUdNi8jqUzfMiKm3FqtPXPgP+AOzAX5oEkg== X-MS-TrafficTypeDiagnostic: BYAPR02MB4904: X-Microsoft-Exchange-Diagnostics: 1; BYAPR02MB4904; 31:EXvGX66TvTTUaonXRR5nwZ7ZMBalcv5knOo0Ny6mdg+oRKtzKBRwVihdVgwyYoKJjpD52hUoLQE7K4LGruN0EIFWtj1Bzh6hNGc54Il8pxGEVk0Femz1Td2iJ2yQKgj/YuqJkZ+QlRxaDqMxa6E4ZaeSr80MGCr0Gt+n2pqiLrbBiU1xUk+gkCI+lhUa/Acw62eBYcMZ3c0sSY9cc+YH+dgAdWFhpWExtkwCnGKS7ro=; 20:cIGJOBTBIWkBWEpgR5/Elp3VNyx6MP+Xn2nMgY7Mb2Q4L0U8P64FWMFyU0KZAQaauvIDmIJq3tcL3nq8hu0x4wnLFl8CnDFRBrUMxa4SQEEswNjmcH0tVirB+rI3P33q+Jx/IaUjxJEXkgZrcR1vYxzZnJEMMFzAxTrx/FJ6f1mnz0pUYB12oYMZ07b2ipnGacfI9h1E/CkPD9w3B/GZYSOvpHe6YVxmOEif90o1E19T5MC+RR4mHbvlCBkylaUuBx3x6Zf1xPxq5Io2iCRFBlacVkcKr/4P6mUqIXRKQMv8DLudrtTUHhZuL3fNQsw6PSmDcgcSlI1j+SSwG/23a1Pj+nY9k0z3bfw9NOO+TtWx8ky/zfc4z7iAQW5a3osH8wCJag5OF8W+8yeqUYGDq3txGSlaKZCXGtuiThbrDfaAcqq1xut82roCX2uWLmIiX1TLcBRXWtRbWycxqQjpNyTdCNQaT64HNuLm8KAuJ8fOEcCsIMwXbn+qS2TJOm8v X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(72170198267865); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231254)(944501410)(52105095)(10201501046)(93006095)(93004095)(3002001)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201703031522075)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:BYAPR02MB4904; BCL:0; PCL:0; RULEID:; SRVR:BYAPR02MB4904; X-Microsoft-Exchange-Diagnostics: 1; BYAPR02MB4904; 4:SP1clK5LLWe9Np7aa07un9Tuq/Qt/q86yHe082d2jifo8t7Dt/clt1lGkw3geH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KJajs7v8VtnpwjX8a432JunX5ryVIwM7Yzm+mrFmUUu5QejfH/WRR+FRjSEukTeWJ2AkWimcj/bOlXPuV1QYdmZSUwbYBeHYTt3JBHSgEp0ix6Q/YYXZgR6vayMHz58Qm5qzk46m46Bd2fQ=; 24:koB9kTDEXkIMRzN6NntMirOfqFtYUCG0qt8OccYs2Wydv6mSKmtwZsXzth4nVUAZd0bbeZbwsCoFQw4H5zq10VW3AdIJh4mrIBv6GYdjfzo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BYAPR02MB4904; 7:7VVPu8JQPWL3P29LRI7sV0neNBtTpiQfWL7/Ai3YLsCotJoFp0QKD9QSosELODywYiHE21HrZVCqeL2+Db0YGYMAbjJ5KpQDZAQSKSy2R9+iMdS52g/vKckkjfVAlN4m6aF4kAv9tMzxezQA+8qeqd3+XJ1fydMVnjEUN5SCoD1fPbc1qG8ACaMcKQprbROfYBPm0EG8FbbvqyLFYy5a7fvmpAQYZldbLN/8zfWRJLEi14qezZldY98MT1kypo4K X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jun 2018 18:22:50.2334 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a09e240d-88af-4819-8057-08d5d5487fed X-MS-Exchange-CrossTenant-Id: f267a5c8-86d8-4cc9-af71-1fd2c67c8fad X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f267a5c8-86d8-4cc9-af71-1fd2c67c8fad; Ip=[208.19.99.222]; Helo=[AUSMBX2.microsemi.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB4904 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 From: Kevin Barnett - detect rare error cases for synchronous requests down the RAID path - retry INQUIRY of VPD page 0 sent to an HBA drive if the command failed due to an abort. Reviewed-by: Scott Benesh Reviewed-by: Scott Teel Signed-off-by: Kevin Barnett Signed-off-by: Don Brace --- drivers/scsi/smartpqi/smartpqi.h | 2 + drivers/scsi/smartpqi/smartpqi_init.c | 54 +++++++++++++++++++++++---------- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi.h b/drivers/scsi/smartpqi/smartpqi.h index dc3a0542a2e8..a8e7c4d48061 100644 --- a/drivers/scsi/smartpqi/smartpqi.h +++ b/drivers/scsi/smartpqi/smartpqi.h @@ -483,6 +483,8 @@ struct pqi_raid_error_info { #define CISS_CMD_STATUS_TMF 0xd #define CISS_CMD_STATUS_AIO_DISABLED 0xe +#define PQI_CMD_STATUS_ABORTED CISS_CMD_STATUS_ABORTED + #define PQI_NUM_EVENT_QUEUE_ELEMENTS 32 #define PQI_EVENT_OQ_ELEMENT_LENGTH sizeof(struct pqi_event_response) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index 4036f65cbb72..1593ee343a2b 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -1197,20 +1197,30 @@ static void pqi_get_volume_status(struct pqi_ctrl_info *ctrl_info, device->volume_offline = volume_offline; } +#define PQI_INQUIRY_PAGE0_RETRIES 3 + static int pqi_get_device_info(struct pqi_ctrl_info *ctrl_info, struct pqi_scsi_dev *device) { int rc; u8 *buffer; + unsigned int retries; buffer = kmalloc(64, GFP_KERNEL); if (!buffer) return -ENOMEM; /* Send an inquiry to the device to see what it is. */ - rc = pqi_scsi_inquiry(ctrl_info, device->scsi3addr, 0, buffer, 64); - if (rc) - goto out; + for (retries = 0;;) { + rc = pqi_scsi_inquiry(ctrl_info, device->scsi3addr, 0, + buffer, 64); + if (rc == 0) + break; + if (pqi_is_logical_device(device) || + rc != PQI_CMD_STATUS_ABORTED || + ++retries > PQI_INQUIRY_PAGE0_RETRIES) + goto out; + } scsi_sanitize_inquiry_string(&buffer[8], 8); scsi_sanitize_inquiry_string(&buffer[16], 16); @@ -3621,6 +3631,29 @@ static void pqi_raid_synchronous_complete(struct pqi_io_request *io_request, complete(waiting); } +static int pqi_process_raid_io_error_synchronous(struct pqi_raid_error_info + *error_info) +{ + int rc = -EIO; + + switch (error_info->data_out_result) { + case PQI_DATA_IN_OUT_GOOD: + if (error_info->status == SAM_STAT_GOOD) + rc = 0; + break; + case PQI_DATA_IN_OUT_UNDERFLOW: + if (error_info->status == SAM_STAT_GOOD || + error_info->status == SAM_STAT_CHECK_CONDITION) + rc = 0; + break; + case PQI_DATA_IN_OUT_ABORTED: + rc = PQI_CMD_STATUS_ABORTED; + break; + } + + return rc; +} + static int pqi_submit_raid_request_synchronous(struct pqi_ctrl_info *ctrl_info, struct pqi_iu_header *request, unsigned int flags, struct pqi_raid_error_info *error_info, unsigned long timeout_msecs) @@ -3710,19 +3743,8 @@ static int pqi_submit_raid_request_synchronous(struct pqi_ctrl_info *ctrl_info, else memset(error_info, 0, sizeof(*error_info)); } else if (rc == 0 && io_request->error_info) { - u8 scsi_status; - struct pqi_raid_error_info *raid_error_info; - - raid_error_info = io_request->error_info; - scsi_status = raid_error_info->status; - - if (scsi_status == SAM_STAT_CHECK_CONDITION && - raid_error_info->data_out_result == - PQI_DATA_IN_OUT_UNDERFLOW) - scsi_status = SAM_STAT_GOOD; - - if (scsi_status != SAM_STAT_GOOD) - rc = -EIO; + rc = pqi_process_raid_io_error_synchronous( + io_request->error_info); } pqi_free_io_request(io_request);