From patchwork Tue Jan 23 00:22:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 766778 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C14E1350D6 for ; Tue, 23 Jan 2024 00:22:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969355; cv=fail; b=WhF/o5NZx6i6BB+eOER3NNE7uSQmF9RBgsoYgGFI6LhRRpf6Un04F/tAL4WGvH6r6MGb2JRFzpBIcjJWUfO6hmsAdpORfhbFknP37tHJ6vUwH0OS8amzEYADzJrdKJJzMx5xFztldglswLrlNPtTLB0NyygIXWLGa/WgfAeBwFA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969355; c=relaxed/simple; bh=p3V7Q0dtwSQshgU+d4DgMc7NWrrAjz/1LSLOkpETCiY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=qzLobhCFNIif0nSUh/U6HQTXTfXZ/btcY8Fe8X8sPZswn4lKmDCPQuPsF1XB4QLt89Vg8JO4vt1DQkxYH83ocNYC3AK46JyS7EZUfemDfVVk4OJzW4s6oK/Si8HtFRDlnzuThj6HQmHnpd7osdIKcT7iXfn6b8FlHdl8zKoJTYc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=cyOoGNSI; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=YtWCkwGk; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="cyOoGNSI"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="YtWCkwGk" 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 40MMp4td004497; Tue, 23 Jan 2024 00:22:27 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-11-20; bh=mR0yiQD4MCn0rx6HdYDg7mcon75rwJ6bqV65OukiEgY=; b=cyOoGNSI1DJ7gqDA7alRW02NPV0mbA1y+8D1NS78+X5aiCikxJDh8bcbR1/Q2dPQ8Xup IiEUTxG093KeyhEXdXVHaT87+R3hVKU0tQy9PyFfGf8Gu1csRvcq5xGzcfyBnpo+dOqg a8p4z5KTvXuBjog6sgW4bH416KQdHy1AO9kmP3H7Gi9d3owjbOPq3IrbBZPm+Z8pCoyU mAOeSLtmhBikJffhowPm1zbERlF/+4E4dzRZgh/9RWQL4b3Yya2AvAGb+bHx0Pcw5sno fdMJZMmYEtSZoPgahVul+uOUpHJpGf3JyaeVEsULv601ajATZDV3BAuZUYXMrRjTornC 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 3vr7cxvw4a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:27 +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 40MMoP94013174; Tue, 23 Jan 2024 00:22:26 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3vs3700jge-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JTPV8o4UO6NWOg9GtSZgM+l2lRQKdgTfoNkFAAKK+OtfCXtnoxKd/MmdhJ3+y6abHQTYYQWlLaAJazhxWxRWFfdD+Ms7bc1nbM0yqCpYlxLtE+el2MjI8d263xC16aQ5q6jcGJ23EKjUaGg3UCvJEucZXJrsEEOdj7vJltIX2Vr4gn9FHbVW87eMsaqma4CUuWiUTakpHKXbaLW4L9AYuQdsmocCPVuA1yKEr+uH/Q56PLiJO8OtmAPDJNnDPGoP5hTNybsMmTGz+v1BCMkjZW1rte15caq8ngATKFDTfRp0yTSLBAPpc11b8U0jfATicEbI0EvEQZ0onx3gelTCOw== 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=mR0yiQD4MCn0rx6HdYDg7mcon75rwJ6bqV65OukiEgY=; b=amifnug1MIGjfXm28Eajgc7UZzoF169nnV0vsnhqhiV/pf44UJ0hZhkC7eWPigqqvTmdO9jN/Iw/FYEq3egYxRNX2qY4XL+0lCFkI3CUBo97bGYoQdAvx8zlHe7GkOcfDFWLxjxbxkPMoK8PizCxoFJdtNdOd3oL6gqOtea71tgJArKuMEWh8GdojcHh026QXo1oe0dN/lJ8LGeZMaXKyMffzXdImswtuo0o3gE+X8BdddBY10FpIdiZYf3D/eVZ+p2g07cv4CGjFrY2XAkJoLuyvyJlNHZkxdk0b/M2tPp22BwmncWiiHQ5rI88HP+dPZHugupZsPdCZOsk4z2FOA== 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=mR0yiQD4MCn0rx6HdYDg7mcon75rwJ6bqV65OukiEgY=; b=YtWCkwGkb412bNvT92dgOARcrq9vlHRHzf4JHK56vVX//BA2SYQYlO0nkefSHHCs+w3Q0i+0fK1CNcsEnUWMgYiI/OlX18kYOXw8tIKRFxW4hAGs/5GD8DGAgQOoaCwJXQe+FnA7Z7K7MH71FsgxmAXPMdM6cK45FvXJUqpOplU= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SA3PR10MB7041.namprd10.prod.outlook.com (2603:10b6:806:320::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.32; Tue, 23 Jan 2024 00:22:25 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac%7]) with mapi id 15.20.7202.024; Tue, 23 Jan 2024 00:22:25 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v13 01/19] scsi: Allow passthrough to request scsi-ml retries Date: Mon, 22 Jan 2024 18:22:02 -0600 Message-Id: <20240123002220.129141-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123002220.129141-1-michael.christie@oracle.com> References: <20240123002220.129141-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0032.namprd03.prod.outlook.com (2603:10b6:5:3b5::7) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SA3PR10MB7041:EE_ X-MS-Office365-Filtering-Correlation-Id: ca79062c-c4ca-4ee9-91ba-08dc1ba95fb4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 805bbuIKmKmJQBuKXAt2UZbW6uyVb5JYZnNdaIuv1lLeeyoHLxzLY5FVl5Zog8LOxbpWkejyEiZNgMnp2HS3F8wR7kVUnmi3HzCJ5xQDzDtmfKGoK+g0D8RE4N6DdT1quoAr1qYEbjlMHzLra/VZtzqvuTQ8x7mCeAFlPgk80iC0/ls1Vr8dUqTtYkm8wihmJJopfeerX+co91NWIdABBCllY1n2qyLQMWcBLT8TRXEAl4PhC9jhJ9QFmNU896tN9uk7KuhlJVUuBIhqngtfPetFKQZ7R3VNknffvu2SuRDI79hRu/xehb6Wn+1cfhlpe63/06VdK1ITPjV1xnhNyfDQDZ1hoWbkOn7xRT7hbBuKxzPySFVZduz1RySaRnaHiGQKPZYOXdpdCVB9Ctn8hBvASvQLbR31G8ffQyzX6AP+sZbs00iV9OZgNWCs5Z/GUb0amXHptmyqx+0AeV8AbcOI4va1vOckkIMEx9cAnbiMDoqSBz9ONvjBQe9KttMg9+wS3Zr4cP7eSyX0ZLj4HGqDtYaasSK65d08KdlfRmcxrj0ktkpwe227/xhvTHbJ 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)(136003)(376002)(366004)(39860400002)(346002)(396003)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(38100700002)(36756003)(86362001)(83380400001)(1076003)(26005)(107886003)(2616005)(316002)(8676002)(66946007)(66556008)(6666004)(8936002)(66476007)(6486002)(6512007)(6506007)(478600001)(5660300002)(2906002)(41300700001)(4326008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: A2Ij6c1rAIoge9UrHa0Vd/cJ7f0ghh5U0LOTfGjMi2DlqB8sSehx+AiN/CWo5X366M2WdOtH7FgM/By2mwQtoLts+u0ZAT5qiueprSNPv79kQsyFurCHKDur/mSUeE3RZy0mPGKVFz5hHpbxx2j7dolERzZL0Aj7B+ygkRX5CjRHaujXDi/nTdBwMjExjkmElxdlzAelTeyuVUcdHZ5xZ1DTiRZWo3fEY9JeUqLaDbCgqPajOuelCnUMDBEmHFDfakoteroMWB+se3hJBi06l+/urUSNedIaY9r07CwJZDQVu27aeSy2arCNT/vjSamxxiau3cllP52ixYKxOQJIdIc2yHGYhodcaKAOg9aWC2kdhqfR1BUNCMIy0UVf0/rZ3WTSmdQvPDjjI0t998Q4/dPithAGoAI1zEANO4tB2ywKYD3wBcLEtfSlvYASGukgm6q6svouykIEJoeZkxdYfTADsgY0y8okHzn/H/YTudL1VbsJgeMoKTkVBnDQb7jnaEaVG0ngbYhsGKra+AI960tX9Rj8UR4v/wPWx/Nj1OmTAevP1jMHnkqgx7MPRraaYrPwx5QImpaXAvU+Snh92JiO59XpInA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ternalHop-MessageData-0: tRE0BwgSJmIVOiUlpXNyGR2LfHlEI1QgAXydoVpWRYjVv+K9FB+/rGlDpsf2ps5FDAevjT0XhNDvpJT99eQJ/+zqo1fTy3N/BaEJ+O5LrnimEOTG0Y4H66BkRQEn6pHA5gwnHiYoVBiIGKGgv2PuxkG11T86Y1GNBkoJzCwxZhwnUo0VXUO5bbWb5UpnlpBtlScSmC1OSWIjj+NE0m9gs80ZHpiPPxdyMO001bU/oVqVnoNrOHkhliQUT8w3Kr9X5Eoiwn1cjzO6CbpfzrTCcciXxTJgURe5i6qjxFgG7zNz6dA7AX1uv/Oy5VeUVC69su6dYiubAjX4CnKFx5M6QCoUNdQgVBz7oK8Snfi11+S2mwfwE1RTs9gZvvr0AMZhOX3iEkrijW6oYD+6AH39Y04Xrzw0FWe+AY7FTQBdJh9J7gCOQot3P+RQBfd6ocSXL6QAgs6FJaZkBzEN6VbVUiV3O02smueukCnc4a3kc5aHch32IEqI7z2dZ1fw4euwpg2n9aUub6db/4gpEkE2F1IHD6Ii0qrKhVEA3qvLdpbH/CFXNDqj+rrrNmr8ZWKgWZ1gcz3ysqw3fCvoIJmDybh604lhqpF1n3wWBmS/asc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ca79062c-c4ca-4ee9-91ba-08dc1ba95fb4 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 00:22:25.0332 (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: ANgpC8RGGWWTPLj/IDg22CDnis6s9sxQ8s8+trwRQh3hlrVBPaEsuQU+tydzA57DL9f0C0YVV7REEzB9EknoF52BuWhQf065ZEdmnXc1z4c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR10MB7041 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-22_12,2024-01-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 adultscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401230001 X-Proofpoint-ORIG-GUID: RRDwgnQuHpvOGStdFDOMHvRWA-ZBOqeD X-Proofpoint-GUID: RRDwgnQuHpvOGStdFDOMHvRWA-ZBOqeD For passthrough we don't retry any error which 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 Reviewed-by: John Garry --- drivers/scsi/scsi_lib.c | 98 ++++++++++++++++++++++++++++++++++++-- include/scsi/scsi_device.h | 48 +++++++++++++++++++ 2 files changed, 143 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index cf3864f72093..868f23517d33 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_failures_reset_retries(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_failures_reset_retries); + +/** + * 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 @@ -192,7 +278,7 @@ void scsi_queue_insert(struct scsi_cmnd *cmd, int reason) * @buffer: data buffer * @bufflen: len of buffer * @timeout: request timeout in HZ - * @retries: number of times to retry request + * @ml_retries: number of times scsi-ml will retry request * @args: Optional args. See struct definition for field descriptions * * Returns the scsi_cmnd result field if a command was executed, or a negative @@ -200,7 +286,7 @@ void scsi_queue_insert(struct scsi_cmnd *cmd, int reason) */ 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, + int timeout, int ml_retries, const struct scsi_exec_args *args) { static const struct scsi_exec_args default_args; @@ -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); @@ -227,7 +314,7 @@ int scsi_execute_cmd(struct scsi_device *sdev, const unsigned char *cmd, scmd = blk_mq_rq_to_pdu(req); scmd->cmd_len = COMMAND_SIZE(cmd[0]); memcpy(scmd->cmnd, cmd, scmd->cmd_len); - scmd->allowed = retries; + scmd->allowed = ml_retries; scmd->flags |= args->scmd_flags; req->timeout = timeout; req->rq_flags |= RQF_QUIET; @@ -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 5ec1e71a09de..4dceabb9dbe1 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -489,6 +489,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 times scsi_execute_cmd will retry the failure. It does + * not count for the total_allowed. + */ + s8 allowed; + /* Number of times the failure has been retried. */ + s8 retries; +}; + +struct scsi_failures { + /* + * If a scsi_failure does not have a retry limit setup this limit will + * be used. + */ + 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 */ @@ -497,12 +543,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_failures_reset_retries(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 Jan 23 00:22:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 766777 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C0131350EE for ; Tue, 23 Jan 2024 00:22:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969359; cv=fail; b=UUsqPhJLj2UqA5s5cJ+R443nk/bcGEJ3cABuYKp+GXibCXEZi6eo5yTMT+76KXqc21up5wGoDCtWXqYRSACz/p03FcFjRpJC1APcG+yo1cjWihRbwf3jefQdV4mcEzlee2+q6TlKgV5XsW1IQpKjPf5OH+1/bNUTGF2pnztnxAQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969359; c=relaxed/simple; bh=GDSV7gIHPwzsk/XcjEpt2JdM6Ulz9/VDrelPMpb/Tac=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=kQyZyR8U3OWas7gdtqBJBh7Tty+kB57SFmBzkmUFzA2HmgY43PtSwlaC89jmL0/EHtD/4LJ1AJJ9+iQEP/xHODSwpGKeZJ+ahgbZn8oxMqoWiGbvPXCddDBWBB1qeKDqQANU4wXxxS/fB4sIPiaOv5XuuIkHuKXAHfPXLv9r3MA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=gVlqF23W; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=JM5IXfA4; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="gVlqF23W"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="JM5IXfA4" 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 40MMokhf004020; Tue, 23 Jan 2024 00:22:32 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-11-20; bh=8umrS4UN1BNOIZF22PBTSTJ8etYSQ/9CVKnGMV52/og=; b=gVlqF23WSP1TqAoPYVU3aRQMVaI6ecFGAJYPMvea6JY4D8GFYHuWdW1cZb4DGVbJ4FmE /QjfxitDNzN9FMuJyONxGQyYftj47X7JSW1bheT7xd0lEKFR9tONmwOwHPKZWrR5Nui3 FTwk0Yw9C1mN8t6BLFsKEV2nJUsC1ERRiqZ0WlBF3kJn4Ljve5t9x7SQtej26Zo9fpis DrsmQBfR3L9CWpR6xluPsSV+U/DE3MvUFWV2ZmB0/JUj17C6c/OT423rOrAYiIJmDksU bo6WZ3HXu2xvAglGlcH0Kk3LXR7suFzM432+zomsIGcE0+1gn5xBoKDJUVJV6YiNBirC lg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vr7cxvw4e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:31 +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 40MMluSt025289; Tue, 23 Jan 2024 00:22:31 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3vs33s34k6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IcO2aDklnVyPLR04IVsCWI7DnWe8QDQJm5+6wsKXJHUgsBvAqNl2a9qkOITJPyxk+SvTSlPJE6ocqYBGuUXx5SV5dRbrrQk9nlPrG7oSB36nyh/ofIB3J6bZeUu25UALCBRHRc8gdFB0+029Zuz1dU3m5G3YYfqOZ7fSdRqV3k5NEzrtZg/B5QPHjzFf4ptdlHErhZD+bqZ4aowPCwvNYnqU7cKCyw7dQR1Y5i2qBtKVCh6pH/YfMCXhxkJYKnUO0MqAxPz4NIGXDOHy0ce9SN906LHpinX8dbzoK6gGGQeK8PGWGeD2HKGTICbOQ6B7ZFtcyBzRmtZUKNJ5Ybqqgw== 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=8umrS4UN1BNOIZF22PBTSTJ8etYSQ/9CVKnGMV52/og=; b=Sar/Rzi0b5Yc+HOuMfgkhTAGyoiWXGrpCu0oClWX1tztvCRphiMYDlDQVTNhLbcSqtMJ4Lg5j3I2eezQB2srw4C6FJybGQ9ZOWO4WrJsCacC7WZSQUWbsWlHOKUFAN/+SQzJLnehIKvp8loQwaUeYuytmN3qlapUHdfwqD26hiCGqaol1/rJPRAoQSKvhZcqmknat1+9MDeVxCQ/g8Avz1Ra+x4okthe5aj2DHmV8CJRuG0arC62uGAbeVe+xa2Q7G/PotTVLBckgCUEXpRYr2jzS7KL0tdBWEcCl6zA8wz/9E3YLsL2u5Jl3jSOL/tH/i/0gg/bePF2vzpRvL0kRg== 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=8umrS4UN1BNOIZF22PBTSTJ8etYSQ/9CVKnGMV52/og=; b=JM5IXfA4qNHkgNFLuQ8/JKfF2rGzhLViFAgFPBMbebT8sPA5nb+430n5jdWUyGraIZUwG08lSv+KAXn6u1rkZH/XKBQqF1A8OCZpQeSP6evEWAD5m1Co3y8TNHLG9UpMVn2RdQlp9u5DQf2YMGTtZblClM5y0k8PHlxbogXAoSs= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SA3PR10MB7041.namprd10.prod.outlook.com (2603:10b6:806:320::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.32; Tue, 23 Jan 2024 00:22:26 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac%7]) with mapi id 15.20.7202.024; Tue, 23 Jan 2024 00:22:26 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v13 02/19] scsi: Have scsi-ml retry scsi_probe_lun errors Date: Mon, 22 Jan 2024 18:22:03 -0600 Message-Id: <20240123002220.129141-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123002220.129141-1-michael.christie@oracle.com> References: <20240123002220.129141-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR03CA0068.namprd03.prod.outlook.com (2603:10b6:5:100::45) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SA3PR10MB7041:EE_ X-MS-Office365-Filtering-Correlation-Id: 97b26a56-2480-4972-0006-08dc1ba9608b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zj6KOmKWp0i1NuxEBnTaE2T5a8hBKrgOWwTTaQg3VXApP8l0ULyOvGE4RAgkXvTd68nXKOGjKqaneNlnoIVQY1m08qXWSA0uGmLDB5nG9fP7tVmiSv0umaAv7q6aYfkECjmoqUXGamaGPf4Ist0wFQ+w0i1+bAK/2QVhUQfR2zR8JSkRXMObI/GJINndFJAUmIXxNhFIAJepJ2x96VxvKkArEoHcAsLJe57qNhvn3i/gB1R/ouyaEuLazaHHyT+yjOuEcprWOXYUHqBuVNUYbCO1t1edYfASmpOadYMJZv0vGjR4X9EXclAL18aiP9epugbvGFooxADq2iwaQLoHP0Ea5a6FAXH/IpNRD74qvcrzJhbFM+cTBCyDjb7StD2Flv/gwWPY1mAn0srhZjFuZWTyrG3ZgTZsyTkKvb5EsYLl6k0MoOiLSlZcwKKt1upBRgtrWdsCJDrlp+sylb4A/qqtit0IsRHL87bFKWw96ojp8RikIAXyLvFUBCYaqZ8CweFIEBGxVIj9QwQqBljz6UzAt9a5VkTBhqwn1tkGCRjtxYIsI8H+zSNbJJs+mMHc 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)(136003)(376002)(366004)(39860400002)(346002)(396003)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(38100700002)(36756003)(86362001)(83380400001)(1076003)(26005)(107886003)(2616005)(316002)(8676002)(66946007)(66556008)(6666004)(8936002)(66476007)(6486002)(6512007)(6506007)(478600001)(5660300002)(2906002)(41300700001)(4326008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1YlHFnxD6JzqSl4oDZxTHBhnLDB9Sy53WhQ6KoG9aGImoam7zyO4TTXBKpEEnmL0GOeRc00181GOqXhp0Q00QZ1lhkP3b2D8ETcWX3btO5NIOOa7eGgcy2WsqlwWkUWUJ2kwYlQ8adPJ1k85GsYvH+SVr/kgsg51bgN4a03gvoY67HP+tOpKcX90SSeKPh3iCxz3Bydgu6MiU6uNsywhVdXV65+iFrwFa5m6YJhpoE7lV7cchoX1tMyOGhqT+mZb4IUvv/UBC7LUjc/XCma3rKZbeOGcVdF4EV7Oy+3L0nDdHqOEx+NmLjQO1GoJvz4XyctfsbOR+dWnI/y+NYq6CPgbirjc2puzPLZ/b9gAq/TqBW1vCk+RiCroYKMQSenYY7E7//cgz9c3+YIFa/NqWOsIQc/gOuGETjqeeuwMsQDCCiGqe14NKj2gvz9Z8JDI4ZaZHYI11fBBSeJTrdgakqT/RovDi7a48YaaBiBNkAxwVRYM1OJ22FFIi1MhPXDHWqt9Ou4ApEISUTjOoxXkC6qOUNtopB1E66YJe1iWeEYfflyCvSVyWVltEIwZXWpN8PT6pxhByPhi122HL5b96RepADXREs7v5z4OABuSohtRI1spO0VZ1aPX0Ye9Qw3g5a6IgRwn4k7CRQ2ePsFeN1Qb+E3HRHG1BNsKbSv08qISYIm7Xnf5bn93BdtxkcuzZeml/8EGVk+oGHISJxIoqDp2e+akaNAJW4yoCZig6qZ7G8J9dKQjRy+EEKZzTnIfgMIWY4Ae/gqjXw3fTQLOK+1nl2cGOB0qIyu1QbG66xE689F/EcrlMVSiZVpjH9Pe8zpwOf1/zLC9vpsqCVC45jGK3ljG2B+Sxgz6M9Ael8xkeKFb/NPJN0e+2JMp+pJ5uAZlXHYG8MvKNOOE58cl9gXw8dtIzTxK309oYzMbg63XYi96mDbBdCJek4iNlkzLaYSdWeyUp7Q/BuaAKXzJPwI+iiMWsi+5o60+4RBw/fQ6iS92iVH7CT00AUH/5E5BukdyFrGw8qibU+EOIs5VYknKPjIJEspIbckKhde1w7fipzDtzEjdkOzAGxzz3jpESjBA/33PHgw3QJuwJhZk2i0SmGtu8zokU1tU6/6/VDChzs5Z6uKZivaAl8Olz/2RfTj9X5rRdYupjTyZjIbuU52twNb4U36qC3PFMn4uZtKOv4WELZPgrcNeG+SB3KVP2MEBDiKVtakFE/c/Q9sMb+gkymAasYTWNfrOmbV7bq4s0burNu8RvwmWkyiXEmdPzym4hG0pLgapRH02+05vfCs+oxgf/jCadbcbfYRHtgymUap/QbaYf9SHbNgOuAuFsjeBGlU900j9u9XFHd27pV7LtRM12mJeJQVhciabh7UiOn25tDxEipVxZYyIZ2wKxaTkmW/95YCD46KNduiHjnIjmc0Dgf9EH05akvW/edfDK26gDn6uf7JeKf3IJBr8QAVatnAqBgTVSFz92qyqv+UAE+Q8nH8BolYiPtC3cMJE3zAtMre8KbE6+CSNM0JUYCHvvAF8z3d5HfkkIdshl7Mli2wDgN85qsPrLYia4KmW2spI6WVQc6kzEudCfdGSyukFmEwH4OIgppKXG8WTXg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: /OLmj50SDAMAXKTquFPabvDfd/LqkRVFPIDtycnXmmyVoaIVHKEU7Vn/g1D8miPTpgkcnzkrYwooW6OFL6W1pbrc1nJDjjGVkDammEx/TR374xXnfXHPfNk41fr7l2BYfbBu7m03Lz2eOlfRPOkMF9CHJi2Nqe9H1fVkttQZo28uY8Q1ZzVlGAPR8phD1r4+Nhdo1yzBw0TL4N1ZfIhdi3KIVQnvFf3Ze7EJWN/xUj2CclQ0kdynyRW27RE85VjRvY973kNckAHuL/B3yk1UplmVNpq9YRCIWCbwM9l0IHguuc6OFlhYdR9OsBcPX7VwRtIkVAq3KHcO158m9fpibURMiX1riA3RKOHnUbbnfh+pbD2eG7ItgZcFU94BydtAiH8+gce8H2ZtQBtzMho01rtqqpPZ7HUDJecxZYzHvm6+pNrcIB19OlYWNJYuhuW1O7pmxKSxIzQ8btVQGB5bUCV9BNx9sKaxed7bfgK+Z+hh/fLadJkkvmt1DCOsFmfz1ZSs8dczTRwPSvwV0aG/AhtG66Ka+qQapMR252LpRqLwjOjwjzkqX0SrZBM1YrfZ8DabXd8EkM/TMLblZfxQEZb+gk8ARi2yZTF2POrWvDM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97b26a56-2480-4972-0006-08dc1ba9608b X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 00:22:26.4249 (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: ikQ63xYasfMZ1LEScpQxPo58Fy+iX8iw1hrsEhw91eJZkWl0DUyIyzTKukdYPZN9dM/fQafrM5oDSrz/DEqgmJbDTFyJEk2qa1CPNqNP8rk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR10MB7041 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-22_12,2024-01-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401230001 X-Proofpoint-ORIG-GUID: WeaekpOE2urMqa_6jUKqyI9qp1IAi2cK X-Proofpoint-GUID: WeaekpOE2urMqa_6jUKqyI9qp1IAi2cK 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..a2bed0dbf996 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_failures_reset_retries(&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 Jan 23 00:22:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 765552 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2825D12BF34 for ; Tue, 23 Jan 2024 00:22:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969359; cv=fail; b=AqjxBf2fgfeNKf0m1Qld64Dv5nNYM7IPdki8xwcc4/6X3kcqDWe8Z7LPmPR6lqEnFLXk9wG/5lQE5Hb2Nv+WeyWw0GJmhXR8eYtw9k3rJWGGasTQhr/TZXJoi4WxvH4LSHrJ+ZknBgzdjk7LsOa4IrHjZyM8/Byvuq5TuvGwZAo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969359; c=relaxed/simple; bh=7dGxnMr4qhPcoaO0o+QE9HK69br35JRuY/cvFWUhUTE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=AJiaTu4Vv0yJPu985BsbrXYo7ovFTG71phQo63k1CO60kCl5n9ZhHFq1m7o3US27lwKUAw1UoX5udKH63E6uD5+t8DwIjaH6WUK75NILUlEYCmWinDpKSsvLQ9ewE0xcUZ3QvjWc43FNSv0Us6Y5pSKSkYMK9aeaWzehXPQX5UU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=M6xs44K/; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=GYxkDm6S; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="M6xs44K/"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="GYxkDm6S" 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 40MMolZi004027; Tue, 23 Jan 2024 00:22:32 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-11-20; bh=xIzVfUi1mtGZoxWxdY70LpgatEyNAeAKA3gvZz3w5R4=; b=M6xs44K/CwM/y6SU6Gs6Z+QuybHrH3KSLxBS5ZIiO+jJvH28D90hBtz7DwgqK446Cz70 2NPBUYraH+GpkQQukl3drgi9UDCRL4av3tTgQKBet1OgPdoK/vzUcnysbucNj2eB0Ebt pjfLfo4wnjzTX81QtaX3DaoWCr43/gSwOHkmBipi9tjDQYvxbV71BDAqOXKqEH19cfvE ETSNW6p/TaeP6cVYaGf/1+fTrLlAnSfdKTlehDcLvvibUhLlxjtVK5TmxDC2cf8yg82B R54B2Oi9Vt9+qLegZ/RzujXG8UfbvZ7ya0SXIrSQ6EkP0Vv/wp7pLhrM8HeKNuPAlwtx Xg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vr7cxvw4f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:32 +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 40MMluSu025289; Tue, 23 Jan 2024 00:22:31 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3vs33s34k6-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P2PLA9q3PRYhytpM9UD6obY/MlHu86SNFSb7vyi8FqI6MX1MgUiMP1bsN87UOWIs1LuVpZLZWe/tc7jmVoi7Zydc6BaSGFURnegBBBg6t1DYpkWXmZ55kGnkbcJ6CsXuAZUBsZzSgcKIx9jtsBb9QpC64jQ4vo+5Nzy4yC7P3b1vE6k+PzdaoRWOenqI9bMyf8wB1GGhiOHaM0vu/1AfLzNcJ4PtxGgT33P0nbezNGxY/wosYsnQzsEdMDctnYaiwEQOSlWQNYCg5+8UUIz+NXZ4AYplrMcN+3MvDOatFmNBP843KRNP279r7NMhUnWwYH0s1rEVnQZNUARoczW+UA== 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=xIzVfUi1mtGZoxWxdY70LpgatEyNAeAKA3gvZz3w5R4=; b=QmPFbqyxVc9TscxF6wjX4bUJ/oaLr15fcz2QlD1iREAGsPZ4bRdMzaWpO77zJtTJlBSRIznIjj4O0Jw/fnLMagfaV8aoKKzzZt9Z7dFkwfnPNyDUJMloHVq6Ngmkla3IE8rMYt9xhhhRZIHFkMomRycENYewdVmuN/3WChxyD0dtOi3XIJFzxkZ4fwB+vv4/54hRK3HwytO3U1FptwpMOomiO84eJLs8kJbg2l2sYEy6/gPngSvQYMBDsdwUvRF39ncE2wbGk4lLON1zWeomBmhn4OozA+Cbilm1wLiasneFh28qhWMcRGHJcIZs47m1X+4b+q0G63WOYxBGDzd7zA== 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=xIzVfUi1mtGZoxWxdY70LpgatEyNAeAKA3gvZz3w5R4=; b=GYxkDm6S3G88Ft9vVPdk7SgzQ6vFKw7Sfc67D31N3yJ4evH2gLji3E+V5tmdEkwWbytHs2DKQhjOk/ysficNHeFMsSL2eHQCtBw+PUj0HGCACRPuMTODageAqvh9SQAqc8HeNZOTm32PqpTUNiH5v61v8K8OSZsOoZ2VZGrkS7s= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SA3PR10MB7041.namprd10.prod.outlook.com (2603:10b6:806:320::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.32; Tue, 23 Jan 2024 00:22:29 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac%7]) with mapi id 15.20.7202.024; Tue, 23 Jan 2024 00:22:28 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v13 03/19] scsi: retry INQUIRY after timeout Date: Mon, 22 Jan 2024 18:22:04 -0600 Message-Id: <20240123002220.129141-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123002220.129141-1-michael.christie@oracle.com> References: <20240123002220.129141-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR12CA0003.namprd12.prod.outlook.com (2603:10b6:5:1c0::16) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SA3PR10MB7041:EE_ X-MS-Office365-Filtering-Correlation-Id: 2f486b79-21fb-44e2-af9c-08dc1ba96172 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vSxRSWoaPqgK9WT1o/tn8ru3ESF9glsJTse70pUy21ilEDxSLAkDxfzLn+LF9b7QDo2xGMcCMpoxI6BpZPzovNvZS23Qe1zksAIQQA8+HK4MhGWLhh1vCY5jp2hAIKfmJFZxUxzbi7G8DCajWes8u2AMyeRka0sa+NxFbEsC9SjTLRK4RM3iOFZNc19f59HOM4XpnVAcH8VO3r1h3gyTDmWsfLYCAOJWvPJxPBI5KSwzy/GoYLfobZXX968qjnvU9AFwBrz4WcATETvKkyMoI/IDwsP92Kp9cSWPQoJbVtQHOm/n4nNXC/Nk1j2c6lgsUZqgyBwUl+FYk9UEEO+VR+OtuVfYpQeMt4lfgLBwQ/KgF/4JbE3wGzSYylUZoaWKvu/3OxdbaPU/yVpt/eAr4KEnCFTTpP5GDLo2nBBQc4FMhRjdqVhpKUqI1iCe7rsU//OP+C7jVWoLTHIFdPIJXqEP6NRftgRbO/6cOF6BKJy7UljeQbjTCvIE+N7eBmRGubTzPPTH7gpp8xYz3UC/GiZzwU5EfIk2l4jbqxZ3Df2g9BY45bCMt+X+sjDQMEkObhj7hwkSeYwNQ1vUChKe4MlCMlalMFyWDlYvmAHu3kXaDV50gVs/Yx7KG5g92pL5 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)(136003)(376002)(366004)(39860400002)(346002)(396003)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(38100700002)(3613699003)(36756003)(86362001)(83380400001)(1076003)(26005)(107886003)(2616005)(316002)(8676002)(66946007)(66556008)(6666004)(8936002)(66476007)(6486002)(6512007)(6506007)(478600001)(5660300002)(2906002)(41300700001)(4326008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: frsd3ymbgPYckS+XffiAlRhuLMKeuv5Z+Ok4gWY2pv7mYwwfkS60Q4nLeQw3l+W7bALFEzQY3U1VXhae7XIaEFKhgv+FQ37KT5/4Dn07scqjL/yBtOnAmt5Ufbrxd9etbJqZUny8JdT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7tzUwurJBOfvPvpGRA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2f486b79-21fb-44e2-af9c-08dc1ba96172 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 00:22:27.9595 (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: 4rJFEJbaBc55tYq0/JlvXEnZJB9u28EixCfGb/b2JjgTj0qLLvo4TkOMIYyRjgJGIJxnOjr5z1qeDL8H5MP34lupebR4zo/Nmv00XBYyYbc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR10MB7041 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-22_12,2024-01-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401230001 X-Proofpoint-ORIG-GUID: 9RLQwoFJ50QGvb4LYdrs8npWAMg9xwA_ X-Proofpoint-GUID: 9RLQwoFJ50QGvb4LYdrs8npWAMg9xwA_ 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 a2bed0dbf996..8ded08f37337 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 Jan 23 00:22:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 766776 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 48BFD14D459 for ; Tue, 23 Jan 2024 00:22:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969363; cv=fail; b=mqVaGAHvDbZw4XVhDs5rQvCw5gJ4JcYuJGhk3unnHt2W+skZwRF3A5uobsuZ4GQKUfHcppW2EmRqnYQF8YYJ6DicsiWcTW52+llMD2IrVGjB+IJcEwbbo8r09+5jeLT3wWA+lZsCoJnyU3ycy4228q2odQTGzRH0qzmJSjWQZt0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969363; c=relaxed/simple; bh=b3SBQxcfcW+6zj8Dtw14aSJT+WkeJE0WWyGLJu4Qe0o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=ZT2hQThmXSn74qM2509G8em1MDWYire3HtYaf2qyXJR6NR9jY0f76lvk+tAz0lQRp1E+A8jGAZI3mClcwI+jAnENv9oEcniysGIO6U06vQU4HGWHro57kwbFY/bnKntG0E5g6NFqtuq8XI/yC0pp1GDv4+PN0ydMthhZfHwMsnA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=hk7qsr5A; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=EgZ0WGCA; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="hk7qsr5A"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="EgZ0WGCA" 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 40MMovBo008245; Tue, 23 Jan 2024 00:22:32 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-11-20; bh=zAYjDajbSvI79mZBM3zspHWDMEx6LdW+K2xyzvxT728=; b=hk7qsr5AMld0ZE/Xtw3pvHtLKa6k6EV5HoL83Nbm59KvfhtnGu5zHHarF/x20rX3o5zp IIfCPjKov3YRvCwFfnqxhD/3FcN/1f9Kqk5bglzT5sfQZhWY4OW138RMqZT1h6O6h9Fv ivYWjDODrs87Ti98S4brqr4Fh7v9+7xj1p2Du21L0c/Hlz6BKesp3yXodUfjRgdCfy9R D72K6m9UFU6NPFsMJi1J00dUC0yHB8uxazdz3O6KGHrjLTL7+UVwHhOxubD23pyHudZH BKcdWwM39BODEUvtseFG7NkN/FsoeZYPZOrqsGBDR74Qn7G2hkff+942BGJpAkMVmwY9 Tw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vr79nd2dp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:32 +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 40MMluSv025289; Tue, 23 Jan 2024 00:22:31 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3vs33s34k6-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GMWuEG7f2ISTI1ubxCTqWhGhkE361W+Lc0ciy937Y3mynXR4fVLSma2qvveCZo7Ny+8J7tKdfRdGJCVjyyI2r5aqsMeJtcX5iOi5UBf8nUAxWh2wflQmM/7GzjDeTC6FxQEOdfMiEvNXrC34CoCw9AcTVdK6xtC1DCLPTdTNGBNOaoMLDIIjjKRrE+yKNj3++4ORJXep0qnDIwVO0z2LNOxVlSiM8WEgu0EUOU1tojv7pIMY3jOWqKq2Wta8ZmudxVeap2IHhrek2DN5xU9JKJDgvZxUzuwZWTkbKm4vUEFwS8tIBjmXlBIGcF/dH5LSlMAPhW7Ew6lPuNqziwg9ZA== 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=zAYjDajbSvI79mZBM3zspHWDMEx6LdW+K2xyzvxT728=; b=DQcrR5Lo/hJQwMsKBxBi65UPiWhlC5zXupNN2RvMZPdbzlCY/iSmWyrX+2CoTgkfLLfrB84OuJgDhuK4SjJDUe1gH8o3ryuJWRD9nUTanW2eoLfkgwJsAKlL8VjuU1ZeqZ65SyUBEA/OAfE/7+HVVuVTSVz8DmsYs6397BQG8+2j/oOJSaBPe/rjH6vpeZhlykV+zc8/+ghpyHhJY+uElLqWym0ITyl6AT6VcIt+Dg6Kau1sCF91k0hmRioDXNL3AwHDH/osXVhLh/Os36eTlTBErmBjS2tM297CAhEU3DGpjzCORbMPAS4lOuG9k3/muPYCv/gk4vjcf9yXfbvq7w== 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=zAYjDajbSvI79mZBM3zspHWDMEx6LdW+K2xyzvxT728=; b=EgZ0WGCAtCqZyyuCGXhVMtjKFO0g7mOFuPuhlwIRE6jrO4fComgWf/OE2+ly/FU6L1sc7Ubkx3lhkHl7OQTVe1u8je0qR9+/FV5ylKIf4yVdl35G3qh6DlOPiMH3W08wi/9Ty3Pqjc4ulnaY9KnO6FEVYiFjzuSojhN2xDWwZXY= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SA3PR10MB7041.namprd10.prod.outlook.com (2603:10b6:806:320::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.32; Tue, 23 Jan 2024 00:22:29 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac%7]) with mapi id 15.20.7202.024; Tue, 23 Jan 2024 00:22:29 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v13 04/19] scsi: Use separate buf for START_STOP in sd_spinup_disk Date: Mon, 22 Jan 2024 18:22:05 -0600 Message-Id: <20240123002220.129141-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123002220.129141-1-michael.christie@oracle.com> References: <20240123002220.129141-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR07CA0052.namprd07.prod.outlook.com (2603:10b6:4:ad::17) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SA3PR10MB7041:EE_ X-MS-Office365-Filtering-Correlation-Id: e83aa56e-8c5b-4e33-8b96-08dc1ba9625a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v5DpjPt854LvpWgOKxsaruoAwyHxecE/r2hqqREr435niYzTzsYfb1mPUT87DxLQToe8J5qF7eK83lFjWYUzgdMlAdexq5YMB2gVFbqc7CcpDx5JG1RM0hat2P9bII6362gtWo58E+9okyCEVPMtY8U+YLuiVrTvJ2V3p7JYWffLk+l8LlqR314C1HS6ywXKaYE/1vtmcc6HwU64ZUCbDrfYPWtO/iUIBaED3caPENwUn6BNlCOP+hkRAy4+piXZli8+nfM2i0tFPs/eUv3HvGQ21CJtL+3pQnYk5QYQt6mR0neTfQOGd3bJKHlNbfrQKi6JGC0G03kqJpY9aRwBekeJVEet76hhUPmLhQ48Nl36W20ngsaFPKUJhhZSlxbIIOPkbkpLloJvrK8bPrLGR1ft/wuPgnvofq4r05k3lC7/xfwFz+YxtJk+UrnrIC6Shj0cRTBI8nkIy19IZbmysIzrFlfPXYyHLVoZUS4os/MG0Ru+DncBDzf60vkVGUgBceWhQXGalTnfb22Nz7aqCaCBI7dBljQnYi9tQRZ7gOhaFvjoeJJnZKwKKWxq2mqa 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)(136003)(376002)(366004)(39860400002)(346002)(396003)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(38100700002)(36756003)(86362001)(83380400001)(1076003)(26005)(107886003)(2616005)(316002)(8676002)(66946007)(66556008)(6666004)(8936002)(66476007)(6486002)(6512007)(6506007)(478600001)(5660300002)(2906002)(41300700001)(4326008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sZ7V4hZy6bWfruhKyuNlD9AUXhAaddDVQ3QQMskbD5psYRsm/+qWlIInXhnILDpU5SPdX/9z2pWDm/pNMoCCm86i3K8hkzS9WIQ6fZ3WL/JAxSKFiAgaCq/bSOsG86VmL6FEtAICSRkl2cMFd5LGw5LPwK6ZTliN3w17EdeA7IziDyDnRF95IvkcRj2Mhsyxf+wDbSaThcVkTM77xgHgKledqBkKdc+kuDLdawj+J4hD9wRuDXY2BqpwlP5EcLcPm4zTOevXLnvZFDEmkMyc5F2Ozu0veYzENvp+G96WfCuoA199/08Kcs9E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sqHiNHKujTAsmHubTgAmOFm/gxbmgkDHAsswq6qEE4I0TeehYRA+0vsvgFSlB4VWZAhaTU3THe4EG3EuJEyZd1GLO2l2C1XZXSPgs10dNGRM/Fo5rdLzvgf0vm8mWU3OovNkZISHl15z0lSv3KCSV4K1LdbnyyqTxDQ/jj8NkBiyaUGlEl5Iy78NMbXtM/bXjzx0MSSawRnHsKFdApHmWLQSxrWGxJ3TlF7qDZTOSc3w== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: HQAG9ztCU7qO2kjF3EsXk5P9VokIF4gkNkbtdSYKwC9E8GqqTKH3WTnX8UG2BmflUXywxfWdDGjQsAxOKESfHoy3Tl86rDaJcdKGlL66Dyin4AhDlq3q82oy9UtMqHnygIZ2eOcsz/3BFgQ66be3xv2G1lOMP5wxWyEWrd5yY2zZBORgzIcRmZMOSMbtdw3dq05gW6LSvtXEZT+FzNQnuh+tPuaHjw6QuvSBxF32sDciS0hl8AWq7DfeaseA6j+K0u5ZrUtziAfsIC16hZxie4c4Q3Ow7CzU3xl9I68nxZwx+f6i3S1xDsoAqKVTk2oHE/7aS8UaYxnXla0vteAODveWy4Hw4utjDGOW3AjoGZe8xdeNQAc0Z4hXSun1IK1F5wEIe8gd+4qNIM9zMF4B60XueHWWLDzCC+UhHMTAUNEaYU9UYRCdGv3Q8e9xZ8fgGI+iSYbZQInDSvU2KBnqlqcsJsu+L/WzNVQuWlWSN6FIY1L3ZaO0oNS2YJNxBL3/VdxBB7BM12WSqJnhpjNqOkqObH5ILnlESSFBaqQGt4IB5qTwJw0i/6wpTKKP3OnvrCrKN3epnAdNEF4bXrTjGiiiIjig3yWHDWkvnA2x6bI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e83aa56e-8c5b-4e33-8b96-08dc1ba9625a X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 00:22:29.4334 (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: pqFwa053/nFACNKK54HRm4ze60l/MyUY9+BJUKdDIkrZxHPLB8rlHsL39ILUeaH36hiPQFCFVyujB1Ew0KH5W1Kn9JFqxqgJUWdX8NOVJuE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR10MB7041 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-22_12,2024-01-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401230001 X-Proofpoint-GUID: 2ssjpge4WfegKD7ljfcdAMQTmiqS6Fa9 X-Proofpoint-ORIG-GUID: 2ssjpge4WfegKD7ljfcdAMQTmiqS6Fa9 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 0833b3e6aa6e..3d85913d373c 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 Jan 23 00:22:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 766774 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B618C150989 for ; Tue, 23 Jan 2024 00:22:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969366; cv=fail; b=QR/abbtnanzY2ecd/r4hh0PwYZV6eRtgFc3w1PdS7d+8vntjDktFxDz5jxPqS6+b+sjHzvlXb/mFYuMlsBDtjfGRNQVnggxe2ECOyZXopdcCL/jsM6/FM4+ousJJ3lZUQyZNrULiT+7VodDf/wbYmDfnCsDgemYzK2VIS84cLmU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969366; c=relaxed/simple; bh=uusAQ/qQaNuG2ylItBbTUBKRUY6+5C0ld3rN8R8SJs8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=jp91I8cMM9jeBWvuBCyvesJl/SD4DGpiC8KA3UzHcUFLcXczgRADzit4KAmkalQEixS65U4NxpmCoKlCQ2AkUMiBNO1Llrzz3EYuZsylamH7BNLhvs6zzFRRnk7N2naGfT4rved0Bljzkg7CzOv5Fm9+bnoEcf/2LWz88eXEy9I= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=Qw2HcvlC; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=DsA87+Qw; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Qw2HcvlC"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="DsA87+Qw" 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 40MMofRt022150; Tue, 23 Jan 2024 00:22:35 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-11-20; bh=wIYqDJpqcPj0MRbLkrPZjcUDcW6acWq6+1asmTAHlRo=; b=Qw2HcvlCkYXrE8VXJNjR2EoTaWAzjvHcSnDByqbrYd2164gHh4ye+It0KwAJWncLqSpI ihKNNlqi9N4dUU0Eri3TWlzPtlxfU+Pm7cwsLqOaeqAsowoJWp0QBXkkpovh5YandwgK 6/6+vSQfYAV8s6zr4k5aeIuK2u+UbcHpj/POv0ICy0VUBFdiW8ACJ5uaQNKjPpoBznfv YIL56wvMjWlK67vEM+bJmoaUGXASvcIFhl+E/mSTx6IeOsoCW+NKJDeKlAmsCTisRcOb aqlpMgUPMP2V/XVfE2RhJ1avPN6hTeaVUWrXeRkFapkU3CRnhT5hhnuYnsDs459WF+TG yQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vr7n7vysq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:34 +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 40MMqMgY013112; Tue, 23 Jan 2024 00:22:34 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3vs3700jkc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dGviFP6vKrihzxT/BPzZSbjgBW0g6eqgE3INpx2vlj/FeVLJr4laDg8F4yvyd8pp2E/s2AcjQtCW2VxpAaN8evj4IzeluqXBW+btyQPKropDFz7fliM/fTDyD33PB3V4AZ5TZB0h9tILV5zfu0bwO/6LSiWyXn71FWW7bmB17dM1Ts6ej4HJVXjmgXZz0qrpkjnno2z3EfOHDxMqqmH2KwqCDWCsbMTbz+7jq7sUUMS4s1gZqsWRE86/Te7IBGu/ksTR5kzu6zhEfDQql+OLL/eusfMO7n+Z+s39EeNerMQ2iiaTBls6qfIKoIvDwZTSGRVMBR1q1qtyOOBqxbMDKA== 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=wIYqDJpqcPj0MRbLkrPZjcUDcW6acWq6+1asmTAHlRo=; b=br0mACuo7GgeOoaYc3Qzv0TgGWIFlhDyXeA2mFU/vnLJYuBsk+FKk+avhKS5ohzJdBFEbthWDQVFOmrNqFGvTvGcOK7bs/ypPSsu2ueMeklG8Udwi47soeBoxEaI6OObdK1Af1tEljnva4HePBUuQBatMrk+ys281WnbVLmVf6+aUNSG1eq40CUrR6pD9NTpO6BXk91iZhNc4llT4HxpKxvJdpYqgbG/Sek6o5Nif/3TUJQ4i7F79Aw73QbRa047Q0+IXqYzA3O+PEYbc15khX+jBQopWDV2TPhxAy6oRHqjmtTzdf00Tn+Oo3ClxD7kbr+RtGDHPsVLhRHKuRJchw== 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=wIYqDJpqcPj0MRbLkrPZjcUDcW6acWq6+1asmTAHlRo=; b=DsA87+Qwi9aj0+dVtpgUCmqpqk7JrVqnOv2GRX5oZTVbn5jz8irWulYEaIKl97qrtMKUt/IiA7UBpcQLi5b9JHsNjJMa6W85nC8hy7+Gf7DLc423zob5lpbdQsi8QffR1/RAkJycAliXOewsOYEhb2UtepsHxp+pBKPKeOMxiRE= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH0PR10MB5340.namprd10.prod.outlook.com (2603:10b6:610:c1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34; Tue, 23 Jan 2024 00:22:31 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac%7]) with mapi id 15.20.7202.024; Tue, 23 Jan 2024 00:22:31 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v13 05/19] scsi: Have scsi-ml retry sd_spinup_disk errors Date: Mon, 22 Jan 2024 18:22:06 -0600 Message-Id: <20240123002220.129141-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123002220.129141-1-michael.christie@oracle.com> References: <20240123002220.129141-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0101.namprd03.prod.outlook.com (2603:10b6:5:3b7::16) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH0PR10MB5340:EE_ X-MS-Office365-Filtering-Correlation-Id: 37ae22e0-78c1-4678-e2df-08dc1ba96342 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dk5Ot/J6ASCGJn0CMDTElBR6vsr4mOg1uz3Dc7Zj3Q43gMIHxZepYae+hY5lUVaQ7LuM+MWij8gHHuQ0f2J9pHKthP7t0ZlVdpEm52UHyEqcBlO6sOLzlcntyJDibpQs0ZqtRZbSdH+RYf/vMxQQYy/Z+KIYF1MHbiQxvH8O0endmBfgIqZDvCaIy7FzMTtt5m//fDmyuMy4/FQnnU+Lr/AwqeMd/VzEXEtvCeSQCIbJj1AHBNpVj49oJEGq5z0Q8qay7ntxsZ3LepvrtNy8Hh+jM4zcKLNJPltDdhAgn7XUM12+GUW9XI1X2VwD9Y4iC08Tw/imx8kcTY9dzfQHOKu4oH+J4YTTljhVpB/ENcU0z7t/ni67yBWs48sPBQYMS7P2jSfzlIx5ekDb7QUDzDHf9zvBJgKCvxzw2z70gKevcUk0srTbL16XV5Z7Azc2v6O+EJldJ7JViMZW8c4x6+dDfuMaCuHG/KCbt2qeZrqd/VExHfhu61Moa/xMSKAhx0pjKrRn/WRJYUcBfPKCqegLDaXIwCg22EczEwtIQidZNFu6PR1LwxUjEsPfsU5j 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)(396003)(136003)(366004)(39860400002)(346002)(376002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(2616005)(38100700002)(6512007)(5660300002)(6506007)(6666004)(83380400001)(1076003)(107886003)(26005)(478600001)(6486002)(66476007)(316002)(66946007)(66556008)(86362001)(8936002)(8676002)(4326008)(36756003)(2906002)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uMGCXM4XUeEbMsVbbTl+jglr8mfHFn6TwPj+qggxo+32wdOmEvjq5LvQU1ptjACAq5pMOdZeawIxe6/4huswdDG5hzZsuVYLbx5lOU93fT6p2ReO5kTL5r2+NtM0Q2n0jlzE0Lf5nOVnh4O7gfQs6SQ93EhD5M13E0470bUisdclFBqX6+ZOnXqIcZqoj9r3JyOJx68uEi1ctv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Qx8ToSIPDFbPsna/ef25M8tZRpeJEo2dSX+nZLOG4ZFGm6ZIPAnDw8w4F/5OYfvCeuo4g01mJIOy3QKz75x4j8nLQLrzIguVYibgLBz5Jl0lSm0sHOXnK+26wLbgMLGnMNCWLpelaSV5SZBlRR1EnvqXE1+O3zVl70SDkLq1Az7tyAd3elKJVeQi225Oi3QkJJehkS7MDq6Rn/nydJBRR7lSZD8MbNSkpJNHbK+I+zm1yi4LVl+0ITi4N+WT31IoVpRIbckNgACEVDylfSlhUPplwoKoTg/ALGaVzD8nk3s5C1b0aayztUFNnf2blK/qEw9Azn3WmIT4+UC5A== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: DtBagNPPGKb0h/CDEddTwUehxZfybpnpRpDNMlsrVCmVgzztJqSrcLKch5z5f2EEwp5154lEZ+e+x2irFW9w7V7H2nRuiet70TnqZJRwGXCMVrb9ZDIM0F3J+Jda3l1WFqK0Tg4Fr6OUONORXzaVWdMY8XlsUS0Q2ZyCDmZDIF7N2S9jKvLsCkM59P0q/nIC3sW+YF9l0K010sDwJYcfbRYvVR3IZEfkRcNFYViFFsRoMNDkCIr1XUHDYf7zPxC4bbYqVEH0AtBrj36TI42s2bb3sBp34ooWxbLAOJfERMuvr7OxwEw7d9X6+xCnLgIeNO4HhyPPdhtL0hQEhpQNnEost+MDkcOr1TSfgBOLfiLEpmc0OYXFECD8XpBnJ80sOhpo58nmiD++V619dteX6bCgZXGGJD7eoGBLIynragxQGSD8yq/3RBSzA7F3Yd5ar5beSPKSahgACPviqmU6SFIYPlHLb/iIZFykgeDggYqKKDLR9FJASyS1E+tg07i9xuLQwLf7YikRhPpUBW4BeZ/5g9eu6eaT9KNKOOyn1teDdrJaV42wI27Nrab7mok5GO6SWeVtoqh5EqfSg6+ZwBJgDQ8nwl1Et48aBBD4ZhM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 37ae22e0-78c1-4678-e2df-08dc1ba96342 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 00:22:31.0038 (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: 7BVKXf1gbRJX8Kj2mfM+UKhcFG9Dg7ZhXjcEfToFHKIGPwXHWoEWbXEE+DsCDMIFyd5O4v4s+g72MESS4593jeMfwZesw7szZNUt534cggM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5340 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-22_12,2024-01-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 adultscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401230001 X-Proofpoint-GUID: D1l-g98T2L18DV-ykDU4GTn9l1Ojrce8 X-Proofpoint-ORIG-GUID: D1l-g98T2L18DV-ykDU4GTn9l1Ojrce8 This simplifies sd_spinup_disk so scsi-ml retries errors for it. Note that we retried every UA except Medium Not Present 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 array entry for UAs except for Medium Not Present which we don't want to retry. 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 3d85913d373c..cb240015bde5 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_failures_reset_retries(&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 Jan 23 00:22:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 765551 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6412A14E2C1 for ; Tue, 23 Jan 2024 00:22:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969363; cv=fail; b=LdIFL/whv8poiSfODblcjUwWKLLGlYEkmXOLWRlcuk6Vb5UYXCNld90cDCBCbo2NZqj/yv3YiOCnLtQc38diqsrg9SQHG/s0A9lOrKXZfTWSDqDWznkfPYM1Vi0S2KQOjpM3Hyq3uUuLcyH3uwSjGagsBL0kO740S/9dLlWH/Bw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969363; c=relaxed/simple; bh=Z2s1DAJMlboxwFQ7K6T/a5eWyB9BCDfWPEOs3Sjc/BA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=V1XCZHT/0nc1m9wy3jNuOKhOmGaxeGDj/sMarts0rYpM0WL455IbPD2FK1Vdnatfhyk81GMQqSJDE3fsKiOZ0FbwdNI4W7aIWVwWpv4VJCobT6fzA/6u0t60HqNDGJfCx5GpJe1Qu1jOGvcD0zG65QHc+R+ysgLgmVy0hZKXQbk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=nzLVv112; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=YL/9K150; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="nzLVv112"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="YL/9K150" 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 40MMoq7d026501; Tue, 23 Jan 2024 00:22:35 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-11-20; bh=GumYsAdzRdmAjg7ud3icqplo0EAItN1svWEtdMeRs7U=; b=nzLVv112Bz67/t+J3HeSEuAu1M+fziELBrBSe+Z3P4oQBES2RglVy8npkPOwNlTkf1U2 3aAuWF2cnMF2bIsw+JH7b3+blf+fYCfBFTFDGhNGBfOovQx8qNZ0XCZabWTpDOK/b1iJ WmKwMFjzHUIapChS0w1iVybO34MI/w0KgE4osEW7PeLDaf3tza9uHAgqEH4fuJDOQm2B FejVjYmsBGzWDg/uYlbPmnWIwko4U1PW63Y1NXNY62n9sW6PnABOTYxfIqKbyjb/JwEs phPGQanQlokQ97wzjRbLbgNwsOqVPd1PKg1IrF0Z/lZiVtva0OMr+WubIpgJ4QKeXWCE Fw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vr79vw0w7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:35 +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 40MMqMga013112; Tue, 23 Jan 2024 00:22:34 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3vs3700jkc-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E+B66W4zzaPkwqwwjnv5lyZe6fQBlw53xGS+D/0nn808tcITEYK9Epcth8FgUKSWO8JqaXmLdKTX2GNGHYpggHZnr0ggvUXmBYdCPOlbwKHfCk/NvdvO2hwOWMN7SBmxpxf0o9ZYIy+SIkj5ONWaTykQDvMRAijRrz+I3yzMuR00V00FZ2pvwxZ6UAUOvJO6A3kmYHswnKpkmhvS87uVd4tOPEOLhAIlTAoXiisWa0BqgjA7qk/W8NUgGqHk8qRnp6i77d/dwV3OKnk5eaU4h2i+0gTOYrwPRaEIrcEMSXvWUEXKwn4y1XmfftnRm+gQID0drfJTIcoqjMwma4KYzQ== 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=SDXr4+ef6mb1pa8C+2BDe+LltkArw8BEPs4XQOwlx8VlUIV2lSCEIlJ23Eowspbl8HPD+KqRmK6gINNNDyAbggb5cEVTHCMvlYGA4Y+e2vLFokQwey5zhD5mfH9L0oNEjBBzCKpW0JZNRSYfLSKwfecRJHLXu1qNZzuq+HjVOrIDrpwM13VM3I/WDMOI+sPa8TY4dIDmJpba9pc5U7gzzW2AtbIq2Y00wwEjsG+tthhAxS1wdLyTPXgayimr75xyKCoCvM3zD9ynic3tX/Inltv4XKfb30KKd/iKFl63N5lhKyvibAHJcp8Dbk8fx1OislPBgM5v4p6CNpCZ/KUCYg== 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=YL/9K150iqBkwKr5lCuR3zYzguKiDqT1VNvfMhVd6eef9nT8jvPzW/IvVXz7d9JEtMREIqmuQYBcthlwGlMNPW/DvC/k1is43sa36SdXgZCk4Ln/tS3xbyVjlHVhA7wOtrZ2q3aojLH2/kXAmuv3xCWoVFEJd6KU+OTOJgMlio0= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH0PR10MB5340.namprd10.prod.outlook.com (2603:10b6:610:c1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34; Tue, 23 Jan 2024 00:22:32 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac%7]) with mapi id 15.20.7202.024; Tue, 23 Jan 2024 00:22:32 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v13 06/19] scsi: hp_sw: Have scsi-ml retry scsi_execute_cmd errors Date: Mon, 22 Jan 2024 18:22:07 -0600 Message-Id: <20240123002220.129141-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123002220.129141-1-michael.christie@oracle.com> References: <20240123002220.129141-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0119.namprd03.prod.outlook.com (2603:10b6:5:3b7::34) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH0PR10MB5340:EE_ X-MS-Office365-Filtering-Correlation-Id: 9bdac062-dde6-4a05-0006-08dc1ba96400 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: E7j0dtM3pOADTztKLcBcsnc199nzqZNDHmESTaF73YUneu9QZuWmIZmGkMQ2+t4CHZSeCqxsvLzNq0LJqkhLFc3f02jSEV2y8UXjrueBu6HBdHLqqd+IXicr3bCHUb+X+3p/Oo8LyiVo5Rvq5a1G31Yl59xsqg7w2kR1CFFb1NzMH1mspQBrh1Zl9+Sq16JsnOKqQXmPbclgYpVtZqcdjmL0/2OjYilN+Dg0Kpo+wV6G/T2Wi7dCa/i5gwIkxNVmtlGRC7y4vwFgTmcT9xU/1S1or+4xZkpnKLpQQycwpkWrel6VwC+UEKI1T6xfOZ3muF+Me0fkYE98kSdFzrXniFtIInKLrAzXnVV4G+aTvVuQA5VDFRq4EvckMKM6Ob0Xi2K2dbGtC7omANJfNX844kTZYOfjKFWDu7nIkibHiY3CvIvvmFqSftoivzoRAfSQMHWjqDDpLOFecyXSOZloY2LRiuW/g+IHLedmNAuDa3qTgWDx2TSQwWMG8MA9LZc8/SHxugJbY+Y7HYxE0eEm2BSYo2yL9zmQvOGO10IU17QtRW+7xkIWnC0XYKuxAMPWhLnOmuAdmSI9d4lycrG6OVGsyZbqZKMENhh+IG+m2WadAKhSn2WcuyeElaCuyWf3 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)(396003)(136003)(366004)(39860400002)(346002)(376002)(230173577357003)(230922051799003)(230273577357003)(451199024)(186009)(64100799003)(1800799012)(2616005)(38100700002)(6512007)(5660300002)(6506007)(6666004)(83380400001)(1076003)(107886003)(26005)(478600001)(6486002)(66476007)(316002)(66946007)(66556008)(86362001)(8936002)(8676002)(4326008)(36756003)(2906002)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NMrKsbzNcNjPUH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hoZZUfIEHk8yT9kWUHkggBVBigca5nmQW2HzA1pC8y0SqZJGEDchjKs34SSvqW75oOeweENOlwvY6BlewpidZ5CPJcIk35qfDyE7vuknK+IYv0oT7ALacRGpnKs0uWFTxllPz/vG9SfYJ/niCCAJdJkPw76lFFTxncbsn22kOZacYcF0xls6aeC6VDei51OKenL86qbhjXfJtQ5kr5ENt9nIGJP62KHhe/5DZUqk3eA65lpCMKMYHMw1LxeboYp0RykFKlmBl7jbE+Cb7gmISx66VOoQbDm8q58dFemEsJKJAuXw2vLdU5NRALoWV61Vrtu8EBYX5TdMONx/ER6DU04VThtpMsKRAFDjPFUeOh6dUq9fxknVjyLyE+WMD2IjWZP9fPOKVQzguY5h49IGqssTVZxUizpsWyVljHh9gsh84Q0aIpV+gQBN+aBcXB+FaTIktyCTcGt2S5k9XGXZSTZjh+tYTd6lP70FbfC1WyYsbroz/YfPCM5VidKTxifp3VA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 7kug5zIvhC4rjF8KwpAKX2xyn77k6HbNhHkrHo8JsFwBl7JtY6kPvJQNW0PSh++EHnAccsW/5APE57jB2xfSJL74BOmBp0JZkCQGfX0sWbtSrPqh/0cs0Vs2tl6vbLZy0VkA6VvmNm6i+5lUPeFR+nWRaw24hENPXmDL4eL5PR8TQ1S8dBubw8b+DpIt8vnPB7qphQbYAGMC40uEjtteAdOLChBpiJSq6Icl0DP1okO9UXiIa3VwdWK64KZwpXaqloJs6j6p3gruu8orIb86cbRQSTxyjLQuJdR17Vi+WQSCmuG7vyCREUmzGl0QaNInp9YIJQRtHvM/pmkztXFCLate0uxA7r5/23rrgRoNqZ6C0aTWJDnfJxs9JKR5SAjFAyPDymYPbMhW6xnZRPTQMgYmS6mzNM6n6ts7FMyqwFRr2gQ0amCu9t4/CYRYqZuZA6YWl3yAlTvXZUzyL8BMT6oZuh77zZKM1GeqBQtDp1qXOsGo9pwJOYcm/xnLQ9RYTdXXhpgRF/UGocohGPE34GTjpY1IJxkHBi1Ea2e5Zlc3iyexGzN3H5lvLC3DTGH8ePjCL48Hvmfn9g+udBI3xy1KILkjGnnyRZW4R/QrYyg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9bdac062-dde6-4a05-0006-08dc1ba96400 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 00:22:32.1977 (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: goAMGKBN+yhIG5wCcc9rlHQlT+ZHyIuD5KAIOBkx3UsZ/bXuu7bRGZ6W0mHwm+cTnxqGog5d12y/U11BV2fbR3CT3kYKOsJnsYByPZZdKi0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5340 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-22_12,2024-01-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 adultscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401230001 X-Proofpoint-GUID: uGt6jK7Wm1kGtd2pZj5tmQ66OPyfYiqQ X-Proofpoint-ORIG-GUID: uGt6jK7Wm1kGtd2pZj5tmQ66OPyfYiqQ 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 Jan 23 00:22:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 766775 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F53514DB77 for ; Tue, 23 Jan 2024 00:22:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969363; cv=fail; b=PLJE0HtcX23v4g6h5hVlARXcD8kgk1eyH+vmB53UO3Q3tdfqv79RHEAgs2auIAxIBmG37fFUPrsSH/SRiIT2/gts+G0DizqVvnJ2M7QQpoe7QINZvre5h3g54Uta6rxR07MG1xz6tjGv+6MSOYqM3iXalheuSnwiosubRchh9CQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969363; c=relaxed/simple; bh=6Fok6q8EFJzUKDnhJU/p70GxQ+adu6pdeNod/uJkGmE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=s5ZnVAw5LTu7GzWSDL3i31B2BlUs5VhzL3RhCrTFHCrsGkXBuav1HLObRK+iXCMSl1SIuVbwBnEU6Cd3dnOEw02hRi3ikvr2s3q0tx4clt6IhoSEQp/1IRAyYrDo/So7SMOxvu+UtsasNrhieUyPmcxna+ClfLWgSJvW9Gymkls= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=FkOmcNYF; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=BO1Dg9rI; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="FkOmcNYF"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="BO1Dg9rI" 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 40MMogLr022182; Tue, 23 Jan 2024 00:22:36 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-11-20; bh=Jxsb0thGeaakGaSIIjW0c1lUqI3rg/gUtemvguE1cQk=; b=FkOmcNYFOGM9PpxWbYahrwDabOzMNQOouXoNB/ZVjupMgD366vTfENgcZlQpfRwypWTD RrJMUGQ77qQVkkx2+cnnp+v/uv5BMiATyhzfkrPWdEaHcDELk8K2d5AT425ELvdPy7ke VQsuUWa/7DIlKmieHUJv0yl6/rXF+N/Ul4/DPLn28SxjT1Kk+BICdY2T187LtUhMhQpP IDEDW4WMdrletJreZq4OeR1rxJsHbUN1kI/L9FNJvfwCCZZFrzdMW7529ibfEj5SXFhE JKAkhMsNt6mfJw7gKGdDtSF6PUQBEmPOcUxYQ6gpq6E6veqPeis8CBp+vguLBLeO6plQ Fw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vr7n7vysr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:36 +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 40MMqMgb013112; Tue, 23 Jan 2024 00:22:35 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3vs3700jkc-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QRY21LYbJR0Z3EEnGs7YahGI2e6a68BWkFe7qh5vScWA8ld4X0VEstGQkxbBtKPMKlmXq+EiT5AjaJ+yjyLLwhTYJU3WSNEKBnApgY4gckm5edVd1ZAi2GswlfLlXDmZfoih/eTn1qsKhsABTo+iS5R94VjwGDBDM4QsSB4J9KDnIRsj6YO40c9ASwCAnExNbk5VIUV8RRS34dxFzoTcb424WIfCz3i9UpuKyDe5F7yV0PzisJlSEBlUn8OhQNWCaMonI9fsZICzB9UwJVp+1jF5VY/pHEafM9vzfEYxJFquGUreCtDUc+iq1S9LGL+LDELr7Y5ehB2+5NrJ9p4xhA== 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=DFCN4YFbNKyDgojPsGkEJD++iJOxUh9lOY5bxl23hwuviPN/rxivq63VqvI8dIt5gmT5w/JQa59nClTVlOmKDaVBQ0HnfsgyLQdbGVMZohCzuyk/3mjLwulLXwVhBp7rLV+lfGX3+atmbUcj79GSIdNNN4HLHeTqi70L1iW7ZeQr4+5qwwAUDURNN5P23Qz55g3lozlm2VV9Tajb+GINyQdGQEeZx68JOBzSVl7smmTCtYdgIrNPEZqA3dLtz4J02rJOrV8XEE9PO1j2JwIvju/LPwVCYky4IB5TKvE6IwG/Jbz2BI26kCIMqxH+R2/8YrRm4iryj3V/xuwuqq8yjw== 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=BO1Dg9rIpytaOPHHokxAVvVFHa8XBnQHdj0U9PO2WqgUjolni+iXo6XRLoDCo+Mg6INRj2CoPPvSox7LERC1OyStvqaEYftTVcfppZLY4zDoQpKzseOnlncAQk53UC+3uXSUn+htDrTGl3SPEctLbmZPXkVMoaC3hcQAHi6s5IY= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH0PR10MB5340.namprd10.prod.outlook.com (2603:10b6:610:c1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34; Tue, 23 Jan 2024 00:22:33 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac%7]) with mapi id 15.20.7202.024; Tue, 23 Jan 2024 00:22:33 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v13 07/19] scsi: rdac: Have scsi-ml retry send_mode_select errors Date: Mon, 22 Jan 2024 18:22:08 -0600 Message-Id: <20240123002220.129141-8-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123002220.129141-1-michael.christie@oracle.com> References: <20240123002220.129141-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0323.namprd03.prod.outlook.com (2603:10b6:8:2b::12) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH0PR10MB5340:EE_ X-MS-Office365-Filtering-Correlation-Id: ae33878d-bdac-4583-d6f2-08dc1ba964d9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7e7YxYknPGPClmAi9gxZXeX3hqwDTf9bA5DsmPLbgQ6Mzm/yESXLPg5pn1fyn5yQunb8BIhJyIGEDABKOo+G7efhpOh0w59HAPjpH9w+MULhDBv4/xOjuF3kyms42fbHlhUEMfYg0Nir+4UV2CTHT/+2lAhcYlRS4Lc39T/s9jVg9304jm7NDvQJokHx3SQk0Ozm9m5LacqwgcZU0rqlkdeWVgqtt/mf+/gs0bq/ttBTMRyQdE6lWurHVipibMyqT7gK7SlxhmFTKXOe9iyHLXCZSYPB0uGCls9RvallLf4lAy5R3PV7iKlXGMkLyCWm+B3Rzs76Z/zNhpGh9dVZWKfrETVBZYwoofW5sM3SypixRPBFc7SfDMCBpCBqcbVAPHDg7QQiNfiZrbBAZ6oRmIh5PAvs4Pk59mY2tI+w/Xfi5IEtwLjaXjkl4YiDfJHVfmgqNEoN2mJcoTMeuufUAnQtl9iFYQOCESNHAe1s0mnhKHXa/sEjGlnM6ME/wXIEDADlus7wbSaukRbb7289lm4WODOL3qzOkU281joOLxY4Eur0+j4EdiavHSpR+ViNt7tV2+fzqbjnGH5wChthzck5xkWKL/+9XC/IYK6Q1Fi0CF1EwHJc8meG7dql/iSd 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)(396003)(136003)(366004)(39860400002)(346002)(376002)(230173577357003)(230922051799003)(230273577357003)(451199024)(186009)(64100799003)(1800799012)(2616005)(38100700002)(6512007)(5660300002)(6506007)(6666004)(83380400001)(1076003)(107886003)(26005)(478600001)(6486002)(66476007)(316002)(66946007)(66556008)(86362001)(8936002)(8676002)(4326008)(36756003)(2906002)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bC5F6Rf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iI/mhsIuMJCovEj9nYPBe03TBrKcND+LnpeZsz9ipJxNpJo8f+Ej5iJFooCYTZKJGrkbDn+s0Xjtx8j1pRqkcNx1vBtrwqo5eVlka3nVQXTJQqMTYSdrXtrHbMWwvQqhwAj39B4v7ZUwi+KqrMW4PHiY8R77X8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae33878d-bdac-4583-d6f2-08dc1ba964d9 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 00:22:33.6379 (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: GtH+Jkd8cHGl0CRdI9rzwrbw/AQGXrXmJ38934jUw2pJ2tnvbOyC6Cx5w25WdqDAATIcJmCrYJbWnZmNg2I5xC69OWJOMbmBCKY3gMAkk0k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5340 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-22_12,2024-01-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 adultscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401230001 X-Proofpoint-GUID: JeL78OmWIaupN2tksW0Mx8h8iB9y6Acc X-Proofpoint-ORIG-GUID: JeL78OmWIaupN2tksW0Mx8h8iB9y6Acc 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 Jan 23 00:22:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 765550 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B750B14FCED for ; Tue, 23 Jan 2024 00:22:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969365; cv=fail; b=RPwCWutSnrxqKBW9t52jpKy9qADdCwQxz19tA/uFLXh9iWjSubK8a19w70o+MpLSHJbUlNzOVlTTkbg0QG+yDUq54lAd6V8+CjvLmXt+lof94kxK4Ptokjn6CkmQlX9QySG64MW/kSQ/yFT55BC+/Bp3uHxL1OkDlIFP9WWuurc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969365; c=relaxed/simple; bh=zIKcvgfSbyx+WmF817+LnBLC11W8Scl/rlVlA2Nw6jU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=dEHE/e9pUJw9M/MwZ8RloOlOy/nw6++sunOdFSqHjrGV7BOr7aaUU0bMZlxaGLf3EJ8tXY3U3vf+2ZA+au43ZDymkIVSFvwAiY69xZ0JPeEvzSTK5PIxaIdL3E9/VtKmj2WjGF5RDmQTGiWZ1kzxnNd/dpdRNNieMOaWQ0VBZU4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=hR2G80Nq; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=JStgJBg1; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="hR2G80Nq"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="JStgJBg1" 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 40MMofFX022177; Tue, 23 Jan 2024 00:22:38 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-11-20; bh=i39wCHhIzVAo4OQbG8mHVVOsp8SrqraJXQtkBId8LIs=; b=hR2G80Nqgj2OCDuLSms0sPC0UTVqUTFZcr19ntKlNqLliprcLda2QbrUKy7Isa4Q9eE6 64zg4fVXZgzf/J30HARbyR1touOTVHSbLBqPJAZu30Yd3nr4y0Jod29T40MuB4JQTzvH +QDLD10T4Tw/Aldmi0XSC6acT2bWq9I9KcyLXoPGK/wubs0r96AnS447hemzPoPcBHsv UsBEj9ZZygsS7hOoV4mQgOe0ZiYTteqZD5rOR78aIZXf3ObRIHghGFQwHc8vBcqtIFZM s1zHN6X7LMZDoryEFsCPCCj4KtiLYog+C67TyrvDAcTU6Ji9nArhQtK2zaZekBfgtBjC VQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vr7n7vyss-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:37 +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 40MMex6q025344; Tue, 23 Jan 2024 00:22:36 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2041.outbound.protection.outlook.com [104.47.66.41]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3vs33s34ne-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k8+7VrBS+loT8kQE1oEIhj8Hbg4LvHCdMTxtDVRk0FUnOyBb1NA+u+4jJRDoZbB+JJCr1AmgTV3zpcbr5WCLCECVM0meHSxyo+ao53bVHz8xldu+felOBHyc//dWiLjq2NhpqUIPxYH7ZJwtVFEchWnZBIx/y0KQ55dyFHpY+p33PRwuCptNXImYfzHPvgJQY6rd2CisDX6akQZZE3dDOuSx24u690bt5Lz2kAG1EdJFkt8qRw5AkOwsyXAsLYXSkp1l/ANnni7+HPw5sOJ5fwf2ThYhm7TZ8FNtBCd/0dibOK5qGVq3pw0nsFcWn2yc3LE4Gkdl1fLwuVvYVxptBA== 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=fzDik4Zavu7ySCTJo1JSVuwtZqLT9hI/M/cX7JXvPXA34nViBkok8sX+fgD5fXhfzV1AOWT6tZ9nfxn8VSD0K4eNm/TIPvEd31S6N9sr8zr85rpeaQFwtoDMWjOwdR4t6WfST9wwIrdF7u+hsxBXVmiGtfvJbcTe8PH/yJAgQvdIWNpJCCCkAp//TSQ4OmydEMH8WLPAcMDbT2WIJ5d/BeUmYmbIpw3ty8wkrAYYJAZxhjr84woQWd2MORY51ZHQC8t1tNFvNpkzfz10ZRg9YWBVxuAHwwddlIJcPmiIvxmDnQ2+SY7Ja4JF3PL5Jyq919smHCLOHcdLnfTuqWe8Xw== 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=JStgJBg1wdsqhtuc7f8qdKAlYj7caOPxwt50YU2qShywcl9kUByDAVLX5cyHw4Onxtd/OMXDgFm+MlSyVIFo6TCplhzWORghrmbBcVGJuyt0/nuk2TSAAGyBHiDj7tEniiZtkIV9jyCxwmY2Y99rYoZAMi/uwqXhHuv9Wo1FsVM= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH0PR10MB5340.namprd10.prod.outlook.com (2603:10b6:610:c1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34; Tue, 23 Jan 2024 00:22:35 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac%7]) with mapi id 15.20.7202.024; Tue, 23 Jan 2024 00:22:35 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v13 08/19] scsi: spi: Have scsi-ml retry spi_execute UAs Date: Mon, 22 Jan 2024 18:22:09 -0600 Message-Id: <20240123002220.129141-9-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123002220.129141-1-michael.christie@oracle.com> References: <20240123002220.129141-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR12CA0020.namprd12.prod.outlook.com (2603:10b6:5:1c0::33) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH0PR10MB5340:EE_ X-MS-Office365-Filtering-Correlation-Id: e1666641-c6bf-473e-a86d-08dc1ba9659b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: muQeXChiomfDjnSJEcCWv4YKiaAJwK514cDDoHMCAnQDR7yrkNIBskQSdZkCa9fFCd0ynhdI57b0nzDMhfwksuQ3XqsLZ6wbqh0D8VcV+C9+H478s/0r5se9Z/ViyU2WzK1ecGIjK259CGnj8pCMLNqPSC8Ax3mWhH4wqg20I40LrbdzIlxhk7KRT0MDPXSW+1qTIfga+b2/zGGqfp57wyUHhxgCWDMKWTaid9jHTEJ8GnftQ3QR+ShLnPJjUI7wsdRIwpQGceK2k1bzYwThcdqCuLLhb84SpETgrpFJknBoenIJT0c/e0kKUtGfzlE7Jz9r7ry6zHt9UuBiHi+ltoEITZ5q7QYco+xUSPcdIXeDpTXfXK6LKRAvAQ9oJq7IUYA69dKFDkSuTRMAA6qPkZLhmJ9m2llVzOYApWlEzaWHNCATB/QPZ8e2Q9GZ8ocBz0FB65nUjPqzqUE1sgbjgpaue2DuxAOLDC0YZH1eiaxlFpz31/xBQBWpsP1sThc4mVYxa+cM43n34zNuHp27xagufMOi28CCffosuNibA6QK+bU7NDYDCXOMwt4mfK9W 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)(396003)(136003)(366004)(39860400002)(346002)(376002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(2616005)(38100700002)(6512007)(5660300002)(6506007)(6666004)(83380400001)(1076003)(107886003)(26005)(478600001)(6486002)(66476007)(316002)(66946007)(66556008)(86362001)(8936002)(8676002)(4326008)(36756003)(2906002)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: arJ7PMdB7Q0lVv8NXzZbg44nftzcNhJ18iC8fX2Hd2jMzrrE/d2ekt7pVkYvn2JkrZwM9A65yTBhG6jHIv1AJ56tmYT1BLFvlsBw4W9Efh6NS2dfuz1U+XrqMVteSs0/TNQuJ5aiWU1QaYcLi6IsFaXp9WlyKzXTdwq0gbxr/BmYrRet7MzJpBRPyL6LWKdQcsy6al2r0oeIqgDAWrNGJdiYrgKNv5LAeUIBS+76Cl+Sm4xO2ZBuonfguKqkbDQYBckIOMZY1ozdADmR+H3QI7Z6bEyW7lOVfBCQR6IzyGQuYczFhC+Yh0/zdw/67N77rIiQxl/68+fi4pn5I/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VfPx7D9qu+3dhi7nmncsvKlZ8w1T4moUtdGAwF3tjn2JOZGSq+fdTsq4zt+mmhuDyD/9F5j4UXxj6UY8F5i2ZZ3eTVFG7jBi0JCDtGTwNX5qvOWhi1JT3dHFDda1Ss6RJ5WvBbLsFCIwPgCK29/qBRcc4gRVYUPRTcGTi961HROl+PdJgb8rwAa+b00PYrmznTfedonyjg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: HRqRxRPuBZC4idJKMnDUr1YchsYkTUDdDpPz+N4SJbMobLv41u3rfxfMZiysCK0nKawhGyudebPCLQHoQLRK5jF3h/aeU+M+lE70UrJHFoco0SuLPfYWHeK+u7zP8t2cjPcZna3cSlCUyJNzbeUKIQOmJYdQ4tbJttppq+8MM3BwF+3JzRi61b2NuuKz160SY35uR2Qk54j/TLSxdQevIPyqBFOHmsqhbNoQGxTb7wbMICUTW50+EBlYZSapntYnKPkduMzbGZLLc+b93PB6UMbfxRhnsc6BQQzXfGCdsfqG+PVAPOaQY0WoNMYgcRa4GmS3O+LSrjnu7vlQkCra6pANR7+HjHZI8wK7HXMACnF3XNb4yiG4zMs88jTTsA65Giv+J8S+ei0Q5ZK4qBCprPvsdcA0dFx/KgkF0ST7uWjpiphX0C3feKKF+PmcV9FFigF4rNTYJpFJ7q3MqjTt1zvZXTOFHStMmYdZVN5ZZvbt/jgWs0Mx3cwPJAS68USH24TC73HTNHGiA0vErQkgZ72RapEGSGKTabOyf02UU2DnyyocfkrnK0eE9JbyXl27H+MOBTdHkLs7mv/kMrTrtrrI9ZWS/hw1UzpjfuTNRiU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e1666641-c6bf-473e-a86d-08dc1ba9659b X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 00:22:34.9542 (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: SBGxhOeyr8vb/ohZIaoDPwjThcxIMkUFIshzbCGEQNGQSHsttoCuW7OoGbmUpllSBmMrsMut+mRITQ8FWt2FNNfHbKvm9KW5rCcNfhFBZgM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5340 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-22_12,2024-01-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401230001 X-Proofpoint-GUID: 0qHuI2ThWxFe43NUuGoGnwwZIbsdAQFp X-Proofpoint-ORIG-GUID: 0qHuI2ThWxFe43NUuGoGnwwZIbsdAQFp 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 Jan 23 00:22:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 765549 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84F141509B5 for ; Tue, 23 Jan 2024 00:22:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969367; cv=fail; b=jon/v2M4Zo8nY3ZZsgppz/m1/ruNpfBJ6a/EWbF3lUcwgmoni4bCtw3PLg+LSh0JgUldqkflasP0dg8Qe1KMuFgIFSVJR6H1ifNUaLRbkLktpWSHX3d0RumDsheLtb72c00mzOmhZqKOY0rRsv60QjYZ9UYgLSqWmaeugOjDPlc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969367; c=relaxed/simple; bh=scXG9iXLukNXvkFYi0kNNqwujuiEBvY5tSnEBvgpoLU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=QOMvdvuWf33Ntu+dpiXS78xwcjP/0gUhfd6Pv2YH8qQFJ8oIOXzZ4/MjF5UV3RN3WO6am/mNQZEESh0usvISW2ZmzIU/V94MA2qwIINXbrX4qkRCBjF8uckLAva4ON7UOT+IxHTaoMc9+9jhwILsceD35P5pARMsmrPy3QcIkZg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=kqAy2cuR; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=U3rWnnQd; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="kqAy2cuR"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="U3rWnnQd" 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 40MMoqpp004060; Tue, 23 Jan 2024 00:22:39 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-11-20; bh=C07KMcUHZ2EkGwvMAvKm12nEN9TLFWcp1tsph6aLJss=; b=kqAy2cuRppRpd731roTRs3GVWxBu1f+FnA1wUKbGpX1itMuZwdggyyZDJ5qiX763atJD DEf2lwfBJvh9xvhkmOo+RhHdtyyLEb9eNBJb9VY5IOgtH73/Bio6VnFF0mawmsygR8Ua cBQn6uUn8uFt3/ovtQ+z7Czd0NAu03g7WJRkPkaBljc7R8wamZInyrhAvrd/Hvn3VoC0 tZjSzgsUYfZ/4fCs+D84/NzSYwLBLkA7h2Sa0JsUJNvqwaFU8FiVruBHhevjzZq97Px/ bwwi0wwCDXBjKQKq6Duomq4NZNS35h+um129y7Y80FmVNeQWYtGxMPsCBhGHAg+i95p/ aQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vr7cxvw4j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:39 +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 40MMpnhA016243; Tue, 23 Jan 2024 00:22:38 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2041.outbound.protection.outlook.com [104.47.66.41]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3vs32q0qyp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fxhB/CGGXQLSO/HMPLpoXRkBhra0PsZ8ay95IYPaoiEuXlQCIKI+FQqaCSfvIdv/vj8/70Fzxdq+8bY4Xzy/PQxr9h4zQBpNrujCnjrOligSoMKVeEXd+Q1RzxNUlFCfgRgE16Qcd2UMKHGrIEspk2pTL8JYSD4xCUHkEF/Nu7JIgJVj5cqRZ3hrJQ4kpXzOQjeqBhfJAQQ4nSJJs5y5ZRaJmH8vkXPcDcovXImtVOAU64N9Hydoz+Z25tIvFFbQL6PUCCSvB05OqVgarlzymbIPjVyUbcwU19fuPN8qkFxbQh7EQ3t6w5auKsjrL264O7/Hzrb9DC5CPw7Xz+WsNw== 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=C07KMcUHZ2EkGwvMAvKm12nEN9TLFWcp1tsph6aLJss=; b=CVq/b3Z5zo133j65HzcunBgHRdCl1JC5gvMWxUkN7fZnDpl8eRVMizEsPLrdqr3dx94Buc9ph0DSEfKEWPvqPdmZL3uIM9ixsQVVd5VyDoFfPAOG1nepx6gXuKlyFHBvWiHC5F2VVKQQvuoKyTd2eSJz7aqRXZKxP3Vpz5EiJ+MlZ3IBQEDBX2d+ywRbl1Ifn+hLoS3ffIGQKAiAJAZCCJ8u+MWAbpfzNgorgspswl7LY6vmhIPxKZB1ik5gE/yAOQQmr1E3MZb4HDWeizCC+xBPeFssrFMS10oK1QxeRT2UqiW9GV/18TiFRzV5W49JoAXnA85l7fQNRR57C5xEjQ== 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=C07KMcUHZ2EkGwvMAvKm12nEN9TLFWcp1tsph6aLJss=; b=U3rWnnQdY/HMQEZiSe/3slJe5QBjTzrzesJ1z4n0vjqaVLwVqG3pQuKCjjPklP0AOy94kY7uehK3GlVVlbnomUAlnCDQDKv8jj89X9RPlNZgGBikslbNIlNJHZfpzUY75pN+lt/HK0kNETIFGBSl3qG3c7F/Z/1zR7KBh0YjBEo= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH0PR10MB5340.namprd10.prod.outlook.com (2603:10b6:610:c1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34; Tue, 23 Jan 2024 00:22:36 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac%7]) with mapi id 15.20.7202.024; Tue, 23 Jan 2024 00:22:36 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v13 09/19] scsi: sd: Have scsi-ml retry sd_sync_cache errors Date: Mon, 22 Jan 2024 18:22:10 -0600 Message-Id: <20240123002220.129141-10-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123002220.129141-1-michael.christie@oracle.com> References: <20240123002220.129141-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0316.namprd03.prod.outlook.com (2603:10b6:8:2b::17) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH0PR10MB5340:EE_ X-MS-Office365-Filtering-Correlation-Id: 2de2c860-d279-4911-0635-08dc1ba96666 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gPCuAd3u9M9IetbOplY7DMCwTQxX1/4i8KbW1lV9MMTBL9y0od2Gc9RuiXphoxZccsNgUdSs3IV6A6Bu2IEuX0s/6fwEqJgkI5AfeAW8vibkd3aD5fTw7Ixq1jjALhOJNd4I6t2lvtguQbZXe6DGEX+w16zzI53PCLl13AK6WcJgeA1SNqMJQ23ReR85bXx4aWfxWOH0VWrhYz4lPalGQuCxNweFMVKN2ShOtL9BHfJU2zhjK3pM0gZ5r7lW8EFqdphCcoMdyZZj0hP+62srErwM4QBQHGiM4+BiZ6/09dzk1drBpynXTv/mDAynqMQOMKtI8He8Pq6A3u6EC6FVv6IoOJnPrrDHJ+nYRxqO6JyDiRwdrbOpV/ka9o6fMh9h27b2b+ytYLqd6hDU8diiViAlCOco8PMH/EImmszkYO9dkCh/hDFf8XIYoQ+cPBTKx5rZlPs1v7cfoFg0DwUrmfoYRzHRGL6AKht7VCxCq7/aHCQze31+FLqn4Y1LADwy+/jkPg0//QIZXQ6t3eE+mo7zUpRZ6sxLKWkYyl9Pu36S+VGsb/D51tMiJwJj56cX 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)(396003)(136003)(366004)(39860400002)(346002)(376002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(2616005)(38100700002)(6512007)(5660300002)(6506007)(6666004)(83380400001)(1076003)(107886003)(26005)(478600001)(6486002)(66476007)(316002)(66946007)(66556008)(86362001)(8936002)(8676002)(4326008)(36756003)(2906002)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Ex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SED3SuwXqvcN6WGF6GrvrWAxGJnc8fNlDlZZ/m2yoO97QzmYldINUoikJzYDMvTQZ7RxOmNri7UHZC/oxgjzynfxVE0ICWI2xk0nEBsGh7Wr96le9fIq6r3i8yQoKwHOBrg9YDyq//d5wdwovxhQswjDNPMBm8goq9LTjWgZi7unrAXzww= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2de2c860-d279-4911-0635-08dc1ba96666 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 00:22:36.2197 (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: tT3GhN215l6NkXvx/DG0QuEdZWmQl25xap/lUleakXtxnlhdNl2VtYkEULgqIvgc1X6rwlAshWmqvSXOoy2mY81LAcrBtZrCAj9K41yWFnM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5340 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-22_12,2024-01-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 adultscore=0 bulkscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401230001 X-Proofpoint-ORIG-GUID: RNWtzW3kVD5hUqrMwQlD9rCFR0rSOXSy X-Proofpoint-GUID: RNWtzW3kVD5hUqrMwQlD9rCFR0rSOXSy 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 cb240015bde5..c2068d83c812 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 Jan 23 00:22:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 766773 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B6D915145D for ; Tue, 23 Jan 2024 00:22:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969367; cv=fail; b=agdhwurhb6V4vIqIS2oKrhq3lDig9zfRSYY7dP/v+YTgKgss0iB6h3P26XBY9F2BvILEy5IMtnREPvkDjTP/jI7EzGOcbTbus2h/Le1oDHIUya+lpNWx0c35x0g/an4UCx77jJc27/uyJM+6moEkW8sYbBrBbqQ7eDIutWlJLgY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969367; c=relaxed/simple; bh=8CJgwSIO5PoO7ybAweyyIMcfvLQVZLmTF3Qa0nzkyY8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Th/j2cF2QLNyl1XJsO/Nh28EBlqk/pwuEadWB3OKBWUJH1tiYqN8/yaUO42jkh3IgldY7wZvp9YICa/HAPlKBvyRd87X/g4U/MpIYuQIgr4N+n8XpCtAFRuToPlDz5Bp6KcgwTJs4oBV+UOu1CzsHxNeF1WL3oiLaTbTKsK6wsw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=J7JJNcbi; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=m5c9IDag; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="J7JJNcbi"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="m5c9IDag" 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 40MMpgMp027295; Tue, 23 Jan 2024 00:22:39 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-11-20; bh=dqxpXIyI4r1BiHnVa6Lzrbr1F3giMSEwLBoYjzrQ3MY=; b=J7JJNcbiVH0fmxdHxg2byWWS6l8W/NsQS6pnxEG+xUDXN4nxyKVn3L7n5kAXf4Xf3Gyj 6iznmCr27lOtDywO8VlgpEdTA8ellWXsAGzDRH5LQhtAQEpjaN4OAWn1UG67/MrCpUah VgSIQRFsYadJ71A8axbuvSZjIvZQCfKw26ToQ/nBTi3YyPBByCc0haZfO4ouxDbGXWcC rRCtfCM3IUlm+A59UodKFYxtc/UHQUFRO3YGA/p+tZXn44uvd3s7E3gPRhLf5xBhPdKK 1qMijyYUVhlzgNQR23zmcTsfkdUvaCgk+zrHjJpGPAWjQ8swrgxU6edfihx2b2ygK6qG Xg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vr7cwcyjw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:39 +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 40MMpnhC016243; Tue, 23 Jan 2024 00:22:39 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2041.outbound.protection.outlook.com [104.47.66.41]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3vs32q0qyp-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GdY7vlgVGecltqv8MGI9HgD38/DO6W1UIgxHsni9QjNdLTyE3WOUt70q5qh5OvLaLynb1PC2mF/2nABoVW0T+KHWgWsJlSRKiJd1X2uFTIYnIqArvLJJjE3qUd5yxz+i6NH+NitKvzZ347CogFY89e+vp5s9N824bS9+uMncZI6M5mvp5W/Ubuk4b0SWY9LXhSwzf7DECtTDlAL9poxtGzQ6VhNtb7FLS1I4q3b137IX0TbDX3HIplyqhit5R2s3ohf7LOK2uu9YW9sdM9E+dussssHo8tRMGrfKGDggEw6i1FbiXFu1kpkjopUF5g8WWsE5r50a8h6EP8NvN1V5yg== 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=dqxpXIyI4r1BiHnVa6Lzrbr1F3giMSEwLBoYjzrQ3MY=; b=U7nGAJjzJ+8hatK8NjuFt1qrUJjBkzw+zkCzhVVnPQ6tgrpC3w00g0CTR6D1qcydmw7Upe1r6VS+8sDl40RHwj4AUj2La8NB2BjInbUaAEbMaUkaOeaK0e/wW0jZSRt5lRZBZlwHNY8rj1uDqssmsQrUs3ejO7c6ZHs4wiumpzlPmtUOKWYBYtaZBSndCTMhNn5O4Igas8G03OQTIPzy5uFNXT/FmWZ8C1ZCqlnVjm6gTtZNecNs3qdxdUJw0JWl7BkdRAg4DpBaTM9qcm5S/OEa9+7BTSAvcNwfl4ct4fGJfNdj3/ajbs7Hw19T4LRvNSKN845QPtpSNmFu//iq7w== 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=dqxpXIyI4r1BiHnVa6Lzrbr1F3giMSEwLBoYjzrQ3MY=; b=m5c9IDagdF4ngoVGbGzJsrwz0T0jvTEX2XLDvbW9tNs7nzv1PXqcJ4j+YGjhw3UaKQ+bc3bQPNBOZcymRE2sj+uPSnCrikKvGRxY0cHCXNd3nOcUdXaOj7OCa22JuFeOxDw7dtjxDP2fqRegbmDALVWOOPl1bXPUtWSgsrkcjyw= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH0PR10MB5340.namprd10.prod.outlook.com (2603:10b6:610:c1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34; Tue, 23 Jan 2024 00:22:37 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac%7]) with mapi id 15.20.7202.024; Tue, 23 Jan 2024 00:22:37 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v13 10/19] scsi: ch: Remove unit_attention Date: Mon, 22 Jan 2024 18:22:11 -0600 Message-Id: <20240123002220.129141-11-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123002220.129141-1-michael.christie@oracle.com> References: <20240123002220.129141-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR07CA0065.namprd07.prod.outlook.com (2603:10b6:4:ad::30) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH0PR10MB5340:EE_ X-MS-Office365-Filtering-Correlation-Id: cf7a3741-2cf2-45e8-544b-08dc1ba96719 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dDFXiOcNBOEDTDyx88VZ8xdXg32udJ3hrzoMN4TOckV7oVLF2ySmCuFL2sXkOywJBtUVdy7x64vvjNI+Ck+Qx6FtNFzburqmVcta/0P9R2p4IJrDX+0ktqDHtVGaGtweZDP8pceMZU7MMFmHVHs3fL3lK1Xv2YhmQj0ESGcEpd6PhtSe9UZm9+44ne1cRXD5HnPnm11U6YLVTujEo6NJcYxh1tfOyvgIF18X8NaX1rRR9MdmcnZ8DF00TfCtilet1dkX+2MewLsWIB/PSFiLs/8uAyupCgNiuhcxZZsfiEB8utJ4Cr6fampKTRAX5Njm01bDrRc5PlN1ZiQS/xUo+8o5eYOZQJpSd4XFtLjG+11XX/7H0imFPzx1699l5TGGYCkALjzvyDAP1L+ZbaXAUPOqlX8DRjm9tNPUiiEWUvfKiJtd3zcfKelWlqmBnlKnXXAa0apxuRIJNF3hKl93Mn8aPQaVCP7IcXLqSA6OlzMSsk0OAZgts/B9MEHynpqIxXKNrTUZjtw5edqAPv6x9AT3bAlqTEjOPxOEPaUumPJ2hpWTqbcm9y1iGzdBL6Bh2tggqsNMLGtY/G6n/RP1Zhg/J7gDjcpUtKrc/pWMba2fHyf2BkZxgJAU1T1VrgIY 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)(396003)(136003)(366004)(39860400002)(346002)(376002)(230173577357003)(230922051799003)(230273577357003)(451199024)(186009)(64100799003)(1800799012)(2616005)(38100700002)(6512007)(5660300002)(6506007)(6666004)(83380400001)(1076003)(107886003)(26005)(478600001)(6486002)(66476007)(316002)(66946007)(66556008)(86362001)(8936002)(8676002)(4326008)(36756003)(2906002)(4744005)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: H1Zf3wPwlJx+Ze1D6ELYWfsHf7fqJGwodCBHOAGzo7s0xNjS0QCADGpsdqJj9q4AjHzQb4qSjC2bGSTjRH/LyrQaz4o7j4VevoXFlpROXMBUzO8go5t1OpZ0fDctPjzxltLAKvS5J5JgSdOwtyS+0gE4UNCyfU7cmMKcl2eCWwmL7poJUxttG0DNEnJsmc9BBYpfaf4bOGp1FR+ak/LMiuycsLHYw2cJvgTX8ZE02NwghIJsOj0wCeMGeOg32XG/4aBVSHJpef45mV4hYV2f+aj8Iw66kn6L5A9WL2v+vJ42BWaS/0oc8YcW5Z+oN/mHK4IzWctryo6USV0ahiR4WXiJGoOewj5/XkdqZrUgjkwKEYC704xFry06d7ydydzkXS8RKg8EIiUd+iXqpg3w5WkalbXdSP+7bcpv5aL3VMS6urp1Nul5BbZieyolwkoJqmK0hWeec/exLgyqHlv53fq8xIrOFkNLGxHKp7uJMz2yBiMwj1J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eLYPZsP1/GoHYzLQxV0C7fIlSYbMbk7YtBsdQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: LGS2+H5u+PQoeCQTSnJD3CJNaYV6McEqAN32BJjoc/kQsyiifV03llwnJdxmJcVH5/IHIN6LendmW5zNIsjbAbKKdFlIWoS7W5+1eKL5dv6/BfqkJXtwV1/IEyKQfFr1X0ZXkcCC085Y7g1bS+Kvtsy1qq7N1MyxcqIKUrdTNsc37ySU8FwCdLmM40nhWMgNcfszz4AvM0aYpRYTHTW9oG4xEaoRMxmadhIFUGp/gfe9LteSfkhpgDAJnMtMWjyf4h0UkZ2i7kT5A1c9lt6Uam/ILMZesqZxCQgJMgb+1Yi0jIb4pCkp1Pu7Ap6SGmoH16QtAl/AIsQU5nkVK5jrO7nWUMWGev9R/u5ZL3xhsXW78vqno7YjrBZtoq3vteo4GOIC455c9hAOvPS/ajgtZdcqk9Ew926UZGZCz/E9r6PW/AtntiHFADzlDIeZxi51tfa6S3gxBf40aTQWXfMI7buhNKKFfFcBFiMdVXUjRJyKjaYL56zT5yYHNS0he5AbBL79T1QDmRHqpoN+jxcNOuEgf3l685EfZSmkKi4wCuTSoej6gx+6qhIp9FZy0gk8U4JMrt9p4QNaXElmQTxQKn4vW8H6AlEZ9Cq9sgzDh5k= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cf7a3741-2cf2-45e8-544b-08dc1ba96719 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 00:22:37.3913 (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: XC3rQYAAa2dsEOWAWZf75WXNW5zaObTMH8UgIQ1OSyWMDbE5jiq/Txctuuy3HIg2YncoT3E6WBhrduXoa9BxJMrdCSu/F8yI8TY5QXKkz84= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5340 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-22_12,2024-01-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 adultscore=0 bulkscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401230001 X-Proofpoint-ORIG-GUID: t2HQgz2Z1iVsGBoyMh4oGgut_TvBc38D X-Proofpoint-GUID: t2HQgz2Z1iVsGBoyMh4oGgut_TvBc38D 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 2b864061e073..9d7fa097ae9e 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 Jan 23 00:22:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 765547 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F051E2114 for ; Tue, 23 Jan 2024 00:24:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969491; cv=fail; b=LFPra9LN160PiXMkYW8addz3w5A1KSm2ajnq0xYbGE7r0olFC8roGTbtJ7LvZg8hy3YQAKP9TKwf7wvpDJlj6jNDKo5nDwF7LhcigbdpFX17kQBNgm5c8CKTMw94wOtfZDsZNZKYvqj+/j/emXKpFUzH+87p6ctRuYHT2gwvZMg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969491; c=relaxed/simple; bh=xIKUwZrg1Qm4PSa5C+70iUX+HOZO5K+NQct+3fWTgVY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=DUym9pewKVcfVCyPKlRw511ZoP+wsKXPQ0lrITGs+M0LqbOxb/lpUZRcJpXMr6GmePYqjM4CFuPutsRVEdwulahmLGi10P45bmUsRmjeNanhunUNi+wnaru+dGxkwL4tSULlsB3nPZgbSg7SGlmGaVHLGmKbEUriOjT9Nr9Y4iw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=Krca8nh/; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=se3okOcf; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Krca8nh/"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="se3okOcf" 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 40MMopsQ026498; Tue, 23 Jan 2024 00:22:42 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-11-20; bh=mEzr8XKbZ5PUhcNAiOILij/41wdOkln2wVhPAgoeeB4=; b=Krca8nh/Q/wUsDmMlfb6ypHPjk4YP8e2RQKWTCCz/Wh5FChjwwIRditJDqPlJuscvIth m38v+AoA8JGXGm+mKwO00vjO/Cj/Z3jm7P3iemk1w+kmlhfUW8iL5IHgXbbxeupmupjH IiL/6lpQsxRitV9x6yhF1YGk6gGHCpdlkn1a/aFmqNAdHu0Sr7tUpeWMr4Z9GKUD7ItT ZouDeN+YyqKYpRSGNM1pmLKTWJ6rSt1E/JxTX50IicucPK+t3VQhCGFkTvjWAX/juRxM m/aH7ogUqdKd3rMUMiDmx57y+vQKhwBxlI68B7A90GjLWXk7w5SgfPQX1LNKO6NOzswx 5w== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vr79vw0wc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:41 +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 40MMlq82016242; Tue, 23 Jan 2024 00:22:41 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3vs32q0r12-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MjZmoBEOk/N4bheh3XoL2nlJTvjMFb4YWxnKVmUQFvAvsU6QsjuqvHT1SmG6SQbGIUz9jEdgVmRrOC+bLWoUBat71+Z3qBfekjhWCgQtaiCTpr+I/iqw8o4J3XTTpAMQEewme62fmHdQocdkhA55VzTQlpDqvzSs2D2+O+ISXgNQz2kqgKpn0saV41+lBU30WIV4sxtTA/FJVNrlnwTWtpflrx//IDVLYQEF/likZc8ETxFbXmcm6qvdNtWqv2if4LCGYfgxWo2zj2KY5g3YJuTVpUINidnfw6JsfG7VYLz+G9RNlmc5Bcox+QNgtp4KeXSg80zMZl8K41QpLe/6DA== 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=mEzr8XKbZ5PUhcNAiOILij/41wdOkln2wVhPAgoeeB4=; b=R7HZgAX1IDxu/QXNrQETWYF3cMXmG5/FPIDCHBa7/m9k+H+Vv8JuqQVD1yvXKlZgNN864C+hTB67QgrUG3kRwAAuU3da/PNeUH/gl0XP8Ta9uX4JfietbjYZytQTc01njqPUiE1TM5ZChd/tqbn6+qaOZcIbMhywCVb4vbRBj2mC2Jediq+lxsGBXY6UUSFRHxzlRtb4Z5nYmNIkyEoU3PU0E/dkGtp2k6E1VpfbwvogtSlAkcvGmPLMO6qCpyTGvhScSwkrT/StffMCSCPE5nQ3f+K2zfpv06tXdsbP15E4Nz1Vco+wUZrjPZNve4/C60LznuYa+1YVspta+mEH7g== 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=mEzr8XKbZ5PUhcNAiOILij/41wdOkln2wVhPAgoeeB4=; b=se3okOcfpTQq0oJD6YP3QGsWeBnpVna/+bbt0ZSotu0ZSOr2SpzFZDnuDEq4sgtGNDDltyJxpLZmdZmozqXvVXXGacG04986FLzzcw9EZoXYV45E0Yukj0PzFDBSaBab4MkfWBoNRZ58g03A/Jv5tGOxzY3w/TwpLHfENP9anzY= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH0PR10MB5340.namprd10.prod.outlook.com (2603:10b6:610:c1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34; Tue, 23 Jan 2024 00:22:38 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac%7]) with mapi id 15.20.7202.024; Tue, 23 Jan 2024 00:22:38 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v13 11/19] scsi: ch: Have scsi-ml retry ch_do_scsi UAs Date: Mon, 22 Jan 2024 18:22:12 -0600 Message-Id: <20240123002220.129141-12-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123002220.129141-1-michael.christie@oracle.com> References: <20240123002220.129141-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR08CA0029.namprd08.prod.outlook.com (2603:10b6:4:60::18) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH0PR10MB5340:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e2f792c-e01f-432d-ca5f-08dc1ba967fc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hoNl36n+DsuH5OgKUqwicJ3FEVAvNt0uoWEOeXnD28gE6l/W+Cl2uxcxk5EzkdGpMsii972NJjnMZ0dgrKweYV5hOwqKlB7VMdsP3Knk8meSOKuuI2AF3IrKzAomYb8mnKNVMAIPn54xRbXVMmFd1hezevdMAUc8JcIXo3kYDbfiAhvXFnDmWvYxD06C8uRO81LBOcDbA3/XIhF6fTA8wU62D3oA6ySSJ73MbTh0D8hLwKngfUa12tmknwP03FrK5/1YhKgvyMXowMdGPp5vrom2rHKQPw2/J2TrWMWAAw0vIbn/hfcodgjCqlxrOVH23yJxBuEHIjtDhwLawozfGh9pdykSO/tUO4VtM0GBwmE2Y4Iip5wHo41V+gSJbUAPNuVn8A9tNyYyLnmGjndfk2xW/lkA9kNBysomMVDPKMRx+OP6mshq09a4Ah999zmNnRJEMMxZ23dvZdr05PPoRZpR/NqZXZ+dzlm4S2yNFLCy2QVhgnx9jZneTg1S6lG52p3J8T28r54uhGCzJWBMNp3Gjqvgs+z6Ts7niQxUwKv8gKF5LowBeRAJ2G6yGxmdQJB8qWqeZnfHOMSFusFAnboz5vWTU7ZCk7Fjp061cli9uvTnfleB/Vokv4TFk6OX 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)(396003)(136003)(366004)(39860400002)(346002)(376002)(230173577357003)(230922051799003)(230273577357003)(451199024)(186009)(64100799003)(1800799012)(2616005)(38100700002)(6512007)(5660300002)(6506007)(6666004)(83380400001)(1076003)(107886003)(26005)(478600001)(6486002)(66476007)(316002)(66946007)(66556008)(86362001)(8936002)(8676002)(4326008)(36756003)(2906002)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6hicmkJnSnr6HPKZKbby0VXWrhCBCBx+OCTqqFa/mw017QwGDJ85eOufeJUaxeM13jcEuHZetLH6T0RsAuQxil3UHEUAp+jT3Jmfh9cCzznhJFsBUaqGpsabKHo+JLAdaBnn1BZ1NzzQ3zOwSvcQGcNulJur89XC1iRi0EQ4cIa0ZqFgzyEiXwK2j/YVQx9O7Xytu+IkJxprzrKc/AkxmDOsE2q9BfoF7N7LqzhzH0EqDngdDSYSvjSsJVOP/u9LQEZhyU9LNClh9fVpsWl+Q4TbHZg5SzuaxzLvnX5xEYoYDU5HRFBRCz9GZGanZJ5m3aSMigydZv77e4zFr5PpJ48xMCB8uxGbSv5iRoV3AyJFkbUcHx2SfRmTnmvC5C1o6lHSTOxO5zgwdYNXiKcl9R8Nu5v6VaEBjHDkGmQTGQuduKxWVA+1v0FpHz+9MjhKFpWeApgert3BjI1rxXMXsozwkEbkVWCdmWxS7WmJNvr88BEioy7bC9qube2/DiXnfVsAnWwVHBavFF9eeMCeWYEecMFwKFVovwnpEFPKrK9pmLvwrglOR3Bt2p5DNo3wMB7+/KFCRKtv81o16zbAP2TAT5SkPu1ms7MGl8Th3oCBuZEMSAWEFac9/jd7aIHwk7N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3H+cc4khwJdBH4ngS4FRVDhwi/IKYpvQS7ng4fiqIZFvnYePRHeXwFFpShDpCv1PQFe6XsmiMkaW6d5LXkwTt5QXkI8rPjn8UNggUnTS3mKTn/uZsAtkkYFEpHWvQl6nJCqnJx3XnXTuCYhvHTgagBU4YzjlPxpHxuRdFPBmfX69+qMMIIamA13aw7VbJMGFaG6gBbfUOImHaxaJT0VR9zpY/oCQ5mm0FuGuefavHVSJmMSUAaN6SoHOKn5DRldEZRuuZmYJDL9imqJ3GIjvsTCweyxzWUPmPVpIeRfh12xQux7o2wQ8Q32Jutm3/VF28qP4LZeXmiD22RehhtRTDNrAylXAMyq8qxtxlhnEIseNhwbhL+kEfpnU8OAfaFe3mFCDOgP8uhfshP4iDZ1RJSl7NWD/2K+k0A/ELjtQiTfvOfPrQ2pF//bGSysAEvBHniTpnIMsPlmM0xyYUw5cam81/UX6AzdI4DbHa6W3LjAMG74AYLWHMkiCPTBISB3uSuYpW2dIA/rmQHl+1/QI43SSTfPdiObZ6RkYIozKcJcZF3G+n/CTK14/ey1Y9QSnijCC1YpPuzEqryFzkVUejE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e2f792c-e01f-432d-ca5f-08dc1ba967fc X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 00:22:38.9103 (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: 3iRoVwNldL9FShQlID5TuJMUDDeg/Awx0u+6USsWnXpjZYQzEnjOv5zTpFcbarIjYBMp0bfqTOrbO3QIJPELYKCj7lWjg05ILAPCX0EO06Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5340 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-22_12,2024-01-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 adultscore=0 bulkscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401230001 X-Proofpoint-GUID: h-o1kNBsL0CdfYcBmmvJTZaJoaAOwOIU X-Proofpoint-ORIG-GUID: h-o1kNBsL0CdfYcBmmvJTZaJoaAOwOIU 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 9d7fa097ae9e..1befcd5b2a0f 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 Jan 23 00:22:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 766771 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 179F2EEBB for ; Tue, 23 Jan 2024 00:25:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969511; cv=fail; b=ANRLt7n7KAKutTOP3CW9bdhAB4KDV8o5eRTToSLNio+6jIlo6w2WsEVIXYqs74LCjOn7rjIiYmMjXp0bxbUGJBW9qv569BYUY9n3oIt6V0aHsDiLwbSSdAB47JCM/ksxoSCZ5MpQjzap3VKBiToZhxwZqaAYHpSHbEREmWAfM48= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969511; c=relaxed/simple; bh=K5n9Li1sPsQiUGc4l3BpvDYcgdgYMj9pT7qkN0YyH+Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=bOQd4JJmvKxLkSrd1d6UKCKbNgXkWjoNu14l4THpmVUVHFVeE+qhydmnYYlshmxm+bGAO3fPJ6/QH8vaiY+GByn90Bf3oI0UP8fv8IZEU/KtMjOIqmGtbgtmtqQ54+xwmQXKQhOMw0plh1rJQfCU1S3as6whbLO63/4jPrQuDe4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=Qwlhtj6j; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=wt/Orxmd; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Qwlhtj6j"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="wt/Orxmd" 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 40MMogLt022182; Tue, 23 Jan 2024 00:22:42 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-11-20; bh=t0Kjk8zsR0i7Qe8RdIzL303MaDCOodtCk3SOKoVkj3s=; b=Qwlhtj6jkCQHSMUjdufkBODuyVzOQtSBL+kNYBmT35JJvNNJdXbqIUuumwN2vW2QLJhK uRDsErYDQRp7dxJpOFwyRIbMyvuF8loDYge1KwstgyDVAcxVYaKNHiy5F/NBueQk7Knr Ifa0g9RZwwC3pXx2LXO0eLxCboYtSVcmsKw/r/u/4Qader+Ta08f4KNKntRHweQxlcSu uARgOoleXsE7aaLE9RjH2AxuFTTjQ8NFqDVEsRIPLJdLh+oO9XAVIBE5ThzF6lcAPUm8 Nip0oCsTYxTHfEmV7drArSggCstJsEw3v1PA6AJGM59WcVw8cgXe/i3C3y6JJEb3bUlt zQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vr7n7vysv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:42 +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 40MMlq83016242; Tue, 23 Jan 2024 00:22:41 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3vs32q0r12-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gUTjIfnIruELQgKfsBaNg3iNIumlqzWDklQ1jegZF3vLFx+BUwptXLomPmubD+i5o59z4N/5E06gI8uo0EDSWIvfWDj/HJ6HPQTKkWY4vZx/OFsfUeifdasHO7BDpPKnp4pCr6S4JkcUMhM63Tubt1O2DrshTuya9wUvxlK+llUOw8OGHIreE0uvoedaiQ4BDiNs6Iyq37iqXy50iss/8dAgmTfgaxWv672LGG209jjJ6skiSLmcjqvYB0H5h3kidBexTkefl97S0YVu4ErGkNVHvxQW+9XF7jTpfNEHsHTr8xGJ0+zS2K7wFX5UTja2qlQPuzDoMjBoFWe5wGiS7Q== 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=t0Kjk8zsR0i7Qe8RdIzL303MaDCOodtCk3SOKoVkj3s=; b=XthtzvuEEd1COb5NhRNdH4deoERtp9c8UziQfW8yu6ijRUSA15WBr0DZptOu2pc9/xds+ky17P88nAPwnmGn4z51OPfscCbZcb5rEXdjFFDNdivyjLoAhqnR5w8lB44kcWOImnVlgPiOdsGk13SOuW9A8Dp+hfDydd81wg25GZNURed61+3aKkiiPmlzLO4v9Fidk+iSlQxmRewkLyMNY0WECL/OLz36EhF6+qOxrJRupF8wc8UiXFYf7MXmkO6JlWvicz196Zu51eWvDSkEk+0Znx0WXlFsMmLPJ6NzSxpItp4TfWo6SsnjnqVIn4X7CXRDfzoPlbwSeQLQr6U0bA== 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=t0Kjk8zsR0i7Qe8RdIzL303MaDCOodtCk3SOKoVkj3s=; b=wt/OrxmdS3XK1731F8bvwb6czQEF8+0ud4DGK00GF9zI7nUBXvZD2U0mhtb9YlxHTvFkYkhz2HBDAWOUTBeBuRI/6QUuReAxXf/+kTNDuzIH5kjdtkdibFJOj6g1yroBlquGGk5sHwRUvZth3EidpMMrQ7TWu1LeMEbkqOi39Vs= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH0PR10MB5340.namprd10.prod.outlook.com (2603:10b6:610:c1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34; Tue, 23 Jan 2024 00:22:40 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac%7]) with mapi id 15.20.7202.024; Tue, 23 Jan 2024 00:22:40 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v13 12/19] scsi: Have scsi-ml retry scsi_mode_sense UAs Date: Mon, 22 Jan 2024 18:22:13 -0600 Message-Id: <20240123002220.129141-13-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123002220.129141-1-michael.christie@oracle.com> References: <20240123002220.129141-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0148.namprd03.prod.outlook.com (2603:10b6:5:3b4::33) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH0PR10MB5340:EE_ X-MS-Office365-Filtering-Correlation-Id: 93d5a62d-8ef4-40ef-a8e5-08dc1ba968e3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +MKHkXIdCOFjmYBY9fRPd1WVqWhstfhi8hG8l6MMi5I4TvJQir6QbdNWNY87d8Vh3Taj6WFMD6WNisQk+dOijGOiDjeP49VXwLd0KTy280GqpfHQ06fFJGrHDkGa+G9aam++uDUWvFPKSaesRiRbySablZXOQamPGP9iq9GFW/JiWZcbVttGPMwGQIe0QAaBG1ysf3oBfrjfD0pmTY0SJnjA2vZDUYFlTn6HEXb+vjDV4Ts0iuEsxUWLrXy463Uu90Xd+fvnnc/VGDcEgV1yUB47f0kkrJm0zFBLtYyC8cIscSO0YzKsSB13BtPril8TS2g4ffuoaqtSZay1dn8LSW1a54jn6tLfoafn0itjpudi0+bc2AweUOmNYP4sl4VIQDWNPLBl8Z2pEW8QI2qIP2nbLz6ljzMYJTx9i8VLdOsASgx/AsS47YFaCGHRx0mNdPHsGBNyuhZ7DpToleXiuCX/HDEuKzqvGtGADsel2X7BzNxlsr3CdL8i7k/v+x1+IKB/Fobo+nxSQhhexH/KLrpPsHrRa6mx5cHFHm6fGS2NsSf8BzffjbBya20RhK7N 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)(396003)(136003)(366004)(39860400002)(346002)(376002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(2616005)(38100700002)(6512007)(5660300002)(6506007)(6666004)(83380400001)(1076003)(107886003)(26005)(478600001)(6486002)(66476007)(316002)(66946007)(66556008)(86362001)(8936002)(8676002)(4326008)(36756003)(2906002)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kmTF9EYZfbcaKLZBhic47zAnL76AOsJ2CHfxe7TknhnmLpXkxkX5ODuhX3sZHsTBJQhOlEiJoZ7tvnBz5LPpgD1KmoTrP9YCPJWf04EI8r9nxJueRw9iH+t5phPd1JkHG7ENpjIT1CIxYCnxoPY+mCkPQHAfpKJpFhnvH5V0KlPtoAU0E01k+bM6doQCTWGF+XeHJkA2SeXJrrU1AhcvEKx9oOlN3Hb1NfxWKxwlWpollQHMiKsT8cskJOzr1pg+2irof372tkFbE4RjRSmxxgdZEoFmbJAk7v6rqdh6SlhezC5CHc7s+Sjv3HtzdstojVnTUxrfxEph9zzGGyOKrDJSIWPT04KzO8gaF1KXef4dyiII0BtMWINPwz0c4j/+viX417abYTPDN0dlMvBn0L13txW15hDww4HUaVtR9QzUGCrOZjtYaJs2MSe6zxi1oxNF31lY/dfwMiw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MtvMj7GZMNTQ+OuI1Eu72hLeJx1WHL+7RdYOUw2cFcfbGiZGO3MCbg6nImMp03PSX+u3SWul2UIA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: KEtZE5nqS6U/GEFaBLbSftTN6MfyXQqhxEGp1i1jKSotm2qUQACJ2rzisCPMB/yFP/+O6yolAL0bB5fLQqlRQ8WCZxR7iWVFMJ/zs9nVOEWxDrVsBKvgo5b+J7M/CipQdlUAdrXe+hsiG7ZW1MHjhIy4CNhIm2yaNmo+AHuebqy3uL/ZKhYWqcbGrzxOu8CoOulDlLE/fwFesvT3JT84EEfCzipyEcEWUa+gB10oxYO06cB+Zp7JuD0LARs3AIDQSHzKKTiHkj5Rex0oPDmjkc54i/ch8LTgwN5YgKajjBZbOhvQdoNQWUMmOnhgUQSwFIKx+sCcDz6BZCA/2scW9nwcqscqPmH2hmK7O5ZfAhyryiHpBgX+rDnBD0Wr6fJ+rkHiQZnbaLlIMZbNlJ4CLg6yXOYB8PuwnnJqsrkjam/mWP+SRp7VhiBFoLTuxrnIGLA89Doyw5PMm6tDmzzO/vf9YESGOTovuJJSnJv8u5YhJMfIuZqXxaGRkaBfg9EBrAX/eHqko0qZJ+6241H48hCCRhelyg3syaGRkNfz1ZKjsTg5Rh5czDzJ5I3T5YjLh88tSrxiiIxcbsbQEBcxQzq8kljc9i1swkpWtwdtgpA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 93d5a62d-8ef4-40ef-a8e5-08dc1ba968e3 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 00:22:40.4216 (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: Q8jpNKojXuylpqiuiuxUkU9qAB6/sZD9JSOpMlz5V35XP/mShKvTFk5b7CkPoytx2vMWRlUEZdLx7WVscZsAiyECFs61YGbe17yPfnR7+C8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5340 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-22_12,2024-01-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 adultscore=0 bulkscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401230001 X-Proofpoint-GUID: 0ukE1ZGKEHbmK-NVHU4uxPvnOxfzCiPJ X-Proofpoint-ORIG-GUID: 0ukE1ZGKEHbmK-NVHU4uxPvnOxfzCiPJ 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 868f23517d33..9b109192c51e 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 Jan 23 00:22:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 765548 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F2AD154431 for ; Tue, 23 Jan 2024 00:22:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969373; cv=fail; b=er0QPV9J/6i34KhM3i4ikIe13R6Bb7fle0AJzGEgnb/TKqP2OTVbdoDv/I21DY0AHumMl1kj5HdpRyxChoNVlcS/TO9QNiG+UQwH5X+AoWFcyL4V+QIM1fif0c58uugUd0zotVjieuXWwZVV4iulZ/0fUTkfpBPr8u7a/ovwYbc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969373; c=relaxed/simple; bh=P/QJ5Y0cq1PpBZz8P2jEUdP5rwolS+u2euVAzzQ+/mg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=YYBz5JK8ljYIICw0uDmLvFBNo0iqgyq6ymgpae7fo1XPRycW2Sep5u/XrN0X/Uu06xms92NpcLXHNg/T8WGKo3CAxxRa6AJZAAQCfgv2iHu2vegD7RME2tKmVb+dcxXijl45cuEQd/hgZec+nGescYpe1uKihAjPaQsBHnHl21U= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=Mk8e7S7s; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=cMrE6owL; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Mk8e7S7s"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="cMrE6owL" 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 40MMoh55018199; Tue, 23 Jan 2024 00:22:45 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-11-20; bh=qHvYT1SXvi8go1ikgTe/XY5aOw0TjHSt9Nb44D+xC+Y=; b=Mk8e7S7sNnByhJQ8KFpNqE4krDZ4Kb/473df9WBt6TPzcACIkdHslkhnXjxQL62je63S U4jaiwnziISMTg4kYFqLwXKeEQvNttFfv9vrmdckUBMgB67hcEhv+WCkqLBoUjm+3+Qg DDmFepPcrpBVsaFtTmOCkxreZgsgftr+6VBvfnehhlMsAoy7G4CNHQd+lsGcfprih6HR +UynFWTGBT4bZL0AdQ+d4efnsOWac/EPHPuQV9UtRrUaVaU4t30rehTnGHBZOo1LVWP+ t3nuolNLSt+4KuzWdyyMAwKKz3RJAuQ5jlM6qV0IPVFoP5nQSNjpS5Cb5LAkgoGyGvPp 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 3vr7abw1s6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:44 +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 40MMeBWK018804; Tue, 23 Jan 2024 00:22:43 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3vs314g7gt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P+IGC/u7TT0s59PYUAtmE7zuQQPxZRU4oecRM4bakDcIn0oPQeMBpSUUnb1bV6h7zORCBYkAVdPG3TA0Q73a0wXbgSJIeUzCOoEz2L8y557qAGvqjoGbtA+KDDiKPCrq9/bWCvMnt0vppgFF/bXsQnjo4BLGGa08lzgOIUKvj1IPEmQxWwsJA6w2wuilphd7uN7Mgu30rFpvl2xsnwUX7lSp4Oe4++8aWHlLeIFuukHsuk1UOG2Qs3LwIslFyMTwpWLhd88/L/3VIZi0f70Z21ONsl0wBPZNMp590JIGvpGKZXomabPEC6PhB8B49yb+R8O0nG0JAiF4WP541Uo6eg== 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=qHvYT1SXvi8go1ikgTe/XY5aOw0TjHSt9Nb44D+xC+Y=; b=Z9cImKb5ad3cvWgoztsGM+11+r2OLwAw7Ot6y9gO2jPJZ7YcMRaBTe6TRSeZz2RebSWmbDGoZq0cUvLfNvM8d0G8SSvC4P8u5OtOzihwSmDxnp+DyKJAxHz/TpBakOYmHHPMozTffeRQ5jzcH0HiuKnBOGb7CpKoASBD4a4/bTPBpNe06q4uAxVFxssQMyyGsvhcpFS09TVs5TK7ih3WHRvQVlr4fyGC0FNQhovrHyTDFK801ZhnI4Ah5psJX4Ui8uK0Wc4pqbVc4uEQc4nBWfhG54MiYCCj3A7sMQ8vsKfj8rJceNJx1T6PUZt1tkrZf724HCxnW9XXmyKoil/0wQ== 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=qHvYT1SXvi8go1ikgTe/XY5aOw0TjHSt9Nb44D+xC+Y=; b=cMrE6owLxgvV1D4Z0v9PRmS/zKMXUYM3IpvJMjQpSuRpTonVnXb0xl5otjFcgL/SnyLqHSUZW250ksE7c+vrv5bwMiFOmiqe4fmKdongdeO9X1tR3z64Q1yrELyL2WyzIi/Mcc0cL97clXwArNkmvxcoPKArlVT9v8LK3UJk9xM= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH0PR10MB5340.namprd10.prod.outlook.com (2603:10b6:610:c1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34; Tue, 23 Jan 2024 00:22:41 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac%7]) with mapi id 15.20.7202.024; Tue, 23 Jan 2024 00:22:41 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v13 13/19] scsi: Have scsi-ml retry scsi_report_lun_scan errors Date: Mon, 22 Jan 2024 18:22:14 -0600 Message-Id: <20240123002220.129141-14-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123002220.129141-1-michael.christie@oracle.com> References: <20240123002220.129141-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR05CA0041.namprd05.prod.outlook.com (2603:10b6:5:335::10) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH0PR10MB5340:EE_ X-MS-Office365-Filtering-Correlation-Id: d97ce823-1129-4ac0-7e33-08dc1ba969be X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lKHvptCVAp90oAq83gUsqiyuZIccgbr6tEDfNFum+is6AGa2X9lo7SvJ91s+V5OmoU0H12Ov5rh1mje1TQe6szNhTosszQN6Gnw2iz7po5t2uAcO8VobWjgHuT3A9tPvksmxQj7BGa+5iwMEMe71N6rQl0VRer+oZXeJNW7TjHdfFbEu8HYplkBPEBg4Y4HHnhcW7JYRGsGaiDZtBBvNeAQCcDLBW6riHxdF3ZQp/v0hKTv49kht4NT5iMXtDY2xJJlkIK/I/Ml9FeDHtTFBELxlDYhP3myPfUNZC+SKoU1zJmhjKo0RvVv7OCjg5sIw1gqOLjZE7DOMSM+cfEFtMwFRBG9/VSqRS+ap05G7niItley1TIEVnkcLhmBabMECXtRJeJeryxIoQ/MBgPH+kLoXvDmBRBEXYAHpQ/OoVPFbedV9vldpk4WtDWmu9y+rMewr+778Y+wk46UaMuJB2NBVlX3Nfp5KeQWg1jEYIWMf3LRKqZd3N8Dv4nxgO/CN0pIbCbdJSK066cm18IYHW4VweitziXH3LdwWHk+7l06ftqgzlAApSMKR74qd4obo 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)(396003)(136003)(366004)(39860400002)(346002)(376002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(2616005)(38100700002)(6512007)(5660300002)(6506007)(6666004)(83380400001)(1076003)(107886003)(26005)(478600001)(6486002)(66476007)(316002)(66946007)(66556008)(86362001)(8936002)(8676002)(4326008)(36756003)(2906002)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ra+BBJmlCzKP3OMSNfMhguYEK+zsrIxzOdvyP4hCc9sjjigyhACHcGc70P0PkLF1unVqi0EMKPe/iB/5yQLT14Y7iWB/Uj4Qf53mfENaa4DDDeEgdGLiL4nW9/GHx/Pw5gDwerr2DItwG1Toj4nzqqoEdPzIShpbyHM3kNWTo0s3JZ2PYfySd2P1x7rRgnhC8m9aVAGPpI3Q7HA5xCvJMHeaM//HoDahXk6sEDo+4NZZm/cK6w9WT8FgfUy0w4YAo4H+xsu7jVdzJXCrq8xXUeg4jSgpGyaioW8Qv3rzzjgK4SZl3Y36haiVtuLRFhGzds4Ywcx8x1TrpYIcdv2OAvY45aO0tvf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OrkdZ+t5/fGMUKttAjSYqEVp+RO0GaWPPpukkfBqIHPJe5+OvKFbc94IWWo/DweiSZjfShDTvp0SlKYUsfLMMD9w7xOiT7zAvV96vdgXbInu2+MJPMQA2snnn5TCYFEjBSMa+4x0EySTevDJC2A5mP9C5TEVb2H5r0tlMwBt8ZIjlrQUL/7+opsyLg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: GLcPlkbx3z32mMs1HbfAaLRtjppE5cnC2OE4eFyZhVbsvX4ghc45KP/kdsF0b857PBsStpjuMA3ofwKzn1i5nZkTyyLGDhyFnhtHu354zixzmO78htLgZqWwsKpPvvSByUvZBOSOUeMdR3H9DTklblCId2i48IE1xZFZJ87UNYyMUoAbLd23gHIHX1Hd1GrC4XKo8zFYhbmTSw0NWIKIidnIyAKSp92iaWZiBbXVwH+bRuuEvUEHpt0G7Rdt3N/YeTZZUTyDHUK2zYrFInEPImIC/ZRr/6Jhejf3A10b2cEAWYfuQeDJtIlSImLD4JgxwGdi8SfwlWsZ2kYhR34GBccvusu5wBBpvZr0ComzjIVl/36786pwaSVMzUw2pjARqGKav2Pc6yI7eI46GxELErO5OimzM4RqMCPCqY0jkim6eUux25xNvmQEOO9zXZIgACm6Ef2DdM+/GNH7uuJh7IRuCx/vDFJZIGZh1jaLppuApfk5dCO6zDxoqPVAxTdXapop01pLzj64OsR//mgDFd3UwSCLr/E3H1mM0YqLT7VOCL2P3bgQNPyfen55jpNvpx2aUn1zB0opK3emXsPkIMR/WlGfVKfM4a9PdNwyZlE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d97ce823-1129-4ac0-7e33-08dc1ba969be X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 00:22:41.8874 (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: aQcqkH4w5OC5ii08C8LHDl8V8Rbv7RvTcjw6jE3HPwY/t6wGo3os6iGLv36keGCUo+SnNO7vONYUD8Pw+EXMg+1PxpMT5VJuEeZNh9YOwoo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5340 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-22_12,2024-01-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 suspectscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401230001 X-Proofpoint-GUID: xn8ddlRcoXtEIekjPfKorkkt9kuhs5gd X-Proofpoint-ORIG-GUID: xn8ddlRcoXtEIekjPfKorkkt9kuhs5gd 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 8ded08f37337..70c0319be34c 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_failures_reset_retries(&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 Jan 23 00:22:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 766772 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58676154441 for ; Tue, 23 Jan 2024 00:22:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969378; cv=fail; b=BjH+CkFZBGlwg3XgjVHjMwFr8diJLGUieLIWvlRt8DJ3jUnoUhBBi6hGdmFwObqZdoWl0Yiz+5OvSSKMGybwB6o9pZ+w3BTlSS5Ecl/rWhSTmFtygtHgH39kHrLeDyWMfNc0QDxTuUJ54iEOJO0E8ijaRiyYN0EztBlAEqat7SE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969378; c=relaxed/simple; bh=C2rMchSa0F8kh0qbDkQ0IVuujvrXYcsMbZBXKpAybM0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=VypnBLPUvsaLJSRt3+bf15Kn/LGCJQ7mzpvC72iVoNjV8YzmoRKaxEWsjq4fWn7o4N6VADqCFng2JNdalsEt3uMO9ItMFmZYnOWJXhtePmD3umYsemmWCfdAZWroHgtPKz0qAK/pbFmi+saOLCBj742TzMEvUHRQJEijPvu8DRc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=TlW7hRSP; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=Hs7pqaXK; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="TlW7hRSP"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="Hs7pqaXK" 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 40MMouEL018359; Tue, 23 Jan 2024 00:22:47 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-11-20; bh=a/YDkR01uVqhHG1CYEPnlKsrqq3IfWOLOyvoqiW44D4=; b=TlW7hRSPLpAOng9ZBHpyS3wN5khqSoybpFDOT1GbJMz89N28eRrTjK0kuCe921lZm5Wh 1WOtVfyh51/mKE88f8Qdms/NXxApJWKnU0zC7yZHGHZ9iOVrKLgYHRRO94FYmz7aMkpF qYa3klv2wjwCQO15fq4IyQms5Bb6neG1KMEi24dJJyJhVOlC98QS+oY/iIp4z3xUS9Xz Jf6r0WNlEb1JtQZ8qrGHqD++GOKM2CJvgfPjJRQ6MDGahamC94c5hKagvMPeMoRBg73w xVq3rpG3NrPuYWSvWK086VZNDUrCr2avMh6JQUDdGLeaUbQ/2W02fgyPVdOMHyPEKjMi qw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vr7abw1s7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:47 +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 40MMeBWM018804; Tue, 23 Jan 2024 00:22:46 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3vs314g7gt-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cUAZVwBq7PQjTEEeuzYB61+qU3p27+ExWATVtQJdLAt+nlxTaGfyxflbiC+eg6IpoxS+2h2o0BM8SNcWIYO/qJ/LC33RlJ6kNvdtaUtpde05Us6AasgDoVCL1vTmXJGAjsdjfeUBczX2DHjPIVWFd8FL3xOOQ0iocaFNFEPz5C0HKqpSgLshtxM7e1jxZnfGWp+F2omAAXFg1UmXvtLSvG5zP4q4mtnACPu6TlfH6o8sypPLiaA6EwgQbJ4g9A20n1CU64wYX8sL+GsiN53cTB3awGzcxPdjO6NDuWj1T9fyoU1I+h+lR7UogfU7qiyi6WAcFS/Rxy0bIiKsnSiujw== 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=a/YDkR01uVqhHG1CYEPnlKsrqq3IfWOLOyvoqiW44D4=; b=GNG9PImQiaK7n2q9nuVZAiuonFjQnkACUs3ZbbCBgysAdF5vJmr2jE+EJdUbiiqv65LVIW0HCPtoHbdK7bfiPVVbflL5dxNR13CsXaRo6Wm1Ly/wxN32wWoKtxCnUafA85MLTXD7+aJD/gpuCssVgy4+2gLlsZO5LTyjgCWfP/dW9uAeVBUhvSdc/na3pMwbDzgjpL9GoaaytNMKagkY0aLIOpCAROi/fkOpEVHvFAmB1jGxCEb1N/p0bGUF9/mHifrUch1qYo9ICtwBNW0NJftX3bMUuDPQYBkvkYIudGjDvDaku+yIH7ovgqo7WARGgJUBQzdqIH+643bmQslerQ== 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=a/YDkR01uVqhHG1CYEPnlKsrqq3IfWOLOyvoqiW44D4=; b=Hs7pqaXKmTLY3V26Zu1NOgZgowOo93/1Ic5NaFRm3mf2c9Cd/a9fAFbIlD5Z2vfPP8wB8WLWDy4pj4uz95HGKf2Ex2nH4quHTutSXIYSMV63nRObP2JI9o3kHqtHBElTrSubOIPZI+zLVrgoskmFsKeoZh0EnHNmI+CmjpE8HCA= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH0PR10MB5340.namprd10.prod.outlook.com (2603:10b6:610:c1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34; Tue, 23 Jan 2024 00:22:43 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac%7]) with mapi id 15.20.7202.024; Tue, 23 Jan 2024 00:22:43 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v13 14/19] scsi: sd: Have pr commands retry UAs Date: Mon, 22 Jan 2024 18:22:15 -0600 Message-Id: <20240123002220.129141-15-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123002220.129141-1-michael.christie@oracle.com> References: <20240123002220.129141-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0011.namprd03.prod.outlook.com (2603:10b6:5:3b8::16) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH0PR10MB5340:EE_ X-MS-Office365-Filtering-Correlation-Id: c1c37a9f-8425-4992-03a5-08dc1ba96aa3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kHKeb2ewm36bMoVVa9R13u7Yq5ZX5tElFc8IZvkXoB5eewaZNMRkKQV14ihNLPadtoFH6MF6A3QHq7zB0MZu7QYyDLzMkeOZu/MXooIQHENvaF3D4hV9Pz56ejEXuaO1QCLU4JNbFYZzps3R/s5A9VEQVndMPsRPckI08wqLvfS6I4Za44UX8Jf109LezrVsncqcFAwEEGv7ouoeQ/6qFX0YeHy5KqHAb4SvWXrgvvXpHqVO/Flu0A1WrUPiCWyDd/xubKTJhWAmtjRZzJ4tcxmPcp6uefrrjFBgl1FKaOJ7kaAG/At4ItlsgI7W9qWrpVasgeX6/tkCTZF+ZxcJBz8GnNo6W1KiHaY4Fu50Aw2FYAQx4N38Os8Pxp4pohvsv3qVdFvboFJB62RbWBiBbODFnxuFRACschMPLfmncxxRYtk0G11Y0uCzSejnC8y8bKR9WPI5T5edmUxuMRJyze0mNmsSD+efOVurXhdaSN6By/J5CY4Hz2R7x85j0gxMAykp2yLXx6G8HBlmjbQ/SEeqQGS/vld/t82B5lYsgCp+gYAv6t4H4OYvzePmURV0 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)(396003)(136003)(366004)(39860400002)(346002)(376002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(2616005)(38100700002)(6512007)(5660300002)(6506007)(6666004)(83380400001)(1076003)(107886003)(26005)(478600001)(6486002)(66476007)(316002)(66946007)(66556008)(86362001)(8936002)(8676002)(4326008)(36756003)(2906002)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2b/e0C/lTI0YmFmewP0XvLxqJDw1Sr3mIc5I7YEwz2oSD3QJJ182kx/vj8JD1evsJLMUHdnKWYGClrTzzKCViakfx1+n0ej4rzyPNoqq29QQmYSPZqI/fvMT/MQ3MBIrUcnalRDXNWFC9fD5FBTDahe43cwugMjTFyyfo9YqfqXaBMuB2ZFRZhPcmKzo/p+XHfRoIi+j4kLGUwC8zBMqjObfkdTonSuVn/PiPFpAurG1NXsprZf+vRvsT4/CIKfuob1H3PuwWu+lSAhEqC4hcs+Y3Pf1wpm0NrRyfi2JRkVfY16k+BbsChdNNH/cqJ9eSPL2mCLzPwn4nBDltsYeLJrAPBcdBTiOSDbYfxpno0jBdfYcXsBTHIBunAHd4XMZL6lnVG0gnTGbrxJGxPu/zQ/moz4dU4ufOwLfE8SYsSPgtYr/LUk9IWDf5l7ziAleEb+IK8zID5W2OJRuxN0L3gMM1HYVLx24xAXGA9//5kA07GMSsHwaw+8WCl0PkKW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1ux4OEDCI8CVkzE7E1z1eMo6qntKyhKLDO+0w== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Cg22hGIEIqmEXR7YU6E7R9QHWL1DpLbGlwK7EGWfMoznPw4dE/tFUVjzMzqEpZy3oPkgSxT1zizEaE3X2xCvzXmSuW3n7JjXhis4GxyUV8CtcBqkYQXeKpTrIbGrPPcXvbpSmbGWd1fORQ5g2KzLuFX4GP9oqTRYbaErKJQ5wPt763fo4Itn26/3htjIRtKpH/Q69IBmlkH70Z5NAEWxeWC5vxnq/dKZLkOgZ62ft4va0RDFb39Kkzl9rPWG7arjLkfsk+TsAsaceWqlgo+DPTVNcT9SEf+FxYtj/hLlosxEeR5tl+HMaBeLWqWeZ1BSZtE+C7JDneILsVsDySCgHgj426TAZ9XHgvgLr/NSWkeiRoisR+ZPb6m24mkJFZkMmsPke83GT5fyr00AO9TzeBc4KfnC6zzapY6tM5uUuylVcYwjNuYsePNcx4u28PAoP07hNCLnWyNQrjYlZDTogv3jsCkwpqDJ9k3GpA16iGbQAvX9b1d0iiecpL02vzHYXDEtPfbG6swfbCkbuE2hDrwRFPhI8hLp+2BzAnQ19F4HwiS+kGhjIzcwGDn61m+gqlj7x/B3zkzRbZYYp9OaMgeNRvYJgNyCZWA9vVZo7WU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1c37a9f-8425-4992-03a5-08dc1ba96aa3 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 00:22:43.3482 (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: b1hRljiCbrzBUccajmE9BJXEv6Ib0XEJskbcV9iyW5x20KWlDZWRZLT4SXrwSghhTUmEUtclnSCM7RSOWsdJNjk+Y/n2iwjw79JutJY+wgo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5340 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-22_12,2024-01-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 suspectscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401230001 X-Proofpoint-GUID: jbeh9t-BYdfWiF7ujn_b8Q5clA8956oQ X-Proofpoint-ORIG-GUID: jbeh9t-BYdfWiF7ujn_b8Q5clA8956oQ 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 c2068d83c812..4196f722c3f6 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 Jan 23 00:22:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 765546 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80AD81EEE8 for ; Tue, 23 Jan 2024 00:25:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969519; cv=fail; b=NQjToHV6ftpaiBhNfxS7hISivWha0OLu+lLpYq9fK0cnT8h++ltoED+8/OQtwFYN5ep0pUsswaYKR5opDMuAnvRGa3maEQ8XcUv8xQgJkFlW64lm68IOf+7GBEAby4ZjDatXr62NCOUEJnDUfMAwqoZ+z4Dd148r1TnBt1gWjcE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969519; c=relaxed/simple; bh=0AhoGil1xLThSwHuih2wT3EA+ZOiIpmdGXs3M8VJ2kU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=tJznLUuzgSZhyo/uQ2uyjXdzxGueQFH2f4y0E/X/ZgPLv4w+tdMv3+x0F5rC9A2KYeQdfCTgbhCwIOwvfhJPTJUDmqBGY8U52WnkGiQhYxZDn6wOSzPG5pRX/oa3gGP4uWEPEkZ4paWhN32/b57dzswiDC4JyXCikLx0Xqt58NY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=QFJ7LE85; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=U9YAAhr9; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="QFJ7LE85"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="U9YAAhr9" Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 40MMooGN019259; Tue, 23 Jan 2024 00:22:48 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-11-20; bh=t1XNX1FqK0PGQQFLihun3Pj1zf0u0btsGYH9h3A+4IM=; b=QFJ7LE85wquvVF+Uzj0ZRwB3bKVR5sCsFy63ELwKnhHDurtsi3kdqW7T0Fhi+bjSkhYS iJK+Fs9GnipUVx2ihmzdEoPYAdpq5GubadkDsxeAwsK7njdOBYa9t/SEMIxz0WEQMhfS 40zfztwiGQ+ZYwt74Bw9SfsY6R5tfp46pySA+rsaT4GPvw8HLQeUIlWjXuYFH5+L89vW IbPSP4o7USZYvs7dZs1j+L62aD7KnQ6/yeR6hXZpd3doniKtWLn43ZRo28xL6RZmBSRs 47JX34fBvaL/68DPDOpL/MiKzJJZbwn04vtv6W1KhRiMPj3ZVNRtp15cbAZ1EOEkAtmE TQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vr7cun2kk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:47 +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 40MMeBWN018804; Tue, 23 Jan 2024 00:22:47 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3vs314g7gt-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mwyba8TQn/kP1uChze0qP0amCPp+YKfngafswQVASuOz3AEhY0cyXm0pY6cal+JL1dG83dcBjIORucV6aB/TurFZbe+Fwhn8/nYdo1cFTh1bo7XXmXpXm4z7ri9uKnO22cIhKShgbSwa64mRPX9km7oz+iU1YhEH4iIDDoW60E6K7NKbUljCCgD+sy+0IgEAm4hwudZdEvoViPcx2l9pEWyMCnsRPLOZa1JlOfxrAXtji4kwyzrsL0NNRS5dwo/Q20jotb69B5w9D8kfDXRbtqDIeceEPMSRv/V+oIyi/depnjUBJVzRidmRmid/OlzviM0bLPWk97zrHn8JiohS0w== 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=t1XNX1FqK0PGQQFLihun3Pj1zf0u0btsGYH9h3A+4IM=; b=lM9r1aL7fb5/X1Mv3ULrpfqXq9Q4crvwk5tTzhaUTV92HTvnC6ncy3AdQrr13+QoeprJjj2ZCK+dXqnRYj+b/OeyeaGa6KCHTiKwH+i6ormQHUPBB3Qblmu+hh3XWy4/7Ib+7bJcPtFsGR8GAdE3CmiZix3iGL3VA5tMZMMFjXqBmCZNvMW4hKM9S5+9Nmj1tEBepUou6abRmhB2grmKfT5Q7s+7T+ywNxk6HVN/c6nVI+y3msA8BQdchmokKH9ogbOSCGgmRVgZsZptqRt788dMfA94gZkOjOtMuz1+zqmvJEMUxzCsSNgUeJl4nCf/PBAPZ42z8gK3gP7iVKuJ0A== 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=t1XNX1FqK0PGQQFLihun3Pj1zf0u0btsGYH9h3A+4IM=; b=U9YAAhr9MNIMGPEHEFz3G1n/chP9Vu/JZUZjzjPL+7AXJfOTzIpm5LjcJU6ZsnXMuwowwWWLT45yCUTvy8uMXrhub6CL6VICVmRTXT2aEuzL/jqL8iK8pW4o54y4RMjkhz8CPMF1GSfvXgY8ikYYDaIUcKAHqS+ZibvArj9IrzE= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH0PR10MB5340.namprd10.prod.outlook.com (2603:10b6:610:c1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34; Tue, 23 Jan 2024 00:22:44 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac%7]) with mapi id 15.20.7202.024; Tue, 23 Jan 2024 00:22:44 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v13 15/19] scsi: sd: Have scsi-ml retry read_capacity_10 errors Date: Mon, 22 Jan 2024 18:22:16 -0600 Message-Id: <20240123002220.129141-16-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123002220.129141-1-michael.christie@oracle.com> References: <20240123002220.129141-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0016.namprd03.prod.outlook.com (2603:10b6:5:3b8::21) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH0PR10MB5340:EE_ X-MS-Office365-Filtering-Correlation-Id: 521b9854-b1ad-404e-ec5c-08dc1ba96b75 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nxQ2dYeQuMWUyH6M7Hb5uAr++2urRVWbsOxbukDhDlvJVshY0tGfQlShwQmScABhiFtr9y5oPY0dLvz9x82R8oIJJuq4KHMSDFRL5i7CVf5+gsACPDJh6kg6AWkLE6J0KvYrS9RZ2kHgr5tqBbYErDjWNXoKic67xR96Co3W791TiCXwthKfLacgE3iZ9Cbr0yhHij/swH+nQNMmT/+vh9aoA77abGU3Y/J0dtbobB57/aoQv4oq5yDZ3F6t806IuQ1g6mdh1XU/4HOyTC0yI4j2cQ/doegiPDVCiK9CfVuqyXuFRaZvPVmXDllMsf5/5lJMvdj9eVLOS6GHksJgYs+beeRbEZMY+fcsFl3yAKoi4Qf1KfVHHtChRMDNQyqAsxo0W05oD4rA8lO+24Ie/WQs3zhiVL02A0zZ2SvWLXJMwb4kWMyxARfP1+RDiGwCfpsWf5YwRn8GDTpQFRywOqDMCbOJ9YNxjOVC81DgHgT3e74Xu0QHqyfk03qti9SjpeI9qc//h5+KCYOSddKXlSho7Eg50WRk5m6WXlcZxIQGK2aCZaada9zMuJTHrMFB 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)(396003)(136003)(366004)(39860400002)(346002)(376002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(2616005)(38100700002)(6512007)(5660300002)(6506007)(6666004)(83380400001)(1076003)(107886003)(26005)(478600001)(6486002)(66476007)(316002)(66946007)(66556008)(86362001)(8936002)(8676002)(4326008)(36756003)(2906002)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0QqMC500DJEolk5Qt0oqmJOLtfiyoDL4k9gIK+SgumM6dlBkIHxd47rBDx4nWi8yyAjagnY8FKAsMFnQw/bnBepBIKxxzLAVaCT7ERH7eRqIx5HUpZ6ezWPpTmIAbooN2fXFug1phiuhwB4sq/yDmdpl+wxbJCKeRkSa4UBuQqR7DR7T7jwEGF0ruo5cKuUcA9T1+886y4K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JPM3dRwhHWgbbSGMgW5aC/EoXb/vaQxiag26RJvSyEQYF/5KPlvOYDnWxUfrR10zw3LhwwBZHKC/d1iIQu77g73FhFWsiX9e5e6WtPZoZ/lwDEUD0kiPYsutsEQYGygm+bxQ4gGo9nzh5RqCBuxCQCjhUTGQ+Cc3HVsE0/hjSXFnm6a24awqgJQxUGrHREicWVj0meqct1NRCi0qj6jsfk1J0JwzAs6wqdcUgwhaA/L2ddXZKsIN/jtKeZefUJ3VlhkRMGRLDuqUCnpXgrVpU4yld80t3BP/4D9FGKTC6lidhuFR0t4DUPYleRI5pEYBP/4WhdC/eNcxcLXWqPWWnPlSA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: hz6imTYICjbYLRpIGu050qzXy6oIRCaNCVx8Ftc/ESukraKO0wQpq3Nm8/EFuXI1TQy/9pNALTchNEx2z3r30ykt682Dpxl5TL0a/npxkWVwj7bfGeHCvVxXdO9qjlP25lG4/cO2oIS1EA43ILwhHA8CYAoJsa43400a8/mz4ssoAV/pz3n1YT9X6gOfYZ/iZGUbUPrZ5CAyCvH3Q9OLLSbnrG4VXyqx6NOecwAmB75oTWJV9Op1zcg1iHv7AvE5lHjaEYyIrMMxQGWK2GNL0dFMkGnPb9OG+R0eNZiWTySMSZ7FIQH262PM4ozumNOZRaeDpGaZ/75nv4WXC4yer7NN8YXyezSHJgV5yAZd+nmIlldJUcvagyEMjKW501IQrfY9iHwdyR90bvs3vawVIuDN8/5qLWg89h6c9AeFTi7+9tsvx/OXv0Vc24+RuyYrmrqYdFfgj/a6Qcb7Ci7EwdVMV5o7t5PQP0rjPj6cnRtMEPlcBo4lHg7QYF5Hgyc6kBsPi+LPuJ0Ve90+mPny3wINGAV7hmO63SBmK96nBW5VefNVLRAM3PyoxgiJD6URXaUSRPmehUvEDoz32nUmv2gaBFtkxcl7Yjoh4VVTgNw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 521b9854-b1ad-404e-ec5c-08dc1ba96b75 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 00:22:44.7282 (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: ot7hUwDApVkbg5OkRCsVXLO5rmLpWXLh8xtA0/v18gdxYjaQuPXSGsqNsHPZ8T5JX/aT7RbX35BSeKthRtTXzoAQYLp2DJeqvQWa9cDFn90= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5340 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-22_12,2024-01-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 suspectscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401230001 X-Proofpoint-ORIG-GUID: bOfLnrd-UyyGqmVLMOuFxsi2QvRUvrob X-Proofpoint-GUID: bOfLnrd-UyyGqmVLMOuFxsi2QvRUvrob 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 4196f722c3f6..49159dcd638d 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2588,42 +2588,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 Jan 23 00:22:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 766770 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B1861EEE8 for ; Tue, 23 Jan 2024 00:25:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969523; cv=fail; b=DWuVLFHgaKzAF8Z3FMwvHbxrqLt2zDv4zu9LkGfVtCpU0YdwnWuGp/v3rkmN7ny7ZO8MlRLlbmwumZniTcWMWf71Xi83njuYcY6kTI9f9fCpix/DkCHnX5o+BnVa2n8Oh8dc0JEdLXDeqDgxyKPTbgu8RirXIYXDmB5po5CjMmo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969523; c=relaxed/simple; bh=2btri3V9OBOHYVcNtf+t+lNx/mBCeMVjp1R1DgyQ+QI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=pQGhsqRJTKl1TX2+grcn4OaVkGR0XzrQ8Uq+QsPUcthRpTgSrKRQ1ynBLOOjnZrM9xq9QQ6p5vLR5FcIx1UNLRBum8xdF53iYLyLLcmD5T+K3sx5DoAlcndLKTz9SQ5/orEB0jHIR5QxkH2UNONNXaI+3rCMSk+y/T0S0a+7Dfo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=iCGbjnCi; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=VU/SGR2n; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="iCGbjnCi"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="VU/SGR2n" 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 40MMp2wo008297; Tue, 23 Jan 2024 00:23: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-11-20; bh=NWLT3G49/rrR9aRboYfHvH2bMlYuyLiAHg5BiTX9x2g=; b=iCGbjnCiJQSC6dgWkCTE+iVB8zhOrUw/EiFXVaRM9dFIrNRZlDs1uAJzF8zwGvICw3km MoEuGCDg6FX6OraqROwdFthHv7jJZY/bXOMQOqX+PZnAXvLZARp+gMkM5bnRpzZrwmH9 4Hv08BQzj/qcwuZpKCEBpTlEqgyACwCacjn5M2RAWX+8SX82PtrQAsnMj697cPNrsImb 8cmPZ5YpTZlFxJhr3iGurJY4MhfxqM5/TawZRJcD1QMTH+/RPHkZM1/PQwDeEN+kh/fB +XRUJKLzrF329MH7GhNj8mgam6Qp0T3Due6RVJv5o/X0dtPIhAULiUqskVquyooXGXsd PQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vr79nd2e2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:23:14 +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 40N0DTlx025310; Tue, 23 Jan 2024 00:23:14 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2041.outbound.protection.outlook.com [104.47.66.41]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3vs33s34s1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:23:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z9TVrSklByRSAnJyo96zy6Acz74cTu36wzJWC9Bo6JTFDk8BnQi2PJ34co76T398A0Uqw49iyKs4oN3fS39ZIMZADafNX+YKFkmXbLXVFvjyLqwrc3eAgSibgHu1BQ5En4Oc0QHsmJCtVX/fsPs0paKPC6oOAjG726UMz9uB0KVx7YBhR5EyzrN+2qejWAN4PQvbgftuNI68vsdcJXdrZUF487j7JaryiEp54R+AP48jYuWHOtMkomKrZ15J/uF9M+UzWBAT9DGOfh2kMHxuknxXjec4xhIRY9JhuQZJGUdXYwszG/hXOe7dA1qcK8aHJGEpZKRYJw6TbPIElSnkiw== 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=iX3B9vzxZyVGhPkeqVkv7AyckodUPT8hj/Dx6yyW6Tg13CwU1TUudT0RD3vSXkvtwdDpGVyGZjYXot7JNvAY6Dno5fMNS19DG5jFfi1F3JGX1mx5dGOojcoBbE88csViJbgTbrWJjTco8W9XfHwNqM5yCP3hXB6GhKgPiDQw3LjlSGNj0jjtvmJItqexMJucAkOkI+sk4//QECKxcRIPCD7y6RLzwErwHopIANNmdMiTzo4+la9FbF7Szj4Nwk8/9+QFQ5XrciWYyfvomMELBhIngnTy61tAMiliaDGWNPPI0rEE7q4J1tGh2fv51xARIS3OMDGZ2iEtEq717VUcTA== 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=VU/SGR2nzTDBdGumd6nyarSdTubfrrzGAEw9i8tJohn2tAG6CJ0G1SivnX1GbSZABtNYfyzRWdDSnVu45ep+gz6msQ/yb5kPcqM8sVcRWkrTN0TyxudgbAb9zDiRTQdQ56J2E6eJMTJZ58DrQLf/obn6MHIiaZj4JttMnM7j3J0= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH0PR10MB5340.namprd10.prod.outlook.com (2603:10b6:610:c1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34; Tue, 23 Jan 2024 00:22:46 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac%7]) with mapi id 15.20.7202.024; Tue, 23 Jan 2024 00:22:46 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v13 16/19] scsi: ses: Have scsi-ml retry scsi_execute_cmd errors Date: Mon, 22 Jan 2024 18:22:17 -0600 Message-Id: <20240123002220.129141-17-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123002220.129141-1-michael.christie@oracle.com> References: <20240123002220.129141-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR08CA0035.namprd08.prod.outlook.com (2603:10b6:5:80::48) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH0PR10MB5340:EE_ X-MS-Office365-Filtering-Correlation-Id: c2a95ad0-0fd8-467e-b209-08dc1ba96c66 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pjIS6cQm0x3iRQtkZ2U7Rw4SQ7NBGsBHYHqnwMttA9W+EFpiX4GKyXPaVa9PKmyamAUMOP1M5FbqZx4rylaZwkZ/h5L6RdmHG6ZVAtmcalASj0qfk74A1M+z/yv2frs2K4rPIdWLvUYP3U9lxmgBW+5VMUsdmnxYYA+b1MpsYJnBq+voCr/5liTS/ODXequp9JHMCfqUrIG+4NAhn3aBKZ1nslWm+JEJLT9HqMG28NVVyWpfxcXP61qAUpYGNZMnsTtZMjHYf7aV4M1XO9ClnOI5ZSqk64inAw1H/eOkH6eh/4GOFKQrbdJGxOqxmCa7eR0pWsxyCXPSEPaMBiS9Je7Nn3Uf2thyQoqpqKme6NK6HVntys2Pc2d1394uUMlHwSsn07UXfM3zfbWcf3D6LBGl5zTAThJUEe0dEV588xWYxcNKy/nRvxHV6K4xOvq8Fr38l2DX+WfRD+T6rul3fc4RMb4bkhxaqXypYK2TeKGPS6o0bwqwM49JVGXMnGQ+Thxuo8epsdnYF8+1AUp5zW3nbhbG+Lt6Sz4Eft2G9g/UFjGoGi5+F6DnORIdyC/g 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)(396003)(136003)(366004)(39860400002)(346002)(376002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(2616005)(38100700002)(6512007)(5660300002)(6506007)(6666004)(83380400001)(1076003)(107886003)(26005)(478600001)(6486002)(66476007)(316002)(66946007)(66556008)(86362001)(8936002)(8676002)(4326008)(36756003)(2906002)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2Y9/L/731ha8PkHjufMO/HFd9D9w8DBvGjB4hQ7rpZ4FhKuxVL+hol/3EZpdYsS2Gs4f74WGt0szsQ+98Plj5rQgUsMojI4MF+hlwCusNLmziLAomhhrUZJV4eVDiTbdzh9Yl0tjreaiKKvXU0uFjBHxlX3CzdZBREMWyFSnuV0d90zDXOYdmWcOyLcGQFAK0A2kV9qOFmcI7YAS/jz8S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r+H5w0nXO4DsJ0lno3DTQzQkekPOSCNj31aVN4C3uehsyFONYXCSID55L26E8sSK3jr+Z9e9YC6HSSrScVO0kHGcuSazMHMCl6pQ1k/fHAnYJIRk2vS0Jtw6q+qwOldX0DebwC2a9sKBtwuV6EosRx4DIom+JvEOFKqkKi1FIt+JcjbjvuuTyqVmx6DZO6GA6niPki2i3naSKmI6h+I0VrI4f9S/WP8aGsXphXNFmHwl7AcCxUidxjwhSyFhqFKCBvoPR/kTSh+UCOCactL2lIRNBDFQtOzto6L1Ht0aHEoak6VdmnpM+IlsnZGzfqgZKkEIQMmtCR0eg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: fgMFkT4S9dHoGdHRX7NSwoTpT5Igr+MBWn1axpAcbebqF/6mMZF0anZkHdaIafc4iyKt2MOviJ5WlFUBH4Ex19tcU2Ramwcas7OUlc3Zu8zZ92rZ1eZ1gd/Kn8xbJb/uix3WDjgs7JYTiM2y50JPbXkZylUCoqCA8VWsp8htjggiiFE3hkH1DyiPZ6h2nt0f29jtTvMTo7HaSrBsw2zoEgGKxn6P1im4e2462a5UH8RazjphCHMb5JhdR2P9ZF5zAxQzLEAXuyB0FTi8j8dWZeLLmB3KQVr0lOlfrUA+rbdp33tg5okp8nhG+1JCso+cQou2Jty6KVYSABCq4Fg/bdRW7GXU8wu/9wt0arC15GBMzecPPvierbnS6jw2diZl8kVX9EaUpiX2w/8tEsUeJJmH3CiOa+/KVKwBXL6+BtjmoXN7jzlDCLMbyL79Z2MyJbRpH9gvEBDMPaU6lgJQj1B6JzFFf2hAB/HuTF/+gK+zue9ALBZ5EqielQmHIR5Stlui5kfjsWpld7itJ+TF7VotLLlGdX2YAdR5/h6r2uFzDSoOPzp/y6gPNT6vdd9ybXjmargVVianRiwqLJ7/9jAuvVgD8R6Q+Q8LcEpSNjY= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c2a95ad0-0fd8-467e-b209-08dc1ba96c66 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 00:22:46.3621 (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: X4Wd0x6ziouF2HGpqure7JL5MGVKH1+zPgdlvWmVCkFIDBdg5zCmKygFv7vm7DLrqj7CJVmNefpwAE5k/6Xbxndrf/1S9u/GEvZxC0xEtyQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5340 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-22_12,2024-01-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401230002 X-Proofpoint-GUID: TGVj_LAcQ3SwV9STP9bNgcQcGHSptxsu X-Proofpoint-ORIG-GUID: TGVj_LAcQ3SwV9STP9bNgcQcGHSptxsu 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 Jan 23 00:22:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 765544 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E9BA144614 for ; Tue, 23 Jan 2024 00:25:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969541; cv=fail; b=VFA4xENuS4kduXYWn7mc6FqCcxoRPmcP7rUpXQqBxySem+3FdRbZEkw56ccCZXjxNVaZqC4vNTK3YX1crVFYRD0qFk4maF1iP1cAxdV8DHthXzuvuxrPoA+mon+plo90yWEO73OtGUy6Dt7SyOt2SYKHNALoZ1tbU03Jzr3dO0o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969541; c=relaxed/simple; bh=108IOLqCmoOnnCEn2MsaAoepwgW5OO46TNl/0H0SiVU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=iiygqQtpNa3drp75sWtW0F87b7IoD8xPLkqP0clEVipZMvJKqunL14Op0T3lDGfUG7OLbE7XrQ+m+j0TJyaXfnUs6PbtN9BUxpGB4kEML4IgGZsLzZXudgniPrgRR04jCZHunvjMBVSAjQM7EezPXDYkRhju19yW2D+76loIG7g= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=POnWBltR; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=swAia7Ph; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="POnWBltR"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="swAia7Ph" 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 40MMovBq008245; Tue, 23 Jan 2024 00:23: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-11-20; bh=i5vXS1djHmBsng2QRrTpw3owfNQ1wdfmYnh5ZA9b1yk=; b=POnWBltRB9eDNKH/4ij7VfrinGTMyZbmA5OKorceSbr24rB2VLt0hTPvqhsxdnVFewjy mexxohwKFJ4RMAhK+nvE8wk/zEYhXF8qxqeDt7GtNea0CSDiYI2KtsaXh7KD8LN3w3pH QHaDuL/4czWiOikg2d6FIvAuNm29hNeDQeTJQ8zT3Bo1ZsFrLIIQVc0h8fyJfOdO8sD5 50E4Er/g4B++x+lpWArs07SFGWfCFmIvriCaVB0mr73kh7iygNY3Em3PhcyX7EbTAeYT uTPLL7BtVCD8HEhGLj2Dsdb5mSkdJujWxJeNFct1UWm5VvlDGUfbNhvGLvYwHhNMnk9d Mw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vr79nd2e3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:23:15 +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 40N0DTm0025310; Tue, 23 Jan 2024 00:23:14 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2041.outbound.protection.outlook.com [104.47.66.41]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3vs33s34s1-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:23:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OQ1+UdX3mL6FiF+TpwCBmtw/YpiyxHj6uqXIjeGZDQgM65sUa9GQHZo4AwnxR1lq7UOg6mFv0FvnTMrc/Wm5Sw0zDVC9wGh86DkdbukvgzkKZdd//IcOOa7+ElBwEo+19VeoFunq0zhpfd8fTPaA/WOmOTWyXG0fu09VRag6BX/lXvQbCl97VzKzJQ4Msyq9yIXKqi//mnkWlr2wFnNgQkBxUQ2GBn2+o4BlcHy4Ilwk+NOOWpJ942kt0eK+eWj5lyyc8rb6rgjejFTOP9gDYSfptXCTzdrW2dy4Y8yQm0zRl9rj72hJC/RStNWG1p6/+EXIHrojMCkLL3diP3VXdQ== 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=O6bYT41dNa/TDKb91cXc7IhB7jyaYT3zSkOPk0Eg6YL+HWL0JCCWlDpw6NcIomZVpVZ5ZsuZVQvZF9r190AhugwIMmVWqoDuwyrAY5lrBq8lXwit4ZpjPT8bnjq29VqFSDGergoJkb/lsczbcywXqP/W1wuqhCWhVsFYjXBdf9/IVyN7skvO8ybBp0bySxKWMg0cVjKZKFDhQVlpvECy/uJY5Qd1I9EmYC8XTLofQL2Z5TWhetK974clrLjK0GUNh3/iH8icVLYC09XnGalA9yl4k8bzlea/sGCelDfPkQ5SG+wuwEN/m+JG+1l8kc2hWdn4bgeh2rpA1V9weUj1gA== 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=swAia7PhC3A/pb5CcNbohfPxsGM2JTIFj03Z4/zCFcvswT9xxb940duOXGK2IX3+6LGsbzQy+c1TRjQedWWHtOjjrG7hDaLhw6EKms4jGEP0/jMOKrl0SS/jRBo4wqCRIAFrGcflG3hHN1tc7ECFNBiiYk3ZXv+NvOAV2yQvleY= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH0PR10MB5340.namprd10.prod.outlook.com (2603:10b6:610:c1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34; Tue, 23 Jan 2024 00:22:47 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac%7]) with mapi id 15.20.7202.024; Tue, 23 Jan 2024 00:22:47 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v13 17/19] scsi: sr: Have scsi-ml retry get_sectorsize errors Date: Mon, 22 Jan 2024 18:22:18 -0600 Message-Id: <20240123002220.129141-18-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123002220.129141-1-michael.christie@oracle.com> References: <20240123002220.129141-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR07CA0116.namprd07.prod.outlook.com (2603:10b6:5:330::13) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH0PR10MB5340:EE_ X-MS-Office365-Filtering-Correlation-Id: b347a3b2-8b33-47ef-6fe0-08dc1ba96d29 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4xv9GrNMXPyxnMpmci0IWKJdTpQPSOnpNnQCnAGYX9jcBOHegsWT/VyRyYzCiXPlhyN+7V4KOMa6w/i428U2iKQdEbGA8XjPZ4T+VafrAwgzpwyIuMKxbQcmITiYqlZpytMkUCAlxow0Cxyjli+NPs8vEDg29waOMP7iblJwCSUyWf0hqFlKX9JMV4M8zsNxcuBIml/Xp4hFgOESmILa9jHULwWBefw6cvb75YbpZH4zHE6jL1cYE/bLP3AbpvME0Ds2A70AMoeS9BAa7bVZjd86X3AW+0DiTNQ4bMg+PzHSAA+EeKST+pexlqIpBzXWllbIPfKiYU+u+hGFtts+uE65LFJNeBhZc6WwCxGp1JAmM3GieOJuqgZvPrBZEtGlZg85AJS5DpveN6DzpbB4BZZHVprbtTFjjxyTrcZLtnRThkPva8ncSbFTy18SVOM+tE+qy/xen3rGKds9HoIJWjLD9hozgkAf3Nd+F9PzHYMMxTPr0bBJ/DvI1C2RDvhcMhN8O2KQ8Gvre0QgcZhBVbby2LjV76qQY1UZMC1lA0lAhTXzyYLu9nEYqbUbU41b 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)(396003)(136003)(366004)(39860400002)(346002)(376002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(2616005)(38100700002)(6512007)(5660300002)(6506007)(6666004)(83380400001)(1076003)(107886003)(26005)(478600001)(6486002)(66476007)(316002)(66946007)(66556008)(86362001)(8936002)(8676002)(4326008)(36756003)(2906002)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SQ+AU59OHE+AHg5yZBl0cTSPzFhpypBzJDJ9VOcJaP6zkSsUHV5FP/MMwSca2uxH59IC6vaAkFSQbvj89kirkUOQ23e008X8C0XY9WX++ZooaOmPK+HN+gyhH+ICkPT7we6az32xzgdribqWFEMLc17hptDdm+8TGlATMWN0ycSIbqN062BDVZZqP9LvGYPyFUvQbHWQ5/r22xTiG/XSo+TzOieiBDFeg5sDeWLqGTA3kpgfJNRz1uy7QreaxLHSnqmFZHiTrkzBZAsOw0VejsPQCTE0AICWrRV9/Lpn6pG1R94BhlWcl0mUXpaR1pY/W75dGW13ndx2EBWGm6bqUirJqnL+NtYHYQHvG1nonzQ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rbUco8cHdqNIUqm2JhCzpQNkU/1bdMn9C+xN0ZmgEKIK8m4f6haRf06onfXeHnMkKdeC8Hg69ek/Huv6bmoXFpzlLurPYyzIgGW96XTl7JcHGUA4hL8KoI75zPbMvBVKXbl1mySnIpL0+wO8lJfGXvvyhzgNF0ECnIhylmRHQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: sgqmlu3HGYkyYP41auNvZxGjSeyXi5FR4yi/dQc8OBuYiGK/qMMjvq/3RfC5MDD5akh/zeAqNshNldXXxe/E7KH/x5i6sl6ZG1fYVh96oIhqtlhTNdwJ9cPWSPh+tcpBCRYlfdJCywpZxb5kQSMdUy9rN3wM1+pw/KRyo5pg7x7AI/Bm+WVVhmBFg4x+QUjgW+DKbYTqeOD+oKT0DH2vv1eJkCGi5cRfrt4JBK1XB9PoE9Q6ZxR8FCDkvKBYxcMnWMmswXzU/WBgFf+DcgqkzTlyb/RUI/3cJ8dsXPILEW6bGMsstf7LpCatWrJP2iwmIIL57T/5dT3C5xu7BJIKEnR+RwgAllXP6O1MLJ8HmHa4aoD/vTQcPIDDaOpwXiGeHupmt5O+fvfnePxNmF3KzMeZcxzAEhYtWmimCYv7EzrbEmiwniZyxNf5xySFY3XewFUr2+8x8Y9YyzMxCNCJ6yggZa54zz0WnWk4HzQYlpwA1IFeo7s7C+aUNlTyAH1qUSyRyaJMSyWJaL22tHcukGdg+j941ClsmvpyzqlKLog657LYI0WU4BvUJg82ZYUcqrpp95mII9MABNlBid0RKvCvcNStuZY/GVYZPRHC07g= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b347a3b2-8b33-47ef-6fe0-08dc1ba96d29 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 00:22:47.5747 (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: dULU+yuA4kNzKjy07ou/402ipfWyqT+fRON9O4Dtj0LeF9y38IJnhRfknjDawgsUZwpXhS4mh2h75YKJlcA72WP4HV0Mf2eTjhMonJPexQw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5340 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-22_12,2024-01-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401230002 X-Proofpoint-GUID: GABDCECPwAAHRrdKp3H6oKfdyUcjE5Cb X-Proofpoint-ORIG-GUID: GABDCECPwAAHRrdKp3H6oKfdyUcjE5Cb 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 Jan 23 00:22:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 765545 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C754623D6 for ; Tue, 23 Jan 2024 00:25:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969523; cv=fail; b=J6sjCFky6ZPS1oQMc13pZqZss+AiVR//t306yh31Rf5MEy65Y4J1kvQLSytc1Xzdb6vBHSbZt8/HPqbUeb+fap4UzKXG+d+RRMxVFVtr6uVjCGtAbcBfP0y87naygk9oy8BI4KsEI7lDmiyWhee3QuVtb5n2pFT2vAZJ8cCRF4w= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969523; c=relaxed/simple; bh=2tI3D8gWPJ0MfGl2ewjkX6WMxNJ+mr818WC2v6BTFvk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=kqfVH7gP2f0i9r5LxOljA+WbVaJ1IytAxextG5Bo/VVyfOQIYkG7Db1J/r4E+lve1Q28uLHADPuz4MwMG7qtXoFdDtd+OufGxz8iO7VPNtCmNqWv5UJwGbEX8UmpyWy+KdJWAugpIAXH3reuBUdlBUZAeBUooTqfcmGj8qEBV+Q= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=CX7eBeVv; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=V51w8YfP; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="CX7eBeVv"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="V51w8YfP" Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 40MMooNE019256; Tue, 23 Jan 2024 00:23: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-11-20; bh=VWU7vDDLwtHRmdi2crHRMzwlX1f1ImS3irU6Db1lEmk=; b=CX7eBeVv1oQA+1iwJ9qZ1orrATtiH5hBaP/T7gnDkwMnZqlZ8ecBalnsNDrPm979KdOm zCL3CsznRD81fSgUplnqXjmtNZrv0iF8oe4fm+elVQ9oGl6fdoihdQiw0OR1WqnIxcHN Pp1bJl6U7id7RIGNp+e1PAaL0EP9UXOIRR+RGjbQ/NFYz5WoXWbZQYgaCEGXR7N9k3ND S1mdK1BK6fWOzh8hpqrIWhd5+WrvT4T/4D9ncv04ao0Op1J8ejf5jc+qf0oS+CWmFeXs OMCJ+EcP8pvAnPIHGjCq7B9hq8xClXZ2uN2WtVXgDsDLTnKlcpxD2d5bCs2i8EMOflNq 4w== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vr7cun2kw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:23:15 +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 40N0DTm1025310; Tue, 23 Jan 2024 00:23:15 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2041.outbound.protection.outlook.com [104.47.66.41]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3vs33s34s1-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:23:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a0uxdVEy0/JH6IY87UyvFvQGzZf5xeAOj4rZxoWYYVMaeXPzt7rwEJe1Y+Y0Vcjd/3SO9KcdqZ5hZMf2VrK34XIn/dbaKnK9NQYM2g+RZcTXwfeaSBdSYc7e5ZQ+kd35dWtPIJqCY6uEvmGZnS0L/vWG+W2v+iJZCPIk2+kvng8ggNrkUl90XRlVEc5XVJEbsjlJqZyAR7Mez+CFLKB6c+15k2Sl9Qal6OANawuML4vcLJuUFbx06p+lQVFffu7ww5oY9zXNwbTbvvpaPXsqRqzCvazACNMdwX1Yil3CHqnk/L3GA4f4StQMAZ24O8geKQ0/ZQqVJK0Jl56SPMbSwA== 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=VWU7vDDLwtHRmdi2crHRMzwlX1f1ImS3irU6Db1lEmk=; b=Qvy5aggRl/7rVjo/L0jN5RGwCJtJNhssR8TtagvUU2dNB6Ypc6FoM7At9PuOa5BmG2Ny8tkdr69Zh71oripsDVMr1VP0SaNjTamGQYUW5LaVSC9pOVZ1GhIXlxUNlipGz8E3t1fiI7qK1iO2ThnKAklpmF7tiZrAD6aBpq9i+yyLYZLBN/jCL4ZJloA1g/wiugEC89ayLD1vZ6EkyetXSl5Rbk4JmWgkDIC5lL2cLzqIvAJeArMGlv6PRZPgobhDQ3nnONsz91Z5XUKneeYcuzTs8j1FpPcHmJdZ2fsw0XwLfTg9qU5tH6vtX2YuIMPTM/I5OaDu2YXbOhIUdGiskQ== 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=VWU7vDDLwtHRmdi2crHRMzwlX1f1ImS3irU6Db1lEmk=; b=V51w8YfPd2cB0v5mgoAn8HlvEtLIpMitf57nV6NN7Fk4KphXmeOrdQPyG5ojJ6OKEMmOOC7a2+TcePCZVTbC+B2p+ZS26UnrNtTARj3gA9O5E5NisQcTzsWgla55538CL3vNP2krFnaAoRqQ/+/VHD+gawwqcOCHoAiN3bYTABw= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH0PR10MB5340.namprd10.prod.outlook.com (2603:10b6:610:c1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34; Tue, 23 Jan 2024 00:22:49 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac%7]) with mapi id 15.20.7202.024; Tue, 23 Jan 2024 00:22:49 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v13 18/19] scsi: ufs: Have scsi-ml retry start stop errors Date: Mon, 22 Jan 2024 18:22:19 -0600 Message-Id: <20240123002220.129141-19-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123002220.129141-1-michael.christie@oracle.com> References: <20240123002220.129141-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0107.namprd02.prod.outlook.com (2603:10b6:5:1f4::48) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH0PR10MB5340:EE_ X-MS-Office365-Filtering-Correlation-Id: 43a27865-823c-4080-e8fc-08dc1ba96e06 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BfAbdGJXGzQNY+RC+W8HmQqL8pNfOeUgnodNE2cXe6YbHAizt/+YiP/jPLy9F5yst0Cq9TSu5IA+UBSIuFQOQMrOL3sjBjE+F2aDb1w3bUhHQwHcIuxmEqDpgNdP4aGUgq0+UV1FU0ZAI7aXGWm3kfGo2GbQoJtD0e8jPJwBXwiO7pclUI/kd1azHYENtKekjD3DpKC5tHNIAQlsjy+IqmT2IRQVdJddfHiv9P/6d9AaETXfWDU0X4yKQO3JiUc5sBMpLRn6+JPKm4lOqVD2UzWmDNm2Q6YVaxmGSwhXKps/N8Ges8HOvZ94c7MWziPCXWYRSFokxeWVct2xGKPAoBLKVqI5WnJS20RfR93lYApQu6hPHvfobfqJTiihMDv3TYlsJAl1Z1bzRkYmw+9/rJpNzp8QmYyX88HI8ogjnd6XcC8gXcS8ByJVvMmOkZm/Y/eL144c2HCDg5g9eg+GXCxQ0adzP/AEzrNT9PiFDtySXUhELPQ6tEYeRy7kQP+3N6k0wOjqk7yOidf8DW8cWGwEjBWgs+rDxNw7Tdq9dH9NoX3fZo8jWwqRiIY6GJ//xFE3M+oZyMmsU7GIBegyc9vt6DjdSlsW27yQKwmtU2oBXgdp6CpfWvD5yfKn9UYr 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)(396003)(136003)(366004)(39860400002)(346002)(376002)(230173577357003)(230922051799003)(230273577357003)(451199024)(186009)(64100799003)(1800799012)(2616005)(38100700002)(6512007)(5660300002)(6506007)(6666004)(83380400001)(1076003)(107886003)(26005)(478600001)(6486002)(66476007)(316002)(66946007)(66556008)(86362001)(8936002)(8676002)(4326008)(36756003)(2906002)(41300700001); DIR:OUT; SFP:1101; X-MS-Exch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ry4LJ9PoCOzzVAzKBolDxf4Dqf+2nEJyr7ft8J1VGMA7pnOof6dqqg+ZLd4nuKclSOc+oRLmWfAM2uMowMBINcSLklj5M3gUjPx4oZVha/Psg67hbYpRLDO/CGqSBkDpsjYpcXB/PjbMqZF9oRbLMEhHBGPn3uV3cnFhQtt9RFBYIggJWBz1KfW86svPTswCsalXZEYAPCb2ckxkW3Umdc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 43a27865-823c-4080-e8fc-08dc1ba96e06 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 00:22:49.0227 (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: HiHtEsEbCFE0DHiABk8w0j2YY/kMEv4iiDd7TOh2hBbmbBMKpIkxyiNijqYYr7RCRhhJvdpFof8Wj8UnPewzANWs40LDjhjXkzmb0bC6BNI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5340 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-22_12,2024-01-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401230002 X-Proofpoint-ORIG-GUID: 9pYkUGSppgvyogalJw-ojxoJV2jdSa3L X-Proofpoint-GUID: 9pYkUGSppgvyogalJw-ojxoJV2jdSa3L 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 d1e33328ff3f..0e4d1ec46699 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -9479,7 +9479,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, @@ -9505,7 +9515,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; @@ -9531,15 +9541,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 Jan 23 00:22:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 766769 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 06A1E15EB0 for ; Tue, 23 Jan 2024 00:25:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969524; cv=fail; b=UreS3RN4Nlircqf1yNwVQqlS4C8RuZ8qXahWHvje4VsUd2Lz7u4PcMj9ORvAUN9DzClsFcnW/zyGFaoXMLajSskagAbPTpIm1hedBNyrGVWNVlUleicersbipBtgVYZgeQxvf1j/ii+p0MLX0o8PqTyEyK63t/kLG72ThG/CA8U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969524; c=relaxed/simple; bh=onh4uTCJ+xNJ0FCMglv0ekowle7n+AIYDifJduGgoQs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=tCAcA/nKf1NipjaqgE7PCCgm76Z12Y1TEXsKkbXr8Jnxl7SW5c6N4UzX+6IO4odiAZfH9l1Ill1/cLdOvE96JE72pV2jbFBBjdETUYoWIZQNY/2dx63FrkZm/8IG2tkE8Km4+3SwKVmTIWDR2pxmLBxy1ToC/Vg8bKu/IfOm65g= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=dHFp6kNm; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=A0ydnrh0; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="dHFp6kNm"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="A0ydnrh0" Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 40MMosN9019274; Tue, 23 Jan 2024 00:23: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-11-20; bh=eItB51X0PkIyMe/AQTx03930LpxTXG5gk2eEpzRsCUE=; b=dHFp6kNmf/BAMs9KhkVxAGltvyh9Am6D4jT3XMW57mpupNPDZiTfBQcKn4AmbOrQEJMm LfQVJLN7s/yehCZIZ36k78jGdM5EykAwN/EvLajbcwmGcY/WWgdm2GjKV9+VT60oi41N 64wN8YOwlfSh30IQ/FgaDtvdahPdyhqTTFQZKKF5I+tuwm0HBay/tmYSsmXjf+BGK+C8 ZwQZwH92+fMiofXjWsTW4RLMoT0njPb3GGiY3lSW9KcBGi5CvU/eYYTNp0Zo5yGlwCjy S29Rv0vYfbsxYt1JBQ+adnBSKjdg2aXZ7Vftx+XRM2v1lWy1m8VRrt6v4k0fW746cU0U 6A== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vr7cun2kx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:23:16 +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 40N0DTm3025310; Tue, 23 Jan 2024 00:23:15 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2041.outbound.protection.outlook.com [104.47.66.41]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3vs33s34s1-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:23:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LT6nNCvIR9xjggWlj0c4s13CmD1OGc329TAGzESCrQ253+qKaqoV0hBGVh1Y1hYnoKketHR5Yy9evVL4AIZphq2jSp15/pA/BEC+dIaWDT1YbtMUTqJoIQ2HBD31vzPJzvBEJWlikLsE0bQtYpBTaw/7kQNitSGtQ7n3Aig/WTGi6Wu0DyYzTtyfMP6lP9fpzqFtCIfRLUFli1MLgCUDpGfMTzrgq35YiNaFqzU9N3L5dbXbVLMcbIS6kjSHUzGEC4wt1Eptg5pQc8DyA3ufT8Dc+CD00aLE9PbyoC7EIVEf0LJhipzYUTxdKiggkj7ku1eDKtfXVZ7MV+1KKPXRbw== 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=eItB51X0PkIyMe/AQTx03930LpxTXG5gk2eEpzRsCUE=; b=oK2rfYnlpOH80gWIxj5DZsYKDojbjqTcyPvfncjCT+QRyTVWUVcbUG45w2eqCRnN+E5xvvYW0JZhV0N/oVt8WWZTRHD811HhSDsEAk5Cy5WtMt9566y61Doisz81evVSBa4SI1Yk7oVUflh4yqFIeMiQs9oGzQe++8UnJ2OB2WA6bLmad/kj/FgQlsiarvl1cuShiPyGbuLB3OzJ72INtD978Gxi7s74KJLmcRIai/lKG1rJAQdOaI8VKWddDd2eZ+jkAEVBMyZsU6UFXXBe01OVUHxFwTsAeedUXimG72PzUXora5/vqanckNmwuNzVRa8n8UYt6gvLsjIjGo07hA== 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=eItB51X0PkIyMe/AQTx03930LpxTXG5gk2eEpzRsCUE=; b=A0ydnrh0uJePwXFK7ueq9UYdZ1ANwmI0LE+Phk6SknA4PGvMsePKCdUq6AkH7XMDZ/jplbBilY7e/LIMKFqsbjDQjAcmz2JwQJpRe6rvJ6IvsLB5wvIJkz09PW/eI2jqULveH6OCaHtcYPQcYp9FuK4Kx3mPvU+ULDsOLxtuhAY= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH0PR10MB5340.namprd10.prod.outlook.com (2603:10b6:610:c1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34; Tue, 23 Jan 2024 00:22:50 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac%7]) with mapi id 15.20.7202.024; Tue, 23 Jan 2024 00:22:50 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v13 19/19] scsi: Add kunit tests for scsi_check_passthrough Date: Mon, 22 Jan 2024 18:22:20 -0600 Message-Id: <20240123002220.129141-20-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123002220.129141-1-michael.christie@oracle.com> References: <20240123002220.129141-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0073.namprd02.prod.outlook.com (2603:10b6:5:1f4::14) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH0PR10MB5340:EE_ X-MS-Office365-Filtering-Correlation-Id: e160496a-8cfe-4120-7d6f-08dc1ba96ed0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5mC7po5ftjGpZdv10ynjQ3ubUDdpYs0QfnaACwvD39+bOpSab3rTEhZGpwMKcj7bUm0h8RbRxjI5dd/0fgYyomxlYpj08qdu1X5iyzaMOVcXyjwkZfSIGTDOI1dbD/CHKNTAFOwOtLf1ossLYlmhRzYCdtQre2H8EKlboydqjKrSOPVWomeJ3SrtKAooOVbBu2lMYgXclfEOwZkdiK72fTlw7T5081Plpw29u+WsqEDXq9GwFPEpKCDlmxB4qX2Y+cLIBIbl+cT0s7Z8/Q9k2OuxotVheB78HfXb70r7igQ4AJF1fN/6zayEQtid2nWqhQzyWL+6bTwKlmoesANXBjF411j7eZ+L64x4JEs117rJ47ol+tMXblv+mKJX3CvPI9xUaAC6aNFpLO9PHztatWwbAotJGA2vhiVZUwU/Uc3BiUnfBNZZwrt9dLwjQw84brb2Gv95UV0htJDyeVAI6Yj7NIUaSzRGbzR0hYHqVHBH955dFgfP7FrHPWPCq4BEtWdKpS55RwUdmCsIvmCH1QDCujH1nSwN4W+Myuzt/jPIvOoXpQdCqF+gOZX3BYqL 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)(396003)(136003)(366004)(39860400002)(346002)(376002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(2616005)(38100700002)(6512007)(5660300002)(6506007)(6666004)(83380400001)(1076003)(107886003)(26005)(478600001)(6486002)(66476007)(316002)(66946007)(66556008)(86362001)(8936002)(8676002)(4326008)(36756003)(2906002)(30864003)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zE585xtvQM2pun+avz7T0tjIn3Ij+7XB2kzSIH8iOrOtw7e54O9Dc3Yfrb9b3Sa0mippizRzWzxRjzUL8S2Rav+Y+/aSz/L6DpuYEX3xoiUnDWgfW62vqUwQJoVHIVlSE+yGKjOGtmESbTaKXHCHJkBFqJYaugVWRR3H1d9P46VLY6LFjzGJaDOBZeQuTYMWo/0n7XsTLpHxevW9ouo01IsVk3lNSOGhU2nW6MXTfRMneODYS45yiVG148pIDkJeFNbnsO7hfigmhG8KgIhdHrYrw7PPHCB2FF5A7M4fezOPRoa+aSN4+qrru5387Gi6al2Bas2+hZ8va55WmlMs4frT3lfu3I5s5VBADfYGhdiLobBIO/l3DIwnSWnMhxbNy41xwV6kSXAPss0SmCnRxYXhRZvzgkfwce3yxEKMgRKHghZnyW4kTSTJRKp1R2RSVIGHy/Y0WRQ9mk8YbEG6NanYUh7qDi+qO4CZ28MFuWrpSG7qs4Gd1/93C0tCirRD9YwzkFHgjxYmNzvqhBGAKoSXd3afusaZcKxSdBaZAErLlbS6FHSUJlPVxoFGmhG/ugsm6+SvFKMhDWlkPhE9FdO0ufAAxBOn4jeDcpR3C/zgJwjv6xEvhgoxPQEuOFt71P5P9OzUdQ92N/NahD7p8AKBY/NYUFOPew/Kf3HN6u+sjm4nHOPMSgQX+XPZ3zavZiLif426M5Bwh7LMQmr5sJ5pg+e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bczcckTh/6R5TUG3bcb46c84gHJC6usujgTL6ocuEjxqoPghrzwJDiCOJmW7/U3sJcD7/GOGVLYXJMM7Vkp1n9MAn7GaoMTx0bd97DxMDfFHui479mT17Zqg7Cytz7ADpwUSVX0TbKLOASYQinvmNXK5WeRehZ56cB3Q2fiFqg95oXYGHGqshvJwpRyGvq/zOhnL9iIGByKv8FoxgEbjrEhSoLvqtihAapzhKGnseM1VaWUjK2+XVq6BYNInbaG6EfI3xzey+BO/NmB5E9zXi8+4hf8hv7s3JE29FaKTnDoj1iNPFTPQUJQzWgDMSlKcXGR2TKKz1cpc8Wavm5ssPyzEA9sG6WKb7mw/yShz3RW4+OQdpCiuowoUjPkp3gBadnxrIH1xNz++SlcZVKSksdUKCZecDNTo5JvcQzWdUNK3qDz0CAf4GygQGmF0eK+V0WrzW03QgXKp+TwVid9+0mB0OGfE+Smq4SNyMfvkiqR4Z7ctC/z0otMMuoo1e+w= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e160496a-8cfe-4120-7d6f-08dc1ba96ed0 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 00:22:50.3315 (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: vxsPtuM3llwPIP1yFXNwDkcs50JgMK9vGj4O1n3tuu9ige9QEZnLe+noctA3Qx5WAd0ILCkOFp7YiDAOUofUdV1oucF08Irfsmi4OxLHPPY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5340 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-22_12,2024-01-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401230002 X-Proofpoint-ORIG-GUID: 9lF1ne4V9GlHp269XQoLJUsweEIYnLn_ X-Proofpoint-GUID: 9lF1ne4V9GlHp269XQoLJUsweEIYnLn_ Add some kunit tests for scsi_check_passthrough so we can easily make sure we are hitting the cases for which 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..e20af95a912b 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -67,6 +67,15 @@ config SCSI_PROC_FS If unsure say Y. +config SCSI_LIB_KUNIT_TEST + tristate "KUnit tests for SCSI Mid Layer's scsi_lib" if !KUNIT_ALL_TESTS + depends on KUNIT + default KUNIT_ALL_TESTS + help + Run SCSI Mid Layer's KUnit tests for scsi_lib. + + 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 9b109192c51e..3590275f712e 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..99834426a100 --- /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_failures_reset_retries(&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_failures_reset_retries(&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_failures_reset_retries(&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_failures_reset_retries(&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);