From patchwork Tue Nov 14 01:37:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 744608 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F87AC4332F for ; Tue, 14 Nov 2023 01:38:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229696AbjKNBiJ (ORCPT ); Mon, 13 Nov 2023 20:38:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229508AbjKNBiI (ORCPT ); Mon, 13 Nov 2023 20:38:08 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4750A1AA for ; Mon, 13 Nov 2023 17:38:05 -0800 (PST) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ADNscjh016932; Tue, 14 Nov 2023 01:37:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=FQa4V8Kesb8ZxQtrf1TJYlHituufnQJGEeg4rmR31Uo=; b=Yxrx+VKYV67v/2HUgMlKJThWNzmFo2F2GjMdCQpXG4WPz40K+k2qgfuKopDD7PXg5Mo3 1vIhQcesEhdzgfIP1foemwgeB4EhncY6uQ3yqyvi4DUYpG6HqmW90Iqtl8xA6oFyQN7I 1T0vJ6zg0LAF9uxPkWyNGfA7MudNcwmTZ7xE+Jp0SmwL43VloGQKcYPcObVMCsJjZt77 npI6rmJ1P19V4SoM8n4LUvWgRRHsPvt8qOxKwKwK8tzghkH38oluxaAenpoicxPqHOXi wiifj1QSqdDhi/DFYtR6ZkYhJUKo7CjJoz4inVHnx+a5uArQA9pxl5dGGku9ioT21ck+ VQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ua2m2c4gc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:37:57 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AE1ECRT029776; Tue, 14 Nov 2023 01:37:55 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3uaxqqsc1q-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:37:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LC1YlayBB3O/SFnsfZLeoKFhRsZ3WsF6hl2/FClTfdhkz+bQGZkxZ4WzLM22nURGwG6QrHSn+Opqpw1fhQ0dFqmjflSc+By802MYOlmw9KRmp3sdASV1+0/DeJ9AmZ0YQb2Mr0PZO5r8EUsp7PXPXwVsKYYK0nlTDokj68TScWfOw++hrM1F7gQ7OePzd07Vwa3NyEnOOF/X0GFqe6/Cltb45z8zS4OXnoh28M/qsDx9IPyBFaZzqeMlTD5HJLsx4WcI/aGkeXtdNiQa1wne9WYmxfuiRezg9uX2IIm6HwnXFbXl4GUHptPLJ2qujDJYIWgBIjTAtJrPkphb3sGVfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FQa4V8Kesb8ZxQtrf1TJYlHituufnQJGEeg4rmR31Uo=; b=W4CiOcQXhU7LIC2cbavAjbukWFEet9EMUVhj7HdELSebFTnz2TwZSQyuwJuAGTafd4rd62U6QTV0GQCBWlndP6d2SUadkx5O3QSyDm2c7bqncX2KyVHPaIh4NRcp9XEvF4kWIqXTkGEnE0HvE8v9xjXYMBma657gNI1Fqj3PtYjzP4Utu4A9BtO/BgWnSJ8HZa/z+ZbQUaHCIpgul9TWDYrlgTZw3K37Rtvu/tP+5+NGylCpJGlRW5U6J6X+3X8Q6tCAAS9P3ewA24rPvisjyLfHXGC+bnEYq2o8GDD/d5y8DgI5a+WlX3gFMqco5RozPQRHWdIljVrhEZTdGHVc6g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FQa4V8Kesb8ZxQtrf1TJYlHituufnQJGEeg4rmR31Uo=; b=t1HjqjhRJMx5FuUr4gxdzf9zl4jkb71/V7xs5mWuy9WlQGrEdo078Jo6lVfLl43WMDeoRrLoCtMa7nD21XRS2/NEUWmL9eRNRyt2rEEh2hk1pxVwZOl2xsnUpDGwmSP3gr33TFzFTfp7sMYIFtnBtO7G0hFZw9ywx79Xd8vmshM= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DS0PR10MB6752.namprd10.prod.outlook.com (2603:10b6:8:133::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 01:37:54 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e%4]) with mapi id 15.20.6977.029; Tue, 14 Nov 2023 01:37:53 +0000 From: Mike Christie To: mwilck@suse.com, john.g.garry@oracle.com, bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v12 01/20] scsi: Allow passthrough to request scsi-ml retries Date: Mon, 13 Nov 2023 19:37:31 -0600 Message-Id: <20231114013750.76609-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114013750.76609-1-michael.christie@oracle.com> References: <20231114013750.76609-1-michael.christie@oracle.com> X-ClientProxiedBy: DS0PR17CA0007.namprd17.prod.outlook.com (2603:10b6:8:191::14) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DS0PR10MB6752:EE_ X-MS-Office365-Filtering-Correlation-Id: f54ea60a-f7ba-440d-5ac4-08dbe4b25241 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1nIs6suEMC7Bn09EK9Afnmx+/N3EWMnbm2zcIM17EbByUqzGYWOc1lwYDJi4DLlXMeeXSclbqQ5RK1nuYfrByHdqp7M0wtA9rVMs5m+8+v10AVjOO3T1Zo3RmEtHaLQMEyag1QwfePoR2O9WIAiF/qKYp0rSgyDmIPAQj2PV47q7F0Z/qXO+6y70o0fVjxWq62KDvHCVDX7rOZO7ucaMXeLIen1pyEMXMt3hTNluxtxzpcLZCrhQv8i49fG+udw4RILuQoAbJEdNBbPzseOz+L8S0gIY7emuDdxn1/unxHpHC6edHQJdk8Cw0GkK6sn2m4M1q7Lo1Kr2ADFiqxUZV19S6HVvs2wWF5UwrHKHMKdMD4zjV6xslViECk94fvHinBTcrLWbe2ZPYzpCg7uLqkVWkk7PGqf42KNWqOJLYS86TFPYFmZ1TicTSl/KHAiSd0Z0yZaR9Tu5Ho/Ep2WWSFKrEOPUApycDJ8Aj+1wlhhJd0NSIIuciFPf9uZhgvsQXeYuMJr5Ad7A52t7JLD3nj4mLczk2kFKFu2vDHTxXvkMVtvIeoY6QshAdJkk+Rck X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(39860400002)(136003)(376002)(346002)(396003)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(1076003)(6666004)(6506007)(107886003)(2616005)(6512007)(83380400001)(4326008)(8936002)(5660300002)(26005)(8676002)(2906002)(6486002)(41300700001)(316002)(478600001)(66946007)(66556008)(66476007)(36756003)(38100700002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: O4r2f9TpzeZUBbMVDWKnNY6+7EP4G8AOj4n8oWMl+AcRv7pgif5o2xapIIapwQ/bjEvOQGDT8AhyADyPp1q5W1zZiahdvB9/SBe2teneW5ZTsnltaWF2omVQ3oiP1X5J6hI9WPqIX2benh99TowMfNxn+BUXQ/NtVBX/1kpMkXCHBLmWPSePdSwYtUeJc4qq07Ccw0Uf3dREEBcvRm2T5hjA5TYYvXwH81vBuWX3cHXQV+o7cGl5VuagYDS7jK1RfY1CZOQx7O5PLpF6/aQMy6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ovXD0rTmO3wAtZ0H8X3gvXmG48imEWFdUWJFV5DdRVfCDEK7nZfO1AoSWxAyhy/0KFqKTsZl/vTaRnhCqa25lzGQ54sIYIyKi4H4jB+/ZJochPj25RjFS2S5uPZWFqSXY/nr+HWvwH579Pq8HnTMNFKxx1YDS1WdRbnbROAMTH X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f54ea60a-f7ba-440d-5ac4-08dbe4b25241 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 01:37:53.9335 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8v/kFHerRdwJ1JTC2BdiJHcSTqnXlNoKWORQoll2hzgIHEd+UzW3w8NInJVrhDbybltoUap/kPRmgBB/1AVlYSGwYbW0IRbPciumCAneJt4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6752 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-14_01,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311140010 X-Proofpoint-GUID: kXCW3VRZFX0SbvN_5AJJozBuWE-mpyJH X-Proofpoint-ORIG-GUID: kXCW3VRZFX0SbvN_5AJJozBuWE-mpyJH Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org For passthrough we don't retry any error we get a check condition for. This results in a lot of callers driving their own retries for all UAs, specific UAs, NOT_READY, specific sense values or any type of failure. This adds the core code to allow passthrough users to specify what errors they want scsi-ml to retry for them. We can then convert users to drop a lot of their sense parsing and retry handling. Signed-off-by: Mike Christie --- drivers/scsi/scsi_lib.c | 92 ++++++++++++++++++++++++++++++++++++++ include/scsi/scsi_device.h | 48 ++++++++++++++++++++ 2 files changed, 140 insertions(+) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index cf3864f72093..dee43c6f7ad0 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -184,6 +184,92 @@ void scsi_queue_insert(struct scsi_cmnd *cmd, int reason) __scsi_queue_insert(cmd, reason, true); } +void scsi_reset_failures(struct scsi_failures *failures) +{ + struct scsi_failure *failure; + + failures->total_retries = 0; + + for (failure = failures->failure_definitions; failure->result; + failure++) + failure->retries = 0; +} +EXPORT_SYMBOL_GPL(scsi_reset_failures); + +/** + * scsi_check_passthrough - Determine if passthrough scsi_cmnd needs a retry. + * @scmd: scsi_cmnd to check. + * @failures: scsi_failures struct that lists failures to check for. + * + * Returns -EAGAIN if the caller should retry else 0. + */ +static int scsi_check_passthrough(struct scsi_cmnd *scmd, + struct scsi_failures *failures) +{ + struct scsi_failure *failure; + struct scsi_sense_hdr sshdr; + enum sam_status status; + + if (!failures) + return 0; + + for (failure = failures->failure_definitions; failure->result; + failure++) { + if (failure->result == SCMD_FAILURE_RESULT_ANY) + goto maybe_retry; + + if (host_byte(scmd->result) && + host_byte(scmd->result) == host_byte(failure->result)) + goto maybe_retry; + + status = status_byte(scmd->result); + if (!status) + continue; + + if (failure->result == SCMD_FAILURE_STAT_ANY && + !scsi_status_is_good(scmd->result)) + goto maybe_retry; + + if (status != status_byte(failure->result)) + continue; + + if (status_byte(failure->result) != SAM_STAT_CHECK_CONDITION || + failure->sense == SCMD_FAILURE_SENSE_ANY) + goto maybe_retry; + + if (!scsi_command_normalize_sense(scmd, &sshdr)) + return 0; + + if (failure->sense != sshdr.sense_key) + continue; + + if (failure->asc == SCMD_FAILURE_ASC_ANY) + goto maybe_retry; + + if (failure->asc != sshdr.asc) + continue; + + if (failure->ascq == SCMD_FAILURE_ASCQ_ANY || + failure->ascq == sshdr.ascq) + goto maybe_retry; + } + + return 0; + +maybe_retry: + if (failure->allowed) { + if (failure->allowed == SCMD_FAILURE_NO_LIMIT || + ++failure->retries <= failure->allowed) + return -EAGAIN; + } else { + if (failures->total_allowed == SCMD_FAILURE_NO_LIMIT || + ++failures->total_retries <= failures->total_allowed) + return -EAGAIN; + } + + return 0; +} + /** * scsi_execute_cmd - insert request and wait for the result * @sdev: scsi_device @@ -214,6 +300,7 @@ int scsi_execute_cmd(struct scsi_device *sdev, const unsigned char *cmd, args->sense_len != SCSI_SENSE_BUFFERSIZE)) return -EINVAL; +retry: req = scsi_alloc_request(sdev->request_queue, opf, args->req_flags); if (IS_ERR(req)) return PTR_ERR(req); @@ -237,6 +324,11 @@ int scsi_execute_cmd(struct scsi_device *sdev, const unsigned char *cmd, */ blk_execute_rq(req, true); + if (scsi_check_passthrough(scmd, args->failures) == -EAGAIN) { + blk_mq_free_request(req); + goto retry; + } + /* * Some devices (USB mass-storage in particular) may transfer * garbage data together with a residue indicating that the data diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 10480eb582b2..c92d6d9e644e 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -483,6 +483,52 @@ extern int scsi_is_sdev_device(const struct device *); extern int scsi_is_target_device(const struct device *); extern void scsi_sanitize_inquiry_string(unsigned char *s, int len); +/* + * scsi_execute_cmd users can set scsi_failure.result to have + * scsi_check_passthrough fail/retry a command. scsi_failure.result can be a + * specific host byte or message code, or SCMD_FAILURE_RESULT_ANY can be used + * to match any host or message code. + */ +#define SCMD_FAILURE_RESULT_ANY 0x7fffffff +/* + * Set scsi_failure.result to SCMD_FAILURE_STAT_ANY to fail/retry any failure + * scsi_status_is_good returns false for. + */ +#define SCMD_FAILURE_STAT_ANY 0xff +/* + * The following can be set to the scsi_failure sense, asc and ascq fields to + * match on any sense, ASC, or ASCQ value. + */ +#define SCMD_FAILURE_SENSE_ANY 0xff +#define SCMD_FAILURE_ASC_ANY 0xff +#define SCMD_FAILURE_ASCQ_ANY 0xff +/* Always retry a matching failure. */ +#define SCMD_FAILURE_NO_LIMIT -1 + +struct scsi_failure { + int result; + u8 sense; + u8 asc; + u8 ascq; + + /* + * Number of attempts allowed for this failure. It does not count + * for the total_allowed. + */ + s8 allowed; + s8 retries; +}; + +struct scsi_failures { + /* + * If the failure does not have a specific limit in the scsi_failure + * then this limit is followed. + */ + int total_allowed; + int total_retries; + struct scsi_failure *failure_definitions; +}; + /* Optional arguments to scsi_execute_cmd */ struct scsi_exec_args { unsigned char *sense; /* sense buffer */ @@ -491,12 +537,14 @@ struct scsi_exec_args { blk_mq_req_flags_t req_flags; /* BLK_MQ_REQ flags */ int scmd_flags; /* SCMD flags */ int *resid; /* residual length */ + struct scsi_failures *failures; /* failures to retry */ }; int scsi_execute_cmd(struct scsi_device *sdev, const unsigned char *cmd, blk_opf_t opf, void *buffer, unsigned int bufflen, int timeout, int retries, const struct scsi_exec_args *args); +void scsi_reset_failures(struct scsi_failures *failures); extern void sdev_disable_disk_events(struct scsi_device *sdev); extern void sdev_enable_disk_events(struct scsi_device *sdev); From patchwork Tue Nov 14 01:37:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 744607 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7ACA2C4167B for ; Tue, 14 Nov 2023 01:38:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229659AbjKNBiR (ORCPT ); Mon, 13 Nov 2023 20:38:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229720AbjKNBiL (ORCPT ); Mon, 13 Nov 2023 20:38:11 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84F651B2 for ; Mon, 13 Nov 2023 17:38:08 -0800 (PST) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ADNs3dD030162; Tue, 14 Nov 2023 01:37:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=3APavx0stkgEF/t2ZpDbC2c+AXMAWP50GezwMxmx/GI=; b=XFeqFupYiUYF8fH32k/CpKKzhuUYC0bwBhQJtTWdRzRPIZ8TwG1zfLf1ePWvtK1vuNT/ MQduaW79634Jse32blA9rtgR5668ipySn9X+QSzL9HCpPjPEWTLhm0WF3f1knWaMMgL5 zDGbJi2KwE6vB+EhtL7z4eXbXEJrwRYNgqQP5atxi/pOFX83n7V7SnihgB7QeRSUEa33 A2vtMLv1325D+cSOvdX+gnGYUmjougvM0TetCUq9EANqFHsOS37w5DgXLsIUOVIOP2Md qmuSpe3hQ7iWFbhf9LZzeZGIP0NZr1hAr+d56Vl9fWquxXWS6R4czADtdpSMrlhOpG0v Sw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ua2n9v56m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:37:58 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AE19n3Y013669; Tue, 14 Nov 2023 01:37:57 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2169.outbound.protection.outlook.com [104.47.56.169]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3uaxj193ht-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:37:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KYglTnTLRH1P+fYtYh6bAWLhCeNUPqeOTvagsoOjVOX5FUTnYfspoBAjoTIJgV3ViIl+W8wGlimXKEetLbVB4IjIHxH7jojlwlD1dgReIz+OTkHCSRCvV3p/Eoxh7YLA/pQeeHkM0nvP8ob44PR7+pj0Z26bU4AwGhM28VGgzNp10eiVkazXqyXCC/aVj/6jBzTPVJlxaKd+JFs3ymyDgPlculjZ9GQyJYo9lwwfUMFKVd/SqwsXwfybuyl/WzgUUoKRimHSn1I3c2hunBdo0rfhrrnagrO3i+IRulRZz07QbmNrEenUOdJBdpd2X26/qDrjc5ILUySJsQNf2gzOSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3APavx0stkgEF/t2ZpDbC2c+AXMAWP50GezwMxmx/GI=; b=gfNt1wS8b5lZkpDSfXhsWnN1ORVxCFTPOTOp3dC6/dMBcawGHXlUJv7qEvkAWUYswa9RLVi8Pw9zKq7uzVKtDml7/MwEVxk3kfvtjzY2fAwtLp/6JsJxZSP1hjKC6zmf0upWS4DE6SwuzAMZJGQTlNBl4gHKGTQxO9RJlnt5uFraFCAXlAY+ESN7ElJDuRmqUSz2gXSxYpY4S6fFkcQXTfG93nnhiYEM2jafDthQgs9oCcNn3m7Mh9aePEJR5KKrRyhmQ4Jx0XXgDftoaljc8n7v9JOjuzzZetG+qxvFxUqiicW4kwZFUVf3hSvFPF0LPIWg3rCbl7B+qCP2tS3QZw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3APavx0stkgEF/t2ZpDbC2c+AXMAWP50GezwMxmx/GI=; b=bZCeT7koujN7LYvh8SClB5NQiGStnFtYFnnaF7aLpfJ4Xx13gWdv2uMQcaAvQ6NEX1T1fXgTbaOqgFR1RXmnMDxZsKpAqvBrxv1tjUjO3quO6qNtUnJ4DIwo+vSHf7r/Sir9PR8TbbDjMOtL3GubA+EJtPqfowrCvlUiKWvruls= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DS0PR10MB6752.namprd10.prod.outlook.com (2603:10b6:8:133::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 01:37:55 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e%4]) with mapi id 15.20.6977.029; Tue, 14 Nov 2023 01:37:55 +0000 From: Mike Christie To: mwilck@suse.com, john.g.garry@oracle.com, bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v12 02/20] scsi: Have scsi-ml retry scsi_probe_lun errors Date: Mon, 13 Nov 2023 19:37:32 -0600 Message-Id: <20231114013750.76609-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114013750.76609-1-michael.christie@oracle.com> References: <20231114013750.76609-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR13CA0025.namprd13.prod.outlook.com (2603:10b6:5:bc::38) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DS0PR10MB6752:EE_ X-MS-Office365-Filtering-Correlation-Id: d14ea054-2e1b-4eb5-a63a-08dbe4b25309 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7T0oHqQoLHBnflsHQfq9URZeteN0e51uGAzn5w6uCNJbe2ARS7uaSjffev8mf+oanXpyEj2vv1c6H45azWIhglEei51obbOcjiUpcSQAj8Q5dKnb4tQyPHzOa0YYfUdZNC0r6gy3/QGlu7jA84WgfIyd/htDDBaadCdM1Nvh1CyLfXPNOZcP1HbMpDcMP+cprR11q5VVAEC1u5FoYdOkMI7FAHddGQCkJ+cZ+qriTzE2YeMz2U8BfEs89xWrPPWDiJNZO5HQ+6xw/cjy8CiyGP/Qlru2ldB0kyMlNXiHXqhxZXfJNSgRGWrNou1eoIHUBSDNHw2YJ0+fI1snLrQUhIZRTIdAG8MJbx1SgIx88kA2zDzfBmhLvGFEAPm2OS0tPUq6JWfvC3ZXg/6ZFjo1EZ1Wzt/lfoxB1Ly8dMrOCOJaOKe//z8Cv0Vh1LxguIQvS/gVRLZ0k8NVTlFzaoiI3jA1InsfxUY8NvuaJ0/ph5ZscpaKeAPFzWI5X7qHQYJ9soBL90LG7x9ITaV6U/A2OE0zIg/QGaLX/Qyfy/zIFexQT/YEnXdXvAbuPKzxmvWB X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(39860400002)(136003)(376002)(346002)(396003)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(1076003)(6666004)(6506007)(107886003)(2616005)(6512007)(83380400001)(4326008)(8936002)(5660300002)(26005)(8676002)(2906002)(6486002)(41300700001)(316002)(478600001)(66946007)(66556008)(66476007)(36756003)(38100700002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6cWm15si1x4fsNH8Yo34AyufUQjBLrSlrmk7oR3c1I4m9qoaI1fmJ02Tj+2DxWGfAuXPNedipi83vIQJWFHOuF67hGz0kcl5rvWD54tEXAOC6onCyzWhISzayB9Clt2nf8qdsntpJVBQL5aeH9sPV7Rdt18DMZDtKy4jibpIKx5HS06KnaGwOjGRRJDFnLdYr2xMdGcC2kdyzowSWF0u+hZbIGjQuch70SYHupkqkAUZ/dxyfvv6tbDDqScI5qKs/tQ2I5EPH5CrknftoNT28wINviGYpanH+GMSqeJ3W793MdnHA4WplIIJlUntKNx+R7eSRnpOGpjTBG3zRpsbBDqSNArT3a69V1qibQOCf9bHxv57xvqJefwmFyNc6dF4KsT0zl3ESN7dyCK66R8eHzfRKL5QzBjAY2JimthYEprK7hFguIYdWBqKFc/RIFZYFBHtlYVcdxlwWpXW3vSDj03FedatARH+mdjf6vQAbaCCVLg95hAqZ+4f0Zjqd9h5aO5fb6ektfe03PKSLSvjubveHLFkQywB7DoRUR/K9fty6QYK8bFmXcGIWxqFhx/0ojsA6CyYL50HnrPic32TXYcZm72SQMPlBpSXtnGGd4TErPqch9jjgz2cIKHpJ94XHYWgMtH5YWDWbnudPp5US5gx7YKS41U17D30OPCIfE5UXBlHGELtrDNWzYl4dh4Di9+URbqFTQlRNEnhg3c+LAucx4uGrQ5ZU3t2BAValofKmu8ACF65smrpXa2JhFHrUqoOdPdKserTL9wDmSP/Is7AYu7NpTLjfGcUN1oF+NkLGo8qLHaeYanB96FkUnho5VufamITLG4v9cDu927NBeX9M70hCXfFs5al2kBOEKOfZ1GImE3/DL213bq/P+t3AmA0nvSIW3sZ7xsX8jnea6L+LIj3Y5v9O6cYl4UY8EzxriZV+aI0R9hDdgGZHGjKbzsr1T+bx33qlRM6mfkVzGA3CQFotXROad1u9dX83MEUSR0OH9BENyk1ZBEEh34Y11EEB8kEGCvBLRGj9vc0g5Lj6wJvwsFz85kXGScuqtCSxDHJh5SHPMWAaZRqWpYshuorf+SOXBEl9PUJ9GpKo0JI/Tqg9iF2hsEhp8mVR9EUPypJWMbxA3Q5rKR+uq18kL7GlYUD0ZHBj4CRGKABf7loBVMmzFg2xMke+c5X9JPuHDOMNvGmU6XJp2Ow+P66rkD+yFzcyWqHOKVjY3XtzRwoHNttjYqo340NqtPfAu7GqpbmT4RtYXIHz90qiux6n3Z9q+8oyFqBC82O0sbXyppu+tXGO9b97igXcbiO0+aRwco+9Zwvs4cvnvottz4kBWaAVWCc5e/xRJWMjgwjagay4wbF1OIfxZ974pzslU0QDFPaCzTxY6+POZQhzr4ZuhJqHihbQMAdL5pPWEXWzlYs6odi5/LBw36/+/3T3X7VEp2dGnuZAxacgeeoZy1jYMs0hqqvYXRCaZ6Y3xm+2RQR0vcMz+apU6npI2akg/tGlKGhRQ8YvylO2tVMbDMkXfbmZpCkxfF9rIHqTxsS2X4G1CyIW072ELMewxsI5ZopY77QrTUh1SdkJn2ctjLlHnPOk2DdvGGe5eitHXoM5Q== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: SCqauVOWksc4/PlK3duHQt+GZLWO9SAYqq4uJA1L2lHA2acmgoEReW4uodMm7AVxrZESWe1pw51RoUpfLgmlHX0eWHqJcOXeI/FDNR+LuXRUR7CUeGxLBzD/ySwJ9U9M2gzzjfySuRHUwMOaOfkf6pwSnSonO+RMp56YBKQkonnoxlGN2qHAfKBDTjb1At8cwD2cucb2O5+h6Jo7d+vP2m+4pj80vfsk+83LPe30nrENcV0tEKbvjjDBRQCY8yl17c/qGO3G2x2bs0pZDgPwdlXbJpqaOBVgp1vnnt1fGY2adTgdn5gHnZOoX98Chm9nqvtb0ALLY6FNAco7wpTiaJwXLJzDbUxqyL9TjY62zQ3di3C/lPGNeoG9svlVuMcDaUl/ZIJJQWjqMsqwYqiSztOrfhQub9A3vM0aDEJyw20znu2pkEKNDNe70VJQaiIq2SKr9kyFl0jPCP7rlYz8VCbDxj55YRCN/gvf37Z0WIVBWAfAOe/QwVcCnjo8pqnG2U/Vs7b1Ii7oyU+491Qq6sf4QbQVa7OWfCwY2AFo7LUqszxL9aXyPAc3r/kKstCepha6xuzjnWUs9ak44/KrcnhAWQoX2ecE9PHlUy5cTCoFFSONtfNPqeUholla8rq13/j6CrnydGJQzsw/ammVCYIxLhJ9IKfu15MebV79/B9AM9/WSwxrqrBNmDdJ/oG2OLk7IZafnst9HNhl9zqEmDkIJWdxko8VpPDxxrGg6Tm1ny+gl3Qg4hEdDvz9LIp3pYCAtEFaNze+Spn56ahWTVqltgGeR+rgDZBDC1ivIaEcm+a0zn7RhewfByFFu6g8NdN6SrnslcnfRX+FrLQGZBPuPJyy17m5DQz+LSi72qikiOl81UvedNIK+98pNqwb X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d14ea054-2e1b-4eb5-a63a-08dbe4b25309 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 01:37:55.2577 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Ni7hAJirMn1gSPgT7D/Qow35erihxKPqWkX+rKW9A31OdIPcZGGmOoy189gw2ioOaHiYw8aOKH9iQg943Uc5HeOL3HqdkmsXh1q94RW8Q3U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6752 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-14_01,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 phishscore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311140010 X-Proofpoint-GUID: jLhPl-Hre1oNUvtqIiaWJtRi6NogCPa2 X-Proofpoint-ORIG-GUID: jLhPl-Hre1oNUvtqIiaWJtRi6NogCPa2 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has scsi_probe_lun ask scsi-ml to retry UAs instead of driving them itself. Signed-off-by: Mike Christie --- drivers/scsi/scsi_scan.c | 46 ++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 44680f65ea14..eeb53c28581f 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -626,6 +626,7 @@ void scsi_sanitize_inquiry_string(unsigned char *s, int len) } EXPORT_SYMBOL(scsi_sanitize_inquiry_string); + /** * scsi_probe_lun - probe a single LUN using a SCSI INQUIRY * @sdev: scsi_device to probe @@ -647,10 +648,32 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, int first_inquiry_len, try_inquiry_len, next_inquiry_len; int response_len = 0; int pass, count, result, resid; - struct scsi_sense_hdr sshdr; + struct scsi_failure failure_defs[] = { + /* + * not-ready to ready transition [asc/ascq=0x28/0x0] or + * power-on, reset [asc/ascq=0x29/0x0], continue. INQUIRY + * should not yield UNIT_ATTENTION but many buggy devices do + * so anyway. + */ + { + .sense = UNIT_ATTENTION, + .asc = 0x28, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = UNIT_ATTENTION, + .asc = 0x29, + .result = SAM_STAT_CHECK_CONDITION, + }, + {} + }; + struct scsi_failures failures = { + .total_allowed = 3, + .failure_definitions = failure_defs, + }; const struct scsi_exec_args exec_args = { - .sshdr = &sshdr, .resid = &resid, + .failures = &failures, }; *bflags = 0; @@ -668,6 +691,8 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, pass, try_inquiry_len)); /* Each pass gets up to three chances to ignore Unit Attention */ + scsi_reset_failures(&failures); + for (count = 0; count < 3; ++count) { memset(scsi_cmd, 0, 6); scsi_cmd[0] = INQUIRY; @@ -684,22 +709,7 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, "scsi scan: INQUIRY %s with code 0x%x\n", result ? "failed" : "successful", result)); - if (result > 0) { - /* - * not-ready to ready transition [asc/ascq=0x28/0x0] - * or power-on, reset [asc/ascq=0x29/0x0], continue. - * INQUIRY should not yield UNIT_ATTENTION - * but many buggy devices do so anyway. - */ - if (scsi_status_is_check_condition(result) && - scsi_sense_valid(&sshdr)) { - if ((sshdr.sense_key == UNIT_ATTENTION) && - ((sshdr.asc == 0x28) || - (sshdr.asc == 0x29)) && - (sshdr.ascq == 0)) - continue; - } - } else if (result == 0) { + if (result == 0) { /* * if nothing was transferred, we try * again. It's a workaround for some USB From patchwork Tue Nov 14 01:37:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 743969 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F5BBC4332F for ; Tue, 14 Nov 2023 01:38:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231446AbjKNBiS (ORCPT ); Mon, 13 Nov 2023 20:38:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231132AbjKNBiL (ORCPT ); Mon, 13 Nov 2023 20:38:11 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACC601B5 for ; Mon, 13 Nov 2023 17:38:08 -0800 (PST) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ADNs3pf030154; Tue, 14 Nov 2023 01:38:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=CDWpIPIdWSUdGwwTJR8qL2jDZ+410X72bl/pqP5LwQ8=; b=1cOL+LjGpgXf25SEwYF7xSrqQEMlg2vG0oIpN98pToKYuEAyqNtdeZozT2/W1pA7WEuV 2JHuaizKhoY/HLY4XVF5Nh51T5LngIKuwKjqCxbUDuRo0afBomEBw+XGXeEPQYSpsCqR eSoBarLwRf8tAYEuKKh7cOr96t7Jw1a6512AglC2f+bU99H09BwebIb4WoqO4itHLaLG HxzmdI8b3ydkvfPUeEwceM4RQSYJXR0MToUDW/wfFCa27CTLqLMFvcxA8Z3WKqyidwpX nv08V1/lksKbOAe+oQw2NzLcP/WPDiq+Dv9BYmb6aOEHEKkrA4ky/jOMoGCJV5L3lDO8 7Q== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ua2n9v56p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:37:59 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AE1Badw022702; Tue, 14 Nov 2023 01:37:58 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2040.outbound.protection.outlook.com [104.47.51.40]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3uaxpxgwjc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:37:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RcyjoouCcDf6n0DuBXsW9hFCVa/H+PENCrcg8rC7b+r0gwO5TbC/9UqXz/j2mlMJ9iYieSdYf5Prbhpwwiexbd276nW0s5CpgUOxiQew68awCNNhC9WkggAj+PYbAClCxUkENAYcSrZeIjyleIU6DwRQcSVpt/hkzR1SRMA5Pf+zTn8JjJ/vs8d8kL/XG+WyF3wf+Rz9Q0yQfWWXrXc4LixvPWZ676ecLyPeXLlimuZp8utaAqZeeGGNT1PrLDt2tvDEgj080YFFQvEnOCyM429fHLIGoJ7H63Mpxtz5SDoIAQpypuwFawq0Ppk8sWYTTn6qW//Wro09LUUeBk/uaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CDWpIPIdWSUdGwwTJR8qL2jDZ+410X72bl/pqP5LwQ8=; b=hX3Rq49504wIyaT1ozeqq6vkKKvhVJO/bX+OWOuuS5y58/dAIgFSs4TGjxiE4+xcfMqR42LNV2PoMDBG4etcRQW60FmlfmICobCACfNkC2OH1df3dv+whb8rwND1MOk66fq+WjgKlA3gHXgA507OYTlM3Z5IE34fIcvFFcrN3o4/8Q2JjHly/s3epGTSW/QrI9LQdEwpUYnfzi6lPzeh9zC8BwEU+FxPyA/6Lbhl+EDmKefJ+1lIgKD79UgiamcAFGYyXAMjdoGJB/2+3WdbwV6A0aT6E5+wMiSYphEeRdFUrrNyYubDJ8pO3ONLx5bnuj7spfzFiIemY6Ezd4LGDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CDWpIPIdWSUdGwwTJR8qL2jDZ+410X72bl/pqP5LwQ8=; b=Q3dqZsoFVC0F3CRDDVFUxKGWRRxXZLbX0t06Gi8MDTgOwp6NQwIIp2TNT9Meaz06Xzy2i+uDIrwCO6BSA9kt/jz639CGh+tH9pFgU+uvesTwylaCGsowBcp/jpoRah6gdjXhVy5kp5gjTASDWlXPtv/C550lIPCl8APmxi8xWys= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH2PR10MB4199.namprd10.prod.outlook.com (2603:10b6:610:7f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 01:37:56 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e%4]) with mapi id 15.20.6977.029; Tue, 14 Nov 2023 01:37:56 +0000 From: Mike Christie To: mwilck@suse.com, john.g.garry@oracle.com, bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v12 03/20] scsi: retry INQUIRY after timeout Date: Mon, 13 Nov 2023 19:37:33 -0600 Message-Id: <20231114013750.76609-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114013750.76609-1-michael.christie@oracle.com> References: <20231114013750.76609-1-michael.christie@oracle.com> X-ClientProxiedBy: DS0PR17CA0001.namprd17.prod.outlook.com (2603:10b6:8:191::19) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH2PR10MB4199:EE_ X-MS-Office365-Filtering-Correlation-Id: d423dbed-d20f-4eaa-2cec-08dbe4b253cd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VSlVJVu6MQPQNrpxJQVJ+kA1FI8rP03m+WzQx5OX8445GXJp+PbXgI/RK4GXtEns+PEtj0Gc87IfuLHhRPIQihvcuCA2xF09aqSUAQdGpnc3caswOnGB9XW21BYDlDzrHxTnQB4r3sKtOICoyF/wV3zHqk9uipkNz1hAzplA93RH/f08L1Kfy+mXAv+SrE5DhcP9HvO/kc1/O5YCmJpTicJumdv5uHbh4HHhl7trKf92zzOGRjKTbCT4R7x/+r7xTTSR/PTv491ZqpneXYEZNYEY/DyMDNv5FEcvemsHkIhgEvVoDAzCAWQ0PadEytjZR+J5BnoWnUE9hYXZxCQq8ZeJEo7NPqqAZSLsVThq/PtHS5f6s6JPDQBhVYZTPns2H7Nf349lyz2InEZ1M9uDdavVAt0iCQ+Lp72FUuRXn19HPr5wwbVrKuwvuikDEsMqowtSpkH2CfY0tXKOLAdzloL4clVEP+RkO++O2T+hcmNjHefxQPA/WnZsz5k++k37OqLzSTXjg/5DSI7T4Pq/20IlTtZaG3Re7Rz9C406byvP/F5sdo9ZouRf06aAWqTpwedA/A0SDy3UlG5QqTrh8nFcbqXUmUxWU8hUkzaCVgUoxVpLuRQAeQ/K68Uc+oWl X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(346002)(376002)(136003)(366004)(396003)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(83380400001)(107886003)(1076003)(2616005)(26005)(2906002)(3613699003)(38100700002)(36756003)(86362001)(41300700001)(6666004)(8676002)(8936002)(4326008)(6486002)(478600001)(6506007)(66476007)(66946007)(66556008)(316002)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fPgmGRZmui5TEoJUvUcUwjo26jqGtojF4fkCi1MykTR2OXYR+IEngoIxfa2C67zf/B7agKKlByMasxsWZAvEy/443f1meqdvl0OMKVe77KosBIHn5s04pqJ7VS77EQUYatrQJS2pZHJNm2EE6z6DStQI+M7RpG61dmmTzRRbng7AMht0ToP3cj7jc7ySAUbyQDWqm0e5ROhIT1Se6In9PRjEoDEOc/KCLh4Sr5j/U0pA8fPOV8200z/m12mB2K7/xigspAX2e2K6kALIiM45nymnNoqtsd4p6DIt8faseZAHxuUmbmjT6i4/JNwB1ezVVsnsY451Z5YCUByvhpLfQ0V3jmX3EoVyqxde8zsW3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AMpqBKoyJ1hN53Bhplc28WCffSkXu/XnzJJT/zabYgBqmteAXwhDkg8Q70WbfRNuvvTW98fbGI4erJOBxVfZzN85R8K8KW X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d423dbed-d20f-4eaa-2cec-08dbe4b253cd X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 01:37:56.5184 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: urOWVqHd/LEe8kbq4oViGBfgcfi298Kw6KciOwiMR5kPSwKqm/CCLiLTtKt2q3SHOAtwxhVkBqQgEX4BGMV59PzmhWwb1JbI2UF44W6F3OI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4199 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-14_01,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 bulkscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311140010 X-Proofpoint-GUID: KWhOhJudI1nyO0tSgDYSlEAd8gSwNIO5 X-Proofpoint-ORIG-GUID: KWhOhJudI1nyO0tSgDYSlEAd8gSwNIO5 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Description from: Martin Wilck : The SCSI mid layer doesn't retry commands after DID_TIME_OUT (see scsi_noretry_cmd()). Packet loss in the fabric can cause spurious timeouts during SCSI device probing, causing device probing to fail. This has been observed in FCoE uplink failover tests, for example. This patch fixes the issue by retrying the INQUIRY. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Martin Wilck --- drivers/scsi/scsi_scan.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index eeb53c28581f..8da0990b2dde 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -665,6 +665,10 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, .asc = 0x29, .result = SAM_STAT_CHECK_CONDITION, }, + { + .allowed = 1, + .result = DID_TIME_OUT << 16, + }, {} }; struct scsi_failures failures = { From patchwork Tue Nov 14 01:37:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 744605 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9148AC4332F for ; Tue, 14 Nov 2023 01:38:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231449AbjKNBib (ORCPT ); Mon, 13 Nov 2023 20:38:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231172AbjKNBiS (ORCPT ); Mon, 13 Nov 2023 20:38:18 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A4B81AB for ; Mon, 13 Nov 2023 17:38:15 -0800 (PST) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ADNsG5E008833; Tue, 14 Nov 2023 01:38:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=lBn+8OH8bJzzXWR1hyDc5gAZXNZRJ54YZBc3XrfwnWk=; b=rOUUS8gcfSpnpuCse0IZymhQrWh6ndsLmG/NacX4wlDqN4jFEz+olH5ce9cLGh/DpXYk KYriH12cUFrMUF4wwsn1r9D/cpPAN/68ksVJPoWVhbvWrOOdgJIZlx2qog8s3MiJQvmK o7iRCnHytkDCQD7Wvb3McbWqdPRMsMXemPcl9fXNUtag0+ggtSvoHm8nlGQDxlxLdfoi akUVF75kvjP0vXMww4+jszJ5jBQbF0LzSDTxw/k7NsVDqebPS8rnLVkBSJOdNfrTXaxk x3EyLWeeRRYNBFO54DyjvXVrNCILUd6/eYg1eZQthdHeLMttgtwl0uPfYvXJACGWd9Nm gg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ua2mdm7a4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:00 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AE1Badx022702; Tue, 14 Nov 2023 01:37:59 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2040.outbound.protection.outlook.com [104.47.51.40]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3uaxpxgwjc-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:37:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Atyk7nsJi24E4cFGJRrQE/bRcNDEF4zFMuHwFlXriBBehb1wUyfFWkjbBroq5Sg+eh1qFnHJcD0ZgHYC9DLMBDL/edVE49S8sfO4FJZJ+JwvEC3998r2RWAYcdEjlBofpoxpsCkGAlP4XuMr1sK9bf9PiJ52mWPlFYtQabhOc4AcPVSbsyaBq6+hJPbz1+Da73iioJP3/0FcPipQptERCdiEUHnonZ0Do6G3Okzg73eAdfH59wdQY8pf4qdqfyidsNhUSS+RY403VfwD1hf6sw1NmvHYRBM8zLe5PI2Vs/8Z4g3kzoNjEVnv/fF//NkA5si6tYMQHJZiqkE0J4e97Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lBn+8OH8bJzzXWR1hyDc5gAZXNZRJ54YZBc3XrfwnWk=; b=lzGz7FvvLkNnKDTIv25sUSB1o44bHCI7iWviXjkYTBgMkYDMTe99mXXC+mUGycC2/2aPUnGWswiH7haBDM1rN+rHhV1swTocPvB8XO3iwia8GZGfzUdEIHHuMf/uEvjolc52eJ7ngALUty5XXxxf4CTkq1BPkk2EMzquQb8qb2G474mvy6lkfuy7K0UbtY9KaW4ixGuYjvzEnaV/XZHzm0YhZrPntAqpubYEZElPB7h3eNlpy+V9ubSpIQQNFewj0ZRWalsZiT2ErggEfJ2yUEFzE28S8p+eJIlP+kkdHqtZUbswNk5BTxgrjlT/SCUBoLGP460k3MwUVE8T2JARSg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lBn+8OH8bJzzXWR1hyDc5gAZXNZRJ54YZBc3XrfwnWk=; b=JttDYN7TxnKiZ0xCpdavn3Ms50KPiEY7njLgiWxz9VRBj5VgUI5M6oPE3I27A6MYO9MNGM7p2E2bNmxzEU1eFPcdAMUzgRz+jVfW3S1prxfttVAMfBbLgCaDi5jBqMqvPl5FMozILku1MHY1Ow99+srNedSWOiqgdYIOW06V6fk= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH2PR10MB4199.namprd10.prod.outlook.com (2603:10b6:610:7f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 01:37:57 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e%4]) with mapi id 15.20.6977.029; Tue, 14 Nov 2023 01:37:57 +0000 From: Mike Christie To: mwilck@suse.com, john.g.garry@oracle.com, bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v12 04/20] scsi: sd: Have scsi-ml retry read_capacity_16 errors Date: Mon, 13 Nov 2023 19:37:34 -0600 Message-Id: <20231114013750.76609-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114013750.76609-1-michael.christie@oracle.com> References: <20231114013750.76609-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR06CA0077.namprd06.prod.outlook.com (2603:10b6:5:336::10) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH2PR10MB4199:EE_ X-MS-Office365-Filtering-Correlation-Id: c392c728-ef42-4f9d-c764-08dbe4b25484 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: owoUyYLcm2dxmIjXF/WYotDYnlo+kOxxgaPW7nGOpysUdvm7fFj3Kt7beWC1iYqVHCpHmmCaYobjMzi4V2XXTqsJuF2EiwsFE3AIS0I6La0WkWFYk82O6NPnYo4ze/jKHIEh1oRxCmmf+1Ay17WBPWSFuHL6A4Oub6qWhCgjWZX01N8roQbs3yXmGzRH2Al/vkG4a0roPhx8UxpzdKQn7cFvC/YC3T9w6/FICOf6H8XryxYsmc4Vumv34heWIFRvcZIBARzXQWqnN2UB0Cpz8v0zvnsiWnWOZnt96lf1iC3ZDEt5xZrN7RnZ5KFO3NbU3RC2avLe8n9yS/IfLRMN1yTOeGvIVDD8QGKJtEfZv7rq9pSdeLjWUo6AHVTMN/Eu5Se39irOeOL/DSRBLQmSFn+JED7/VPzy42tKhWQEkjlCXIXLAPopOe+mwMaJ1Z/GuH5jxqZ77V0w1KFf3G2q8x3SbcwmSNMgWg8B9FvY0zu5EmuF7iXx/dXb09VvCeMSngcz5BXClV9nDaDF/J5xJ5svQY2ET5aALDjCS6s+Zb5ZkWd/b0lrntzPVLiAInPt X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(346002)(376002)(136003)(366004)(396003)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(83380400001)(107886003)(1076003)(2616005)(26005)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6666004)(8676002)(8936002)(4326008)(6486002)(478600001)(6506007)(66476007)(66946007)(66556008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fvfPsBdhIU6zI0LRyMdtH6WcZPnX62sVpz3iQBa0wXiefmeNrhG7PJ+YJs92NnvCJH5WcAkZRzysP9dBw4ioo+hSPJPAZBFXbcNwDHJeJ55ObPF7NtRGSl8fHjeA+4WYLzWxkXeFBDBIa/61eKBtHplYWp15KQGPNPlzJ1lahpMqh0xw5PErX8EitP15MgiKaI+M2OH003pM4t6oGrMFN45tOm9oDqsuHdpHBpiO00JYwy78iBV7DCfg/FQxBd/n2V2Mm7K2WnC0BiOAwa/gLPIX5oeiBKkkIMfCNQwevj7Brf8fLzJzt6V6zYlKXbPGCIVPkKdRyBYoTWtKjWRpoPYZ6SuKbpMZmGhumOF/lK24ywY/Di+A3nVAVWCoSY8dchQyjb3QxQwPrm3GWoVTolnKJ/3rilKqdoJEqxHLPXOKAmgEtryKWr0rhZldDcQSjWOQQVisdLfoutwHkDTXcI4LHSoIGOkoDtqJZYm7TUE2AHVbng+m11vELakQTuHtN9hO5o+aVDTIKWF X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c392c728-ef42-4f9d-c764-08dbe4b25484 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 01:37:57.7830 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3NakIzvQucMk6fub9JlFp7fzwQeXDBIpOa3aEFbQFYnmy15QS2C7DGzJgZp0NyPaEE39n+iqd2/UdF08wahSUIR44VfOs+ipYLO8npzEJig= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4199 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-14_01,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 bulkscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311140010 X-Proofpoint-GUID: D8vxoWpmk1pJNcM31oUIeblx1MuVcPh4 X-Proofpoint-ORIG-GUID: D8vxoWpmk1pJNcM31oUIeblx1MuVcPh4 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has read_capacity_16 have scsi-ml retry errors instead of driving them itself. There are 2 behavior changes with this patch: 1. There is one behavior change where we no longer retry when scsi_execute_cmd returns < 0, but we should be ok. We don't need to retry for failures like the queue being removed, and for the case where there are no tags/reqs since the block layer waits/retries for us. For possible memory allocation failures from blk_rq_map_kern we use GFP_NOIO, so retrying will probably not help. 2. For the specific UAs we checked for and retried, we would get READ_CAPACITY_RETRIES_ON_RESET retries plus whatever retries were left from the main loop's retries. Each UA now gets READ_CAPACITY_RETRIES_ON_RESET reties, and the other errors get up to 3 retries. This is most likely ok, because READ_CAPACITY_RETRIES_ON_RESET is already 10 and is not based on anything specific like a spec or device, so the extra 3 we got from the main loop was probably just an accident and is not going to help. Signed-off-by: Mike Christie --- drivers/scsi/sd.c | 108 ++++++++++++++++++++++++++++++---------------- 1 file changed, 71 insertions(+), 37 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index fa00dd503cbf..1af04b01e1df 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2453,55 +2453,89 @@ static void read_capacity_error(struct scsi_disk *sdkp, struct scsi_device *sdp, static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, unsigned char *buffer) { - unsigned char cmd[16]; - struct scsi_sense_hdr sshdr; - const struct scsi_exec_args exec_args = { - .sshdr = &sshdr, + static const u8 cmd[16] = { + [0] = SERVICE_ACTION_IN_16, + [1] = SAI_READ_CAPACITY_16, + [13] = RC16_LEN, }; + struct scsi_sense_hdr sshdr; int sense_valid = 0; int the_result; - int retries = 3, reset_retries = READ_CAPACITY_RETRIES_ON_RESET; unsigned int alignment; unsigned long long lba; unsigned sector_size; + struct scsi_failure failure_defs[] = { + /* + * Do not retry Invalid Command Operation Code or Invalid + * Field in CDB. + */ + { + .sense = ILLEGAL_REQUEST, + .asc = 0x20, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = ILLEGAL_REQUEST, + .asc = 0x24, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Do not retry Medium Not Present */ + { + .sense = UNIT_ATTENTION, + .asc = 0x3A, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = NOT_READY, + .asc = 0x3A, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Device reset might occur several times so retry a lot */ + { + .sense = UNIT_ATTENTION, + .asc = 0x29, + .allowed = READ_CAPACITY_RETRIES_ON_RESET, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Any other error not listed above retry 3 times */ + { + .result = SCMD_FAILURE_RESULT_ANY, + .allowed = 3, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = failure_defs, + }; + const struct scsi_exec_args exec_args = { + .sshdr = &sshdr, + .failures = &failures, + }; if (sdp->no_read_capacity_16) return -EINVAL; - do { - memset(cmd, 0, 16); - cmd[0] = SERVICE_ACTION_IN_16; - cmd[1] = SAI_READ_CAPACITY_16; - cmd[13] = RC16_LEN; - memset(buffer, 0, RC16_LEN); - - the_result = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, - buffer, RC16_LEN, SD_TIMEOUT, - sdkp->max_retries, &exec_args); - if (the_result > 0) { - if (media_not_present(sdkp, &sshdr)) - return -ENODEV; + memset(buffer, 0, RC16_LEN); - sense_valid = scsi_sense_valid(&sshdr); - if (sense_valid && - sshdr.sense_key == ILLEGAL_REQUEST && - (sshdr.asc == 0x20 || sshdr.asc == 0x24) && - sshdr.ascq == 0x00) - /* Invalid Command Operation Code or - * Invalid Field in CDB, just retry - * silently with RC10 */ - return -EINVAL; - if (sense_valid && - sshdr.sense_key == UNIT_ATTENTION && - sshdr.asc == 0x29 && sshdr.ascq == 0x00) - /* Device reset might occur several times, - * give it one more chance */ - if (--reset_retries > 0) - continue; - } - retries--; + the_result = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, buffer, + RC16_LEN, SD_TIMEOUT, sdkp->max_retries, + &exec_args); - } while (the_result && retries); + if (the_result > 0) { + if (media_not_present(sdkp, &sshdr)) + return -ENODEV; + + sense_valid = scsi_sense_valid(&sshdr); + if (sense_valid && sshdr.sense_key == ILLEGAL_REQUEST && + (sshdr.asc == 0x20 || sshdr.asc == 0x24) && + sshdr.ascq == 0x00) { + /* + * Invalid Command Operation Code or Invalid Field in + * CDB, just retry silently with RC10 + */ + return -EINVAL; + } + } if (the_result) { sd_print_result(sdkp, "Read Capacity(16) failed", the_result); From patchwork Tue Nov 14 01:37:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 744606 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CE22C4167B for ; Tue, 14 Nov 2023 01:38:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231492AbjKNBiU (ORCPT ); Mon, 13 Nov 2023 20:38:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231313AbjKNBiM (ORCPT ); Mon, 13 Nov 2023 20:38:12 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB2B01BC for ; Mon, 13 Nov 2023 17:38:09 -0800 (PST) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ADNsDm0000855; Tue, 14 Nov 2023 01:38:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=94JLefK/6DJ2NlT2IQT0LYlfk1Gea7MNrYbFixqFQMY=; b=yQh3wQ7/fojH6zge6+lMXFfISGgc8oZSkE0LZnvPdcGi6ymny8zOW7o8jQlxNuIkq+WT bOBWvnIyRcoTmUV15KhXp/0U5CLe76jADfRIG9pEzVMeRzjG4nVEeBL5ckpEKdlHgNJx Sru3cEMfP7JwssM00ix/kubliGmAqZz4QPuFEUzNJrO1SoAB/JKG4g5JeaUMv7sorJ9K e8zhdQwCOTYOLIg/fLT+zGpN3QfErX9NlYfz0VEdbwZS4Aes9kmtayU/c3dFdCVZqcrk eoqrWltLZyGokDA83OSZZyFjfMwyk7MWsr9XIhrCMY+Im0pBYnQxpnYfATChES50Sg+7 3Q== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ua2qd44ee-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:01 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AE1ECRV029776; Tue, 14 Nov 2023 01:38:00 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2041.outbound.protection.outlook.com [104.47.51.41]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3uaxqqsc4t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S+JU0A8nCA88bXWRQEjDbtC7M2IoRRFDqwzny58zDc6joyWYrqxt8MKwEJqXwTg3R4cgm36MtdKVOSjvwoFPMys/GKPBLL0euMqjdbMW5BtTRBPHlDJ/g5YNvl8rUJwNmN2tuDrov1X4JIOqxX9C0BJQWGB3bWt52qXS6aq2ZauYwO0+DstwK/w7eQkjdWroa+7k30lJNW6WtLWrVO0XyiKtMVYCPO5GxWp6jsn/sO6SPyOGIQ/RdBFbrD0lPjnDd5vnGlSQ8tRPtwgdSnpkSUAe8jBYT6wARWvrd+OTcH+WushIUhwIBEBb0AF9VYXwQN79VjdhzzRruYu/y/nLmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=94JLefK/6DJ2NlT2IQT0LYlfk1Gea7MNrYbFixqFQMY=; b=kY5eWaCZL53I3cbCwX7A+ub7EDhE3Zy1IAFfOTfyUa/trjthajVnR3RWYE5uX9c7tU9bcbbpzHty5acXpDjO2nKsifeYOZ2RjTFrjb2A0m/syFQyjhwtN9T5EqwhmBLm35P0IzTTGNYkDpHZCZCdauOBT4/mtIPS1R+e2lriy/Obd8s6vM5I0ZDnf705SdGmpBOJoTy7S/LrHQ50UdPJN+faEl+FbvvJSJWQ+r1/9P2V8mi0nCUx1tDUG94zB5bKQDOTHMj+Ulpovt85SwuyW469e+5gUIQu1Xbtz4G9zHGhLfKH4oz89/9zE/pdPQyOFcRo1EnzHOyofxa1BywgZw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=94JLefK/6DJ2NlT2IQT0LYlfk1Gea7MNrYbFixqFQMY=; b=XuOo8J6n+epxoAaFij9MNDVVs5kBz5r2gdOgEkbIvimm1js0hGSTM3RNpaAQ6rhiqxSg4CjU9jD2B7sV7SWBVMB0iS8zjEhzl05IW2F28MJ2dZ3TErfFaPbj6g/WemWrGC2HDZBPoeKc1VIJD4o7F9tRzBlsRE/PYUXL8LQQxp8= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH2PR10MB4199.namprd10.prod.outlook.com (2603:10b6:610:7f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 01:37:59 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e%4]) with mapi id 15.20.6977.029; Tue, 14 Nov 2023 01:37:58 +0000 From: Mike Christie To: mwilck@suse.com, john.g.garry@oracle.com, bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v12 05/20] scsi: Use separate buf for START_STOP in sd_spinup_disk Date: Mon, 13 Nov 2023 19:37:35 -0600 Message-Id: <20231114013750.76609-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114013750.76609-1-michael.christie@oracle.com> References: <20231114013750.76609-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR05CA0050.namprd05.prod.outlook.com (2603:10b6:8:2f::9) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH2PR10MB4199:EE_ X-MS-Office365-Filtering-Correlation-Id: 28e16c9c-30aa-4054-9d14-08dbe4b25537 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wDEwIOMJ2zV9W+GTx9rj+VfkYMxFyVlFzX9dSTFq+t+gdA2Gm8irX8VsiqefznXwIyvgIZVq7/W3F541cPO4l/Lzk9CF7Fangn8IsBT4ku1SPC71wQtVmdbfBkHnY6Tmk1ShTdTlFglJ9Fmi1BrenPBWyLYE0p9JK8tD3VR/6Ev7oZAPHqFy24ztCMP0VSM/co8WHUaTTO6UzHfEdiYgdAI60XpW8rm6j9cBU3FKiXYhmZK1dBCt1UQglPY+1RuX1C9wwqDqgofzys7Qz3ZZx9SsT4XTGX2FPutwfI4UW8uHLS+ySCZK6aHvCwN3b4N3i32M9Fz3hD+A4Z09uXdFjdbSWXcASx3iNAC4qN0Ggv/teQmmK1fTJXOS1yn7rresfyTjC6dAyAjVqIz8zCcIE3ZG2ZPlZVEVtESLG+sNg3XWvdnInvaf1YqGY5eWUDbO4c+jcaC5lQLix+povg368t4VtaVHQTcocIoJmWYRkbc5ht2RLOZpEDHS6WTWilSrzcmjWC81qDjjlkV7+JktICNJQ7FvMCvzkIfw8zluIRW1r96vO7WfTaPweV28AEHW X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(346002)(376002)(136003)(366004)(396003)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(83380400001)(107886003)(1076003)(2616005)(26005)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6666004)(8676002)(8936002)(4326008)(6486002)(478600001)(6506007)(66476007)(66946007)(66556008)(316002)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IY5TXhhN+KfnszIr5SPdSuif9YqO2s2JZ054w1sBi81vLxcueK0rJLQM0X4OA9qwnGuRMFjHTQ2YKNb/zjcvizxaIJeO6t4E1aaBXuRlpcG9YIgWQbntHVLPWs3DAk1eEsDpXzTuindpasw++BjaH+H/lNpwr2sZMjQ3BudJ1/Lgb4oEQkEuxS7O2+4ndI+dA1AjK2Pg1jhN5gvcRmTwwcqIXTMiyOqcpVKByys/gGKIUiMzP/alVZzTVXHOw/BJ9IgGYg92mCOq9Vg1RG7bCrZRPQNOCMUNQam/VbGCljk4JnGYRIUGBJGJCH05qd/ZgOJs0yF78nDY4tSJ/XwrtNnB3CAQZucbFNKOkz/1GsuOMWDtFrCDJ/F4P255tP4y9xxhv/+6+Ul6kfP2ornH/RWlHhb712ZU6v/qnlUkFN7m/8kXlXTsedEPwuMsEtKU8CLbM0/8iCupYoP3ObqA1Ez0kmaUYCT5ClohTLWKiHjIgf9ps91CyYfmM2kSq+VdXl8ZSjQwIdJ9jtEd/uLUuBE4KK1WYrDUgR8dl4UGIBAW/u4be9/DhEfOvSd7ixVSduAN1dY2VhUvWppPBTzxmDTXbRaZlfwWwXaRoAB2BvZy+VT+D54vmrojrKR5qgWgM0p5W/tUOlVK+M5Vt6CsjrYI47iqZjUivJTKGPBkCLXw8RCghuvcRwjjvBWs04KEqSFq3jEdJjaA/jG0rk/Eft65YcC8NSSpXcnSUwScPzM+lLWINWNJM/p7EFIAVT8hqOQ4g/QSfopIiPM7JrItxoWx2dIR/PG16Wl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MB/pxahYToZhv9x4jaxO/i/DXT/IBmqBPrZyZ9kLo5yze/rk9U0NcE0ZeNFY9MOC2G9DniXAkxb19R+WbkmSzYNlnqxmnZWtC8hMORxvMGOoMq1qdztrWrFnK56t3MoXmaPR6/fPYxcikWpaBMLRkEAAAYTwca4pGb9jPumFh8czyTxyge7VG387F8/BBXPye1cweouROdOUVSj6jyJ6k47OIGeVJ6gNZ//NLzat+CvnzrUrhqD5pXKRW7bCku63VNNow9FHviM6VdvOa0Mvb0lDP9r0xZXCPdnYhvxLQ5iRcsHeV+zqFk2mGYiR0QCLzYLiqfTY93Cyl28XbDyXJ2HDzM3rypmE7+qsLOlPm7hkZL67DcfvbLZTAP5YY0u1WEfCxd8s8sUtS8UC5v8tZtGkJH+F+NkhlO7A6EvNJqz32i2mwk5AvEPo8sdzE9WpCOrnitYvRnaf9ZzWeIezk7MX76HBKolawm+JITJ7pGzCX5UyfSftgNvAORdJ6f9/UJZiDB245bjS++FKkQjBF3+lzVppEPwIoteyGK0ky91xh0d6eWWFqQkRJrtcAYOTmS3fI9DQ1mWfhmulm/wLdl2uIkLf0/TZO5DiJ1bcqTCeWaVUQ5YrYG6x3ONa4Za6rcJMm4mrpMPFtCHq9UjO12VK9W0uX97hSGtE5T1N9jbANwbYOm3sDlTp2DAwX/ZggwGZ3 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 28e16c9c-30aa-4054-9d14-08dbe4b25537 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 01:37:58.8888 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Qb9LyzmFzKO+29cxAmbmXqW1Ormtla71R7LpiJL2451blpg1CwssgA0LyKnVDFtl3NIWzpPMO394Vz9htSDyzcyIcL0Xrfdg61kBfg1Tn8w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4199 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-14_01,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311140010 X-Proofpoint-ORIG-GUID: IfGD5Xm-dsJWqIXXFyHOwMizZRwBb6fy X-Proofpoint-GUID: IfGD5Xm-dsJWqIXXFyHOwMizZRwBb6fy Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org We currently re-use the cmd buffer for the TUR and START_STOP commands which requires us to reset the buffer when retrying. This has us use separate buffers for the 2 commands so we can make them const and I think it makes it easier to handle for retries but does not add too much extra to the stack use. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: John Garry Reviewed-by: Martin Wilck --- drivers/scsi/sd.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 1af04b01e1df..641f9c9c0674 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2318,14 +2318,16 @@ sd_spinup_disk(struct scsi_disk *sdkp) * Issue command to spin up drive when not ready */ if (!spintime) { + /* Return immediately and start spin cycle */ + const u8 start_cmd[10] = { + [0] = START_STOP, + [1] = 1, + [4] = sdkp->device->start_stop_pwr_cond ? + 0x11 : 1, + }; + sd_printk(KERN_NOTICE, sdkp, "Spinning up disk..."); - cmd[0] = START_STOP; - cmd[1] = 1; /* Return immediately */ - memset((void *) &cmd[2], 0, 8); - cmd[4] = 1; /* Start spin cycle */ - if (sdkp->device->start_stop_pwr_cond) - cmd[4] |= 1 << 4; - scsi_execute_cmd(sdkp->device, cmd, + scsi_execute_cmd(sdkp->device, start_cmd, REQ_OP_DRV_IN, NULL, 0, SD_TIMEOUT, sdkp->max_retries, &exec_args); From patchwork Tue Nov 14 01:37:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 743964 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13B8AC4332F for ; Tue, 14 Nov 2023 01:39:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231920AbjKNBjd (ORCPT ); Mon, 13 Nov 2023 20:39:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231906AbjKNBj1 (ORCPT ); Mon, 13 Nov 2023 20:39:27 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD30ED43 for ; Mon, 13 Nov 2023 17:39:24 -0800 (PST) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ADNsVo5001324; Tue, 14 Nov 2023 01:38:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=vDyZOEPFNJG203eTO6b9kBU68tc5qR8NV//MQ+okcKI=; b=EcCl1pnciWHGEPjOlQ6l2YUI6pA61fUKhv/ZNCs58Li+9dz5tbhPvT0OBK/I8DCKiqvK bh3qanmwbhnpGhZWm6AUD24LWWSNbXwgwwb96o2KZdqskoVUWQq2DDRs0xIcT86H/7sy aMxnZtE88SJlppnWuSa3v8CdJV+GXwFUX8KFrYfjTk24CMyEPetzYnRDkoahxNqySZwf Dma3ddTKcNUt1+2LuNm72dzp8P/5x9JVXHajkbnP/sZOzvKtug7Ld9xO+otagPsuNI5R XFkO52bjdSMk19tPmNCzi7OGh1hPbIhBQo9/tY3djsLMDLoHty1EDZV0wHJAXPlwkPJ0 Fg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ua2qd44ef-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:02 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AE1Mr5A029859; Tue, 14 Nov 2023 01:38:01 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2041.outbound.protection.outlook.com [104.47.51.41]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3uaxqqsc5h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S6nTwnjSKcPoPkp3a+Eon2msYhSxcmWCH8tQ7C+d9LQ7/7SHLQSc2eLLKJ4UeJqTS+DKOkrQL4Pmx1+NFttFMFooW3cfSgNE06wm4X/naRlnSUc1w0s0axG9EFCxNAYjqoRT+or5DJgrnFsjhN50iuwYQ90tiSK4R1nwNsAnc++6B/Kv4Wli1lnS3+n0Y+PKpPY4NuAwhkWgxga5WoLg+sDDOnh/Z935UqafKNsbnCxIF1doI4njiZHOXX7ws3nE8Za1egvzPboRnHNTgmChcpH6PL32RZsrLpDjlYaVSrhI7d/90ZHAMgNiBO63ya0RFQFnw+XLeyh5nCeO+eKArw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vDyZOEPFNJG203eTO6b9kBU68tc5qR8NV//MQ+okcKI=; b=SoZs/7QWQsCAC2q4TcT9lCHGVzeFe8t0QNn9FNTgmALnNp1v2RfkmF86eKr5sd6GIzBCUCxY8kclrOOFvZKMBVQqyuf2EmFH/m1+jrw2t8frLP4INbHQFAr+n5y+GQgIAi6NgjqoNdb4Q259VS26odcg0opkgbf6iuWRYwhJPN4Cm7AoSRGcRL0YJlAUeE0bgSoQ+afbnui3jQu8vAkGAqir/T83z4OuwTTSWcV8pc36qnqcRXlrnikZp2+upEOe/U0bAnpWyx/DgUyT8B4FU/o/gMj6tAbhEVZ4xEUjbrvrDudduoDP+NzdMSOzji3lBrT4EzUAkLoZwo6baxfkWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vDyZOEPFNJG203eTO6b9kBU68tc5qR8NV//MQ+okcKI=; b=qMaI6c5YQjph/sZWV1zbo1n9GjkFLIt8gHfoDqjlVtOTEFIeHsHjBRT6FJpKfqk5Ba8Z4WjqX6cO326LtsqeXHDd84sSzEjtDfNwBt88Pa7FHuCY73qCmVeRlk4sniTFZ05fb48Glv1a+1o3/StJnODlZ3bW6mmCJStwmV7/Apc= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH2PR10MB4199.namprd10.prod.outlook.com (2603:10b6:610:7f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 01:38:00 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e%4]) with mapi id 15.20.6977.029; Tue, 14 Nov 2023 01:38:00 +0000 From: Mike Christie To: mwilck@suse.com, john.g.garry@oracle.com, bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v12 06/20] scsi: Have scsi-ml retry sd_spinup_disk errors Date: Mon, 13 Nov 2023 19:37:36 -0600 Message-Id: <20231114013750.76609-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114013750.76609-1-michael.christie@oracle.com> References: <20231114013750.76609-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0115.namprd03.prod.outlook.com (2603:10b6:5:3b7::30) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH2PR10MB4199:EE_ X-MS-Office365-Filtering-Correlation-Id: 854d11f4-0ca5-4116-723e-08dbe4b25609 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZbJLoGjM1PQczjfn01+8kvYwPk8ug/4SZcBd5PJ3ADc4gonlwprGH1VIf3PkXD8JU4hYcBsiZdAZWgOH4PkI0DqVWijS8oUA6cuvwmwleHqCbZWc/NTeOGLLR0TugvU+qT6NC7kwz3zoPvtxl1EsC+vzNmwe6gO/7psJDzIjxIhsbRGh6iT6SpVszH3BLMnE3jW/1BHTE8cA3Pb9S+Jokhj3MtgaXLPVFxEchvdHPXCvLOrZO0nz/Ck7Xn/Xhyhez9UuxejNoqgMVcTPUTVy/UQh/4uY2cp9EsBaNDP0eKZNQep/VgCHowwZZ34NcCpqedZDI2rQ9IcPLJFadleeOiJ283s7ZggZSJLKzNuogbozMc/7tRTgq6Gi3cMD1eI9xKvJl/AW6yKY4ahEqZKUD+Cv3+dDhXM81YQcMkhGUlQ0wF9dX5KM7K2hEhRsLuBg5A8ffsnusIGc9jZpjWMos2ep5gBeTIPJWzHD7AUovPFLSAsr5N9zbaqAbXmCFysP0Jp1LRuo9LiuLpzGPo4IZ/jsUxN210gNSQR80qnrIgspVLCnQjACFyCnKRn0ytMj X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(346002)(376002)(136003)(366004)(396003)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(83380400001)(107886003)(1076003)(2616005)(26005)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6666004)(8676002)(8936002)(4326008)(6486002)(478600001)(6506007)(66476007)(66946007)(66556008)(316002)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ne5ezoJ7q7pO1PLfSRhd7l5pfQacY4uTgX6PKoaV/ewGRMLmSeHizv5UL4xy9RR9AQ3oDvxbbduxjAzDSeGayYMCyawVsoi99iDXIN2vQOR34Pb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IkCs5uFBsRbbJgkHt9twsFfsIDAkdoTq/n1RptSSgl8J8XCB3KySUTgiTJ7KpihzuWprT37KdKm905MRzGSWTcvOvQneslxI/i7DQP1MSNdqWp8VI2ozdCNCvpzsZLK19WRM6IdXlnMsVbypD2J4sNyzBvEn7SjMOVUfz2124P0f3eJ3N2ExJGakyl62lfTgtv7YNA/SokdLa5hsMnAgcqDtJeUc0lRbZmzKIjzvGuuQ0iH8sC2CFFf2PkiORH4N6EqmraNLFhCWYb6kAvWGuz+Jif5u7HMWcA6GAxPd/uZ+6rXkN3QdnHX+s X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 854d11f4-0ca5-4116-723e-08dbe4b25609 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 01:38:00.3031 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: I9yoRVf6O5oYwmWRSVC8uPbniY3kFy+eOoOYLa+BwPxyAp2Z6PdPrJSwl+h6aX0aK+ZqNFmnjysZfLFZI6idaFuoP2GIK8/3sut5xq5ZETo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4199 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-14_01,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311140010 X-Proofpoint-ORIG-GUID: 1uUySfgNnvr421a58yafnG4v7GyPHzyn X-Proofpoint-GUID: 1uUySfgNnvr421a58yafnG4v7GyPHzyn Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This simplifies sd_spinup_disk so scsi-ml retries errors for it. Note that we retried specifically on a UA and also if scsi_status_is_good returned failed which would happen for all check conditions. In this patch we use SCMD_FAILURE_STAT_ANY which will trigger for the same conditions as when scsi_status_is_good returns false and there is status. This will cover all CCs including UAs so there is no explicit failures arrary entry for UAs. There is one behavior change where we no longer retry when scsi_execute_cmd returns < 0, but we should be ok. We don't need to retry for failures like the queue being removed, and for the case where there are no tags/reqs the block layer waits/retries for us. For possible memory allocation failures from blk_rq_map_kern we use GFP_NOIO, so retrying will probably not help. We do not handle the outside loop's retries because we want to sleep between tries and we don't support that yet. Signed-off-by: Mike Christie --- drivers/scsi/sd.c | 77 +++++++++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 32 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 641f9c9c0674..cda0d029ab7f 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2235,55 +2235,68 @@ static int sd_done(struct scsi_cmnd *SCpnt) static void sd_spinup_disk(struct scsi_disk *sdkp) { - unsigned char cmd[10]; + static const u8 cmd[10] = { TEST_UNIT_READY }; unsigned long spintime_expire = 0; - int retries, spintime; + int spintime, sense_valid = 0; unsigned int the_result; struct scsi_sense_hdr sshdr; + struct scsi_failure failure_defs[] = { + /* Do not retry Medium Not Present */ + { + .sense = UNIT_ATTENTION, + .asc = 0x3A, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = NOT_READY, + .asc = 0x3A, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Retry when scsi_status_is_good would return false 3 times */ + { + .result = SCMD_FAILURE_STAT_ANY, + .allowed = 3, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = failure_defs, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = &failures, }; - int sense_valid = 0; spintime = 0; /* Spin up drives, as required. Only do this at boot time */ /* Spinup needs to be done for module loads too. */ do { - retries = 0; + bool media_was_present = sdkp->media_present; - do { - bool media_was_present = sdkp->media_present; + scsi_reset_failures(&failures); - cmd[0] = TEST_UNIT_READY; - memset((void *) &cmd[1], 0, 9); + the_result = scsi_execute_cmd(sdkp->device, cmd, REQ_OP_DRV_IN, + NULL, 0, SD_TIMEOUT, + sdkp->max_retries, &exec_args); - the_result = scsi_execute_cmd(sdkp->device, cmd, - REQ_OP_DRV_IN, NULL, 0, - SD_TIMEOUT, - sdkp->max_retries, - &exec_args); - if (the_result > 0) { - /* - * If the drive has indicated to us that it - * doesn't have any media in it, don't bother - * with any more polling. - */ - if (media_not_present(sdkp, &sshdr)) { - if (media_was_present) - sd_printk(KERN_NOTICE, sdkp, - "Media removed, stopped polling\n"); - return; - } - - sense_valid = scsi_sense_valid(&sshdr); + if (the_result > 0) { + /* + * If the drive has indicated to us that it doesn't + * have any media in it, don't bother with any more + * polling. + */ + if (media_not_present(sdkp, &sshdr)) { + if (media_was_present) + sd_printk(KERN_NOTICE, sdkp, + "Media removed, stopped polling\n"); + return; } - retries++; - } while (retries < 3 && - (!scsi_status_is_good(the_result) || - (scsi_status_is_check_condition(the_result) && - sense_valid && sshdr.sense_key == UNIT_ATTENTION))); + sense_valid = scsi_sense_valid(&sshdr); + } if (!scsi_status_is_check_condition(the_result)) { /* no sense, TUR either succeeded or failed From patchwork Tue Nov 14 01:37:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 744600 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23DACC4332F for ; Tue, 14 Nov 2023 01:40:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231660AbjKNBkP (ORCPT ); Mon, 13 Nov 2023 20:40:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229511AbjKNBkO (ORCPT ); Mon, 13 Nov 2023 20:40:14 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E17BB115 for ; Mon, 13 Nov 2023 17:40:11 -0800 (PST) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ADNs4B6030165; Tue, 14 Nov 2023 01:38:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=GumYsAdzRdmAjg7ud3icqplo0EAItN1svWEtdMeRs7U=; b=nFo9hL9Z1qkO5dHs17csRBxXddw40Ekc0NzIy/EzvP5arCbjYwMzFgopABrQtZQT/78R oWvPPc6eq6BJUeuUeklEa6OYd/OpFm5mTi4JOoegDrxpvtnhhEava/sybTr1nEJyI05r TL7WwFC/RlUrZwTNIM/xh7SS4kNOQ005L3GCLte+zE7OJ5H3tLuDBZ4oufRXkL5CV7Ql Nrtyc45qNqw0GEoy6C4e/SxmkM6C3R2BGIwyH+zOw1HKaqU4P4ogn1YdEOnqviktR98E /EdKRDl34Tnb12velJP2n4LCj7u/GENcZtx+KhUq4GsuDmwZzEbtqOJfvesxS9cv5/sX uw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ua2n9v56s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:03 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AE0mrTl013734; Tue, 14 Nov 2023 01:38:03 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2040.outbound.protection.outlook.com [104.47.51.40]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3uaxj193nb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eKTDsZT4YdTNb1tIGgyVLpFQleZP3e3dR9RKnnR01hAZu/yUOqXkKpsAmKATSEug40vAQUofy/z/vVal9LMjpHmMWOT/wYvmGwpPOpKSH0bzyO7f+asVbMEqrz0zxLkDNetH30+L7YM6l70gNCMFpUpZRtZ2hSHFN48wQaFuDfA6PxnWYb0hnaSKKMLpbf9fWDOJRqzwKqwssgE1PnSrUvr1L3589rDpwNNcxEBJCJLbuv6ULrSGXO1YozmVkwb0rf/m0djgmNTWkrAmoNfUBYUl73WYHoSU7tXv2qocAIp0BPrUw8CgV1Jd19veixT68yrT9DoZCQM/FlR04qgB2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GumYsAdzRdmAjg7ud3icqplo0EAItN1svWEtdMeRs7U=; b=iYnEF7rH9VOsskrLtYC8x80VULU8dp3tAZjJLNzQ26+anXQ6LF6xBqcQuiaBATWilrg/APkWsrAbjSpkN966it53R93M+6c0q80/EEbUaAvUhWghN3Sdrd2E5Mzcs6nz2OuKqp8tGkkxHLx2+d5UWwxNlq6IsiytLLD2I7EqPG59F6jgZSwFjZT/vANAavKDmmYpyEjAAtzQGZkkaEMeCu56HS1KiTvKw4YPu39Lc3YAdFhx8Ygy6zYBYkuo2lHm7x32w6dYak1tKMrQ2tuo5A9J5WBhks3lP3MqMDBgmv76SNI0rkD9lUlZAk4IS+3WFRpKmUL/MPl6k1xJxQMqmA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GumYsAdzRdmAjg7ud3icqplo0EAItN1svWEtdMeRs7U=; b=GZ+kr/tDQt2bqtSjKTwENLAlFfYVTHVV6v9INhOD4Db7cdH3Hxnkk8WHbT7D9gIKX5gEcQjWttYSG9+R6UAHtvtSRhiqZpPWOMRrMjAEWXYjJPjSMdEQP9x8DcKPeCvN5u0nOSIDiujOFcDwBKN6xGt0i+F/A7rAlOPwB9HK4BI= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH2PR10MB4199.namprd10.prod.outlook.com (2603:10b6:610:7f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 01:38:01 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e%4]) with mapi id 15.20.6977.029; Tue, 14 Nov 2023 01:38:01 +0000 From: Mike Christie To: mwilck@suse.com, john.g.garry@oracle.com, bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v12 07/20] scsi: hp_sw: Have scsi-ml retry scsi_execute_cmd errors Date: Mon, 13 Nov 2023 19:37:37 -0600 Message-Id: <20231114013750.76609-8-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114013750.76609-1-michael.christie@oracle.com> References: <20231114013750.76609-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR13CA0023.namprd13.prod.outlook.com (2603:10b6:5:bc::36) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH2PR10MB4199:EE_ X-MS-Office365-Filtering-Correlation-Id: dc35810b-1956-46c2-d19b-08dbe4b256c5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RJT7PRLI91fjmaKRP50jX4tbJ+MHudsHbOU/hXmtc/lCrFV8o9i8ADBh48nvXRl4BHlRYs8sUEr/w6ji0CVjCxpIz8RKXWHP3ujmHsP6rni91s8ZO2af+A6B8L4hpyR8JTh9XvOjSnmdwfEBNsGZZe2Lk0dRCezJFdV6cwVyzVwh82l7xaiFvjDCM9WKdbX+mCDhrrhulfD/1iu+PlxMy7ZMpJg9xNY/EzLfWxgFycDLOwAwyOVyEsH77w+nufeo3FEoXmrqZj0ipI8rR3B1GssPvvoUsNjPLFAS8q3Tm7BXhhqsgp4AY4oJzulWYaD3wDW9pO/bx+EjcRc+b2DqthH5jk+UKKFpgGeultckyRpfm37F9bg4vn658lEb2opNlcE9qIHEeWK/jjJtxpNrCYBT8I8V4tNkTwF3k0IQVh8VnNFj1ix8N3NEW0ThcZOrzJqDfXezl8xIzjM5wCCe4HGu6b7afKrWLlsdBmusKAlV5z7ruO+fRvkQzHgKRYYdmhYVIAeNDUbT15j2v9YVtab6Xf/y54H0Dy01IGZaKbUt/3mmFmhRIcb8elqRVEMUfuNonN3F1nbS45T/BX4zY+QGFvkTqcjSuo2V9CbLL7ufijpg1M6EIrO6nAU4jBNv X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(346002)(376002)(136003)(366004)(396003)(230273577357003)(230922051799003)(230173577357003)(451199024)(64100799003)(1800799009)(186009)(83380400001)(107886003)(1076003)(2616005)(26005)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6666004)(8676002)(8936002)(4326008)(6486002)(478600001)(6506007)(66476007)(66946007)(66556008)(316002)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2jRSqyIHHFE29N2OD0oS+Wuohf3p0XEe+sx7hFjYxcB/qgZ9u9VmFtcDOjhLMtf7+TX10qjsI4Gbycczb7rCaQQhipSe8b2EKn3LzH8UWhl/plma0+ds07g1bEz5k6oYPL1PM+rRMRWNu8OVwdeWh+Iq4uNd08oqmQi4rOscj5tTaTXnNHeC94f8MiLE/yf6OZC2T+ZDcMV7HakIekITe+xTfWDZuxpccHB1qe1O9NZCADW924epxwObZf9mLWKMRuOtPUzz/v0fzAuExiImEeVkVpc6vqDs2vOu+vG7frr3e9gzUAIX5B/zmXWhjsKAn+KTOECn2hhGCVr0re2VpmyzybhksieRcZrIAIuVEeGZOjV3IqqbJx1HjJzdWMye6i9M+uQDQZNj46bx99DVTUF+eNDsIMbZoxnZUX1jqriq8xV1ElOUu10jxU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orOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: dc35810b-1956-46c2-d19b-08dbe4b256c5 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 01:38:01.5168 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lMZv0wEnOaTLOUo5PdCUqcQA1e7bXc3ZF9sA03hxCWUISKLhYjIvlEZosLgdnmoV0SHISyMTGjFv342/7vt2IlEAs/PLhXt2pa+pwo7rlc4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4199 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-14_01,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 phishscore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311140010 X-Proofpoint-GUID: LaaLKb8Hu5FVWevNYfR5lN3L5caCPPYi X-Proofpoint-ORIG-GUID: LaaLKb8Hu5FVWevNYfR5lN3L5caCPPYi Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has hp_sw have scsi-ml retry scsi_execute_cmd errors instead of driving them itself. Signed-off-by: Mike Christie --- drivers/scsi/device_handler/scsi_dh_hp_sw.c | 49 ++++++++++++++------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c b/drivers/scsi/device_handler/scsi_dh_hp_sw.c index 944ea4e0cc45..b6eaf49dfb00 100644 --- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c +++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c @@ -46,9 +46,6 @@ static int tur_done(struct scsi_device *sdev, struct hp_sw_dh_data *h, int ret = SCSI_DH_IO; switch (sshdr->sense_key) { - case UNIT_ATTENTION: - ret = SCSI_DH_IMM_RETRY; - break; case NOT_READY: if (sshdr->asc == 0x04 && sshdr->ascq == 2) { /* @@ -85,11 +82,24 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) int ret, res; blk_opf_t opf = REQ_OP_DRV_IN | REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + struct scsi_failure failure_defs[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = SCMD_FAILURE_NO_LIMIT, + .result = SAM_STAT_CHECK_CONDITION, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = failure_defs, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = &failures, }; -retry: res = scsi_execute_cmd(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT, HP_SW_RETRIES, &exec_args); if (res > 0 && scsi_sense_valid(&sshdr)) { @@ -104,9 +114,6 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) ret = SCSI_DH_IO; } - if (ret == SCSI_DH_IMM_RETRY) - goto retry; - return ret; } @@ -122,14 +129,31 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h) struct scsi_sense_hdr sshdr; struct scsi_device *sdev = h->sdev; int res, rc; - int retry_cnt = HP_SW_RETRIES; blk_opf_t opf = REQ_OP_DRV_IN | REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + struct scsi_failure failure_defs[] = { + { + /* + * LUN not ready - manual intervention required + * + * Switch-over in progress, retry. + */ + .sense = NOT_READY, + .asc = 0x04, + .ascq = 0x03, + .allowed = HP_SW_RETRIES, + .result = SAM_STAT_CHECK_CONDITION, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = failure_defs, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = &failures, }; -retry: res = scsi_execute_cmd(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT, HP_SW_RETRIES, &exec_args); if (!res) { @@ -144,13 +168,6 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h) switch (sshdr.sense_key) { case NOT_READY: if (sshdr.asc == 0x04 && sshdr.ascq == 3) { - /* - * LUN not ready - manual intervention required - * - * Switch-over in progress, retry. - */ - if (--retry_cnt) - goto retry; rc = SCSI_DH_RETRY; break; } From patchwork Tue Nov 14 01:37:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 743965 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 693B8C4167B for ; Tue, 14 Nov 2023 01:39:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231888AbjKNBjR (ORCPT ); Mon, 13 Nov 2023 20:39:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231873AbjKNBjQ (ORCPT ); Mon, 13 Nov 2023 20:39:16 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFB901AB for ; Mon, 13 Nov 2023 17:39:12 -0800 (PST) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ADNsDm1000855; Tue, 14 Nov 2023 01:38:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=Jxsb0thGeaakGaSIIjW0c1lUqI3rg/gUtemvguE1cQk=; b=OLbjeF5vjEpkJFWElELJsohu83q6dv4LUJDDY2ZQz9voedcCZsNcVUGcAEtNPtF9VHPt eEXr73bytY+MswFbmlijpI6mR8GXfVeqvnVBcNtag2ZkAixVCSuAXA1UxgmzK5Fr1xpO /w8TfA17gMZ/6XIWc2mgeT6lASm6VPTuIqHNZK3KPQXYbx7vhn0tzb4eEqnFPB+v1+oX AmSPIlVQ0yGos74Q38xbqc5N8N9X/y40zz27FStYCl247iyEYbV+i08os/KHw+crTGUo dKEBMXIZt6AHU4bqvrVL+gXeGroAXbmpPbCCBaOD+C06APfErFzDxaE1AoAu+w/KiJIL 2Q== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ua2qd44eg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:05 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AE0btSe020722; Tue, 14 Nov 2023 01:38:05 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2041.outbound.protection.outlook.com [104.47.51.41]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3uaxh0h6hb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fkQIWTM23zkcXnriXJOkDjd3ZbC0JuKII4Ma9AT3Uqwjcb5TVVL0q6hRRUp6XnOVu7zw2YGXNcd5ljkonb/Vf/SBJHvVRq3FixZT4BpMJsahpnwmiOVeO3eLGF+Vp1qdBsDt+0ph9Mdi5Fw9i1PWInYXBaBqi4Ae55eLGM2fcMJeCamR5j5g0/cNzyP+gJIQnd9Si514yZeIRhCsJtCPoHG3IRphZmjq/cV42GXWvmXfFyxoxU2SRDqzUOKiaAWe441+frtkPfBs2TYc/VdY50gUFV/o+9UDdBPJfURzSnfhZOCEqhKhnkf03q0C4CMOEKPAgPXQ5M323VGkXTBGpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Jxsb0thGeaakGaSIIjW0c1lUqI3rg/gUtemvguE1cQk=; b=Mxz7Cdw3y0gr7vkPusum/p8ve0maqWzPeSpSAQR1xbtWiSjOvDsYjKMlh1B+tmhJjoxmpjMm8rjmPDgQUOmipAjls9HcvTI17Q0uTfuNkP+AdWrt6F/RdRcMT6DsyWWzAPQtqdfiNLnlEzw+Vk4fcjof4u5ZI/jU6uy87ullMZzGLS/TU/u3YMQlYEOPRB/MV8QdyhvtUofuEQyEDiaN8T6oYpwu+ybeKqNQOedsL+cqrFX2+Z+zf3UBqBNbBJX9z0F+SWhBFOXVuO1q10q8vrYenDSr4BWmFICNSA5HIl/reOp8DcVYUvGEn/1qsvywlF/qAGNFKKNjb3rM2ihCng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Jxsb0thGeaakGaSIIjW0c1lUqI3rg/gUtemvguE1cQk=; b=wfa8kUDAl852YXcAoTaVL/vlue6ZWAHSfTCE9nz31RuSnXS1KR3x+UldzVlw0x91B3Zz19F8TAQNh5T5dMeM7L20toY0smsgcaB9J3Wwr456nFw3GYAS4XE49yLLjJf9ZeCKowDxXhKWcNEBQOGl4WQ+Z75L3J44V9MXlNpNfn4= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH2PR10MB4199.namprd10.prod.outlook.com (2603:10b6:610:7f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 01:38:02 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e%4]) with mapi id 15.20.6977.029; Tue, 14 Nov 2023 01:38:02 +0000 From: Mike Christie To: mwilck@suse.com, john.g.garry@oracle.com, bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v12 08/20] scsi: rdac: Have scsi-ml retry send_mode_select errors Date: Mon, 13 Nov 2023 19:37:38 -0600 Message-Id: <20231114013750.76609-9-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114013750.76609-1-michael.christie@oracle.com> References: <20231114013750.76609-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR13CA0034.namprd13.prod.outlook.com (2603:10b6:5:bc::47) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH2PR10MB4199:EE_ X-MS-Office365-Filtering-Correlation-Id: cbcc9192-48cf-4893-e267-08dbe4b25773 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Nkaa1MnBHORNCd3iYClTFpjNR+hwsGCIQR7PpRIQEVrVDyTcgP0uHUqvAmycFidvlAfbUGxXbaLvFtJRv9sGYN9ttjiPNQZrcOafQnzvQ//qjezu3RbZlXj6/PVDtk3MILAr4BscpJE2inCL83DleGlZF0KP3uUR8Yae+KrobvcjJikeaUh4TjxY5aChvAr5sWM9iacHS9eF/Ih4FspefHuWNWdeDtReLtgYtp9OavnyOUjl5cuOWgwxOQF7qBSNfGEi9AKJYI6xlriuNajwccX12fe32t48sdxo5GXVe/bTwtlv2ernrSB0GdqNySR5q996jHhS6kO02yknAFdJFiFeFrJiEPURoSd317Lm5VZkEbHZOnu0tcHIy4wLVbxX22mAOT0U+ighey3QP0Cs20cg6ogem9VJqfD/ea+0KeeUC4/1Ww1QTUAKQna50zha9C5G/GcPJ7LDkecyhjeqGe4dTtTI7ESsM2QliugfPwNGF5qrGcH4rrLq+zdR4Kx0XcIDU4EvITnvKjcyLQwAroih5mPT9dUtnP5AkleLCsHk7tzcn5KoxBeMzQpjT/jj2/sCSXcBFXnwmA/veFx9QE1ei3+15pvWysYqKgLvqsKkq57c/Qjl3W0mKeqsxzYj X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(346002)(376002)(136003)(366004)(396003)(230273577357003)(230922051799003)(230173577357003)(451199024)(64100799003)(1800799009)(186009)(83380400001)(107886003)(1076003)(2616005)(26005)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6666004)(8676002)(8936002)(4326008)(6486002)(478600001)(6506007)(66476007)(66946007)(66556008)(316002)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZNLoSS9M4xwd+8I3NuoLu6ETaB0N37CekJLTzYv3uF6xakfSpaVqCy1VVda/5v4qZiau2XLW8m08/qxo66oXX7vZjQLUKOCRtZFi8gq+s7UPlNuhpkbclMtbqnQEIvlxlKm1wQqSiLvSqMhOIDAoxghAiUbgaBgO20vSpZaQcP/823TkTSA9rIaSYxjH1+5JXz6lrKDzvs50KXedMrjlq/U5RhN5Teh9St7hgjrZ8rEUWM1rFlp3Sqbzn1DSm6N8Uq8odlOdzSbU8132Ipj4DH+OUQLgfFcoaLbWGTL2C9AJCq/DnNMarRUox5BmhUDaxlOXqwfJoPb6vvPuehtY9+WEA0BRkWBwlklXU/rvkHKNufFk84RisHjiP5cxqAtcOyyXSbb7YJFut8maaVXnNEa0pet6qgtZKPIWmRPPRHOIh8atjuajCT1PazZzcYF6giy/0Q2i3J/77yEm1K+r0Bhk3phhKD5ejnb4UOiEewZ2/5qOLciKaa1ppegkN6ju5W5qS/AnWT7NOGLNz8mY8p+veCGbzv4u+l4xzjRRt8GhKVh94UR5Qxlk4gUXRPJXCPmlQybTdzW/L3YXT7LBDucvkUp++MpwrBHYMyjt1Qg7XZYW4mmG+vGIMzKnyVmP50M3gu1WSGlpMBFQmnqYW4znZ19t4FnozAAmc4xD/1aJlmRPib7llT4ekVL4rvkrTMw6Wiakto6EdtHVTLFmM1nUHZMACFl9FlmHKxTt/hz1MuNavk1WvhusKNdoOEgbcY+mozMHvpFux+iArHxJSLhqkwWGrTJ1of8xxciOYAVsDMpH3KtKQOlwa6mEnHBeC7K3Y9p3h7jCudNredtV8G45tx7IOM94OGvizgfPjvp2IwmCZu5U0T0bUGqZ8fs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kZaPdorHg7iJrGEyO2d5QZ4Vp1HQS0wB2LOgkM7P576zznrPoXx5PXTrC6k+oYuj1T1/60MnMyXLd0KH6tYc3VGZrTXDBcH1dEPUSPT04Z1irqQZ+jJcgy4L+c/SRuIgaV5SKMbvxlQvikEGpFX0Ks/4lHB89xPAZ2cX1ct+q0NOMFFmJRW/nvFw0rB8Wjs7LrZ1dxdzEbD0KLe9LrxTFR3kfd/c9YoSSusvcQNm90Nv434ZNTwJrVqSMp3ssv1SofB1SVo9kxE1yLYsLXevAXAkYmDv908j2Pvkd2gCbw4ZDjPBq6Yi3FEH57S1oITBS4pDbOMGCEUlJMxs/EI3w+fg3B/0TWPoyaZvmENXwr1b8fo66xhNSQpMqJEcUpByWww45pFpnv0oy5D48dnBLdZ+FYnwkDkqUahCmUGSGOQkdN8IB09yunJfKzugsD6NkiD9PgbYkLN7R0Xw9HxtTaj3DSSKK0o8JwcQhOMZuRYJYcKZFtWdunsxg1B1DdeapUNglat5R33Jf+aO6pImjBq+LCg+ukXil9uXwmdixS4oOJQnMrBt5g4Irn1SzI39r9lfT2w/K79ymRshD541cdIHTsVTyM5h+xIbXMSanX X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cbcc9192-48cf-4893-e267-08dbe4b25773 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 01:38:02.6774 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pJM4oLd5SSlnZ62kRPQQzYkYgnq8sFzBazpy2nv4m5SYMQFy25kzVntKPSE32AZ5t1yx31qu81kaOPgy/Atk9i4tnjYyOEGbCJXEHAyTYMo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4199 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-14_01,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311140010 X-Proofpoint-ORIG-GUID: wvsCVUDU_PYtNus9gTDwwF4Z87owLykn X-Proofpoint-GUID: wvsCVUDU_PYtNus9gTDwwF4Z87owLykn Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has rdac have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie --- drivers/scsi/device_handler/scsi_dh_rdac.c | 84 ++++++++++++---------- 1 file changed, 46 insertions(+), 38 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index 1ac2ae17e8be..f8a09e3eba58 100644 --- a/drivers/scsi/device_handler/scsi_dh_rdac.c +++ b/drivers/scsi/device_handler/scsi_dh_rdac.c @@ -485,43 +485,17 @@ static int set_mode_select(struct scsi_device *sdev, struct rdac_dh_data *h) static int mode_select_handle_sense(struct scsi_device *sdev, struct scsi_sense_hdr *sense_hdr) { - int err = SCSI_DH_IO; struct rdac_dh_data *h = sdev->handler_data; if (!scsi_sense_valid(sense_hdr)) - goto done; - - switch (sense_hdr->sense_key) { - case NO_SENSE: - case ABORTED_COMMAND: - case UNIT_ATTENTION: - err = SCSI_DH_RETRY; - break; - case NOT_READY: - if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x01) - /* LUN Not Ready and is in the Process of Becoming - * Ready - */ - err = SCSI_DH_RETRY; - break; - case ILLEGAL_REQUEST: - if (sense_hdr->asc == 0x91 && sense_hdr->ascq == 0x36) - /* - * Command Lock contention - */ - err = SCSI_DH_IMM_RETRY; - break; - default: - break; - } + return SCSI_DH_IO; RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " "MODE_SELECT returned with sense %02x/%02x/%02x", (char *) h->ctlr->array_name, h->ctlr->index, sense_hdr->sense_key, sense_hdr->asc, sense_hdr->ascq); -done: - return err; + return SCSI_DH_IO; } static void send_mode_select(struct work_struct *work) @@ -530,7 +504,7 @@ static void send_mode_select(struct work_struct *work) container_of(work, struct rdac_controller, ms_work); struct scsi_device *sdev = ctlr->ms_sdev; struct rdac_dh_data *h = sdev->handler_data; - int rc, err, retry_cnt = RDAC_RETRY_COUNT; + int rc, err; struct rdac_queue_data *tmp, *qdata; LIST_HEAD(list); unsigned char cdb[MAX_COMMAND_SIZE]; @@ -538,8 +512,49 @@ static void send_mode_select(struct work_struct *work) unsigned int data_size; blk_opf_t opf = REQ_OP_DRV_OUT | REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + struct scsi_failure failure_defs[] = { + { + .sense = NO_SENSE, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = ABORTED_COMMAND, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* LUN Not Ready and is in the Process of Becoming Ready */ + { + .sense = NOT_READY, + .asc = 0x04, + .ascq = 0x01, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Command Lock contention */ + { + .sense = ILLEGAL_REQUEST, + .asc = 0x91, + .ascq = 0x36, + .allowed = SCMD_FAILURE_NO_LIMIT, + .result = SAM_STAT_CHECK_CONDITION, + }, + {} + }; + struct scsi_failures failures = { + .total_allowed = RDAC_RETRY_COUNT, + .failure_definitions = failure_defs, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = &failures, }; spin_lock(&ctlr->ms_lock); @@ -548,15 +563,12 @@ static void send_mode_select(struct work_struct *work) ctlr->ms_sdev = NULL; spin_unlock(&ctlr->ms_lock); - retry: memset(cdb, 0, sizeof(cdb)); data_size = rdac_failover_get(ctlr, &list, cdb); - RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " - "%s MODE_SELECT command", - (char *) h->ctlr->array_name, h->ctlr->index, - (retry_cnt == RDAC_RETRY_COUNT) ? "queueing" : "retrying"); + RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, queueing MODE_SELECT command", + (char *)h->ctlr->array_name, h->ctlr->index); rc = scsi_execute_cmd(sdev, cdb, opf, &h->ctlr->mode_select, data_size, RDAC_TIMEOUT * HZ, RDAC_RETRIES, &exec_args); @@ -570,10 +582,6 @@ static void send_mode_select(struct work_struct *work) err = SCSI_DH_IO; } else { err = mode_select_handle_sense(sdev, &sshdr); - if (err == SCSI_DH_RETRY && retry_cnt--) - goto retry; - if (err == SCSI_DH_IMM_RETRY) - goto retry; } list_for_each_entry_safe(qdata, tmp, &list, entry) { From patchwork Tue Nov 14 01:37:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 744603 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8D05C4332F for ; Tue, 14 Nov 2023 01:39:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231886AbjKNBjQ (ORCPT ); Mon, 13 Nov 2023 20:39:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231489AbjKNBjP (ORCPT ); Mon, 13 Nov 2023 20:39:15 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3652ED6F for ; Mon, 13 Nov 2023 17:39:12 -0800 (PST) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ADNsK3X001232; Tue, 14 Nov 2023 01:38:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=i39wCHhIzVAo4OQbG8mHVVOsp8SrqraJXQtkBId8LIs=; b=YLAVZFR6W92PraPFqNDj0LFsq+78M51bfW4+SyxRJbmFGIcTUb1eylFT8PhSx0MjdhOt lYpHYUZiByDARNSsWoyeIpD1eoQmkTE0jK4D1ls99gyoqvPxbH/C9ggXxojeX8QSf2gr BvVIAi0rGjCOVuEpLAXR6+T1NZsS8a4kVCpMRFIe+4s1v0TCqpjJF9HeJTvhrG7fAZz6 LJMXvTHjNfRUzEkhvnMDOhNsc11qiP6lXO4Lg9ktRUuvAYCX+AWvTHzM59pqb1kghXLW 3gOAFxZCtkONI0sL1fMhH8TgwBUfIb8S/WXKfZPckLOW0MuPSQOSYIhdIl7cLkoE9P/+ qA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ua2qd44eh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:06 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AE0btSf020722; Tue, 14 Nov 2023 01:38:05 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2041.outbound.protection.outlook.com [104.47.51.41]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3uaxh0h6hb-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dKImpSynu1niJNvpLE3GxFaXdyAUPKi7dOPyliFG8SybuC73oNRkN/yiHRWbsOxVQWpUknp+2Tgjc7XEKOnuGspM21dNRO+KifR5zCT+qR/MSF9KxxldPvljugn/6gQWR6SO0j4+jhCNYeEwcAzffAG0WBJ3dJq9zzkqiH0wcTrVgpCqdFSnYaOIBiacrH6Hf1FbNGYhB6ya8Y5Q3rQ/3jiLPseDVlPXfMnoj1dTUnz9pig5QdTmxB7kn8k+bWynSFP6yRlpVjBjikEPXkE+7HygiADqTqRCUTElb0/DIk/J6uEb/2uQ8vpA/vklWiptsSC9QRNLDL9MjouQS6pNig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=i39wCHhIzVAo4OQbG8mHVVOsp8SrqraJXQtkBId8LIs=; b=VBZQotLLSSWF5OjNAJHz2l1veSTOpwcRg9ZRBUewdPPBsN9EC/hRXiMUdWegza9xcD8vOVMwfnmYr6XjlL0qFAlb1etfmGiIGwjbPI/n3q2M7v3yjic4RjT5ig7xv81COTctn6ozyRu92m1sKg+WMQq8L29/xnoK0YhxhcEsbf+SSgWtqnhWaASaTcYfGn1OMbSKTxp8ijvEXu0ZUGV3iKatZurGc7kPdviH8XGRTvEqQ9mWjwCQYraNJE8RWNK6ndYYfieJ7h+NHGKFcPHx17qMNBG4UK2eb7ug/syD0UzIC2xBGSWo1emBfu1y+m2t4xzLsvFd4NHAhmYDjVJ/Xw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i39wCHhIzVAo4OQbG8mHVVOsp8SrqraJXQtkBId8LIs=; b=qNuBLgbH0TzZYJOrTZ4QfOA3A1k122/SIo7Eh5KKiSEDzoDE4PMsudsctaImCUkhGupOksWkyY+pcAdT5YsJ0xWuAbtFwy4k9xRdM2XEQSAPI63ajsZ84XOycveDU5QFa8+9+XnMlXViCnLBnF9PA6qvehloldqfVJ2+1oHFxQk= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH2PR10MB4199.namprd10.prod.outlook.com (2603:10b6:610:7f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 01:38:04 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e%4]) with mapi id 15.20.6977.029; Tue, 14 Nov 2023 01:38:04 +0000 From: Mike Christie To: mwilck@suse.com, john.g.garry@oracle.com, bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v12 09/20] scsi: spi: Have scsi-ml retry spi_execute UAs Date: Mon, 13 Nov 2023 19:37:39 -0600 Message-Id: <20231114013750.76609-10-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114013750.76609-1-michael.christie@oracle.com> References: <20231114013750.76609-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR13CA0021.namprd13.prod.outlook.com (2603:10b6:5:bc::34) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH2PR10MB4199:EE_ X-MS-Office365-Filtering-Correlation-Id: e9214d5e-568d-48c3-b7ac-08dbe4b25845 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cWIyQSebHZxUlwUQfpr/ItNsEPKY4iRhsDMAxNYzkNSeHCDS5dDgpulryOj8y9shbgELwuO/5i9v8mBnaK10Y6PV3nM9ARxhDapZ7uCMqIYuooYzzqCsvMdDFMmjqfcgkKcqUP+ux0d0ClGFRQpii0M3Ja6itEZCCKIWSXsL0Mztln52/AEhFFuhfekldFu2C9u+oJbku3T4pq5fTubBLjbrj1ertKu8aMJTZ6JJUkRDbhgNApe3K05vUJQqAPAeuT17/1u/d55ynHemafvuVxuMyqgreQnO34R5nMoq1fleFGr8KUsa3NuJPU6zTjTEiATx1KfW7L9ksoaoSKiNlJLNFbnNsdg5EFyWMnVgiMkhv0nvkNIBB6YM7Y7/1IZeb8uPYHZP7DB0s0h9gPIY7WLrqWyEcGjj+LX3JUJK1PtPJ4A34uGiX74edhDVDzak9uHnbr0eQTWTI+Vrim2zPmj0TCC/9sTuVZ3C9Sfp8vBrcswe5+fKzKpWIycEC9o+9JOD5RXCtlBtuPNq+q3MoPPduSln0J8IRCx5oCLezDgL3CKulzJv7hihEiBdCVsD X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(346002)(376002)(136003)(366004)(396003)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(83380400001)(107886003)(1076003)(2616005)(26005)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6666004)(8676002)(8936002)(4326008)(6486002)(478600001)(6506007)(66476007)(66946007)(66556008)(316002)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Y5RBsva2Oyn0AjG5PkKSPXNHc/lgUlTBb15/GqW3kro42kqoVCWXuZDAo1KQemn054Spmb9jul7xD8AJ9SD6Mbnbl/Mzax97zV/Im9row9NdNH96GzZTeumJ6ieYSqAMoypFLzU5SayUiYAXeYbsqmvSTrCR6C6a7GQnBBe6qJ4/nk44KE8HRYLOmFjFJjV0eRnFmvnQoPfX6hYXuLgj7VdXO0DlKqm4kuMTJ8vtnHM3rUAO0DMaZs4Az0H2Hi1+T6JTtFTmkSBx9sW3Yt0m5pEqfIFZaTKxeWMP44ZO36BwACvAo7D94eVUXQcDJgpzI4y1Vrq2SpqPl8BHPOg/v+mV0ANaDoSvL2M5CJ+sgJwneZRuHLaZtWApxhSq0Xrmsr8P1fTi2q7H9MckHM9nSwrkG2DyGQKy8bKreuHZrd5XGS7IZrrUqo8HTDCfBCcAYDtnde/EkKnOFaW3NuCy8q1CGlDmxuGSVpacUuv/13SY2zxBgujFBuuDiRQXvD70/qzLEBELb3Rz3/dWT0P0nkHfsIaebbPyZpchvF/1O4d+xhAXkD8kfKRtqkPIfNZ2D/4HH9nBraMzi3m4Ly56MP3POVa576PTFl7aKRuKbC9ihcLaGY0j4OA+pcR6RNd9VIezwmh8/nYp9McK4tAysNFIFiT8P4tB7p1lucxXz93ItPgW/9umBkKTs3QMzatppl0R3Sr545wwBhPJKqYbLoaOOHm7CMpCFqljmT21QgqCg5Y6HURui2rc70tj5m2hXznTh+z70Rph/mNjiqNfmFxSWLViBCCBpOzRZgnFUBzGIUosn0zuLaTKVp7LfZgRPdJFo39An7UGpTKCMNYfdKey7Oqe9b+YI8olbuYC+gJeKa09LajJPcc71bM4Plh+ZvKkFdByf7eJNlhnkA4HXRK+A51gBkc3DHUPKiGUBTvrkyrTEAKgS5VuZLJwoPgyymxa3O+K9XHql2PM2HSEAjoSLD4FGbGhD6VyJqaQKACezhsJBOuStYlue8kzl/WCiW3DcHkVQL9T+4dEeB84yJLcZ8vgBc+LKW3PsDtaeVmDPJTe99aybhQeLEOxbI459pBRx24FeDrLPhOaGbfksfgPiX0KyZ0Qf0Q8EnESDElS1Cej6wxHtT64p1HlE0RVADxcF73aQbjDqo9u6kDeobPGqBUMV6KkEn0IV98ckLw8Mx48tWusZD+pSdey02eDLfC3yI9uUUw8uSkowAbkZqmdN1um/x3uerpwA0u3BjYMxk7RtjbzNK6/rY9WNW2cqn4mloH4CjatppWlvCuxIkDaQ2aP3wnniqqlcWbRP679iA8WMsJdo4N7zWQdhD4uZ0ZxcL8WH1FcYRPcKBHdPqxFOVM8E3nUvUO4kyZMEaj9Kt6FNp4WezJdIghG0ym+xAdGkDNgRKTBm0wGzBBxPT5LTIpVxtDRwX7M8P0Rm5qxngvpujxXah94obQXhEE0v7BFpFRoDmIkFO1ESoiReIoZ5Q36TevxMc3cMigppDOo/uPzyBaattePOnmZ85ZLu2pKh6u9h2SiRUuJKIC0RGGin7YCRYgJNhN2BIojj5FoXveFRDfpkjjdOaIF15fxpJcp0+v/0TqTqfXdzutF9g== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: T+YHE9Uk1GQkJMxIDWPQmhgGiOcjbZUEpiCjAMXhXStyXI1dpNKG1VmxsB4v0dZHVoc+rF7nrWbWgYmWvSzmV0sYQgrtRqbMKs5+p4+LgBNDAGhybyc+WMYyAVMduJ7MkeemCa8erSlKWtXdYhDhOxchvkFAEq/yG+r/UR1qdThn6lUvGV2005KdBq/eq9kGf7QaU7IO+763+BpFBqpLt6pdzuufoUCTBhsOeLVoSpuYJLj68iHY9HrolIdSDGb+0+w8gDkr2+WOcuq9NXvCPImVF4fzUB0hIyP4f3UZcdwsaJXSNoYdTrfW2arsrJbIxdQnn5vv70AQbrAcjAjE6toU96n+rCwc3Co7qkowPLsErT9LFcqLnTOzoz5IPZKosOzCxJFpaxeEiTaqltQ2qviqJWzPPFHI1m8b4KDOer4Jii3ypzhzL72VIK+RRkm7ePxSFrGWmnM/irQAesqoWcKc7mxqV8V4sbYvQIZ3XUCxRM9wTnvBDcCAvyrwMj7J+IB0hqMJ7p1VTD0euXh+rFFZoqLLtNz1ymLRe514wr4MsT2FpKbLbH6A9lOulUUqelZ6viSjWSPPWHnuflCUo4zArWHV1OW46dZL0HvD90b4yFuDot8WISYIs9XZno64nC1u3KqvBrDYZieQ/p3A5OI7VPH0qQk/0kMQP68lHF+zj+4wTBf+evYyxNq+mWF0xOL1DmDsegQQ7cXnR/ACLDGW7WEnCXvHVK6ExfhSFNd2PVoAbFWTOPEPcay+OH2FiwcuGs3HTx/Fe35vMC2tivG+AX1eOalyeYuX10PA/etfbKD75t7tNFotIZB5ss32EKmRtAZsN/biLJIT0r8UMKeV/bPc4FKOKGtFulbDlLbFneDNnoDAzjJoK38iel4g X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e9214d5e-568d-48c3-b7ac-08dbe4b25845 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 01:38:04.0263 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: e8iVdQTOh0Q/x4VGLrlhB1XYfkc/lH5ozj6YW99JFsJJlt2Lj4nT7rnMjoCFYhdqLGDNiwdYVd+ncT3zf58+4xkyQsjot7cs1EHRwhJVQj4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4199 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-14_01,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311140010 X-Proofpoint-ORIG-GUID: O9y4m8Mf8GMY-zXCqRKpdfH_fRqrO_3s X-Proofpoint-GUID: O9y4m8Mf8GMY-zXCqRKpdfH_fRqrO_3s Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has spi_execute have scsi-ml retry UAs instead of driving them. Signed-off-by: Mike Christie --- drivers/scsi/scsi_transport_spi.c | 35 ++++++++++++++++--------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index f668c1c0a98f..64852e6df3e3 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -108,29 +108,30 @@ static int spi_execute(struct scsi_device *sdev, const void *cmd, enum req_op op, void *buffer, unsigned int bufflen, struct scsi_sense_hdr *sshdr) { - int i, result; - struct scsi_sense_hdr sshdr_tmp; blk_opf_t opf = op | REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + struct scsi_failure failure_defs[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = DV_RETRIES, + .result = SAM_STAT_CHECK_CONDITION, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = failure_defs, + }; const struct scsi_exec_args exec_args = { + /* bypass the SDEV_QUIESCE state with BLK_MQ_REQ_PM */ .req_flags = BLK_MQ_REQ_PM, - .sshdr = sshdr ? : &sshdr_tmp, + .sshdr = sshdr, + .failures = &failures, }; - sshdr = exec_args.sshdr; - - for(i = 0; i < DV_RETRIES; i++) { - /* - * The purpose of the RQF_PM flag below is to bypass the - * SDEV_QUIESCE state. - */ - result = scsi_execute_cmd(sdev, cmd, opf, buffer, bufflen, - DV_TIMEOUT, 1, &exec_args); - if (result < 0 || !scsi_sense_valid(sshdr) || - sshdr->sense_key != UNIT_ATTENTION) - break; - } - return result; + return scsi_execute_cmd(sdev, cmd, opf, buffer, bufflen, DV_TIMEOUT, 1, + &exec_args); } static struct { From patchwork Tue Nov 14 01:37:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 743968 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF69EC4167D for ; Tue, 14 Nov 2023 01:38:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231608AbjKNBiV (ORCPT ); Mon, 13 Nov 2023 20:38:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231374AbjKNBiQ (ORCPT ); Mon, 13 Nov 2023 20:38:16 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD758D43 for ; Mon, 13 Nov 2023 17:38:13 -0800 (PST) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ADNs3WO030141; Tue, 14 Nov 2023 01:38:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=RCKG0uvaQzRhSuPQuc5BgmOb35G2HSzqbGYFgdbngk8=; b=vX6lsIrczCx+kjqo8wkruljPoBqOD3FXBXGxrP7Omf7m1XxU8eHDmZbSdPmxkaU5gqi5 9mv495Z8RRrBfPYOhU3oEER2PLuluGML3DA4q0hzIAMSYWvik0SMkkFjxZmWliTq2mBE 8Gs807LXsLcwu8BCH6+CtLlwLrwZ2dmFBvlnk0tHPgWLkXx9QgtVw+sXF0jIxAdllSx+ 5H8b74k6n6ErzOAI5Mg+YRv0mIFCe0xr1xJly/KXZoC/00JZAexWpRHoRtaYDIxOcHbb wIi+9rG4gqiFR9L6TTq35Jt8Ycz6P+ZOg9Sb5xDfr6k0mFRVggd8HliKVwjZxMII9GEp Mw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ua2n9v56u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:07 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AE0FDJt004532; Tue, 14 Nov 2023 01:38:07 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2041.outbound.protection.outlook.com [104.47.51.41]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ub5k2j1j7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xe4sMCAyYud+4VWjXNK6kZzZnkR3X717xeFjhQQvWowp/gQkf91ckikQzY7E8CQa1yqQNKpp6oKQXaWkMojLvLAa+zC34cKP0Anbj17g1HqbfyUTk41wmTyMFVPJPrwcAFGK8ZjgO4R1Y8OAf/nmtLTo48tfBUCGrETopSVG94tXddUUZjiYS88aV2n7po/L8p+xPCdx1BgmhBHJdEj+gx4/iEekUdfJytePXFep9js/NrcPndjlTgIp3SM2BLyDxEJWB0SV5Vv3kTKOHXV/OYAjlVyOe7Y2LDZ1Ww65NzGT3ZM3aUYuYMp0G48VPWWK3HvQPNlpCSpBRxBR6pZSMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RCKG0uvaQzRhSuPQuc5BgmOb35G2HSzqbGYFgdbngk8=; b=m5U4HZJWU19hjyIDuMQ2SUVc5/hJ/ie+OBrb9339W8xTQr74IR850FL1YRMn2x4cxr7Glc4TVdY45x78S5ADj//wM5+Ng4WnS8OAuqeKGcKzXXMPSCd8eweWxFUTZBaOzc7mMcPxg7gDPOGT7SHQM+DrsU/VV9l21okKDYfYfXNcczFL66pLiPvIXgf2yP+uc0kJE8Wx/TkKi21FcHoVQFCHb7v0uB3F31va2T5sld2oz+XsaB5ouRWxEZhLe5DziALcHNIbRsGla+OKMS7dv4lxAMW2q2iXU3X+VuOrrgfqVo/QDe7uF7ZaNLVj8STNZcpKPBZS+OHrgpbw48jQFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RCKG0uvaQzRhSuPQuc5BgmOb35G2HSzqbGYFgdbngk8=; b=cthaLAh4HY9V6Fw2Ve8CydZf+/ldh4HWu4huUjfw3Y5+4V+dRUJPXT57kbu7aiiMRys1iXKTbQIeV2La3CJ3nr79Uh828MPSuczz+mrtWraZ+LkXhEQLooC0BICiJ68IS1Ep4Ndmyw3NdF9mv/Igmcp1N6tK8whO2NEo8RPSRFo= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH2PR10MB4199.namprd10.prod.outlook.com (2603:10b6:610:7f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 01:38:05 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e%4]) with mapi id 15.20.6977.029; Tue, 14 Nov 2023 01:38:05 +0000 From: Mike Christie To: mwilck@suse.com, john.g.garry@oracle.com, bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v12 10/20] scsi: sd: Have scsi-ml retry sd_sync_cache errors Date: Mon, 13 Nov 2023 19:37:40 -0600 Message-Id: <20231114013750.76609-11-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114013750.76609-1-michael.christie@oracle.com> References: <20231114013750.76609-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0113.namprd03.prod.outlook.com (2603:10b6:5:3b7::28) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH2PR10MB4199:EE_ X-MS-Office365-Filtering-Correlation-Id: 570d1fed-36a3-42ea-ef35-08dbe4b25919 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kOSGsdia72mEQWqEoqCjuk4phyCsPWMF7YU4WPGGzhdCzcJudUH3S+rW6e4eJOMZimTG25ZNN+dgNvFxwnWBvYWdZsCwdB6562vW7zstzfxA4aupvkYSKgROAMRg01hRDQREKIqTbV5N9dhvV8X6Ise8I7YuNB42YoD12ZScCymqPGkv8N6VEGv1bavz8mUWbquIJDxO9a5bx1nF1KQ7GzTz0ecS9SyzjEYHMmy1Xt1VSnr6mhahCJNMp9NtXbqTgpfSfgs5WrBtwRUSOYe5ddtn+Myw+YM42qBrx4YZ1BH3/giQIF8BFyMEx1SmsAkiP9pb42yPMyhyiERjTh5EGBPpW7ZT9P/RI6rfyBVx0lWVf1Jr37E/7OLuoagpSOHX8ecavZN2O5oWL88wEWSt2XsfbhYVyhAZNfbsxjKZKuPn+CykPbUufEMULDcyRX6zvtcm02Zhbua4aJcMchRFcPLQe7+feOScJPh0HKZTj2woqlGRboJg9gQs3k29buIpTrk7Si7gopXCNYhC7uGdIMOvRaKOxUt4JIiTDRdU5wap1mILGbp6vj33MCKsipBd X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(346002)(376002)(136003)(366004)(396003)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(83380400001)(107886003)(1076003)(2616005)(26005)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6666004)(8676002)(8936002)(4326008)(6486002)(478600001)(6506007)(66476007)(66946007)(66556008)(316002)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +d3W6vWgftmLCZr2f++Uo7LMoBRzYdkT3TFKzrjKT2Qn1+WptRbhwhSvwDbtxTw3ly1ADQxgHdfq618YkTiVfjq+IAbDp6t0RskuF3jQiW2OpTPpD0vxb0ERCWznGDAZSMexGp5cMCqlrvng/q62pW3CYFtE0jcZlPhC8iMpq3EuCRN9jYjsQIhBjfzfg5bwbZMhxB2qwWX3iGsk90iV4PXaOnYuVPj+TtcKBLoVymKjcS4dSqsofkMSoTVRDbhmi06SVmB0w7tii/6NqYjLhd8RYU7Li4Qb0NBiRsRCKMqDP3bwUMI/44zrmgv+fui+6C26vXGnJ/RezTxNG1O6UI8skGP83WCvYirNJ8yEBrWRShVW4E2DXhVJvEBOJbNQg4gd5O7YOcWOJOSVtByG7j3RYRpFNfVG2ss2od+PbBXY4p2sPjNHBRyn5gCeYewsoLI9kPFOloX7eqxnGBnUhEh+9z82Ib5g7G0LINTcNnNf/RpRoLp7iB5bZBl4hhhKvqwVMX6Zw4kJL0hlTCYQdCRx3MATnXsWGzNc/u8GnM04B8JGDQFhcCojnW4SNvWVEseW17oReoHzw9ArExQMOwKVk71MhdIXYi/s2g3//arka9i6O/3aHO+r1yhxOQMm3iQqD1bWMxUn2M3SNA1Wf75Il0kX4rHWLkoQ+KIvNCe+Yi7sq1fU/h8iYzBRFVHTN/E6gfbP5Pl21DXBgenKXKI1tMunnubQ6Ne/2xTRwYf6N1FhZ32HcE1WOsXy4zE+2n9gwrgEtQx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eJjN21ev0f2LhksFK3BJwS4JuRKQpPRCp1u+k9g9lmArcua+LUABwopfreQBjihTRBz0nnbkDFddWGt20DRdOUf06n8Msdrxun+RBF5EvbYR5VUXiiR/t4HNSykJIj+Gx4sSdaSlUBLRk/F1mgJve2jWZFgmKDdQxowBrdTgIw1H3wyo/w9jmsg3VZQtH9djSRXKB4LjbvV6373DhUbhl2hX9HPOjRBYVk8U6doq9rpS0nIHREQXAFGzBWrSD2gLH4WzaS1L5CZuXO2uVDzfbd6dvuPYlv9rxs7HkYLyi8opsdaqnEqVOJtYLaLAyN7MmKdECZ9N/s5H9OZN6pdLCA4poY+YhEOb/qgvYAv+cb6R9OoBDBshpdPvLkZDtsKhywKdxfxRhxaylB/5LalLgnJmJv6xUHYf4005huQPAsxSdXwdnN4bMa2xHOrz2SVUM4tKdhG7ZSE5TOePutyYFd2Ue1BHTVAwFK8a2A5ckXqIjDD9PaB20VPa0t+QBDfnfyr1NQ6z8ZI4iYNuJ5El0mQe5Vn1kw5LbY9SJJoBvWniuDyG9SR81hV+EL7gyK2ZGCzQXCOG7Gh5f+B4VbCmGCol/zjf7U9VMUupiOUEy4DVbT6B3ATa48/fkzGLRKB8VnN7q17LO80vlZCTB+kCmJweFR4TzBkgub6ZKK/cEml7dMYcWeLOBvmi364ZXARv9L27spdp3sfcuQEH5qess3rVNGXDag+iY++sYTCeD6WsMMVqqF X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 570d1fed-36a3-42ea-ef35-08dbe4b25919 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 01:38:05.4088 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tlCN7F4HNiC29jyYYjUal0qZryE4NOuVRT9pPvf7MViQPE2gRH7XdT4IGlytgSQojndVgyFFeiHuxobFneYHVOfWOgFD0HE/nhxf3ScJ3gE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4199 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-14_01,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311140010 X-Proofpoint-GUID: KEZHCkbeFh-IN4UlKaxwTzR7ugXRKMTu X-Proofpoint-ORIG-GUID: KEZHCkbeFh-IN4UlKaxwTzR7ugXRKMTu Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has sd_sync_cache have scsi-ml retry errors instead of driving them itself. There is one behavior change where we no longer retry when scsi_execute_cmd returns < 0, but we should be ok. We don't need to retry for failures like the queue being removed, and for the case where there are no tags/reqs the block layer waits/retries for us. For possible memory allocation failures from blk_rq_map_kern we use GFP_NOIO, so retrying will probably not help. Signed-off-by: Mike Christie --- drivers/scsi/sd.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index cda0d029ab7f..0d73145430a4 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1645,36 +1645,35 @@ static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing) static int sd_sync_cache(struct scsi_disk *sdkp) { - int retries, res; + int res; struct scsi_device *sdp = sdkp->device; const int timeout = sdp->request_queue->rq_timeout * SD_FLUSH_TIMEOUT_MULTIPLIER; + /* Leave the rest of the command zero to indicate flush everything. */ + const unsigned char cmd[16] = { sdp->use_16_for_sync ? + SYNCHRONIZE_CACHE_16 : SYNCHRONIZE_CACHE }; struct scsi_sense_hdr sshdr; + struct scsi_failure failure_defs[] = { + { + .allowed = 3, + .result = SCMD_FAILURE_RESULT_ANY, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = failure_defs, + }; const struct scsi_exec_args exec_args = { .req_flags = BLK_MQ_REQ_PM, .sshdr = &sshdr, + .failures = &failures, }; if (!scsi_device_online(sdp)) return -ENODEV; - for (retries = 3; retries > 0; --retries) { - unsigned char cmd[16] = { 0 }; - - if (sdp->use_16_for_sync) - cmd[0] = SYNCHRONIZE_CACHE_16; - else - cmd[0] = SYNCHRONIZE_CACHE; - /* - * Leave the rest of the command zero to indicate - * flush everything. - */ - res = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, NULL, 0, - timeout, sdkp->max_retries, &exec_args); - if (res == 0) - break; - } - + res = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, NULL, 0, timeout, + sdkp->max_retries, &exec_args); if (res) { sd_print_result(sdkp, "Synchronize Cache(10) failed", res); From patchwork Tue Nov 14 01:37:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 744604 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 963DCC4167B for ; Tue, 14 Nov 2023 01:38:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231765AbjKNBie (ORCPT ); Mon, 13 Nov 2023 20:38:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231872AbjKNBib (ORCPT ); Mon, 13 Nov 2023 20:38:31 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA6FDD43 for ; Mon, 13 Nov 2023 17:38:19 -0800 (PST) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ADNt3W4010777; Tue, 14 Nov 2023 01:38:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=lkE6YB03vn58d7F5yu/BNH6O2p7Ojudh70E71un5AWA=; b=0p5Rr6b9P4pGIA62ey0mjz7kCFc2tFPV08TY/Y3u8ieKVsh5oqcOZfUqacSyVQCNKrBv tVkVXGCcFjV3DmvKc0m21gSkLmSJJhpK2RYcdAl/7rPn9n3Opm3XfLaegd+luHF02CSl nanMSQx1tNsxTkS2i8tJplk8xevbWmcTMO0cqo4P9pBaBQcGeTNazYqPg2x1hADWAVKu jHSp8cYhLRQCn/rTR5+jvInrnTAPTqj7Z4LwWM7Ldf72vqz6K6qMpiJxoaZdwVqDS+1v gM5wRIIQjAZyI4HnJeymlmyAdoSPGAA/LaFIy+IA8QXA8pjoAwE6IFxbgaJX3P+4Y7JW pA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ua2qjm56d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:09 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AE13Y5M022706; Tue, 14 Nov 2023 01:38:08 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2041.outbound.protection.outlook.com [104.47.56.41]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3uaxpxgwq8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CbImbR0m3O0yOwklE3Io4cqoLuYn7eCuTj55c9BY9nGUpU2vxEZV3u1ODOfNnA6jSMSc5BE6+/WKA3EQn+XUpgKdWk4n3x/Z75g4WXMWOFAYZiafAP0GGQBo+EE16KgHVdhk+k74ro70zNO3SlMnSXPWDHJjOQ3+TXD7ugBqcd22l/JJiDj5Wg/kkxJzDb6O2tZLyBn9dKFfRs01GrAARD0VWfIC2wvuUxj07XHYiKpm718W1mI/ttiCCCAfyZoEfQyHsdi8vOiu8NdMZr5faPUgz4D6gMXOlKwOBTdEnQ4sGayBGG732eVSPUE5Oc8NOUWv1TNIOYsmqlmKO3jEcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lkE6YB03vn58d7F5yu/BNH6O2p7Ojudh70E71un5AWA=; b=T4zOWMiTcS5FT28FgtIbJEF9ovPILmU0d+0HxkBPmkn7ANzcaAclHKOvtGkxfRZkWRVwP4QTe4YXVrIa9a7woLTW2aQHTXmwW5oh4UtHNKuQBZ5zYNUQVxNPHjQcGpT9uvunrp9cyPTvqmujCqGCpZyQjOWdr0gudgPeedKucQGC9iJB1ENncbDkkbecP0lVhF2+YfG6uhklcBd9De2ZNhhWvMeWaksE6DtNFrfDRgxnofsNgxzBDzU/yhhQMGv6+sWEgk9in1pgXpZkBk7PYe2PHULjiRDoGpsN518LjjvVUoxw8G88cxP3mRVJkU+UXEyvbsXUcOvucjODZGNb4g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lkE6YB03vn58d7F5yu/BNH6O2p7Ojudh70E71un5AWA=; b=mbR0aN5fhJKhrFDfNlP3wnZWbYchvjfMEbkesD+TpUwJwTyFtIxghuw3JcewEW3S/uAhLRpxJgrYKeQpSkSVXokcNScFObWA+NumxujnFJWVw0g/L6aaU3HLYu2m3MsYpHlFIyLeLBT4b0xZRMNZa1QRHVALpkoJkPXlx/UNDBs= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH2PR10MB4199.namprd10.prod.outlook.com (2603:10b6:610:7f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 01:38:06 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e%4]) with mapi id 15.20.6977.029; Tue, 14 Nov 2023 01:38:06 +0000 From: Mike Christie To: mwilck@suse.com, john.g.garry@oracle.com, bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v12 11/20] scsi: ch: Remove unit_attention Date: Mon, 13 Nov 2023 19:37:41 -0600 Message-Id: <20231114013750.76609-12-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114013750.76609-1-michael.christie@oracle.com> References: <20231114013750.76609-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR06CA0102.namprd06.prod.outlook.com (2603:10b6:5:336::35) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH2PR10MB4199:EE_ X-MS-Office365-Filtering-Correlation-Id: 41822e7d-d2aa-4063-ff7c-08dbe4b259e6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PKaGrM4gieQvrkwxcsg5nNklmztfxy7fU2f3+lu77kUdELxQxu7/siwq/OfomzroPTVKpNDg1BWsl8r8O/pcPFz+qiMCJQ6yxzu0FIV9TO+E6SnHEk7fEhHEzrjh6lrV1XJPXRw9H3++Z63DzM4PS9K7fE/l+p/QVeM8hprCp7I2lu21Y+/84noC/uvCUg+8WKgv7uuD7cSKGuvbPNaF3a2YZ2oSbt+TPU9a03FSv6QawxPq9nyL1vAPcWB8OXsKXWWKgfQ+u/SpzzCEh0Ab+s4dJymrpz5jAwBs3i1X1sIxRkz15Nbr/WVxxV8ln0KywfoEdvFBU1p8Zd5R0mlKBGJTvjzAFCZkalvDckxcHn+koyVevLxcDrqsUABbqYrd6+tjRKx+jJgqPB7dh15LCvbyAUhuNzUnyXX8o9m3b+xmBlyYkHyYOeEQLLgQX3mJncMcFmv5lo1SyDSWzb+74jwAauImsiQY+lxlYNGdt6KImbgoiJrBrn5EwFWDFNMKuL/abvcQJdeOmRPmw+Uy4KYh1O8IV8sYAGkOJctxEhDwk33K2jxhZJSCT6MXOwPpRADPnOKmgtg2xu/YCSd/4gsJL3Ouk7L03/DF9n676dQOegDazus/Us7zq6SDpF/4 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(346002)(376002)(136003)(366004)(396003)(230273577357003)(230922051799003)(230173577357003)(451199024)(64100799003)(1800799009)(186009)(83380400001)(107886003)(1076003)(2616005)(26005)(2906002)(4744005)(38100700002)(36756003)(86362001)(41300700001)(6666004)(8676002)(8936002)(4326008)(6486002)(478600001)(6506007)(66476007)(66946007)(66556008)(316002)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2GG//dZcs4RLjIkTPbzR/DW9kwj5kbKr7DbgDFtsmdV4IUG7LML6cBFLOIg+T+kMfQ7UC05y/9NppZWEvfQBqBswytUNfm6Zg3SwmKoVLJrHJKpqDjCgDUOuHQcZNQMJwdrilquC5NNE4dIp0fDGVkAly0wnuXiVqF8cik+BRSJQVuEOlYgt4ZzmAqe1mMs/fjtQzWEKg54apzBzJcNl72id7flfrPZEa6fykh0XAOQCEnVMcs4UZXtC2Me9iWkUflaTynE6lxNuCIVC+18OJ2P0C3U6jRs8BHTGS1/qSO88l5PGNo0bIwQpEGY1OMXgPb1Zq+bq4+mlpVKrB6Zfc44rFrKhsUu/a+XcvHhPCoWWSDyg0A/8dOc6PEUK1/ts0pfYcRPeX70LEG1jd25CR5PyfOPJVwpRStVuCuiYoJ+/IgolN6zEfja8MGA17ef8KJhuSWwPbrAkHtGxLjavpfWrmFIaRl+kulepttM2R8FiQfX3wn3uOG+Rxi8PxDtVplAeQAUSGlgrIB61dbWjCXfgZA9xTTBVsNm8Rvz4gsc43SBCGr1AsyxvxfkYtq4Y6u1Ia5FG5xX9WvhBAy1P5YNgKhVCznvtSfR4ttR16kabHwDVmGW0L+ZKZMjM9/IeT2HLhPizfYOI1TC3p3CuiNpY2PF7tvGBy7cIWHiHFW3IBHp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TCKZ6V0ZmWR+sMR7W6r/L/hZEGcsO4jEwZWfPx/PfyXqernTQCG9M8qGdf2GvyLo1pxWyrRJtby8gwA98kckOMLfBZdZY1J1iGgIqTEaJw7xxI2kPipQoiiy5s6v90fE5BJRASBnsdMQFZJ6Fc3AMabTsyXM552DXQm+qaTIsQNokM5HR2iTki/9TIv5DY2gC+XLzMIJuE4QyLiS59F/MX/a7LkDZS9wn/EDB5ZMR7atDJ82iOdOmes4b63/gFI4SxR7E1cmOKPsvR5o1AXiEE+qPDHmNRZx/KvJTFXgZdAJClzUznA/tKOBQpZFV5k9K8J4xR1RvAiqIzAsUj2x/eZtTaa2+YWOtY04G2F3wgjvBOXkuoN5FAPq+aSDC9JAO96VDLlUesixRpIBb3NDi5UrCa3dj+Y9LQlK8ROjQSJZL9LRhWJMAlQeibfx1csjXJwFWJkAbqhX3dCtLlL/9irM8mYUCYMbGX2sew0UFffMRq1ABDJmKOQ7dzzma9Jg1mku1ReN03DlCLa+6z/InICadwcEqqUtUXPeP8LfKNpkKNrErvqOMirYTzEGcBvLtZuf6lolttrhNECyMr8NUCxfzXWojNPaPTfgnJ/hYM4pReYdbP2s+65L29/VwaCMzCY67y2al5RUHV2GEWDWFWvXfLPmMJwSct6NrSshO17Hk5dwXbIrsrQvHoN0HdSqjPUvSVG9qwdG5SIz8G1irOkPuACnta1cmp3W/nKLEsUg+5t0mlhqTF+Jj2/R69Iqq+wWZOb8LrGZyeMHxB989RojHj1XmU9/xiodDtuGsXiQaArrSk4sqThLWRDWgIBl X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 41822e7d-d2aa-4063-ff7c-08dbe4b259e6 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 01:38:06.7352 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: YdpdPw0cyCEwgShRzqagSUmr/kFBjA1tW8p/naKI9fwwnjCXk0BYFbciiOqL8dZM2DU9EXT6HsZSkXJnp11+Z8Q0jX9fTeEkM745hbKwR3c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4199 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-14_01,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 bulkscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311140010 X-Proofpoint-GUID: SrGdY63lhRQW1EWdy2XcXk43hRDtSdDz X-Proofpoint-ORIG-GUID: SrGdY63lhRQW1EWdy2XcXk43hRDtSdDz Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org unit_attention is not used so remove it. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: John Garry Reviewed-by: Martin Wilck --- drivers/scsi/ch.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index cb0a399be1cc..1a998e45978e 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -113,7 +113,6 @@ typedef struct { struct scsi_device **dt; /* ptrs to data transfer elements */ u_int firsts[CH_TYPES]; u_int counts[CH_TYPES]; - u_int unit_attention; u_int voltags; struct mutex lock; } scsi_changer; @@ -208,7 +207,6 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, switch(sshdr.sense_key) { case UNIT_ATTENTION: - ch->unit_attention = 1; if (retries++ < 3) goto retry; break; From patchwork Tue Nov 14 01:37:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 743967 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C79EC4167D for ; Tue, 14 Nov 2023 01:38:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231965AbjKNBic (ORCPT ); Mon, 13 Nov 2023 20:38:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231313AbjKNBiU (ORCPT ); Mon, 13 Nov 2023 20:38:20 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B547CD51 for ; Mon, 13 Nov 2023 17:38:17 -0800 (PST) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ADNshUq017317; Tue, 14 Nov 2023 01:38:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=XOA7xFZx1ya01Iz4GEFW/R6UqCxtQkcq1YDmkKdjcG4=; b=o4c1+A9MGA2L2j/2kAekLDeTpfU+67M+BEhBEVzUe1ddTYeUV44UbNDpVVXPYqZXDB02 TPaRT1R9Ri9tmt6jEvOffxLPSPq4xV5Vmdmo1xuLjJy+4SU89NOUE32HdkdeWHS8UikO i6jJG5fPe1vGPFDN74RJOYizB53pc3eVuHe9Z6Gay/3vU+pAu/WxR72cbCtMpbEvuCVz 6akayHv1sf59nJFP9IWQFu+QS0bDX8H+AZWDt2yX+WsEvpTXKPhMqCpjOPgIQLMalfqd 9DY3/xf7DdK5zvXFkf0SIw+mftQZI1n3BmL2Wo3E+TWp2FhpTtnJ9zicfFKOOyrEOvKB jw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ua2m2c4gh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:09 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AE13Y5N022706; Tue, 14 Nov 2023 01:38:09 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2041.outbound.protection.outlook.com [104.47.56.41]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3uaxpxgwq8-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NG3MoN1SbWbTsC1r0ie7yrUxjhu2Zp1OWzaknZROkU9d1MDKy5FXXIa/FvzSqGrIKLAvqA0Wj5YZudanJ9biYafRPW9O/T8OykIfSYKdI+2okaVjd4XkWGRR2mGcD1dM67zhqtHt308iV48P0+hVDwO8SQiDoGmKXwBL+xTklfEVzTS8PtacuBoSRX5ZX6mRAG2hlbMLGC4Vf3FE308HD9jQmE5JqMe6gdo+eTdE0h8CAQd+vFRyAz4vKzdfelnogZKKCkd3LDNFGk+RYtuD3G9WVD4zrwGqIjju9YcW0Jm7DomO8nHavotxazHZDZOQrAbW2sJEywEjDL4YI51KQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XOA7xFZx1ya01Iz4GEFW/R6UqCxtQkcq1YDmkKdjcG4=; b=BiX9ux216/gBzE4KnBi39f2pyJZ3xH5lYGzMhLdf4hTPm8/OHPSimLnt6l6FPInEW9+BuN7u8wdv79aXWduMhyBU6ZGZespOQWVxwvbHjx/Yoly0fj29dBgWetf0s1RZaUQRIh/xT9u5KeJRd043pOCPujOXaX6vZFWFyGqV0mN3K3T4rnpHGjZtVblEA+102ZvcnMk9tWznhElYS/OkuyhAKAIMbsuazPDSS7Imomh4CA/TAnCSyOFcXubzNNrwPOzfhPtVVb7SegaqGsEhV4w7F156a5z23fAMVFd3FAzLh9hP9hOOjCMkd9FEgoHlKN4IN8b8EjF6Uh5+VbvZuA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XOA7xFZx1ya01Iz4GEFW/R6UqCxtQkcq1YDmkKdjcG4=; b=eN8cU5iRsdtEJMkqPeYV1Oirckb5VS7wcG6uvV7CIMrArodDIgha/nF7cKETxt2njFEPLMpmWmMm9Nl0yCOl/M5WMZ9a+RPkIqICx1s1DJeefLP8EVEHFO5MKtrk67VYYsQhfRCN2NHd5h7svEDHCQy4jtpOa8SSdA+FyGtZAWs= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH2PR10MB4199.namprd10.prod.outlook.com (2603:10b6:610:7f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 01:38:07 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e%4]) with mapi id 15.20.6977.029; Tue, 14 Nov 2023 01:38:07 +0000 From: Mike Christie To: mwilck@suse.com, john.g.garry@oracle.com, bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v12 12/20] scsi: ch: Have scsi-ml retry ch_do_scsi UAs Date: Mon, 13 Nov 2023 19:37:42 -0600 Message-Id: <20231114013750.76609-13-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114013750.76609-1-michael.christie@oracle.com> References: <20231114013750.76609-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0138.namprd02.prod.outlook.com (2603:10b6:5:1b4::40) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH2PR10MB4199:EE_ X-MS-Office365-Filtering-Correlation-Id: 564cf181-a55a-4709-86ad-08dbe4b25a8b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qCbfUyuqI/9RnCxA/WnIImzAgJ7qcS49/DJ7Exnmg0aiNHSySf+LdOiRv1XOUCrrGY1DPLeVixsStbwmNI6GJaIBd+bIOyCJ1Srg+W7TyfACQsAw/VSzm9L2W5ZWdGBZf0CHwZGdB1HEV86CXYyey83ZX5cQ337c5iFZJX/X9vla9IRB8jLPJYH1WHHaZGOYjjihunNvwfrTj+O0gNztnNKE+RUvx2IORkosG5U917/FFsmwnAitMK5iDy5yQSN3fhIGPpviPXOmNJ9SwbfmmpYCqhFv/CgxO1yvjJpQAEX3dGLG0j87ajTFtHOynlWtSE0QVwlDUTuf7IiLmk0JBZhLrHiZgsdyjy9NV7eYw9lJf++GUhub5SMFzCD2t5/W7Zuy6uzSQ7CQQVpWKstlQBxVqLuvXY9ltmQ1yaEOdB1MHR3FByV/R6ZfxVP06hQJVdhLw+GYQD2k9sj46p2pOwy5mEbHw2gy7+dntZY6UlkKS9hGjDxbHmdcRYbYzJm5qOXJSnmTHsAp2T6hRWWo0p+GT/03VWA0DIfMS9Wk576HH5ix/u3qGC9NuoaHudw+PM+/FvlsCcvk/AyEtOYGTQy+xyxP7qDTThTFECr7bwdmjWPQA7lG+lS5jLnGiaDO X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(346002)(376002)(136003)(366004)(396003)(230273577357003)(230922051799003)(230173577357003)(451199024)(64100799003)(1800799009)(186009)(83380400001)(107886003)(1076003)(2616005)(26005)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6666004)(8676002)(8936002)(4326008)(6486002)(478600001)(6506007)(66476007)(66946007)(66556008)(316002)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oDxlGRwrVfQYlapSojr7mWBSMUvA0OUTKcu/pfdND6+vCo3/3vWfKXOBeDHmhYrLPKg2Kda6ZyuHjl/8URRezqHVpVvpCJj3h1ttNjK7YCTB65FrB5RONzZxQEAzfbXcC7tYu2iX1FUKle6gpFXlfEXZUpEH9Hwb+qldO8du7viYAH0Cx5REdtEp/r1q6aLc2QYX6QiYU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BJMs0YxS8Ls6K8m6M/DpZCGrPyyVmTNTR5eHmKUH1VBeivLQm9LdPELAPXwvUJxfGi5sfJ9WkVLA+/SiOphvwv2VDjaCHzZ886P438zmnrMkwXVBVgTH78QujOvBs81N2TGbNeEqOweljY1w4UUTMXl215r5mJO7mv4FmeTq7Eb6HEKOKGWiPE/zkDPNCZ9WG+rYltfrqO2vuMT3CmGJoG4khYo4MljnAurbzJit7EicVQ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 564cf181-a55a-4709-86ad-08dbe4b25a8b X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 01:38:07.8233 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: n1kbVJcX/+MGbHMZcLar6Y9gAnvswxvC2UJ6267qLVbWuGzOU4go3s5tFltN4O78Mh8D9Ji9xMn+8DGIxACgGUTlALUzmo1vp9y1YwrvQT4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4199 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-14_01,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 bulkscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311140010 X-Proofpoint-GUID: xhGlLF0ISdwqWSC1ci5N6AkRN-EZruRJ X-Proofpoint-ORIG-GUID: xhGlLF0ISdwqWSC1ci5N6AkRN-EZruRJ Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has ch_do_scsi have scsi-ml retry UAs instead of driving them itself. Signed-off-by: Mike Christie --- drivers/scsi/ch.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 1a998e45978e..4811d15b8fc3 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -185,17 +185,29 @@ static int ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, void *buffer, unsigned int buflength, enum req_op op) { - int errno, retries = 0, timeout, result; + int errno = 0, timeout, result; struct scsi_sense_hdr sshdr; + struct scsi_failure failure_defs[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 3, + .result = SAM_STAT_CHECK_CONDITION, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = failure_defs, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = &failures, }; timeout = (cmd[0] == INITIALIZE_ELEMENT_STATUS) ? timeout_init : timeout_move; - retry: - errno = 0; result = scsi_execute_cmd(ch->device, cmd, op, buffer, buflength, timeout * HZ, MAX_RETRIES, &exec_args); if (result < 0) @@ -204,13 +216,6 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, if (debug) scsi_print_sense_hdr(ch->device, ch->name, &sshdr); errno = ch_find_errno(&sshdr); - - switch(sshdr.sense_key) { - case UNIT_ATTENTION: - if (retries++ < 3) - goto retry; - break; - } } return errno; } From patchwork Tue Nov 14 01:37:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 743966 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37282C41535 for ; Tue, 14 Nov 2023 01:38:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231722AbjKNBid (ORCPT ); Mon, 13 Nov 2023 20:38:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231506AbjKNBiV (ORCPT ); Mon, 13 Nov 2023 20:38:21 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D851D57 for ; Mon, 13 Nov 2023 17:38:18 -0800 (PST) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ADNsNM2009055; Tue, 14 Nov 2023 01:38:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=6XVjzyMVKuJ7EPCNXg0h4JiOQCS6wjLoyflDyLvdw38=; b=b9AEWlROSz1XXVImzFXLiOlyleJBuZEdt82W2oD4EJTN+qRahnjOL3UClmmHQo4REN4K hc3X/2/icVvPRTTZJAbnKP0lXqYs6XofJdjdUC3neg5vJ+dVMLKby0pde0J4JFgrB5Mq klJejeVqIAxnSzIvIizyoXeACTeu5DSwFXCUvzXKFZNSpRcWxqrsnu7SD2eDFo6at+lz MT9OvoD9T/u1Fx22AzJrb1CtuHo2vcsT7hoanW4FV1sVC8/o/MIQVeGSZ8xvtSOTO7SP ynZyLTmcapu8B2BQBncG+/XY1BuHeqFjUhL7AQ53GYJs4OpmfPzGcXlaD/f33ZvFRZQm 1g== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ua2qjm56e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:11 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AE0SxC0013517; Tue, 14 Nov 2023 01:38:10 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2040.outbound.protection.outlook.com [104.47.56.40]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3uaxj193s9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NYmCUwg1D2Jnp7xgOvUQ95uIu6VlPHqkHWaBp7PrNcUlh1kRK0qoGgI57Vd8C7oUhS5TbKsl4x/iBtwA1IRvDVOUh+Yt4sh2MjUEMF/g+tqDaWxafiakVxIRqAYZoGvMrbaRhzYngKnrrMOg1o28o7l+EYxwGE1WSnBthsk/A77wttc6rmRLbEPHCnagpzLzTbkVNa5p/6x9SMH22l7SPFzEeW7GX2t8MzB+N3aljoGZM1oaplFrFl4TRGNEZeQeWyOUuWrVNbMcQ7MzZGD+/NjxFkmeeyKmp7smcrQn2cpML2UUtTkvZ9nuXVD1NxWB6i5MHHoewSU7saxtYFo9wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6XVjzyMVKuJ7EPCNXg0h4JiOQCS6wjLoyflDyLvdw38=; b=g5+lscU7cWJjpCkvzrqNqFkWZ5FJctO/dwwUUVqBFUgnoCGmm7E7TDTRB/wGHCMBKCf/TMLunOFwlOgtUFAN50EqwWN9tukor2mE9E83+UtRJbk3WM1qm0qIn2o3iQALO0KB8HqNBush7NrIQciHP0hUJf6IE8THrj+2t0FHGTYCiHdzUUexe7TZ7arVH/oKryevps0ybp8HAx9D2rxHCPx88lY7yLCFGbSpjR8tNSTpW5l2gPuvdekFs9zgikfTYIlLcp9tE59yQkEoRDRNl1z6//8AKa5AX+PkbISx8jWtj+GoWHKwe9bKw4Arub8iMODnNpvo3bdYUUWCeF3mXA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6XVjzyMVKuJ7EPCNXg0h4JiOQCS6wjLoyflDyLvdw38=; b=cKrOxUrMd60w+wiLu0YFCzu71mAsWTzrVLEJxCe96S9fr5IEEgmPxsQOwFU/8B+QtmmO76OfpGO3hcSfALDX1n4kNXDm3sW7jyeQrYIWGRgmj5uewa4LGeTsvRobdCUFmQ+XiaQHzEdjVqix/AW6yIJlWZGck8HTI/Hd4TgGTZY= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH2PR10MB4199.namprd10.prod.outlook.com (2603:10b6:610:7f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 01:38:09 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e%4]) with mapi id 15.20.6977.029; Tue, 14 Nov 2023 01:38:09 +0000 From: Mike Christie To: mwilck@suse.com, john.g.garry@oracle.com, bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v12 13/20] scsi: Have scsi-ml retry scsi_mode_sense UAs Date: Mon, 13 Nov 2023 19:37:43 -0600 Message-Id: <20231114013750.76609-14-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114013750.76609-1-michael.christie@oracle.com> References: <20231114013750.76609-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR01CA0025.prod.exchangelabs.com (2603:10b6:5:296::30) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH2PR10MB4199:EE_ X-MS-Office365-Filtering-Correlation-Id: 214c93b5-54b8-47e4-348d-08dbe4b25b56 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IsSgJLDHy/K2q+/t5ZXgsZo+lcPt/CNzyAPrNAbI7/PaKYXCTNNp/eopaUDupwMA5pE5hf3axbK6XjdAlPUtmcbWrSycUeOLqlVZeTrIwab2ZkRB4RchpEkBMB2dXxEJCabJYbZNIM6Kwsm9MUVP4x3EeZJPPMVxk8Vdhoabbi42e/5ihOcs0zJq3S7tgOWssa1wTBIlIrZrfyHXYOHBuKTW3SkS1e/9fRao4IOVH62Si+VInruhN+Ec0dHINxH6Lhv2BQlOeYCmUMNZImlbycUMqLJ5QrGKKG1cU4+0uUg0ECre06xANBEv/Wve3jEVt63Pir6Q6myO/07e5vNQ02yU7X5vS3MtcZY2NNbvQV2DT+lwhyHXY7fpeKXU5P9mURM0CAVkFPcr0hIUSR5sPkgdFhr1VSA9/moYtJ+3eTyjzMAwdUGS6TIR1mym2Ei9tWGVtzoBawx/LK9X+5HH8VOCbeAkaJ6KaapyWCUlp5Ku4iCuMpLmriBwHdO2TR5RXoDngpWRd0zCytotb5FGWqSwDbc+7/QXBpC0fhrLx3XkkjsH75ceNhdQrCv4rULK X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(346002)(376002)(136003)(366004)(396003)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(83380400001)(107886003)(1076003)(2616005)(26005)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6666004)(8676002)(8936002)(4326008)(6486002)(478600001)(6506007)(66476007)(66946007)(66556008)(316002)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xK6n2wxKY4mBM4P5d6x0vpCH86At+0DEjEU47GKldmmRRvqZeyIESSdfulqr/QEohSskO3RLozK0rcYLwD43rhtGE9qFoAy+znnxIf5U5vVkVyOs0ktlWLYWkII51Dzbtc+31JT6Db2oyqd9d71j2u/DBL/eDw8gbk8bJOKwbTFTdcxopjW9NIny10zjY6reTtHUx7GNF4o6oH4WkAXstfllw0tONUQUGLSjYrMApGuE37un3iDwJoUkxWxaW5L72OfEj+y9lRKkDj4KBveqpvS55gV9rEJnsYjeiDui7H9a+Xryn16vRc18YjwDI6w9JiwIGgrVsDK69Ec9pc7tplBvP13c2LEsjDvK2RzeiQTBVUAIyCuJv+RSKAYjWQI8xO3/i5lwJvMFL0tJaJdsp4cc6BU/zYDtJ2BJaeJVnOzXNg2z6dJCojDL8b/zAlbq5hXwTkA4RlB3eqLzNf4w6S7PAR44qwwwXfESqATJ+IUPD7L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IsHJ0I+aNeJ3pyAFQBnAVqBXoA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: BJTl61dw15GiwlkTzEU9v2v8gcM0jYa0xK/wdXMChHGQMlDG3n8mvF8Emxygiybzkzpz4yTl1SvNxMWLsBaIYv6e7WngReChvXT46mX44XjjmWLZ1rCMFPDnKeJjJsrLgKlrK8YMVOs6YWw7ijilAOkerUsS81Ny/Jn6VaDZ0hwOBqYVJkmSHs7noZEoKZiSeu2dCRskkmrFyzh3RQNyQbj6SxtWlmFrfnp9jJXUoHUhSakTvmG/FoQT4+I2u0+Kjd9kD7B/Ob9pRWHnuecznZvFqgHq2A7hmRsNxLrznyuzpGneWFV2XM4e771UwQ2FnUdgm/CIjRYfaJ4v6IIG9N0InXIbu1KEjSw2yjdqfkieUytY9TtZpJfuaoL5vlggq3RtUSE27iXPJBqLn8jfAktCEKSgsnEbG1dIQ3NMhH8WroNz+IR+SnfWjV+A5PqiafoTW+kskovqHvsV3HZHgqOC2C/iAYi7tgpZrYfUMMnqVQtq9DBfm3CsZGi+fpDL8TtMxfwpzDmRjp147fbRWy89dJcE9OaC4NYvOzLbXs7DYwhUxB0K8/Uk6I4+PBqAakWs17OSDFeXWs/D9kBXbmWpy6+DFVdzCBigi2KvRS34753vETXGU8KEL+AQtBL6LnyM7NEWa6N5LVln9XJLaHxAx7ODpClw3A0oKtpoCSpkfpAfafu5M6GGLdVH73UCQuqHVrsCrxOZoWdCgVx/YoguYI9h1pV0i1SFiVc2/DJ09DBXzz94nS99Vsgs7VXRKTQ1u/3x4wN9tg4D1STkkUwsYgsjy6qEA0X5BcSmqutmh0CpE0JqdyCBt6tyrKTXEnmHKc8kcroNLC6ZVhQSfFdhfW653jfaxJ5ykdL4da7jUSvxuXAuWsOtE+mNSJS8 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 214c93b5-54b8-47e4-348d-08dbe4b25b56 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 01:38:09.1518 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BE9BgiygGF2dQ2UBd0+srf2FYWfzi5iy62tbOU8jrNNz/msBwUcx0jhK6GXXWjsJ0xYq1ANsx1AQgeU3xXxSVuX6JoePKZb+xV6cEziAQzc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4199 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-14_01,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 phishscore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311140010 X-Proofpoint-GUID: q1TguyWYjosYQEVG6wD1RA7xnIy472pZ X-Proofpoint-ORIG-GUID: q1TguyWYjosYQEVG6wD1RA7xnIy472pZ Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has scsi_mode_sense have scsi-ml retry UAs instead of driving them itself. Signed-off-by: Mike Christie --- drivers/scsi/scsi_lib.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index dee43c6f7ad0..69c79725a1cb 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2262,11 +2262,25 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, int subpage, unsigned char cmd[12]; int use_10_for_ms; int header_length; - int result, retry_count = retries; + int result; struct scsi_sense_hdr my_sshdr; + struct scsi_failure failure_defs[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = retries, + .result = SAM_STAT_CHECK_CONDITION, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = failure_defs, + }; const struct scsi_exec_args exec_args = { /* caller might not be interested in sense, but we need it */ .sshdr = sshdr ? : &my_sshdr, + .failures = &failures, }; memset(data, 0, sizeof(*data)); @@ -2328,12 +2342,6 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, int subpage, goto retry; } } - if (scsi_status_is_check_condition(result) && - sshdr->sense_key == UNIT_ATTENTION && - retry_count) { - retry_count--; - goto retry; - } } return -EIO; } From patchwork Tue Nov 14 01:37:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 744599 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2ECEFC4167B for ; Tue, 14 Nov 2023 01:40:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231962AbjKNBk3 (ORCPT ); Mon, 13 Nov 2023 20:40:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231906AbjKNBk1 (ORCPT ); Mon, 13 Nov 2023 20:40:27 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E40E1AB for ; Mon, 13 Nov 2023 17:40:21 -0800 (PST) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ADNsedC016960; Tue, 14 Nov 2023 01:38:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=nfn+ek1xQwH9YWUKf3f7SpAOY2Y9Pp2jwQLU+p0OKkY=; b=NXnKW1v+0r8dGkX8zER/fFe3Rljvy9EC/H7o413FnZqc3TBKXC4CikakbqBY7x3yDPv/ jfuP8PucbMAun+syORdnA2FqiJmWYMaJRc6RuZ2IeUPYPdQFQpilwU1wSu+wzazOn01Y icPxHd8U/T01h0MqsNRDwWDDGMN6Ejvmg6GzrSAzMaWcUoifq8qaNO+fI6e5SWYH8KAr XRMMF7/LGdIPCxyP2o+OFO8e9k4HE08QXVw0Oo2vPRrGCdKZ00IzKZN0qBO6krW+kg2E zC8lE9fhSogLJGVzChsh74zMpZSMvaxOeQW+qnKWDyRw+NwhYs4TPpDa/6FRZzoSwC7/ Og== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ua2m2c4gj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:13 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AE10WDG015009; Tue, 14 Nov 2023 01:38:12 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2041.outbound.protection.outlook.com [104.47.56.41]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3uaxpv9d8g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R7Vd0uaS3Hzt7l0RI6ISn3ird0h3zouT9ik+SP/nUE9yKHWh2IEeNTyhtqss+LQ6mtCgKMdSF+7lXF8HuuHa9hqPKGMWawPN57Ko9ssswmrDkL7RRr2Jis1w8C+0HhK33XyN/tY3DPFI5NqbJWMVfvWHz8R3vVu3QFT7pdWYSQNRA6BrFQo1wOzBIOaYKqbk14SfnTE9dfKr0iZxb6kl3zqjtZh85mp9LZN7Fsh7MpgLrXqRir+4tkS7IY9KzifU7Z+lT0BLVLHkittnoodZ46bbXsjyDB+/iYS/mX940RqmClCTNp6Qjo4f6OdPk3mPQx/+y+bubEfwifP1D96UVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nfn+ek1xQwH9YWUKf3f7SpAOY2Y9Pp2jwQLU+p0OKkY=; b=DWyF/91BH/PQ9u5tXJyZRDpFoKyOdaSkFEiAwqdZBmE5cTDATTqdVtfhG7y2TWmpso8nX8hqfaH9gbvUvotBBSlfTv2oPboEP1dUxXwffsj4pYgDhGmlH4Indx5pOtitMkDCXSThLMsXIXW92HUgLSsRliAVkt4jNVZaEYUY2xdXD+pS0v8ityqyV3muwA1dZ7MtrAZtdInhv5DjaIk0AdJ2PJsBujBDtlYT81zzW7SxXRxJpme2LghkToQk0PLShKFjxBs8h/PN/cJbm/TRj3n1j1EhBgdLI9HAFP3624gNx/T+TR1GJ2+Gr18Dp06hp9nllmWbzvO4HR3U8LvVZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nfn+ek1xQwH9YWUKf3f7SpAOY2Y9Pp2jwQLU+p0OKkY=; b=GbAd+udjAjtNqBmPsgRvJQxJzRrNEp1tfDIUbtuGn5gIpeDt3kG7t/8fgfLpyobKwD/mssZtgITNCadA7REZ93bVhq2MrQXyMjeyHoQhNh6qjNkNsnA2L10QCVQbjny8jIC1KP4hn6i033AXNju+3OilrvOLzqphDl0A749WFpA= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH2PR10MB4199.namprd10.prod.outlook.com (2603:10b6:610:7f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 01:38:10 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e%4]) with mapi id 15.20.6977.029; Tue, 14 Nov 2023 01:38:10 +0000 From: Mike Christie To: mwilck@suse.com, john.g.garry@oracle.com, bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v12 14/20] scsi: Have scsi-ml retry scsi_report_lun_scan errors Date: Mon, 13 Nov 2023 19:37:44 -0600 Message-Id: <20231114013750.76609-15-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114013750.76609-1-michael.christie@oracle.com> References: <20231114013750.76609-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR06CA0097.namprd06.prod.outlook.com (2603:10b6:5:336::30) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH2PR10MB4199:EE_ X-MS-Office365-Filtering-Correlation-Id: a3418550-49fd-44d6-ce8e-08dbe4b25c2c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1k2yIysQpPxvp8Y7+MghcKvyQ2NFEGQrYXQcbWKAJa3G/DMia4APtg9xb+yd2h/tvW77K1k0xDRxtUorcM22EISIz4S2xlYth0qyKiihAjmV/0opOWCbxQRx7RJPdU0PUwZGpdPzvcSuFO6G/p/mQ/YvoieLsvdFHHlf1AxmBLY6/yGu6QIymY+lc58Sx7yhth3KC9nxddx/Uhh0FhVcbZ6abpj9PWv3zILzUL2bEWMApkXmTZthh8WK9G2ox5ORHEP6Qksexe6jrS9yWlB0wm7vIZpXZp6abUNceXo1a+Iw03xwnGkKHzcwK2ueCLvEwz0Jd+MG2/SJ1m3105eZD5z1E+zZ/Ft2MF88wyTJxxpt7N+2VyuhK2b9jObRqJb8W7h7PKQTLtevJHojWOBcYzb5AF1ueBP4obuHM10Ilx2mlQGMv0JZ79gVZBgk7PcyNWqOPi9U+xF8Yol3tLN2nnioCc/ig1b7i8wrIn/hGZzAhjLMhlmJNGua1s9/eZ8cvDWG+2I1AhZ/0ves01259Xmve4qjZyWa4Pf30otR9zxcTALHzBpw2GSx0juidVm6 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(346002)(376002)(136003)(366004)(396003)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(83380400001)(107886003)(1076003)(2616005)(26005)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6666004)(8676002)(8936002)(4326008)(6486002)(478600001)(6506007)(66476007)(66946007)(66556008)(316002)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OQo9dd2WtifDr5mjHAR/LE+qhl1p1AtrUiW1mEkUBtrj8DVV1tzt1Hc/BB20yhV0jrl7Ldf/HhyUe7v3SWPjP8OA05CK5vb0O2p2xpbslb3FKYzvG4XJyRd6p7i7R6ajRjECkNU7sB3HlYjHTTIoypzKKa8ZJ43yxVfGedpTw1Yq+POTnpAVV3MrV5jShc1tlH9PYdhmaiL+HNc6kHTBtlJOQGQzbycbSLI900JPffQDsVrLWiTF7SoeAtPEW0ommc0QMf/W0uVa+UQC234KCJimIahaY7vaEFhIICfhtq/STb3Na8I65w4KCsA//5KrJNS9t+9Po3wCMsluK0sXzVihRx7c1+a0w0n4iLP6QCLLRTuGbc32qxq/67o1G/IhstSmLX3bnAYUU7a+jVuCiN/BoDH+PlbODHya9RGoaGQbPsRz2uqPLnbqHf9lCjKuZV7HcPVHd23UQgjWcRPttz1V55B8alwiQeVXSfenfZoU3iKyd4r3tQn5tAbId+2PRBETXAtDmzmo6Hjja4/fL6TSMOCmIGlxFEiTnJQmhLrVipq6ONwjJbhA77if7zmvu66iz8pSgrXhGAIdwNaPHWrXicUOEQZAtLPv/eyUsXoIOHKDWi+PMesuUhodgqMfpiy1XIutsG5a3xfmhfIsrXWY3+uS96czK/prSZWNLreB8uwFuPrTAXS9eVv2zyNVxDTC28Om28cmk6Pz7ZghMEPpy1k2ak6TKN+cXDv7he7OAMk6sUsPrY1fD2wXUTPYxZvVIxDwlKF+Un+4b9m4veZhVR440YNqtBgGMkCjzHn8mEmx03XuZRWURo7fvjhMsmn3m3UejeLiv/ohqEkvein+L2Is0oN+KiQN9OXuLH9lSs725aTG9m83ILU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8dVYPkAIeFHBYceS3JIE6TumeCis5EjZ5yEd6DG3YtbnbbcKFssqgkZprk+fB7qdhqW42vXcwPeLc7X5fjYhW8F09US4xECo5+5ebvcEQrXcH9TkG5hfNCCK54fsChCMNVr3JEz6usMh16uGlJ8p3cfBSkX1t5/Vx6jPh0QtVDB+0/pook/hogywcNYBAgfpAZ/uqoYhb6gM/cG9P53WaminzuPNnCprTvqKqZ3nim9r+oh/Q7LQa8JupKYu6QZNnbFeh3g6pmseGEgWwelQfOIgv5pJOcmAbW8JxVgZsbo9QoKvqnPhyx99je7U4GXQxt20KosCMNh5JOUnwT2QFk/wRyfx7Jxv0yMylHP25L/W2wozPJvwXG5vQAhQzUMU3gbzF6NYFkfnOIQbSHA10B4GevZUKDVJtRvsVRac0efU/BD2XKgWj41IvuYKg5sNQUVkCgrPzIOs5gmtnp8K8dpf889GQM4iRsmDmpa4dk5lDHIAKehtZu8z+CzMYGgRcMM4CZzyx+EyxwEZXnOnolQPzUeqrb4kuw8g160a47KapLeKWb3m33VZhlRqKQBXZrwk08VFx/S/NSreGjW6paoAmjk+ANuWKqqORyEkAVwj6x4W3V8 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a3418550-49fd-44d6-ce8e-08dbe4b25c2c X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 01:38:10.5979 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kDnP8jteYEPYAnKuGkqOV4wQ8F3X2cnBIeTfvyxYa8PC2PJRuh/m1MQRc3QOh3+ywdsp1K/ysOCIhCRQPkst64RkM31gS9vgtzMFRUSdECE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4199 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-14_01,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 adultscore=0 phishscore=0 mlxscore=0 bulkscore=0 spamscore=0 suspectscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311140010 X-Proofpoint-GUID: uAZFEUabMRdss4yRYiCQmtcipjzoN6lF X-Proofpoint-ORIG-GUID: uAZFEUabMRdss4yRYiCQmtcipjzoN6lF Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has scsi_report_lun_scan have scsi-ml retry errors instead of driving them itself. There is one behavior change where we no longer retry when scsi_execute_cmd returns < 0, but we should be ok. We don't need to retry for failures like the queue being removed, and for the case where there are no tags/reqs the block layer waits/retries for us. For possible memory allocation failures from blk_rq_map_kern we use GFP_NOIO, so retrying will probably not help. Signed-off-by: Mike Christie --- drivers/scsi/scsi_scan.c | 57 +++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 8da0990b2dde..dce2d75e394a 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -1416,14 +1416,34 @@ static int scsi_report_lun_scan(struct scsi_target *starget, blist_flags_t bflag unsigned int length; u64 lun; unsigned int num_luns; - unsigned int retries; int result; struct scsi_lun *lunp, *lun_data; - struct scsi_sense_hdr sshdr; struct scsi_device *sdev; struct Scsi_Host *shost = dev_to_shost(&starget->dev); + struct scsi_failure failure_defs[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Fail all CCs except the UA above */ + { + .sense = SCMD_FAILURE_SENSE_ANY, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Retry any other errors not listed above */ + { + .result = SCMD_FAILURE_RESULT_ANY, + }, + {} + }; + struct scsi_failures failures = { + .total_allowed = 3, + .failure_definitions = failure_defs, + }; const struct scsi_exec_args exec_args = { - .sshdr = &sshdr, + .failures = &failures, }; int ret = 0; @@ -1494,29 +1514,18 @@ static int scsi_report_lun_scan(struct scsi_target *starget, blist_flags_t bflag * should come through as a check condition, and will not generate * a retry. */ - for (retries = 0; retries < 3; retries++) { - SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev, - "scsi scan: Sending REPORT LUNS to (try %d)\n", - retries)); - - result = scsi_execute_cmd(sdev, scsi_cmd, REQ_OP_DRV_IN, - lun_data, length, - SCSI_REPORT_LUNS_TIMEOUT, 3, - &exec_args); + scsi_reset_failures(&failures); - SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev, - "scsi scan: REPORT LUNS" - " %s (try %d) result 0x%x\n", - result ? "failed" : "successful", - retries, result)); - if (result == 0) - break; - else if (scsi_sense_valid(&sshdr)) { - if (sshdr.sense_key != UNIT_ATTENTION) - break; - } - } + SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev, + "scsi scan: Sending REPORT LUNS\n")); + + result = scsi_execute_cmd(sdev, scsi_cmd, REQ_OP_DRV_IN, lun_data, + length, SCSI_REPORT_LUNS_TIMEOUT, 3, + &exec_args); + SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev, + "scsi scan: REPORT LUNS %s result 0x%x\n", + result ? "failed" : "successful", result)); if (result) { /* * The device probably does not support a REPORT LUN command From patchwork Tue Nov 14 01:37:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 743962 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C92FEC4332F for ; Tue, 14 Nov 2023 01:40:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231949AbjKNBk2 (ORCPT ); Mon, 13 Nov 2023 20:40:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229580AbjKNBk1 (ORCPT ); Mon, 13 Nov 2023 20:40:27 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 573221B2 for ; Mon, 13 Nov 2023 17:40:21 -0800 (PST) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ADNsssK031062; Tue, 14 Nov 2023 01:38:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=H6UVph4AiV2Ade8PEo3oT4SMD+C3x1fFAwvQCLnnC1M=; b=f3afGoqDo4u0HzC9IWmHRDbp2mtseFdb34UevOcyWlYyfQlxGqERO8mHK0NSvhT+z+iW esPtWM+WkngSCROTj48eYjOsEdwMe2KpQpZYmIJ118rhwksnH0K+zUsLweTjiNBewSs9 fyW0Xupc2dNxV2UhWWxFd7W2C10eG3mdrPyw7jf/fS91GyqO/3VsMeVb9dObOt5+8woU K5cHqtJXD6KJm4isdu+Jx3X4UkZ3sKvXfDLUwdzCaDLp8Yc575S+fegHABMiGvYkDefC otHKe9B1kNlMK4cL9TYbdgdqF79u1cUi9STCRbCtuE/QB53SKJafeMZA1YYkYrttcQTJ jA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ua2stm4n1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:14 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AE0WPrr014858; Tue, 14 Nov 2023 01:38:14 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2041.outbound.protection.outlook.com [104.47.56.41]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3uaxpv9d96-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K3J9VkPMz6/RJ7bH92ISIn809Ak2pN6cy1w8r7qzYAO/Bh3t9KYCW7eDIN/GhZM1AsY6u5a0XUk0icjTOoRWY/ASVH8T7wY2HUr2Ed+uTOKJRnuXPoc8tRQ3s4VIrvG3bPsHOB3KT7H9DPu66MVAWv1TRYLXaLvRQZjnnGhTR0G/sY27ONoe7pJOIK1KeqA6ZIZikUfu1i9fQ470lOZ+UNszNqw/UlU5t1bs8RTOHCZJK3ON8ShEqs+8eszHDkH/i06teFj3Tzae0xkS9YGA/WgMdFbvpG3QhBZKwSZl77Ojik89NB9TpL2Rt43SHIZo0Xz4QeqBVlfJX+5jDa6FgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=H6UVph4AiV2Ade8PEo3oT4SMD+C3x1fFAwvQCLnnC1M=; b=kPRakTR53MB5UNwNA8EgSpnpkEzvCizD+0eFBIa59K/CxwrlhW79UomDyCccgGmSM9gZsLVol2lPYD20ZSPOttTwUQUtLkh2HlftwVBDwzRIiGPBPJXpM72dqxxu/SPUxcGYU0/fucdoGGesD6sFwUOUGhrYUby1PfF9jRpYyz9IrrFVtDSO7WlItKKc4fAi+dRH4mvsGabMXQnBv32FQ3nDo+2dG3XG1eje9/qlXGaPzKmuHdJv8qI3DW/QrzhDCyKGkD98oDemGjjr7M9sQEtki+gixbI1Y6PN8EL+JBCH9/FlnQncVaCJqVwuQpH/VP23wtyNQ/2quMZVoxg73g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=H6UVph4AiV2Ade8PEo3oT4SMD+C3x1fFAwvQCLnnC1M=; b=oUqRvLJb+YOrzRjyqEx9Z9qMbM0+niqQ5mSrjcW9xbDsFTrE/AvmR3OSYid/nAXI/9OUZmtDLMH7ZcIlAcZ4F/RMYZDpMDc9w9qYsoZXLQHS5PFOOs4eg1MC0NeaCQCbvO0YjbtNI7O4mm+y9VRVfbFpirj5yos1VFuCahaXI1o= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH2PR10MB4199.namprd10.prod.outlook.com (2603:10b6:610:7f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 01:38:12 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e%4]) with mapi id 15.20.6977.029; Tue, 14 Nov 2023 01:38:12 +0000 From: Mike Christie To: mwilck@suse.com, john.g.garry@oracle.com, bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v12 15/20] scsi: sd: Have pr commands retry UAs Date: Mon, 13 Nov 2023 19:37:45 -0600 Message-Id: <20231114013750.76609-16-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114013750.76609-1-michael.christie@oracle.com> References: <20231114013750.76609-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0164.namprd03.prod.outlook.com (2603:10b6:5:3b2::19) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH2PR10MB4199:EE_ X-MS-Office365-Filtering-Correlation-Id: ff64f14a-6211-4ace-198d-08dbe4b25d14 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UXEtX1og2VLkW/t4PZtxlbpL0PRpLFx6ZtulqTdhOULsQ/JRTsJsAc+L7a6l4SdEmt7CL5EceB9Sj+UHGv9tqrFBW8wHfixRAlyXHHZpfkZXdWPAMnUotgRePGTNwUQpjebkxwIg2qWpyNclcfRwHhckDIYnSatgZAU8Z6/rHRmkev35WXgSJtwer+ktHS71OYlt1b533AICIW7NGT6zAFCULzJdlKVnsbsxXXldrYj5eagEajbini3o/vv8nodiOYlymVIA+fXZtcUIieOpr5/rm2X7rYHAJjRlVbk9X+b6n43jMMWBhPlE6mIYT6e7FF2GlSuXdOl3QKPATkrjayzu5QvBj0IG17hKsscg6HzzY2TA2pXSPaTcR949l3Z7AEQccCAU6h7q/nCI/Pf6CuubxyPXtZZOK5wh9G/XOCZY4H39Xw/oKVfDaWGGWD80v4uEQ3g0FBpv8LUkBglKb3bqhiWNqoZhyW3hHsgSQNQ02g/8VgIFUupuJZwi5aHMU/QROX3DwKOFntV/Pw3P/YnXjLRhyVRn4YInzJz/5xO/4EC5B6ReR1rfj9ahRvjt X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(346002)(376002)(136003)(366004)(396003)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(83380400001)(107886003)(1076003)(2616005)(26005)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6666004)(8676002)(8936002)(4326008)(6486002)(478600001)(6506007)(66476007)(66946007)(66556008)(316002)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aRZrJSH84Bmh9idbayHF9lfdSszux06iZHYVcxAofHH4n0CuC9FB3MPBqcj9UFEwWOVpObLy0nlGGKrkUdNGm47iT9pKWF8rwbxHDbWGJUkVBB0Kl+Iec3Te+wpcwjAqSxnX3o86wEclqtiuGmISzDrm7TpfsJsAnogrE0rRLVj3NBLkpclkkf1DuD726lUXYXr5IVAcSyezJz/CEl5Ta0s5elpafnPpY+QI53Pg4Mqw2aEZ6X+0f3edczCRraxFGkOZM9D80HyyHutqbJhiIB2shbsRwJv3aybY9jheadjRlMFYI3ndl6+GGHyE/iQnWxvnttdOcsbtolHFU4pFGIeAZTcIFpEOGem+RM1lAaRBdA73swxF5yJFV1sW9D3oJpgZUkUkuSjUdZhsVoG02NzQyaOS5UHHnwMl/kEwA0trKTvYqO0m5yCB+kyQ/E9vzjpZPuX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8SL93WHImgJJ+40h4NAd4P7LPmOS210z5Hqvg+rNBrfa8vMup/sWYhvdgBdqGyNxasO5DJ5zs7mO0C9ZuQVVQiX0aQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: WrgXJ3ifAzIozIHsIFcEZ96JWvLlRXNCw2i31UmHZUir36uEQnUzFZz4/QisldDBxa+mJY8UjQWvfdE7VPY8srGNb7Sa1FfYG6gIRHGopzl1MIRJiDqyN1TqehaHFq9EW2q0lxVgRtCnXemKAmZGVIpZfJgImFEAzEDIJ6Z5vEUG7y+DbtYw4TLFirHuQtNIT/8keVEpSvmFjruS1XTenM5xXBV4xvUQ0U97baPakcHiqkF0uS/jm43RjSJi8DQiTedxNxcf/WR4QljHg5urB8x+2BquBtu3A0rquFOEEMtjHoIiz6i959T/rkbdpbOBqKnv6pG7oruERAePi/1keRikhDbZKBS3rHdp0VdXZk0xdFV1QvNSBiK6VMiyhv+4eRP489Lj3oTjpDS4a42+dTq+u0MORLFagiInnmfAAv2y6+l2LnpveWGOn90Jd+ucOXA9bzKIA+TaYxVJvKXDXu8fsgKcRztwbNx1g1yYuNH8eF0nxQOSRexad/zW0AbFMvHK1wxdPa5iDfmFXWoSMeU99EQI+sedAS1RncwICbt49Ib/1bjT3SVc8rbmB1TMFKtUy/tUhxoeSoVWbd3OHxZUQZQ/aLW8MUO3Pmk/t6nzicxmif41b2NTdolbtgzSqSkFhktHPnCtAmJNqMw26PsX0ZwAUOjnKUAI7ICGDH/BV/FDpAB+WmeyoiyFZLEoMKWwU6lIa6lR9jU/A8LQWVzrCK87aF9JENq2n0BegwBw64KJJo6e51FEFICqjC6beuKkbKuL+MbH55L8RWaR6jw3PM1Y0ILVdbr5G5N6BK0Kxab7TctFWvkrYAAUEMbWubSo4ZP1y9vV5Rwtoi/UMtjMHc8cO+Cc3YUw12G6tHJw2s2u43sEGiZ9IuKtLuFm X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ff64f14a-6211-4ace-198d-08dbe4b25d14 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 01:38:12.0853 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: a0UeVSrzCx2IG8UL49caMY6o2SvnH4pcZ1Z0N7gGM3kakuCnr9nz3b4g21gmYHArNSugM1WFGUkjO1D4pO009G1QxxDt8iqYRVXJoQxgexc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4199 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-14_01,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 adultscore=0 phishscore=0 mlxscore=0 bulkscore=0 spamscore=0 suspectscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311140010 X-Proofpoint-GUID: 7eXYNC7yhyeKCC4TeFyCKLqGNSuIFCXd X-Proofpoint-ORIG-GUID: 7eXYNC7yhyeKCC4TeFyCKLqGNSuIFCXd Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org It's common to get a UA when doing PR commands. It could be due to a target restarting, transport level relogin or other PR commands like a release causing it. The upper layers don't get the sense and in some cases have no idea if it's a SCSI device, so this has the sd layer retry. Signed-off-by: Mike Christie --- drivers/scsi/sd.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 0d73145430a4..87a8feabc2b4 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1800,8 +1800,22 @@ static int sd_pr_in_command(struct block_device *bdev, u8 sa, struct scsi_device *sdev = sdkp->device; struct scsi_sense_hdr sshdr; u8 cmd[10] = { PERSISTENT_RESERVE_IN, sa }; + struct scsi_failure failure_defs[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 5, + .result = SAM_STAT_CHECK_CONDITION, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = failure_defs, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = &failures, }; int result; @@ -1888,8 +1902,22 @@ static int sd_pr_out_command(struct block_device *bdev, u8 sa, u64 key, struct scsi_disk *sdkp = scsi_disk(bdev->bd_disk); struct scsi_device *sdev = sdkp->device; struct scsi_sense_hdr sshdr; + struct scsi_failure failure_defs[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 5, + .result = SAM_STAT_CHECK_CONDITION, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = failure_defs, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = &failures, }; int result; u8 cmd[16] = { 0, }; From patchwork Tue Nov 14 01:37:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 744602 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94C7CC4332F for ; Tue, 14 Nov 2023 01:39:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231489AbjKNBj1 (ORCPT ); Mon, 13 Nov 2023 20:39:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231629AbjKNBj0 (ORCPT ); Mon, 13 Nov 2023 20:39:26 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B14A6D43 for ; Mon, 13 Nov 2023 17:39:22 -0800 (PST) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ADNuuJN012937; Tue, 14 Nov 2023 01:38:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=9hbkVdGyIWiw3VouZvA7pxSitmgstT9FqnuTSmlNZOI=; b=vXDDizKXzuQfFI8hLQxUyFNjgVD0wEzPxCRoLKrcAIWMJvilyknvHaKy0auwzZ6LEaFi dRXdvG+wPx4hmEMhfz8ZyR8Qn51N84qqztB+qVz6IT7hZWAdxB2VKJDXMojx5ho6PXsN 2Szk9+0MI0Ckp8+k9VbmUGoKk26kyW8vOXuVwdP0Jy1gYcgydRk0GO7aeeGb4gB6YcVt N8BfK6uEBfXJj2cQphIdkk+NZZV1Wy5Gne3iMQUjJw3dg9GWiVi6gAm2M9PGjXJwVASm Rs6/1KV4gR8mr1s8+oUuXF6h91QjUA8GhlcXqY05yzb4PYNjRwxAO1EEsr7A0WYtZ1co fg== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ua2mdm7ad-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:16 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AE0L4th004566; Tue, 14 Nov 2023 01:38:15 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2040.outbound.protection.outlook.com [104.47.56.40]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ub5k2j1nk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cTFZ6zRbe/NE5B6h1C4SrRjWgX/sg+61UJMlLTSn1PoMa32xjaFGjiXjgstM7o/zgxiFmjctegKOCDl8OgrxrH+V8YmzGmZE4KG8GUZnhvcyHmsXiDs73L/2WY5HdZ8avG2iwkXWIVTXL5DUMcNj7axLwHYAH06/KC2lgMFvdAsptBPh/nyv9S7tPiR+dSwpVz0kbnSTK2TcImDq4F4uaCAUr8QigRkL7010fzZXPw2eTsewAyGcm7er2TSzCbo9dMwDuFo2nKi4jLiy3Y//8d0I0BeuYjwogEUibZysgUI6W6Kup0plZ0EVa7YsrhnCMc/K9bnosa2iFdiDp7qPtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9hbkVdGyIWiw3VouZvA7pxSitmgstT9FqnuTSmlNZOI=; b=GindxlFM4AbOx/Zk3UcP9S2gOvuthv3EOxeXCC4fdWeT+m6M11xnepY37gMqpOXDBjDMRN/boz4tIvseQmSQWHr+eup7yUbkAqhg0bGOgsQkhzI252jACTHPs/emOgM85ip9dXKNkbJSFlRB23wJihZrYmo4R0GWO4ezN6XqoS9KOyajvToSL4uOEhxq/3n4ilAjrLdWQK730xuNEWPgJguq87DODN2dfHxQKJsYbvuxeOey2vx33ZdyyyMPUgBozk0IIKE7+o3jm9fc58VQcDn49N2Ql8tyPSmYBC5Y2beRGJLXPSuMuqzEzgpicyzOwsksWOzzkHCftU8AaM5jRQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9hbkVdGyIWiw3VouZvA7pxSitmgstT9FqnuTSmlNZOI=; b=uTDJ8S26Y0piUat+DxJX+zQd0I0ZmBX0B27ABl/DkB10w7NWFxqw25bSY7ahBHhbCmYNeB6c5x46A/8wjxuSYfHNBPzX0qBSqOvn63zFfv2r9EyjcXnylit/rDw1vJXNm0xcglepRmSjS941C46mMmkQBEC9S9CluZ62p2cNZAU= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH2PR10MB4199.namprd10.prod.outlook.com (2603:10b6:610:7f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 01:38:13 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e%4]) with mapi id 15.20.6977.029; Tue, 14 Nov 2023 01:38:13 +0000 From: Mike Christie To: mwilck@suse.com, john.g.garry@oracle.com, bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v12 16/20] scsi: sd: Have scsi-ml retry read_capacity_10 errors Date: Mon, 13 Nov 2023 19:37:46 -0600 Message-Id: <20231114013750.76609-17-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114013750.76609-1-michael.christie@oracle.com> References: <20231114013750.76609-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR11CA0017.namprd11.prod.outlook.com (2603:10b6:5:190::30) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH2PR10MB4199:EE_ X-MS-Office365-Filtering-Correlation-Id: 79cec762-56a1-437c-b387-08dbe4b25dea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DCYlUSQ29NWA78F+DniPpn8YjKdGx+O26VWHt3oM7jBH4/GRyMJznGtwk4acFmvyeNZw24EiAOB/vZJPqUJIaQGD4JT3E0YqGJIz5cehKTMas8487/7FwBoofAETE+huP/LGQrNeA/GLqQrkRHiTUhDwzFnFmrCk5tEGz6949yYA7sfCdW7TlxhrikrFCym9WObaRg8CN+QXi5nDqdmQmj7wJ1tyOFN4C0exwo3FwkiutZpGY1CPugQyCBfUcduVRVOM7GuyMCkqizBRrGeOjU7XQJjsKCUzHk5vHtbdAJAPXDCLoPNeKJws/fpTjXCLHNopwXjkFHZ8d7BkICcxRlhBrZP5e9C5382zgxSz6Z8wNkzHfrMXizSYObHNUGvJg6rh7ui+ISz0BJdtJGH1QPMutIBvtBCh9tLFRG9MkdZnP8uwvXZaLt7ysTF/s/mzp+TAdy3+P/oQWfPFdofua1hN2s/XKTmJMFKyotUibUYSbShkfN5xNT1DhA/IAyl+mWFCKrF0Ag+HCs9t555CMkPwEFri4nVLMM4YEusCQFDSxtHEk7KyPv7lbg4VWmiy X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(346002)(376002)(136003)(366004)(396003)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(83380400001)(107886003)(1076003)(2616005)(26005)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6666004)(8676002)(8936002)(4326008)(6486002)(478600001)(6506007)(66476007)(66946007)(66556008)(316002)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qIV89+/XD462DCfPhHLVHklgXjAu164b1uXmB82/0eSGgfcvko6bg9NxRJ+oes2HzSwRLk590qV8NS+rLFUWTuzgr5OYKBmZmALpMP3xwWl6Dlo01U6rfD41blnEaP9dEiMvg2R1Cx1KXpGc6TQMelmOqNmIhqN3BqYSqTDPl4+Xq0DoAaai3Of/V5RzrQaXYgkJkLN7bOL4H4QCCtLPGZVZLcvqJP6kZptDZKXfhf8OP0qJeFDmiF3uxcgTA8jxOWD18S25PrzvNtOTf0jw1UmspjNPKSq8RSNmqoJMYXkZcIER1N4ecYszKvas7T4KXSHVTXy91y1hpvUs0IYRFDeZy2s+Ee9icXaqaYd+3emQMppIDiCCDau1sar5MjcAsLmmeyJmL24B8EkyXXHDtt+LoHEzDerFcgpqORsZFtPxcTCfT0qdHrtX7X3fZGPTVTVptVGUU5YY990oULrOC6w28WnlLrLRuc5wKPRveoERcEhEi0FMOlnFzJCIJPQdg1uiyJWAPfSj2kzSYcz66xpmW7pgmnF3HXs7SO0wpv6jVKJbzBY2QoaaznUzQvpXo1TbTDyBpgKO3bDNo1+/URafo2LkPtPfNF9Te9OodIZlyxQAwPMfYeHEkkJTygPTgDl90UTX8bB4iRWftJ2RCqceFB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dGLuijOAvr1h4B7zPyG9Ba1BJ/gJnVchPDGy91i/R+viOfj+W6VdOC4PZH42m4kDL+etTr7gd41cbNZ2WjIIy3KuC4IRplBGLA50bhmd6FG2X/Mkh947PHoL/g469AwTtzq+/MxMvi4vqTSg2l9Yzvp/3qyYjmdZRiGcPU0n/p85iEuVIuPcdOWZRpEYISPnSm7l7PpRoEDyzXDUphmMx1aC28m206+mXHVpA1920aqZGOc12bip4H/RPLCG10dzOCk5cu5ZfxUSDHusUt7VBrDKyZwQ/4N6qUDjWEurV2fBKyHjOTdXbaYObM4meA9/cOJV/JBq/EZyVpDPLzTd1uPfrdtxJlJuuvSm8Pr7sc7t5eM0QbhFfgjxxXitHgSvsZGdBwU3e/g8Qi5+U4Fvc7ohmpZqySPpXTBgVGcE4WxtvLoDCUmqDuKb4NpmsAv+0ddbL/eHYgWJRqa8RjUAgdRBVIcIC6HmBApcNGeRCbyu3pwSJlHHOUVP8TY9gdGHNg2ExK8yT5EnAoeMa4bSah/l8Lj4PGN1EecqUim7guobZP/HCmb9OY48vEe1ebx2VaYB6R9W9qIgkR662SXJOC+9FoEci7Cw8cSJD9PsA5WJmwe+XHJ+m8pKASZ84zCd1BKU9liOxNfvE1oOwUW213bIciRuN+1U6m2AkLY/iyQhub+OwRXPKefr2wnhykMNsUcwIitJ7rVU5x17t9h9tra0xNtS0I7MFSE/maeE6oltMRTIsV6/+Vti8UK61IJkf+s3LUq4fo1ViFRIsn8AzygVfdGOBqgRQa9ygpYGtXRSF+ldCuB0uurMHcw5xD5qO1ZmPlCYxB9Yiqbp X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 79cec762-56a1-437c-b387-08dbe4b25dea X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 01:38:13.5356 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JJi0T1jUI6Cj286UyylVPJB9q2GJ8LlZzJKXx/ACaseGMF17AkzvM6TzKN5RpJJ30tgPXuxxaU5+wV/wZnYQt68XD+F1pMh6fSpJyxjU8IA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4199 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-14_01,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311140010 X-Proofpoint-GUID: 7ryhl9RW9JeS_c1EcAgu1mfvjRTlsZmV X-Proofpoint-ORIG-GUID: 7ryhl9RW9JeS_c1EcAgu1mfvjRTlsZmV Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has read_capacity_10 have scsi-ml retry errors instead of driving them itself. There are 2 behavior changes with this patch: 1. There is one behavior change where we no longer retry when scsi_execute_cmd returns < 0, but we should be ok. We don't need to retry for failures like the queue being removed, and for the case where there are no tags/reqs since the block layer waits/retries for us. For possible memory allocation failures from blk_rq_map_kern we use GFP_NOIO, so retrying will probably not help. 2. For the specific UAs we checked for and retried, we would get READ_CAPACITY_RETRIES_ON_RESET retries plus whatever retries were left from the main loop's retries. Each UA now gets READ_CAPACITY_RETRIES_ON_RESET reties, and the other errors get up to 3 retries. This is most likely ok, because READ_CAPACITY_RETRIES_ON_RESET is already 10 and is not based on anything specific like a spec or device, so the extra 3 we got from the main loop was probably just an accident and is not going to help. Signed-off-by: Mike Christie --- drivers/scsi/sd.c | 62 +++++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 23 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 87a8feabc2b4..cd6a6b31433c 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2622,42 +2622,58 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp, unsigned char *buffer) { - unsigned char cmd[16]; + static const u8 cmd[10] = { READ_CAPACITY }; struct scsi_sense_hdr sshdr; + struct scsi_failure failure_defs[] = { + /* Do not retry Medium Not Present */ + { + .sense = UNIT_ATTENTION, + .asc = 0x3A, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = NOT_READY, + .asc = 0x3A, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Device reset might occur several times so retry a lot */ + { + .sense = UNIT_ATTENTION, + .asc = 0x29, + .allowed = READ_CAPACITY_RETRIES_ON_RESET, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Any other error not listed above retry 3 times */ + { + .result = SCMD_FAILURE_RESULT_ANY, + .allowed = 3, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = failure_defs, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = &failures, }; int sense_valid = 0; int the_result; - int retries = 3, reset_retries = READ_CAPACITY_RETRIES_ON_RESET; sector_t lba; unsigned sector_size; - do { - cmd[0] = READ_CAPACITY; - memset(&cmd[1], 0, 9); - memset(buffer, 0, 8); + memset(buffer, 0, 8); + + the_result = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, buffer, + 8, SD_TIMEOUT, sdkp->max_retries, + &exec_args); - the_result = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, buffer, - 8, SD_TIMEOUT, sdkp->max_retries, - &exec_args); + if (the_result > 0) { + sense_valid = scsi_sense_valid(&sshdr); if (media_not_present(sdkp, &sshdr)) return -ENODEV; - - if (the_result > 0) { - sense_valid = scsi_sense_valid(&sshdr); - if (sense_valid && - sshdr.sense_key == UNIT_ATTENTION && - sshdr.asc == 0x29 && sshdr.ascq == 0x00) - /* Device reset might occur several times, - * give it one more chance */ - if (--reset_retries > 0) - continue; - } - retries--; - - } while (the_result && retries); + } if (the_result) { sd_print_result(sdkp, "Read Capacity(10) failed", the_result); From patchwork Tue Nov 14 01:37:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 743961 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDC1FC4332F for ; Tue, 14 Nov 2023 01:40:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231976AbjKNBkb (ORCPT ); Mon, 13 Nov 2023 20:40:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229580AbjKNBk2 (ORCPT ); Mon, 13 Nov 2023 20:40:28 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1EB1115 for ; Mon, 13 Nov 2023 17:40:25 -0800 (PST) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ADNsnRZ001053; Tue, 14 Nov 2023 01:38:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=NWLT3G49/rrR9aRboYfHvH2bMlYuyLiAHg5BiTX9x2g=; b=X0mhzmbPC1aU3Lowzc989xysooTTyFnIvVyRhCrIZK/XMmq3MFIVEp/ntZcr7e7V3enX rsgfzNl9oYhzVPzs4p7akf3WJ/UeO4jGIK5gdaApRJl24PFmrmTp+hd7XIKRnsqpTyYW IRR+Uf2CzKyspAeXMvS+e2HSoUu/yyRYw9xXjpYtuxmI37cBIW7bhp71mfBDKrNt+eHB E2P4Dm8EcWKuk99yva4jbzp2dcffi+Yhylbq+CXx2PPjjx8JH3Ortay5JowDd31WlqsE 06t2pu/aVFq1xElBgrv7bv55qWd0cgh9LtrtsNpMa+e9PwqFYxulQOKqtwTBEW4PQeve ww== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ua2n3c3n3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:17 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AE1DjPY020441; Tue, 14 Nov 2023 01:38:16 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2040.outbound.protection.outlook.com [104.47.56.40]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3uaxh0h6q3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LZDbguS4LvWwHa9WXSqeN7OU46OUrMXmCGjkhHQEWzGo4IzJ0czHgAidxQKiQORXvX89YGo4D5wsUr87bsnpBqbn1sUDaDx/94EUveZHGhjDpSCMfi9vw8aTAeTDidxsDbR9bx4naLjgkpH6iOyjSEtuJjucawG0NyI8V2pkAISW1aOVNnnFFQqdWPUeOnAFbIk/lbCI4fHEyM80vUaP/FuwcC7PGWxgh89M6KZGJHV1KFEnAEwbUBv5zZw0VEcx7QuwnJ1tOgGpwTbN4jMg96Ku83wTHw4PNQ35JO5KFglSAD0isJQGKzlNbSSimcx69RC3snCA1fRy9sRnYixJTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NWLT3G49/rrR9aRboYfHvH2bMlYuyLiAHg5BiTX9x2g=; b=WJ1Tk4810hPeYC1M9XgmUeEj9N0ElkK6HI0UWBWwFtOF4tXEN/fiUB6i6BDWq41CVWw1p7A74KSuKJ2lP6dJXVCuCkakFSLTEtaDbBjD5g8sxG70Ch6Hpa+Dm4RwutH6FHHlAF+MTTLfRc1s7E/uNLXQVves/CK2owGuuob2FF/rqSVrXQ1b3mzdmuEaXyvIN65SQspTcCGIpbOfoz5m/y1kYsajjUFJGJCHX73S1E4xb5wRoQPBhreNa6V2QEHuO1p6UBoeYOWNxkKnEaTG2KMt2wI1Z1j0R6UmrWItJS7eWvrGU4DX7+XmAFZb/t6pVxYBXBjMqOiMxwT54xB5OQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NWLT3G49/rrR9aRboYfHvH2bMlYuyLiAHg5BiTX9x2g=; b=XyUI+sAClHMgfzNM7Be9UlCQbbbt+5Bbe9ylQPjQMfpbK1PYFg4qPb/y1zHQvVjZdDL0yZidq8e6KkiEyxOCSQNbCgyYsN5XZaRlXliyhPZIH0QfzKjtJ0kvh+k/3cv5+vJVMC1zmdcLzAKqM3S3YBMi9ffg943t7/KDdBw7TVc= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH2PR10MB4199.namprd10.prod.outlook.com (2603:10b6:610:7f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 01:38:15 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e%4]) with mapi id 15.20.6977.029; Tue, 14 Nov 2023 01:38:14 +0000 From: Mike Christie To: mwilck@suse.com, john.g.garry@oracle.com, bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v12 17/20] scsi: ses: Have scsi-ml retry scsi_execute_cmd errors Date: Mon, 13 Nov 2023 19:37:47 -0600 Message-Id: <20231114013750.76609-18-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114013750.76609-1-michael.christie@oracle.com> References: <20231114013750.76609-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0235.namprd03.prod.outlook.com (2603:10b6:5:3ba::30) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH2PR10MB4199:EE_ X-MS-Office365-Filtering-Correlation-Id: 98985c7d-5c4d-40f2-74f0-08dbe4b25ec8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OoAPhIAT7HyCUoKtGXQ1N2Z+YEp09qp8IJSE6SikVo6WRCcoKGHWNaSvHixis0SbYrgd5owjvMtI7RtTqLpgHsfR4IeKykUN2SUDYyc9zuXncQB/7oyhNTl/TbBHZXuWsUFh0AE35/X0OUVyCoCgiIApHNvqjjIzU6+SIlkpAWCie7+doCJAMo1tOQUZ3qKD4bHtHceeLxkVfOg3dgGe/Z0rlaRIDH8kUgkCPFG0PHPMkMj0ajCIlKnpki10awwOCwfZ6KkFAEFqDt+r8yqgIkJB5Dd0liiPu5uS8kcukzjdm1GP51/2vs9zAGVVSmeOSMnuLBSACtrUQ6KH9fEY554cFIDYQVPBEsT+aIIzbDv9qPYI5MJ/3mapcmKNCyyWuepJh9BLYNbE8o9e36GH1TnrFB3rWmejqU5L1qXIXwFZC0WaBJtBDmt0Vjdo0OzcZWjDTp3Gzm3Eh2P2b0h3u0Xoh+3EMT0Y26nut+BhXboUQYH4RMyG3nt9cRlzEcIM+OLNIEA0JeTi+MMhDPB5WLs4Ffbd4ZwKHAs3nyd5ILDwLmBuHB2kCVJKiiLZXqGT X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(346002)(376002)(136003)(366004)(396003)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(83380400001)(107886003)(1076003)(2616005)(26005)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6666004)(8676002)(8936002)(4326008)(6486002)(478600001)(6506007)(66476007)(66946007)(66556008)(316002)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ko+XrSs6P+h5SKQc2KlUbvQHZ1lalq11Or6vclKeIgd55PIKsA/O5M3NgZ4G1k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QEA/vlAeR74Q/uJcKrqstSoKE/GJI4PHzrKOpiVSKARMx+lDsEz1Rg+5qn1DUn4HX8W4umtrH6H9M6V4c2TeG7EuCzW3exXIY9Vvpl3KPpoAF201t5EkF5V0f5wWPMVWrJ1bxGehcbX0vQPtqvtM56TkBL+6xPvdqSWckl8oAPL8JBjySLJLIjRRqtUVQ/gJioJzezx5oGGLbeXXSXNhtCCF6CCNNw7A9BAnK/C5LsYtesePIv8iZVvtBrilkv3ccggJZHgPQQr7qAzWoqwZY6bxk0Bb6cg5rtKIXqtO9z7BHmxUcTcLQpaYRbCwmUJy/gn54f9DNUatgBwnRfF8EpnX5dyIhU9sMrIl79L5wfqxmuKLVDaWjlum X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 98985c7d-5c4d-40f2-74f0-08dbe4b25ec8 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 01:38:14.9534 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kFK8/ulpcUbiDZGuwGz539SIoUQqgjv2kXyh3I51RR2L8pQXmQN0yA3z2cR15dv58g5Qw092Vb1VVHPXDPw3ffxmnmkAAPhui/T7fNhg5yY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4199 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-14_01,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311140010 X-Proofpoint-GUID: YR3sLbU3oTpuRUvTEhGV98xyo7EkahgU X-Proofpoint-ORIG-GUID: YR3sLbU3oTpuRUvTEhGV98xyo7EkahgU Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has ses have scsi-ml retry scsi_execute_cmd errors instead of driving them itself. Signed-off-by: Mike Christie --- drivers/scsi/ses.c | 66 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index d7d0c35c58b8..0f2c87cc95e6 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -87,19 +87,32 @@ static int ses_recv_diag(struct scsi_device *sdev, int page_code, 0 }; unsigned char recv_page_code; - unsigned int retries = SES_RETRIES; - struct scsi_sense_hdr sshdr; + struct scsi_failure failure_defs[] = { + { + .sense = UNIT_ATTENTION, + .asc = 0x29, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = SES_RETRIES, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = NOT_READY, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = SES_RETRIES, + .result = SAM_STAT_CHECK_CONDITION, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = failure_defs, + }; const struct scsi_exec_args exec_args = { - .sshdr = &sshdr, + .failures = &failures, }; - do { - ret = scsi_execute_cmd(sdev, cmd, REQ_OP_DRV_IN, buf, bufflen, - SES_TIMEOUT, 1, &exec_args); - } while (ret > 0 && --retries && scsi_sense_valid(&sshdr) && - (sshdr.sense_key == NOT_READY || - (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29))); - + ret = scsi_execute_cmd(sdev, cmd, REQ_OP_DRV_IN, buf, bufflen, + SES_TIMEOUT, 1, &exec_args); if (unlikely(ret)) return ret; @@ -131,19 +144,32 @@ static int ses_send_diag(struct scsi_device *sdev, int page_code, bufflen & 0xff, 0 }; - struct scsi_sense_hdr sshdr; - unsigned int retries = SES_RETRIES; + struct scsi_failure failure_defs[] = { + { + .sense = UNIT_ATTENTION, + .asc = 0x29, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = SES_RETRIES, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = NOT_READY, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = SES_RETRIES, + .result = SAM_STAT_CHECK_CONDITION, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = failure_defs, + }; const struct scsi_exec_args exec_args = { - .sshdr = &sshdr, + .failures = &failures, }; - do { - result = scsi_execute_cmd(sdev, cmd, REQ_OP_DRV_OUT, buf, - bufflen, SES_TIMEOUT, 1, &exec_args); - } while (result > 0 && --retries && scsi_sense_valid(&sshdr) && - (sshdr.sense_key == NOT_READY || - (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29))); - + result = scsi_execute_cmd(sdev, cmd, REQ_OP_DRV_OUT, buf, bufflen, + SES_TIMEOUT, 1, &exec_args); if (result) sdev_printk(KERN_ERR, sdev, "SEND DIAGNOSTIC result: %8x\n", result); From patchwork Tue Nov 14 01:37:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 744598 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72294C4332F for ; Tue, 14 Nov 2023 01:46:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232005AbjKNBkj (ORCPT ); Mon, 13 Nov 2023 20:40:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231956AbjKNBk3 (ORCPT ); Mon, 13 Nov 2023 20:40:29 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E16231AB for ; Mon, 13 Nov 2023 17:40:25 -0800 (PST) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ADNseAc016967; Tue, 14 Nov 2023 01:38:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=i5vXS1djHmBsng2QRrTpw3owfNQ1wdfmYnh5ZA9b1yk=; b=sw4/I42hyP8GuKCNhgDMZViUIXsEIHVquaKeolBuX9zeGbr52UbBlGeylTmlLnoO0cow 5gyxRwrtmu8dx+9vJq+h4+1+Nazvmn21vXN/meNZ7ODcarFKhjTuUvUtvyDtrZMwHnWu F+VvmRVn/F5cT8owU7jlOHRxhfgnZCBt5PYw+f0u2i4dCjZXZqTyt8Ox24M3JthPfqmb FfxUv5gdAj4X8H+THmlSjtb+g6HZBTyTwSxaSgf3qGBsEZo7B+O1laaSBY/UFWVqYuCf gDMniLZKuE3UNsvK/w11xFJn9vtbtQq7gUwVm0fMN0nOSbDUTktfDM4rtGkjvlNRBl02 tw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ua2m2c4gm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:19 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AE0MswD004499; Tue, 14 Nov 2023 01:38:18 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2040.outbound.protection.outlook.com [104.47.56.40]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ub5k2j1pt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d6Q2RKYbf3L9K6/d3ptfaSSNeFG8Jpu2VgkdJZfIDM2L9ZLgNr1e2JAvDta6mzgUsGXfwbLSTc0ePDZZmJantOwg5OZZMZbZSfB5t8JiZdp/VMKyWcn5UKskYYnS26qI7TmkvLNcRCZK6LHGMq7cBoIWRCG+H2hh6uru5nQVlQMWWdmKFAoWmp/16B9bgs/ZUd5Xua5irO+bl8NbFWPQxFIM79cOtSvzAVpbN04hjJFClNm8+lRcH+tR0fCRe/lWQXnWrhX3bnF94tmoJBD8lzM4cztFNufPcGzGIBD5bgTOhbiv+yaDHj+thI6xsmRqQNC+X2mS1ChGhb6qScle0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=i5vXS1djHmBsng2QRrTpw3owfNQ1wdfmYnh5ZA9b1yk=; b=UbO0NZE6a2t4PnuzUB13n2usITG58Q5f8Jdf6zOdaZaDwfHUfv9YBYwhgUADGXo/TgSGOUAGhp/O4Aa02wYX5aRN6IxEAkzFlRFFV897ziDQAGg5NTBxw/Cfs10L4qKuQpegh0HoJFXbiaV8wrgAkJCiSu+WUjwDQZ69Y1jAfVOUvGhgHCNv+rXVyFx0+4CH3nV2/IIzgCVKC7ryc8FWMvIRRn3DD0263bX5mdjlSz4WlPq8Z0hMFEy/X5fVU9yGvZtEDthInycKgqBqtSBE14JosusB+a2VQfseetEhnqGpfKxs5g+WkhjwPpohqxc+sAJcmvzTcMCGigk609b5og== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i5vXS1djHmBsng2QRrTpw3owfNQ1wdfmYnh5ZA9b1yk=; b=Qtdm5h5IxnicCPB0RNMCHiaaSm++ZvQW2yY+D3FM+LZscFBYKFcYbyLjinAJjWtrreHtugIOPIAhoDC7QdMOdF/jpdNa9dtWCmO3ho2qg1QcUvrzM240jUNRl2M/BIkTh1e+rIrPpg0rsCrpdDn1bK4O0c1IkdBKmDgT3Jika1Q= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH2PR10MB4199.namprd10.prod.outlook.com (2603:10b6:610:7f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 01:38:16 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e%4]) with mapi id 15.20.6977.029; Tue, 14 Nov 2023 01:38:16 +0000 From: Mike Christie To: mwilck@suse.com, john.g.garry@oracle.com, bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v12 18/20] scsi: sr: Have scsi-ml retry get_sectorsize errors Date: Mon, 13 Nov 2023 19:37:48 -0600 Message-Id: <20231114013750.76609-19-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114013750.76609-1-michael.christie@oracle.com> References: <20231114013750.76609-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0042.namprd02.prod.outlook.com (2603:10b6:5:177::19) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH2PR10MB4199:EE_ X-MS-Office365-Filtering-Correlation-Id: 52693522-e4af-4a39-5e00-08dbe4b25f8e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yKBu2pbyd9GWv94C6/9Ih8VK6biNVjI55KPwtkEByvZtwiZ2Qa5jlIMtN1aeqbCkjWx+1AtiCp3MjwCir+W5VMTzF5yqSdKH1Zp7a3x/NrrmU1A3mwSZQspNtqyTbibcQx+a8CTuOMzRp++1mkNXL8BpvfMpeSmRWxJahSg36hgFPNGEfe6xg7xMOmsFhsJ9/uE1qppku+jQGL8WMZi7DlV18PMujLatetsyJangMsmwCukFStUixTekBBafaglstUGOZqHZk17o/soNWlMaABiH5BgZApRvd4Vuf/Y5DcTOsH+p22APY2HuU54qD2iwvNHbM7GZ+wd6eSRScFUoCVxCrICT8/pi2rpsC83p6Fd6OXqS+48Sh/2hbCMukoXJeg1kNzJPt3+itczAJBL8tPrh4uklE9AJd7mS4fvaKSQkE2EK3IvqJmEaVZV1ZRa73em0/YWt0O7il6DXnD7fJQd7UPakMJI42dM6X6CgHS81F7/Y5+i+8NRvB/DiLuvvpIvIQOBj8kcPpNw2LNauTXYSlPI/JHqGeD671idr8bcJ2c+nRDbdk/yCg2quzyvf X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(346002)(376002)(136003)(366004)(396003)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(83380400001)(107886003)(1076003)(2616005)(26005)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6666004)(8676002)(8936002)(4326008)(6486002)(478600001)(6506007)(66476007)(66946007)(66556008)(316002)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Q8axpojM+HjFFNrgjv1s3BCgFJcmPFjQaoIpsRkQ6VZq3mh8tcyMGK60ObHdUQ+q9Q/w/tC0JVhwbiXtCXEvXn1/60p0fWKDHXvuRUvtqGIEc19hP+Hf1/Lqzf/DbNDFb2pkXSIXcxY11TNsU0ou6paKxJZqkYF9q5TI/CJaYaHFH+YDgMUJHjRMiisilh52LvRJCBPQ6czGGqY+ZSzI6TbJMiJY8F7EUhDoz6jTudEIKLi8zQfs/xE4ToaIp6x/THnYAbW85vGa9Q0Y/KEGohow1n7zu5vaRkMFVQ9b0EVKKvURDsc6SA4NnHZfFsO05tf2J6d8VE8jIJzLSE0NwsT98l0lSLBSrLU9Y8Ca5iLTcKRXpvbcOoNJb7jtqkbzmavRkSxI8SadxgnbGw94/hM+BqgPE3JDvp5yF3OBKEyYb4wPUiHArNXHnkYyiTUzAEtA+UKjujqu7K4w/JDF41bF0G3jbtFgGjcF1r9+jZ2l9xBQRs9YlvzsRO5vZGETQLdv2s38K+X1HYThPbmOTIvZCBxyUJBHZMkjEk5ZdRuWjzqT13WQ2tBA7qOJx6qoI3ifeVRf6LN97tlCQIGGG5WS0YXtlHcRhnb+Rk2haI9Hsfw2yJqOfV6W3Ue8bYqRREs1pFLl++jatVa8ewJXkVNp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zO6Uva813XBhKLqMeSNCFbPLvovwODYvFLqRaOCVMqCP4JCJopz/3q4dqYVxMlzUmbtzWYjZF+yDWbwXzeCn8nyoh1MuJMxDX6tfD5E1BvOwSdfoMx/xWEv5iWS3LbgDzTeg+6K8fXyj9PQVNqU9PUUHnEgYf6fdx9cBwqn+lTxADXqiyvNpEZDERE6WIr3XT5EkGOOnDVdREnoYWQgFQzl1X327u83qQ1GlreBwoWoozApud1Asma/T8MR+kyJ8jMo1a946FHT+V7poQ3gNsjkx5eUHEblHHK7w0IyKiqjEC4qAZZC47U+/pgYGEMW5XNL21l9vH34URd9Pv6jW7W2TdmejajHfp4ZZn0iXk/E1vNq4kK68y33EP2pPZ+RbOqV7T962/4ShAPahgBZg4dPdXwZg20NmdXxYX6N0p5S2dPzYQJNB0leBFeA/6B/8mMzrgU58yNKmIsHV++OrWcO9ZuMpgt9215VK0cI1xT9KCjEv1Bgnra2ITpL6Bu4VDqG9097LEcEwAXX/97uTBS5V4L920Z6E1VX3mOkidrjsk7Da+ax682B8qCU/NqTzbrYl7gBChDnGPZI9qBxIY8W9FF3Ua5Z2onX/JA8NJS+9eTb4006yIlxkNc4LUruJNyvVbfJ9dcCLc1fPsuIAZ0Wd9Z2EZ/roHmIMy+se7B+wHIb+Jb5A568dZUNCUl/zp0lr1cxFHc5OGRYDe2+DqK7evYskymDX77NNsQjSYfnbdnYyn8bC2DXe7lAzPzlBoItvtBqY83+jpvwQCxYckUIHGD1ZvoZCGX62CVRwbU15x7Hh7uin/TDMQ/WFqKvg1WieIXsjYHVJl7Dt+ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52693522-e4af-4a39-5e00-08dbe4b25f8e X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 01:38:16.2806 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: D2brNQsjyA0BZ6R5QqnkjbfpsyFey4nkM8ejGzgJORcZlrHJxy55KQO3rDb8AFyfu0OfFJ6Lx1vJ8s5fHaCiZFdpqbV+M8iDRy9d4yeUb2Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4199 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-14_01,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311140010 X-Proofpoint-GUID: a-2ZJOv6KkjV7MHucatHkFMIx2FVVlhl X-Proofpoint-ORIG-GUID: a-2ZJOv6KkjV7MHucatHkFMIx2FVVlhl Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has get_sectorsize have scsi-ml retry errors instead of driving them itself. There is one behavior change where we no longer retry when scsi_execute_cmd returns < 0, but we should be ok. We don't need to retry for failures like the queue being removed, and for the case where there are no tags/reqs the block layer waits/retries for us. For possible memory allocation failures from blk_rq_map_kern we use GFP_NOIO, so retrying will probably not help. Signed-off-by: Mike Christie --- drivers/scsi/sr.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index d093dd187b2f..268b3a40891e 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -717,27 +717,29 @@ static int sr_probe(struct device *dev) static void get_sectorsize(struct scsi_cd *cd) { - unsigned char cmd[10]; - unsigned char buffer[8]; - int the_result, retries = 3; + static const u8 cmd[10] = { READ_CAPACITY }; + unsigned char buffer[8] = { }; + int the_result; int sector_size; struct request_queue *queue; + struct scsi_failure failure_defs[] = { + { + .result = SCMD_FAILURE_RESULT_ANY, + .allowed = 3, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = failure_defs, + }; + const struct scsi_exec_args exec_args = { + .failures = &failures, + }; - do { - cmd[0] = READ_CAPACITY; - memset((void *) &cmd[1], 0, 9); - memset(buffer, 0, sizeof(buffer)); - - /* Do the command and wait.. */ - the_result = scsi_execute_cmd(cd->device, cmd, REQ_OP_DRV_IN, - buffer, sizeof(buffer), - SR_TIMEOUT, MAX_RETRIES, NULL); - - retries--; - - } while (the_result && retries); - - + /* Do the command and wait.. */ + the_result = scsi_execute_cmd(cd->device, cmd, REQ_OP_DRV_IN, buffer, + sizeof(buffer), SR_TIMEOUT, MAX_RETRIES, + &exec_args); if (the_result) { cd->capacity = 0x1fffff; sector_size = 2048; /* A guess, just in case */ From patchwork Tue Nov 14 01:37:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 744601 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0027C4167D for ; Tue, 14 Nov 2023 01:39:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231924AbjKNBje (ORCPT ); Mon, 13 Nov 2023 20:39:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231956AbjKNBjc (ORCPT ); Mon, 13 Nov 2023 20:39:32 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6821A115 for ; Mon, 13 Nov 2023 17:39:28 -0800 (PST) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ADNs4B9030165; Tue, 14 Nov 2023 01:38:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=/qx7ax6f+kv89eOoXm80os6ygj+SY5O8m3IccZxZfLY=; b=HIGDylw1STv1mrY8bmuW8SqtnRTUW7TPC0LklEykYORg0TPKiK5ox+jh4jIlWZ/ggDid OvdoPOwnNPdrxuxZ7C6N24bbYiRJ46Kuv2WvMpasCY961bf9n8ciP/SuKrdcgtcZro/u AOlGUiP8qq7rzjUA0bDaJGI91TRhHV5X9kbPEaW3taCa2p9J2ZYxQrEid48OaUhppEIw k2ntoXNgT1l1+o6KVOchm0DKAQ+eZIjgaVv7Vi8+/+FCBFrBuZyhg3HQxnHzdQugfzBc g2f3FFBZuBF3VqRRJJfBhP2QSYugoVGS4iTUQbBtdv62Hf5aB+dHlcLoHewtS39GTzo1 2A== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ua2n9v56x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:20 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AE1EXbt013562; Tue, 14 Nov 2023 01:38:19 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2041.outbound.protection.outlook.com [104.47.56.41]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3uaxj193wp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q7zxDjWGEryS80Ab3EI85BRgRJu7BwdU7yNqzJLhRcd8CdiYpqtNCa74xmPg3nRfQBY0SUd0TiUM5PG+VvjaT6Fy9fJRRodqfs7VreBoMVd98KE9Y/uKAGQrXIxxKa0UDu8/NcHu+C8TxSOh1iZ28sAAJ99+R5+LGGie7bVPm7Y1F8bVb/tyioyrZPnBpbUD40wUfioeQCDMlaeBtBW5Vhh4T4JQ03Z00v/F05Ehg7xhl1QsBCLZS2+wKNuFJ89B3xLjlEeXYLdHCYP5lmncPhFlamZkZCdFgUS+nROPDvMERkF6UetlfCAda7R/wjv1w6z1Hkyq2gcRVP6DVkBC7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/qx7ax6f+kv89eOoXm80os6ygj+SY5O8m3IccZxZfLY=; b=cUDpoecjyUha37hYTCcDQm8nwPNwW10wBLux1+Xjc7qoPb0rqqfaeAPYlngfBrBBkQAF9isZmiNWRuMVN4OWhcXIMDzqzkk9fk2x2lhUKjUt5R8RSL040Bbllh6eB5Z3mZu46+hw2u/ErCW+nWzu3dRgYDcZM09ux3pc4ePUf9DJs9OMi+f14dvkxCK/QD15ZOXdQUfR2JHRPIm/o0qxVo+AB44Vl1qMp6OvRcSgyExXNmsUAjUyIbC/DUYEGQk0JPqnHvK4PGHoFKS9lUHNeCfbv4AJ13pkzd5ewgTaz05gfL4JxlQGsBCBAY4rny/ab4nk+8MSrUOF8wpjusr9uw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/qx7ax6f+kv89eOoXm80os6ygj+SY5O8m3IccZxZfLY=; b=qOkF1+REZJ873ACg8WVygcjzlhwEoPVxjtDLxkSUgTrlWCYv3gmxJo878Hy6wDeyeaY++b3L4O/ujfr7YZGkmD5yAsUQnoeoQ1rmp3hyWyB+y5MbHllztq7DWH2CLWRyWXJSHe0qyFD1idc5Tt554ztWLP6miPJdhDV/viNJl5k= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH2PR10MB4199.namprd10.prod.outlook.com (2603:10b6:610:7f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 01:38:17 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e%4]) with mapi id 15.20.6977.029; Tue, 14 Nov 2023 01:38:17 +0000 From: Mike Christie To: mwilck@suse.com, john.g.garry@oracle.com, bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v12 19/20] scsi: ufs: Have scsi-ml retry start stop errors Date: Mon, 13 Nov 2023 19:37:49 -0600 Message-Id: <20231114013750.76609-20-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114013750.76609-1-michael.christie@oracle.com> References: <20231114013750.76609-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0039.namprd02.prod.outlook.com (2603:10b6:5:177::16) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH2PR10MB4199:EE_ X-MS-Office365-Filtering-Correlation-Id: 02b1df69-32c3-428a-46f7-08dbe4b26054 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5xEXainli6TYB4gt6cKDX7i+iCO/lHHic4n7ekIHBe7t3SonDdmgdfHc/X7j0UPu7Uift90HvwFfAAoopOM4cDnD385zMhpTqDsWsk3QuhKg2luWNYkP2QAHynEEIp+41Wr/qf58Tj/1w+z6N+XcYT1Btly1HMiTiB1E+bOooTDjHRjwG5oWYprn0g7GKuVDfuqjwUyA6rMtIE5GQEcDlrBKjhA1F+UThMgXEfla2wBHFraquFT8AWhbuD6QS0NSResNwqT1wJbTgTHItaCk46zfieAATh9enb1pEYua4HcOIyTGXIcuGIFpoAXJ63OeS4hf99JOUO7A7V4NjO+ytbQG/iA8qq3jSlFgYoHMZaeHf9izQQb0tvbLaWG8wdsk/+UStza+DynXoLRheqTTIxrwZOiThKuUAgG9XeFgSN6ue2JWt9gUY3Pm0qCXFyQeLVZGQI7SvWTwK7sofbmoLFKJlygeHAIcgOo5QQG1WRPoQEuCYPz1mudwSRJ8ckk2YH0Bbh0zhXmueVpdp08815nHV0Fjy/Zfoha3XctYnYopEEjanUZbDcS+dsPo6yMCZrpYdLoubZWTzhi/uaTcQvyCZyJ7HX+AoaZ+WPqC0i5XZ8DTfEvRR0brhPtxfD1k X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(346002)(376002)(136003)(366004)(396003)(230273577357003)(230922051799003)(230173577357003)(451199024)(64100799003)(1800799009)(186009)(83380400001)(107886003)(1076003)(2616005)(26005)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6666004)(8676002)(8936002)(4326008)(6486002)(478600001)(6506007)(66476007)(66946007)(66556008)(316002)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6SIJr7jwAwt7dJVwnWpuMYMSbh8U/VYlhtiOboM6s86MY7P3rswexXtgwCWuMAFF0ZrZxsUB4hxRYQmz4LwzFIthU9eUaNPReuhzlmpRQc+jPSZwJnbYinIs84/+fR3eDFBc9ow9ZYTb0/U9eOYhVREqzVqy/fhr+Z7O/Ueqq43j0kP79Ka+lLGuyaDwfOWFlqsEy6WAG/dRVUX6vS+StYCdGfH6OYYJyLp1p91zRTsCNB1PVm++4kF4BIUKPAEoaOm4M5GqIoVH5BKP2lzmoUoc77b+Dwmiu48QzJCT223j3xzhZOncS2rx+dRILMwXAIBsbh8s2apubczVfGzj0JR+dXuR68SA+SbeJDSlkqtmkPLnuGkl/JxD2cF52ofn/uX5oHqVL1v2nRgiT64A09mT5jt7TU3nPZ77O1M36NnwUpjZ9bw7aFapWxN3SAkfIS73oeQavYupWzkU0G1CmsZQmVcvVJzh5haaIVLht4YRWUdPWq6U6QypH33px5Sv/oAgLSBYYtAA8vZXnEhphym2WYMD7bvsdJoDpbG7a6foPZzB+fHg4O6qBq/2oR02zKNzWPhd5J5D6XMIK7PDBpPqtwc65z01hKl1u77GiEg8hUrNIW1Ndlxo+64KzBN54NqtLRsf7x45dwF+632OMYAsBNi+J1y36Goo/77vvmUidLAFpLf7KUCQ82gF5UJIyDova4F3gmuQ52yu1WRqLXPGmeGEV+stFJN2aTQFwkUnSvv2LLm2wvzAT6C+TSYtfJRZnt2W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raju6LNNmwLqQGJAj07YVTN64sH5fRyxo0d+YNVFvaYH8aMJqz4+PPGH+0zhykLj56O4x75PkKYsIQoBNtsG9LRGj+h7G5zU5BeyeOxzYsGKhEoJZWsvyZcJ8kU5VXVI9Jw/ew4qqXQqc1WRyn8lMYAFQRAD84GoCCuaoh6pBEivkdbcVRcbpI9FYuCykh243Sb8gdZpLpxoAyyiXcPKijbgQQJ4xsdYpIu+A4ouRv7+3Y/UOn2SS5ljAWR3IAXTQUPBpFeLJRYVe21l/QNHYBnrBrwO6A1S+9KLIA9UJv8P639+6HsUGuMQ/JGZNKFfe/VceWVdy5TJBo1PmxR3R3sWCIchoDSRkISUj3ufgNG+tfDB1gnIwdh4DqAF6M+zsIXbiy5nHB4FzD1NvRGverg9ia/p5/hkEPjjzWwbP0bMJbLVUrD3rjC0E6T/CptPEE1rTQmCxj7cogzNNRPRjDEaulMFE6nCunf0TLr4vZBLp4xgXaA49r+Rk7iRd9BEOkypqtaJf3G5AGItU6DvoPhxla5eJSdTPgCo0UFfMYqzZyrhjYiK8Hh7NlVHxWEhA7SUEpiR6H1N1AccIc2CbLh+EtfrGrRkkQhPYVVQBSqwJ16XDK9SrYH4bZucSqgPAu3kOwHBGa+8Bf1HHVIeZ/FvT9Btc67SMMOZR28o5emcMyjkLcWtrvZZGGz0Hq7tdv4dPTQdecJuPQfmgq5G+tIF8Wb302jMmJAyeUeZ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 02b1df69-32c3-428a-46f7-08dbe4b26054 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 01:38:17.5484 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2YgiG09B5P1oXgpHdV3kvUWHNroeOwhIS+2jCQ5cpdijfMqN5u9DcHoF6mrd8m0vCqJoSAsNi9lqLQVt+tLPfd3Qi537fy5GuRi+Sp+TOPo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4199 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-14_01,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 phishscore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311140010 X-Proofpoint-GUID: -dbH5dAzjUbmmfElRU2LYz0N7A2GOpUs X-Proofpoint-ORIG-GUID: -dbH5dAzjUbmmfElRU2LYz0N7A2GOpUs Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie --- drivers/ufs/core/ufshcd.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 8b1031fb0a44..001b27ef2bdb 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -9384,7 +9384,17 @@ static int ufshcd_execute_start_stop(struct scsi_device *sdev, struct scsi_sense_hdr *sshdr) { const unsigned char cdb[6] = { START_STOP, 0, 0, 0, pwr_mode << 4, 0 }; + struct scsi_failure failure_defs[] = { + { + .allowed = 2, + .result = SCMD_FAILURE_RESULT_ANY, + }, + }; + struct scsi_failures failures = { + .failure_definitions = failure_defs, + }; const struct scsi_exec_args args = { + .failures = &failures, .sshdr = sshdr, .req_flags = BLK_MQ_REQ_PM, .scmd_flags = SCMD_FAIL_IF_RECOVERING, @@ -9410,7 +9420,7 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, struct scsi_sense_hdr sshdr; struct scsi_device *sdp; unsigned long flags; - int ret, retries; + int ret; spin_lock_irqsave(hba->host->host_lock, flags); sdp = hba->ufs_device_wlun; @@ -9436,15 +9446,7 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, * callbacks hence set the RQF_PM flag so that it doesn't resume the * already suspended childs. */ - for (retries = 3; retries > 0; --retries) { - ret = ufshcd_execute_start_stop(sdp, pwr_mode, &sshdr); - /* - * scsi_execute() only returns a negative value if the request - * queue is dying. - */ - if (ret <= 0) - break; - } + ret = ufshcd_execute_start_stop(sdp, pwr_mode, &sshdr); if (ret) { sdev_printk(KERN_WARNING, sdp, "START_STOP failed for power mode: %d, result %x\n", From patchwork Tue Nov 14 01:37:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 743963 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C989EC4167B for ; Tue, 14 Nov 2023 01:39:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231948AbjKNBjg (ORCPT ); Mon, 13 Nov 2023 20:39:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231660AbjKNBjd (ORCPT ); Mon, 13 Nov 2023 20:39:33 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5498ED5E for ; Mon, 13 Nov 2023 17:39:29 -0800 (PST) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ADNs8Q9008766; Tue, 14 Nov 2023 01:38:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=xKvVcmTmjFya5UcY+GG1md3A1G7SZ0ZQ6Yk1++9ltzQ=; b=kg6Q/6ik5X1H+krDffodRlthgJBnkI3AEaRpxLzxqqR/h4SCJSXjvnlf9s3/9dvOVRgE 0nh8jI5fyy3qZPp2drP87jopx1i8Zrg/klzF7n+XhLm7NdhD2f669FOB2Y6N1bHf5TVZ gagp3txIwCH5+3TgSeiX2BgeQrzQn4QY6bIHSgKuosGzJUCHfuzExgPpRtiIT1cb5RR0 M/ZI/ZCZ1w0QKRgD8aN7rQ4LhPIa2iskSLuVP+W7CR/swd+nhfbAzAejMx2UJ26vpD5d HAyZDGmD2b/q5p1W5f/nTemrQGtGSKFs9T7n25uG6B6/YEWUNjsvL6nGkHczwdYppZ2f Yg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ua2mdm7ae-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:21 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AE1HCnJ013256; Tue, 14 Nov 2023 01:38:20 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2040.outbound.protection.outlook.com [104.47.51.40]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3uaxj193x7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YpXXxACEvfEzfKm3uZ8WCATn/NOwLwm1DH0XaHyhEpezqjOmnv9/JYOJdAj96CMWiO8wJAPgLq6vg9puOHOvR+wEX7ORFtsa8OZBNRSussj6j6d0yodnr0g9Sz2vJ1rqkq0+YSLLEqOGcvxmLrjXaU+5xH1VZ9jaY+7BIUeYLAj08EtccV+cTZ98aVr/Np7WjFxLjfkg2K676B1IdgYYWyTSYgGQ8kpN8t2oDkbd5TVFeusGaqCZrL0FZzi7+rBaSwYZLuE3G38SEXzfry1W82hLR+g9yARGLDoe7wb5ie69XFOUbmjEYmf4UEpGTilCsr3I7gY6AVSqQ3HojelvMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xKvVcmTmjFya5UcY+GG1md3A1G7SZ0ZQ6Yk1++9ltzQ=; b=MtzEu/UIHB7ekykez7tW1WQ4ywfuYsF38pPFEGUb3oxMqy9VO6svZRJwgXmdCFiZF8Y3bFB1mLvewd27hR7r1/BYjXk96YEivoceeyyi/jnSarUJ3h51goMTxjnCyMDTRyEJ4TkwABqsx2Rs5WLJyymreqmvOzyqJyy1UbnbskBUg6LXNfuzE3kXFup+Rr4AeynW4GveTvmyxKG4MElq9DTy+tFMDetJM30oTZuVZq3klZW0y+fjcUYaQKL9WCsGZcHbOjTqt9BbYBqz+EdU51722uYESlyHYSu/cKakVGoC47nmoTbA+Xim4PvfG53qJ38H03nlYb/TO+6yz0/jGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xKvVcmTmjFya5UcY+GG1md3A1G7SZ0ZQ6Yk1++9ltzQ=; b=Wrn9z48F+1WxwP7vIHqLQSuesPpGrYdMebS9ZmL89aoYEYeJrTirftyzT0xQXvS29VenKg10DGbjBjX44ttjtPln5LAXX4EtqB2Bq8slpVbbcysAajsz0tBv7sVWx4UOry9nzCNd35PVzMh3PCh7ihI9IiuQmtO/e8mao9CaK10= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH2PR10MB4199.namprd10.prod.outlook.com (2603:10b6:610:7f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 01:38:18 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e%4]) with mapi id 15.20.6977.029; Tue, 14 Nov 2023 01:38:18 +0000 From: Mike Christie To: mwilck@suse.com, john.g.garry@oracle.com, bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v12 20/20] scsi: Add kunit tests for scsi_check_passthrough Date: Mon, 13 Nov 2023 19:37:50 -0600 Message-Id: <20231114013750.76609-21-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114013750.76609-1-michael.christie@oracle.com> References: <20231114013750.76609-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR07CA0054.namprd07.prod.outlook.com (2603:10b6:4:ad::19) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH2PR10MB4199:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a5174e6-d973-48a2-574a-08dbe4b26121 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nd/8QlW0MsSG9H+qGi4pOKD0JOfb/vWYt5vEy5C3PpLjlMrThwRjh72GuVsJBn5caZL5vrWwRUbtfiaeZZkrrt4921zBjL+ywKfVRZIjW8FA9ieAy3wR7xYPg8Ae/4zDquHX4+jNR5+ViaQf75lMdgqkPDXFQpK1ZgUB7tzAhLMsy/0V2z9xBQDgHkC/jWnL36+pNVegHEkp4TgDI0wTgBU6bgQkYsUQfgNyPhqcrwoYOb4CNfUL/vS65HHMNxeRzcxz8iBdEJ5hybtQFA0vKHmrkWQ5dpqWY2hWs4Y30r5gsESuwD+Ublb/Xz5PVkMDUeJ/g8wgErB0Uzp4k49480AD5VN/XrsTvxFTRiLqSI9cswn+Pg7UpsqPwscKX4gqU2/TZVQOD93ocQ/OW3JfQy7J4jq25HK0oLU4aTKxkEatqmHH+40hG+2ZGUle9bqcIuJpuiiK6fA4FgAoU4sNsbfWGsQ2XT8x/hOu1L9gBmu4cv5ByinFvETEHYN+Fl25MzxzCejF8SrDjnMwJIjjc8dzREUuMrhjh7LKWK6klj6XWKdOCq9xM9D1FLVa4zBe X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(346002)(376002)(136003)(366004)(396003)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(83380400001)(107886003)(1076003)(2616005)(26005)(30864003)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6666004)(8676002)(8936002)(4326008)(6486002)(478600001)(6506007)(66476007)(66946007)(66556008)(316002)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KvdDm7Hj7yvux4p5q48YTBni4jrN2WSaNJEmFZtyXF5vS+9euAd5Cxb9zR3AO413IWizgKtzLQllQZKlMSfWPWiLrjRTg1LH/EWm9QtpObR6mn4DnALGWkpWzQR2l88l+My+7uY8PAs3JLBlqhe59fZeGNzwl455XZeO4lpzma5QAS86ITlYBfin/Aujy/pqQN/ii2LxmNQOyvyLgjts0IHInp3TxrK8Ytv2gm0N6QnwW0/z25bjw1YLlnTGThXST7sL67vz1waBWAkVSawLJp4MLa05WqavVcl6hBLwFnriEL7Bzk/03+XFy0+VwWJEy2GdKLMaNz5OkqyK4JikeapiocOvLwl+vyqQhgD5BArjoHyhm5TjQXTnCguAg1LAsRUfT61k5I7mz18N1U6yNKwfG5GN/Ky1LJYs+8Fz7dDPd08wywzUkNs8j7dGRDeb9ln90LAyHEXhHvzYrgisG37CVSPTrC1nsrFyEEAhZjC75BfKnTFMpYoI7I1Tk4t91oF9xezSXMgQjNyIPBnYFkfUvhBxua9FcAtIJ80DkxFtReLRWlEC3ytLm+4cW2mT5LIjrVCl/T+1XgfB3kskykCG1kPz+rFX0rAxFIFdr2L07r6Jx4g1NpEQ5IaYAMKDtHsppwTnj/zH683rkDA+CnFwPPfFYUbbnFdI/AZmvEALu6p4uzn9FMXb2LBLKl3judQpkDRlKH740BC+aC3RqocfCqrKdlMPYiPEMvI6AjvAiBNQRi/ymIBH3Jbzl+Ec7EqhgHfn9hqoKumdPWzjHqjEYwc0p9MBfwYXGC989yoobkFXQqfmd/jEBPdqyTncZwg4LaRpC/zkN+VMRQnWrSn6qz/UtcBeqhzIT3e90p0CgsfWb4uJ3WXL/U8b/qDH77ClgVbmwXyZJKm/Jfwm/v0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HAgosJbXKMS5NNtC8frlYJ0hZhWseOkpuNLSZHcV/63A4DY8jgMlNVwNToo+sEL5oR0qwLu9hr1AQZdOMESadvRivgy9xgrrC5YaxBwRig0OA8DJXJVx6VLDG7S+Sq3qNbyA9R0qIosWn8xBDJPnC1wThO7wnvYbE/eejUjnC6SeQ57KyaZ0qMq77kM3OZ5DVgeygRxymTA7iY4FLgGhKql63Rw/MOpcISBVI/4S7XPrfdwFOrqvTR+cePqtpl9EAHZoshCSy/5vsoy2NaBsDvLSCsOAZ5Cronyp3+ZHRVXUZigELU6yAWEniGP5AhBfDtc/FFKVjjylAuKkPudTzh7F9NGN5STzzAjUiQZPlt5HV3bRQJLFeoOw3jNhm+typ6eKmTLrV+t3xCV2qpH+Vn0BAGvgBnb5uo/NAd3DfBDMWfBU4HzHch7imHrpXJE49cA2+GgoYkHGKbfJqbaQR+zPmZfuYykbdYw4hE3KewULHNj4xtB8TRCm5TlysVJUq7ArC0NBSN1V2BadYKAAPAtOyWSS6xzqjD2xmitOiuiGZDBemTX0ijz9LYLlvGng/9GC9z5Efc6O X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a5174e6-d973-48a2-574a-08dbe4b26121 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 01:38:18.9009 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: s9OayhbqKIq58v19Jni2ORi4VFpY991wgh2sAw0L08O+hmKBgtcW8p8ucVRb43g+3o/PW7DmXQF4vEXI1BuAbEN1TsgBuEWG05baklhG77Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4199 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-14_01,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 phishscore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311140010 X-Proofpoint-GUID: lb6jM6qjGfrLHbYCgRtTc36dVsA_tRSS X-Proofpoint-ORIG-GUID: lb6jM6qjGfrLHbYCgRtTc36dVsA_tRSS Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Add some kunit tests for scsi_check_passthrough so we can easily make sure we are hitting the cases it's difficult to replicate in hardware or even scsi_debug. Signed-off-by: Mike Christie --- drivers/scsi/Kconfig | 9 + drivers/scsi/scsi_lib.c | 4 + drivers/scsi/scsi_lib_test.c | 330 +++++++++++++++++++++++++++++++++++ 3 files changed, 343 insertions(+) create mode 100644 drivers/scsi/scsi_lib_test.c diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index addac7fbe37b..e4ecf6491c41 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -67,6 +67,15 @@ config SCSI_PROC_FS If unsure say Y. +config SCSI_KUNIT_TEST + tristate "KUnit tests for SCSI Mid Layer" if !KUNIT_ALL_TESTS + depends on KUNIT + default KUNIT_ALL_TESTS + help + Run SCSI Mid Layer's KUnit tests. + + If unsure say N. + comment "SCSI support type (disk, tape, CD-ROM)" depends on SCSI diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 69c79725a1cb..b3b3ed8d435b 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -3434,3 +3434,7 @@ void scsi_build_sense(struct scsi_cmnd *scmd, int desc, u8 key, u8 asc, u8 ascq) scmd->result = SAM_STAT_CHECK_CONDITION; } EXPORT_SYMBOL_GPL(scsi_build_sense); + +#ifdef CONFIG_SCSI_KUNIT_TEST +#include "scsi_lib_test.c" +#endif diff --git a/drivers/scsi/scsi_lib_test.c b/drivers/scsi/scsi_lib_test.c new file mode 100644 index 000000000000..b4f7576edf2c --- /dev/null +++ b/drivers/scsi/scsi_lib_test.c @@ -0,0 +1,330 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * KUnit tests for scsi_lib.c. + * + * Copyright (C) 2023, Oracle Corporation + */ +#include + +#include +#include +#include + +#define SCSI_LIB_TEST_MAX_ALLOWED 3 +#define SCSI_LIB_TEST_TOTAL_MAX_ALLOWED 5 + +static void scsi_lib_test_multiple_sense(struct kunit *test) +{ + struct scsi_failure multiple_sense_failure_defs[] = { + { + .sense = DATA_PROTECT, + .asc = 0x1, + .ascq = 0x1, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = UNIT_ATTENTION, + .asc = 0x11, + .ascq = 0x0, + .allowed = SCSI_LIB_TEST_MAX_ALLOWED, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = NOT_READY, + .asc = 0x11, + .ascq = 0x22, + .allowed = SCSI_LIB_TEST_MAX_ALLOWED, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = ABORTED_COMMAND, + .asc = 0x11, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = SCSI_LIB_TEST_MAX_ALLOWED, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = HARDWARE_ERROR, + .asc = SCMD_FAILURE_ASC_ANY, + .allowed = SCSI_LIB_TEST_MAX_ALLOWED, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = ILLEGAL_REQUEST, + .asc = 0x91, + .ascq = 0x36, + .allowed = SCSI_LIB_TEST_MAX_ALLOWED, + .result = SAM_STAT_CHECK_CONDITION, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = multiple_sense_failure_defs, + }; + u8 sense[SCSI_SENSE_BUFFERSIZE] = {}; + struct scsi_cmnd sc = { + .sense_buffer = sense, + }; + int i; + + /* Match end of array */ + scsi_build_sense(&sc, 0, ILLEGAL_REQUEST, 0x91, 0x36); + KUNIT_EXPECT_EQ(test, -EAGAIN, scsi_check_passthrough(&sc, &failures)); + /* Basic match in array */ + scsi_build_sense(&sc, 0, UNIT_ATTENTION, 0x11, 0x0); + KUNIT_EXPECT_EQ(test, -EAGAIN, scsi_check_passthrough(&sc, &failures)); + /* No matching sense entry */ + scsi_build_sense(&sc, 0, MISCOMPARE, 0x11, 0x11); + KUNIT_EXPECT_EQ(test, 0, scsi_check_passthrough(&sc, &failures)); + /* Match using SCMD_FAILURE_ASCQ_ANY */ + scsi_build_sense(&sc, 0, ABORTED_COMMAND, 0x11, 0x22); + KUNIT_EXPECT_EQ(test, -EAGAIN, scsi_check_passthrough(&sc, &failures)); + /* Fail to match */ + scsi_build_sense(&sc, 0, ABORTED_COMMAND, 0x22, 0x22); + KUNIT_EXPECT_EQ(test, 0, scsi_check_passthrough(&sc, &failures)); + /* Match using SCMD_FAILURE_ASC_ANY */ + scsi_build_sense(&sc, 0, HARDWARE_ERROR, 0x11, 0x22); + KUNIT_EXPECT_EQ(test, -EAGAIN, scsi_check_passthrough(&sc, &failures)); + /* No matching status entry */ + sc.result = SAM_STAT_RESERVATION_CONFLICT; + KUNIT_EXPECT_EQ(test, 0, scsi_check_passthrough(&sc, &failures)); + + /* Test hitting allowed limit */ + scsi_build_sense(&sc, 0, NOT_READY, 0x11, 0x22); + for (i = 0; i < SCSI_LIB_TEST_MAX_ALLOWED; i++) + KUNIT_EXPECT_EQ(test, -EAGAIN, scsi_check_passthrough(&sc, + &failures)); + KUNIT_EXPECT_EQ(test, 0, scsi_check_passthrough(&sc, &failures)); + + /* reset retries so we can retest */ + failures.failure_definitions = multiple_sense_failure_defs; + scsi_reset_failures(&failures); + + /* Test no retries allowed */ + scsi_build_sense(&sc, 0, DATA_PROTECT, 0x1, 0x1); + KUNIT_EXPECT_EQ(test, 0, scsi_check_passthrough(&sc, &failures)); +} + +static void scsi_lib_test_any_sense(struct kunit *test) +{ + struct scsi_failure any_sense_failure_defs[] = { + { + .result = SCMD_FAILURE_SENSE_ANY, + .allowed = SCSI_LIB_TEST_MAX_ALLOWED, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = any_sense_failure_defs, + }; + u8 sense[SCSI_SENSE_BUFFERSIZE] = {}; + struct scsi_cmnd sc = { + .sense_buffer = sense, + }; + + /* Match using SCMD_FAILURE_SENSE_ANY */ + failures.failure_definitions = any_sense_failure_defs; + scsi_build_sense(&sc, 0, MEDIUM_ERROR, 0x11, 0x22); + KUNIT_EXPECT_EQ(test, -EAGAIN, scsi_check_passthrough(&sc, &failures)); +} + +static void scsi_lib_test_host(struct kunit *test) +{ + struct scsi_failure retryable_host_failure_defs[] = { + { + .result = DID_TRANSPORT_DISRUPTED << 16, + .allowed = SCSI_LIB_TEST_MAX_ALLOWED, + }, + { + .result = DID_TIME_OUT << 16, + .allowed = SCSI_LIB_TEST_MAX_ALLOWED, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = retryable_host_failure_defs, + }; + u8 sense[SCSI_SENSE_BUFFERSIZE] = {}; + struct scsi_cmnd sc = { + .sense_buffer = sense, + }; + + /* No matching host byte entry */ + failures.failure_definitions = retryable_host_failure_defs; + sc.result = DID_NO_CONNECT << 16; + KUNIT_EXPECT_EQ(test, 0, scsi_check_passthrough(&sc, &failures)); + /* Matching host byte entry */ + sc.result = DID_TIME_OUT << 16; + KUNIT_EXPECT_EQ(test, -EAGAIN, scsi_check_passthrough(&sc, &failures)); +} + +static void scsi_lib_test_any_failure(struct kunit *test) +{ + struct scsi_failure any_failure_defs[] = { + { + .result = SCMD_FAILURE_RESULT_ANY, + .allowed = SCSI_LIB_TEST_MAX_ALLOWED, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = any_failure_defs, + }; + u8 sense[SCSI_SENSE_BUFFERSIZE] = {}; + struct scsi_cmnd sc = { + .sense_buffer = sense, + }; + + /* Match SCMD_FAILURE_RESULT_ANY */ + failures.failure_definitions = any_failure_defs; + sc.result = DID_TRANSPORT_FAILFAST << 16; + KUNIT_EXPECT_EQ(test, -EAGAIN, scsi_check_passthrough(&sc, &failures)); +} + +static void scsi_lib_test_any_status(struct kunit *test) +{ + struct scsi_failure any_status_failure_defs[] = { + { + .result = SCMD_FAILURE_STAT_ANY, + .allowed = SCSI_LIB_TEST_MAX_ALLOWED, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = any_status_failure_defs, + }; + u8 sense[SCSI_SENSE_BUFFERSIZE] = {}; + struct scsi_cmnd sc = { + .sense_buffer = sense, + }; + + /* Test any status handling */ + failures.failure_definitions = any_status_failure_defs; + sc.result = SAM_STAT_RESERVATION_CONFLICT; + KUNIT_EXPECT_EQ(test, -EAGAIN, scsi_check_passthrough(&sc, &failures)); +} + +static void scsi_lib_test_total_allowed(struct kunit *test) +{ + struct scsi_failure total_allowed_defs[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Fail all CCs except the UA above */ + { + .sense = SCMD_FAILURE_SENSE_ANY, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Retry any other errors not listed above */ + { + .result = SCMD_FAILURE_RESULT_ANY, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = total_allowed_defs, + }; + u8 sense[SCSI_SENSE_BUFFERSIZE] = {}; + struct scsi_cmnd sc = { + .sense_buffer = sense, + }; + int i; + + /* Test total_allowed */ + failures.failure_definitions = total_allowed_defs; + scsi_reset_failures(&failures); + failures.total_allowed = SCSI_LIB_TEST_TOTAL_MAX_ALLOWED; + + scsi_build_sense(&sc, 0, UNIT_ATTENTION, 0x28, 0x0); + for (i = 0; i < SCSI_LIB_TEST_TOTAL_MAX_ALLOWED; i++) + /* Retry since we under the total_allowed limit */ + KUNIT_EXPECT_EQ(test, -EAGAIN, scsi_check_passthrough(&sc, + &failures)); + sc.result = DID_TIME_OUT << 16; + /* We have now hit the total_allowed limit so no more retries */ + KUNIT_EXPECT_EQ(test, 0, scsi_check_passthrough(&sc, &failures)); +} + +static void scsi_lib_test_mixed_total(struct kunit *test) +{ + struct scsi_failure mixed_total_defs[] = { + { + .sense = UNIT_ATTENTION, + .asc = 0x28, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = UNIT_ATTENTION, + .asc = 0x29, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .allowed = 1, + .result = DID_TIME_OUT << 16, + }, + {} + }; + u8 sense[SCSI_SENSE_BUFFERSIZE] = {}; + struct scsi_failures failures = { + .failure_definitions = mixed_total_defs, + }; + struct scsi_cmnd sc = { + .sense_buffer = sense, + }; + int i; + + /* + * Test total_allowed when there is a mix of per failure allowed + * and total_allowed limits. + */ + failures.failure_definitions = mixed_total_defs; + scsi_reset_failures(&failures); + failures.total_allowed = SCSI_LIB_TEST_TOTAL_MAX_ALLOWED; + + scsi_build_sense(&sc, 0, UNIT_ATTENTION, 0x28, 0x0); + for (i = 0; i < SCSI_LIB_TEST_TOTAL_MAX_ALLOWED; i++) + /* Retry since we under the total_allowed limit */ + KUNIT_EXPECT_EQ(test, -EAGAIN, scsi_check_passthrough(&sc, + &failures)); + /* Do not retry since we are now over total_allowed limit */ + KUNIT_EXPECT_EQ(test, 0, scsi_check_passthrough(&sc, &failures)); + + scsi_reset_failures(&failures); + scsi_build_sense(&sc, 0, UNIT_ATTENTION, 0x28, 0x0); + for (i = 0; i < SCSI_LIB_TEST_TOTAL_MAX_ALLOWED; i++) + /* Retry since we under the total_allowed limit */ + KUNIT_EXPECT_EQ(test, -EAGAIN, scsi_check_passthrough(&sc, + &failures)); + sc.result = DID_TIME_OUT << 16; + /* Retry because this failure has a per failure limit */ + KUNIT_EXPECT_EQ(test, -EAGAIN, scsi_check_passthrough(&sc, &failures)); + scsi_build_sense(&sc, 0, UNIT_ATTENTION, 0x29, 0x0); + /* total_allowed is now hit so no more retries */ + KUNIT_EXPECT_EQ(test, 0, scsi_check_passthrough(&sc, &failures)); +} + +static void scsi_lib_test_check_passthough(struct kunit *test) +{ + scsi_lib_test_multiple_sense(test); + scsi_lib_test_any_sense(test); + scsi_lib_test_host(test); + scsi_lib_test_any_failure(test); + scsi_lib_test_any_status(test); + scsi_lib_test_total_allowed(test); + scsi_lib_test_mixed_total(test); +} + +static struct kunit_case scsi_lib_test_cases[] = { + KUNIT_CASE(scsi_lib_test_check_passthough), + {} +}; + +static struct kunit_suite scsi_lib_test_suite = { + .name = "scsi_lib", + .test_cases = scsi_lib_test_cases, +}; + +kunit_test_suite(scsi_lib_test_suite);