From patchwork Fri Nov 4 23:18:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621678 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E8C8C4332F for ; Fri, 4 Nov 2022 23:19:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229750AbiKDXTq (ORCPT ); Fri, 4 Nov 2022 19:19:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229672AbiKDXTp (ORCPT ); Fri, 4 Nov 2022 19:19:45 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18485BCA3 for ; Fri, 4 Nov 2022 16:19:44 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Kj6go013351; Fri, 4 Nov 2022 23:19: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-2022-7-12; bh=OSgc68cUk1Yw6y3QaNr1Rl4K6Bk8oXMWY1YLiBnR6w0=; b=3UotaKmgLP/9poKX71+MvasQVqY4SO8Z7EiYWvZ2nBMsTCrJvckhx4NgdmT7euqZiN9+ GzchKnMzPzgqWEU45Ldd28/vejoA0BywViJM3GSZnc5LW00ac6NtNDIKIkEjLB/Mu/mI crBn5AY9SSaeSfJrVU7AZvlkoV8zdZKvS3m5MQv7yECswojDlHJsjSArtO68+WPU/Dp0 1smiT3NJ+v4LumJsOD6hkb8psWOepDnqJvK9++N9PWKHoHaVP+8HyByF2arYH6+3IVjp 66WBWDTvNiJphmbj/2endPiSKratXCcE2g4QdK4KJs2RkKmVSpMrmCjEwSM3FSrcBpiU Gg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgv2as1h8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:19:35 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4LTAMk031986; Fri, 4 Nov 2022 23:19:34 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2172.outbound.protection.outlook.com [104.47.73.172]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kmqb6r8ya-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:19:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J0/fENTs0VUyzXgkljH6Tzg5h5TJQnPhCzWWb37+5eyAfkATupdp/26ZgKTeXUxFFuCk9gHGafl+aXoqqU2YFNLaZhpYIO6jhtuERkRLyWj1LzI1IRZRW0wQhgcqNI98mpvJ0X1eQKnkpWlXCo0qSdmhxODv+Azrt6bXfMzW4K6KZK71n0BOU+tuzaMzj1jZIXy/uaD9vRjzHSPKbPjM8TGvEqp3MWHkimkpfo8V+K/XdUpE/oJsv5Fb3Rchl9w8L/yScQSSqBjV5lfRPrOCS6LDTGsXFu6PjIoFUL2j5jCABRwOiGBVScDc47QpWVb0OIgDSJxUdoKrdcm9lMoKeQ== 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=OSgc68cUk1Yw6y3QaNr1Rl4K6Bk8oXMWY1YLiBnR6w0=; b=QAdB/R3wIz3Mr3Po05I1IX4NR0Q1ptvXQnf3gfEZwiPPKffemcgd+IHsqwuNN66tlUM1qtM0aIctFeit2mRB2+jOmAJXhQvfcCRH/VK8wvoQ4pOgciQV3FQkOrvPJFX/pTAYNLbH8uC3rUQa+6c1CNX10VBRoVinnHCr9upp/SDzJdGl46IJDbETmDaLhkHQgYX05CAdS200fDxQQWiWI8X3wG1ZkmtQDJGeNs2c9w+ypTPn10dsItuSyMeEC8t9HxZ3OCETAoBmnAGB62HgED/N3pz1ebWHpmd8fxLRmg6qpSCcKaw/NdI8GK6v4TeIQ/DXsBw6cqPcpM4nIfPdaw== 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=OSgc68cUk1Yw6y3QaNr1Rl4K6Bk8oXMWY1YLiBnR6w0=; b=IARPwjSlV6P8hBpFNreVXH3UJ06S6zZWRSpl0sTuTDLd53ds7tiiYvy4bEUgGhyiMYtTBc8b42787BrAkUiNkxNQKdiySYvUAjfFaX+svisxgidFDAsz1VvsrFRZ7VzGGEN2W7C5ErDtRpSrMH58aBr4riWFGTE9Fnf8/zS/b9E= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by PH0PR10MB4743.namprd10.prod.outlook.com (2603:10b6:510:3e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 23:19:32 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:19:32 +0000 From: Mike Christie To: 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 v6 01/35] scsi: Add helper to prep sense during error handling Date: Fri, 4 Nov 2022 18:18:53 -0500 Message-Id: <20221104231927.9613-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR03CA0266.namprd03.prod.outlook.com (2603:10b6:610:e5::31) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|PH0PR10MB4743:EE_ X-MS-Office365-Filtering-Correlation-Id: c2db89a0-e38d-4e2e-f7b3-08dabebb07af X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Xoy+dtVrp97FlaoXSjan6AEB1SmYN8BELvdYlLKL3+Euyu9thzoKxgQETsiOuAVqfwe27MBavAjnOavWmTE63q+Az99vNn/Idtqaqkk5R5rd7rxV6q7/74YJ+EqVcTkSu3A75a09QZtEVepPst00pZmkaXRen4k7AEEqfJshfq8c1g4efdbNKiGHbGeCtL7VvqEsSlz75FjwJtof8J+35knkYM/mU1CSjyCmj+OgSus2PPtFKgSpYFBpb/p/DwsY7Oq2Mgn81bg6DuZaBjb8kcOHwaHfAEDqbnLqQhdNc+WmqYywNJdoW6mwwbylHCcwK3t5U3gkV23nOGRNWsyqM5QwXusk6mjFm4ods1q7Ydcw6hATZ7Y6XhImkU7zsx1rrpwqGnr9zYSvKqZHG8EuITq6KN5tKM8qam0ifW6j7dEObH+8Y6H25GW+927v0vYfbZhgcEAz9w20zvqsUhdK/mIGLfSotO21tzFKR5bxVKYwyHA2rFnFsZp2l4zX0nBWJuZKSDTkF4ZfdcdUGe6ZIvP4+/8j77YGVwuETZbT8V512w1k9xw6kmoRCVMoLEAJwIBnS3aX3boJWRh/vH/8llLp6hT/Jgk9CRrpmLJDqZiNed8qFwqL0qonvWnlaOqF0Lt8ilk1GR2USVNSYl4xLE8Bx1Pwkb2vq8YzkKoAL6IXfgT/ZkF4uvqWs9TZUsd4MH8IFeQcCm2R1at0wt1gLw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(136003)(376002)(396003)(346002)(366004)(39860400002)(451199015)(186003)(5660300002)(2616005)(1076003)(478600001)(6486002)(86362001)(316002)(6666004)(107886003)(38100700002)(36756003)(66476007)(66556008)(26005)(66946007)(8676002)(6512007)(4326008)(8936002)(6506007)(2906002)(41300700001)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: InE2U1SeYFYFx/axFtxQrX1aqS0yl2bOSlMFmOFDCU5ie1AQfxeL1leEbthVEE+koGM9QlfsKqM6PP4rsMA16qeeE9j0rS3cmn+guThSvB6cxgQb/V9Gpa7+gASjT3IJ4n1QDTQ8UCUlfeML0C3DQs8gzojxThtQgDSvQHo6kx+B8cs7yV2gPTWbji6xvGZ5OxKqRMs0mfYXbQK11/mIuKjuP55D0eID/3MLEvabF/YMlaHgfeECtcU+w7zMZqL1jkPqGG/hWWVIMzRfshD2unrH1WRI6KerWTqsuwcWIDsb6OVSWuA+vwLvF30evHj9aEHm+myeAvEhQLlZb7zrKWXJ8jXaBMr1+h1IqvAPZ7uJVRScX1mUR9qWVuVGwcPxD0Bb7T38V2yGog8S5pDitBVF4wZ75GxA2dBBol/W8jKy7QOb9HwRiQcas/FYrMCH1wqCIDIOcJzpfLC03Vi3caZhQ8kU9C9q6dSQAesw3gmFXSdpGz5uUo7pUeaVZ95GP1MgPF/0JTEpgiQYOkrX8Wl5kDklChmz/N1vv3wy7V/JIzcR0bIYuCrb+dOZxoo7UFXbJznJ6N4RwjZiTE8Wz3cb2t1nS0DKApVstfedmXuSO45Z7ana62/IWIhNFHIvoV809yuh4eKIFtm/8u1/X02PaR9hnAIVKoaHvyyhnVKF1Dg4WSbbF6MZ/9NHqBzGzropyPwY/7RKQatRZ1iGKnYC8wLKHxBlxsG0y1eLEr/uBe7Zlsogna59dCO+KqVdqiLOrR05PP8nSG8fctxxoeuxHNltF9rnoQXv2JMm3terp2Up476vXw2CAr7W6GESYUEOoqhA2dFJSBGD0w68VKFEqTbZAqkbnoeu+aGYxFp4xgj8b1QiNJFYp7XPcW3dVU3BMWI5JUQBWD8pbGZWgP2Jnz9SScdFTVH5S7RAOz8qR1f3++1UL+Z8RuYgFmyecWY/vmzZloy/WfQjxpVH+8WScxUrYEegT9Zn6ysFnC62m7W0ARGplxI1/QWFI6ye46hh6ZqCP2Dui/xvFuQfTejk2FPimASjVrOW/j7gjuT1vFLYlLLTYWMhcyRY2ZHpwQSIqKtOBuYy6rfxv/Z4Jtx3IrLBzpzRaxRCK0qqOutxf0BhQc7sq+PXNJQ+I5Eblyt1TcCJZKp3U1prj/nAVsFtXpQSrKt7QjpnOe/eB2JVol+LhgcYB7tFr3MKRDsBG4wLU/9xTUM3HtDuXkMm9v0yH+ucoklKPZ7iqIeU+TSZ/AVqbe3fbIimR2dnw0il004przwu0ankM8mvS4y/3jZOMuVtNq+ITlQ0n/x12lJLJNFdbgGDQD6kJaCRQL0mU8cr2sv1KHjIdwhytNmnF74LkOQwQbp5c1Gs9MVizwcyOlqUO0Bng0O5hShHZgbkEAzJ7fcID6bvdo0ecK+OCjd2BK5a4Hrilb+Go79snVyr0ei/bR3Dad+yeIAs4pKk68puPoyz5X1CdAI39ia69WX/kzxtUYzyBRFp7kwfnVxA+0ON8BFmAhNfqGkgVccV9B9QTq9eYTrZI5xxl5jfJPwfFuwO7g8QehQf1icw+VF3zQ+imEgAdnIK5EosOck3BTq9LGT7Tsv8A2ss7pxVJA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c2db89a0-e38d-4e2e-f7b3-08dabebb07af X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:19:32.4730 (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: aFtqlxnLetZmf32CEyyC4t435AIvJILMmNseKXdO4yihnmvYIeRbNMq2Xvf5otyK7DGqPyFUnn13/+Pd5gSZY2z5ertn6zOewjp8mR1VjSw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB4743 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-ORIG-GUID: uVF1of1mNaJKtEeY-pgRzcww4xhL6WjN X-Proofpoint-GUID: uVF1of1mNaJKtEeY-pgRzcww4xhL6WjN Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This breaks out the sense prep so it can be used in helper that will be added in this patchset for passthrough commands. Signed-off-by: Mike Christie Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Reviewed-by: Martin Wilck --- drivers/scsi/scsi_error.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index be2a70c5ac6d..994b7472fc56 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -517,6 +517,23 @@ static inline void set_scsi_ml_byte(struct scsi_cmnd *cmd, u8 status) cmd->result = (cmd->result & 0xffff00ff) | (status << 8); } +static enum scsi_disposition +scsi_start_sense_processing(struct scsi_cmnd *scmd, + struct scsi_sense_hdr *sshdr) +{ + struct scsi_device *sdev = scmd->device; + + if (!scsi_command_normalize_sense(scmd, sshdr)) + return FAILED; /* no valid sense data */ + + scsi_report_sense(sdev, sshdr); + + if (scsi_sense_is_deferred(sshdr)) + return NEEDS_RETRY; + + return SUCCESS; +} + /** * scsi_check_sense - Examine scsi cmd sense * @scmd: Cmd to have sense checked. @@ -532,14 +549,11 @@ enum scsi_disposition scsi_check_sense(struct scsi_cmnd *scmd) { struct scsi_device *sdev = scmd->device; struct scsi_sense_hdr sshdr; + enum scsi_disposition ret; - if (! scsi_command_normalize_sense(scmd, &sshdr)) - return FAILED; /* no valid sense data */ - - scsi_report_sense(sdev, &sshdr); - - if (scsi_sense_is_deferred(&sshdr)) - return NEEDS_RETRY; + ret = scsi_start_sense_processing(scmd, &sshdr); + if (ret != SUCCESS) + return ret; if (sdev->handler && sdev->handler->check_sense) { enum scsi_disposition rc; From patchwork Fri Nov 4 23:18:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621677 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0610C4332F for ; Fri, 4 Nov 2022 23:19:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229678AbiKDXT4 (ORCPT ); Fri, 4 Nov 2022 19:19:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229783AbiKDXTt (ORCPT ); Fri, 4 Nov 2022 19:19:49 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7922BBCA9 for ; Fri, 4 Nov 2022 16:19:48 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Kj7cj012094; Fri, 4 Nov 2022 23:19: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-2022-7-12; bh=BCWIeFWexGM+EZzIcj0uH+GNpoB5fh6FpGLnaaU+zYc=; b=wpqqQAEZKduKDEBhO+6OhjovAqWm9AHC52W35+0xzyFQi3KGHwRmvtDV5Y3rR26scpcJ 61D/gtALLYubY9cSJ2PQQVz84dQtS/j/CJ/iGcXXKg4wa1CVTthT2ltTMsN4kP4MCxeH Skwj9HckHmz261Xl2w+TlP60roUfgVnblkHgVLilSm3V7MerBFnHH0nbn3uh9Zg291M4 INLEH+kk7IRPW/lfHYHf+mTYfp8p83OU6elG/STdP/r+uFJPNYcI4oGw5f0rjnqnxeu5 bmDz7NHo8SFw7CFdZL55tVmIvbdByefTltK92vzs0awjOdgadfRrv1WCJ8O7WxZs3gvT 7g== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgvqtshtv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:19:37 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Jx32U029754; Fri, 4 Nov 2022 23:19:36 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2173.outbound.protection.outlook.com [104.47.73.173]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpr9a7s0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:19:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iQGCY26zLx9zzDTsO4NTrZcupg1DD2dPNRqelZdOfECDPr1+57Abv4cGd21tFeoin9rn/0YRVr5TV4rNRNCP9jNNGuzpFLD4Q0s/5UKZy7/tVypfVAhM3SM9I2F9voSuyTJ9yE/fhtnpqi3/WiRUa5EgGapo50g8wflJi6to4wCw2KOBWfI+/VXEhd4tlOtEUYU/wnWJLWUHiLqeMlAOQ0oAPJOW2AjByPxMHuUAlI4TS1Fc+dOgzJcOuRN62vyEG47WCEtbQD9jg6I5tT3CraPNSPGc4M3FAdweR3To7D60cq3+gJ9OHh4xnHCh/BGwTL1s5aNe0NU7bQq6+XT7EA== 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=BCWIeFWexGM+EZzIcj0uH+GNpoB5fh6FpGLnaaU+zYc=; b=JmHdJaEUzBiFziBGx8GUbtwJ0VzI8eNiLFPn7EbW3dxGx/06VoINhe6Q+5RTXzopVWZtP7fmpyr2lCf0kLRYzUN+QPR36yU0JM+3y70SZMzIbW2FZGZjcgxom2Qrk0kicwfL76L0kfagt1H4mmzxSwJToyDEx/gF1MNSndl490v3o1y2yZRsVcYMnTNx/4I8t/OEQic/j7W3IkrSBnsHxvrL4MBvqvTQoFF0cXZPFAiYKvW3GcMYCJ+o8W8agJnqhXhCiNfgVmm1iEnSkXen74gdYU0WHPTbBjhkHUk7QIW+d6eZIe2T0m3sBCrNVkifRlQJLvUFkR2afiU9dtZUlA== 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=BCWIeFWexGM+EZzIcj0uH+GNpoB5fh6FpGLnaaU+zYc=; b=uXps/CMIFA6+HvL5OejH4nUa3bPpkBrdUYkCS41v8pQP1plJITaqFYG0OByqDdHBZkI5+jLk/xDxn9b69iFtYnetOwHQuq1mD2dU/20dXKoab/Nv+nIh3KxD+h82HL1VxHRez3yeb3GDOt5ID4JA2KVZgfVZGJgByBQqwlogB9M= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by PH0PR10MB4743.namprd10.prod.outlook.com (2603:10b6:510:3e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 23:19:33 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:19:33 +0000 From: Mike Christie To: 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 v6 02/35] scsi: Allow passthrough to override what errors to retry Date: Fri, 4 Nov 2022 18:18:54 -0500 Message-Id: <20221104231927.9613-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR03CA0250.namprd03.prod.outlook.com (2603:10b6:610:e5::15) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|PH0PR10MB4743:EE_ X-MS-Office365-Filtering-Correlation-Id: 1d806aa9-848d-4b8f-3907-08dabebb0878 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ObDOUn4FDBa8n7x3VXJh9XGAk0+h8w4LOwEB7SsOpx+6LfrrvFydigw1k7EM8pYLF6dYFOEb9W3qS39dJ75jRDOVdAXu2tBAtK3xIEEhTSn00Eue4JD51jNuepzoBeJrf2oEOy+viRZT9erS9qj5fzi/RrHt9k2/k/IISAuUvZKwWbp28gbVf8w8Fum7q13KW1iq1ZHgs1l/MmFOQw5A7qjpwKblYQ5vmRKUNSSylkQ4tpD+u808seTH63sTo6FScw8ZoGPqtT+c07lf1EjIGbdzQ2ly03k3o0swrGrP7dfmPE0MAnQfsgKk46gQc+LyDS7duRurD4wjHaRIqSmDvX+WYPAvIiLchubBzQKE2YyelhxFuR30IFAjSNaTySJu5BhbcgU+ZbB4m89PmnPdqwWR5990r6EqD6qtlenwAe5sFv48kk9ZPKubmY7XM7dGYsU9mPOSlAAU3ZF4KXldQCgXJIST+vcpze+TDc6vbFTQbgVunE7UplrBZY2DRYC1L5H665I1IjfzLqTnlz/zvLJ0JCZoEx3NiY6ernTRn5BQ5yIDsGrxXMDqh8Y3VaWHfGsQKG9SlemAjSBBDBMk/UvsGFOGYQGN4YbVjsIHuZw0CZeEfZcgKkAxivWwB0zj1H1yWbzOu2ZQwL6D3AsYqbuqJNGFi45mTmZ5S4gNch7jUnzpK5n6pTWNhXm7tRB3DWY8HckKCuBFNVESjyMqRw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(136003)(376002)(396003)(346002)(366004)(39860400002)(451199015)(186003)(5660300002)(2616005)(1076003)(478600001)(6486002)(86362001)(316002)(6666004)(107886003)(38100700002)(36756003)(66476007)(66556008)(26005)(66946007)(8676002)(6512007)(4326008)(8936002)(6506007)(2906002)(41300700001)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dsUOQF/pH6UFBin7vOqEV8VdVuU39rKeIgFBOSCbwvLkSXptfuri86rNhqHCpKIRUnTum7uQLYK+3qxB16F2xFdvbo6Thj2KvpObv5XG+pK+INvdbrvxABSbW9mXcXeW7vc+a1nmD/sIq9VsIic/XE7G59qhKPAhnewJRRy51sp2LrXuClKJ2KFrLre3MKLeSMnlVZ6Yb8SchKOX6+LgkmRypB1Q1D9wjkH2ruVqOeYVFQ5jdPOYpVWNBmKtjwHIZirV+YwN7sd/Q2rD8lFFLz2Hev1/4ostyi+7+br+9L7R3SL52z6k24wKMUlwdQTR4Lf2e32ec0y1TCSahTZP22ZnrwM68QcR+NspV35VUMOW2NcW+EJ3eQnLirDi+i2wk8iD77qa9B9RFOEKGpG4auoKt9DUSGDrV99+6tgEUoFHCAHyYDJ4GY/73CuZpZbWh/M2R6Rpf72s39QTToOu8UUsRw+L7t5A3wsb+PjR2g5YjPFW4nzQ/aIJ+ILDCcz3WlM5YBq1+ePuFEkCXONlnAr16LbaVZ9migMSMtwEaEwFEerk9TwXnmpiXVPbXSLt14RUZN96sDeIMtRoV4uP2Rp/ybF7eYQbTBYwB747lr84l7JnMXb+CKXrwxPO5TJbqSkiM5omP4Q9YugL/r7d8p++fO63ZOJPqWmvQf6QNz2++Koq0vb8ERD1ShG5sS3b5RnpbfA+ZMVbP1HEHEksdcOhw4ZHWqRDrWwED0XMq/njLik4IDB/e3B6EyR9fYXzvueUgyzT2tGenADA6pZQ03hbD5nn99GBXEAPM60ByglIVkdZYyui4Cwd8pGQxrhw1F0PUpBRnESSnwN95mWz1tb4lCzA8vqleEbhXgllyjYm81sXeTCa3TeSaSS66mPS8PTrPHVqdCj4ikuPqtc9UzyGOsDVcv0d4FIsaqBA5Tq+DASRimB5LYvaBmHOUE6zryeNb8r4vlBVGU1yXaVm3i9xWrwL0L5FF7ytADKkB7qiuQ9xVYuCfWurreF/JZkntUB8YTg3qwnhBEQ1nq7fwLRFLmGk5MpAgRoNP6/ea28XcXY57aevGs1/72W83lJRZKaV8U6DyYnLGdJlP6ekqs4X70y3jYxCWi9yCwRgTEpl5GOzsq+T7x9BvQMNm0KAVpTaGdTFUZOl/78Sr1fMQYQQVFvPSK4aHSwY/zYV6N4e0xz9dFcWpH6faZnRsbdIDbvaS8I+aRRnqVr6bwaGKwFyoKr2wMuD/7MzN97LZY1x2jhfJAZPhpkL9HnJ53R4vFdxU1G98e3fYXFaJESdQFMOloTBLDG8Mwhc3LOYI4/dI8P+IpJJlzZl2oL9t1vT4S5cnftj4Gi9FOpoiLa1dEDj0vWyrxDm/SxR3wfmtNWL2G/eAvT/71ODiBGM7c4qdxbGARjurOpuc9MG1TfgK6jR+9PNM7uEHwK7saO0BSvrnDdeqsvor5hJ+w4qTIGKBERXoQhJOHtwBRWoyhdl75nVInCwnOV1CBdwIv4+B7sGXQCRIyfJkSAqsJIG7Q0ABIjqtaKtSOo/PBkvFFGepZJ0MHH2+cEEXPniYYsEgBIEE4XUTv3ZC/vVQOhdQ20q8MP6Vrp/uOnVktmjRYNklg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d806aa9-848d-4b8f-3907-08dabebb0878 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:19:33.7854 (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: 5N0YNLVqtZ5lBfVDLWwT4Qyo/gwBbSTTXSugj+kRJewce2pRWEgh+dyXWmfKcaOaaluWru3dt4lKcGxxxHokI6jG/7Exz0NbsZZYXS1s3Eg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB4743 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 suspectscore=0 adultscore=0 phishscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-GUID: mb043vnkJaJrHRgKBY_rg2plmwJmconG X-Proofpoint-ORIG-GUID: mb043vnkJaJrHRgKBY_rg2plmwJmconG Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org For passthrough, we don't retry any error we get a check condition for. This results in a lot of callers driving their own retries for those types of errors and retrying all errors, and there has been a request to retry specific host byte errors. 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 their sense parsing and retry handling. Signed-off-by: Mike Christie Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig --- drivers/scsi/scsi_error.c | 82 +++++++++++++++++++++++++++++++++++++++ drivers/scsi/scsi_lib.c | 1 + include/scsi/scsi_cmnd.h | 26 ++++++++++++- 3 files changed, 108 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 994b7472fc56..77d7ad07645a 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -1829,6 +1829,82 @@ bool scsi_noretry_cmd(struct scsi_cmnd *scmd) return false; } +/** + * scsi_check_passthrough - Determine if passthrough scsi_cmnd needs a retry. + * @scmd: scsi_cmnd to check. + * + * Return value: + * SCSI_RETURN_NOT_HANDLED - if the caller should process the command + * because there is no error or the passthrough user wanted the default + * error processing. + * SUCCESS, FAILED or NEEDS_RETRY - if this function has determined the + * command should be completed, go through the error handler due to + * missing sense or should be retried. + */ +static enum scsi_disposition scsi_check_passthrough(struct scsi_cmnd *scmd) +{ + struct scsi_failure *failure; + struct scsi_sense_hdr sshdr; + enum scsi_disposition ret; + enum sam_status status; + + if (!scmd->result || !scmd->failures) + return SCSI_RETURN_NOT_HANDLED; + + for (failure = scmd->failures; 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 = get_status_byte(scmd); + if (!status) + continue; + + if (failure->result == SCMD_FAILURE_STAT_ANY && + !scsi_status_is_good(scmd->result)) + goto maybe_retry; + + if (status != __get_status_byte(failure->result)) + continue; + + if (__get_status_byte(failure->result) != + SAM_STAT_CHECK_CONDITION || + failure->sense == SCMD_FAILURE_SENSE_ANY) + goto maybe_retry; + + ret = scsi_start_sense_processing(scmd, &sshdr); + if (ret == NEEDS_RETRY) + goto maybe_retry; + else if (ret != SUCCESS) + return ret; + + 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 SCSI_RETURN_NOT_HANDLED; + +maybe_retry: + if (failure->allowed == SCMD_FAILURE_NO_LIMIT || + ++failure->retries <= failure->allowed) + return NEEDS_RETRY; + + return SUCCESS; +} + /** * scsi_decide_disposition - Disposition a cmd on return from LLD. * @scmd: SCSI cmd to examine. @@ -1857,6 +1933,12 @@ enum scsi_disposition scsi_decide_disposition(struct scsi_cmnd *scmd) return SUCCESS; } + if (blk_rq_is_passthrough(scsi_cmd_to_rq(scmd))) { + rtn = scsi_check_passthrough(scmd); + if (rtn != SCSI_RETURN_NOT_HANDLED) + return rtn; + } + /* * first check the host byte, to see if there is anything in there * that would indicate what we need to do. diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index ec890865abae..fc1560981a03 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1128,6 +1128,7 @@ static void scsi_initialize_rq(struct request *rq) init_rcu_head(&cmd->rcu); cmd->jiffies_at_alloc = jiffies; cmd->retries = 0; + cmd->failures = NULL; } struct request *scsi_alloc_request(struct request_queue *q, blk_opf_t opf, diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index c2cb5f69635c..016a371715b7 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -66,6 +66,23 @@ enum scsi_cmnd_submitter { SUBMITTED_BY_SCSI_RESET_IOCTL = 2, } __packed; +#define SCMD_FAILURE_RESULT_ANY 0x7fffffff +#define SCMD_FAILURE_STAT_ANY 0xff +#define SCMD_FAILURE_SENSE_ANY 0xff +#define SCMD_FAILURE_ASC_ANY 0xff +#define SCMD_FAILURE_ASCQ_ANY 0xff +#define SCMD_FAILURE_NO_LIMIT -1 + +struct scsi_failure { + int result; + u8 sense; + u8 asc; + u8 ascq; + + s8 allowed; + s8 retries; +}; + struct scsi_cmnd { struct scsi_device *device; struct list_head eh_entry; /* entry for the host eh_abort_list/eh_cmd_q */ @@ -86,6 +103,8 @@ struct scsi_cmnd { int retries; int allowed; + /* optional array of failures that passthrough users want retried */ + struct scsi_failure *failures; unsigned char prot_op; unsigned char prot_type; @@ -331,9 +350,14 @@ static inline void set_status_byte(struct scsi_cmnd *cmd, char status) cmd->result = (cmd->result & 0xffffff00) | status; } +static inline u8 __get_status_byte(int result) +{ + return result & 0xff; +} + static inline u8 get_status_byte(struct scsi_cmnd *cmd) { - return cmd->result & 0xff; + return __get_status_byte(cmd->result); } static inline void set_host_byte(struct scsi_cmnd *cmd, char status) From patchwork Fri Nov 4 23:18:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621674 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18CC7C4332F for ; Fri, 4 Nov 2022 23:23:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229581AbiKDXXt (ORCPT ); Fri, 4 Nov 2022 19:23:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229527AbiKDXXo (ORCPT ); Fri, 4 Nov 2022 19:23:44 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8882160E7 for ; Fri, 4 Nov 2022 16:23:43 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Kj7dQ014044; Fri, 4 Nov 2022 23:21:34 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-2022-7-12; bh=no4PE5ebOc9JmtWx6EcSDPOU5QRXvgEbkye8oOC7shE=; b=OrlF/jajpMg9V1WHVMC9DZq0feJIUkA/3TdeuHoV/h0CDr6eKUI6lcuIsN92fsJ0BGu1 6h5hJKu9QC8T1Iwa3hUEe86wMoMkUfzzDll4v9i40McxnE6+c5z3xtH9/Bdr1yeoBRFS NGiDZhuH5orPGFnFXXuRXyzMGFPb2fFHwy60VPWOtxCYioAGssAGYmTfUma0LYESGs/I okurmUn1DBiJVhNZzaIVag7+0DcAJBH7RCZo5yboVrkgzwK40nMf/mKp0sl0ifChwy7f iFjRLZ668Oh1/8Rko0BGKgGseYVpyFlhboSN/IgKt5y5OTotDfoJeSqYpB/KZShMrHIU 9g== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgts1hgxr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:34 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4MI2F3012011; Fri, 4 Nov 2022 23:21:33 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2175.outbound.protection.outlook.com [104.47.59.175]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpwn8cpa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=II/Z1j3kiAW3wDHRntqfXI0BA0f4PIsNYpxs+au37A5lP7Png4QJFScIOVyUJcMK3F+GZJa2LShqT4kAuFNIX/fc8RXLPOrkOv3B4o4Z1sX1XhujG9BCbGz8HKCeOxHUJKpEeIG0ow8q6nj255IMQ2KjbLrp0v6JXuTH36+YRT85eA3a7CfudtajZbLij+d2p3bqd/alF/6cqoXT+69JrC5cSMXxB2q7+wiZScwxLaBxSVrizk14JzsYhkmV8USqnMuiWMuqk58SXBJYjCtvxiflQ1S0NG4Za9vvh2AqeO9T1UwOKmijL+XCLAWDrbaeEEf19SQX4CPURRZ3MPlDgQ== 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=no4PE5ebOc9JmtWx6EcSDPOU5QRXvgEbkye8oOC7shE=; b=bN7iAjhpiyZMz6XqULW3rop9L67HDP0F2IZQv4glu1Sy+54hrUyHUwWGXsYd3fZi3xAeYBO3QbMfl9c4she8zXMNOQDAHqj7/q7Xg7kwoABKWY0tcj3A7LqVfQZTsmc1Ty2Me3fEi1LQ6j+iP2ub54U/BTOMpIKdwwyXeSlE7WkbzEqhgsvdBU0UNusNMaaCQiHJGUC6i6X8GvjdB5Kfam7ir+WKWS0knvZFw9Gd9ns2TQZGZenfOfhCHRDYBn0uSdmPa1jhnTGhiKgB6MT3yu74FabYgBN22HPeSOrIRTmQtwvyIKyoaxYjjvYqMkSx/GqnpUBb8nbA4e+xejjDAg== 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=no4PE5ebOc9JmtWx6EcSDPOU5QRXvgEbkye8oOC7shE=; b=BCCvDqlS1AXQR6/JZCNSzcHATq/TeGKVlG2jgxOgqYACQ7LFe2XExm8PV2Vt/fNKXcNTyt/0cJkOoSTv6tC4/QxJtzzw9qUFz9YmhQFIxfhwh2Acx5IdNGnGeWMZ60SpuYQj1BCpJ1zv9napP9hzVG56v4hzMKAxc4Knfkdg5Pc= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4433.namprd10.prod.outlook.com (2603:10b6:303:6e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 23:21:30 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:21:29 +0000 From: Mike Christie To: 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 v6 03/35] scsi: Add struct for args to execution functions Date: Fri, 4 Nov 2022 18:18:55 -0500 Message-Id: <20221104231927.9613-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR03CA0263.namprd03.prod.outlook.com (2603:10b6:610:e5::28) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4433:EE_ X-MS-Office365-Filtering-Correlation-Id: c66f3150-0a40-4a0b-c05e-08dabebb4d80 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xDiVHjqEsKz8pdckBzyIB8dDbsv4K22fUTffyzijrXpNa9VDhyxOqeIEp18u7TBcsae0RW9YL8NeVNpofjatrzQTGOgfsQB0ezY9VJHW6EYLFH+keCiG1ZnrNzVwBrQRJJYh4ITpkOV6LPWirKxWf5eMDu+kmz0yhShSJjO1qNvGj+gRNFZKPSWEXDei5QrRwJrUFDfIsyU+tp/+CZRDM1aJTpd5H+ZxUGJcIPoTmsByGQ3Ow34T6R3eo3II8lxyCwnOj8VJjGXwpypT/Np+i8QlB5xiUa9qoxuX3ZCRJNJHucn7Nx34SBVoFkw/7GgDD62VLjbMTlkM9aDw0pTAOZT0z9stcbXWKTMkDc7LDFOY1pVii097k1Mk0ZdwFSQH6PswUDykALVjraQxSvFc7euOJDIN1s/+rhSxaNY2QQ9RbRmx2dltlc5dozyl03WBz2oO9ZtthKBpticOTtj9BLtlrtce4LVRUGyHl5zZQRXsZH5SSuDo+6z2CBemxBiSYicHsqNwmZsKRXBCtwPPPqk9fPIoponO7ZLu2aoB45ClcVPy6+v8kKdClCjBUGDGV5fbgpnM6JjVXjkK8vkwzhz4cDUMUU5gkSF6cJRMzfbeMgfY2Mqviq8ROEPGfXl4qvuMu7wPwvPVBz9iaK4jlGzDO9K/ynhQ2wqEKb2QYf17XNtd+twGlcfVK8gplvEaNQB8BQCrQABEog7xRMpTqw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(346002)(39860400002)(136003)(396003)(366004)(451199015)(83380400001)(8936002)(41300700001)(5660300002)(6486002)(6666004)(86362001)(478600001)(107886003)(8676002)(36756003)(186003)(1076003)(2616005)(4326008)(6512007)(26005)(6506007)(316002)(2906002)(66946007)(38100700002)(66556008)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: x9ZSQ4Gq7SR2gv0QB1iJYRWPS7je4E8YpCYvM+gcKAezA3rWpbVLnkwQIs3LWR9fNHCjT4ORHBdBXNq1j4vgazk6I4af4Jngd7gwGxS9BJkL4kQ+zHIKsNjmJsz0bKBjB9S0LMANKo43HNhmjPrH5SzpW26eK7qIL9d3fpqVbjvYZMleL5AkzR+SbplSYGYJC5XrnylF60V2X4O7HAcqIdit3azJw1BsIRbyheJQMJeG6x4T/xSnzqPzm7SEPJ1ODUV1V1KQdoNgQWMa5hqNmwb4o0H0935FIC9SOIju8vVAHdLPQRYYLvMk55TJfpudx05GwfHmP6k6Vxi9XYOtOWpdLkkNMQ552alv692jOWC+xKPysHnRxrBnhbMg1tsamnjQt/IvvY8M4GOC72IRL7SxJncdn7FEV3ju22l32aiWrDNRdmsUkQIi9HBxYFwGsiXS3aK0n5Uhp933Fn1cWFv7zI8G9O+8e4Mcpnb+V4NkBRB37gHLl9n6sbgZw33chDsa3haEmpBF4Aubn4J1yTlLtOligMKMVnEnbbiupD7XZsJEh8t20g99rUBl0uJs1giaVViE7MdXLsCLa+0WLFbHPfHuPpfhVPKBT/AX0lewbbRd2Lpi3CW5tcxVugtbo/ocdhUK3zz0gE+EAlPbQEEISDAm1OM8/JT69NYMVa6wPyYrk9aUsmuMmOUnDNLeJC8gcg0DPpK4adBkpj3SS6N01/qYE7CDI+ijeq0A5EgJT94FvQF20gsXFnp1WLXqFLxxLAaUb4xlqb4OHat1yUlZD3QTNUj/nqAgCzu9sQbyqnOZPNpRN58+1ZpISf2ZbrJ/9NeX0SuOZ7p+hp3S+QgfdbfZTWOxnSidgjySPQuc+41Y+sF3Fq+LRTOY+O/9HzEzxEiDzFazt1KJD8XgppwHzi6NuMBaTR/k3h7vC2602qoYs0NTfsFV9q5+5z3ytdu4Xx5sS0+vQmW8CbTWI/EAaDUTKAZFVAoCiXTsfDJ3MIMu6hKY+aSutecseQgDhfgyaY6Mu3mPA+GKnDYK6IlK4yDPp5aZzXLI+wJMdjrpS5Wjwg46NyIa5UEfsM3mvs4uMncSWn81OoXpBmEijFCRXwfcFZeoan0igtqVZASvPmDZ0sAoGXURXWpw1D1GwgnyNLz0jCz5XicCOB1rhsAhr/kFoD3FriofNih1nF3TvUod8xCvrH/34LUViOCYXqONMlyAixyZhikpv+rG4lK/gfcMIZaTUb5tghR5UL0KkEzPUpSUKERahoQIDeCatPV1E4hOOhDO5rRWFQCH+AS32t3r+BvHRrI8F+vDShay/xPUj81zbEDFdAslABFGS9bsF7N7J3SNWBXXPQRX7zXV81UNzeyyEOrwvSkRSzoNEwcSIUQ/h7j5liaHIvmmXqRrQ5ko5QhlAFACbo72FqjtBgHkXE07hDPgBftq1JR1Z1r06aiTlbD9DCG4wy4MYX42irVBXMzYuJBuEI/wo2dZqCfAoStoS2KCWaEVCt6o1hbERTxX/qmk2Duo/nBtxltjdMhguM6BEVWgz/hwBZPBXmwQbCL1w8qBAbt8n6P+ztlLUAo5EEyB5c2XpJBGYKFO+wNomvIzw6QfMp63Lw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c66f3150-0a40-4a0b-c05e-08dabebb4d80 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:21:29.5885 (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: UyiDbXV2gk04/Q0fe3vUbko0wfKRz1zst+I0qO4wBvNifqyZZVrQTQipAZJKYwj6UYPTMHBo8U6FrbxOCCBj7hKf5CX9tWuizHjdoquxCWA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4433 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-GUID: 52SISrM52wGB8NiLPq5xjZqZkwuYWeK0 X-Proofpoint-ORIG-GUID: 52SISrM52wGB8NiLPq5xjZqZkwuYWeK0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This begins to move the SCSI execution functions to use a struct for passing in args. This patch adds the new struct, converts the low level helpers and then adds a new helper the next patches will convert the rest of the code to. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche --- drivers/scsi/scsi_lib.c | 69 +++++++++++++++----------------------- include/scsi/scsi_device.h | 69 ++++++++++++++++++++++++++++++-------- 2 files changed, 82 insertions(+), 56 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index fc1560981a03..f832befb50b0 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -185,55 +185,39 @@ void scsi_queue_insert(struct scsi_cmnd *cmd, int reason) __scsi_queue_insert(cmd, reason, true); } - /** - * __scsi_execute - insert request and wait for the result - * @sdev: scsi device - * @cmd: scsi command - * @data_direction: data direction - * @buffer: data buffer - * @bufflen: len of buffer - * @sense: optional sense buffer - * @sshdr: optional decoded sense header - * @timeout: request timeout in HZ - * @retries: number of times to retry request - * @flags: flags for ->cmd_flags - * @rq_flags: flags for ->rq_flags - * @resid: optional residual length + * __scsi_exec_req - insert request and wait for the result + * @scsi_exec_args: See struct definition for description of each field * * Returns the scsi_cmnd result field if a command was executed, or a negative * Linux error code if we didn't get that far. */ -int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, - int data_direction, void *buffer, unsigned bufflen, - unsigned char *sense, struct scsi_sense_hdr *sshdr, - int timeout, int retries, blk_opf_t flags, - req_flags_t rq_flags, int *resid) +int __scsi_exec_req(const struct scsi_exec_args *args) { struct request *req; struct scsi_cmnd *scmd; int ret; - req = scsi_alloc_request(sdev->request_queue, - data_direction == DMA_TO_DEVICE ? - REQ_OP_DRV_OUT : REQ_OP_DRV_IN, - rq_flags & RQF_PM ? BLK_MQ_REQ_PM : 0); + req = scsi_alloc_request(args->sdev->request_queue, + args->data_dir == DMA_TO_DEVICE ? + REQ_OP_DRV_OUT : REQ_OP_DRV_IN, + args->req_flags & RQF_PM ? BLK_MQ_REQ_PM : 0); if (IS_ERR(req)) return PTR_ERR(req); - if (bufflen) { - ret = blk_rq_map_kern(sdev->request_queue, req, - buffer, bufflen, GFP_NOIO); + if (args->buf) { + ret = blk_rq_map_kern(args->sdev->request_queue, req, args->buf, + args->buf_len, GFP_NOIO); if (ret) goto out; } scmd = blk_mq_rq_to_pdu(req); - scmd->cmd_len = COMMAND_SIZE(cmd[0]); - memcpy(scmd->cmnd, cmd, scmd->cmd_len); - scmd->allowed = retries; - req->timeout = timeout; - req->cmd_flags |= flags; - req->rq_flags |= rq_flags | RQF_QUIET; + scmd->cmd_len = COMMAND_SIZE(args->cmd[0]); + memcpy(scmd->cmnd, args->cmd, scmd->cmd_len); + scmd->allowed = args->retries; + req->timeout = args->timeout; + req->cmd_flags |= args->op_flags; + req->rq_flags |= args->req_flags | RQF_QUIET; /* * head injection *required* here otherwise quiesce won't work @@ -246,23 +230,24 @@ int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, * is invalid. Prevent the garbage from being misinterpreted * and prevent security leaks by zeroing out the excess data. */ - if (unlikely(scmd->resid_len > 0 && scmd->resid_len <= bufflen)) - memset(buffer + bufflen - scmd->resid_len, 0, scmd->resid_len); - - if (resid) - *resid = scmd->resid_len; - if (sense && scmd->sense_len) - memcpy(sense, scmd->sense_buffer, SCSI_SENSE_BUFFERSIZE); - if (sshdr) + if (unlikely(scmd->resid_len > 0 && scmd->resid_len <= args->buf_len)) + memset(args->buf + args->buf_len - scmd->resid_len, 0, + scmd->resid_len); + + if (args->resid) + *args->resid = scmd->resid_len; + if (args->sense && scmd->sense_len) + memcpy(args->sense, scmd->sense_buffer, SCSI_SENSE_BUFFERSIZE); + if (args->sshdr) scsi_normalize_sense(scmd->sense_buffer, scmd->sense_len, - sshdr); + args->sshdr); ret = scmd->result; out: blk_mq_free_request(req); return ret; } -EXPORT_SYMBOL(__scsi_execute); +EXPORT_SYMBOL(__scsi_exec_req); /* * Wake up the error handler if necessary. Avoid as follows that the error diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 24bdbf7999ab..cd3957b80acd 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -454,28 +454,69 @@ extern const char *scsi_device_state_name(enum scsi_device_state); 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); -extern int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, - int data_direction, void *buffer, unsigned bufflen, - unsigned char *sense, struct scsi_sense_hdr *sshdr, - int timeout, int retries, blk_opf_t flags, - req_flags_t rq_flags, int *resid); + +struct scsi_exec_args { + struct scsi_device *sdev; /* scsi device */ + const unsigned char *cmd; /* scsi command */ + int data_dir; /* DMA direction */ + void *buf; /* data buffer */ + unsigned int buf_len; /* len of buffer */ + unsigned char *sense; /* optional sense buffer */ + unsigned int sense_len; /* optional sense buffer len */ + struct scsi_sense_hdr *sshdr; /* optional decoded sense header */ + int timeout; /* request timeout in HZ */ + int retries; /* number of times to retry request */ + blk_opf_t op_flags; /* flags for ->cmd_flags */ + req_flags_t req_flags; /* flags for ->rq_flags */ + int *resid; /* optional residual length */ +}; + +extern int __scsi_exec_req(const struct scsi_exec_args *args); +/* Make sure any sense buffer is the correct size. */ +#define scsi_exec_req(args) \ +({ \ + BUILD_BUG_ON(args.sense && \ + args.sense_len != SCSI_SENSE_BUFFERSIZE); \ + __scsi_exec_req(&args); \ +}) + /* Make sure any sense buffer is the correct size. */ -#define scsi_execute(sdev, cmd, data_direction, buffer, bufflen, sense, \ - sshdr, timeout, retries, flags, rq_flags, resid) \ +#define scsi_execute(_sdev, _cmd, _data_dir, _buffer, _bufflen, _sense, \ + _sshdr, _timeout, _retries, _flags, _rq_flags, \ + _resid) \ ({ \ - BUILD_BUG_ON((sense) != NULL && \ - sizeof(sense) != SCSI_SENSE_BUFFERSIZE); \ - __scsi_execute(sdev, cmd, data_direction, buffer, bufflen, \ - sense, sshdr, timeout, retries, flags, rq_flags, \ - resid); \ + BUILD_BUG_ON((_sense) != NULL && \ + sizeof(_sense) != SCSI_SENSE_BUFFERSIZE); \ + __scsi_exec_req(&((struct scsi_exec_args) { \ + .sdev = _sdev, \ + .cmd = _cmd, \ + .data_dir = _data_dir, \ + .buf = _buffer, \ + .buf_len = _bufflen, \ + .sense = _sense, \ + .sshdr = _sshdr, \ + .timeout = _timeout, \ + .retries = _retries, \ + .op_flags = _flags, \ + .req_flags = _rq_flags, \ + .resid = _resid, })); \ }) + static inline int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd, int data_direction, void *buffer, unsigned bufflen, struct scsi_sense_hdr *sshdr, int timeout, int retries, int *resid) { - return scsi_execute(sdev, cmd, data_direction, buffer, - bufflen, NULL, sshdr, timeout, retries, 0, 0, resid); + return __scsi_exec_req(&(struct scsi_exec_args) { + .sdev = sdev, + .cmd = cmd, + .data_dir = data_direction, + .buf = buffer, + .buf_len = bufflen, + .sshdr = sshdr, + .timeout = timeout, + .retries = retries, + .resid = resid }); } extern void sdev_disable_disk_events(struct scsi_device *sdev); extern void sdev_enable_disk_events(struct scsi_device *sdev); From patchwork Fri Nov 4 23:18:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621999 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2699FC433FE for ; Fri, 4 Nov 2022 23:23:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229563AbiKDXXr (ORCPT ); Fri, 4 Nov 2022 19:23:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbiKDXXo (ORCPT ); Fri, 4 Nov 2022 19:23:44 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D1075FF9 for ; Fri, 4 Nov 2022 16:23:43 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4KjBBn013373; Fri, 4 Nov 2022 23:21:34 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-2022-7-12; bh=IG38ZcaDktcxHrevnRSqilXMxFKxUPtrHC0YVxkm2DE=; b=LwnCb4cdqTfYunFjw0ZwCtKMjD+rztgq7fvPbMKtUdfDLXegwqKsJKd6+cldsD+f1fXr VjeJTcVUBwUvpOwDnGPv2KRR9qzVIYHbbVrGvpAkjDO8Wi/g7+ZLdy7x/Y0X6RqfwW1L P92JOEYVdTVhwt59/v4r8z3oDCQZIL22T6kZIY39bwH/po1Z648v+YHyJ+JQXbbRH4XT f98X/OLFspWXnlr5e/l2ZNbrWojoUQFQooSvOL7Nu+b+DGC262YEO7JToHBFA0lIli9o TZmtxn6JJ0LyWL6HNrkgTFgYcrkxO8Po196US4aGMfBGZPhwRW35qx0KSWVIzsbF+Uvv Wg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgv2as1jx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:34 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4MI2F4012011; Fri, 4 Nov 2022 23:21:34 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2175.outbound.protection.outlook.com [104.47.59.175]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpwn8cpa-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OglHEEhvtiQvR4QF/n4vawHULmcKaivbLXybCr2DdBeXoVlkuCAAlLkcV8QEPLSWJp6incuoBL6bjYjUxs7OH7V1S9qlBGzyBFenfvsOs/kj4rmOuVT+iIi0MjT1Jva4x/pkJgQBk4ZJY+qQEPgILtWkEoyBCdeMgLs36k+FFKcf1k9DaDSLIwK+YgDoebYMIzpsRmZPLuIoOF1skHFtKWNDuKCANYg5QJZgA+jY2El9gN86nKDXGqcZ3jFaeGIZPlj6Vg/AfsC7pOn9dBXtUd2FOJVx5qJtxgQCw8MdCXpICqbLsXt2uU8G1B41VyPXKJ5pjncvrS8aqnn7wkBNQg== 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=IG38ZcaDktcxHrevnRSqilXMxFKxUPtrHC0YVxkm2DE=; b=diQLCbW5CwvGwqr/f1RRKeXPmT5WxwF6+/5ydiIWsqdGbgbJhrOtl1o03+v8K29j1gp+j6/VVRGRg7u2dJMY2rcBSZ5K/zHLSx+nZtzGRylyGEJ2xKQQJGkRlrbwiAC2DdYVsX+bInOno+kWCcMtgObRuZfsPHckaYTKUrM/OfMfa8iuGXO+E85rDvPfq6swBaDy8kPUoNH3ZRPvAxukkEyRY2K6Ud4wgSphA8USKaQcNtuPEsLkHyQnG4jODuwwL2xLqN2xlYsdcOhW17MdT4o+3tkQCAFsiH8qSZbIXoLCTOtu+8ZVCcb+FY5zPKAUOOBOzYZ+6Qzmf0qqUhKZ6w== 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=IG38ZcaDktcxHrevnRSqilXMxFKxUPtrHC0YVxkm2DE=; b=DNvirf1G/9Slh7tbu9dXr/1+x0moC6+fHSNGhSxNAN5HmfdoC8/U/tjM1E4/KZMT1R2w2QAHJDCLD6LGPXMVPh1e51JDOeg/j2DJehxwDsZWQQNQN1YnWey20EuKlGitl5tgnnG+DhxwkX5PjThKiqXjMhk3j/53L3Bjl0sRl6s= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4433.namprd10.prod.outlook.com (2603:10b6:303:6e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 23:21:31 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:21:31 +0000 From: Mike Christie To: 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 v6 04/35] scsi: Add scsi_failure field to scsi_exec_args Date: Fri, 4 Nov 2022 18:18:56 -0500 Message-Id: <20221104231927.9613-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR03CA0061.namprd03.prod.outlook.com (2603:10b6:610:cc::6) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4433:EE_ X-MS-Office365-Filtering-Correlation-Id: 53edb85a-d2b0-4e9b-1633-08dabebb4e3d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i69oOVRogv1vdUQA/6utyf0j2Yi7T3ZJsOGC0iHj7Vv41hzzt7RzKvny2ZYlkCdE6AvQFNyYJassevfcp5HKd/fVxfeSVVxUN86Kfj/ZIdAnoLnYmf+K8Xgg5Pr11rqSZpfBLecDXyXCyEfXVchwGUNzedgfbWNDZX4HcYmNMARq8R05l9BTuIBdA7FoN+/dGM3G9dIGB8PH4+Gr+V4UaRZDHjiitmR0qRyt89ELh+VdCW8Hpvz/2Giizm6sLZhtobxhq8gnoEm3Y7Roz/GCoXTJ23hLolYvfpuZi65dFLUbqs0iuyZ6Db7dntgiJi260cetJ9l62ZJYNLMsUBHTv5naG8il+wac0SXiH8Y23mi9HcIQyWMTnB4eankMvD2CK/RUUxzln1BnLLjzTZb+l8jdpzO2ari9EDEKxEMOAl9yMvX+3i7lYpUpKdt7777mk6ZW96ICgz5UjFqND0hOvkoZF7eqi3ewOQftC3B/F21R+x41olCM5No6w1AmGMSLTyyAz6g2/e2kRgozZfR2FiY3nhswZTjSqNd4d3KV6LAw8my3mPuwOiOXhcXtU/4GKnLuomWF0M3xNF8BRGfoeG3cRPUQaiItM7AdVZnSlw3gihlYbvHcbMR27mZ+LKWMvLmYUhwHt4ORcxTCSmTD4zRnEzJSji7gzVPZD8etbCcoP1HwDSwZi2VvvcyG96Cx1pq68ujjCP8zDHxliUujCw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(346002)(39860400002)(136003)(396003)(366004)(451199015)(83380400001)(8936002)(41300700001)(5660300002)(6486002)(6666004)(86362001)(478600001)(107886003)(8676002)(36756003)(186003)(1076003)(2616005)(4326008)(6512007)(26005)(6506007)(316002)(2906002)(66946007)(38100700002)(66556008)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +zz0I9t/nWBz5X3nBswcjwfCF4UhD/EEseXR6Z21uuNEepwaIjSzFSNJBw2TZ3WBWh/+Ou/NT7yxJlJDezrq4TW6DRC7Na6ZcIt5hbCvcLlHTWnkm/xq4diRz5ig32G6AOsAn+urwxibLc26X7isvJAdEahgMOb5kaB3CPrFok14rN3veP16E5hhLgBkFwIpzLoaaFrxMpy8v4uBGhzkxUaO8U71MTBGLGck1LgCtwmoIPjL8sV3cFZ/BVmIXsukJYEissv5iVyF+vytWBoWbkr5J7s3vx5r7UwbQU29EKXy4fMSfdG46YXHOhEujG23szDfZWApDgqwxtpSMPRIv/SotnhcHj9Nn47Gv5FLfMbcillCAnSZdJted68tJYtCynOQWU19LvUDDrh0ATDHZCgBNR6F6cFppp+DMzR8OtgLJulDe2lkJXJVfHbJkNNSg0A8ecjhkbk+u1YdMhXlRs/lL1v2WfeqeGxzSoYtU5TBhqSn+HgbwoB2dVTzT1TUSAeeaOuoq/7JVwbXrP04munDAZqb80aiwsHZPPdXd3+sqFEuew6hNNAtPnTV+zrn2SmpexPS48oR9Nts4uHCFLMQZ5s16sUc6+bZuEXwdTowu1aappQWgAk0eyn4zxBqRRpjATxG2vIqKBTtDaDgCcB9A5br4FmEpwpdBVDXc53E+XxFCE6mkoPAxsuBW/0WNKXDKW1ZEMV+EJ3G7ExkidG8OZwXC2uuE/+f1LSWWoWkBy0hUBEa+fjR1HylsFTg5++ImbIeFUXCC1gcu7rCMcsU12jI45WLFETVxM72hf3SDJqwV+M2lk2kG+/xNIe+Po0oQhtGGyeVJqFoxPRtfw1ieMWI3tswzxC6olxC5PLoUf0y3YW53o0DyBo+RN+9PyXgU+rolXO1cjwHWt4LaWeNkfu30astJMGz37uf9QbOFN3/a37v1TiQxlfUcTgFdG7vGqh9aUtRZZH03NGT+jYemkoOYtqe421/qWodH5L8G49krPyh3CdJfZNixleW/Sff6IBDW3bn5oWauwzCF0n+2UJLdZfVOQ0sRfMoq4UoozFNaAT+ItcYL9kFpZ/O0ymP1eW6bpqWkwIKJaWgSIG3F+0nopywylqLTsL+qfMUZJinEW2BTHe4In8jdm3aEA6OaYlhtmR08d9KqqyreIBT1ujbwCFd29F+4mjmxkvOduDkDAEs8CHHcmkzG4z9+sjX1ul96zuDdRlhcBbaHe3UClznz0CU9/D0UkDI4ngWrbXzaypkW1WpEe/O8g1h66/SNXTfk91QNCJjlRzkf9RdnUG+ZmjkRIlydhej0aq1Ph/kEbzE8yDmgym5G4+iFTJXW3kRS4XobU9UoCDkW/pVsjhu2ePCdhdwviVjX6iZECp9Cqv7Px1+xmJzYfP1BdUCNu3mhfOKWwt5WE3EdDgz8QgD7JlNP9h9KI1ezOlHCzqmz2wc6BSUtzh0zPrCLVqdpC93k0nOBk0j5uBKw/cPza4iRe3O1mp8oy8WdFycIJfr6bBMPHl6bZ8o60+gq9tuWADofZd4c0QCQWD+1k/O4x6cjSF0y7epwrivCSjL1BcyrbFlDoEZiyg254aqb1HnA306fT4jHP0trMKJ7w== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 53edb85a-d2b0-4e9b-1633-08dabebb4e3d X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:21:30.8384 (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: rpkmUt6o9n9DqXMDH4jelkZyU8xZS7h6nUaRJJsqE6WXpetY8nIOVA0AusVM36ZDTkX0c12Hzcjrzwkppno/3lM5f/WJQZMdqKvC5tVMm4k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4433 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-ORIG-GUID: lWd84MFBFvS_GItBwYXfXauCMlHypsKz X-Proofpoint-GUID: lWd84MFBFvS_GItBwYXfXauCMlHypsKz Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Allow SCSI execution callers to pass in a list of failures they want retried. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig --- drivers/scsi/scsi_lib.c | 1 + include/scsi/scsi_device.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index f832befb50b0..9b6dc47bcdae 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -215,6 +215,7 @@ int __scsi_exec_req(const struct scsi_exec_args *args) scmd->cmd_len = COMMAND_SIZE(args->cmd[0]); memcpy(scmd->cmnd, args->cmd, scmd->cmd_len); scmd->allowed = args->retries; + scmd->failures = args->failures; req->timeout = args->timeout; req->cmd_flags |= args->op_flags; req->rq_flags |= args->req_flags | RQF_QUIET; diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index cd3957b80acd..4ae36274b6c6 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -14,6 +14,7 @@ struct bsg_device; struct device; struct request_queue; struct scsi_cmnd; +struct scsi_failure; struct scsi_lun; struct scsi_sense_hdr; @@ -469,6 +470,7 @@ struct scsi_exec_args { blk_opf_t op_flags; /* flags for ->cmd_flags */ req_flags_t req_flags; /* flags for ->rq_flags */ int *resid; /* optional residual length */ + struct scsi_failure *failures; /* optional failures to retry */ }; extern int __scsi_exec_req(const struct scsi_exec_args *args); From patchwork Fri Nov 4 23:18:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621675 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44BA0C4332F for ; Fri, 4 Nov 2022 23:23:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229545AbiKDXXp (ORCPT ); Fri, 4 Nov 2022 19:23:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229495AbiKDXXo (ORCPT ); Fri, 4 Nov 2022 19:23:44 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FA395FCD for ; Fri, 4 Nov 2022 16:23:43 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Kj7eL012102; Fri, 4 Nov 2022 23:21: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-2022-7-12; bh=gLJqvLDnoM2LAwyzuFcx9nVzpbqbINSt3ruS/6SUL1s=; b=QNGzc15PacKj7inRAMIB7zStEj1d/RXNgpbOWGYUQevA5zoPiFjVQUrhy9ZVvuyEBPEA fTdADGnZ2HffJmu1+iVfABU1C5EaMqvOuvAtLs+w1PiSDu0W0TKZas6NGpCWnYTunWvF eygCrVmmz87HYTLu5y9Zch+Tv/s/RJ2Ifj7PbeI/eNTnCzAqbUxmR45SKpMoSXKkFhIE Rocy/HEqalHamcf7heA44SavOcYOGh5n/8RNJXdAAUIMJPiu2CLsZgfvw1BKgbGGNHB8 mAS6uFn56Jxwo1GZ4KmZENXCg09eIe6SKgSzjC0EU8hUiHvN74SlQezI4QC57nl88iTD sQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgvqtshvm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:35 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4MI2F5012011; Fri, 4 Nov 2022 23:21:34 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2175.outbound.protection.outlook.com [104.47.59.175]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpwn8cpa-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GxmVlevXBMHxvSf7FgF1VFs1ZR5kzIqnGmYKm0nHgvDkjrSUfZe7yIdS/iQfLLNbWhkV8F5xK2wrJWHxo6vtEjh7FO1D9khX1wWJCLa59av2Zb/aaLa3tXGDwLiOx8jS/Ibr8lgmAhmwruqcsmjb+51oG1lyKGccahTL37nwVZVoXnCy4iu9WP4/nMBpsAQu1gAPnyUjzpPMkzAQIYl9gy3wS1mcqKqVmCFtz4EY608fbEC437m6uzoZXu47rnK5fnkhr74s607DqyxGpn4vwKGi6oGbTl9rMM3qehYZ/gPh0lnyqpFzxnP4TJNCKsQJ3Qmw4OJabeM5Ydm3vg3vLw== 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=gLJqvLDnoM2LAwyzuFcx9nVzpbqbINSt3ruS/6SUL1s=; b=busYgwlwBT9c5AG6YUcN8ZGVaGC3ezROgv0Pk43k4ZNCDNRn02hITZEdlF9tPEwzeW4QxrIs4XccKzmvvGKsiWLTrbT78mJ3Q03WZXBRyZkjx5c8mzHKpswRSZ3YrobMjKfyER2DlG+RPnsWELX+J7oNsFZIIK0MpNSz+tICRt2F24wRY28vfmZih8W/jXtBlbuRgWPTULQ06vNoLGSzS9FbHuy3sgVcYZbll4z1dEz+LaHr3XviYqnaCZYv+D91kpqGW+y6NM6pMXi/scNVrUIDKAOG9SPFsE1UPL7nRjpHRU5LNAJODeA1g3alXGUaJIZgsVKDOLVjz8Swf632tg== 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=gLJqvLDnoM2LAwyzuFcx9nVzpbqbINSt3ruS/6SUL1s=; b=o58U2ml3G4/5eyMZ0kSLTEeSOzvr7CvNMZPMQ5UVOLryOOFguX9ZANcqnDDMfJmtLGIZRDPlixCC8fpnhG6IaNiW7c0cHw1lygxehif+XPty4gicD4sbdPgmLf1vw2JlP+V16wiwxd/V5BnaltQKtoAWX2Hkir4MYwt3VoSbIlE= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4433.namprd10.prod.outlook.com (2603:10b6:303:6e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 23:21:32 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:21:32 +0000 From: Mike Christie To: 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 v6 05/35] scsi: libata: Convert to scsi_exec_req Date: Fri, 4 Nov 2022 18:18:57 -0500 Message-Id: <20221104231927.9613-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR03CA0088.namprd03.prod.outlook.com (2603:10b6:610:cc::33) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4433:EE_ X-MS-Office365-Filtering-Correlation-Id: 9332b72c-8194-439b-2e8e-08dabebb4f1d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pqzuU38AovqjHjDmi/wC37C4xXXecRQ+CjmjDIEUVrkNYDQ3M2ltlv2PC1m+DL7YhjxiwSSv6/GnwkpS3TS8Wl7LDVIy2ZQZLBvtr5igv1cIwLU+oWDMzVeuKf2OqKjOI8xxPNgZ1IFAEZnPjFOSsYef36GLXXnXEBugjEU/AM54UhJaU0dlznXhh7q/QRzjx8atnK6D4ZHRa47OEUgAstFwA+ENMUMvHrDrmPEzqAKhsOqspP0Cu9HtLPgx1r44cmQ7TsWPrK2f5XYDMHhEUmaLju2zZaHm9NC4a6dhX4DCFMHP8skwFQhebB38aqkGMf2DVbwCC57eoWne4+8YzkB+E5SGiu9wBWEJYmyQXDF/aOtXkh2M3JoL7k+1eBJyqVooG78wzpVZYEeuAlyj/2J4Nfvpb8opCs+qiXe7ucv5A8WuXRJePr/1j99DqkGBjP5g4CR4Tk2T7YPJvB2sgESg8sZvoXd/lBs4A8qcE9ywCYQARVLn/l8vXZpBBvNsOIJv7JZdelmXomQ66R1GoKbhCZtJFt9IHmrxCGZZ0w0Gm1LmwzdGo+nmU+C0lZi8A6NsPI/lvOmuwtWXyTMxlyZGiTcQgyE5Q5xpzbvu0xhO/Km5brA7LaW7Kfkohh7t4h/qa4GZ1k7Z6Aq+FrBPn6jOeVwj1Bi/woiVTiPdcZcjLs5McGS0LdeBQOSJJADb4f2AQcQNGvYsHJjoFG0beA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(346002)(39860400002)(136003)(396003)(366004)(451199015)(83380400001)(8936002)(41300700001)(5660300002)(6486002)(6666004)(86362001)(478600001)(107886003)(8676002)(36756003)(186003)(1076003)(2616005)(4326008)(6512007)(26005)(6506007)(316002)(2906002)(66946007)(38100700002)(66556008)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wfzuBFzghimf/Rz7lrIS5dCCZtv9FME7vZN6LHE/wWaKHPl+S9H/bRa8X7L/SylNJfcOY+E9A36eQPbNOQEiQ2o9lyMQJrSwntXEHbks2ijmLFueq8pPe4EFM/5ld/SB0QQmI+ZvaPTJj97YQ2WH4+9qY7j3xxQNSumIGtu7OdfVMcBnZNMpuqcomCB9aeUKLXMaFWu6B6S7fMZ3+rkVzM339659pTctRuxYPAO2e0bm7NL7SDyu4RYe/zCFDSr8hUJzj2PkfyQqYEnwDbaBKwNbbk7wYPealqjUprz7irO0LWH1b9vl1PE+rUEX6WR9OFfksDm1ZasHLWNL2lXsjwV+KDyWTRyXsHZfQz9mEgjblN+5u1WJUhCnHJ5A1pVapvNFX2eEw/coSeMMPFaAZkYeTjTbvUz3zIAHIkOYdceVudxbRA1TnQAPijonFKzqECvvPQnrGx0FIDojDw6Dy4JKTjXTAG30lgpjUHtuSetYbgKxv8MeSH5EU3n3BpVJLWqEqBeuvDh2X9bVXZiuTHqHaCgIEqjHxoTTUMK30XHiyTQs/IbCmJplNBITjNPwdHzBKKi0rrQEJk6z8z+VJAS3iLv5QFTBMUvlMjtJWforwZjtaNpP8M36iW82bk7TCrqK0Y/CoWwwWzd32HHwb55m9W1Jz6AEPHUjsQQaNOu88F5bT1WcstYS4DxL447mdt1uEFVWw74KVY1jWcFYn0B4RzxH08kQyEDsA00zvYEficKeZJUd6qZZk/KE3FwuCj5cMiPUw9OVZtXoDP6ZT7JdaAcbNEba7rYKjMAEYA/K2kQDIe0Wwm+KuwOXoaZs/u+KmZlyOIzPbULzw22Mq5JYj/wsdoRfTYvZl/j+q8RAJiY2EB0jDAjVWqZzZF5+7TVllyazp2aqWUENm5qx3gJukSG/OXkxx0VGEJ/1pitz+VBQghwhsY/lg01/lUp9BpkhOte5USP6jGwJSuh/jYE5Eq26Os2W3n4NTQ+rEO8mFyWi/4d99a8FiXtR/B12zd1y3ZxeVo9od3RZaADs7K0lrWv2QN6LxyXPqGSnZT2N6Irn3XoGE5K/DWyk9oZO7dmgNqf42yme+/6IWXwOtzWRL3d46g9wm7K6Q7sJmvUcTGHy0koiai7z3di0eNDH6gEzY4NYW+Tsv04CShePJTvTagelkfUzHV1UxrXZeMudSb5lHMUNRug2XSiuV+DZbZWN2ydCu2BNTu5wP8/QaWrDsjpb/9+ocqE0isa86lJ/iufayceIW5Nr9CjuvJuuZON2DSXoAGWmmQkaB8BQEJ/O0V9llIQ111v8/xkPV9bInHJIlwv4xUBmvgQ8nSX2NpWdjNyDXu6525qKEkCnYh2mo8S2k5xMVvaBGiOxPN2cvYkvAS0oEebGNy0NuCGky8FaziAN9hCTly3xbiKlurVjKIsPkQYzoEhYsLf618R8N9eyR41ptqzcOp3C5MSV1wjEF+q8DM2eHCbp1vXefGt/uzCzqZlrD0ZO4QDIEyk5HxiuSbFf+P4U+H3hvn8Z0MJtLefYAtwYKbbwK+d7MaUERHV2ZNEq0xC4lhguAdvrETl2eP7efNThF3ABJU5wFqUSfs36xx0b4KqllZh+sQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9332b72c-8194-439b-2e8e-08dabebb4f1d X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:21:32.2914 (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: m76pFqpB2iNgloN4rlUCmHyReJHsFnX4rOSiOID83ztlOXpKIzL2uplUayfO5VJy9dOmcMg25e6jJOHhNL8d9/EOuAbdJy2tU+fppdZp6l8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4433 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-GUID: U4cxkYFTA0TcNPt3Q02zkWd0m7vr-rgU X-Proofpoint-ORIG-GUID: U4cxkYFTA0TcNPt3Q02zkWd0m7vr-rgU Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org scsi_execute* is going to be removed. Convert libata to scsi_exec_req so we pass all args in a scsi_exec_args struct. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche --- drivers/ata/libata-scsi.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index e2ebb0b065e2..3057f703982d 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -413,9 +413,17 @@ int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg) /* Good values for timeout and retries? Values below from scsi_ioctl_send_command() for default case... */ - cmd_result = scsi_execute(scsidev, scsi_cmd, data_dir, argbuf, argsize, - sensebuf, &sshdr, (10*HZ), 5, 0, 0, NULL); - + cmd_result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = scsidev, + .cmd = scsi_cmd, + .data_dir = data_dir, + .buf = argbuf, + .buf_len = argsize, + .sense = sensebuf, + .sense_len = sizeof(sensebuf), + .sshdr = &sshdr, + .timeout = 10 * HZ, + .retries = 5 })); if (cmd_result < 0) { rc = cmd_result; goto error; @@ -497,9 +505,15 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg) /* Good values for timeout and retries? Values below from scsi_ioctl_send_command() for default case... */ - cmd_result = scsi_execute(scsidev, scsi_cmd, DMA_NONE, NULL, 0, - sensebuf, &sshdr, (10*HZ), 5, 0, 0, NULL); - + cmd_result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = scsidev, + .cmd = scsi_cmd, + .data_dir = DMA_NONE, + .sense = sensebuf, + .sense_len = sizeof(sensebuf), + .sshdr = &sshdr, + .timeout = 10 * HZ, + .retries = 5 })); if (cmd_result < 0) { rc = cmd_result; goto error; From patchwork Fri Nov 4 23:18:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621998 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D417DC43217 for ; Fri, 4 Nov 2022 23:23:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229527AbiKDXXu (ORCPT ); Fri, 4 Nov 2022 19:23:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229495AbiKDXXq (ORCPT ); Fri, 4 Nov 2022 19:23:46 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36A6A267 for ; Fri, 4 Nov 2022 16:23:45 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Kj8Yu014047; Fri, 4 Nov 2022 23:21:37 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-2022-7-12; bh=w6ze2qNHltbPDGym7a+87QbyUKKhBwuwBnx4llIGzf8=; b=lFwj2kX3YG7AFv9B1nzpVt4GtwAOTksxgTUjLnP2Zq84KW9IH/7JzVSsQjnyio8JNpCw Hfal6L0atRPv7vGPa/tIA/RteujpWPCZzmB2C10K1758vpKPgGDNGAPk3YYwDF+sB3WP A4dnNopPtt8oBafRoU0SD8SFKi3+iXJtkRVWpWReekdl8xFgHK1p/vAnR3XRg+3Mc0YA qLC9jUgU2CjiiswRSTQwhr+lZvkMh8+eTeWrG7AqwVxo6goYdi+jAC95D1r0LNyBWFWq QXXg27E533a6stvKSaW4PpEcXWniZYMSwZH0tO+aIydkJerXBa7PZhHRD3mJq4TfBfLJ 9g== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgts1hgxs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:37 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4N8CA2014069; Fri, 4 Nov 2022 23:21:35 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2172.outbound.protection.outlook.com [104.47.59.172]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpr4t9r9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gfZcefyO+7IfdRgx48NhBYg7vFzqz1vOToLTHZKqhJqBnaBRtNSkBBg/ClVBv1tMYb/bFgtHeIFVgwT+QNqgYJyo8RfTdisZkac9IRzgOTq9rtk09/aB5xjA4gQcxMPMHKH7knUtCOHXyLl5qpAUSH2sQm61LWmyfCtXJrEBzTlKtN9YKPePHkCb9ZYiiMsYo+T73ixIB5ovEwn5aSTdhZHdqANX4V7IkYAPq5T7H39TBbU+xxdYmorhs4bsHD9cuAaJsY8uTNmsJJ7YmjoDWuGgVwN8qiutxQiLT2p8saoWz82AKof3r1at3aEqJTpzFg5QZyvArDfHOXtauhrsbg== 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=w6ze2qNHltbPDGym7a+87QbyUKKhBwuwBnx4llIGzf8=; b=TaZHTK7MVqHTbS9JIcdoSlvuE1wl1cQgoO0StsdO/jrb2LhwUeuU3OgZCccEO90hDJe7OiNJG7cxdDAwFWtW06xS/O/iTNRlBfZoN/wnkhJru7NfYx1fFgNq8bbrGexqsdFUes18dATxYMZJpQtHG+RK/U/MzvoVGnSMb9qWR4teu3egRevNEjfuwDe6owY1xAU5RrmA1/lnK+S0f2rQws8zVleSm+recQUzgm8XP9Vbuuiv03FwvUI6zRuM/Io8cecN1eroX+TxDZrxTsR1R2xHI8U7iRMD3Oiq5/gyFGMGTZXmzCv9VRb7xHEK2eYvKIYV7UuUGtN4VnUB91JgCQ== 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=w6ze2qNHltbPDGym7a+87QbyUKKhBwuwBnx4llIGzf8=; b=IdTe93+s1FB9hQNdLxR8sTYcE7v2pflUJVrOndzaPyD3mlYDHziFvAesedYp+wP0Yjn7VroVlfOGsIaJhkPLFADUSWj25Vp7xu1UiA6v4/+VyE5D09L1/oRCEwsRuOCnmu0vLFeI0P7IfaAfei9e7K0F8cuYrAF37syoaBZIcvs= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4433.namprd10.prod.outlook.com (2603:10b6:303:6e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 23:21:33 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:21:33 +0000 From: Mike Christie To: 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 , Damien Le Moal Subject: [PATCH v6 06/35] hwmon: drivetemp: Convert to scsi_exec_req Date: Fri, 4 Nov 2022 18:18:58 -0500 Message-Id: <20221104231927.9613-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR03CA0087.namprd03.prod.outlook.com (2603:10b6:610:cc::32) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4433:EE_ X-MS-Office365-Filtering-Correlation-Id: 23d814a3-c1d4-4982-0b8c-08dabebb5002 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3OAA/muXzjLkFlRh78l4/ahxKyt9oitf5s6J/Q0fzTtXC/Fv0hQqEQAqhH3o56RWEZJqxjp2ett2eizpS0YwYmwjBn5nKZNIL7Bdj3xnLTP2yxrk3SVVwyRd2ztRTU4bjSz3WLmHp43+VHhbqEjpdD8yNnC4ldzz1IT4C3lcf4rpaLdFRuaGHtglPcdeYJTNtMIhCKI7xFelyPGr69HuuXtR//o0vDAfqgeOsr0SQMKbXBbqG0gwrPk69lhHESUzEe9OlCyASFawilBgQh6uxrxYHAb2fevMicHZKa113nkEjWjVmeq8ZfHXvTIL1V3LAH2Di/VQbSGa5QSSXWLDgvQmDGHf4K0jRYvLcIHxydLU3xXE2vMtrCdOXOrdV95Br3oK7/VxXtj52ONL3jCDFMqdh+afcH7fuPWqBV1u7do4raTT5PsTwxmlywUYGLOGUme0dJ2Q//5mP7eRqR9sGE/sv1uNNSQlFaB0BZr1wcJ2EpBaiXPe4EnHZ+WA7CYbuiqVFVJl8mfNpk0fgqgPezDxPD0iy44eSlVB72zsJdbzTd3SF5Ie7z0wegK3rLiXfjyTqwyH1UqalrZn2/wSKSwmdju0x8XzoNr9UffpWSRLYxSJDJNQx4OCrS6pzV5uGu+5IvTQrxymCOX0Tc/zKp671nsTplITF4JFpK+xDICO85liYX3zZp1N1h/StmrkhULEamo0OsVsoEtDALNeGw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(346002)(39860400002)(136003)(396003)(366004)(451199015)(83380400001)(8936002)(41300700001)(5660300002)(6486002)(6666004)(86362001)(478600001)(8676002)(36756003)(186003)(1076003)(2616005)(4326008)(6512007)(26005)(54906003)(6506007)(316002)(2906002)(66946007)(38100700002)(66556008)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ES9mBI5pNmN4HRTFSQbqYoJUP/7HnLLtXsC9N+TqDAb7ydl9zf63faa9Z2YiQOzGGRwwBnlsiTDAPx31IUKS2Q7lKqryidSuGJppxlkbasSgboJj6kx7cXKcj4txnMi/ZLTKqwDXh9xW+QEigTrggHZfQ2suS/fTkBd+SOSkKwO5a0Y/sc5n/whQI03WAZhvNSzsFr32Xbfud8Xw6WGTBTtQOYpeoo9ju1ah9fArl+ofWuBbBGAOBN/YQOajzJNH9NPmmiVyQ0Qja94ZmbAAdDTgkW8Rk9T5vse+QqIn+jhbzIhh+ZYHNXW4VND8hf8qSqxbMEhYoCkb6F16aVXZomvBrPbJUF8e5KWGoszrCcEM51extib7PE2Niri47PTDaQ1Hb4Pi3h8BjHPos5GAuhfDbv2dc4VIAUcHVsrLhN0X8BRf6c+8wwjTtI/IkfPv7wqD99RHNZ4dp4jhsdagbsZvSD1L8gEr2AlqObWq0hSZYPPMjaJNcnRPaUfOJqHLpSz7b66YpSg8d8G95y6dgGmCTgsAwDsjZykGeyUujg4mujS6fKz3D1vxVb3fuX+iiTUvggvrry56jwe8NpAgwqBFNV8xdIfUjNr/7aNtbm1bLyBcUrPa6iNgmsytqSSwZyCs9Jtnm0lE/aIP+JZj5KEpwa2dVyBZtOqMuyhwgp9nmoHXRKJcOfq8IKY7c8lqF0b7eXZxp5qR2Qoi3XRigWUTUGGfuggmaKtnOOJ6lYcE6Bv5iWyF28eF4q4m5Z1E8rXRPJV810cAST68rzEVH+8++be++FvRpe9T2MgEFVCZ6skEG6kUSeN7brcWLdhOuNvbJtMD64gc185md62X+Z7qdeB8Eo4Cn+LFlPam5FjfcwOqEn6BlLJdCS+hUxrEzjSw7nYqmx9bf4um1n1pOZnxSPronIQUhHTdCrtkuRdv5l6eiSbCqsAdtOGPFuLOY1zwQFarT/nJdwqwOxrB6bUrNuEEWAMXu/vZJfByAfqx4Mm7PgRdNKfNTHjtIqBVC6x9JdwRORsJsKmbDeAnQuFw6Yj9szIb5AVOhNyRkCUMgR+8sW199aGTgiVU3l8+UsUQPC7OR68O6wXwSrXpcxLauojFNGhLhldg0HjlnZvchgVo3qGJj7RwwDVdFQgeg+fVnmTZi9/iSMmGmLq7MaWsmtBcF2181/YJG/GIBIa3Jo2ncGrmiVC3KkPqLB5Ps9K3MGqFIFjYyASxy6+NaOGZXXOZrqhrjkL7sE89Os0e0/CdSUcHiBDP8CaKLK7kJvQmqreex33se97p8YNA7fD01MN4f6NVM2iGfPmzEr+jfXPBg4wEx952i1ZrRstKEFimW406bL5VY42piZRHaAtxo2EfEgMN6II+EfmWx7xVjx31u7kWwLI/LfXdmkU0MyAFGhtnRDOVShSGOeOlWcDKqq2oUa8FioejjUusDAPepFIxcbH75X1kRXY2mz6lvpe6OZh5BdQUcWOZxkzlEIDuzlaLjo7G6npodnwW4aQAdvKQd4LPZTFW+LiZaF4I6ZbUFeUikxIddvBpjxb/dhTz/lxsWdnP91dpuvjAPkpTzirE2IpOD5I4hU/Og0RFWG/FdzO7vXOBZneVpU9IYA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23d814a3-c1d4-4982-0b8c-08dabebb5002 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:21:33.8069 (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: 3FiLXPdcg+MA/D1Eck6GE9XRv5pSFfg6jXO8PM1EWqyQbq5y5X/F+rToMRebS+XMOmz+V71j8VC4Qmajncr26VwfiZm0dStoxDAtUd8/Sp8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4433 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-GUID: duA7kDOnNWJtsxhg0Xn1y8S63KtKhRlY X-Proofpoint-ORIG-GUID: duA7kDOnNWJtsxhg0Xn1y8S63KtKhRlY Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org scsi_execute* is going to be removed. Convert to scsi_exec_req so we pass all args in a scsi_exec_args struct. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche Reviewed-by: Damien Le Moal --- drivers/hwmon/drivetemp.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/drivetemp.c b/drivers/hwmon/drivetemp.c index 5bac2b0fc7bb..ec208cac9c7f 100644 --- a/drivers/hwmon/drivetemp.c +++ b/drivers/hwmon/drivetemp.c @@ -192,9 +192,14 @@ static int drivetemp_scsi_command(struct drivetemp_data *st, scsi_cmd[12] = lba_high; scsi_cmd[14] = ata_command; - return scsi_execute_req(st->sdev, scsi_cmd, data_dir, - st->smartdata, ATA_SECT_SIZE, NULL, HZ, 5, - NULL); + return scsi_exec_req(((struct scsi_exec_args) { + .sdev = st->sdev, + .cmd = scsi_cmd, + .data_dir = data_dir, + .buf = st->smartdata, + .buf_len = ATA_SECT_SIZE, + .timeout = HZ, + .retries = 5 })); } static int drivetemp_ata_command(struct drivetemp_data *st, u8 feature, From patchwork Fri Nov 4 23:18:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621673 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13DA3C433FE for ; Fri, 4 Nov 2022 23:23:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229611AbiKDXXw (ORCPT ); Fri, 4 Nov 2022 19:23:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229562AbiKDXXr (ORCPT ); Fri, 4 Nov 2022 19:23:47 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4626060E7 for ; Fri, 4 Nov 2022 16:23:46 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Kj7C5013354; Fri, 4 Nov 2022 23:21: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-2022-7-12; bh=mLO3Spkew+E+i1LsX8SIRp5psan2Y90s9P0m1HdmK0U=; b=3aNbeZWnUIkQy43m2r9O5AZylr5VgufUoEUKDZ/Bzc3Yp6MSpTlWVTH0oxSuYGiYNGP8 nU2pCMkyV+Nc9KawDThJVNnL7Qq4tz7To9CGKa4pjxQR+iunSbhly75GcVd2rUoPOwsH swId7aiBTZu71VZDrT22bQmA6CjmINkaMYKRejzrT4B7Ng96SE7s1bLzNTVkSFkd1BJC dIFHCPQZBqczsKCmUPHOM/eDrD9gL+9sk1r8DZsCq403c4zzLcRDRdfHBC1pPq1F3HDZ X/xRZXfjNhMAdrblFKzf7oKKbs2vMUK0p9dCQjTX4gyCX+zXEWrw8g2kIEIjBFFJSIAX 6Q== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgv2as1k2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:38 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4NI0Wi029703; Fri, 4 Nov 2022 23:21:37 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2041.outbound.protection.outlook.com [104.47.51.41]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpr9a8xt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g2sfMs3tHzSWr9Mx6tVVJzv7LKSzLU7rEIbASw543YtHr+gEUjiypIXkgPl9oGv9EYzNtsllc/OHmt+kpTkwogFWvCmg6JnA14+LIjU+QluWQG8rPpDvzqdV3q8u8xLEz6l0cdNIXBxX9DSwojzX9Zyt3M5oXg/Sdkh3ydPdSUK5auUt82LupG3AOqd7Xlf00WcEulOeq2wR6XZ/kaZ3st1V8PCsmgOqGM2cC8En3IuIcy7BCItFxWjy7nv+CdhGVEIp5ovB3yK1VP5YsFnvEflQW+z6++cHvzQEUjA/5ccbHMm+cQ20M48Ed14wyz1qQM24jt9v98cvRJozO3kACw== 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=mLO3Spkew+E+i1LsX8SIRp5psan2Y90s9P0m1HdmK0U=; b=cudG45wz5wAyHcS8hnAFa7u0dLXPSlqXBhHMhRmPc5wkK5nMie++HihX3ObrRXwVa5jNpuJ7Ukz4CAKMmYNoLcO4IFgPX4Chpyy/gk23Md/p03RhI7PWoWlHxATya7m1/x6v76M/THpe034/n+hmsesXZZ5YvNlC4jzSTUJqJV44zeqEwzLjmTEtNfSXxD4Pl7Z6QTryhliLcIv216goSGQN+t5r1J/VMEURejBAS/fpG/kPIbnSJpDdnuZlrpOG70eLcl00bL+bz03Ln6KP6pV75sbXDW+76QFLdmWBDLxxTrc5ZUt3h/XHFs+Pgnm621w2Z12qwLCdwzcZjxEoxA== 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=mLO3Spkew+E+i1LsX8SIRp5psan2Y90s9P0m1HdmK0U=; b=QvfmArU0hfEjeBknzk9KjJBsRpAMnji2h+Wcu/iFngnUmHglnB2G2fCMjQsmfb7g83AmVd4Mz8lHuBRyJp8LV1aUkFMWAxEQGqqyL1sJxMtwkeChijN3jxtUq2jIcovoU5uW9+JAWUChK4y5LdllqlfTieAMAzzfJeO8O54xh/4= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4756.namprd10.prod.outlook.com (2603:10b6:303:9b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 23:21:35 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:21:35 +0000 From: Mike Christie To: 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 v6 07/35] scsi: ch: Convert to scsi_exec_req Date: Fri, 4 Nov 2022 18:18:59 -0500 Message-Id: <20221104231927.9613-8-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR03CA0088.namprd03.prod.outlook.com (2603:10b6:610:cc::33) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4756:EE_ X-MS-Office365-Filtering-Correlation-Id: 256977dd-ff42-4d51-73cf-08dabebb50d1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ihOuJXWea86ShdMfIQSv45+KU5NcufW1tP3zkWpF0QmpARAnqiRpXBOvzrbT4IGj6n8xXLOgzS4ikqF57EAdnYukaE5Nw56WEgNiE0D0A0qsGOprY5DzchmvKr4n1+g2wfMOXIGMxcqe0S5AtsHO2r5p5Qx+FnOFgusFrTd5Q5VtX8zUn3qXDDPdj6T74rT3FSnoXuuNE1m+xALwpV5o712cvt2kdbpXUNXsqyTrkYZO32bG5bYCEDiUNqhARBVQj1iHm/FAQ3YQyP+99NMEIGx6R5YSetHp9EPjkjzeQwaFCpLKmf4aFo1GFMJAEbVj0zITbg2rry99H8cHNSDaIo9dem+Dl2SeJ6tb6W45O78KwizKLp7VwdkBHZr17k8WiCXI5PxR3IMVrAU6N/M7sI86WxCgwkVbvVT2l58uFLCH+d58mLdcwADvdVSDP8zW/sC8DvroEIn46DhrAs40vaz8/xpTQRy5IEH0Qy5vVPm16ZKlTVs8NIMSShUgUovf+cvlrHQDxvlDbk6OcZH0gzfe89zswuYMOCVlNCs3uCkxBOCuHNvPchnjaXewBMyubGtVNN+TqY//MsrJVZFt8s1WPG3q6jfBmcLpmba6NLwdiluqfJulYdPw+t8xITKauAgxfekLjsPuQewYWLkv13mNc0ArOdGEozURJkI6iQlrOosXsmF9l5iPx3ZbYy/bra9a3fWOSH301b2olracvw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199015)(41300700001)(2906002)(186003)(1076003)(2616005)(6486002)(478600001)(107886003)(6506007)(316002)(4326008)(83380400001)(66946007)(38100700002)(8676002)(66556008)(26005)(36756003)(86362001)(5660300002)(8936002)(6512007)(66476007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: h705xQzjJNttfzQ5U3TBXkiq0PvmUIP0qS/h0eRW2PGCLkMiKVJzYgItM/pz2PkOw2THv+Lo48571hm+ItpVzslYykf7hPvRVdJtJXiDJXERxJf3ugMn8gtM4WqDZLsutQlkf40ry4CTOXDBQo/doQ3o3Qpg165DuLKVUjnjrQ1fJFh2+crTWD6xj3MhPZKoA07MpDcGq4wUqbgGbBAdNBXdTfau364i/LLcURqD3r7x4kDuX+TIeNKe6Sm2CW1mu/0pqRvCvXhRk7X4tmEYge5jXtHHGhdSQtysMKsY+tiiIvqYUcimOmsqcFCx9fC+BLliQV7ox5PcgNk8J3cSpurOyEWFgim6nf3h2DnAkZ8+OKirCcvCKbe6FX5hC2PmIsI+zZCsxMKbA8327SXk9Gx1e09MfM0jfudh1ixANtiko6smO5PS9Emd0PcByHTmhAYtANJzJSffLE9e6goHvqZrOKz2YrQot1gEtSK2koW54QhtjQ1+yu0MyL7wUTdcFUoQnStRFvFXqScOJANeQQo9MAzsDln+jUz+ebvDw7j+OE/Qk0Z235Eb42gCL3TrdJYFndrSqqndHB+4uOfgEM0Kc+oAAVaUdRTnLrByY3P01mLkk7pijUqZiVeoesdeVjZaGhOL3PqPcNoeLM588FNwjSkp+WFnNz9AeZeogr7HecoeuM2dLzZsCcWL3x+jeYWdBA+9MxAkVl45D698DcHyk/CeUY6NS4l17H4Pi/X3+bA+j+eXA6FynkIWqIklsmqJwl3tA2kB6k/E/3HB+U9lFXgrwVfnDhpSJ+p87knzPfhh9ccXyMVj0JzLC9TXV36C3JN3OjRzCsefBwxGsBXZXrhEX8CnsWUvFC3MGSzebJroje74HPGw/G2yE9blAf0tmRgNbM4EbVrEU7jKm7h7PlNAf6i61kdpa5Zv1y//6BdJC1U7ogiySRHliScrcUYslABUGvlED/pYB8Hv05cgkH5XwYmyO+a+Ir4Ma5Q2JdsfhNshNQjej1QE7XPsJ/joJNPBstfN0/kxXOQkjzb+SJbUhnIJIJ/of7CbzH3Cgx574PXaQxfCO5afW+7dgu8udviUdcmJWdahkXyBBTtT61ULntQrR48blKxIvFqlie9VtMZDh2HLlAM6FxXTRwjPRxSO2Wm7wfGJmBlQ5gYXiEeVO4lNNo52DcKy2FRwRrYYF4n5jItzP9weBdaFu2Utq2/A7UHWXCEmzjCjSOybZoWwAEUxWAV+RNbgmDTpMX6UAdqkS+hp9TIUDhIStVjti5wCe1v3+a03Hy2aEtEIekjeKvWL3VPJ1CMVJfgFN435fbveIm3y70fGa+0O3HBzFwIG/Ii1wMo+r689ARzyUnmiq96Q1K5XW65R1p6nciDpD2M1/bi+dHAlnoWGuxhH1MPSwRpH+WVXi9xPVspvqsdEuj8eyMdsLpylXl3y2590zXBakOAgSOCQVdlqMAMDlgz3YcrPgPA5xZfzywh2/xM17ijd0NMZVGU5TS8NjnZIMpDaznFncQiPFujLq+skh0oOiAGTJVlR49TPamWqJZJtrPMfjwPTEghRpXSq4JhYb+T+JTYDTznPHGHymPYASS8dsPsaj7NiTsqiIQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 256977dd-ff42-4d51-73cf-08dabebb50d1 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:21:35.1349 (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: V2RGXYrlufv9SnPx4Ziz/a91YKxOZ3Z8UWOExqJxoMYx+/gb7Q0oPyH8Qnb+PSJw65V5c/iR4vzSzUp/iM2lV0KEKPIMg/quUGkjeQR8HO4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4756 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 suspectscore=0 adultscore=0 phishscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-ORIG-GUID: _yYFquZeJmZiDszhgmI3oOucVXh3qPSX X-Proofpoint-GUID: _yYFquZeJmZiDszhgmI3oOucVXh3qPSX Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org scsi_execute* is going to be removed. Convert to scsi_exec_req so we pass all args in a scsi_exec_args struct. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche --- drivers/scsi/ch.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 7ab29eaec6f3..511df7a64a74 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -195,9 +195,15 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, retry: errno = 0; - result = scsi_execute_req(ch->device, cmd, direction, buffer, - buflength, &sshdr, timeout * HZ, - MAX_RETRIES, NULL); + result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = ch->device, + .cmd = cmd, + .data_dir = direction, + .buf = buffer, + .buf_len = buflength, + .sshdr = &sshdr, + .timeout = timeout * HZ, + .retries = MAX_RETRIES })); if (result < 0) return result; if (scsi_sense_valid(&sshdr)) { From patchwork Fri Nov 4 23:19:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621671 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D46BC43217 for ; Fri, 4 Nov 2022 23:24:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229628AbiKDXYI (ORCPT ); Fri, 4 Nov 2022 19:24:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229624AbiKDXX5 (ORCPT ); Fri, 4 Nov 2022 19:23:57 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B155719C34 for ; Fri, 4 Nov 2022 16:23:55 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Kj7eP012102; Fri, 4 Nov 2022 23:21: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-2022-7-12; bh=njWcjRm7rRVDU92EVjdVekYdbKtw8s0S20ejH0HXvtA=; b=SSEtfUFc7rVbxpJTSb63QP4Z2B5+mprzop8q6nPPYeyl4sAqb7yRi++nKQd+LTenbFSf 54AdqxOZk9HKDL5dWHHpkn8d3cgLbw9ivmwHU9X+Hs0EipR80xcuMAgjpfAMu93gYQnj GsiYzlJTwXgbroTZcuE9gt+FedRbtGWTxf5ONb97KCx6JbIMBjugmny+/svDnMW9JbBu jfa4gHtzjJAbynwyhnfTHM/2SlT+nHlHS2Lc7UE6xyqmS/xYI0W6Iue7lzDnmaeAd+3f 7egFU1o0qalc4x7DCqxWuYUiML2rRxsMLQ8mwzHSHSwmnTyrkSwS6eX0r0xa1ZV3aqiq 0A== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgvqtshvv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:44 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4N8CA4014069; Fri, 4 Nov 2022 23:21:43 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2048.outbound.protection.outlook.com [104.47.51.48]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpr4t9rr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XASajHAAdyfllzBzgPunnMb575YPL7KAr1rMY9cplzqvBvfDw+bNT2ZaUTSxKZrkYRdQbS0Z71h1ZQyrVotleyMXgsDIKHCGi3M7nhMCYnp6teZBFHw6ZGZLI1JIjD8vu7tsfN2/BdvVnG6Mp0JoVFwPvV7KaqORinMH52Z5g4DkmC5IxHT/4B65As2tuU9NR6zBS5bKMqwJAxnAwYdtnDrU2mAGFhmylDtJIYV7sY4/HUQdTMC7uNT5qBzNocjdV/8TmkFyr7OTuBwwzeyIlIWNC6y8dE424adfg/WE1S3KWMKZo4l+zkOgc/Ih7+s0ygV6um+SP8gbL3ttE5gnpQ== 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=njWcjRm7rRVDU92EVjdVekYdbKtw8s0S20ejH0HXvtA=; b=CcBAtgcOiNG1mF+p+T9cijxO7lRBd4suNK7Re3cyGvIUGoH7s1Bc1O7xmbOzp3/sD414zW8WXTfRuLI9hH1NG+fng04+0XyJW8EtPRcH/Z+tGEoWufkPKuoEmcAcrAj6pRFmMXWeNN5bRK+syXvl5M1zY3mn+B7p6yTmbzYg2eQUGoEmHD7KNPjBfi+V8ShklOx6gTXDMCriMpq2RncbwOEjUA7cMcUMaPPEMbagjrq6CH0LX4nhIWOe+W0DzZfdOK3zn3ud+SxS6y4oyGlgG4J+CPUXotr/j/nnD90i/LLdM1s15XacjVEQ4hHUnHYXO5aGyU0usREp/d/9SJQgQw== 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=njWcjRm7rRVDU92EVjdVekYdbKtw8s0S20ejH0HXvtA=; b=rf0kJhjmcLb/+likVMgr5HxCVZKn1FzMMYvB1CpJE4qKd+icjHLKto8w73BTQY4Tm9Mhb1iEx2ORHId22R6CKVCzatR5mSCxUUHIlUyLQQWMEv+SOkNe7YxMtTW3Vk+CV97XK9cUH7T6lN5HvEch5Iv+wIwJ5so6youmzwCAekI= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4756.namprd10.prod.outlook.com (2603:10b6:303:9b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 23:21:36 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:21:36 +0000 From: Mike Christie To: 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 v6 08/35] scsi: scsi_dh: Convert to scsi_exec_req Date: Fri, 4 Nov 2022 18:19:00 -0500 Message-Id: <20221104231927.9613-9-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR03CA0090.namprd03.prod.outlook.com (2603:10b6:610:cc::35) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4756:EE_ X-MS-Office365-Filtering-Correlation-Id: c40b9f73-d368-418b-50c9-08dabebb51b6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oS9Nugrns0Y8nelveNRDazvzWiOUDhHZS6i7cJWH94asxGgQn0C2Zwk5BaPAGZvS8t+pdY497WtDoI3nAryA1C0MRwX14yz/yWl4ShpfuyJA2iQWJvsqqhTA2xtl9bkNU1X3hFMr6Pj3p4l2I5Ok05V1IdDHcfHUKHF7oVyKR8YuGcLCzOj/Z07jqwup8OmcoW53gXf5+3cMHviUnixenjlgqRfxbQlKKCuM0b/v3I3QF/dacESRCPgkuYk0oc4y6Vz9tUdBHPjp+Fz2PyilJwoRW+zqLyltDqqGyOebbs18g5VHLQgIgkNzSuIcpnPVhYP3cu6raWubdy7BDZAtrXODq19gzjpuKQt3NbNn/npJcl601HHivx4eg5a99NDIDEd1zXTingOO7I/pdvjLFMe2mFfn7EKy0os8DnhnF1kGccmnmYqR9uFGl6S1zmy/qHxdcqY0bYKmEEcPpPFet2k2/yUVqrYMJ0St5NzyReLVH7gmCsaU2xLWozi2gs5P2dze2Zh9wT3Nzn6e8mPlOBeVHKLsxSVPhdVpU3PfNnFu5o5DyQXeCQnwERr7gdBsMKQSd7NvjzOxywcLp9ghW4VTBMey7TJnSzn/8GBLHwDju2DwIf3Pr1Y+uvX5W6BCBByBNpGRkFg2b1mHINiQ8KrvRo3Ynib49NxjzdnZkr2QgEj6tZZoZz6HY1bM7Xx9z6KStnXC7kB0Hnclz2MD7Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199015)(41300700001)(2906002)(186003)(1076003)(2616005)(6486002)(478600001)(107886003)(6506007)(316002)(4326008)(83380400001)(66946007)(38100700002)(8676002)(66556008)(26005)(36756003)(86362001)(5660300002)(8936002)(6512007)(66476007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: I40eF6Xs5MHD1SFJ1kjQ5/z09dYYvhGkjk7dmW0RvLBpAZO25/epM2auG4B43c1TuNMuAEY71F7qm+DFvRmasZoPvIHgf4I1RxNnwxLfgsxfsmIhB1y/pAsVtbPZYXJx3dnQf7Guum5ltYyjNjr/KjGe3H0Lr6z3wMAoFH0/UU4FZ6F8g4+Fkz93lfd7jstUq0CczQyegDjUR9AFySfn/W2eR4slH5lEXAJWBWJmLU7aOGmk07uCLxlZ9bMwzKipHrKyLpsXr5iA8tVarF+EjnSckVi146yHGNqzzgJvxvzIJ6WMDUtCUQVsgyVJs70WvAzoX4EWF7eL7mx3QPwfDAtM2dwXKgaotVIMBQEtGZl9d4y2mmcjM6wVfOylI3POSTW/Qd5Ce66HOw47PhlCA7XTd8cDs2Hv1wTudeKHveOw5ZF2FoWD9/j9SpKozeMsTLUM1V8B6Drea9ycpb3dUKGRYin5wFnlcHoCKB3uHJZHQSVRaMewF3pSadiK5Hhcq/k/JLt0KDaTkxXxfIbX396gbBBr8Fmzjm+g0lU8lu8Kp2maYZoERm8/ElHVm1mVjAUQi+qNeKimOE9BFai9ZwlFAZ44J4X30K8xcG0DRChjGk/m07OkpLFutsDxxWPIN8lq1LAO8UvNKWgnhfR45NW4D5b7b00lcXDLYuZhQohct8O6pxiVti9C1Hwq+oO4gOt3ihKGqkaJViTJmIHB24kfeNqVYl/xf6rFvwxSgb2rKNR0iXbuvybDw1dOLemNQltuGOgUJjIpx57kIec6LZ6xXrbS3G7gjtp+TW/DfrTaSnJO52ayQByrajqTUzS9PJHwSPv97U33LiY3kGIxPtbPfegS+7Vrj+Q3lX8SalVTC+51DvT63HXDdpAhqZMt3VX6/OtU3GO3rNK9/cSbSTQOJGejBpT7cZGFatxHFWceZbnCTZMZShrqBtmGWTBsfzZJLwBDCzC7HAMK3psVPWMNdR4z7cPpg9uy3dYcnNwyxOPgH12FBURomJx7dYCsrovejIB7SCrAMmDWXI60e8PoD50Ks5z2ITpja0hB+qvrAaxwNnJ1HSNs62E/yHLCVMxS50dGPICTd/SMbogmIYw/gdthIcS52hFF7nWcs/gwDIRTkoZ3FU6ck+VnoWYVF0xRn9Nba/bM0efiaAELZmG+hNNIwsJN1VTlQ2sXG9EKyYnrgpk/ZN+F24s3vtXAGdDQ+MYf40RNovJxC6aIdD8Ff0SELfev9UjUyz5fy0wrRZWY5/uQQGBlD68D90LcQnJiVS7q6LQvf3Ec81ehcOOlQLaPkSqfE7HnI4uHUfruvBCILXP1GFntqjP65ZKVwJkz3X9oEcH68bkulroQOyyiWPmLNTw+2OAZOPN6tMooF6sE2OR/PTUHPUHsMu89Zk8YQYkMXQZfqco/yQ+azTUHPYzcNiJk175esbsmk+trdpXfTocFXIpx+w4Ht44lsqirOaC4PoWqOgVqnsri7ss49Wa6cHdwQu39j8+iBi8f3mPMOYA3U1I7icYKQqHI1T1ALUYMzk+ozvv+u/W3KoqoCX0MF7k6F65Yb7N9tvCZ9BawKYWDhOIjGHJwNP6G1odTEDx6FJaZNQKl2t7Ixg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c40b9f73-d368-418b-50c9-08dabebb51b6 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:21:36.6504 (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: S+sxGeZqJVsOj99JA7OPIDIvLR+rIsdo7AR3b1aO9HRQfVh4OsdnuE12cmqSEUgjGGfsaY1yspeRRu3TLAHKt6xcGWUFdJvyeTwzIyl7ZwY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4756 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-GUID: 0Gp9eajvJxJkQDMFXd73AbDpi9IxOEXp X-Proofpoint-ORIG-GUID: 0Gp9eajvJxJkQDMFXd73AbDpi9IxOEXp Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org scsi_execute* is going to be removed. Convert to scsi_exec_req so we pass all args in a scsi_exec_args struct. Signed-off-by: Mike Christie Reviewed-by: Bart Van Assche --- drivers/scsi/device_handler/scsi_dh_alua.c | 26 ++++++++++++++++----- drivers/scsi/device_handler/scsi_dh_emc.c | 13 ++++++++--- drivers/scsi/device_handler/scsi_dh_hp_sw.c | 20 ++++++++++++---- drivers/scsi/device_handler/scsi_dh_rdac.c | 15 +++++++++--- 4 files changed, 58 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c index 610a51538f03..e4825da21d05 100644 --- a/drivers/scsi/device_handler/scsi_dh_alua.c +++ b/drivers/scsi/device_handler/scsi_dh_alua.c @@ -139,9 +139,16 @@ static int submit_rtpg(struct scsi_device *sdev, unsigned char *buff, cdb[1] = MI_REPORT_TARGET_PGS; put_unaligned_be32(bufflen, &cdb[6]); - return scsi_execute(sdev, cdb, DMA_FROM_DEVICE, buff, bufflen, NULL, - sshdr, ALUA_FAILOVER_TIMEOUT * HZ, - ALUA_FAILOVER_RETRIES, req_flags, 0, NULL); + return scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cdb, + .data_dir = DMA_FROM_DEVICE, + .buf = buff, + .buf_len = bufflen, + .sshdr = sshdr, + .timeout = ALUA_FAILOVER_TIMEOUT * HZ, + .retries = ALUA_FAILOVER_RETRIES, + .op_flags = req_flags })); } /* @@ -171,9 +178,16 @@ static int submit_stpg(struct scsi_device *sdev, int group_id, cdb[1] = MO_SET_TARGET_PGS; put_unaligned_be32(stpg_len, &cdb[6]); - return scsi_execute(sdev, cdb, DMA_TO_DEVICE, stpg_data, stpg_len, NULL, - sshdr, ALUA_FAILOVER_TIMEOUT * HZ, - ALUA_FAILOVER_RETRIES, req_flags, 0, NULL); + return scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cdb, + .data_dir = DMA_TO_DEVICE, + .buf = stpg_data, + .buf_len = stpg_len, + .sshdr = sshdr, + .timeout = ALUA_FAILOVER_TIMEOUT * HZ, + .retries = ALUA_FAILOVER_RETRIES, + .op_flags = req_flags })); } static struct alua_port_group *alua_find_get_pg(char *id_str, size_t id_size, diff --git a/drivers/scsi/device_handler/scsi_dh_emc.c b/drivers/scsi/device_handler/scsi_dh_emc.c index 2e21ab447873..0ad6163dc426 100644 --- a/drivers/scsi/device_handler/scsi_dh_emc.c +++ b/drivers/scsi/device_handler/scsi_dh_emc.c @@ -263,9 +263,16 @@ static int send_trespass_cmd(struct scsi_device *sdev, BUG_ON((len > CLARIION_BUFFER_SIZE)); memcpy(csdev->buffer, page22, len); - err = scsi_execute(sdev, cdb, DMA_TO_DEVICE, csdev->buffer, len, NULL, - &sshdr, CLARIION_TIMEOUT * HZ, CLARIION_RETRIES, - req_flags, 0, NULL); + err = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cdb, + .data_dir = DMA_TO_DEVICE, + .buf = csdev->buffer, + .buf_len = len, + .sshdr = &sshdr, + .timeout = CLARIION_TIMEOUT * HZ, + .retries = CLARIION_RETRIES, + .op_flags = req_flags })); if (err) { if (scsi_sense_valid(&sshdr)) res = trespass_endio(sdev, &sshdr); diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c b/drivers/scsi/device_handler/scsi_dh_hp_sw.c index 0d2cfa60aa06..adcbe3b883b7 100644 --- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c +++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c @@ -87,8 +87,14 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) REQ_FAILFAST_DRIVER; retry: - res = scsi_execute(sdev, cmd, DMA_NONE, NULL, 0, NULL, &sshdr, - HP_SW_TIMEOUT, HP_SW_RETRIES, req_flags, 0, NULL); + res = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cmd, + .data_dir = DMA_NONE, + .sshdr = &sshdr, + .timeout = HP_SW_TIMEOUT, + .retries = HP_SW_RETRIES, + .op_flags = req_flags })); if (res) { if (scsi_sense_valid(&sshdr)) ret = tur_done(sdev, h, &sshdr); @@ -125,8 +131,14 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h) REQ_FAILFAST_DRIVER; retry: - res = scsi_execute(sdev, cmd, DMA_NONE, NULL, 0, NULL, &sshdr, - HP_SW_TIMEOUT, HP_SW_RETRIES, req_flags, 0, NULL); + res = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cmd, + .data_dir = DMA_NONE, + .sshdr = &sshdr, + .timeout = HP_SW_TIMEOUT, + .retries = HP_SW_RETRIES, + .op_flags = req_flags })); if (res) { if (!scsi_sense_valid(&sshdr)) { sdev_printk(KERN_WARNING, sdev, diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index bf8754741f85..c4d1830512ca 100644 --- a/drivers/scsi/device_handler/scsi_dh_rdac.c +++ b/drivers/scsi/device_handler/scsi_dh_rdac.c @@ -538,6 +538,7 @@ static void send_mode_select(struct work_struct *work) unsigned int data_size; blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + int result; spin_lock(&ctlr->ms_lock); list_splice_init(&ctlr->ms_head, &list); @@ -555,9 +556,17 @@ static void send_mode_select(struct work_struct *work) (char *) h->ctlr->array_name, h->ctlr->index, (retry_cnt == RDAC_RETRY_COUNT) ? "queueing" : "retrying"); - if (scsi_execute(sdev, cdb, DMA_TO_DEVICE, &h->ctlr->mode_select, - data_size, NULL, &sshdr, RDAC_TIMEOUT * HZ, - RDAC_RETRIES, req_flags, 0, NULL)) { + result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cdb, + .data_dir = DMA_TO_DEVICE, + .buf = &h->ctlr->mode_select, + .buf_len = data_size, + .sshdr = &sshdr, + .timeout = RDAC_TIMEOUT * HZ, + .retries = RDAC_RETRIES, + .op_flags = req_flags })); + if (result) { err = mode_select_handle_sense(sdev, &sshdr); if (err == SCSI_DH_RETRY && retry_cnt--) goto retry; From patchwork Fri Nov 4 23:19:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621672 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36736C4332F for ; Fri, 4 Nov 2022 23:24:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229562AbiKDXYF (ORCPT ); Fri, 4 Nov 2022 19:24:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbiKDXX4 (ORCPT ); Fri, 4 Nov 2022 19:23:56 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DD65B85B for ; Fri, 4 Nov 2022 16:23:54 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Kj6h0013351; Fri, 4 Nov 2022 23:21: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-2022-7-12; bh=HYr9EPXTTPYrG7cqF2qW4pLjzWoSFKj3vUsiaa8kca8=; b=w60KV9ZM5xf7zor884rE+xxmrXv/a1d0rO/M2qKlUDF5BoezJXkyiZpLzFt3gC2JebGH aIoCqtpGXbKKX+rEwmHDfF6FsAJQ3CmR8DIcsLQjW9psdPy7env1Lt0Uljaja1jTk3IS 6nd1xmWHPUPW2YfIvwDVCg9EhH589/Pjgc8HkOSITz51kVzUAGumm1Jvs+nAI2UfvkR7 RuV37AKqSKy2wU0JyrKCN7oqgJGKmNkic0KySZf1FlXsCbtvYMlZBgBcm+JWu5sENPfp qsiGD2hgoUYDtvqAGL2p9W3wB5fbUer0i2VQdiV8Eij2Eujohh/zziQQTbIV/j+GrKsP lg== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgv2as1k8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:45 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4N8CA5014069; Fri, 4 Nov 2022 23:21:43 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2048.outbound.protection.outlook.com [104.47.51.48]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpr4t9rr-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l6CS3GPYBM1pKR6p0L/hw9ZMxG3OBUY1iXaGG8q9bqcgRgmywzAyizVz9si8HpCKfW5Dvk6heAtZ+VXUCv2NLrJHUKjuze91x4bXRpBPcC0M6vtrALRprtxqsJPMdTe6gaTKkudp7C6qmSVirVTRbqFD0+Ss7V+/rcmeZf1csJLMEnlDFNziFKEfgb82/WCdXSUlBQqxiE/vwDmxegJO8WC62BILOjM4Iidix1BpO+RWdBdtTKMpKVD91jWwIs86Rb+1ANyS/yyr+CANynF6KhVXRdmJG+KoZy4yHX/tC/draLZsQMOLlLbiPm64Hgs0nns+A6N0EHqmcl79dfLAOA== 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=HYr9EPXTTPYrG7cqF2qW4pLjzWoSFKj3vUsiaa8kca8=; b=oD07qDUH4jDreHKNiSVOFgHsHWbVhCMAVJ3JvHPMY2dG58ruybSSywFDfbeET0di2UAx7StZyn3YDztN/MkbCxXb36ur8Y1ZgJEqJprOUqG0FJiuh1a8UqMqMmm9GvivuUBg3MFwqdY+5Sp7CR23mrGKtuJsCDbR4OooWB0D0TiF5i6nfc4vZN06TiNHWzLcu8qZbJqh9bb1ksbVPEQf/DSclyMk3FoilLRIgPT9opvW06HgM2L+3Nj/hFvGP1lvQozS2ljqP83jL2Mf0Xh3yP01Cxp9eSjBGkxYGA9e+mDjx/6ARN7ZBY9UeBeUVH9JzF/qgizO9+0swHe63bNkFg== 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=HYr9EPXTTPYrG7cqF2qW4pLjzWoSFKj3vUsiaa8kca8=; b=adcMT3FF2Mk46vsqIQFWNCZHZlymAiaYMPDh3cPiReduAv8mvm9sRGmKEy1yZk1Sm3Zej3i7IjqOTwl/2+XcTf0L6B4ce8GTG1iJs4AGtATOxpUi+Vgrsn6XLdCmuJBqLhGwOtYdAyYHPjroDWdIHf8vMeMq0WO4qWZPWhve/G8= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4756.namprd10.prod.outlook.com (2603:10b6:303:9b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 23:21:38 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:21:38 +0000 From: Mike Christie To: 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 v6 09/35] scsi: core: Convert to scsi_exec_req Date: Fri, 4 Nov 2022 18:19:01 -0500 Message-Id: <20221104231927.9613-10-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR03CA0071.namprd03.prod.outlook.com (2603:10b6:610:cc::16) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4756:EE_ X-MS-Office365-Filtering-Correlation-Id: aa0a82d2-36e6-43aa-6b3e-08dabebb5277 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ilG1BLZwMkqopRxtVvT1u+Wp1lR45zwG1LFys1Gp7voDQaiFfnU+qQFSDewFD0Ku8M0HCtA1LCXvVTP7R5XYZWfZqpRZeyugK2n7ESOSbWkhj0k7ZX0MCMSvawDSkxBsuL9XspUcfsNt7W3iD/UeIBT/qmoBOd3U7PTP7CONiyfRPRe0LNoQRuZQnQdMMXJn55RWXpjZm2/Np0Xnf2J8Cwglz5z2H7/0CQCVrcCPxpBH2/52qwyaLen14iLsvOjGtYVao6naD0ts3blNGdDDm2fmF9aMQD7TvxDiL7/B5DldJh8jrgEOaMernBUehGvlgaxjEeg3g6rHChrKzyQgIS8Ve1ky+2SOL2L471poA/K+pWd+Ge0nARaQBsKgATWJalAJEIz6By60boaPqSRmw27QaAwL1+4E+ISICcw+YYnF19GQiKem3mr+oAM4RYlSuYFs3B5KssTxv15p99rXntW0wby1eyDbZS+NhGVFfqqaAE7Xu0edDbYgBvavnPlq3UnduKInX16yb+mFomYYKGDNIe489Y34hZiU5BT8GHIuuwnazFAHNfSVz0bYn+qEGOZUdDxQQkr64wDyDW7QMxBZ3Km6a+F7p8Zys5xISVwPxhIAIoZ3BoLcfAHa6mxGdY1M+5/WPvdcACIq+Sl/Yh7PHbBjPgnCxtoegCM9xTPaOrCtsyhMm+74V9oRwGhOTp5M1bWmtEsludpYSUmiuQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199015)(41300700001)(2906002)(186003)(1076003)(2616005)(6486002)(478600001)(107886003)(6506007)(316002)(4326008)(83380400001)(66946007)(38100700002)(8676002)(66556008)(26005)(36756003)(86362001)(5660300002)(8936002)(6512007)(66476007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Gh0rXaycA5paCPy10oG7sKIGG61pgyWqx19RriH4B/ohwb1hLYfVvGrw2OMHwTx1i8djMhU2cfs3ZBobxI9zgrAvEOTIInqeoy4/wy+W6hrDVXEQcjK2aZUmdNHi/PpCPpH3wqT7mXN7ChTvIBH8xsRmJyL5FnFkUcrN074jubhn8acMdR7hutifgU8G/NKPybcJcD0qNvLLuJ9x+LeAQ9IUUXIeuZ2Dao2ZRmvjvE46cw/FMFaT7am1GqzrC9WOk/7O670hTzsElxiqwMl9nee+ejHFue1Dg/LvrlLibI+MU1sBBxbzWB6M50/Es2P+QYO6nJAsiW1Ic31Av8hNsWpKNDdNp+MXMTkFkwywAEEbcnp8jiqJ5IVPpmx61jGN1nHjhKWg6LPvz9FlrnK0UL51QLtE2AL0tqF9cLuUbwgQBGlrexafIvgwTbzuhnq2ILzGxqWJo2QuSgemhJMIumsoqOCvxn96zcONlpsAN9lZjBU9dUVU8RbmnXW2Py/53q2L+4xUEoAToUUENy16QbD/qSTvgR8jO7ub0pubwEAy3oZLj3U9FOK19URERAqumrBO6xgtW4xEinc8/PfdDyxhVFRynOlFkvxmTO7QgbkPY/k/I4EeVrYoLeAyaxaeIM2OA6n9zX6TglJGTxcl7XFumgAPkaZS+HZV9Q6dwjJx4AtLd0qbiacCbCa+WegrIP5+IJ8sxstsNPEA7XiNlahCIDdwJhhyLkUNTt/U1Tqg/E1PelQbgKMNIOApB5hGVh9T0WJMh6cIRIZl/GZfFJqpAlVqvWBtDKRsKgrgiU+3VZBjYYi8VUNuXWzgBeApJxr4I3ev0ZY9aM5rx/Pra6hr2N+pXuk3vAhXBIuQG3sXv6j1VXk79dMW8pVSgpyOGCmhaBrCoHxsPLlWpvBO9U+qCUagg20wXREavB21IhJ5+CHWNzeiIx7dkSiYJk5kqixwJ5NEA+795gJ52qMPjpX3rQhfFXOAolcAAvjwj0ftMLPy68BKISqX4X2+X3A4D8LWMpiYk+VXlhaJj+D/XNIX1t8b5ui3G4QFR7bgeiQ1/gsDCstXRXwM/1mA16Xf8El9GKPAoCVqzxpyzlPyYZmywzbyB1sE4Y8kr1Oi8Aewb2OLYPdCAe7OOqoKoIuTwgf0l8/EFFkBSTskPFQNcJPpsmEM4DBfL9rsM5crJto0DAmdTSkL2leCvw7VYY27VjVrKGpeRkUuJOKNNMF9HhUoZKsrJDqMa3wj0FaFz101dl6LuhjOEhB7Vhedm2lD8+sMBTEpK1YPjAsexG4O+lfGUxRivhGl2pCwudHNtEQEuSRc4/EZOJT4wONcPJzfz4indo2TQ58l6A/U/P5Go3RpCO4esrBewVXJvKaawwvkGPLsVF2AALuMN7lg/6876cijkLA6NZxyXoHCzvRk/qBcSB7cVKo/er8q9p04N/qK9f17iHDTQtXMOFaYhZW8sDPtlzV88pKLhpN4AW5HhQKQGE/C6d3T7lN0jo7VdGBvNx1F0RU5o3FguzbeRXRlufvPwz9Zng1RHzQ3t8jHCmsF2zkYknFPVtxiCiavAVkt3R8cWehrZzR5BL/WYRnzSVpCdpCHGBfQsoWWAXeRbQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa0a82d2-36e6-43aa-6b3e-08dabebb5277 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:21:37.9472 (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: FEu1xto6e4DlvAN+CZG0hife1NQE4VHJc3veh3LvnYPPeo6613VNkxymcwL1QLof+iWrFWnLKmPkdNmgqDZUwmLLLPUU1d4eihoeP7+HjL4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4756 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-ORIG-GUID: YtOVGPK86FWkCWVkmuU4vkAUS1-feHuu X-Proofpoint-GUID: YtOVGPK86FWkCWVkmuU4vkAUS1-feHuu Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org scsi_execute* is going to be removed. Convert to scsi_exec_req so we pass all args in a scsi_exec_args struct. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche --- drivers/scsi/scsi.c | 21 +++++++++++++++++---- drivers/scsi/scsi_ioctl.c | 9 +++++++-- drivers/scsi/scsi_lib.c | 31 +++++++++++++++++++++++++------ drivers/scsi/scsi_scan.c | 37 ++++++++++++++++++++++++++++--------- 4 files changed, 77 insertions(+), 21 deletions(-) diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 1426b9b03612..e074e572d478 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -309,8 +309,14 @@ static int scsi_vpd_inquiry(struct scsi_device *sdev, unsigned char *buffer, * I'm not convinced we need to try quite this hard to get VPD, but * all the existing users tried this hard. */ - result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, - len, NULL, 30 * HZ, 3, NULL); + result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cmd, + .data_dir = DMA_FROM_DEVICE, + .buf = buffer, + .buf_len = len, + .timeout = 30 * HZ, + .retries = 3 })); if (result) return -EIO; @@ -531,8 +537,15 @@ int scsi_report_opcode(struct scsi_device *sdev, unsigned char *buffer, put_unaligned_be32(request_len, &cmd[6]); memset(buffer, 0, len); - result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, - request_len, &sshdr, 30 * HZ, 3, NULL); + result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cmd, + .data_dir = DMA_FROM_DEVICE, + .buf = buffer, + .buf_len = request_len, + .sshdr = &sshdr, + .timeout = 30 * HZ, + .retries = 3 })); if (result < 0) return result; diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c index 2d20da55fb64..67f291cb0042 100644 --- a/drivers/scsi/scsi_ioctl.c +++ b/drivers/scsi/scsi_ioctl.c @@ -73,8 +73,13 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd, SCSI_LOG_IOCTL(1, sdev_printk(KERN_INFO, sdev, "Trying ioctl with scsi command %d\n", *cmd)); - result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, - &sshdr, timeout, retries, NULL); + result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cmd, + .data_dir = DMA_NONE, + .sshdr = &sshdr, + .timeout = timeout, + .retries = retries })); SCSI_LOG_IOCTL(2, sdev_printk(KERN_INFO, sdev, "Ioctl returned 0x%x\n", result)); diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 9b6dc47bcdae..8b2a9388420c 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2123,8 +2123,15 @@ int scsi_mode_select(struct scsi_device *sdev, int pf, int sp, cmd[4] = len; } - ret = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, real_buffer, len, - sshdr, timeout, retries, NULL); + ret = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cmd, + .data_dir = DMA_TO_DEVICE, + .buf = real_buffer, + .buf_len = len, + .sshdr = sshdr, + .timeout = timeout, + .retries = retries })); kfree(real_buffer); return ret; } @@ -2188,8 +2195,15 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, memset(buffer, 0, len); - result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, len, - sshdr, timeout, retries, NULL); + result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cmd, + .data_dir = DMA_FROM_DEVICE, + .buf = buffer, + .buf_len = len, + .sshdr = sshdr, + .timeout = timeout, + .retries = retries })); if (result < 0) return result; @@ -2273,8 +2287,13 @@ scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries, /* try to eat the UNIT_ATTENTION if there are enough retries */ do { - result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, sshdr, - timeout, 1, NULL); + result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cmd, + .data_dir = DMA_NONE, + .sshdr = sshdr, + .timeout = timeout, + .retries = 1 })); if (sdev->removable && scsi_sense_valid(sshdr) && sshdr->sense_key == UNIT_ATTENTION) sdev->changed = 1; diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 5d27f5196de6..58edd5d641f8 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -210,8 +210,14 @@ static void scsi_unlock_floptical(struct scsi_device *sdev, scsi_cmd[3] = 0; scsi_cmd[4] = 0x2a; /* size */ scsi_cmd[5] = 0; - scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, result, 0x2a, NULL, - SCSI_TIMEOUT, 3, NULL); + scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = scsi_cmd, + .data_dir = DMA_FROM_DEVICE, + .buf = result, + .buf_len = 0x2a, + .timeout = SCSI_TIMEOUT, + .retries = 3 })); } static int scsi_realloc_sdev_budget_map(struct scsi_device *sdev, @@ -674,10 +680,17 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, memset(inq_result, 0, try_inquiry_len); - result = scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, - inq_result, try_inquiry_len, &sshdr, - HZ / 2 + HZ * scsi_inq_timeout, 3, - &resid); + result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = scsi_cmd, + .data_dir = DMA_FROM_DEVICE, + .buf = inq_result, + .buf_len = try_inquiry_len, + .sshdr = &sshdr, + .timeout = HZ / 2 + + HZ * scsi_inq_timeout, + .retries = 3, + .resid = &resid })); SCSI_LOG_SCAN_BUS(3, sdev_printk(KERN_INFO, sdev, "scsi scan: INQUIRY %s with code 0x%x\n", @@ -1477,9 +1490,15 @@ static int scsi_report_lun_scan(struct scsi_target *starget, blist_flags_t bflag "scsi scan: Sending REPORT LUNS to (try %d)\n", retries)); - result = scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, - lun_data, length, &sshdr, - SCSI_REPORT_LUNS_TIMEOUT, 3, NULL); + result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = scsi_cmd, + .data_dir = DMA_FROM_DEVICE, + .buf = lun_data, + .buf_len = length, + .sshdr = &sshdr, + .timeout = SCSI_REPORT_LUNS_TIMEOUT, + .retries = 3 })); SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev, "scsi scan: REPORT LUNS" From patchwork Fri Nov 4 23:19:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621997 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D06FC433FE for ; Fri, 4 Nov 2022 23:24:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229721AbiKDXYE (ORCPT ); Fri, 4 Nov 2022 19:24:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229632AbiKDXXy (ORCPT ); Fri, 4 Nov 2022 19:23:54 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCD70C759 for ; Fri, 4 Nov 2022 16:23:51 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Kj8Yv014047; Fri, 4 Nov 2022 23:21: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-2022-7-12; bh=dV79/Obc87tSSRQeEHmAoG7u6mtZnjlW29/zoqDv9y0=; b=N8AHiPlqw34QX4vU7iYFu83YB62PsY4tkxFen/KE7Bje7CTKwmrOJHANpf2+EEN1C2YL 5aAUCQEOzLTvKHQtA/EFsmI9wNdc/CtztgVdeeVwFEmqHrFUiwZaJAAAmNSc8rdwAW1M lKfYPsVPcf5QChcvwOBN59/cfOIuF1QVf2RKHx759Rooq4TmLKyv2DK1bIDJQYsp2ioB WETOCWRfHzMsVnw0X99ObMtqhgHOnBiPM/c9S38ULUhFyEpsme/Fm2y71YpgDvs1Rtdp VAZRndt8xlQ+UHiOVHBRLsfisHLwiRqVdvZjFe2U8fZXVNEyvcQ2fF0XWQpqMDl81Dqf 6w== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgts1hgy1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:45 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4N8CA6014069; Fri, 4 Nov 2022 23:21:44 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2048.outbound.protection.outlook.com [104.47.51.48]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpr4t9rr-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jn64l9IkI24LkCBzhvBHrVgC1x2BhumchRtPk8WgJ1TaWrapwGRcoa9MZb9c7+7yCfErkywznTuIFcfmQ1kPdJS8PvWILaRo0784OeAjVDKxvkofqEITUaBXsuygOIUdpnAJD0P07OzGnHlDXDSfy16T3t88mn0AB9lxvQaGwi5oi6scnsobOfVGdIQMHI1AOf193zsJTd6C9EenJmXoW+rph1UenQW2g5qdD8lRiErSeHD4JFB/bsqlgPeWbgWDMOZP9+sXX6UlrfQDMActY0TzAknC0q+5e+1Ipiwfnwmy7edyJmLF4AklRFZUjOrRClVpmxgLR61NfizLEdCCwA== 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=dV79/Obc87tSSRQeEHmAoG7u6mtZnjlW29/zoqDv9y0=; b=Go0+O+JcV2KnXLDeGbq8dTy/opDu580lX252Bb5z74pJL+Y+4BRDBiF3DQ4uNQdYpgwHDXii0X/mSWfv7+AIsQ59WOcGON3sISCpFfmv5kH+PWNrvIayk0G2Exv6FVzmTUW+Ge8GLwTc5yO17HOYRi+PGyzfXD8Yln+moSoIdyBo/yTYBp/xRNcP/LudLV5XmN62edB6vT6UJl6iBWUkkVad17MPr0lAwQ2m6fp3MoH8+MJ2gyzZlZyhVoBbMhf86vjEzn08IR4G2JgkbgrYemLSYTPB+FcX7X8CbzO9Aia4plk4e6K6K6J5nDjfI8WrfTmM4wy0sdjlrsHdYbNK1Q== 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=dV79/Obc87tSSRQeEHmAoG7u6mtZnjlW29/zoqDv9y0=; b=IWNnMJaTU2W5DbTTG3CrhmFVXfX7/6fwWo/PY5vaWH35A9fbYSIvz70dCR7sMjNnxCmIA+01sPuUFtUaF4ARa+jbtlbo1fLbn/3lOWInEt0/nOctDtQ41KkKN4l9py9cV9va2wMGD/FpmEzB9CjotX1vu1CjRqEo9hYhLBhU8w8= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4756.namprd10.prod.outlook.com (2603:10b6:303:9b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 23:21:39 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:21:39 +0000 From: Mike Christie To: 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 v6 10/35] scsi: spi: Convert to scsi_exec_req Date: Fri, 4 Nov 2022 18:19:02 -0500 Message-Id: <20221104231927.9613-11-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR03CA0088.namprd03.prod.outlook.com (2603:10b6:610:cc::33) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4756:EE_ X-MS-Office365-Filtering-Correlation-Id: ae1222dd-0bd8-4adc-aa84-08dabebb535e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ccDXLJ0+Ws2nFuTvYVMkSqro325iaoJuODaBPbvaZiSRqRp0hrhGR+jfPUsEWPbh9sy2EWv+PXD9HFly5FSB+/jgrWB5qlcYujrlo4EA1ryGlGc2Groz+9HKnduI6okxQtOZfmh4jQ8uFAiHTKWD/FyDR3C2x+b0XyWr60LDMr/BximEGgBPbb4KkKjjpQWkfHTx2Hxg9Ccmz2kgqhD8QML8jkM2pY+m3S7QqYYOIWUquaDNLE8FsWwRCDmL8kIoihpqRNmzghIT4oVJHJ35bR6hoi4QC1t6VqiR7xqeKMweT2uy+Im9PHR/L6KmSbX9mjrYsYIHQE3an5iY9io4Sf5eUyMHO9Lm7wWKyO02JXOhLoHduxDTjvTWfLsF3oah6Vx8Wu+8lRKWtg9iUBNRIOwO1UfLaBih3ydYmqG5z6Ww3QAF5Hvk8XXQ3rI+Kil+tyF7rkitQ3N0IczjQuff/OvC7dJZm4/mdlvmSW5EjV1CbMjllH1et1DDbZNSlX+lubosu1d7/NeX1kmZMtcKcaAzulSCGzHGvfVlPNEP0d6b8aWA1uRkDSacuThQmexsZnhvZZkuZWYpK1qFroX1/+JWOgdXTnUZ5zjN7l1s3RqoYnCvog+rudg2QXzs2KF3OciFPUlM8YSnnMwo21TWawLwSxp6ikc+T9yo/pnbTUhOBeepQO39g5I6trYgA2j9qkd9Yi4oEW5N5S2nmSyHpQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199015)(41300700001)(2906002)(186003)(1076003)(2616005)(6486002)(478600001)(107886003)(6506007)(316002)(4326008)(83380400001)(66946007)(38100700002)(8676002)(66556008)(26005)(36756003)(86362001)(5660300002)(8936002)(6512007)(66476007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PPrqVwGToAO9M6CG66LbUbhwlvcX2jv8fXnWdvaS4iDuj1RF3pb0t6OWVzqeyMqcs4WRpMoiHdBMh3smxxJIziUOluYhGXXsZleXdzdVKjvfFavfAFjRrd78Q+8fJgkoKjv5OmMKm8iVZbolaPLOoemweMSfcJq7bVPYkMTsNL5hd1or4zufI8yiYI6K1ocyH4cfH2nC2vcx/BAEbl02WymbwBVBl+K2DE4wzSQJHkjO+bp2GGl4OzDHT09xj2Xp/+gjmV14TI+gJwFA8Jn4Fy5qe1yDSjHraJXTmvEfB5slsNievtfh+wWq6+qFtpETbP85fK04DJpv2tCLy3k6flKTPAjQJj1I4PqV/SF0s8xLFgZ7CWKzek8y5al21/3jYMwBmwum4SnGdkaeudor4AvA3KZNj20P8JcOqW71Wsa1DoZNNlQj2EQ9t2STlgb5u1P5Ta77HsSx4klbOs/i2vQRT1VEtuAvSNE2l6dzsNkSUFx9hOj9Goa8plNbM4SyXy34uzy5hVvMuPQwPgFUjPiqkvT5Stm/0lNISpDO0g8fnf1di08GlAnq/eMNyFUmHs7gtpCxH4V9KX4rl1edVbnfs3CbxF43Q3mA56DNRz0mFxkFzWOyJQHDFr7Gm3chBnPXfyPnkj4zUuw2I9i2hFffviydUCOgDnV5JlrToSExEoLyVRCqfEwoyrsBdS1Re0F0yilkijiAF80yKNx7RbB1e6AYNfe9hMLQ2LVebxpzzdzW6TWrGo8IsEAnHaLscwJWzHCQfjEva+A6mScZWaUItGw8tiPp4tQ99SdWAfOHlzeNuH+pdv+KQUFh3xTRd63jAG/AHN8M58kpwNdf8goXsIhwFVl/BvCqOgsHZ51++oxZg2MVc6QUu0srwsORSwBBCtBJgZiNcrCxQSIf1HRdSk+xJT2IfQceXyot6Dk+RJ9aj3BqaBLDCPRoBoAzFsfVjy8SDXvbrzLSoLB5WFoyGqU8Pwa9yXb28PsG7ZE+Y6L7khqoeISiCrY4Ajc5BlCppWU6guipRiC8D+mUXqGA2ZGWxrS7xA55nar4jaSX9HZK2pJhRAymnZSqwMmOEBMVFsEqFhYRqlsbvBP5kPqcG2ny/4dLMMLUzo7h5IN0esbARBjFhgRVo4nDuwmE923sTcDJkbgByoAPr7U84ROB99RXem6i/11x2zhVtwt5pGp/yOSKe2D36VTvZx8JUkX+fOh2KIE/06O+jq21o8iFzZ6dwla4gRaRy68dQNK3SFzifR+DfujuFallP4/VJ419mNXEdigcC1WsUoy3JC60HIWBSRxLTBr4UgAu2pxt0EUVpsR7P4LpZqkgsiZpgOJkYfyuHjKLlRBnMWZyk3E8mUJ1QrYsXVBafvMJ9Yx3oii6uPYUsUs+WevOB3LdBbTY3KGNSif5pM0fnCOMGA8GhktNGnlcPHzpM3mH1yzWMVTPXZjX9tGdsCnSQA/T6ymTJFocmfCY7L7yO6Pw8C8xKVcCgozVMw6ctzSwWP5rQ5DFkUJe4P51ls9/F7weQnsWRAzbUQdJe1Zry5ROIIeZGi65b9S20WRJspy+yBSDXc3EXyTLVHW98NJsSXsvyQB9HwCop0QJbA+P3Pohbg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae1222dd-0bd8-4adc-aa84-08dabebb535e X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:21:39.4471 (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: P1rsWbK5fVaDWmOwK8tcbg9mVaNaOrsyif8JeBkKqLnC1YnnhtnbAhTm7gtGTu0d5hs8n0HZHs31g32VhiwldlpIRyQ2cdkEtKzBFzbj1Fo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4756 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-GUID: wpOPObsAZ3SxI58-gdgRDYMe3ZQSzDOF X-Proofpoint-ORIG-GUID: wpOPObsAZ3SxI58-gdgRDYMe3ZQSzDOF Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org scsi_execute* is going to be removed. Convert to scsi_exec_req so we pass all args in a scsi_exec_args struct. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche --- drivers/scsi/scsi_transport_spi.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index f569cf0095c2..18a365c577ed 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -121,12 +121,21 @@ static int spi_execute(struct scsi_device *sdev, const void *cmd, * The purpose of the RQF_PM flag below is to bypass the * SDEV_QUIESCE state. */ - result = scsi_execute(sdev, cmd, dir, buffer, bufflen, sense, - sshdr, DV_TIMEOUT, /* retries */ 1, - REQ_FAILFAST_DEV | - REQ_FAILFAST_TRANSPORT | - REQ_FAILFAST_DRIVER, - RQF_PM, NULL); + result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cmd, + .data_dir = dir, + .buf = buffer, + .buf_len = bufflen, + .sense = sense, + .sense_len = sizeof(sense), + .sshdr = sshdr, + .timeout = DV_TIMEOUT, + .retries = 1, + .op_flags = REQ_FAILFAST_DEV | + REQ_FAILFAST_TRANSPORT | + REQ_FAILFAST_DRIVER, + .req_flags = RQF_PM })); if (result < 0 || !scsi_sense_valid(sshdr) || sshdr->sense_key != UNIT_ATTENTION) break; From patchwork Fri Nov 4 23:19:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621996 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0963EC433FE for ; Fri, 4 Nov 2022 23:24:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229626AbiKDXYH (ORCPT ); Fri, 4 Nov 2022 19:24:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229634AbiKDXX4 (ORCPT ); Fri, 4 Nov 2022 19:23:56 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FAE56367 for ; Fri, 4 Nov 2022 16:23:52 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4KjFO4012176; Fri, 4 Nov 2022 23:21:46 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-2022-7-12; bh=fZNfqneG0jK1/tbPpvcrmHtRanh1CuV25zs0jlbH/F0=; b=kt5wA/4xxZoZP/V7MapBCzqtN9KBNkYaZlXCBfE5DkmZtR2jqOTuH4ded4fU5bLQPOXa yQrr1aZNqL7KJlOT+1t0wyfSs7c0h5gMSO3ZzBLibzAzxMdn+YwjSFsMkI7/MHQB0qZn rDBagnMv7YtGtQdvHp6hdR6OO72+s26DVPc62ho0WFYqyYGXsjFfCIfk7McvxaP9xDV2 Dh6l/cDNzf8g11fWtIPwMuSNRFB5A+lGyMsF2Y+iEVqVq17g6GhD/z1bYmTP9yyMc3yF bNadJ84FfKpqNPkdiH7RzNTCJyCPZLUxKa3IQ5hNk6anuIo+MvkKWt/bYCm6dM7/EW95 MA== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgvqtshvw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:46 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4N8CA7014069; Fri, 4 Nov 2022 23:21:44 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2048.outbound.protection.outlook.com [104.47.51.48]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpr4t9rr-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fSVCo/WOZB7S3v/jtx7RElJsh9hG64Havue20kV0aUwjEgNWIrhbtZjsg2ZaugT6E/PotAUsjTuEFTJcPQYxCvj6zn0CZ/DeZCzlJ7F5/X8WqxWERLdeghoJLCV1xQnSMhCjFlHbWBaxlaUgK4L20rYazD5jIv9H1NlWMGzC0n3P9qExgWDRz5GlLZcLaGAmwWT2g+7Chefs9iY7pbEVi1kSf6luv3lHFxXfNfNrsKtM9XnNIC2BqkXqFZVr2U92+RvlPa/9qxOumPphW8gZa91E4Mj0v1z9O/gCEl4l/duSxERlGr3Yn8DE4drr0/fPCFM9K2aDXkjS3inqt96HAA== 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=fZNfqneG0jK1/tbPpvcrmHtRanh1CuV25zs0jlbH/F0=; b=BM2fQWgo7iy8nt/dCpoGrFjgjVIdpuGANNIsZ5etUNb7ALG45LoxFSte3EiqNcRUVSBK4QgluQ9YlX93+aI87ROecYva+Th2asu/yRgxIjqWch1uiVAqs/UShfkex2xDNfz0SB4fY7QZHPBoElCVZyJK1NAsqSQsPalMxLy0v9Veeg+JIhYXlsaEzkSspz13DJnKY71vE142SO/8ThereI46rvNt5iL7JTeehHIz6TIZV3NLoKcWkEUth8neQOyXLESb24kNqCiMPdDfVO2eZUC25fSqW3MZ7c4Wb8B42lK3qkeKBDHQuAmAo/mmdOCqYaJpFjvXB6XRpXrismlkKA== 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=fZNfqneG0jK1/tbPpvcrmHtRanh1CuV25zs0jlbH/F0=; b=ibFGs6lD7HBHD0n8mwfP2EtyeWRD/T2Hkl8Gl2lqPIg9pVNisTK8yp4gHjB/t1aJ1pT76ckdaTItRB2HNWzqj7/leqHYPEv9vFBnTnkwXUP6zeGbZhw8aGP0+LDNsr4DlXC8shkIXIyrzUhK+V/he2RLbNxqrP/MnRWoEkDp/YI= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4756.namprd10.prod.outlook.com (2603:10b6:303:9b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 23:21:40 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:21:40 +0000 From: Mike Christie To: 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 v6 11/35] scsi: sd: Convert to scsi_exec_req Date: Fri, 4 Nov 2022 18:19:03 -0500 Message-Id: <20221104231927.9613-12-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR03CA0053.namprd03.prod.outlook.com (2603:10b6:610:b3::28) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4756:EE_ X-MS-Office365-Filtering-Correlation-Id: 0c2e99ab-ee6c-4ecd-d971-08dabebb5413 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3a3EmlhS5tEDWvdZGVBQ3sQs7e03LHWo8nhCF7kjAetjcdmBSo1zG7Hy+1RjAa6jqrDGSA+0Xcy0L531hnU4RJ824/jb2CAqjFw7FB1g4GNhmmDQqOAX/qhSUN7KxxC+ya4WHMtB4XYS0I/jJKbyridLEHsR3fSXPdvH2YQ8tQD6FmLpUVt7t0L59JRV5q8/e5hIpQwrX7QVttzQb+NZcpluLResP5kxdUDLJeVU3sESgf6jghwbL+JMoAO+ifINTAWxG5Stt80XKq8GUzJlGQ7lrEYFmUw6CTjtomy6ss0/8CPJCE64RCVRspLrV6N+mk0bxhMPW79WNafYkSoI78+gx1E6RyJgQACpWgsvWpq/1kDCg66YZx6UiYfeuugYWd+0Qp/wtZQ2x6WKE0wWZbva5aJTz59n9lM9iKL1ylLwFLThTyvIiEt5mAxOHceCqzq90vH/BfSIpWyLwB7MJ+7kRJlGH5hoMCEjXcJc7/eNzxuhv+rI9gPxKFifqaWN2rufneHY50JckZBWTkhoUyomyUvuDLwC/8+y08/NNoaYdDw+9t8QymF2c0XRHmKWoKPh1A7zrEobbWkjzX6sq1Jv5OgrBW3p3cbUrZhDcbEncvTTG6wK55eA7QbCRyYIrDXcvuLHMRPr7vULzBChOTHkk0SZ5W82ux61lIbm2/GpMo9MrSUX/EVz6b9CdLmGmzNO3AlaxkT4zA3Gqi2Emg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199015)(41300700001)(2906002)(186003)(1076003)(2616005)(6486002)(478600001)(107886003)(6506007)(316002)(4326008)(83380400001)(66946007)(38100700002)(8676002)(66556008)(26005)(36756003)(86362001)(5660300002)(8936002)(6512007)(66476007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Fu9TyjsUfe77K6+LgTFazKnBrw0msZ/KuPXWEBV0cxZtvw/IlizQ4jvWgkt+LJsk4d7PT3p/v7A/kx5OjYPfupdUFNBgJ6g8rdsLbCIRo0m2mQUyGt27uZ2rMIspho0S1686xPUx/hFaLvYtE97rYfg0tzf/XsecQVF82SiTsku6aAJZz/2mGmzMftzH9n22aieayN0ztkeEkoVCUc/b84Z1gWu5lr4XpgIIM/MSB76MXaBWmnHjM67Ktko3F+ilSD6hmyuIV5mTFqPCkn4LMjk06HR+UYjpnor8bChLOC7I1hvfipzlO66PNg9PuVrw4UVO2wBoNw0HwqgD20uZhVbWygXJrw3tBQfS7F6NBG5NRw9n0L55wHSymg0n1zjdyA2PD5HskIfrc4+OStvLpLThoi+2w9GpYfsDqFkffxubS/fSeWex+PlNNndweD+RBb4avcYLCnwPjOFYkH8QvOZ8tBLqcx8Wo3IdRu2PHzHpuhqgxJZ/EtC2GRpFh0Waz370mXcahGQ5nHzuZ1+k5NgF6dSI4ARH9LFJ+yh/ngWRTJ8gLRe9sg6gsv7czySn0umCkKwIgZnZvi6ct0GzZpAiwPfzgatnrXXhQwrKyGDpSvBrGNpnLp8kdTDobB5dw0I5dscL/66GXRYpM+cJylrMkMtZvcHQvOvFQzMiUvljsKuQn+0kwoh10CZuGliDWMCAd9OqSLyJLBp208dyiBQqvv6sCwuS6J4E9DlkMm8VWOv+WjMKDxLy0BaC8Sc+4PHNO4QnrfA+Co/mo7tg0fpuWPEy017bgRQ5LXcY5/2EdOxWsckOUIhGSvwkeg506VVCYA/Q1S5SrKPKWnzhJBzb7ohwzCsMr+Fz5VrQa7haPhftPe0rUPCo0Xf6hp/SL1c4ZLEVXRkPT/aBbQrOn2d5lX5er8fXvMYe8H+8lCjPPaG2QHweJDpxvNQ6yVXnmChXSP5UcuaeISe59zrIDKtdSs0SL4DV3yUSz5TOGYSfy4pkdqkV3GEWv9DCnJGpKo175P4YIa/NofsaE+InfoUInc3e0RH8ilt34TUfx6X8npIv2EXt1YJoUlQ4Qsrk84aRptV6p/Fi5q2zs1b5VxL1Z4tLCHkwRmZRNGR/2CNtXTV8IsLoAO0joYBQ68R+UpgkH6JtMpiZtboDm5LrroDBBRoX++yD9JQEbGWg1/rWA59ZiDJdgMuDejaHCpKQR1sQXeMFtp6NRWwIdMp+xCMoi/Bqe9XeK8mzROdrkz/SYgPFqdU5P4dtD6fg3rKkgWndlyEsb1sk2MOqnheHRCU/+jC8waZ2lfZHO/QW+iLkFQquasNWrYXmTJd36kYwNTFuNB0nioxPbzgSwBJ4fZZwo9eIAieBwbpCdNCcicLXuM40y9Mz8/pgkvjI2wcOjsiyCYRc4/hLmQoOY36LYiUpS4Tqo8KGzFyCn6fOEZBGRkK1aWAXoqSEf7vaE3pmrIqFiCQoT4pe6NRgdPM9BnfXqz4TArO8SzpoGZuhIWoQXd8pqYsynVzbJg5QMDzhQaSOJGXwjXxY5R61qwFBIQwnKEEhjKKhf30bOdM0n06MdP7jOs12t0vAvB7t0B/EejOkYPCwebjASLZxYaVZlA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c2e99ab-ee6c-4ecd-d971-08dabebb5413 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:21:40.6501 (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: g8/erjvImHtv2ghTFedP+2zI2YyUxt2HZusnaRPdisfYG40hQwIX19vx1SWMZvsfvNMl5EMmUnQvwM68AHhm7x33izeHyDZe2ktFegAj7m0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4756 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-GUID: Z99OPA9KKGziObbeJYaxN1F4y2Q19aoC X-Proofpoint-ORIG-GUID: Z99OPA9KKGziObbeJYaxN1F4y2Q19aoC Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org scsi_execute* is going to be removed. Convert to scsi_exec_req so we pass all args in a scsi_exec_args struct. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche --- drivers/scsi/sd.c | 102 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 76 insertions(+), 26 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index eb76ba055021..37eafa968116 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -671,9 +671,16 @@ static int sd_sec_submit(void *data, u16 spsp, u8 secp, void *buffer, put_unaligned_be16(spsp, &cdb[2]); put_unaligned_be32(len, &cdb[6]); - ret = scsi_execute(sdev, cdb, send ? DMA_TO_DEVICE : DMA_FROM_DEVICE, - buffer, len, NULL, NULL, SD_TIMEOUT, sdkp->max_retries, 0, - RQF_PM, NULL); + ret = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cdb, + .data_dir = send ? + DMA_TO_DEVICE : DMA_FROM_DEVICE, + .buf = buffer, + .buf_len = len, + .timeout = SD_TIMEOUT, + .retries = sdkp->max_retries, + .req_flags = RQF_PM })); return ret <= 0 ? ret : -EIO; } #endif /* CONFIG_BLK_SED_OPAL */ @@ -1594,8 +1601,14 @@ static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr) * Leave the rest of the command zero to indicate * flush everything. */ - res = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, sshdr, - timeout, sdkp->max_retries, 0, RQF_PM, NULL); + res = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdp, + .cmd = cmd, + .data_dir = DMA_NONE, + .sshdr = sshdr, + .timeout = timeout, + .retries = sdkp->max_retries, + .req_flags = RQF_PM })); if (res == 0) break; } @@ -1720,8 +1733,15 @@ static int sd_pr_command(struct block_device *bdev, u8 sa, put_unaligned_be64(sa_key, &data[8]); data[20] = flags; - result = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, &data, sizeof(data), - &sshdr, SD_TIMEOUT, sdkp->max_retries, NULL); + result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cmd, + .data_dir = DMA_TO_DEVICE, + .buf = &data, + .buf_len = sizeof(data), + .sshdr = &sshdr, + .timeout = SD_TIMEOUT, + .retries = sdkp->max_retries })); if (scsi_status_is_check_condition(result) && scsi_sense_valid(&sshdr)) { @@ -2062,10 +2082,13 @@ sd_spinup_disk(struct scsi_disk *sdkp) cmd[0] = TEST_UNIT_READY; memset((void *) &cmd[1], 0, 9); - the_result = scsi_execute_req(sdkp->device, cmd, - DMA_NONE, NULL, 0, - &sshdr, SD_TIMEOUT, - sdkp->max_retries, NULL); + the_result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdkp->device, + .cmd = cmd, + .data_dir = DMA_NONE, + .sshdr = &sshdr, + .timeout = SD_TIMEOUT, + .retries = sdkp->max_retries })); /* * If the drive has indicated to us that it @@ -2122,10 +2145,13 @@ sd_spinup_disk(struct scsi_disk *sdkp) cmd[4] = 1; /* Start spin cycle */ if (sdkp->device->start_stop_pwr_cond) cmd[4] |= 1 << 4; - scsi_execute_req(sdkp->device, cmd, DMA_NONE, - NULL, 0, &sshdr, - SD_TIMEOUT, sdkp->max_retries, - NULL); + scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdkp->device, + .cmd = cmd, + .data_dir = DMA_NONE, + .sshdr = &sshdr, + .timeout = SD_TIMEOUT, + .retries = sdkp->max_retries })); spintime_expire = jiffies + 100 * HZ; spintime = 1; } @@ -2272,9 +2298,15 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, cmd[13] = RC16_LEN; memset(buffer, 0, RC16_LEN); - the_result = scsi_execute_req(sdp, cmd, DMA_FROM_DEVICE, - buffer, RC16_LEN, &sshdr, - SD_TIMEOUT, sdkp->max_retries, NULL); + the_result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdp, + .cmd = cmd, + .data_dir = DMA_FROM_DEVICE, + .buf = buffer, + .buf_len = RC16_LEN, + .sshdr = &sshdr, + .timeout = SD_TIMEOUT, + .retries = sdkp->max_retries })); if (media_not_present(sdkp, &sshdr)) return -ENODEV; @@ -2357,9 +2389,15 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp, memset(&cmd[1], 0, 9); memset(buffer, 0, 8); - the_result = scsi_execute_req(sdp, cmd, DMA_FROM_DEVICE, - buffer, 8, &sshdr, - SD_TIMEOUT, sdkp->max_retries, NULL); + the_result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdp, + .cmd = cmd, + .data_dir = DMA_FROM_DEVICE, + .buf = buffer, + .buf_len = 8, + .sshdr = &sshdr, + .timeout = SD_TIMEOUT, + .retries = sdkp->max_retries })); if (media_not_present(sdkp, &sshdr)) return -ENODEV; @@ -3608,8 +3646,14 @@ static int sd_start_stop_device(struct scsi_disk *sdkp, int start) if (!scsi_device_online(sdp)) return -ENODEV; - res = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, &sshdr, - SD_TIMEOUT, sdkp->max_retries, 0, RQF_PM, NULL); + res = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdp, + .cmd = cmd, + .data_dir = DMA_NONE, + .sshdr = &sshdr, + .timeout = SD_TIMEOUT, + .retries = sdkp->max_retries, + .req_flags = RQF_PM })); if (res) { sd_print_result(sdkp, "Start/Stop Unit failed", res); if (res > 0 && scsi_sense_valid(&sshdr)) { @@ -3740,6 +3784,7 @@ static int sd_resume_runtime(struct device *dev) { struct scsi_disk *sdkp = dev_get_drvdata(dev); struct scsi_device *sdp; + int result; if (!sdkp) /* E.g.: runtime resume at the start of sd_probe() */ return 0; @@ -3750,9 +3795,14 @@ static int sd_resume_runtime(struct device *dev) /* clear the device's sense data */ static const u8 cmd[10] = { REQUEST_SENSE }; - if (scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, - NULL, sdp->request_queue->rq_timeout, 1, 0, - RQF_PM, NULL)) + result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdp, + .cmd = cmd, + .data_dir = DMA_NONE, + .timeout = sdp->request_queue->rq_timeout, + .retries = 1, + .req_flags = RQF_PM })); + if (result) sd_printk(KERN_NOTICE, sdkp, "Failed to clear sense data\n"); } From patchwork Fri Nov 4 23:19:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621995 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 706D5C433FE for ; Fri, 4 Nov 2022 23:24:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229729AbiKDXYK (ORCPT ); Fri, 4 Nov 2022 19:24:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbiKDXYC (ORCPT ); Fri, 4 Nov 2022 19:24:02 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B290B7E8 for ; Fri, 4 Nov 2022 16:23:56 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4KjBBt013373; Fri, 4 Nov 2022 23:21:46 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-2022-7-12; bh=+ShUH1Cm9IjgWLwMtUP3eOv3O3dA79ysgx5YeWTHX1Q=; b=WFNJYZ4rzm4LJmtg8d6DkoVME22Y/KxGyeGBY1wMnKOvfE66keXxrJonOoZTUlABnDV2 MUjnQorvM0KiQ76SwZjv8vqcx6hCBV/67slcdYV5ACuMK9WSRQlMDRKY3fVdaP6honeU YBw00qwbAgsww5x3frjMjSZhpi9WJJ67qIj3MUaffuKHGBTj5ujo+tG6LIpLql0kKZru tDy7or9N2cVo89BFEFozUDSExDBIkzKTzxBB7x/RNeeJlsDHuqJzlpyq4udoE8wNwcb2 54GuUoemeQqDn5ZWE/r68UqUZSqID1LObDnoBKkmO1eIqBCC6Rn5kWq30z3Szf2oNKKl /w== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgv2as1k9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:46 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4N8CA8014069; Fri, 4 Nov 2022 23:21:45 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2048.outbound.protection.outlook.com [104.47.51.48]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpr4t9rr-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RBnhYFuTeVSKKxUBe+Lk8Jkmt7b9CD//JZHVtSX+kcFo/OSLNEirUywCYaccZLeLcQEXLFNzUIPQu80wkB7N66bOm5tuVknchb5EmAzgh28uQqh31qmXaMFOvkb+Li4vtq8wxcHblczNSizIZ4l2ApZ/To3kbgsOGYb6C5ZWUEpMMwAeQKy5mFEGFNshIP/WFXd89U0oMFPJMlrSdbPYdFh3jVPwHz4q0Ntt6sh6YZGUYTJ9F7jkpnfM6ln1qL0DV0Zocy84avj9FapMOdhOENaQtxIaDAShL3uJjMgIvMwBadQUqEzSGN3QJt+7otT9lD1N5NsTV0uiGzPV/0yCDw== 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=+ShUH1Cm9IjgWLwMtUP3eOv3O3dA79ysgx5YeWTHX1Q=; b=Z6DgrndqIjiAtWOsb65oB6jX93kXUXxqXLJmMuKgAW0mOLzTFMcD9pR2RNTjdzFG7QQxh50PUv4t/x1Qr/gOh33YcrylDqzulfRdIus4iyKaDhsxaM7g+ILdeg7g6/6KeTFcR6SeC84deAvnR8qjw80T3NZMFj6sUvo92BjkE6bCWAuyvK6jm/RKqZSRt5tUH9nqP466ugdNZzfvsu0WZkCKehtgjVhiwspPpHcdVYjWAIYyqOJmEAppyAMCsdVLNpaKDCxO2b77Z3g6YTjextnI4+OMuD4f3Cj2bTyplzqkdr2BfyE6gvZSXF3xqDWrYsynCPgrw4/Qw3ZtGwYtFA== 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=+ShUH1Cm9IjgWLwMtUP3eOv3O3dA79ysgx5YeWTHX1Q=; b=kkuEI5Pdc79GOnyNm9u0timl4BAIygQWcpxGCRTAxFOVmQ83nYUO6rvyd/ePCJQa1GZXYJtufd+qPoPucnKBXxAAxY3tq66HUIwLHxoSl2Qulbf2lv9s7UqrxnRnY0sI2vb47zkg79GPsTpTmjUSQaDAIk1Y/QKrjZj1OYbtc6I= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4756.namprd10.prod.outlook.com (2603:10b6:303:9b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 23:21:42 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:21:42 +0000 From: Mike Christie To: 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 v6 12/35] scsi: zbc: Convert to scsi_exec_req Date: Fri, 4 Nov 2022 18:19:04 -0500 Message-Id: <20221104231927.9613-13-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR04CA0063.namprd04.prod.outlook.com (2603:10b6:610:74::8) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4756:EE_ X-MS-Office365-Filtering-Correlation-Id: eeb8e6c4-e960-484d-5428-08dabebb54f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dAwhbRil6HIR8tUufS7IdQ4aRRGyeXGbSIn75vCeMuKwdSZMpReLoa1ODdtAB/aXhW1rwEFbE5rks8Oc5WYLW6M4FjbdzpRxkUzWX7oM72ZrVq1pNIKW50jie2cQfxr2VBhjDzhwsyYSb89BAi11wHOvDg4hpIUfE/xyX0pUHZXXTzQvX+5+SCq+k579hmDNqAC5lRXktu0swfXMwR+Jckqe79czXWmjMh1sQxLx2e/pi7VdxP6xVrsJi7nBgHRfynEk2uit/wDZSggQKLSWLEFPzgLuV7wPR6d+n3d1b7hzFG4MDxR/7V0sZ4YTnYgH6hdX28bof7yLeDVlMGd1sg5im9+jjME4Q7ZObLNx1pnG/20t6Br2/5m3OswfWatJLlT53tE9uwzX9rKnIs/CzxHZtMcWU7kL5B+JjpBxXRTl7iTCRwE8+rD7tvY0zB6MwBz5NsrRg3N0DVI3VIx975g97BfcBk7+/n0wnFrdetBwuzrLFFR83TuV9cWd89w9u0vBhp9pqAzmZouu8px22u4KXmCYxwodrobj5jxrxqmKNmvjhbYfUpFAtlfsHOGhPfdL6i2aOWbDHrpKIDvtnCRCSfMpsS5FfRJNfTe6xZASMpFJ9SrWMJG/hk6Bx8f6uWfuks6J6VflQKfcGrfRwd9OWThnKCjgQmLXqMTfpMLo0vJYPh/pPOb6QTJ1Bsp4W3UkqoVBYF84ByBNSLsJIw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199015)(41300700001)(2906002)(186003)(1076003)(2616005)(6486002)(478600001)(107886003)(6506007)(316002)(4326008)(83380400001)(66946007)(38100700002)(8676002)(66556008)(26005)(36756003)(86362001)(5660300002)(8936002)(6512007)(66476007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BzFmKgoiB5p4AmD6UhlbNhfUGtvBhNmgAD/cPhBk14p55ICKOfo9wQoDg08vCv74yMpB5UkLFREpGhpiKdgNFXBNGeQrg1AYUnoVqcw6Tz4SSnHE1hKz3gkkHXzW2BKdyTH39gWHLgH1LRQ9lVPDveCyEPAVIJNf/HGro4Hhjj7NAHna9tRtcAbD2L7yFAsLZhNE9FxA6w5/ckSOBZEhRCIHzPfIEdnALM0EF47+Sw8rxBMILnUJOY+23Wv31uI8A5Lzbwkp96vuh0r+F4+dEV9JLDO0vLWIota9zX3xR4KQ4JErKEORSkDjoHBgUbvsa703gR4OTbhHRCJ2rd3HOxmLpM0iZBBLZ3N6Qel8+uHYdSv+ce5Y7SCZ3e+vVwzIlEsKAV+Ez1oxZf28O+l/mnGYANLv3wSYfj3CAwNCX4lciOFVKxDOqvxnXP5axThXCd2vbPTrbwpGUgjTlPAGpMQJCjj+nRL8GE51GjtBpB/s0aLJMu1hMKGrI0Gafk/jpzYBOoRh+cpj3hlbqQLR6P8YSWHzC9oJhqTBx+KP7NHx9TVffwIzHUkLvaXDCxqBkHdRVikQbmSA/39rChctJMjyLe/Kw72TUpgDkg9k+Ic64xVFz/HTJYu2F70b5/SOAO3xJJEhxJP4ursct2OCCz2/IxZflpT4jcrUqmx8v8pSRrPVLe0B+Agg8H6L0AxRA9F12U8aHRrSfWYTcLhNsFMncRMg0nBoqDYrVaTL5KIIskc+sS3/YCcCiicHrEmwuVwjgo1AsBLIZWB6gk/8hvDLP2ToeDAunw1oibrLaOpCEJ+wm1e4xJvrSe7JgxVuh8Da+GM851AplDGgff8soNQECnLvgj2s6Z9c31OBBfE0Z1sFFfSfngmDWPxC+RAzWoHnhzyr9xAKWRCVGdSMx+q6jHrM4diaZwLGUHqbh1fNs/AwORbrV4jNU+x08MUu+3+j1wKgpoTg6ZrmjtSclbc2sXfN/tkZ/uB7ggim2jCHe54VQRvZbiYWHKD8baREVTYwNvsLJc0pTP/dfSJNYAZ2aRLNg5B/Pcezf2bEu28WC03jo8EY+0TY9tcG8DjaACnZATYeVKbUuSvkybGLGVpkVSmncz0tLqAKPrx5zQ98NiLZ/QVdF2Ijr73AP5ajZBOSpvl/xWVFqljoggAhpG+1lzt6V8Ngh1IiPmh6Jqw/oKqo13tO4xWAcUEcYnP4dIsvbIdixPIPSIwbaIWdDRph5lwXe5Gk7TbtTN4FCQeL8yAXU2psMCdu0JMVoK1ElHD0JrUGpTLwKb8PrUbSwAlUce/GcryyyBNUEwI1aUGv7jyrBEEHjqD5jrUmi1kCNR+cJG61o0k+rVmleMNIVn5HuIiKOiD9/b9bnkjoM7mPAaEzZam4yJiMzKj28JFRfFllIXZtgBo9aIZ/WFAm9rR9lDhLcDOHiYQ8a4qzpeF3jaFZ+/LZJKOHQaCWExmUpiZ8fCx8qr63gc0QzhiTkTSaAhAS+42CJSegcnkrHPyhFD0r1fsaN/objZMJo9uT62OO877Lmhn64LiPQpihfs0xavlbf99NAgVdunvu7oenvq3vLqeJuPBSPsm/nzUWL+iS/1/CKT6jsR1iupDfJw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: eeb8e6c4-e960-484d-5428-08dabebb54f6 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:21:42.1031 (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: tlI9Zd8+MnvF4JoTBkG86dpdm6uIMPP2tFSlWcOZ8Sv7hUsKjucQ3dpKIJwrhSBr2L3Xosj2F+gyxv/2be50aABC6gsPLzcRZAIRkDqkWNY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4756 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-ORIG-GUID: nOKJrNPBbpO_p40m74jgTHnSjR5Jz8Pv X-Proofpoint-GUID: nOKJrNPBbpO_p40m74jgTHnSjR5Jz8Pv Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org scsi_execute* is going to be removed. Convert to scsi_exec_req so we pass all args in a scsi_exec_args struct. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche --- drivers/scsi/sd_zbc.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index bd15624c6322..d87884a19a51 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c @@ -157,9 +157,15 @@ static int sd_zbc_do_report_zones(struct scsi_disk *sdkp, unsigned char *buf, if (partial) cmd[14] = ZBC_REPORT_ZONE_PARTIAL; - result = scsi_execute_req(sdp, cmd, DMA_FROM_DEVICE, - buf, buflen, &sshdr, - timeout, SD_MAX_RETRIES, NULL); + result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdp, + .cmd = cmd, + .data_dir = DMA_FROM_DEVICE, + .buf = buf, + .buf_len = buflen, + .sshdr = &sshdr, + .timeout = timeout, + .retries = SD_MAX_RETRIES })); if (result) { sd_printk(KERN_ERR, sdkp, "REPORT ZONES start lba %llu failed\n", lba); From patchwork Fri Nov 4 23:19:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 622001 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5FF3C4332F for ; Fri, 4 Nov 2022 23:22:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229477AbiKDXWD (ORCPT ); Fri, 4 Nov 2022 19:22:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbiKDXWA (ORCPT ); Fri, 4 Nov 2022 19:22:00 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2738517078 for ; Fri, 4 Nov 2022 16:21:59 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4KhrPs027184; Fri, 4 Nov 2022 23:21:49 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-2022-7-12; bh=a8P7VsBo6ia2NGN2xi+jJ4Yb+k/2sWqCIymwCu5ZnsY=; b=Oh1ghgwhXCjnFsiX1Ejo0r6t9jIUET4Ji2zFycoqMK068J1NrDhd7Lz8oUhH3BS4d9bv PZkwG4pMPWMZltZM2bH+NCgn5s6DnCoi82KZZZMg3MX4OXMSNQ8+UW+rW785eO0b2K9z YtKYbuXLIc94JH2ZO7Ns/cwfCKTBFr9SxzLwLBPFLWTcffgKkoFv5n+/TyRmW5JG8CNt acVZtEIA9Hp2F76uNnEHM5jBNYxu/IX2FUvVXHKRJp8cR9HAvIS2c0+Z0+FxcZeT5Q9O V1yYwuPMz9u2aLEqj27IwyIzlFqfJCmsYmU/E9FoneHk2DMSUWYSphzughIHOBUZXh4z 1Q== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgust16dw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:48 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4NBob4011908; Fri, 4 Nov 2022 23:21:47 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2044.outbound.protection.outlook.com [104.47.51.44]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpwn8csw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PxIyTXhE9iR8HxtmjXyuJB5aXkTlEo/8ZEaVCq/Z/FELAKr+AeBRuh9HvbBUaCd4E4OUtPmEO5Qw+ZTEoLRTAIt7YsnxLPbtZBg0hLSdNDoQJGUk9Qkg2O/ctL8G+q6N/weE8xQKGwLInp0E62xZYBLbGBMUOrs3f/rDOSG3aEokh6FKbz3D0PViRLYOEowRkRF8STJ0vUqnD0V5bpFQleAOqIHU2Vyty3K9HzScZX626ct8kUNN3P+HmJ1ufVOGST6N/uY64ggv1i1QwZdTTbLei4o6cxI0XGh8Q0shREBGcB3BM6FRhkHxeySf25oCZHxToSA9ltM8TdtEGbWUOA== 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=a8P7VsBo6ia2NGN2xi+jJ4Yb+k/2sWqCIymwCu5ZnsY=; b=f5Lp/lzpUJd41zzTJypS8ipyXDrRFlEu7cCgxgP8eazvbsaw2WaJbwk050jxjglTCR5pR8Du782hG/J2Z1DDTr7gfGwl33T15GcBdONzWweqJQh/YHBbq9EeNRwkWLr92JzdBANa17FF04zcU+lpgPRFLX6lfapGGJEA60q/UVB3aPJX9QBZ+kDu/dc38yapK8yy7dV8K1/yYNqtJN3YK5UWkWDEBfmfRf4V6iCSAUrMi90tcxVGEzRw1Kv+b2xn8OSoEaCV/GT9vE9BweEFYkDmwoVF98Gc82tl+u+7CN5c1lHzNo07R+VlcWso1nSb/YqHcLQVj4cUCzF7Pzm81A== 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=a8P7VsBo6ia2NGN2xi+jJ4Yb+k/2sWqCIymwCu5ZnsY=; b=bU8cdZutk8Onb1vyMYj2/XG/+3VvdqL+Et25tSPteG0vZ/R7HrGCk0GAxrTIgUNT237GzN0tFMVayJZ99oJvq2gQrZ2jaT+LMuFJl1RAqFm08V7gg8/clh35hdAcwk1LDNt3MrTd1MBqnLT0vtoQUqM6raaEDqDvdFwitS2suzs= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4756.namprd10.prod.outlook.com (2603:10b6:303:9b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 23:21:45 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:21:45 +0000 From: Mike Christie To: 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 v6 13/35] scsi: ses: Convert to scsi_exec_req Date: Fri, 4 Nov 2022 18:19:05 -0500 Message-Id: <20221104231927.9613-14-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR04CA0089.namprd04.prod.outlook.com (2603:10b6:610:74::34) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4756:EE_ X-MS-Office365-Filtering-Correlation-Id: b6aedcfb-bbce-4cd6-20cb-08dabebb55a9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +3W8TeCr6VydkxQ1CyMUUD/007n2VJa/NbUD+1NXxup5nymiPok5Ix/cZa42ydCTlQXlmfxUc35i6W4IN8zfzjSPFAUDEqybJYDGoOBqf2xnQWlsiUGzNVwpmwaLucehWL2MEDM+0DzfF3UdUQH4qUfsfDoUOB9w0iKYxBSNauWXM5SjNLW9C2gSHj3vwi/+RBfVgMvdZzaqRthsFeme+6RMyA26diD6a1DFyRb45C6WVTP/nGqdMM6kARCZpUx2uiuHUdi4jBWQIOF4+aR/sY57ScFXjeMrxR7PhYUptbcK3bUTCVLrUpsaQwzf+bsT8owaNcYz6m4CQqL60VLwRvu/YYSf6OZSlxaQK5tHg4VhzsAzWwdcXrZueFv7ndjtzOCJxucOOmWJGsGSWDeJDkGAyywjSUAaPZzkRcsz6R/Fw0/yEW+24JLRI83fScP/im1+5aO4QmiE5WdLFDlxtfi8VFMfbqT8loUEIvnajs/Dov7LS7yrZBlWNya2oljJARifxSs11G+vYq/Be9cl5mvijT+srwZFR5t5hX/TQqn0/r2JT4L9qK6CHFk22bLtteCS6Nc98+cUlSK7TrBBZeBtBv+yBHy7Xkp+bVn7AEhiFkMxCf7izxPtzFee54G020Hphfv9ipWUaGJaK9tj1EVi+8c0ha9botSMv3ONFmog0Jvc5dJ7Xo9jWjIRjKwL54+XjOOo5I0zpDSQIb8KDQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199015)(41300700001)(2906002)(186003)(1076003)(2616005)(6486002)(478600001)(107886003)(6506007)(316002)(4326008)(83380400001)(66946007)(38100700002)(8676002)(66556008)(26005)(36756003)(86362001)(5660300002)(8936002)(6512007)(66476007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: j7fWTz3VJXJ4/1hW+0kDRAN+Kw/cw/OgVPlKd97vCbreBHbTcddGiX/djoMJq7IecIVZBlEqkvmkPItrUcF3/CubS9oxb2x61R2/E6/Srs9xt4d6M50kPEhomgfjyizCUPjkBeBdh08fAtqx9WftmCrmT/6Vbon4hQczs5HFMTQIm2T1pLb6svQPEA/2MoZgpLD3JCc9gOV2/G7fp/hA64lkTX4xy8Wmdv70iGy5kFOXHvOototohfq9P6YHRl5pHihQO4Fwr+wx0guJGtVCqZYKN4zKFoCH0DqY2YadzsdYUptm3lHS/1jdLpAWXp4EJ8pNh0WBCy+ibS9CLtPxQ+K12H2bFN+VoAzkLIp4DEw/9YckcQifVqRGTaGCjIDRbZp4IGb831MmUdXImrv3kLjS5eLz7XR9vo8XYi2mSUgNooxOEwWjvsAiyPUVEyYRPPUc+beFtQIE+PCIjoHst4zi00F94ojBQSmrQLXuu5j0Fc6x/Qo/fk/6yBUe7pKqjf+7KrSTQPp9cl4WcGF9hzzuNY4sCT/fGxIrJnpZxxAJLtgxbv+6qnjuazoO/XL1wdwYuPeb5MiOEG8rTatAd2tvCvwrsQ/kAqc3XArbmGDC9nLeoymjYzHNSqF8QjNNOBJhCgFW3fZ98xScm+ntkoQeldpk30MwmKpJgaPkGC77PrcMYFyFBKJcRoPBNInCqSxFqxbvUfolfu3LJTnCNjxDkRryXVhXEpdusbgHwocjkkC2fGNLMr4Mpk44555/TOhHsIu1zXMiu3By+JN+XK4ttkt/T7qhr4++I9MORx6grpRvDIvDoRzVUKh/vWk9p5tYj9+piXn6iYbqz9u14Ls6iss4IO/zIqKmLUCZTFI+H0NJNA2FELefj3wZyxMSkuqTM9dMOx/2xr+ENQ2bEfEPD1ZSNAK5B/QN+suvzNfGuVvmhRfICUPZNnK69/WLW7RZJ3dRC+Pga/oKnDH01O6uqQ3Gv5Tt5cs2TF27HhDTVw9y8gHeIOqW9/OgASI1pxlhvuZqNpdeGmrDwB9f++xIypxz//7EWRF5jKJBBX4dB+4//jzpjyMh+9zjHWxVCNyElS3v6sWywacVRTLNwj4UGJ0tjlN9DdBFCkpurjQ//YL7fjUXnYG6o5ONWAuOiJP6nsvX8yhfxP5UlJ28h/oW9sJIbQ72ePbyKQmU9W4VOrsyrPCkJI+17DDOj2AIh2YRJlCNCODeNe1dRkBwstkiu9pY4bFQk5yPNcbYtyWCMCzTXWrp6HroohePW0ijcxklMxV3S8UcDMatJ0lNF04F6WRmmI19BeuVzcd47XGHu5mZVvHHD5je4EYY/kEHayXp59rGx37wE2Wfq8wh+PuK6AmxVhl05QuYHB/jaJocc7hfrO/Q6jOPjtuf2sDz2dgDcrJyvwseHkgRukPPTcS8FxjT2n6/bmyhC5kTmoJjTOCZIvRu0IxQIswcf5pp4MD7SdTC5h96RP2gL7X60H8g2cMr4AaD5sHcFpkP7XZmjTJjkwrhkH7YTe4TDNl3iY1QxmFaOMz3T9hjGzxcvZ/ADnI4w8IhAkRdsYQwubzxKAKTgULn9/HZ/OrMNZj1N2wvTNDsxIPwZ0AgcEICyQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b6aedcfb-bbce-4cd6-20cb-08dabebb55a9 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:21:43.2905 (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: qqgDa7WOZkSZoxVPI5ORWhHKvPqeWrNphCQQ4jypyLh0CEXoEIfHmzB12VxfpQyMu3Iksno+c8c6afGjbskZAzD6wsx1u+l3YG4qci/iRrk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4756 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-ORIG-GUID: yXuzGOWdxrO5Bf6gEBB8uB54ZRGNUF8X X-Proofpoint-GUID: yXuzGOWdxrO5Bf6gEBB8uB54ZRGNUF8X Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org scsi_execute* is going to be removed. Convert to scsi_exec_req so we pass all args in a scsi_exec_args struct. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche --- drivers/scsi/ses.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index 0a1734f34587..c90722aa552c 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -91,8 +91,15 @@ static int ses_recv_diag(struct scsi_device *sdev, int page_code, struct scsi_sense_hdr sshdr; do { - ret = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen, - &sshdr, SES_TIMEOUT, 1, NULL); + ret = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cmd, + .data_dir = DMA_FROM_DEVICE, + .buf = buf, + .buf_len = bufflen, + .sshdr = &sshdr, + .timeout = SES_TIMEOUT, + .retries = 1 })); } while (ret > 0 && --retries && scsi_sense_valid(&sshdr) && (sshdr.sense_key == NOT_READY || (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29))); @@ -132,8 +139,15 @@ static int ses_send_diag(struct scsi_device *sdev, int page_code, unsigned int retries = SES_RETRIES; do { - result = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, buf, bufflen, - &sshdr, SES_TIMEOUT, 1, NULL); + result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cmd, + .data_dir = DMA_TO_DEVICE, + .buf = buf, + .buf_len = bufflen, + .sshdr = &sshdr, + .timeout = SES_TIMEOUT, + .retries = 1 })); } while (result > 0 && --retries && scsi_sense_valid(&sshdr) && (sshdr.sense_key == NOT_READY || (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29))); From patchwork Fri Nov 4 23:19:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621670 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD65DC433FE for ; Fri, 4 Nov 2022 23:24:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229742AbiKDXYL (ORCPT ); Fri, 4 Nov 2022 19:24:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229670AbiKDXYC (ORCPT ); Fri, 4 Nov 2022 19:24:02 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55FEA6267 for ; Fri, 4 Nov 2022 16:23:59 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Kj7dT014044; Fri, 4 Nov 2022 23:21:51 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-2022-7-12; bh=osYKhSqc/sok6A/EqLBKLvCkwqI58nQvBOEjYLABYs4=; b=Yb5frqM4FEYtQp1ANve/HHWeXssEyvhp12zvdwQ4ZjvMTV7tyGaBn8zhLjEho1NjJz4a vgo/OBxeA1R+vKmRfoTlpfkAL1ckxgiAWhf2WuGr6L8CEt3TupUgyD49G+SvzqocPPPE tGRub9kQ2cfDlmBaSCnr1J7D26iN8jjwRqoPfWDuUk10WzuARgBIKi8GbmGqyw3Y2HV3 11k8E+fwMxd9IC5ph03gkk3c6eZriUvlXmVR88Zyz0GrxESMADkn74KHFmK98LBOe/E1 Nzwki77pczuGLbfkdc6TvqOP9waolBxzbv25cd6fJdkPBf0sx5EEKeLSVYqHHaYQgV8D Ow== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgts1hgy5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:51 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4M1EUU011983; Fri, 4 Nov 2022 23:21:50 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2041.outbound.protection.outlook.com [104.47.51.41]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpwn8ctq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S9Pu4bUdFjqQIkABU9GJvuhbdY/p+dMXkka1qEHlFKihjVSqyCXQMFEzgQ6tDFjw/3Uv5kdHka6qw+4NtCQrfNjc5DZBDXgvpik9mjDNi0GpUY2SmlqOsgVnlna4hI4pYs59UzUvpS0mCX6lVxFDx2crW34dkD72g53TBojJXNz+MZehR33PGdkGI7OQqFIOxaZHr8dZ7v/92WD1EiOsxx+S3HlzEj6/Mhwue4R6Xs3bVcZg1aWXRQqhyFo++muHjZUwNXaRgaevg5AADPSelXXXBrtVa3OJanEkmqao0cQRlHCLALG1CoPDV2KAxXyB76fAniAb22udRkeAmw7nXA== 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=osYKhSqc/sok6A/EqLBKLvCkwqI58nQvBOEjYLABYs4=; b=IUkOk7hUEQ2IJcInAcaxeQ5A53qF+sJELCNQkb7Pl+xgUO74CMpOjkNvMpWRPL+UvXmzMU+g36oV2SRfPKnzcoDdvbP/9dirw0nONwb93SpRFzROMYOx6MlSz4zaMRyrTkcr3odGHmY9SP23IZh9e4NsMbaSB9xJwD7n2RiTMsPvQH1IFDUtXTR6No/Nuaa9KKsHnUFYu+cq8WHVRLtsVB2ptw7CPaQ8DuHtpg6HscQp8+CUSfSR0PdP02Zo3YxneHLFXXHCzWIOVCmdFklX7LnlRE3UrnIMvz7UYYw2nTSrnQBxPY952U/oLw1UP49xrnpyEq2HLBVovlx7HOpHxA== 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=osYKhSqc/sok6A/EqLBKLvCkwqI58nQvBOEjYLABYs4=; b=CoEHEKG/jrbChjUXj1U79FnUY+4KeW7FrlB144J1CtArUWnU7BDFg+7R54YD1eM/jSWcwDuyJXAJYuzZYH7t8QY3tMec2a3TTsFPVNQuUzGx2Gp/JyB6xK6zZDEjy7STrLBAeXCtVNfG7Q5t6v18sgT+4gzCGnmUagldt71V4pc= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4756.namprd10.prod.outlook.com (2603:10b6:303:9b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 23:21:48 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:21:48 +0000 From: Mike Christie To: 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 v6 14/35] scsi: sr: Convert to scsi_exec_req Date: Fri, 4 Nov 2022 18:19:06 -0500 Message-Id: <20221104231927.9613-15-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR04CA0078.namprd04.prod.outlook.com (2603:10b6:610:74::23) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4756:EE_ X-MS-Office365-Filtering-Correlation-Id: b5c92633-1384-4816-fdc5-08dabebb568d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0qUn6m0fLsj/maBhlRO5wcrYEjYaHtjalO0e7rSV6SF/zhv7DAX9D3mvbdTlQfiOzNQa+eHNvaaphJt3DByTl8zHB8dZCZmT7VuxguPi6uSQiiw6fYyEyHbQLNdY/zOEFM13C2S3nT95jxogFGyDKbrxGax3iaTamXS0Z2sXy+7lbemVKi7RWGnexj8ntowtHyorotwtKMBUwoWD0LYSffYDBlDQJPmzfP7X1LOSSJSr8cL6HF1hyfa37ALUTeuOq9hIDT4S7lKWwTus6KWFCxnfhs49UwanmKFp1fy+w+EHUNlbwmrlbJuXKSbj5P7KCJPKffH9QjsSeory/a9tmyFDoZyVBCOzzX4xFeZBZit+pMi6nMDTd0/Logr3BUYMsZfDiIr/oHFvoqG0bMjwwUptFmGlDmCTEA76CaR0lLtRKm+UYcqm85g/dlT12hU1MQMK4biHWqtENSQIS0io/2QM7d9fgiEuWnydd150V9c5FCYikW79R8HKFfcUfcW073PNP3h7MOdMbXAjxtuy5Zn9Tomc5kuTJzzXkBeMSQG4LQTcnodR9XPXl2kSbhURhlpI1f3DB2OBA3ZYiqdtFyHkJsVoi8sN2HBp87WdTfpRmmIvlkWr4zEFdYRUZtI/wAssgZvQBIaO7OgdfXH8BOLbzALwmjcMkrcA7+i0BudeQNDj3YnDCoOZ7aL3scSmmlqVGFEK1GxF0VV5PHHmvg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199015)(41300700001)(2906002)(186003)(1076003)(2616005)(6486002)(478600001)(107886003)(6506007)(316002)(4326008)(83380400001)(66946007)(38100700002)(8676002)(66556008)(26005)(36756003)(86362001)(5660300002)(8936002)(6512007)(66476007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5f5+fEb8Wk058Bwx9TGEMvuwSGVS1YvVxUpZVu2V81XRcWftY8mzPA0IbRZb8CfUNfAPpTTUDR8I2GkRdyidmbReyKoVbB0LBoa7ZGkNMd5RKdvgLQ24S9IvkngeSrbguBLjeaUKLchKORExBhpK3p9qgp3VuhRKIlN6nW9ZxpAn9fAD3wCTghGA3Kdp+a/aGLQ7rOQMf5mpmnQtrYFxc3PxXh38aUGQ5hn07Jggbm+RIfQsG5UWkvjdBVDIuqCngEZUjHgABrBRmOOoVdzK7SJg7Fu4UTWHlnLbQu0e4W0fdS6Kh9al0BvJyVpGNgQL3mJn4VYGLE83mw2loQBu1hlS7Zo9rklm2xF+p1tiyagB5pmViaVdV2D3XkL+iZbjdOfhijS/luFLl9nyse/ZTdVOpGWjCzXTvwto8sqMNHmgE1Tj0RKvmxmI458FoLpYpslzbLEGJFgbeVVVo6XqLkRZO64FWLt8nGraC9dA+VSfhUHugS8MU6falEAPrrKvLGlN2zcbAYg/g9J7Swgoz6oQtG2VPFYO6wQUjtEn3ZXAOGmCyknP/0eg8ISmCFxGIJGpoWXE0z3pO7Dyak8doee1ZWAoA46M1JgoxOBZQTmwTx6U3i+JcDj+4i+5nWl7ITss4+fZyIg7A2uS8m7IQkOW2co5IJFSzPFaGW2Qx5MBmDqUXofRqi2WO3SEZQufJYh9XGFy5Zr/Ydxne5T8BWLgs38MpgtKMoziqKZF6HVx1ipGnxus4BuFlM6W9GLIw74Cb/0tZm2S3k8QXMbm28iaV0LWnfEYr1cbktdn03RK8bI4K/TuaQm52BL3SHN7YDpo5B98rGJb/Q3yGBHqFfCfo1nSuDwGh/GvGvvcOoh4U+ThRnrdcNu7MC4Lgy30CT3gTv0iQfyXJz1j82qDddPHa5JW85pkc6K/yiGUgUo+9d5ykhcEcrYw6tfVP1qQ+Nvc+32NYMHKrQ+LJgPMsWVP/OkEmyvOHlJ5AE67Zpwt0hp7Om0g+DMMLv5TU+47R/alR9vqKuY1eVHnveLpO45vQZl3BSl6VzFjhhvSepQzJF0cyis0d1vcS/t6DVKrMIz4vGeeRs9O64xApPF22YQL8tC1/f9jYxwEiojACbDqsOLG/Jj8hJxBxbjxRk7BWyq9lpf3iOdJPQy13qlLVGMCuxuGfreUgknifCOEJTlNF1xnQ3BD56sXFPHt1rwD+DXVqfmmyIDzADHZWLnSgNeURldgHrskIe0RxgOr39ebGD6aDVLyflxJvnTTC/+kvx5Bel8r3fvaWQ+BHS3qD++tf4IK9xaveARG1eQDTkubxO3qGywMcxsEh2uIEfUucOoz79HInEhCyWYnpP7S9NZty/n3sL30xGd6Ff7W4/pe0tKwzUHpT50ZAZ71VKdf3TYushO4GCx/hAwxWzv6ap6xEV7OBEaGf5Ai3vRU+UZ+dKIXl18p/EolOjbwdd18vMGTlXf05EfyH96TLdWjtuZ//L0s4vn75kycETPfBlsJVSW7pdh0bCfJeFwjSvvjAz2HbuNTyVsFghcWdZkQHG+x3GCHNmg8HmJ0R+tM/t1nyVxDq8ZUMoNuEVt5h6mguE8TGex7X3SHfXtFB7xeQA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5c92633-1384-4816-fdc5-08dabebb568d X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:21:44.7748 (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: IHw8WOOFD9W64pRQ3Ok8acs1IX4J+3ARlj/jkKGtMPAjiGNDpd6IGavhu9wDN7tL/QNutmLdUV/ieFfeq0ET4c4zULdj4NTFpD8eH0qk7wc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4756 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-GUID: wAz_arrwn4Mgpbjpl4SX2_BefaGT5PGX X-Proofpoint-ORIG-GUID: wAz_arrwn4Mgpbjpl4SX2_BefaGT5PGX Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org scsi_execute* is going to be removed. Convert to scsi_exec_req so we pass all args in a scsi_exec_args struct. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche --- drivers/scsi/sr.c | 22 +++++++++++++++++----- drivers/scsi/sr_ioctl.c | 13 +++++++++---- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index a278b739d0c5..e3171f040fe1 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -172,8 +172,15 @@ static unsigned int sr_get_events(struct scsi_device *sdev) struct scsi_sense_hdr sshdr; int result; - result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, sizeof(buf), - &sshdr, SR_TIMEOUT, MAX_RETRIES, NULL); + result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cmd, + .data_dir = DMA_FROM_DEVICE, + .buf = buf, + .buf_len = sizeof(buf), + .sshdr = &sshdr, + .timeout = SR_TIMEOUT, + .retries = MAX_RETRIES })); if (scsi_sense_valid(&sshdr) && sshdr.sense_key == UNIT_ATTENTION) return DISK_EVENT_MEDIA_CHANGE; @@ -730,9 +737,14 @@ static void get_sectorsize(struct scsi_cd *cd) memset(buffer, 0, sizeof(buffer)); /* Do the command and wait.. */ - the_result = scsi_execute_req(cd->device, cmd, DMA_FROM_DEVICE, - buffer, sizeof(buffer), NULL, - SR_TIMEOUT, MAX_RETRIES, NULL); + the_result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = cd->device, + .cmd = cmd, + .data_dir = DMA_FROM_DEVICE, + .buf = buffer, + .buf_len = sizeof(buffer), + .timeout = SR_TIMEOUT, + .retries = MAX_RETRIES })); retries--; diff --git a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c index fbdb5124d7f7..3d852117d16b 100644 --- a/drivers/scsi/sr_ioctl.c +++ b/drivers/scsi/sr_ioctl.c @@ -202,10 +202,15 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc) goto out; } - result = scsi_execute(SDev, cgc->cmd, cgc->data_direction, - cgc->buffer, cgc->buflen, NULL, sshdr, - cgc->timeout, IOCTL_RETRIES, 0, 0, NULL); - + result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = SDev, + .cmd = cgc->cmd, + .data_dir = cgc->data_direction, + .buf = cgc->buffer, + .buf_len = cgc->buflen, + .sshdr = sshdr, + .timeout = cgc->timeout, + .retries = IOCTL_RETRIES })); /* Minimal error checking. Ignore cases we know about, and report the rest. */ if (result < 0) { err = result; From patchwork Fri Nov 4 23:19:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621994 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57D9AC433FE for ; Fri, 4 Nov 2022 23:24:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229821AbiKDXYb (ORCPT ); Fri, 4 Nov 2022 19:24:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229587AbiKDXYE (ORCPT ); Fri, 4 Nov 2022 19:24:04 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52A5260E7 for ; Fri, 4 Nov 2022 16:24:03 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Kj7Ga013358; Fri, 4 Nov 2022 23:21:54 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-2022-7-12; bh=SkkKotKylVfX7iw4b3lN4De9tC+CB1VWZ9B7wGdSk1M=; b=Ljj67fnmUj3syXf+RIVVZxeDyzJLgNbSxetyJ8xVxIXP5Ls9PaUCwVJJ5yWGr55yfs5/ DmP11s74ZYY+ZxkK8c99tqAo+Lp/xV+QS6ArCpWtU3iX2UYGwfX0fjVJ6qjIEmrTdKXt 7AgetGqKzvtm8jD9q4Kt9wNqJc/dINqCte+g5hZhl1FVc0jNsm2YdUA8xmDXbk3stGev p7+phoYxYU7twnxE6XtOxB77kQVN3HBa7R9ZHhv7BkrdDGDNHlEBphlTWX29jgfHtyFq AH677bTGPAfIKVYfF6az2BX9e4Ym48CVQt6gmOBhREHBwzP0JTnx3E6v05z71AwVrHHw /Q== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgv2as1kf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:54 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4JeSjT023043; Fri, 4 Nov 2022 23:21:53 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2046.outbound.protection.outlook.com [104.47.51.46]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpwp09p3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MXzdBLAZ4CjlQ7YwLUmkqR0Rb+qGrEmzqb/SnDrg6Cm072IKfWw0JQC/z7L/ZYDzC3Mn/xad4n78ZvW2g1hi3YphGYDwqQOape8I9warI2MZ7IfOlQOXpZJtzZ3O8CBGSZ7lTxsyICIE+AEoLlGtnE68QGdLfIuEBVQ6Y9QF9DIQ2upzIlxKOu7KBfin2UsMf8KeqFc8wBgJctJKkprIAv3saOE6LsNJFwR02skpqc157Q68ckhRIJRMkY8U45rxyTvKWP2ZRzBJHojdqqGe5i4f9rfOqByyCHmSMHXaxefo7G+JyMPS0GH7SvfHIlNHOh6HzfNCkjWdBMQ/u73/tQ== 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=SkkKotKylVfX7iw4b3lN4De9tC+CB1VWZ9B7wGdSk1M=; b=FV08d8VGXShdXEJqkzIrILFZr8vQjKf4ld9iDDZVcYPeCbtmeWITt8APUEPqlBAKzq565R9XvGz72UtDwZjOqXnDiv27aUJ6UXmu0QEovWaEwnzEf1s/HYtZiWDEi12j83FsHDCwvU2eSFgmipd9g6JB6Fpe3qMZe7aQYfqQqifMJ4mEDRK48+WoYnCytqzGKmWLalQ950wdmvoCk5wCSzwRb8Oq31Uv9TjhqnZdRX1wEEoV6B4ZyggKBZo/cp8qr1HVqKumHW8d95Oy4np9h2YKUGh7BJ8l4SOh32af46Yn08gXDWWy+rCrMRQ/CcXGd/eqas2q4W1mAnCzhF+EzQ== 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=SkkKotKylVfX7iw4b3lN4De9tC+CB1VWZ9B7wGdSk1M=; b=orQ3fNvODz42G2YfWc/HsNw6SIbLq1TnAR9RL1YDh36O2D+VYuTb1vQRbBd1gAaYEqFqNkV5eylH2oHXpD8fD1OyEcAUT3zlFlY3Z7aO2fb7zPqfsWY2N2wmBY2x/lhZKR5XNR8xZCRmWPA11x0HKI8suE/FfHAo/nBNW6yww3M= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4756.namprd10.prod.outlook.com (2603:10b6:303:9b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 23:21:51 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:21:51 +0000 From: Mike Christie To: 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 v6 15/35] scsi: virtio_scsi: Convert to scsi_exec_req Date: Fri, 4 Nov 2022 18:19:07 -0500 Message-Id: <20221104231927.9613-16-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR04CA0066.namprd04.prod.outlook.com (2603:10b6:610:74::11) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4756:EE_ X-MS-Office365-Filtering-Correlation-Id: fa178958-4c3b-4c60-dabd-08dabebb5772 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9YsY+9xOlBRDjoV6+PuXsxoj3IcDCmlfB5qIGp+w44s3DdHJQDySqzA8nkEZx1GqdHzfnlLPLS1Y/0cDEczPBetp90JrDuTlOFPQDEApAj3bRX7cz8quCk1Xz4hRinrYTzEH2ff6fK32RIt4oetaMRgu7SKftS8vW73h/tcwIyh6+dnB27hWL2UindCIkz3AXrQt+P5bcEPuS1KTs8zwLFkkfhRXIfjo5cpVgJ1qR7+dWZxjtbqlMbEX2v/rwM+S/MC8ENCYrOagsHYVNLnoqD3SaK6oNIcHuQ6GBgXlaPbXUijcTee9d3KZT8Qxs/83A5SrTfYeiQuA2je/Hy99TD1W4J0eHdw7Nk3TDQlOmP0elv/hqJeVIlm3mwiZpcGlwG3YoQ+7eLYRuXp1e8lz7YjAMOBfsfQ5cvSoT1ZyujALv1jzYgeQ/wM3tfpx9/wY8wbuVUsu75bdvlh1cIKhw85WjOD/QF6/GOkRa8cCnok7Yvqy4OBhqtJFLDHpLW3G13+TId0SgETOUPKLd56tqe9s49nPX4QiY31UrTWR1D/2lly/1Ff4eT1tIXy/6qzuxDwaP4ekHboKf9NhDjdXHGE+fpZeLm6EjYje5I5uMEmnVuNKTAXeFxfh6vz2qn60y7rDSfrYm65d0W0oH4IpllCWOHubwBisOpDrSQXr3S9aqWgyiAQxtlYWNVtMuwoBNuViQYvqBJ4ba517PI8viQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199015)(41300700001)(2906002)(186003)(1076003)(2616005)(6486002)(478600001)(107886003)(6506007)(316002)(4326008)(83380400001)(66946007)(38100700002)(8676002)(66556008)(26005)(36756003)(86362001)(5660300002)(8936002)(6512007)(66476007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sKpVnLAV6/F9K1YPcuuTkTZelvMX8gCD2sIl7Pthl7aUmyutwBIDEMs2lZE7Y0RaUv1r3eZhZqbNPoI6LPELZvRAzS0poxTREe/02BQmwbyWjOmja4ilHvdV4tdRP7F0NUVUoHVdpJT4yVaCo9DaVw8wF4EYYYIDjPYBc3kYGRFI3na0DkRblE5aICfi5FjdWtC1G2DTC6fd9p+W7MKA+oEJxHxSMUQNtF8VO3cYOb8TWP6/e/HK/ZtEyY/nVg7x3tIU5LBU/sN/V4xgpDm6wL9J8uNvFBOjHCHQRTXX5e5bqLZYsw8WLALxd7M8ub2Yy33DbmGDDMrSXsJL8rQ7y0pJ4hy7AyRCYrkc+Qb1Aql1EitbG6l1Av6hJe4JjF4/RU+iSXMtA9X6NobZO7hx5pPcWRYvDLnpXJ2oelOVTZxe1d8X3M2hYMKGlTwIp0BGAdoGzgXw/5YVPR0oHtbglJApD2GU+hJvCB+7ZPnWfpdYHLoZMarNPKxyLNLb8IybVgPZLjD2FPcSfZNXtgOCXEmMRTWFie93wxOzygRJmw/jmeHWbHNiUY0oC6XaTmIJcc75uq0lS5zwAam+D3DjKx/W8VfXgMqGyEj5RXtft8HXEmNx5s4x8ege+FTs3aWkWIg9qdCg2cYtgaaXQFCGWHhfjph14lc+M7A4QyIOIHLXcNi151/w/f8qaJTPu4Zw8F8wl3XzvnrBRGUCxAKcOFohj3cmrTSuAEl8ckNyGAPYKYr3YJmgdB1Vq6ZjhIp7hJKsPwH2ekOmtR+qza0zNu/a9IFSNG7UlwTZ42JPvzUN7kNbCDbo02stdkvDfx3ha4HYcUNsLh1kqeZiO6fvFnZnHOvoiwPjRE0vFA+wQDQVrhv98pvV/RV6XsYAs30JGRL6JrKxnBc+c9MPH76ALYucyQL3TpPcnI9dkOIdOQoa9rFlSggTfAlJ8A3A685NK4qn6bMHdbhtpRns09nJXJLDLPgv3ZMK9dPz1sli0IzvRXjnqguCOuientoF8gPO2lGDYFS49ZsXih/mQtfox1dQoj/FCL5YwUi1fQueIpU/uMq+qQK0659deNfD/c2CBLAPE3cZfRxcGHTr3iKLofGYtU23GanvIDdSnvj+2blJihXHARq5aZVOboaeMVQ2LTYVkHzlWbHERIMuL/hcylYxY75BJIJJnPaurz8udcNik+4sqMk421d7TLxgm3V3yh60wCAoUmnFfJcvVW2AasGB/BmkfJOuQI0GvblJrj/yOAnBPMOC3OOaDxWuEjfQxCpI6ZCa3sPdDF1HLSSlXtHTbU0PEG9tICqQFTLr9iF2nxu9KnD8ebpP1R9PEtN6CeCGL3PEkXIj+BtybfodgoW2cYO0lzckGbB1ybvITG51R/Gf7TgS9F7J5XNNchQ6vW0CvGqbTB1YG33r306kIwjU/vCDmFsPoXOtWYhA5oUbO4EWorDKs8B11PnRt5XLFUnFgcoSDNrU/Bzu2AwskDQcnOf5SqfAI5G7ni3uEiO74+0bTsFx1q2E7bP39f8NUtj86RlfdTEXyC6g4ipXZ91OULjXcH5mg7SL00pVsNUIUTEI1h+rYrY2f2TRUKMdxcc/9Dge68Fv8t1z/8iKVQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fa178958-4c3b-4c60-dabd-08dabebb5772 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:21:46.3684 (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: onixktq7VEuhP3ZTS4rTDCPDdRAFn6C9qqzwnM8TIaIMQh11rmTuS26clpHtjKBd+EFgxpX8fdxWzawp2oVVMEHIo0cQTBzChCd1X0jwvag= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4756 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-ORIG-GUID: xm-T0xHyJfhXXVQjVoV98IFNWZfBE8PC X-Proofpoint-GUID: xm-T0xHyJfhXXVQjVoV98IFNWZfBE8PC Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org scsi_execute* is going to be removed. Convert to scsi_exec_req so we pass all args in a scsi_exec_args struct. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche --- drivers/scsi/virtio_scsi.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index d07d24c06b54..e5d26b4eff8c 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c @@ -347,9 +347,14 @@ static void virtscsi_rescan_hotunplug(struct virtio_scsi *vscsi) memset(inq_result, 0, inq_result_len); - result = scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, - inq_result, inquiry_len, NULL, - SD_TIMEOUT, SD_MAX_RETRIES, NULL); + result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = scsi_cmd, + .data_dir = DMA_FROM_DEVICE, + .buf = inq_result, + .buf_len = inquiry_len, + .timeout = SD_TIMEOUT, + .retries = SD_MAX_RETRIES })); if (result == 0 && inq_result[0] >> 5) { /* PQ indicates the LUN is not attached */ From patchwork Fri Nov 4 23:19:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621669 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22ECDC4332F for ; Fri, 4 Nov 2022 23:24:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229477AbiKDXYc (ORCPT ); Fri, 4 Nov 2022 19:24:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229634AbiKDXYH (ORCPT ); Fri, 4 Nov 2022 19:24:07 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 045BA65A1 for ; Fri, 4 Nov 2022 16:24:07 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Kj6sC013842; Fri, 4 Nov 2022 23:21:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=vagzyVM1BxkbBzp1aoQugIpEA/mf0pDjxNFPXzUVrMg=; b=Z3x1f25sttUa1IICgTqx+3e+kqzNwad4Iee1SQi4wFM2XPimpMwzH5kyY4f/YBd7DhU0 3AbFc/mvin9jDnuNvNW6sgk45dXdO6YZ7WTybvsBqp3UipRQtMUzP0vu56CzCbsBdnsH qYvu7jzOzhA/PT6NiSjCYWft++rM3FZXg/3d9E6Jv9IsrLeMDhQrfTA1JSegp81E5LEu pSx5bjv/yYeWn22dA7ZDGRN+1TInSHfuwQbH6eWObfT7H0q6eh0LJP+ZctQaUn6aT5i5 XDLokfcer8JP3XS1oHyRv+NLghoKHVcg2WvxrisuFprQIW6y8N2kNIIzPmxJ3xqYlrUj jQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgts1hgy8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:57 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4JO6JV029449; Fri, 4 Nov 2022 23:21:55 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2045.outbound.protection.outlook.com [104.47.51.45]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpr9a92d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VWmn2+DKmNWmIYbEijwTi6Nr7uPjeLOMIEsicxKHhqt3D84etbbk5Z8ygyn/itVilBp98f0FmUHwwtRiefDAqss5JIkrp1wX9kBwqS0opYJ7UqjBWHpCDpJO/LKhEqfYOR1foaQxp29pYaDUtmmVTyCiIAjxvP6liJDeRXm+PMSAO9BG99o5oP60NXrStCdUsCvcOoAuDPqBHE7S87yV0KlreXkOxHdg7Pm6dzHCuERklNgR0zbkJhVE7s8yN0XKdFyFHo+FG0RHiQDyXnTsdy1mvhSRzjPBNaXkIiHUyOOcHNMntDrVdLetNhdWQ/kkAOMNwYWp8Dwz7oUGO+JQig== 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=vagzyVM1BxkbBzp1aoQugIpEA/mf0pDjxNFPXzUVrMg=; b=YW+fT12TDcquG7LniqHtqwhQ8cqiiQp/+fVsCwmJqPG6CWnw3q86WoCuNCAYPIIkr3oBSeMuGfjCA9ATC1rRPy5tMZ/qJDpCl0DTZiF6oVjVTPURprwN6qebnYZz5mKKkGwOlfwKwr+I7ihJrKgBNmf1iLvFbYIF4N5WhqUiJkGnEWK6IuMZkWZFBAm3j0Iw1kK96V5OLvNAPisBp6JNDNwRWidU3rgWheqXy+rAqkItjD/+rzNJHeSmT1DAI0zhxM8Bq3DFCWqwGvfanG/05FuikPK1ShvX7xtmFw/KymqN+zmqnzV+nnSQWuyF7jIinkZrhS7yoiSGL+2wK37pYg== 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=vagzyVM1BxkbBzp1aoQugIpEA/mf0pDjxNFPXzUVrMg=; b=cLfLYv+JsFVV2q9IRNBflmr76R/Q3f/G8w0c6lI4NOxCMZzZaju5tSxSXrxapQd6IwQtXHpdiKO4/Ce4xcyeAMru20Hao6omRdcrhJjEjfeCeSwBnTvfkC3FtK+ec6+yRt/lT5f9yxg6W9hMlt17fsv5Al14MJ5Wh/W+PVZfuzQ= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4756.namprd10.prod.outlook.com (2603:10b6:303:9b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 23:21:54 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:21:54 +0000 From: Mike Christie To: 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 v6 16/35] scsi: target_core_pscsi: Convert to scsi_exec_req Date: Fri, 4 Nov 2022 18:19:08 -0500 Message-Id: <20221104231927.9613-17-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR04CA0065.namprd04.prod.outlook.com (2603:10b6:610:74::10) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4756:EE_ X-MS-Office365-Filtering-Correlation-Id: 73a86a77-ccbb-4d8f-40ee-08dabebb5861 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JUElEJYTNW1kJJiDi9eIokjShitdYXR2ZIgAjUwATQCozFdraRbZQ3FwEjA2I3bTwTbqDaQ2CNBMb8GutLFa0cSvEO1xJKZj8PyeoBWJiQWh0jkPZSsSacayfh5sRvHgr77m6R2nphJRY6pCu4sqkfEQyZOw9NoDesnHa/YKvHTH9eWJJNzHtDZ/4H10wNmId67tDPDvQUx7Xi6+xgxUAVh1Ekn57ODo+eHvqrHi7yJEyqFFYIqhK1rFHPsjRRKBO7l6a87V6zN3GJpHRu1GaXsjC0yGdBCiQ0RXO84KtSHmcYhjms9RjRw0MXvi/Q7vHNuRK9yiEYTbpJwDxUxeODkHHtEsanL1Vbmu0undug0/MYJMTrtsATcXNGi7HLkeRmuf33y9Qf44YPN5zfyYbfVgYpmOQ84Xqg5ln/jxy511DUOJ81zwzJMGbO6TrlRYEawCquPEWBRAcK3epEFWpjLImKpYxOK6PoOiqurDHFRc9wxp7gzE9I4YnJPSo7IHI+z/NKw+IoAaNg4/aHPivtxPN7edPwlcMeC/OIlp/d0FWx3L5GW0pR6O9KJ+bLZdu2qhlSsulBUTbuIQmvaJUPZGJirA7UUXmSEoZ17DqWKm+5CPCqQoaPWzFz7PosMJteicOx2cHhZCOFaO2gzNKVS8E7/iSzuqMHtb+6EGfO1Xmo+kFmfB/2Bf3kJwJbYkVbRNwKi8abxoq8Ed41fbww== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199015)(41300700001)(2906002)(186003)(1076003)(2616005)(6486002)(478600001)(107886003)(6506007)(316002)(4326008)(83380400001)(66946007)(38100700002)(8676002)(66556008)(26005)(36756003)(86362001)(5660300002)(8936002)(6512007)(66476007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +tM7vUD7lV3yOEQoqJnEhLwqEOUssolvs8x/358tR96l96srk0LJ0TYQ1EYm56uAfAf/8a1qj6zsYBNlq66K5kWNeKHuglm5cVTy7sHOMkB8vpZqLVCltme8bw/pvvKS8pnuqmDQ6qRnFuXED4a1+Dn0JhSGj3Q5A7Iqok0MpbBqWmF0DoCtJIXq1suwCUQeQTcRDigOvPDhW18iYKjMxbsGbg3kFW502n/AZ1zmEAqPKgT7i4nWQ9cJltC8HFgXCPLmxJkDPIbfgXP/xGypUrJjAbOg43PFgasD/WfKnAPZVfM8kURXPG6UYSF5jid5M3oFIxzONzkC4705IICxz33rNIJZDiy8U74l0HjE8AqllmGSjbtA2nlghBW1Jh62w0cwVVMWGaqJIM2kXC/4ouKEzcQW58Ml+jl9RBF3kMDiuPwC+gvFWHVjIiwH4Cm7cqk6c8ZiqWF6I2iopMWk+2fE/ENtsN/2GrJaWzu1ckPA02ZMSQTwmhGcPo25NnlXhANAwSVxqKqqDuTt0yG2bQ9rpr5pcCDGvb/nFTMu3Izpi6gkA2js+cuZp7qKiMvTr0toKxW7ZlV2DNdLg9QcYIuTpkQS65ZRVZfmDR6RKANsLVDY9BndlZa7f/TOEhjv5vIh/p57Vdr77sBlhF0LAvl4bRnELPO1bKtph4sPXZwnHoKy8czxkK4rMRU0caCLpxsGUFM6RZc2vD1w8E6dy8tntdLj1GgWnKFBzOltHxAEz4JH2ITMv7bIehHtqNBBol6/DQD2juHSxV/2RlPwlUfDewWrl08zLi07DpOi5u9nBTWv6VDhFupC4VJHQuJkzV3GCIk5buaHHHPBxl0HFndH7pewyZiZI/Hb2hxDgUHW6T1x99LcRN+rrYIM4mALxiGubJiUfThDt1xbeoXT9F/JSDhkLOdULIQgcrfqhoqyGFx3imOEsbDDnuNxSyWCX5jjcON5yeY0x/D7OyHPVnOFCBRn8P4qQkeZ1C4cgvfBmKYD/ob8DXx8Cl8xtVvoJLkIJK6Ujur/uNZgVgV4RK7ZRQlbOmMy7iFgyQOCsLzy4G4dYhdQHLOAPgfxHQQDGURczP9qwCM5acSbgpX1Csr7bE4hm+fvU6i1B3AV/xxG7ppJ55oTzXfAATDKbtNGCqoSGVKZio+iyjP7+/pZ06NMHHCXzs4HDalXLzxgsLaps40TKRJ5Mp78FrpknyrmN6WqApn6Vc/LIZIKx17iyZo1R0MEgXvcg+rAhw49KHlcXXDo3xY5HC6AzXJViEC005/RIWAt80h81rKQpGJnVcslxbzdjR3ejbTnsbIzk/LQf70WFhTh7u5+lDzyOuRRDBvZO8LjOrqPfKLRQnmou+4tIvUoKNk49GK/uz/+LcWLfjUW3UgFYp1ODF5/0ZdP6n/bptvW+z7vGxP1+sPRZ+RwAlEWKqiir0RvPmJ6URBA7KHymBbPnqK/OknClrH5w2TauOsiHZGJChNAFVb5A/9h7LCfWoQnVOUE+6BDk9nDZ6Cg2fppJteXFm1s8Fn3q0T4cuCa2vxBVJEoTEQW/Aa2kqxnvI4gfdExjuI2x7QxRbSyC2Z2woVmYZof1NbhQ+21IWVQnrqKxx8++VeXPA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 73a86a77-ccbb-4d8f-40ee-08dabebb5861 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:21:47.8370 (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: nvUO+a9qWd7gcjNeMcRa0ykwqgXcqgJuGtSQGVUER5lnPxx3vPi2eEVPBoXNhpnrI9xgV9PBUmK4U96aBMxPR3/iGnIRRbkZ/PjQymVUme8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4756 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 suspectscore=0 adultscore=0 phishscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-GUID: jiwnZ7l78RoAbESbcnrYDBThimDHjqby X-Proofpoint-ORIG-GUID: jiwnZ7l78RoAbESbcnrYDBThimDHjqby Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org scsi_execute* is going to be removed. Convert to scsi_exec_req so we pass all args in a scsi_exec_args struct. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche --- drivers/target/target_core_pscsi.c | 31 +++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 69a4c9581e80..f2f4ff0b53e1 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c @@ -144,8 +144,14 @@ static void pscsi_tape_read_blocksize(struct se_device *dev, cdb[0] = MODE_SENSE; cdb[4] = 0x0c; /* 12 bytes */ - ret = scsi_execute_req(sdev, cdb, DMA_FROM_DEVICE, buf, 12, NULL, - HZ, 1, NULL); + ret = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cdb, + .data_dir = DMA_FROM_DEVICE, + .buf = buf, + .buf_len = 12, + .timeout = HZ, + .retries = 1 })); if (ret) goto out_free; @@ -195,8 +201,14 @@ pscsi_get_inquiry_vpd_serial(struct scsi_device *sdev, struct t10_wwn *wwn) cdb[2] = 0x80; /* Unit Serial Number */ put_unaligned_be16(INQUIRY_VPD_SERIAL_LEN, &cdb[3]); - ret = scsi_execute_req(sdev, cdb, DMA_FROM_DEVICE, buf, - INQUIRY_VPD_SERIAL_LEN, NULL, HZ, 1, NULL); + ret = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cdb, + .data_dir = DMA_FROM_DEVICE, + .buf = buf, + .buf_len = INQUIRY_VPD_SERIAL_LEN, + .timeout = HZ, + .retries = 1 })); if (ret) goto out_free; @@ -230,9 +242,14 @@ pscsi_get_inquiry_vpd_device_ident(struct scsi_device *sdev, cdb[2] = 0x83; /* Device Identifier */ put_unaligned_be16(INQUIRY_VPD_DEVICE_IDENTIFIER_LEN, &cdb[3]); - ret = scsi_execute_req(sdev, cdb, DMA_FROM_DEVICE, buf, - INQUIRY_VPD_DEVICE_IDENTIFIER_LEN, - NULL, HZ, 1, NULL); + ret = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cdb, + .data_dir = DMA_FROM_DEVICE, + .buf = buf, + .buf_len = INQUIRY_VPD_DEVICE_IDENTIFIER_LEN, + .timeout = HZ, + .retries = 1 })); if (ret) goto out; From patchwork Fri Nov 4 23:19:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621993 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7D7AC433FE for ; Fri, 4 Nov 2022 23:24:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229830AbiKDXYe (ORCPT ); Fri, 4 Nov 2022 19:24:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229642AbiKDXYI (ORCPT ); Fri, 4 Nov 2022 19:24:08 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 507EBB7E8 for ; Fri, 4 Nov 2022 16:24:07 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Kj7C6013354; Fri, 4 Nov 2022 23:22:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=GbK6EOCeB16Hxeh5BeQ0zE668MA1KGgbX1F5LCZEsSM=; b=Pxg6F86JKt1+UnXmaAU7UDDRu+v8sQI8iwlAtk3fA+OFg0y9WReQCmpH+xUljIm65nG7 wij+TO0H4tlWGJF6Av8fc7Z+UW5IL+MD4RjkWljdIO/hy9fYwgr+F+S8IOX6cYqeHKpQ q6ZgFfk+KmuW13XZa9MdsBKQg/E7lAwtYJAgO/4qGsmZ+4Sawol9hr7SZ2ZYh1waWsj+ WSO5zSPeEBb2UyKyyOVEgnibQKFI/2ZKUhcFxpRY8wmsjjgVVpF2zDjXSNVeilVSJ8y/ 5cxZcBB8yaeA8UkKeM9d4z8mHXNh7wBJub5wE8mmB2QU2jwSmzU5U5ynADybheD15Dj5 Dg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgv2as1kj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:59 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4NC4P2023061; Fri, 4 Nov 2022 23:21:59 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2168.outbound.protection.outlook.com [104.47.55.168]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpwp09qt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:21:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b+FBF9xXnGuwto+McrlQp5MVo90FB1MMvYfazIS+kBRvzJNiaaTgNcIK5lUd+2OhcKkAZs/6i7UH1Q4Wkl0bsRA98+/8knfFLkLgfkraLXR8q3bSR7eLrStl3XSl36Ksy40QOUiZpktqb5MzIHLuPQ2FRaTr+VpVWfrYv3t0w2/vXDqL6HBVrJRiyQF8YUud/9BZr0RE5eUxmqesA/vh4rWNWLR3FDcsurPar+hPS1UjN9udmFBiX1Ipszw42PClPXHvbr9hS0jurLygSXY6Z4aN7gbvRSli49eK1jZ7xvn5d7JV1iUM7Sr4wVzzHNeVGtZT/3vhx7mDJ/5T8BBFxA== 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=GbK6EOCeB16Hxeh5BeQ0zE668MA1KGgbX1F5LCZEsSM=; b=Xo4k7pqX57X3dfQ4sP28u+h9+kQbDf6JlFWB7KV+1/9rf4FQc8la/a0LK5fVXkQWpmQcSNDmtl+mXKEBNf8kFw3Qq31Ff+VcfDPLlpyvHYJQzfVMpkL7lha8sh3/p6sRbuQewGXlXZY7WA0NTqTJjZnGnL3PYLyvst3DTjNT+EyDfEYkxba1EtzCroQcAg3vbo8vgvfNTnZ6p9ro/KZOAwGarTDQ5PbUx9dXRqkiANA5UUCPEkkqp7+2Aqz/bWKrwi3QN1eLQAQiPG7Nob9VD2h+eE9VPPzDMmMSsEXKb+nJIHGsEBachpz2vM6k6PzCIyOw8QksLZhX1UVSWe36LQ== 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=GbK6EOCeB16Hxeh5BeQ0zE668MA1KGgbX1F5LCZEsSM=; b=Bz9QV0M823X3wpI0s88TsGxuTuLmEcaOJsUggKtRAAhiuihIqxwryDb2OWLnnjAYWFQrRG5KMVa9iZy4oilaEs1deMtjFIfOQQwAjCeBjVvTRu3L6Mbtb1UwmDv9gD+5x4TBVWillwvAGHEo8+WJJ/XaMYNtz21UkWXB9tvxSJ0= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4756.namprd10.prod.outlook.com (2603:10b6:303:9b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 23:21:56 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:21:56 +0000 From: Mike Christie To: 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 v6 17/35] scsi: cxlflash: Convert to scsi_exec_req Date: Fri, 4 Nov 2022 18:19:09 -0500 Message-Id: <20221104231927.9613-18-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR04CA0066.namprd04.prod.outlook.com (2603:10b6:610:74::11) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4756:EE_ X-MS-Office365-Filtering-Correlation-Id: d79d4682-b337-4d3c-f909-08dabebb591f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sDSKJNmVD+FZ4LyO5x/0lP+DxImO25Woz5Z+dS4kLXt9B/fBysyE4Vb3WVT3gY12ogQhB3XbI0JV4c/UsYkUA2KLZiOCO0E9G8OGX9Cpzgc7X59SSp+/aaPodmXgNXqqUI8NqfalkkRt+1S2PCfDKMb+6+8J5aMkDT7xAbi7mfKGN8Ft9RhmUvoR4P+InsSKgYGkoma4FrhYkcbT9PR4rU1/OyOoVBMIBGiPQoTXLCUlUmBqmxmghvJScMJcl6MHbPWS2T5K5jalJmbVWtK815MVaW7ybOiWVdoQHW6yraOZYq9jfub+SA/yOa4Tp7/U9clQGkwGNLjTyWOjWUpVUVT/eRTbc/sNzGOKPftE1ao07G9Yx7dry10wGny9CRcZZmXeQrmwWLqVgmhSkjPVOCljmaW8Y2Ulof0Z+iHZFW+dNi+ZFC2VtOwyQWRHLFRrf0xgZ0wlubI03wykRL2jwtvs8cBJU8ughp4Cxm5CZo+pxDqhMYoZWVa5yOti/5d+oxYXeIlTu11eaG1nyqTIWJS+ZriXAcGJ6Jp+DNIQjO4VO51tSz8wI9+oobROH09IKvGwVPPJSS692+vTorCjVHrxm6NhCLOvXgkuUP3iowsdGLX9KJUetNXLV1QZOEFiH0D41VLbPzqBuCZT6oDKImIw30t65gd37C22LuEyZOqC0e9hlyq+/OhTW/7vss4uvPN/Eaj3nK3D9qzfdtIydg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199015)(41300700001)(2906002)(186003)(1076003)(2616005)(6486002)(478600001)(107886003)(6506007)(316002)(4326008)(83380400001)(66946007)(38100700002)(8676002)(66556008)(26005)(36756003)(86362001)(5660300002)(8936002)(6512007)(66476007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: k6AoCctGYzXSV5Q2EnFeaNb0I+3s5E6xO7YvDQ1LXCadwPyTayL+13SXxvk9d6b1fwKaL5brIiKp70ECPhSK7qWsuN0j2KNJl3wjX6R8gFwFl4YaDtA7Ha5hAbFOM2dCfsyM7u+1it95H2qnxRW9b6DzYrJ4XIbnINcOrkLHoqSCvFz3QmuBYuYdZ7eBxMr2XbwT2Bl4pvPA8ibIEfSPt8/g2R3LrZ+oGDVpTElYXT/38Sj3GzNp1cS7O3DjxdUHm6DrLw/Ja5owLBqcPVvx/6qCcKl6Eg8GvX+Rl0kY+AqoHnllnnDG7ucBE/4qnUNHqEAZB3ah/LYBOg7U6kgBixtQGA86weiKSYZb3P+6HKz1r6j0we+co2POQfN4ootP0q5s8zakYox5F+e5ikMiyQH4U13BrOGEMPaNEM+OlRfHFPNDEmoaiSgUJgjUW37MjQC0mlz2I2BWiepNrZZHq2ZTvD5k853Nf2ZpmiBQyq16EL+0Wm9GzIstXQk2WfwjDaI/ES7qRzf7F9/m8FjO4QqomAWa7AiJxkRrG17dA5uBVrWRHk1nctl9XInaGSn9hQFY2zHqhcbsgGvEORmDOkgQ3hN8/fP1aY5BCg+R6/SRuI8A8kaENE5jaPfOm0jOTS7UTzXe+Q7YsyTydpVsyKnHZ0p62iCwrvUxYWufd1umHad5fJcMM9dYMf+CzsMwvF2fLUFgIXxwq9nMvJhtGSlT2QyLgFLpXbtW7z7jsjN80jczphLUo48h9l+IaCNOWlG2f2Iul0gPMQ2MCtcc6Y+R2aDkQjAs9rSynHE9HM4Ct6EvIpy+QLpIiAwno5yoIIWyf02w48Cxz9TEdpXU8qrBlJqUO3ZqpshrGuChBY63P00n/KIk2Ry7BJirMlXU8qVjE49nJYbNwIQPQXHc75CWsdU2OXn+PkL14QrceOnfggkaG1gO/k5vFfAgCoCsy6oVV9XkTtioeTZNJ8YFow26MlAD3MndydPedV3oLWHDQA3v9qYxy8u1LV8MoXdQqQKZ9xVd5E54lso6gjH6vdMydq1jKfXV0q+uZ8TGRRByqE0E1O+UW1RxUC97xJlmITqt3QlT5vDsNI0cmlNcxcFpQmaof4Itez8zAhC4p7sDbSMQXhEH+ZNP4hun+InwHe701MVg6YTVnac7WUFKwgkjOLJEVHzaHsSDccJx8a06kIu51Xxl9EBHdZZ4xP5Dfj4jnyyCNCAoq2pLqEsMb+cm+pJuO2THpGRId29cRv/UJIJlfH4FvAH2vCyCGck49e/Ya9j8gf015iMO3KklH9LVMqefxDxbJLXYHp6HrUOLFwocUBuNXyXdh/MLh80RgnSqxJjupgJhqnLGU1A/BFKp2Po/+3EIun8cT7Eh+KBGwkxmnqIz/NeQlstJrOwzjrnsFEeZM3EuzNxCz2wEREQ9ENDajn8fTRruOLqHQdhAAO1lhil15jUyDjIly1NNXHBobm/xTb2l294PpNdm55m5DmbZogUH57Cd9esHFNOPc/h4OEkH1GAYW4hFMpeMOpTRzeDColyQDZO+Q3YPuI27y5JFjBxI82pDdxSySfFr5+V3nAUw8QaZVWsDz6gBmtGQPgplVsef4rozHhuWrw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d79d4682-b337-4d3c-f909-08dabebb591f X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:21:49.0713 (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: Z+cMIwF5iDI4yhsZyfV3ENtnD8oB2NSnMJsPxFs5kNIFphR7ul+wkfD6z7YaBru15Z45pPbqMv3m/qDFfwdHMsR73w6SIoLva9nIoruYaYg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4756 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-ORIG-GUID: VA-6tbvy10ITPHtzAeOBdSlHcUcLylSi X-Proofpoint-GUID: VA-6tbvy10ITPHtzAeOBdSlHcUcLylSi Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org scsi_execute* is going to be removed. Convert to scsi_exec_req so we pass all args in a scsi_exec_args struct. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche --- drivers/scsi/cxlflash/superpipe.c | 18 ++++++++++++------ drivers/scsi/cxlflash/vlun.c | 11 ++++++++--- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/cxlflash/superpipe.c b/drivers/scsi/cxlflash/superpipe.c index df0ebabbf387..724e52f0b58c 100644 --- a/drivers/scsi/cxlflash/superpipe.c +++ b/drivers/scsi/cxlflash/superpipe.c @@ -308,16 +308,16 @@ static int afu_attach(struct cxlflash_cfg *cfg, struct ctx_info *ctxi) * @lli: LUN destined for capacity request. * * The READ_CAP16 can take quite a while to complete. Should an EEH occur while - * in scsi_execute(), the EEH handler will attempt to recover. As part of the + * in scsi_exec_req(), the EEH handler will attempt to recover. As part of the * recovery, the handler drains all currently running ioctls, waiting until they * have completed before proceeding with a reset. As this routine is used on the * ioctl path, this can create a condition where the EEH handler becomes stuck, * infinitely waiting for this ioctl thread. To avoid this behavior, temporarily * unmark this thread as an ioctl thread by releasing the ioctl read semaphore. * This will allow the EEH handler to proceed with a recovery while this thread - * is still running. Once the scsi_execute() returns, reacquire the ioctl read + * is still running. Once the scsi_exec_req() returns, reacquire the ioctl read * semaphore and check the adapter state in case it changed while inside of - * scsi_execute(). The state check will wait if the adapter is still being + * scsi_exec_req(). The state check will wait if the adapter is still being * recovered or return a failure if the recovery failed. In the event that the * adapter reset failed, simply return the failure as the ioctl would be unable * to continue. @@ -357,9 +357,15 @@ static int read_cap16(struct scsi_device *sdev, struct llun_info *lli) /* Drop the ioctl read semahpore across lengthy call */ up_read(&cfg->ioctl_rwsem); - result = scsi_execute(sdev, scsi_cmd, DMA_FROM_DEVICE, cmd_buf, - CMD_BUFSIZE, NULL, &sshdr, to, CMD_RETRIES, - 0, 0, NULL); + result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = scsi_cmd, + .data_dir = DMA_FROM_DEVICE, + .buf = cmd_buf, + .buf_len = CMD_BUFSIZE, + .sshdr = &sshdr, + .timeout = to, + .retries = CMD_RETRIES })); down_read(&cfg->ioctl_rwsem); rc = check_state(cfg); if (rc) { diff --git a/drivers/scsi/cxlflash/vlun.c b/drivers/scsi/cxlflash/vlun.c index 5c74dc7c2288..4fb5d91c08ba 100644 --- a/drivers/scsi/cxlflash/vlun.c +++ b/drivers/scsi/cxlflash/vlun.c @@ -450,9 +450,14 @@ static int write_same16(struct scsi_device *sdev, /* Drop the ioctl read semahpore across lengthy call */ up_read(&cfg->ioctl_rwsem); - result = scsi_execute(sdev, scsi_cmd, DMA_TO_DEVICE, cmd_buf, - CMD_BUFSIZE, NULL, NULL, to, - CMD_RETRIES, 0, 0, NULL); + result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = scsi_cmd, + .data_dir = DMA_TO_DEVICE, + .buf = cmd_buf, + .buf_len = CMD_BUFSIZE, + .timeout = to, + .retries = CMD_RETRIES })); down_read(&cfg->ioctl_rwsem); rc = check_state(cfg); if (rc) { From patchwork Fri Nov 4 23:19:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621676 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7326C4332F for ; Fri, 4 Nov 2022 23:22:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229537AbiKDXWN (ORCPT ); Fri, 4 Nov 2022 19:22:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229501AbiKDXWM (ORCPT ); Fri, 4 Nov 2022 19:22:12 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B311F1A83F for ; Fri, 4 Nov 2022 16:22:10 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Khsxe027191; Fri, 4 Nov 2022 23:22:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=otDSly5fTZ9zOY/80/xSpzOAA/8d2q8LdnFcRbYp+v4=; b=t3AxsOVL4XncuePBcNDGIA22VAwQnpPt0lGkFQ6vMFTA/kxu/ZTm500PT0PitJ+B3EZa iphxaaWdSBLMfKgMlweGphUaV3YXmWbgFp1H6NonvI3VNX9vwHr5yITR9NrP0scJBDX7 Z8YzLJro6fo+ocSFeVA5qC1EtWUc9SpgDBczvp2AEDLND6yGX0r0/J07izdS9KXLlJoi PKl5nKCsRvqED9Ot7LsOX6RD8Syqhz6k3kLvbc5r91KtaUE0pw5qVf6T1JXarHz5H70k tnDkKFigSPuhc/DRZVCEsdGgX7g70jsw4/P6s6TYfFy9EKVWH9pV8G+1T7nNuqzjZVwA dg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgust16e1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:02 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4JocC2032861; Fri, 4 Nov 2022 23:22:01 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2049.outbound.protection.outlook.com [104.47.51.49]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kmq86gdm6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V+Dj4unzQ/FlxNp3HmLCOdsFNPilGwDFCqRBpAYtnR2ywtskXJGC5Z27d1/sUA9mlfkiINHAap44MV0ALLTvxBiSnly+e4vkItTk1MkjAvimj6jlZtSF/XC2uEOJ+BMXvKEhA16xTsVIeZieOHFa1Mj0pzFd8WXx48DId+0SeeZPwUS+Put8RTxFuCwF/pPHG0U/9G8e3de4uWMAqP0YqMvgdDl3ytw+IE3KkIVpe5kT+lByWhC+a3yhhCXj1cbYd0VNtKu8qFClsMptG09kgVPTX8DFpoX9b6G1zgES0MCCnJwqaWy1cmo3m0d6JIlFWt1MM/vJtp24oJd2/Usteg== 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=otDSly5fTZ9zOY/80/xSpzOAA/8d2q8LdnFcRbYp+v4=; b=SaZoDK+b+go5448FJ20A/LMCPLAqZmxAToHxh0rnzMWgWxPfxY6joletZbUVdOzzuBDgtVGCc5qCL5cpdyIMk8hkcNxOk0i9NSE9KEn4or5Ms50F8GoLm0IP8ALHQQeJcWnldKxzglZXEkiUlDE4JEvbT7TMUycd82hCKRlAY2K8mIdNtoeK2d2tAsSDHPytqPP7xQABUMGoWgakoaZZuOuQai838/c9XLG8immZw+spIaPKDM0CJrSgDc8uXYDtSRwkC7NuDEmAGyAs7WPiebyuzagHXm9caxiSBNWN23rOa6FrugmwoiIw7e05xBRK/aLTYf+bFBQxEUFyzTxOsA== 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=otDSly5fTZ9zOY/80/xSpzOAA/8d2q8LdnFcRbYp+v4=; b=A81YJ5Umxi92yQk9qyEn+g1eIdegK8jhkVEfzlIT9zvIVljdgMYrEP0yybnVsZWTuy+QB3rJi+lptn2OkPWkHft67qzXvu0oKiuvQXAJP7AolQl47Y1Bhb1LJa1pSDdf34DyXGDXuEHRq3b7sZxE9lYyH/mDKKgxw1fuEbzEnMQ= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4756.namprd10.prod.outlook.com (2603:10b6:303:9b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 23:21:59 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:21:59 +0000 From: Mike Christie To: 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 v6 18/35] scsi: Remove scsi_execute functions Date: Fri, 4 Nov 2022 18:19:10 -0500 Message-Id: <20221104231927.9613-19-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR03CA0330.namprd03.prod.outlook.com (2603:10b6:610:118::22) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4756:EE_ X-MS-Office365-Filtering-Correlation-Id: d3ad14cf-59ff-4c78-3858-08dabebb5a07 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NQmoNOzQyLpcWE9/+93hNPpFns5Ul09oOQbEEFyES61Nqo7GsYQkXz8A48OV6SCzt+1pfyGm36mY5MsTNxugiG3sNyxjNHP/m9V8cU5L4Q03zwHdB3NQBMhQ6ZCUoOwlK+rhRlDYl1NhYfNnj3TvhCYh7oCMlVSp1HEK/B5tBqcDZ0vuPJmPSOd3pLVapmmj8iHgHPiI+Q426lINn3n1Ki93CxuCOVzHxQoGJ2SgLIxICEOOTlxdqvvbVroAzbHFP4Al7vasE/Lx3+a1oy1+73KR9V+w7tMn6W08mSQ0ShivHIp6iX+E+qLE53XwDEtAY+3YSbyvZlxFmq6Ckxaz9TsGfQ5kYP9cBUGh7KgY5HFjk2+/RciRdmx4j9I8mKzYw6T9MnaoCZdtRlsuayDOroADtd6HdV+eSv9ebD9veZI65mjvrMLztgPQwpAIeT7M/nPIfjdrRPmaJL8j9GiCHLq/+GkY7H7Yye4lc1DpnCpuIUuZx0JcMSTevc5zt5eywboXc0FyzmOYeFrVXwhmh/Qq3xjm6wJEV+ejfxz674kMKCKEBSXExDLwkn2xV1V4ydB8b2fqhDK61vV09uA1hYPjpv0p9GF7p7sxACMMqXkbr8sHo1MMzDqDKzdBdmuR7H0sGgxoF89t7b/b0PPQu39//u5x6C1+0ZW0v/Qcxw85tA9yJJNoMpIM6FuRYkkusdiHDk/nf9ngMB53t1eRaw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199015)(41300700001)(2906002)(186003)(1076003)(2616005)(6486002)(478600001)(107886003)(6506007)(316002)(4326008)(83380400001)(66946007)(38100700002)(8676002)(66556008)(26005)(36756003)(86362001)(5660300002)(8936002)(6512007)(66476007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: r6YCEb1pgAG8DKpADeNmlgVf2yd8EwGuc0UIhF+AMzyvPDQ0Cyyu9TANuNlbNlyg/yxcvGxakzkjxr5F1rAm9lWkLcZcBpPng6k+J4ph1rwqLK8jPQNNoZQ4HGMpRV1HUxR6/4gh0iB5j55LvLW5xiGrcvSwluycsYR2zeTjM7i2KV64H/+nQK9RhwDgSqlA2gMZAox9n1NDRuZ6cO1FhU5PwZO6WA+w15Dn5jLLnANtXQVgdeRsuKj6za3iYBWzq2riv3LtKiStupyDwmMKsVhz4hsu+9y5OWI9thH+WyAfxMhbk/T6uNwGi6DUYf5Ue81wDWR/wtsUYWYH16P3peLGn716Fl2zAR4hBY1QBArKAwEwSDa99hlCEkbh924aMmlK/UK2KhxguoZW0dy9HEzGno6JrAvLK6v1FeQEhxBcqffd4OD3VxozGYbXgyWUdZO+uN+Gisj63/OzD5Xt1zPbSwpCZppB1+uPYnop6ohbjZWDGwqpCbBW2bmgCcxWxJtQpw6D3/x8bMaexRALf2M3DKvit42GBlF11Ifj2/JkXUyMsmq4gh2I4S8A4i4LYVg5bDgwvZklmEUe5ejoRqHQ0cWMQFSJJVReXOcxaEUjUrH6SqS+ol/8zdcX2NPfYFK0sELB/aWMqcC93sRHw5V26l36bw3w+mSOpWmhoB/zvFFUE0XptXeiwtpan2QOs6CnA9S5hkyrCdk3T52ueGO7KP2G+Kj4+5hetqz4VLqvCPnefw0j4c9oz5eD7l5NEHZ2eFv/MA74Q+P0NWiCDRHUISxzVoJkqr5iUfooqDYZxxNoOfZzq/2M22gRX/PYBTL11kClzGP1lorKAecOHpH6xMPdunhZDbC2ux3e+jMwaB/jIjELHdLf3EfG7R7T7mxR64DJ/ib7SoVaas7+nwwybXiB5b/hNTZI3Rk6xs4v68TqUeNhV1LYPFGsvCdwyRz4+nugg1HoKp1Jn0bAH+H4S0/0dbZWv6PS7nAv9wYEFqpxw4ArxWZge4hD6yiik+8wJ/bWkuoFkiB/cDllK6JgIvLm/ohWA3I4QvPLH9NOz7Hgvl09Yc9Yjptui0VtDKQz5vMV2NedXnwEOTQBkVOpp8plV87+09bJ5u3+sZDNjecSow4TG/QFIxsR+MZ16/3eDBcYjdA7KU4feXtqFTHtqz5GAcgU0K7sjXxnutH4o3tDumsWRid1gUjKty734gtYLqCHgHr1HFFoVkXIUNVKVs4Nj6DOVkiIxtkNaRSYa+dACpt3iOCJ7vkW21QiXwCTp6Lo7fy4es79/iMum2cJagRrXztwpLVsz4D+zfCLXp33oa+1u9/v16Umvnvumx2uESrYEurUa9hzQkZoL5ZiYpzFrw9NrCT7jjGNyakSp0FUzcegoDMxjloiJ0db4Rc2zUvU3SGbpizlkP4BUxhAXzbZFdo6all6wwPVqDS2uPRMBRk/rslpL7JW6vCgV0c4OF9Bb1tzO/YIxVNN7mCKm6omdhk3XbOzeZA02kGCxvD8Ts/kJt6Kl+4VIN2XRhzQ/w/iFdm5hhEQNbGj0mgx99XtAhQFdsafflEUgTI3FqcAPuqU+DpYHCnrNTsf5XCAYyDPjtBiKje6rYsPpw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d3ad14cf-59ff-4c78-3858-08dabebb5a07 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:21:50.6024 (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: WEScbGGGeQqIeAmurWEIxCZFu+7xCh20jisv4j1c8IyEwpy4lBE2vX0ZL0ZBJmhWsY3QykVrHZZka20im1OnE97F7gc//sZIiWQwkv4RxvI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4756 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 suspectscore=0 spamscore=0 adultscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-ORIG-GUID: r-5V-rpHxDsKvevDDFgm6x_q6QFpFpNk X-Proofpoint-GUID: r-5V-rpHxDsKvevDDFgm6x_q6QFpFpNk Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The scsi_execute* functions are no longer used so remove them. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche --- include/scsi/scsi_device.h | 39 -------------------------------------- 1 file changed, 39 deletions(-) diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 4ae36274b6c6..76a7a05baaa4 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -481,45 +481,6 @@ extern int __scsi_exec_req(const struct scsi_exec_args *args); args.sense_len != SCSI_SENSE_BUFFERSIZE); \ __scsi_exec_req(&args); \ }) - -/* Make sure any sense buffer is the correct size. */ -#define scsi_execute(_sdev, _cmd, _data_dir, _buffer, _bufflen, _sense, \ - _sshdr, _timeout, _retries, _flags, _rq_flags, \ - _resid) \ -({ \ - BUILD_BUG_ON((_sense) != NULL && \ - sizeof(_sense) != SCSI_SENSE_BUFFERSIZE); \ - __scsi_exec_req(&((struct scsi_exec_args) { \ - .sdev = _sdev, \ - .cmd = _cmd, \ - .data_dir = _data_dir, \ - .buf = _buffer, \ - .buf_len = _bufflen, \ - .sense = _sense, \ - .sshdr = _sshdr, \ - .timeout = _timeout, \ - .retries = _retries, \ - .op_flags = _flags, \ - .req_flags = _rq_flags, \ - .resid = _resid, })); \ -}) - -static inline int scsi_execute_req(struct scsi_device *sdev, - const unsigned char *cmd, int data_direction, void *buffer, - unsigned bufflen, struct scsi_sense_hdr *sshdr, int timeout, - int retries, int *resid) -{ - return __scsi_exec_req(&(struct scsi_exec_args) { - .sdev = sdev, - .cmd = cmd, - .data_dir = data_direction, - .buf = buffer, - .buf_len = bufflen, - .sshdr = sshdr, - .timeout = timeout, - .retries = retries, - .resid = resid }); -} extern void sdev_disable_disk_events(struct scsi_device *sdev); extern void sdev_enable_disk_events(struct scsi_device *sdev); extern int scsi_vpd_lun_id(struct scsi_device *, char *, size_t); From patchwork Fri Nov 4 23:19:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621668 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4ACBEC4332F for ; Fri, 4 Nov 2022 23:24:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229759AbiKDXYf (ORCPT ); Fri, 4 Nov 2022 19:24:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229752AbiKDXYY (ORCPT ); Fri, 4 Nov 2022 19:24:24 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D880B248F6 for ; Fri, 4 Nov 2022 16:24:12 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Kj7Gc013358; Fri, 4 Nov 2022 23:22:05 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-2022-7-12; bh=8X+JWQUV8Od86j1ax9yjgfmge9XaVfHHKHWpm1Ex48Y=; b=QC3XdTvfelN/wxJ3KE/7kAzhAJC/HHn4akekzpRx5nX583b4/9WV4Xq5Qlkn8E6DAesa JgAxMfNBC+BHKL+HiFr4fEQ8Ssds2ad/AKAmBCd5M1cBXDXXuWMJRoYonuRgLy/7uzqf iZUQ84AaWLHYuO3m/XXv8V9YtsUVyJWZ1ONaoH+noIO7nVX0oXblh+uSPSPhi1VX7qle he901hRal4NwZ4YlYUQNrW4MOSDPdvyK1hQu1PiS94n3A8ecZ2shqOy9Oo+6V1Y1JnjG SeT0lfG1ysKYQx8ylhWS3jyPCntPz9uKqtbXZEp2aMHivphH5NSFrF3IbBYb7vE7jfCZ Qg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgv2as1kp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:05 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4N9O3K029321; Fri, 4 Nov 2022 23:22:04 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2048.outbound.protection.outlook.com [104.47.51.48]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpr9a94r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WAW/SrdfBHpReF442XB2p5K5sjhPxGFEMwSW240QTuSPXDJgk/YgGgBHvzWMnoYYJRHEWI3DvaJGgwECBGvxq1n7gq/6j2F24Xzkulb8WUc47e4LGpSwVVE5LqRxqz1QH5k/RTkw+11fQuLPWsCsJHFdjCJW9HnkX4Sjr3ZbHMmYJL5tbX7SyvDrxp/EpF2O1IGfqBaTOIctG0giJYc19H5YwTluIWYSuEyFU72Ugalz4TBZL6E1CkkyXo6ai2IXsDYWjRqyt1TGlZO6d2YZBAOulop8o0b4WNfwyvqGTepQKMiF+lb8O4bzBRDJN/R4pba558y4ZWKK2MoYm9KfFw== 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=8X+JWQUV8Od86j1ax9yjgfmge9XaVfHHKHWpm1Ex48Y=; b=mBfRfWlpefbVEABJWZ9F1AaX+Iwb7D04GFtWTGhP59gHCm0RhWo5W0oK9nr1jokMgphsjsYJ9MCXkTQRU7BqJ69MnwCK/85fMzD8Slju2f2enYx9ZTO7AYeLKi/1AmrfTgdR2s1ipCuTaCJSLAJjXn4KkQOlwKjUuJe618F/aPkLRqhUEsJC3SbA8QF2/c3iGsnX68kxZ+7d0OzvX9AXnspbeED0EBUpWmadkomIhvESQ7ZWE8/VL2kYQYMG6LvfCNFxBQBScg8uqs8eCBch/bd7hwtjwof5RkbMh4k/2M14aRSHHJ7VmYwsUIVc8VcZELW+0etH8k/2F1V9uuaeig== 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=8X+JWQUV8Od86j1ax9yjgfmge9XaVfHHKHWpm1Ex48Y=; b=LbrBeYhy0990RtT2P5R5PUY6/x49KlN+pJBdcwJ6QD2ECNQ+6Wbs+MW7quEYl/Ht4dxg1ORBwjU+QA5CQhuO/3Ec5QYiJQrvYdBHCRTCM/hbkrg+TqYJWMLO0+aWTbZsaGUTl0mEGDWJjdHNWC8hCQxVP/WrstPao8es/iPtpyQ= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4756.namprd10.prod.outlook.com (2603:10b6:303:9b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 23:22:02 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:22:02 +0000 From: Mike Christie To: 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 v6 19/35] scsi: Have scsi-ml retry scsi_probe_lun errors Date: Fri, 4 Nov 2022 18:19:11 -0500 Message-Id: <20221104231927.9613-20-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR04CA0113.namprd04.prod.outlook.com (2603:10b6:610:75::28) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4756:EE_ X-MS-Office365-Filtering-Correlation-Id: f85793cb-edb5-4ab2-b51a-08dabebb5aca X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gbiW8hpviYOLLb3fL5GdH7YSOzDjkxzZEn9WlcmcdVHJrwIEhQUQ8XM/USXOrNSidnG0Fya7zukcox4QBaVtt0Yrr5VtpSqX2TlCJt73GKWUGl0lKwqJDxgLsHj55P6QEPCk9iWANfUIX8EAz+RBsF/XGdzfSjtlSnkPp6fDWF1CIpOcdJPlW8P3bc7LU0oauFHTkK5BocmY6ntXM+ElBlRKY9NILsxLv7Chc1bz7B1MO84+tIBUQoYCyptGDlr+5slGZwgkckp1sjUQbXlhMSe+AvqyTjvUtNFwSKFNX28Jw7MgL8DLqkXfMEjKRbdklY3iJZiOrJKbBWJY3EMM0re3KVQx53+h/PFikuvOHSlZyGl8rTONyeJuk3wC0JrEHcztrR9IEIPjSvUn+domiFKyWVfrg8+4Y8YFroiHLjXg+HP8/0hQBW059fiQLrlY+27IpnQX/xjkx4D8Nb9pkzEN9ygUyZmf0MLyJihOjeRWP2oUphv8T8OGmQNdW7R9dk5bFL/F1ThfiRjaoWaJtZLi7hO8EWJon/mjCcRljPK1ytbcBdX777s4PHO3EhZjGszI90r0ifrWUrDYZbmT4RmsGBCTYePF8y5uTn5Nwph4rLiTsssxjGdf5HKxU17DYFLvnBroBysoSWl2gT5jszJN6GQDYZTivIAgjFFgP1DOXPdSLEJvMF0QcytVocnuVWudXoKvUi+v4nRw2Tvasw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199015)(41300700001)(2906002)(186003)(1076003)(2616005)(6486002)(478600001)(107886003)(6506007)(316002)(4326008)(83380400001)(66946007)(38100700002)(8676002)(66556008)(26005)(36756003)(86362001)(5660300002)(8936002)(6512007)(66476007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: G5R5ZgzXbWAN3N3KAdELl+kyemqGtWJ9RPwiqfcwxtSVafptU9FPrKzQi3V6+nnAPZR0Ao7Wsom7Ngcz28uaVIGRh+MGGxs7PKnoI0OMtmPWvVCtmvkZ3VKT6XTbt5kSFuzVtkSsNVz3qoyARYZyH++eVOCfnat393zk6GGz93FTCDmpqgQbHUK94qSpOveGztor573WgInBWwfAdHRy3KvV6++k1P9/RWduyhHbNEcUMVyM/zMq/l2rsZASkcUL64KDDOWsSpi+VeW16XRKpmZmmHiIz7sPdhO25dSLm2DMrNuJTbNJBrs5Bn9R/KEc5Ga22Y2a28f1Ec5xZwn6JplbVFV0bRdlIxiX0h25FvPDBbnjVvmVvxrpHPHm0s7XwK19x9xEH4U7xGSFZ3g0SIhTWoujcyd6fsvLxBYDU4ck5pwUPbccEgk6zH+bvtJo7t4l6V/GMXAdGWN8obsx8S/689EZBev9LkAMvat11ZyJlb8x4YXui3k3GerGTtt0rkJX5lti5BmKJw6MG+oSmBJvNHycYg1Ky4IjbCE+aTj9TqCX5Q7qf8eHGdS3WI6zBMPJ1REKG1pXka8cVeSHOTafMpS4QZaLNbTWNCwdYssFB4tCLz/4rAGXfmVa8SNw/u6SQ+7IPqjpl8ToIY3avkFkkKqtLiEfOA3r1V4Y4Y+4dZaevoxLT0UTArhA7F21t8xjuRTgzKBAb2JJL622+YQytoywlGAtlZ2ZsvPD2NAwL0zZNePDLa12xYoAPZtVdUqlVC/3PumeXHC/UoOwAwB+AV6kJtd6W1NprqIFvx6FizX95NH1qluYCjPtbP4Jcz9dW+W4ZXUEXfiMuhK6Uta/4+q+lRIFqOprKjdpLu0ziqQv4oC/J1cFFTd4MwKEhdpu9OF92msIfCLNKw798qH9NoWmCxOekdS0FzCLQtwhMMMUfmwnsEq73yonNmWyb9V0z7sbBJm6TaVMKvk9kPYrONgP7qkwrXnMktbMWKJukHBFrhqXOcMwdbTgk7mbyNmYVpk+dvYKtS7gF+j3S0MQbsX0UKDMTJDeSuFNbMSsTCZ/s+qNClnGXHlZBegddrpdgsa9IiV5Kb4cBL2orc6AqlSeKEXf98gDU3s4WAAvi7NQhXUA2zyRkwVO42QL8bAkd79iMaZXwQ/9VBjVWb+vZbU7L07DzWqauRlalr8jnbr0ad1/Hf/bDqdDrg13766J+SJFlcqNgUNm/ZVNWdsfUVyyVpm/n28mh8i4X0rEAS7PvrxqQhq+/8p8Cqv1MxfZSSTkZjBTwE0Q+52L9kVhbGM8R1m4n+u/CzWL+Q3fAp2i1zwqH/Yj+bicOzd7lZCcArFjAi5IXJSxYwbb/ynRXKRbyY2ihZHln77BgXNngl6ACGjV6VPpy7ZhZFf/0EpuuZDMcd7RFw330yxl2D8AganzZwBxAUkECMlMbJrfYOKp/oEtyF7TNNFI1RUPmTIWz9Zq5gCp2NeozaIOkfFRHWWvX6/BVM/4ZWiIkRTwGMYBTGdJyLgPuXTtEhqbg2rtpwVx1XqQtKZET/E0yJRHXVL39DtIoj6AvZVHvGno0IxZFDm1Hbvwa79XrYsnAVDdLHctxnpGVb6ssbGLqQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f85793cb-edb5-4ab2-b51a-08dabebb5aca X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:21:51.9148 (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: eFAbotoGIPKyCjBzSx8qZ4vristaoGcqlhH5+9oKgqLV50j3k3xiolGElyap7ZZy0qmVcij+Gd5KUaDuodHgKTZCVeqKFvZ9ju5qj46KuZQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4756 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 suspectscore=0 adultscore=0 phishscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-ORIG-GUID: OsAMILLrKOOtEtIkigfXJ-SXc93KfWCM X-Proofpoint-GUID: OsAMILLrKOOtEtIkigfXJ-SXc93KfWCM Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has scsi_probe_lun ask scsi-ml to retry UAs instead of driving them itself. Signed-off-by: Mike Christie Reviewed-by: Bart Van Assche --- drivers/scsi/scsi_scan.c | 51 ++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 58edd5d641f8..ffdb043bda5f 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -653,8 +653,29 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, unsigned char scsi_cmd[MAX_COMMAND_SIZE]; int first_inquiry_len, try_inquiry_len, next_inquiry_len; int response_len = 0; - int pass, count, result; - struct scsi_sense_hdr sshdr; + int pass, count, result, i; + /* + * 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. + */ + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = 0x28, + .ascq = 0, + .allowed = 3, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = UNIT_ATTENTION, + .asc = 0x29, + .ascq = 0, + .allowed = 3, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; *bflags = 0; @@ -671,6 +692,11 @@ 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 */ + for (i = 0; i < ARRAY_SIZE(failures); i++) { + if (failures[i].sense == UNIT_ATTENTION) + failures[i].retries = 0; + } + for (count = 0; count < 3; ++count) { int resid; @@ -686,32 +712,17 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, .data_dir = DMA_FROM_DEVICE, .buf = inq_result, .buf_len = try_inquiry_len, - .sshdr = &sshdr, .timeout = HZ / 2 + HZ * scsi_inq_timeout, .retries = 3, - .resid = &resid })); + .resid = &resid, + .failures = failures })); SCSI_LOG_SCAN_BUS(3, sdev_printk(KERN_INFO, sdev, "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 Fri Nov 4 23:19:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 622000 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21815C4332F for ; Fri, 4 Nov 2022 23:22:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229511AbiKDXWS (ORCPT ); Fri, 4 Nov 2022 19:22:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbiKDXWP (ORCPT ); Fri, 4 Nov 2022 19:22:15 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 613F31C93B for ; Fri, 4 Nov 2022 16:22:14 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4KhrPt027184; Fri, 4 Nov 2022 23:22:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=mCQ80TsAuy0hmG6ldOJJBi+B0gPmmjwea4QMlokaAIg=; b=ScYnJDwXr3zspY6r2CIA0K7Pr9DBdXy35EZd07laKenMG+pQrH2qXz4+ft9NGuBJpYmQ /AmKuO/qO1FX8xjHCzpNjPSIRBrCx2UpjzHTme/kG0n7AbscPWpRK3z8OUGhtXPRe1/R 3jl06p/4GJcO9XCzzHxpRH2EbCQQn05zdz1BxLOt2Et6AagWa0w8hWyCShAAFmGgkO1F tZ2Sq5tpcxdgLSd805gftaJ6kJv/nrF/xycC/DO/vrwrF+aEKZ+LzZeyvJCu9OoiHRuB tO93XwPcIU7A0J1I6SZFU7ho1N6A09vF2Ukz64CNLlIPUwrV0MHCRHJ6q44+pkyDDe2n aw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgust16e7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:07 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Mtc7c029811; Fri, 4 Nov 2022 23:22:07 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2046.outbound.protection.outlook.com [104.47.51.46]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpr9a95q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aBkb4CL1NpxrRUxmYvCE3ypu0dS0w1QZxZt4tO0kEXOnHB7aOmXhzqsk7Wf/hiIWuLi6XYJiHSxL+0Dj0BwYT5WM1544DjzoKuIoGTPNrAyrcT9z0IFKPafU1Rh9UruqSVCqtGgxlKkawksXdkr24ZachzIrwJNpfx+NEMty1/KFtT9KaJPl2ytG9hVDlXbytw9ce6SQyKBce3CVhwRkNbGKXJo9PJCWpNvjFIMlddoNWhJhQGdJ++KJ7/1zoV/m5OvkG7KkM2+GIidzXAA+MsmP4fapit7zSgx4taQ9qpq3tILr1a6ZkVsKOmqJLPxv65WCaEtvlQEIzw38cL0C2Q== 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=mCQ80TsAuy0hmG6ldOJJBi+B0gPmmjwea4QMlokaAIg=; b=eHPr8WNqlcDYlQDVAMoMxzQLEOVe8R45wVOojZDNAAvo4g0VWmjO7G4c7aMLDzKMn7FQUjtk/dM0tTA/BHvOsQ4vFSg1orHezoC9UTnbux9uMfVqhRttM481o6mFkpEQVJPMHYtXPeCHGo2X8K7ItG2xq2Y8nHzGjbODWi6sVU89+BcNoLEJZlL5hq2fnAmQ1vRSE/EBhTNlNjoYloZ1loHCccH+tBaTkKBwi7tLCG84fo8oDp5hiQyEdBBvwfTQhF7F0qiQki7OHdZMEGEKmadaWVDo9+sMOukFyIPk66fJsyTY/IYsvJSoZn91Y41jzsnN6Get2cHiX2V4FDShQA== 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=mCQ80TsAuy0hmG6ldOJJBi+B0gPmmjwea4QMlokaAIg=; b=wqQl37ELpdsroDd1QYOn9ONT4xj6vWTD6ydBSDPA4QdOcOgegbe9WBB3xDcdeJ926BmWubHFPxdXkQRJED1MsFLG+jokDXRhOVR0QTXYZfr4k/uLg5AvvK0pL+uRgEe82oQZUFOMdDIfBTtKBAyvRz/Tvu9btPUUMQkOCb83x7I= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4756.namprd10.prod.outlook.com (2603:10b6:303:9b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 23:22:05 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:22:05 +0000 From: Mike Christie To: 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 v6 20/35] scsi: retry INQUIRY after timeout Date: Fri, 4 Nov 2022 18:19:12 -0500 Message-Id: <20221104231927.9613-21-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR04CA0111.namprd04.prod.outlook.com (2603:10b6:610:75::26) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4756:EE_ X-MS-Office365-Filtering-Correlation-Id: a9640697-8214-4d66-a68c-08dabebb5ba3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j6TN2TsngjL1bt2YD2RfCOg6Wmb8RdmQNBh/mb5F+ewafAfeNJje6MBP0qHRi5IEDKZwxc7aVWCMvnWnlLBmRUIrNgeDaVonWYQGqOCgI1kHWka7Cdk13Dh4ivDEAiTJcwkLTxvyf1/A+nozyN6PVoIfIHozUvXfH4aIAhfPNvK9FgSFAKfxdbMtnURn4S++2PtfqnEwCsTeefBPFZ/qSz0Nwpe3Rw12F+KqWO7Fy9pQdbT8uLsxIflbwAHZYAO6ZmYah7qbs+eA7K5rr4wDoUjElf9FI8vHo7MFUT/Lj6zlcwGsycmuqe1Y8U3/pW0ynQpOuZe6yMqsZJ8rjeBhT1yxm+2OYw0aZ6HNzF2CoPxMYB5qJ1wCFwXoouFr/N2mxDUL19z/wPl9dmD+w/2remVavKwZm8Z/uPZHvsIEqcXppi4cEegd+GcdY7qDfNfXIYf5ZNK5HH0Ztj+LrsKrT7NRuAJxtqk8MkJ73EXm00uTO0fnSIgdUNAvUayYzbA7w/AjgeRIVtbH9qn91V/hw97QOElL3jIRvVD7Amfrq8s3JTCuaRHPUHX+cISIA8Qa4ALL0lJTonM6XZLFw6QyIp3ItTqrw9ruBtNU6hRhy01+amTlAlGsvlzafs9CLv4i8flzChRGrnaOh74Q5Th6JjFsJna5Naou3+iz4vD4S1S8bsmbOC09qkQw/THmG5S4W0Ga7RcBW8rM3Avx2QoeoQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199015)(41300700001)(2906002)(186003)(1076003)(2616005)(4744005)(6486002)(478600001)(107886003)(6506007)(316002)(4326008)(66946007)(38100700002)(8676002)(66556008)(26005)(36756003)(86362001)(5660300002)(8936002)(6512007)(66476007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vdcZtwFCmN1j7ST8EX7shGQGSa0nCyzxXzIEij5T23utl/Z3ipR6BsYU2MfSqVLwDE88eM6iieYbchdnK2VMeDYwSnMyu9aMfQw5pspAjGyfsFYDwa7xWiyBpPXqJuG4YbGU5afofJkC9MpLt39jOJGjTet9XCuvv141Iw1DNLLxU6JZzok0qRs4qRs15fx/1MYMBhCoer99lRsqDL6Tu7GLxhadRlqIbpvfszpm2aeqwiaS82oe0tpru+uoOQjqMIjO6kUNm1rG3JYZlyKpkPHaWOyqffVZ2FFVjTWqfuykAR//MhffBuw1OZOA1HXnch+n3tQpsJjVATKD07fXh9+F9y/Ti6euO9zg62IJttnWmLZyRfg2XRAC53+E9Rz/P/lvmXnp7tL+dTCeKPKBUPN6E4WQZOZhyYWtgjpdK33bMzlimyTj7/udHfufS0ZfFj5Qr8ynm+aotDXlOfRo+KgOiJd8oR2S8m8C2f2Z+PLlawrf7wjCIa165f001iCQ+fuOhaLfR14dC2rHz/WVLtKD8BMPqjkFGBbm7NJQqmxvRt8+BnvU9sKnvG9MztB5aUfMFfUy3qqby36O/G3rSElvcBnbFtGSIDGdj0FcQYq91Ff41LIWgVuKZeuCi5WrWl/bV9umHvbJy9+yL26yGb27hJa3h1Sa74xGVzliBTJ1T+Zsy8xFEHF8OvOUZfS+MPI6zTpWhIRccTbxzU6HWsOgJ/ieeK/HqMdmrLiHiuS12+GNPFQBaS6ZouQviQrL52Sm6rbqvjdNN7pXJ/TfpgGzf1vhRCTmk9cvEu80QkXXoV9sfbo7f2uRHSkybA2yqZHrUSnzi6A+oqlMGLfVvdeFPTnlcdO6XbpZXU2doV0VPq10xs7AE/VMtHO1jLoU/Uz3jZLYmrz9892Vn/NlViNY1fF+MRPzkRDeguGnldkATn6I78nEXjwMROLZknqWp4kNENyEVuutrkBporKLblUVtHIxAp08JZ7u6bCBmNZX2hylC2KAxPlNuE70evsxErD4qPxArOf7CHzhGvlTTNYXSfmmyp1pNb6JG1v73MA4M4RSwwzNROsA51RHUiC7N8WcSESjFT9LLf1oGU+AzbXSSkJnUDRD4mpSMjRvOdq+YaigEJob/US6/MDMbFq5K7gVo7DQtPG+4cTdBdJTPeG+qKbb+TMSEDIReVSPuupSw5mXEo8qYs59B6Y3E1OwgYCZNX1O+ygGjfqnnnKzqm8JAh2eq3AKj1B/mPdgAIQ9MBfuBK0InmGxJ6yzakFGknMggyHma6FiO8oiblPansCB9YK8R0MjEl459TZMBBQpZZ+lVMeSFmecC0e0ukzZWQvqccYcIJZV+4IAy9hXK8K8z/RNv74KbPNlp9ZM0AXZ/fsHkkl82gKftGaIOH3+LXo1i2yJiMxmNLl5fBWqLx6IlLkLI+DCWELyqeQnjvm6t+SdESHQu3IAJCCwMAtmhd2B7+nGuxpKUUhzIzBhK32DtX2WehK3vGPi9fX3exYwJzlu83FREzxCP+3E6Wjv+vP66CEgEQNeaCWNBm9hok0JU6/zGARVrIdAphPpOoUYQSIQ5a6TyG7xp47VMjUb/K+6QAYeHHGzRfWLvFQPnQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a9640697-8214-4d66-a68c-08dabebb5ba3 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:21:53.2897 (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: qs/hSGd+ifM/GQCG5xEK9jG5+5Vu7jAJRiDJxIWZdKhqKwZ8Ijn6uv9u2jpd9cZqxDBnBGu3mm5psrikKWx1MIs2+8jwAjYbIVInlW7oLi4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4756 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 suspectscore=0 adultscore=0 phishscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-ORIG-GUID: 6j2j_leW37RtqZvE6AtzdBgvZ_Edp_rM X-Proofpoint-GUID: 6j2j_leW37RtqZvE6AtzdBgvZ_Edp_rM Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Description from: Martin Wilck : The SCSI mid layer doesn't retry commands after DID_TIME_OUT (see scsi_noretry_cmd()). Packet loss in the fabric can cause spurious timeouts during SCSI device probing, causing device probing to fail. This has been observed in FCoE uplink failover tests, for example. This patch fixes the issue by retrying the INQUIRY up to 3 times (in practice, we never observed more than a single retry), Signed-off-by: Mike Christie --- 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 ffdb043bda5f..28d53efc192b 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -674,6 +674,10 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, .allowed = 3, .result = SAM_STAT_CHECK_CONDITION, }, + { + .allowed = 1, + .result = DID_TIME_OUT << 16, + }, {}, }; From patchwork Fri Nov 4 23:19:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621992 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90903C4332F for ; Fri, 4 Nov 2022 23:24:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229835AbiKDXYh (ORCPT ); Fri, 4 Nov 2022 19:24:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229537AbiKDXY2 (ORCPT ); Fri, 4 Nov 2022 19:24:28 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2902E25EB2 for ; Fri, 4 Nov 2022 16:24:17 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Kj6sE013842; Fri, 4 Nov 2022 23:22:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=PcWhoyST+OnlaYBDH24JC1tHpddkmBrRH3kjDnVU9Ls=; b=3b7a6eEDGz/D5WMUZFxb6NyT3eubEfd/AD7PwYtAzL7miXyi8oBpF0KKTjjVqKYCwzeW tdI9/pA7TfxOMNsW3VlJ2jbJTGO7g5XkSOxqQ+bdDqB2IrmqSfZHtloRL5rNKlNqQRKo CzbKTa6dRPZpM/MNRU8N9Ysd2t6mTA3AhQBtvlpp4kySTby4aO1fsyMzCFbimanE7taU pHS+tbkWLavS+GXz3UTl4k5g3fFUsGFDvFd+5qyuHO2iFX+Jb50kG5IgW83DRBIxXVMe 25tVSB53APfSAqFyzB+UNL8qqH69IHO5vplPgwr8eb3/5CnSNBzwZjPN2wQxVqRbR89Y Mw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgts1hgyf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:11 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4N2Amb033107; Fri, 4 Nov 2022 23:22:09 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2042.outbound.protection.outlook.com [104.47.51.42]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kmq86gdpw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ShlArXii9bAIMsHGOef/F1KcslSzcHXhJFIo/2jSjgz8u0c4lnHTn6HoX9iR9+kn6l+kzgBGECOI4Hlkqj9raV4YI3Kl8iiTAL4lAKPpL9Nv99wtKrNBTLzhAqlZa5CDGNCfXAOzeEgO0wVAQtgYgEcF1JGmgZ48cIlSAbJcavg8Dp9HegceMVq+gbXMwvyh2Ckni3iWExNtBoA3FRJnPeXomsUvB94x5pRNtM0RYd32B785wEwhftgB/6IqVQ65+E+ZQTXEDcDu4+J9N2axoniN1yxTrQuHPehvgX/yYck4nWVDZL4cpjC6gBjkj5dGIuaUjloG96AEgiHP9vhvjw== 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=PcWhoyST+OnlaYBDH24JC1tHpddkmBrRH3kjDnVU9Ls=; b=Ly4WaUD9Gb3ukDgEc6+bzEr2aZJbp9HXZXG+daWrPUJhJiBNdoTdomsDypzKkSuOfHb9ZO/CtEjB6UW4mfvOUR7AEungwu0fUu/bqN/Ct2tqI2A9vqb/2cRbyUgvqKnRsCTNtxoxAq+/r4x2IHNaTz/2yGU7Xlrg0qo/BOl/LvHa6vjTrG4lKA9oFmQOuTAEpRRMzh8bWqkRiMH0MsyNzpLCKb1/HkN2n9yDdrraCbicDqZ1n5rn5XyRBeSgDmORWQB4hK2RXKfxSuwE3kiX9oOA6P68b8xz5SiF5rcG854CyP565Opj80agWceJoTnPKZpYF2GZcvOAhKBTX68Usg== 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=PcWhoyST+OnlaYBDH24JC1tHpddkmBrRH3kjDnVU9Ls=; b=iM/Nxs5SNr2a3GFBFJAiQ9Mfa/GPwfA49L0DwVbIX+25Dkpg7nTo3DC4zFZl3QGLDn6jJB1d9O3/3qycX2h1MLoP6/UOP11tmczVtKXgeJI9KH7DPl+S4wKLQy63Z2TbJcX5EjfxiMLkf14PPANkKfD9IaxEfgKXePb4q0XUazU= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4756.namprd10.prod.outlook.com (2603:10b6:303:9b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 23:22:08 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:22:08 +0000 From: Mike Christie To: 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 v6 21/35] scsi: Have scsi-ml retry read_capacity_16 errors Date: Fri, 4 Nov 2022 18:19:13 -0500 Message-Id: <20221104231927.9613-22-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR04CA0106.namprd04.prod.outlook.com (2603:10b6:610:75::21) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4756:EE_ X-MS-Office365-Filtering-Correlation-Id: 94de0a79-f995-4572-7120-08dabebb5c75 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Q+oFG83TES6oIlqHOh6oC2IW56Oq1APEAev5JGpbtAB+CxSjXPzP0elQ4gJfXZ/XoCNY5mVJ01sH+BzDCYqdj3rLdC7rSdH0krTkC1sz5fUbxCvlzCCVgGMONve4ybJ3BRtOZb5RpxaI6wcdBu/pnZZDSXUUbd/jCTBbBFimaGKuhND49h5/7XsLV0Z40lXUdvneQeJRiLphoJuXVJJBywzbOpHlcg1UZG/X48Kmr4tOCfmDhBRjPmZNi9N8hBTAeqnl/yCLoGrWOgIxO6OhFHRYbIGS/g6LdYdDDgcjcMfgm31wXeY7zn8Bw4uWBl2ciiFiXW7FbsDA/tyzUIY/pixPBYvUtnYSKkUZAERf8F5wVrU4bjgUhkyxnr7+ANxYj/1gNChaRLLg4K/x+kVzJMoZVdWZQzQHs4E6FqfkDqe0YecxGMWebUhWyPr/59sF5FP1Y6SuuCo4RdMZ0gIOzh7nvpnEA3g3dW8KU/VHiudfHfk+LbeDysGbvBl0a7g1vFtIzEVfXAUjZWhaAEEwZ1zprTXslbAmrBeotQyWRqhjRmVXX0x8dBivk2Q1PPaVRtZS6b+99WLjv+Gafhs3o5q2/Voa9n2PkgkANgc2yUac1ICopJDPStR653jxClt1TZ0ERX8C0FhMpObAUcdaayHBpEFsXSsstw794WGo3mQ/TKBtq8TxjBL+YR1zr2iHoD7gbKUqfaXChIbJyL2fvg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199015)(41300700001)(2906002)(186003)(1076003)(2616005)(6486002)(478600001)(107886003)(6506007)(316002)(4326008)(83380400001)(66946007)(38100700002)(8676002)(66556008)(26005)(36756003)(86362001)(5660300002)(8936002)(6512007)(66476007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5O1SRoGHiOCedx4BOn2Ats/sdDF9Gf9g9Mkf8OsmiBzUOSYyf9rWTbdTNQVve1EjLTtGXqm9QzT+1SKy3q7o9grA7XyqraMfS3IiwmICo2EObbnC8ezMJShwRZMunPjfogBel06wPLFznSbpqYXlONvOwxVpOlWMLzlLbo8UYIvSgsLFO30yHnfk13iizSsjpPfXqspt5aJk7yPscV1Zqr7DG3A78U/CTyiLh2RFguzv0GBFkeVGYIC8y9/TwVpqKva/7/sK0plIYEmNlxCRNe3GkViHmobeigXZAsNHXx/MC09QeHCfx2KSaxAgg1ghPPxvS2c0kJSebG8tThtq4FXmrsymT3wUKPnslOG3QvSl0WJ7x9PQJCUKD5gCBuYHf7x6Gn1tmAaThgrs4nIod5ioGkr7lYUMIqsQjWTOB76R7ZMLGR9cqXgAv080Ay/xph/QXgUn6cv5pu10eT6CzqQqPwKXBL+cAZmJOHDgje5xd1LbetvSyhxKJi0VmzfQP+086bIZMHYWqxkyVS3SLnxKDsNbTuuHUGgQAu920eE4IryMx2XnHejbFJFd7GLSM1CZBz3z8b67rguRHEO2emSCL+5jJIlNFgUr2ZvFaXfBY+t5L1OBHIxPvO9UzD+gSuDm+nmUBjuhxKvENcnTNXMyYJMAYa0oZnpqYPqWgrYMB1W7zffokSbC+u3EcBOdnIioo1yX1FscUfGx8foupOe/QFc8pih1oiss6hwA+Vqq/SD2Fw2OKKr9gwfBL2/jTWS5Q6fW8SVcGvDxcNLNBmhRMzUDV8AP3xD3xhDqNcToeTqfY3hRQ2aiHWIYBm7p+Yt74sKd6xKOsh5gfaNOyFrzDNimrCBzc4pQWdOo+uxEEAJc01cuHt/JkVwqo4iH4K+cd+0jqHkp2tzTLxdMwuGvWLZt7nQtOR4Ll6HOQgUVidXLx8MLV8Y3d5/3TsVzGQvDFyTQhixQ/717GD0sX1ixzgLEz1VKf8hwNiN7qCTjnR0RYb5vdJA1EhTdloClvW4CDdwyoQmEFLwTnreKsHrnO2+0yGxeN9v2GipaejkWpjvcSdna/Elov6KYVKDp5lRhlwgzNWCx5nACvJHWGnGd/qqNsbQvwof2FgCnd4Hv0iCZ6rL8eCOxh9YrdMSEGz5DObvYcb0Y3HIArJRYNKBSP+/4tNmB00fd/qnDRKlmRUZbERZrf7/BoMujVROhMHNqqTGy9pFX+tPJoeqRKfOxDaSVlAJbo+RR6qdyOsZLk5rFmeUsF3/UcT7UsAkre1zMXQGHfOUPKqNIrr47bPk46NGRlGmFoElC06Q1m0n08lrL9GNxFmah1qfgoEVgf7e9VJQwuuQ6aKiIxmEg2btKds4/hWBMB5VSw6ouQe8Kldz0qey8MbSzPq69kwhU4ob0bt/dLI35CKng+2v7q0Z/5Qas2mg+Jjbd/R3StA81CkDVwpfV0+pC/4u940Xvfb3XE63xfJTTbDPcW7iS9wR8yF56ZiufI02bdOLJI8i3UiE3VPIaD0Ybztm8hJVxlsWag7wQktDQEWGzsKCsJhQhNGOvF6yptfKITxWXTwJn+B1SP834DnKoF9EduocPQH+xA28D5VvKPF+F1Rkexg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 94de0a79-f995-4572-7120-08dabebb5c75 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:21:54.7427 (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: TjIXLt+UwWzfnKLBQpCWL/IDeN68h9khXGZtwRrOVC3QDKNugRmlmqr9HWF6r3lndUJY0OOfujeRVpshXzjdJK+9PA6tPwmB9W3BoVeci1g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4756 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 suspectscore=0 spamscore=0 adultscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-GUID: aN-iuXuPE2RsGu0jryNyaxjYDHXqsuTB X-Proofpoint-ORIG-GUID: aN-iuXuPE2RsGu0jryNyaxjYDHXqsuTB Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has read_capacity_16 have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche --- drivers/scsi/sd.c | 115 ++++++++++++++++++++++++++++++---------------- 1 file changed, 75 insertions(+), 40 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 37eafa968116..54e599529a3c 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2279,59 +2279,94 @@ static void read_capacity_error(struct scsi_disk *sdkp, struct scsi_device *sdp, static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, unsigned char *buffer) { - unsigned char cmd[16]; + static const u8 cmd[16] = { SERVICE_ACTION_IN_16, SAI_READ_CAPACITY_16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RC16_LEN }; struct scsi_sense_hdr sshdr; int sense_valid = 0; int the_result; - int retries = 3, reset_retries = READ_CAPACITY_RETRIES_ON_RESET; unsigned int alignment; unsigned long long lba; unsigned sector_size; + struct scsi_failure failures[] = { + /* + * Fail immediately for Invalid Command Operation Code or + * Invalid Field in CDB. + */ + { + .sense = ILLEGAL_REQUEST, + .asc = 0x20, + .ascq = 0x0, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = ILLEGAL_REQUEST, + .asc = 0x24, + .ascq = 0x0, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Fail immediately for Medium Not Present */ + { + .sense = UNIT_ATTENTION, + .asc = 0x3A, + .ascq = 0x0, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = NOT_READY, + .asc = 0x3A, + .ascq = 0x0, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = UNIT_ATTENTION, + .asc = 0x29, + .ascq = 0, + /* Device reset might occur several times */ + .allowed = READ_CAPACITY_RETRIES_ON_RESET, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Any other error not listed above retry */ + { + .result = SCMD_FAILURE_RESULT_ANY, + .allowed = 3, + }, + {}, + }; if (sdp->no_read_capacity_16) return -EINVAL; - do { - memset(cmd, 0, 16); - cmd[0] = SERVICE_ACTION_IN_16; - cmd[1] = SAI_READ_CAPACITY_16; - cmd[13] = RC16_LEN; - memset(buffer, 0, RC16_LEN); - - the_result = scsi_exec_req(((struct scsi_exec_args) { - .sdev = sdp, - .cmd = cmd, - .data_dir = DMA_FROM_DEVICE, - .buf = buffer, - .buf_len = RC16_LEN, - .sshdr = &sshdr, - .timeout = SD_TIMEOUT, - .retries = sdkp->max_retries })); + memset(buffer, 0, RC16_LEN); - if (media_not_present(sdkp, &sshdr)) - return -ENODEV; + the_result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdp, + .cmd = cmd, + .data_dir = DMA_FROM_DEVICE, + .buf = buffer, + .buf_len = RC16_LEN, + .sshdr = &sshdr, + .timeout = SD_TIMEOUT, + .retries = sdkp->max_retries, + .failures = failures })); - if (the_result > 0) { - sense_valid = scsi_sense_valid(&sshdr); - if (sense_valid && - sshdr.sense_key == ILLEGAL_REQUEST && - (sshdr.asc == 0x20 || sshdr.asc == 0x24) && - sshdr.ascq == 0x00) - /* Invalid Command Operation Code or - * Invalid Field in CDB, just retry - * silently with RC10 */ - return -EINVAL; - if (sense_valid && - sshdr.sense_key == UNIT_ATTENTION && - sshdr.asc == 0x29 && sshdr.ascq == 0x00) - /* Device reset might occur several times, - * give it one more chance */ - if (--reset_retries > 0) - continue; - } - retries--; + if (media_not_present(sdkp, &sshdr)) + return -ENODEV; - } while (the_result && retries); + if (the_result > 0) { + sense_valid = scsi_sense_valid(&sshdr); + if (sense_valid && sshdr.sense_key == ILLEGAL_REQUEST && + (sshdr.asc == 0x20 || sshdr.asc == 0x24) && + sshdr.ascq == 0x00) + /* + * Invalid Command Operation Code or Invalid Field in + * CDB, just retry silently with RC10 + */ + return -EINVAL; + } if (the_result) { sd_print_result(sdkp, "Read Capacity(16) failed", the_result); From patchwork Fri Nov 4 23:19:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621667 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9236C433FE for ; Fri, 4 Nov 2022 23:24:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229809AbiKDXY6 (ORCPT ); Fri, 4 Nov 2022 19:24:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229703AbiKDXYa (ORCPT ); Fri, 4 Nov 2022 19:24:30 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41ECB26559 for ; Fri, 4 Nov 2022 16:24:21 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4KhrE5027170; Fri, 4 Nov 2022 23:22:14 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-2022-7-12; bh=5uqhdzGgE/rCoB/SUdvG85da4KdSfqB+65Z2+kJdvik=; b=VZKiL4OUopD2MCqtoPTGG9ABfmJbkmihapxdGVwKsAno2+0DCgrxPk074ApFFaJseQJn 4gDaC5JPPTp/B8zEtMCCwDXS94bf+y/VxhHNS27HSfiKS1AeYA+qDu3Z74G08RZjne/Q ztQo2p6z1Ou2spj3r5M1LRp2p6bb4mlCAKUZCSoGDPIOeFwE0upsfYaaYoIjJoXfFgaT d/ecuAl3k0N172GngeNPmMuUgl5ykoHvJ3joPLJEK5wbiTURZ6AUW8qvQCfSGX9P1+Hr Z/m8IHhMSnQRvl+6R/efyyNBLKCk7k4PPp/7DyfJkuOJGwwaxmuPN7c1BXdkc7DEugvy 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 3kgust16e9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:14 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4K9fXe012210; Fri, 4 Nov 2022 23:22:13 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2041.outbound.protection.outlook.com [104.47.51.41]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpwn8cyy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BdEUYBL+/TVnOmmMFUSBuYoH3nBDnr14DRFITRID+zQ0zHZ42yQ4GEQ5bjUrNrh2tI4u2ZmxSyDMwyTqTmbQleuwsq6zwV66fijU5+IEhv1S1OOxUP/lp6z4w0gyTdaH+EE6c2ReVvjRCY5CHbOrN7CFBWlIE9n2uHJFKIrJ8pUz0yR7ddKZs0gnGPwQsfWFwcxxOiANipL8ryDLP8785j5kfDf++6bac7/pabI3FutlZPPpvboNe8V5Uc+PlrjFSSNFWWbkvVVu2/qt6jfBySqOv9IV9fuM5ZCLGYFA31IrEqwyzH+vmUZ4EcyKXUXjoElIHAp7dTIKHNnkXok+xw== 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=5uqhdzGgE/rCoB/SUdvG85da4KdSfqB+65Z2+kJdvik=; b=dptvjxc+20g50LAXe7l+6kIY+BMHq9tWVYtaYUW6ZKc1CxNpVDPJTYND71KsOZckgl0GU6xWMte74drpyjBPapY+RINGBfIMN1Nq1o7uI+2cUEm7xB9FAJJuTSuQa6nOYwhlG8/HTD3WgzuH7wadZ1p/xu3DiX6SFH5dSxso8dOlwr9w2mQlx06wfs4865ZY8bpBsKRMnTDgGocXGew/lFKdug5E6Fja/X5ei6RHNEy5YxTQs9Amjg+Eo1KSXlvf7Jtp9+3AwEfX+5l47/Yd+j88dfqUYhWl2aNE6Bu1BX/cNYnFcms5S/GWhlRuB7qXS4rqaPoHIucGg1dOG1Q53Q== 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=5uqhdzGgE/rCoB/SUdvG85da4KdSfqB+65Z2+kJdvik=; b=b31tkc1PxdtSgZLr8Lksmk3t9bYp3N5tmdWRlQvT57gsZEjOJyllkJunzRX80cUDXNEiru5Tyhny1ykchttJK0RmA1d2NMlBOznvLMJ/nFtF2lWI8yh8L4L6jny6Nmto/P01GymcsWY8/gZNf8rlOjXmW1PSuaflGCH3YfDeJNs= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4756.namprd10.prod.outlook.com (2603:10b6:303:9b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 23:22:11 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:22:11 +0000 From: Mike Christie To: 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 v6 22/35] scsi: Have scsi-ml retry sd_spinup_disk errors Date: Fri, 4 Nov 2022 18:19:14 -0500 Message-Id: <20221104231927.9613-23-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR04CA0102.namprd04.prod.outlook.com (2603:10b6:610:75::17) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4756:EE_ X-MS-Office365-Filtering-Correlation-Id: edef3e1e-190e-4f9e-ad04-08dabebb634d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CrdslY9izpnsOaWDha2gZ5kLQh7Ib6AkCIGcqa0QsnhzPw+hXLeLFQCFG52JyOSxe8E9LUtO8/qLwD0pFiJuhvc/LuwmmuDdRak9GYbh9zaMk2Br++PdZBpkQHM8Mj3P9lcEv6ai8KdKA9lrbUo+ZQOLHniezzymOEzzu0Xx9SExAYzM/6lX2Lvf9Kssk7rj/mV18BTqHZFQ6E805PgRfkxnjLrHNyinx3mOXvujRd59NYKT2iyhIVGc9i7byfiILOCY/A0UaXu+DX5+uWLOYKFOp76EI1uXXEP6KYvDl4Pn8iMkGkUt7na17Vd+63j2WVyuMh8Qt2lfXdzFuJ5FhDdrVR0Dq0otmp+18SO1/1Ao9mUHjQ7UwDsLxXRi5aUCMzHkdJbmI5uzbEUyboJSyRcSQRCqRFICekkmfg2vsYbSZJK/yehglRhQ2+LDHDG19/vSXkJRgkz8pNDoT4GB3HZiAvD8o2VpoQrK2oJ/PYU8Fr8WO0otjrOrOpNkYAhqWeYPAd/I/N6koEKohtdyx2BarNfI0SNuPEjcc04KEnXYbaRb+pOPKN7DwwFbM2IssJ6xF8COjgd2hUCQBuOd0IU2i9TxRgoqZD1SfGuYokciCGdYfuVQq2lIsAzAEW4CdRd7a1HFV8pXG1B1xkYUQenz33N+VERhxVUjSjZHo8YLaQ7jTPIhdNodcdULYe5yPF8gJc/CwcHo5dz0FvGzhg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199015)(41300700001)(2906002)(186003)(1076003)(2616005)(6486002)(478600001)(107886003)(6506007)(316002)(4326008)(83380400001)(66946007)(38100700002)(8676002)(66556008)(26005)(36756003)(86362001)(5660300002)(8936002)(6512007)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sESacUDFSxM6XMbUcYJCANiKLgmIbKwvbQjTEoyQpzHt+POUCM2NxSBUnv9uJeb0iYRphxLcI0oYf+lRX71iPBKgSp/eHiaZv9wWPnMRJHDkxYMTUGCFqyINxsvKCG0lOQqUoUYB+cu0gKkI0n6bU0k/Nab+JFuez0qFJkv6DssM5PrtjcMjRe/yJm7fqDvOL6xno0ciC1OYGdGmXnFVXdokLvpNIosLWlYeCPvEksRvZ7YD64XaYAmThCE3t2OcwToxjCggpy8sA32OQara8LhTk89mUWqHW2lyUsQpO9Obnu9hajSJvED6mrMpKlAQQpaSCuU9+5iujHTMcrqA7FARSwUkuE0z+xtGl3kjrPxecg242VmZsa6N8Io40x1gFca4hXw+4K3zWTmRCsS5Y6whcQyH3yg/xb3qWidHBWTdf1pKIj3xfZJH9DddlaUyj2NJVIBZCyCTMtGs2xnstGPqiV0EPbX4xTLMLIuDRw/IXEmosU3Y/OvtlUz8JlARlZjUz5tMwSBVQ5xGDP95/6xvFCzexsOPldPhqZ6GGz17nTRJvQW5xLUq+E9ME2wG3Vc2N2nggQA+AGd4opuUHYgl9JyjAuJWYqHe8Yqg3yGf6JL0ZMptxQzaNkeTfZhDcM8/i7kohvXZstGbL0XsqihnTomD5etFq3S47IMcHudypkAWtY7kE2IQcc+4k7DymqKcCrRJNgO/YEk9h3wdz0EglOzsVTo7/6CJH4Gxx/WBbcl/IF4D7U7LRhCh3M7t9vHMJGUZUSWcoS41PBENMDmxpuBHmUpSQRMnfqSe2V80qup+XBWcYuse1JloVbdon7+Ln/SOsGaPDo042RGDEfH4yuy26TzWDeFiN3/qKi5Xoozb9XcfSvRlD2Glq5BGI0shmUVmGdxrbp8mr7TgWW577pU9lFKWd/kz390RT2VXoP8PTRmKHJlYd6pVv4Ef2USARM6RVqpYU5UuLdfE165DaFXWo/wZWzih3gkgyn3S53JqhWAdI3VOfCvWCym9Tjaakc1LzpxeEuRIvBrnA6uWqIyjW1b7bgndQnBwvUzU4MIaJW3ucI5d2B1lEp42tDaL1cBo1pyFzsR2C/V0yACUMnaWE0Vb9Z2AIy7xxKVDPFCGpDlsDlc73tw5bwh6fUomUH8dL3l0U1T1lfshY1WHAQ7voJHFU5Bn1G5aHoooH8T8NAo112pKWDBwhiOF1OxZdbroy13/nju6uJlA/QJnl0yXEP+J2DFSV4kxxD0O5EPjJ6d9zH46yjK1d0dgAFI+a6HTI6q1mSmet/k9OyWVQgVxZLSHAf06UsmzyFyjNO44xMkRn4bBQH7zOo6YM2dMAmSh6JwPdF7SA9deCzzgVXDb+PfpA9TntHwUFLX/EZBAPWE/oLz/ZnfahlImdDdEcZr9HhwaYqHDkzz6o0aADphfKN9vMZdAYpbdJhahvXRsUTmkVNF47PWJX7s6Vq6OBEX2i7ArGzbS7bWhnJ9ODsW1b252wgVKK+XPqdCCchPO1Dv4iPcI0Z6XIOo+fS5pn+wWfUY/luZroB0boTIZt52rYcutzzQYr+GF8OTSPCJt5DNQtE/j7VGf3Qzfi/PX/74ZhhwHGjcwT9fZeA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: edef3e1e-190e-4f9e-ad04-08dabebb634d X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:22:06.1636 (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: 2BTGH+r8Lsl+P6U/2LgMAWW8HJjKrQuPAyGyjr3LkOOu4VXzbZV9aBZrF/P9mtemqcQZ9gYEe6RI2qoJ3bw3BkzBU8k2sx+eccEeYYQY7xE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4756 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-ORIG-GUID: 4ymY257TrNK_PSN2nvSk9OkvP6XUk5pI X-Proofpoint-GUID: 4ymY257TrNK_PSN2nvSk9OkvP6XUk5pI Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This simplifies sd_spinup_disk so scsi-ml retries errors for it. Note that we retried specifically on a UA and also if scsi_status_is_good returned failed which would happen for all check conditions. In this patch we use SCMD_FAILURE_STAT_ANY which will trigger for the same conditions as when scsi_status_is_good returns false. This will cover all CCs including UAs so there is no explicit failures arrary entry for UAs. We do not handle the outside loop's retries because we want to sleep between tried and we don't support that yet. Signed-off-by: Mike Christie Reviewed-by: Bart Van Assche --- drivers/scsi/sd.c | 93 +++++++++++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 40 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 54e599529a3c..66f1bc03e219 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2062,52 +2062,66 @@ 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; unsigned int the_result; struct scsi_sense_hdr sshdr; - int sense_valid = 0; + int sense_valid = 0, i; + struct scsi_failure failures[] = { + /* Fail immediately for Medium Not Present */ + { + .sense = UNIT_ATTENTION, + .asc = 0x3A, + .ascq = 0x0, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = NOT_READY, + .asc = 0x3A, + .ascq = 0x0, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .result = SCMD_FAILURE_STAT_ANY, + .allowed = 3, + }, + {}, + }; 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; - - do { - bool media_was_present = sdkp->media_present; + bool media_was_present = sdkp->media_present; - cmd[0] = TEST_UNIT_READY; - memset((void *) &cmd[1], 0, 9); + for (i = 0; i < ARRAY_SIZE(failures); i++) + failures[i].retries = 0; - the_result = scsi_exec_req(((struct scsi_exec_args) { - .sdev = sdkp->device, - .cmd = cmd, - .data_dir = DMA_NONE, - .sshdr = &sshdr, - .timeout = SD_TIMEOUT, - .retries = sdkp->max_retries })); + the_result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdkp->device, + .cmd = cmd, + .data_dir = DMA_NONE, + .sshdr = &sshdr, + .timeout = SD_TIMEOUT, + .retries = sdkp->max_retries, + .failures = failures })); - /* - * 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; - } + /* + * 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; + } - if (the_result) - sense_valid = scsi_sense_valid(&sshdr); - retries++; - } while (retries < 3 && - (!scsi_status_is_good(the_result) || - (scsi_status_is_check_condition(the_result) && - sense_valid && sshdr.sense_key == UNIT_ATTENTION))); + if (the_result) + sense_valid = scsi_sense_valid(&sshdr); if (!scsi_status_is_check_condition(the_result)) { /* no sense, TUR either succeeded or failed @@ -2138,16 +2152,15 @@ 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] = { START_STOP, 1, 0, 0, + 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_exec_req(((struct scsi_exec_args) { .sdev = sdkp->device, - .cmd = cmd, + .cmd = start_cmd, .data_dir = DMA_NONE, .sshdr = &sshdr, .timeout = SD_TIMEOUT, From patchwork Fri Nov 4 23:19:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621666 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DEBBC43217 for ; Fri, 4 Nov 2022 23:25:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229546AbiKDXZC (ORCPT ); Fri, 4 Nov 2022 19:25:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbiKDXYb (ORCPT ); Fri, 4 Nov 2022 19:24:31 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0E8128700 for ; Fri, 4 Nov 2022 16:24:26 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4KhwD9026577; Fri, 4 Nov 2022 23:22:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=r2ky/VnpqfsVUO1jYDC5N49eG5u0Eb38mr0Ylx4JHu0=; b=nl179Z+Y4giOOfLRKk0P81yB7iZQAOVtwXZlPvb+4kABiUijzfzXImtXjIIQ5B+aspU8 1NsP1m+RLiey0KVrJM0qWMg9mZYDlY8eXQjrCxmVvwz3WtI6H6TYFXj5aA6EPE266NeJ 8UCycennQufHcaocCxSVRTPS/gJzx4AtuABWWWxegipYDUbtxdllH0hhWkGj6f8vjB/2 nCgMo4aZz0WQgO/L0OXh6xVLf8c+8vbE5DsnhWI0hx6EicIEZQA/7WeW8FlyKu8zceWn AGwizSu8KyWDVAZqSNo5hG9WIbmdV0qN+81VLWjsx30Y/RNb5hYGwzTwvYW/YiJicYLt CQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgtkdgf01-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:17 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4JQ7mi032064; Fri, 4 Nov 2022 23:22:16 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2048.outbound.protection.outlook.com [104.47.51.48]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kmqb6raeq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CwNtSLZA2aBtZEiFxn+E96f7bx0tGUYmBMTUaKsE58TCibiJV8xLcYJiYO75EMGEg3gVECSe/oc7EbGV2yNm4/fXv34otZ3KSBO839y2i/evrb6CBHBF1ARiXYJi1N4Ia2z9wlhONf9gUi7qdjylVz2st5UromZjBq3tl6AjPnK62MiZDmulkcW/SdNjAR7cOnG55BXtp6UlJ5GoUQCKKei4XuMiNfSyjiNoZzpmjAdRYmp+6CeP16dAwK2xp7ZYRy00Vlu7Gv/R567gj9pyfJ/oVVa/58HCqSyxtfb+izMVONSNNC9XvKzfCTSYTsYHK777pW5M3c7iofJGJLD8cg== 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=r2ky/VnpqfsVUO1jYDC5N49eG5u0Eb38mr0Ylx4JHu0=; b=c+BweR4uxFYI/Leila3AzOod4GG+rk6NU/BfH2C5CG2u/cyIhY1X1DvdBAgQcgy7ecEfmFTWuzMr4Nzt/AtWqVS1o4PTGD5gQWaGYy9+LsfyChKCPuVO5QqRLyy+ng3qU4W0BBF3odNGsGgCWZJ9GCnGefM6KRssy0XtyTl67Yzf4fbUsKAbFX/DKUH+k+J+8SYOZ3UVtltb3dGB3ekGTO6Azh8d1g6n/VTUR7n93tF3d6SmRhcqSRgzxg4CN1Cw9+OkcT5qyzyV++k7we3HEsCDM9MXFar5WOiQ8gzY2LHr4kaKTEsFxM3hCKsrzMs/5n2g0Fiex38jXrDKptNepA== 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=r2ky/VnpqfsVUO1jYDC5N49eG5u0Eb38mr0Ylx4JHu0=; b=C6t5rq94BFd0+4I2Yf+ut7Wo8ot5zzVFhpOhEOZF7siamDcqtj4SBaldGlG/nBew16PhKYr5jEnCdns1sCOKfnSAc9bhAMevKLjoWhYK/xCOyudPPzRq3XYtiRqArnLjkroEpGJPxjveAlVUp7+XnJ1OjVl9BbaZOGu42O42Zys= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4756.namprd10.prod.outlook.com (2603:10b6:303:9b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 23:22:13 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:22:13 +0000 From: Mike Christie To: 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 v6 23/35] scsi: hp_sw: Have scsi-ml retry scsi_exec_req errors Date: Fri, 4 Nov 2022 18:19:15 -0500 Message-Id: <20221104231927.9613-24-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR03CA0026.namprd03.prod.outlook.com (2603:10b6:610:b0::31) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4756:EE_ X-MS-Office365-Filtering-Correlation-Id: 886b967c-d1b3-4b25-29c0-08dabebb6411 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xhyY0MlW8EC4xSyq9+r+qX6ucRkbmih2T1osAYrN1lNlGrM8CDtO1xpPw35VBNAxC9bp7oGFFvoEt+ZLfHzU0BlHX2gYUWND5kF+0ECiYKqjWQpWTDDp3srrgaaECR5cmnY9RcfVpNOhxIYZHqwiH7PB6my0aoWC9ioDQIlJnA6g9I4RtWDKXUQr1u6IW/4HPDImLg/g8o6rGGyAbXntVOR2JYIKVekIiQns46fWY6gubwAe1KYw8xnNCVMGWm+4qraRVa9EfuYwAK7ATZXEHVEIO0Ac8931WhcZ8JTa1Xw46bkIa8oQQCCe+N6lk9fMBsk42Rk8DcD2Q/FBCiphvnt8uN4+Z+L2yV0fzVSe7pOvuGakzqoXf7Fi6jNGfgbFhHGHTDLMHYgWvTGmg9tdP6mnJPsqYNYatwd/VY6xf3nCmNLtQv/DzpDBsR0MtRDhPryzRyiPqfrxr7EoMm4AMaubbqMj+wzSuLzABQD3sOuHhfvOU0r0PkSDn8uIQgGZbjG3YuPGeBj/x3Lsbt+yF1L/Vh+j+h3KhKmLgleKHIhY3wyNqIZvbgoBKxL7O3MHGKbx29mQz8j81mWzG4Y8m5Z5g1D+7mR4bR9ZHG7g8wCA05+ToMjjsUpiuVuCexODwk7fX6kEXqGVN1ASzN35Mnql8a5LKv7XBeFz1ROpfnTeoG2A0IQB00MjR8fpOdfDeNO3aHlqc4QabIRieSH/LQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199015)(41300700001)(2906002)(186003)(1076003)(2616005)(6486002)(478600001)(107886003)(6506007)(316002)(4326008)(83380400001)(66946007)(38100700002)(8676002)(66556008)(26005)(36756003)(86362001)(5660300002)(8936002)(6512007)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wiAH4Ow6YPio58Iax/jzVp/94N1iSueSXwczEnr5BX/fyOJk//6eH53d9KKNEjPFxhYyS1JVpNWw4piPef7mQuubIrrfq3gHwSbnTBDYsnkv2bQEZifSbYsln8N+CXbB/1DsBn6V7kb+8N6grw/vp/SnXfDrPsQO8J2mzXeYgrGIbSL32gctj2mFiP0RlNKQyzCmlW3gJgmey+MgA2AfxAhuL7h3WhS4yH0lKsduVQS40eohq7HGKJ8FbB3rw0e/81L3YPNaAhh5PRrhq9xfeTmRZN8d+adui8VPVNPJrEB7sEqiMYexT/GtVfY8/hjbSkPMtPF9rHF5eGHS3X9PsjWQeD7oXlUQarAIWvHP5eSSadZHzs5dvUHkyS2wSadig6eskjk3KmhO38tnxfZve8Fd+wtUBTbdCxJsqC87VfWrBayMWNq8oBxCmb+kYlqpEXD9uDPMTLZfqsnnLivJuwtuOdXVJ4eBonCvx1xDmwTQSja3I6Wfv4TbyXzwOrw4AKybbtm8h17NM576IhmKG57HLu5QDh3R7/rAQEFIIzRmsj6KR6K87NWmcQJyuOhzv6/h14AmYjvzlHa7cJiZwXF22eYmVKl5vP9mwviCbe1Qh4RLlMQAIY6PK7X3Su02OopuatUbFygNXNTAdsIofSVx7fTjaKvHTYwMoe+Qjh4DNfdp26GomM724rh7vXHOza7P0DCOfAUCoNHADH3YTvk5E5Gfngl8+4msL7XmWdxcYGBCyQw1k3iZV+Q4p1hvRRlgoz1OvoPdVim9tTVtf6OsgKHg5JDnZ8qaUZWURcfvRwbHfVXGpt0WkOnHJnyd7lcpJssjJTGeEmR+PrK62+7Sx79fFx8Q7IJ0lZJYSPrXooqNegeE1bqgD944FMqyebljhIvn65qpBt0DbkddsWj5qD5CTnxg5zDDp0HHGGr2ioQC77JxEaLWebmsSKF6oDdzbjf3o+F44wTDLhX3CDcWDJTSDX9SrAe9TPnGjhkkozsXy4OspXm8EH7vxm3Ew3hUMiybG3xGYpi6AwJciPdjlSlw72v8dRF6iQWjh6XgGdqXRkopPw3bgetrQRF+HtYq1Q8W5l00fUeiAvpU/KimdNGCn4azMHxzjxwU8Tzx/xIp5W0cBKlq16cirEY5MlJZ5UTv9gcAYwegrO6nMaNbhBluSSOVkIDPApWGbGcd/f2kQdT+Y9sOA1Su7Pz3Ri2PtZRqwrmTj2BIJhTR8qgFNEgbagP1IJUIX+Grb48pQOgjuf9uq9tfvMorQR5lC3sW1MN3GrRoxMrTgOV97PVufTRJYmQt0SxyZGmE/Lylw+sJr+aG7e7/Dkhiy0K+LrzGLj2matE/AALVFDcYGZh2MMBqFZd2qNMcBttBI1ezJkWwvqWz1LDGK4L5NJbRvEe9JotOuF4rFFSXjqd0n62DlSvPAmY5ihCT4SulkwFb+lGC6rpRD9sOEGJ1Qbs7sI7CH788a3eZfTigAsylUz3YAm76tbvQP7NGX3Uxb3AaZxRdVsdBIvlAy0zg5Jwr3DNNKC84CVospt9vfAFUHgdcGZH5pNVx6psZyV9HmfUqlDUIG4NGkTaSZcJHl33/t0MAPNgzQYkssTQ0VsBYZA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 886b967c-d1b3-4b25-29c0-08dabebb6411 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:22:07.4448 (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: ariPkk7t9AwIkeiaYU8x/QgKY0CSuQgPwKSn9qjP5XFE1XZUjBoVYrkHJwS3z1QLZuRbhqyvriAjthNE/F7V8NpyS5MCU7u+Y6fdJ+kAGI4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4756 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-ORIG-GUID: d9NsbyyyIhctXT62gw0dvvafvPLHMpRa X-Proofpoint-GUID: d9NsbyyyIhctXT62gw0dvvafvPLHMpRa Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has hp_sw have scsi-ml retry scsi_exec_req errors instead of driving them itself. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck --- drivers/scsi/device_handler/scsi_dh_hp_sw.c | 46 +++++++++++++-------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c b/drivers/scsi/device_handler/scsi_dh_hp_sw.c index adcbe3b883b7..8c09d512a415 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,8 +82,17 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) int ret = SCSI_DH_OK, res; blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = SCMD_FAILURE_NO_LIMIT, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; -retry: res = scsi_exec_req(((struct scsi_exec_args) { .sdev = sdev, .cmd = cmd, @@ -94,7 +100,8 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) .sshdr = &sshdr, .timeout = HP_SW_TIMEOUT, .retries = HP_SW_RETRIES, - .op_flags = req_flags })); + .op_flags = req_flags, + .failures = failures })); if (res) { if (scsi_sense_valid(&sshdr)) ret = tur_done(sdev, h, &sshdr); @@ -108,8 +115,6 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) h->path_state = HP_SW_PATH_ACTIVE; ret = SCSI_DH_OK; } - if (ret == SCSI_DH_IMM_RETRY) - goto retry; return ret; } @@ -126,11 +131,24 @@ 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 = SCSI_DH_OK; - int retry_cnt = HP_SW_RETRIES; blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + struct scsi_failure failures[] = { + { + /* + * 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, + }, + {}, + }; -retry: res = scsi_exec_req(((struct scsi_exec_args) { .sdev = sdev, .cmd = cmd, @@ -138,7 +156,8 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h) .sshdr = &sshdr, .timeout = HP_SW_TIMEOUT, .retries = HP_SW_RETRIES, - .op_flags = req_flags })); + .op_flags = req_flags, + .failures = failures })); if (res) { if (!scsi_sense_valid(&sshdr)) { sdev_printk(KERN_WARNING, sdev, @@ -149,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 Fri Nov 4 23:19:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621991 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C929BC4332F for ; Fri, 4 Nov 2022 23:25:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229536AbiKDXY7 (ORCPT ); Fri, 4 Nov 2022 19:24:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229823AbiKDXYb (ORCPT ); Fri, 4 Nov 2022 19:24:31 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F4A328713 for ; Fri, 4 Nov 2022 16:24:27 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Kj8sB012149; Fri, 4 Nov 2022 23:22:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=kNhnCtd/bjWJAR7WrKCvn1pKbt+hXTClC1leFeXMEzc=; b=OS11MxWVF1VDa0XHt+OX9H9BTPC3yANJ1sfzfz9CucKppyK5Pfr976EuHlqbGABm51bf hoRy/8fYHxCrokECma0JAemymaX2SHBsEb5PTflSlnaTkJJ8gW/ACGs7aoR+g7QYCyzz Z5DMeJnGdBIQC9plN0kMNwrB3Np65loaZ1vo9O6XuJU88ALp9XJ6gm0F9z/WEQFyRnuz CmQ511C/Hct7PDB0BGEJIui9Lm7Nt1Tr6/c/HoMy8SSHjgLk0gndcX3VQ+nQs19QhB6P HDer0cKu1gxDuqcFJwNg+MM8oP50WckKY0P2oh9qumNHyuPs7ofcGbrHxepCvjHupkt3 vw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgvqtshwj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:19 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4JjItR028686; Fri, 4 Nov 2022 23:22:18 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2041.outbound.protection.outlook.com [104.47.51.41]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpr9a9a2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YTpQOOWL9o4kDlt7WMynduZPPv39SamCs+O+uoSonih17jD56JnuzLlis3oZF/7NYosZnHRcSqw96fcnrNsbmTczHFFUq0ldew7Mn3xEJZ5xjTRJGWXFpKp8AJlYTy87sxZhwMtN5I1AMn/uRnnDsaPXJCqaij0KJLZ4j1ZaMC+ID4iHBrWKK1OVWdGe92GG7Yssfr1JV7KzYRKRlomGsItHXMT9hw8nMUGpcqvtjqCnVqIB6nROa0z1fLsFaRFzGW8Zi5nuadegFeMjaPgb/95cqSsRDyoyRYqV/z4famb+qpwnZCqgeKxUxyYBz4+4e5EFYM2O2IhWGOjh3z1nCg== 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=kNhnCtd/bjWJAR7WrKCvn1pKbt+hXTClC1leFeXMEzc=; b=GmoYjrF7zOVdycc78reO3l8m1sQGc5IAwLHQ3WhWgqeMDPpShRGd3852HyFfN+O/zG3kph2t8a+yO7zKAvwZM8zOMj+ZcHkE/9XYGzjcFNacSr7O+XqwvirOLGbXazsHQf2hT98gOVycdqTGxvp/ffEdtEBT2lZZiOYWyVc7lL0JClJWxKxELwkW8D55defKkhSgHlqzNA9Wmv8b9tTuF0dg74ujv5flehBjTU3JkZlp3ogZ8cOoC0r+Aq3i/QpYs/X9cmmB3fIsheKvU6vrfMYxOTeQKClKuf84vcG3VFf2H0XSenYLYYwN55tfj5rELH2sLQnGc3FY6GWkhgczSw== 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=kNhnCtd/bjWJAR7WrKCvn1pKbt+hXTClC1leFeXMEzc=; b=PBca+K9fL2Z0Qulj39F3I53O4mcgPqtEOAEj1K89INuvoz5/8sCyfpQVOs1REdsWJbXS6bsO+HyB9H51/5/It93IJ3kt2LnrfuV1YyqfZtz0PDMOyzHz3f6xbcZUJ/RESXiNvR+JDXCG1HEwnD5gZ/nYy6mLD7ihvZnJeA+B2/0= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4756.namprd10.prod.outlook.com (2603:10b6:303:9b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 23:22:16 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:22:16 +0000 From: Mike Christie To: 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 v6 24/35] scsi: rdac: Have scsi-ml retry send_mode_select errors Date: Fri, 4 Nov 2022 18:19:16 -0500 Message-Id: <20221104231927.9613-25-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR03CA0017.namprd03.prod.outlook.com (2603:10b6:610:b0::22) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4756:EE_ X-MS-Office365-Filtering-Correlation-Id: 1af89a12-8c37-4b7e-a46e-08dabebb64f3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fd2feBVAQndn8OIwlPnE/RBYNahH4XYCj5jf2qTxmEHZdS95OaEfEiOJX3MRlvmuGckzqbMPzr2/eW5AOtbLjVxMOl/Oh1kNcscs+usv0oBQImPqv9OpqJ5xzaG6JM2rTv1wD6w8ac9cDphnkDzdggCFi9t6PmeJBnbkfssZNlwCN2smmqCrVPHEwHv07t44Dr7YNNlSemvUqyf4SYzVnhd6s5nSmhyhLJ0KieeO9k7ogfe/sG09C6Jl2yMgk+aV/58Iq0YRM1feU6qAQdTl3QWdjYmR1ZNnosTq4Fu3QGzp2QBkM4CLg8aCqlGfCEIggU9hSsswOeWVxfxluBXgmSb6XTdbBaoXr9pKycvw/QROwHmzqZg0X6hNTv0XJ0DOQtLTsl6cRm2cM8T9WttMY5tkEYnJy61iF+nRK3M6onwzDB8+TZ8ewP8toem4J8Vio0VFFzVL+nbbJNOhl0/6ZfnnQ1DWXGtVTDj/jIaWDtVHPEbI02dg2re4vp6TqOO0uFzBa7h3RpCNekJGrqTCoz+lgORDOXw/X89bF4UlzLwN2b7+BrmOHhVn8V83WDVwmsK9L7bj3Dd9ED+1fQehL2QmfcFGr7sLjuE4341+sN1NYYQF8RHIdijup7K200X6D1KF6DhP5ytuVaHTdhc39Ewt9dBrYYCenflN5L+GdDcQuKyzSAZ7BwKk4fphyxHBLXKXZMCy01mctrhhB193Ag== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199015)(41300700001)(2906002)(186003)(1076003)(2616005)(6486002)(478600001)(107886003)(6506007)(316002)(4326008)(83380400001)(66946007)(38100700002)(8676002)(66556008)(26005)(36756003)(86362001)(5660300002)(8936002)(6512007)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MwUrCgJzFOlDbBWwDs97PmnXft8z9aj5zbB49BX6M55LKg8aH+tGd7ScG829NTyh8EwKQcHkSYFOloQQWukvjNrWRW+y0jOG1VVbDvU3eGfdw4GLsbx8p/9R48UqkMbqPRhYVGM2WkgtEmCdDURnb7hbAZUeFEQS++UEEB3dZPKOboj1XM9bHuP4L87mDrCI5P9rik53+j1/XDX06s5S3enpQEuO64FNL9AVwwI2Dy7TM0JLgSbYI8m0IanELOWl8HmS+k/hqDP6l5vVbTDRIZFdUhhJrzfM2S3dNNNypG1dwn9M569smw7ZqSpho2E5ydXVOQqkDYuOq6fHtuVB39vydUp/slmNxYvHQm20lNGdQ9Srt/QxGGGcBiphJOGzU7+FWMV669FEXoUyWqK7wkUTCwCf7UxqY8j97ra21ESOLN6nU17Nw5VMFClWh7Kv0IZ6unNkvSb168yGGrmN4xZOk5f3vcDD5MD5SJhBS0TcE77JWUSA3z+Q0BRKIQTHcSZ6geP02K/f9ESeM2VoLMFFWDOpvjcVqp8g632NvB0DfGCM0DN63CA+Ji3ghNawXi+8bAsPR1ldIF3YS4kHQKLIgxTqlp5bjEgSAtqrT95Oi1RBn35MFQYcaFGDMwMQByybo7i7DwSMUbXSoVpzfWzJUagop3slF74CjlhX8XUdc5MIgaXd0OlaoUXng15nxSZVpyntAgHiOxxEY9CseAGWS/ues4qFlVENGZwmr4UvOLkkaFbWZqO2R9JfTdb0w/chCH0ahSD6+4tgx7n80d021kjWv+Bq4i4rvN20in2fDpnNxcAyFXkTThZ8aNDnutR5Ob6aPO2xcyn6gItgOf8yPd3b3ayaMazYiYFkqaZjbMX7CBjOQfXIFV6EWycXgT3B+tW5InAo9Cj6nf6I2sU7YJJ4OCY0AwB3JxAG0tX3LakS15IlTt1GR4SyfIKP2N3amMgqbjoFEgICh9euqq15fVUUI9BA52e9Fr3YwZLm2+/QIINDkX3mja8LNx9WOf6gLeoJ6Y1NWgtko9cUvgb/NzA3la7EEbP8l9PRHel32a3xxTM6JxKQHRV8pkOdvNGzoiJcPMYptP4Ss+mg/xsKt4T+gFgoZ6spFMYQ8pfPTnNDNMpTiDv5H1Lqba1eLQ7+QtXsb5XhfWalHYVsHH2WmQoLfqVMsjngpRj5CpbyhesJQRDJrDkr9Ym/6pSkGx/EhqugKlAp+dmNBxGbKPXsbUMwfjSnjiWx76ncTqcXSf9eTPkRauTlG8hEi0JIgaCkPgiP0SzqqxykS4VGWXn7G6thRZ+z3wghyEjXl4/gvhP/83/jvqBd/NuyZ/lMYqC4DDTyCqwVykcauBUwG5yQRjJ3Ml3WVkyDEpzR03KuPals2L4aeIvhJDXftPixT2trab+m9bbBh+dTPAuLkFWLFYTrQflha+V6ZwNfeg3L8u3/D4fMP/45x+ogWuCXG0emFb/aNNa2tk6nFJ2qK4jW5vZMaxaiQdTogqwN7ubeqceWd/iaoeKipK9WowEGB+v9hpUt4On1LXH44WSF/DGyV/nR6mVeww7daAXxwFKEjNw9WenN/Uu1xN61j3A1HSxyH+0uNfF5X5PdsZwygw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1af89a12-8c37-4b7e-a46e-08dabebb64f3 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:22:08.9290 (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: 7CzcKK3EM/FsMy7Uaj3gXyKD7qNlMInQaZ7esGJKIxsmkokQrOoktfdKTuLsnhBBvqaJe2CDCw33VgxLIuLSAdAxeUua6e1jeQu2CQI/60Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4756 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 suspectscore=0 adultscore=0 phishscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-GUID: zeUxOSB5OFZxmOmc8zRYpkfPuFHzQ8ad X-Proofpoint-ORIG-GUID: zeUxOSB5OFZxmOmc8zRYpkfPuFHzQ8ad Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has rdac have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck --- drivers/scsi/device_handler/scsi_dh_rdac.c | 109 ++++++++++++--------- 1 file changed, 60 insertions(+), 49 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index c4d1830512ca..953fad6ddd66 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 err = SCSI_DH_OK, retry_cnt = RDAC_RETRY_COUNT; + int err = SCSI_DH_OK, result; struct rdac_queue_data *tmp, *qdata; LIST_HEAD(list); unsigned char cdb[MAX_COMMAND_SIZE]; @@ -538,7 +512,49 @@ static void send_mode_select(struct work_struct *work) unsigned int data_size; blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; - int result; + struct scsi_failure failures[] = { + { + .sense = NO_SENSE, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = RDAC_RETRY_COUNT, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = ABORTED_COMMAND, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = RDAC_RETRY_COUNT, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = RDAC_RETRY_COUNT, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + /* + * LUN Not Ready and is in the Process of Becoming + * Ready + */ + .sense = NOT_READY, + .asc = 0x04, + .ascq = 0x01, + .allowed = RDAC_RETRY_COUNT, + .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, + }, + {}, + }; spin_lock(&ctlr->ms_lock); list_splice_init(&ctlr->ms_head, &list); @@ -546,33 +562,28 @@ 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"); + "MODE_SELECT command", + (char *) h->ctlr->array_name, h->ctlr->index); result = scsi_exec_req(((struct scsi_exec_args) { - .sdev = sdev, - .cmd = cdb, - .data_dir = DMA_TO_DEVICE, - .buf = &h->ctlr->mode_select, - .buf_len = data_size, - .sshdr = &sshdr, - .timeout = RDAC_TIMEOUT * HZ, - .retries = RDAC_RETRIES, - .op_flags = req_flags })); - if (result) { + .sdev = sdev, + .cmd = cdb, + .data_dir = DMA_TO_DEVICE, + .buf = &h->ctlr->mode_select, + .buf_len = data_size, + .sshdr = &sshdr, + .timeout = RDAC_TIMEOUT * HZ, + .retries = RDAC_RETRIES, + .op_flags = req_flags, + .failures = failures })); + if (result) err = mode_select_handle_sense(sdev, &sshdr); - if (err == SCSI_DH_RETRY && retry_cnt--) - goto retry; - if (err == SCSI_DH_IMM_RETRY) - goto retry; - } + if (err == SCSI_DH_OK) { h->state = RDAC_STATE_ACTIVE; RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " From patchwork Fri Nov 4 23:19:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621990 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48DE8C433FE for ; Fri, 4 Nov 2022 23:25:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229587AbiKDXZD (ORCPT ); Fri, 4 Nov 2022 19:25:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229670AbiKDXYb (ORCPT ); Fri, 4 Nov 2022 19:24:31 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4121E1B1F9 for ; Fri, 4 Nov 2022 16:24:29 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4KhrQ9027173; Fri, 4 Nov 2022 23:22:22 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-2022-7-12; bh=06H2zVYeAsVKMHrknavrlAA1PQzNf3cQ9LEgbZtA/uA=; b=hNaDodTtIFaK61yFrLuZX2z13Ft/ESf4FomCUpjULJv2tEOOmImdZwayNHY7Uia1Ue4t AtPthZC+BlKFnbX/w1GfHjfzt8vknerLxTDIVjdviyMNAY/QZLsiSqY7py1iVa/1iIgD VqpCvU9sCX1Z763LhE8hZCwdQSOu4rYJK3WEKj3KQ5elmrKk76aVVLAhViB1KUHRkTj1 N9okgxb6NPSKu8ChYH88yqU8XgqukjTArbSK6WVrVqEOyLr+Yekx81j0CQnGzeHSq2FB u8i6wOltftIRbJcraSZItL9pKsKLRBXc/I+FuvSOzc6ihS1nvJoBoC1lWZleQQkWSxxD iw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgust16ec-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:22 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Kfewt032301; Fri, 4 Nov 2022 23:22:21 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2048.outbound.protection.outlook.com [104.47.51.48]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kmqb6rah2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ta9WDsBRqfKkCndkJbaEiwgGzUu2mlmQRTeigog/G96g/rPgkYdOS7r9e/47XrTq5PV5XTh42+nTKNklS31DskBLcR5WAlRD3nCSUNX27+wU9hwcRIxZCcRi+51LoQqfRCUZafY4UvxH7oRyuscXYCn1VESBxi2fv7ZODRrwfS2BmeHWm4Q7TFKc3QImggxdqWdBGfDwGwGrX5RGnNTPkVF/YPG8xGw6d5eepvxeGFfgtIpzVtUjn8M33ZWK1ZWgERWH5mesWGFwPYuLuQA8CPfc8+a8kdSf6zE3EWbrMJV2yva2fPW9MZ4076LSUbpWSDQhKG4Nl9BcuwhXDc1o8g== 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=06H2zVYeAsVKMHrknavrlAA1PQzNf3cQ9LEgbZtA/uA=; b=LL4rVHUMqGejuhw3xS/fSOJ9RGJlVBVfnDLI8jtAWdqUYBuTKiH60Mfl9K6TFNinTMc1kwfBXOwjVsrjiUMumGrngylgwkxRA4TMmHXdjk7ioW3u5ygAurEZwTvj7jpdfp4hdrh7sPe2x3P3q/U5VEKPYW8OmYCPiHHQjfuX1JBz8xTUChfvQAGK28clM2opb9TZbQUCOwvdaFKbpa5mLlXrcbpIivEa5d9BVlxRJ8pT6uM3jCYRg+MSx3nvB1I0pI89XRBtLS7xJ9cS0a1/9C1WOIAo+qQnevN+lK+b/urWTh0KRSr87hNgsN+sc7WedLywYIpgOOFXDWv6gun0Ig== 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=06H2zVYeAsVKMHrknavrlAA1PQzNf3cQ9LEgbZtA/uA=; b=g7p1mwKZIa1USUEVLp/9kPoH2N5gW//kwaG7ri6X5JCo7KpIDMeCvQYa5yyBoT4Y67cHWA+YlHmKPR+XgaJQ1CEMN8VjBMu5wEYsPkGiGAu88CEw40oGlGdZVcZj3NM1lP8AyVwjI8a/zMZFlX4Ij3fB2CzHdmUq5YF4YfIKbUY= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4756.namprd10.prod.outlook.com (2603:10b6:303:9b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Fri, 4 Nov 2022 23:22:19 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:22:19 +0000 From: Mike Christie To: 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 v6 25/35] scsi: spi: Have scsi-ml retry spi_execute errors Date: Fri, 4 Nov 2022 18:19:17 -0500 Message-Id: <20221104231927.9613-26-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR03CA0189.namprd03.prod.outlook.com (2603:10b6:610:e4::14) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4756:EE_ X-MS-Office365-Filtering-Correlation-Id: 889447b1-e2ff-4a62-5c96-08dabebb65b2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /iJbZhF+6DlsZLKiuSZwQtUkR0How1CoZoanGIeIU426HXWl420A7OhlZ+9Ag17Mco+BdakqUPmbON7z3ebozpwHdaxMKzdJAL1+UTusTMG8eQBvXLdhqn3bMefsQq3F/8IIDIrSHtDgqHNkjrplrLS9Tbh7x9oADhSpokdJBOHdd7q1Eq+PgQndPR/y1u3bZwPza1McLwYXsUALB6YJpMHybRku8Gy0SmNdrAZ9V8d8otRB9HiRgw6XngekY7w8wS8LY111yO1429QkQt67IEqgjimR3EoH8Qa2LN5CedlcwdAH56a3B8m8DSgtkPkldjaQEVPAvxzJUw0zS9QkJAH0LrNgxdf8CN6U+2m9T+YlQHQXU0SywCYCfE257w/L2LW7yUOhx9I1EHn0El9owUk976Sb5zzRjg4JHyEWJgQ96G6HjKVd2NCm8vxPPrnP7kIfLDkKFK3bdhMS7kZZcc03qILSkG7ekKClfX7Ck1Oh5iiNzBkoLnhmNGB9HtKJT6BS+I15hP6YThkYqn/PFs3EnM2O8os1bNHqD6gHx6KSTfqXDcRh9h1kA5ZGMbDhmp6dvcZg/7RhBm8u5+ntNi1dc1nqtU3c5N/BqIchbgQHBNfsQImdcaJbB/rlXz4Ay8ZsE/B6Xf+J4DEOhA/A1Ju/iRK9v8utGt8SHfsd/bvpHZiwkare6VGeg+EyG2JzqbsFresYlzzkIPr/LHZ9iw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(136003)(346002)(396003)(39860400002)(366004)(451199015)(41300700001)(2906002)(186003)(1076003)(2616005)(6486002)(478600001)(107886003)(6506007)(316002)(4326008)(83380400001)(66946007)(38100700002)(8676002)(66556008)(26005)(36756003)(86362001)(5660300002)(8936002)(6512007)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: m0u6Hu03gXcDvGL9OV3IfcHr/f0tE9F4nTOxazGVJMYrgfIMZAm3p7/OqGufYxMpQIv8R/asSRnRdapl1GHkz8Mu/tPp3fZTC9ge1qKsV+BYX/j6EL3VwJtlQJ5elpKmFdZWRtgpbcw8G2E9NcxXDO2CNP97sySPy60W93u+58y6lFKcrqFd7i6hIlGH5vjc25YEHghT08zo0c1k6audhDFrHqL6kw07ggTrTsL9o5uGDZPRqqW/7zGrRY28OqjqWeQYXvJ3AQ7WBXsJWHe1dYFTU9pqCZcpcKfmetQAgG+27VrxezLBAbk1fff5rPssOMTgGm6Jc3TSeLfZVwlUReg19Ah5bjwhsvlNwc5FraAYFEoGVDwU7D6THUbJjxoKYcE0QXFj118NNj1o08XHocRFPsNqUjzE7cWAyZwrbUHe3CgPVHH95XEn6SOE/w4RPFyOmDlrYNQHO1B3saK3PB07MN7JZmGiIXb/EoD+1QXGFjCy/vVt47cjm1m/NU1Fcxcmsvnz8KchXmoQYw6aX86y49lqpUPsIML5f9J2mPj9c1LHFofv+BAP22RNMDkQxX2cc4Wf2GeYJ5dG78NWRxTl/yNp6DKquVjl4Q8pO3C0JxtVfJcuqcPAX7zbKdbs15uNBfNGlSjRj9zgoXvWTx1nLBpT5PrEnXElBtzW2x6P0Gkvh6bfIo8JXxdxMjIyBn56CvP6t2RTAbFnp6f9CPwb4oikN3Qkx1gDJb0mIFn3K1AIRxwkCJZMEZzbjLUsaWIdof7fqKkNz3qlmABVdFUWyn9ezYPw8iDGg84Iv/b0Qpcr7VoyMKkVclghMhkb46IvqC5gQ5DOIrARr7sx+wNAWc1XPSNmEisAg2l0f+Q6JmE7IlEIxl1oz13uwp5sG6rhVXOYVUB3GmauD1A05zXYeqx7lCsNM4MCJs1QeLpGf7jn9S6xHgpv3yt3aEYearEZ2KOPgnxZTA3lvVoTWMJ5vL+pZcPt7M5eLugJIf3/ReqiYSabgSTB6TNU1M0qIkN7+mHrmJ30GDmXmutmqDfCE6rRtwvRmoG/zZMwtkf6GdnrypzDKLriiYJt+h00tzRt5OX/xELHiCf1aCt4BGwz6Q/fT/8OdDlPgKKwjfq3k06H6G3nqlIW4ekOmko0ICHQPNAK8psqu2liyVJ0APdwFFMTPsjmaz1s3LW/VIswUHc6t6wxPejmqJhNgrj8k8GO5RPHA07KH0/MD5SODXLJJwt1XCQCui2xn0fG/YToHWBunSw+N1C1Erzxp2r4Cu4kK2mXh8gMIZ7tSUEgdPSPH2Oza1fQicoO9V/VjePMRTFscOe6R801N6FBLK3wXwyIwfrCyaK4eQ2iwQxOyqtJD5rxIwPAPUjPtJfPSaKaY/KLFKygKBz8xP4OLwwxVz9URCHuUAYHhAhrAN4xokG/kxBmMuLx7F2qXYLYr+gvU6FtQpz+rwD24EcEIc8eEhEWy0fKDLwSGfWw42fX0Jv8M6xgkDJ4BtWaodlJM/jY0ByeW88dXLeYh3kdz/n0LKBxIwuFTvKyEGX8klVjgVnJKoPms4bU10CZLmoTgDj83sSE8D/tfU271Bmq90xJCz370R6AAqsiPP98ffUQLg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 889447b1-e2ff-4a62-5c96-08dabebb65b2 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:22:10.1789 (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: wYEg8tnWIe3JUYegDXM795iQAEokS7AkdMrBe+mvGiSI3MjJ46IfbJ/udXvA8wqpcbv7g2nfbngA+lxMOYk2ocC5+DCOwA600oJBkrF4nPo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4756 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-ORIG-GUID: aSOZBBFfEC804nnXuYdaeXQtJH7N5J7U X-Proofpoint-GUID: aSOZBBFfEC804nnXuYdaeXQtJH7N5J7U Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has spi_execute have scsi-ml retry errors instead of driving them. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck --- drivers/scsi/scsi_transport_spi.c | 56 +++++++++++++++++-------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index 18a365c577ed..b172dd0205cc 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -109,38 +109,42 @@ static int spi_execute(struct scsi_device *sdev, const void *cmd, void *buffer, unsigned bufflen, struct scsi_sense_hdr *sshdr) { - int i, result; unsigned char sense[SCSI_SENSE_BUFFERSIZE]; struct scsi_sense_hdr sshdr_tmp; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = DV_RETRIES, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; if (!sshdr) sshdr = &sshdr_tmp; - for(i = 0; i < DV_RETRIES; i++) { - /* - * The purpose of the RQF_PM flag below is to bypass the - * SDEV_QUIESCE state. - */ - result = scsi_exec_req(((struct scsi_exec_args) { - .sdev = sdev, - .cmd = cmd, - .data_dir = dir, - .buf = buffer, - .buf_len = bufflen, - .sense = sense, - .sense_len = sizeof(sense), - .sshdr = sshdr, - .timeout = DV_TIMEOUT, - .retries = 1, - .op_flags = REQ_FAILFAST_DEV | - REQ_FAILFAST_TRANSPORT | - REQ_FAILFAST_DRIVER, - .req_flags = RQF_PM })); - if (result < 0 || !scsi_sense_valid(sshdr) || - sshdr->sense_key != UNIT_ATTENTION) - break; - } - return result; + /* + * The purpose of the RQF_PM flag below is to bypass the + * SDEV_QUIESCE state. + */ + return scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cmd, + .data_dir = dir, + .buf = buffer, + .buf_len = bufflen, + .sense = sense, + .sense_len = sizeof(sense), + .sshdr = sshdr, + .timeout = DV_TIMEOUT, + .retries = 1, + .op_flags = REQ_FAILFAST_DEV | + REQ_FAILFAST_TRANSPORT | + REQ_FAILFAST_DRIVER, + .req_flags = RQF_PM, + .failures = failures })); } static struct { From patchwork Fri Nov 4 23:19:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621665 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D41D2C4332F for ; Fri, 4 Nov 2022 23:25:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229629AbiKDXZF (ORCPT ); Fri, 4 Nov 2022 19:25:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229700AbiKDXYe (ORCPT ); Fri, 4 Nov 2022 19:24:34 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8CEC1E3EF for ; Fri, 4 Nov 2022 16:24:33 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4KhqUl032442; Fri, 4 Nov 2022 23:22:25 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-2022-7-12; bh=Gf9et9b6cHY7wWR5tmwS3a7POkq1T9L/TDCC6kpGd90=; b=iQl+yF9xbDeaqK2VyiP2jYfdSXoMO29unBDZ63VmwgPJzbbxuay5AAmr2aPq8ygCqyc7 FlxSsA03rGvVnS69GL5qieOgalaaZwetuC/mXUUFYdaigyYRtMvc4vzq//7b1+kxXIqo FlW5Ip1ahOy0AeRuAblpV4FdWnlXT2C6LgdTUB5kDYJ7z9Meftxcklqe7fVNe4RynGmb lWAkU8DNA87yFNtO1A5o09EjihYpJgyFFsEsmj/6ou/5gzqF8GhKrMHp19Qt4d2PvXHe K/XlHVOUSsOc+q5LkbxPP0ez1kOZCPq/vp8cwgy2ysuv+xjd9w/uTpjiQ5rhmwpg0jkk IA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgty398bj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:25 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Jhv0D023054; Fri, 4 Nov 2022 23:22:24 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2107.outbound.protection.outlook.com [104.47.70.107]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpwp0a0n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IheXsAG8yA5tnPXq4Gyh2MyDr9zS1sjggtBmYz0ovSVDHksv2VTnkEn5xZmGqffxKisYOzwwTHHI0KNif5b6aVq49v5qspFm1S2WhttSAfU1pnHrj5Clu/4Bqv99DmUSIDunHspXpt/qpaajcDOFECXfKx8zBI21saKhbmnNbpG3kNKrpvqeuRvW37n4mwfm1zA2oB9+Be3eG7EmaL0V+EJIzirkwA3nTNH2JUJ1JYLSbAqiCqoRiy2ksprOlGCrYXSTrHNViEo96R5wID1M0Umi0YQQyMRYBes63Ir/evqP7erN8cpVb0nCSiltfxxHSwUF4cc3hcKxMVS9TfJ7Xg== 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=Gf9et9b6cHY7wWR5tmwS3a7POkq1T9L/TDCC6kpGd90=; b=ktqL9mcM2VNmiOCixMaAKecerq8mCXQYzIRBMaeXbMIcpWTvMo4cQuAyQ0vyayfHWqy6cqafBWlnPWCWEbBM3uAzQGiHMcKfRA8ItU3Y/irwIXfCoaq7ySx6Mg0r4gK4sfw2x1WtaUfeCDX0TPUbqssZquDtQOUh1LSyMkmaKgGC6hBJbUTa9VUL1ZV4zRBjVneUlgpeDLSmlhESwaN60paIp1Rrhzq74wR6H93URUEcJ17nFF0yDsVomcUuOY7WTepbp3RkeEaDrpdrLQa2oZeCcENOl7e6PlDyi5B7D91pLC+RktDDn43W4jr5WOPqNJUzky56lhtZUI5dtue1BA== 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=Gf9et9b6cHY7wWR5tmwS3a7POkq1T9L/TDCC6kpGd90=; b=V8AJX97fuj8F6lY/t06DKE51AX05QBuRLsIPeIJs4MpTi1x9qEx+vwe8yf2cs+gr95WDNMQP4+z4whATKYUGVXequlSciN8wrUcfFWVFaeAJPCKK73/PsfX9mWfTU3XFwpYRalWWrHzt3HMJUVukkweofYgcQeK4ppuJ9SzgM5Y= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4433.namprd10.prod.outlook.com (2603:10b6:303:6e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 23:22:22 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:22:22 +0000 From: Mike Christie To: 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 v6 26/35] scsi: sd: Have scsi-ml retry sd_sync_cache errors Date: Fri, 4 Nov 2022 18:19:18 -0500 Message-Id: <20221104231927.9613-27-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0P223CA0025.NAMP223.PROD.OUTLOOK.COM (2603:10b6:610:116::23) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4433:EE_ X-MS-Office365-Filtering-Correlation-Id: faf3f506-9879-4eaa-d749-08dabebb6694 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xlg/Vq+pyBmR8J2VLduu2/kw4ZRusKxwFeUbq4jF+yAI8VJGwVrqU/SjZAtZwu33sOyr0l9yfIFU2oOhWlTxOMOtudR12AZaH9iV7ZC2Z7MsjgDtQ+QWyaskeFg4/gLOV2J2cf06k1oijvaaWqlRKBOCIxr5yyk0HPjfAZVICwQkHuaWRVAYZnBMM7xzENbtndFSsb6DbD4mBD1XgZZX5MJ0YBYj98SmcClbiloM1XUZcXLao9Xrua9yYOebimIO5I/YyvqD2elsj1MYdomkbw2U5VoX87qWxrSpSfE0hdLbDXnuke9qg+es7COpA1uX+4dBAeAnNiF0wti+zzDzvew+vO23v5tLw8T1QI5gqxcR2PIDV3Aedy68iY3laBZLgusMCextUYu6oeTDhtUR9Y9+QlPoKZ2tDlHGVXoqMf7/l1aHpmUviER3XJLUPi72kQWFVhaQwDHiNxxw8bFNTzHwL89uaonOjBnRBTD/1r3YPfsJbucvbAfttcfZpE7jSgIGfcbI6Pu5WDN+UdapbpTMBeI/M3dUuu/FczhmNeConJ24m4yL3/MikEvjiZ4lLvUqzrIyUEniqb/Xf2RodkH8d9zoIGvDUcbQ3SCeZ5ByMocC9DZMqaDiT3OMVYJPhNTjWPXqjj5A1wLzZALObjVdYG9bb9wgLnB6Z9UJ9TRXoz6lftEedzuTrG443FCy6aLwkYcF/6CjjUPbf0fL/w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(346002)(39860400002)(136003)(396003)(366004)(451199015)(83380400001)(8936002)(41300700001)(5660300002)(6486002)(6666004)(86362001)(478600001)(107886003)(8676002)(36756003)(186003)(1076003)(2616005)(4326008)(6512007)(26005)(6506007)(316002)(2906002)(66946007)(38100700002)(66556008)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DQWTSfHeBoHXrb/Cu/LrLNbk7PiMsekm9ARt9Kin1Nja2G1EoLDO/ZMKKDjEN6bqWBDhucj9hbXyhnarQkEMvmkC9AVS/KqrykHNhf+DME3gWUc7cCRra33WJbat89iLxtzNEczhELzlObz1cOCB5wByNthC3I87ci9U2nV0N1a8p9XAz8IBsG7oSLy2VLM97pz4tAnUaZzEJ5aLMLg+f8BRGI6W4RgLgGPEbUaT2fnJ/nxv9CKbJJ3TEgSFu7jX6ig01arpXerVU4ykgnDljIDLwESKDsTM0b0PzOyI4rQEFGdIZrULbl/4mSdbfYFPtIg02OZ1EJkCEVPxL2yUTm+MGJB2DFAmoO54x2ShKcos3tcoM8o92FgofX86QvP53y5BhK66FFP84PKekxpMk4l/gf0p50sEIOFDIwlD7Sc//CUUfV4WgbNA2PDfrocaAR+D7245RzAxwtV8Pc8fPD+zla97DsTBP2uNCB6zoecVkfPIzxVdmK+GwfjORX6W32q65W/Wnaxoq+BGteGNBNC69ufbQAufkjw1llmaZY1C+P9/2rEWxKDEqn5rxOTCBagE3hdLtWXSoVq+P40+x3xQuI7ZtvnAh9oWOmZfO3bgZkw8SglQ7YKzjj6GcIpPB1PlRng4LiY/UFH2ZYJvXptfcoXgXwnLfyTH/eJeVO7b7MdN/CYX5DO6aW4Zk8KwB0iwpIrluKkJX5O2hZ8cSVQVT1uREHmgRLwvlZGlEeSuwr550Yz0f9hEWth2Ti+c1FO5QVg6B04jUEa/U0WLVgPcQISq1TyBwdWGVMbqcXoY+Pmh2QOnE6YPe6Rh4bKKkT8sRUwfX7cK6s8uJWQyxbNOpqtIE+35NSsdmwDzrO+d+6/8Cx9PAbAmBOIHFzFBxt7xaJOf8dy2YReScL619T6+vlOfTJi1+X/45mnzA8u8uhmkjjAh+QWhQxRe1e25PrryzJL9QUE+XaQs5Op1SwCKJURGsg2H1FNfzrBNMJdld8wdQ+6E2IZgmRYZWglaw10NryRhI2Zc8CiLlb3WIH+MeJicgtG1aiXV5Cy/e9M9P9hXMhtUkrYkCVbjSHsi/xbOxeRId77uTrBcxr6GWEBznTHgikRuPtm3Y82H/YdT7fty6U6dOVwfSBQxLTxlQWeQDS4Kd6oJ2YhDFnY9liy/UcZayDjwG4OSPZb0uxGAjnYtS0AQC6R3mozzzl32W5J5RmHDohkIXvSWxlLxOALtqM7FQSFqiScDwEs/oOsxUOeMAi0swys5YHbUCj2/OBqPGcu0fGMBscKJUvgkaDc+7cvK/UVAKlDACQg44L5/hMUJZCcxM/ziSv1UjrKUAy+NpD21ZaqF/yRmSM3M596KzV6V+YN1rHSMadCCS8TZ7ImHf28kis3Bmy+tlefKZJbwhXvCwErspGrQ3Ptzcc01jAqy2cSZBXk2MSv+BB8n0giKKh2Xx5CP06bjeELGJdWVS73U5PVCVy8uhQL6TzHTp034LUDGTN+9SvZJT8a7s+GgPd+KvM1ZvyEzQpJb3yOSitSVXqlmMnZ1+xQDTePZpnTog/In+/mmRvssrMnnpLLlOvH6rUkRaxg5PggWvHkFOi3a5/cp6QGW6x2IVg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: faf3f506-9879-4eaa-d749-08dabebb6694 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:22:11.6788 (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: /klATP9/VjymsQVx2Mr5ssPZj90RL4/Kvq63bneGIgbP0/FzUOZFhpfgnUcjYeSZi8T8hARcPGF1ovjxfZwNJST7NR3I2o5z4cg+T+ChPJk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4433 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-ORIG-GUID: 51YStH_M5GNI6uN6DH6E--iMyP6mwWYF X-Proofpoint-GUID: 51YStH_M5GNI6uN6DH6E--iMyP6mwWYF Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has sd_sync_cache have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche --- drivers/scsi/sd.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 66f1bc03e219..a07f569b5812 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1580,11 +1580,19 @@ static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing) static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr) { - int retries, res; struct scsi_device *sdp = sdkp->device; const int timeout = sdp->request_queue->rq_timeout * SD_FLUSH_TIMEOUT_MULTIPLIER; struct scsi_sense_hdr my_sshdr; + struct scsi_failure failures[] = { + { + .allowed = 3, + .result = SCMD_FAILURE_RESULT_ANY, + }, + {}, + }; + static const u8 cmd[10] = { SYNCHRONIZE_CACHE }; + int res; if (!scsi_device_online(sdp)) return -ENODEV; @@ -1593,26 +1601,18 @@ static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr) if (!sshdr) sshdr = &my_sshdr; - for (retries = 3; retries > 0; --retries) { - unsigned char cmd[10] = { 0 }; - - cmd[0] = SYNCHRONIZE_CACHE; - /* - * Leave the rest of the command zero to indicate - * flush everything. - */ - res = scsi_exec_req(((struct scsi_exec_args) { - .sdev = sdp, - .cmd = cmd, - .data_dir = DMA_NONE, - .sshdr = sshdr, - .timeout = timeout, - .retries = sdkp->max_retries, - .req_flags = RQF_PM })); - if (res == 0) - break; - } - + /* + * Leave the rest of the command zero to indicate flush everything. + */ + res = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdp, + .cmd = cmd, + .data_dir = DMA_NONE, + .sshdr = sshdr, + .timeout = timeout, + .retries = sdkp->max_retries, + .req_flags = RQF_PM, + .failures = failures })); if (res) { sd_print_result(sdkp, "Synchronize Cache(10) failed", res); From patchwork Fri Nov 4 23:19:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621989 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DEDCC433FE for ; Fri, 4 Nov 2022 23:25:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229700AbiKDXZN (ORCPT ); Fri, 4 Nov 2022 19:25:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229642AbiKDXYf (ORCPT ); Fri, 4 Nov 2022 19:24:35 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9F9823BF1 for ; Fri, 4 Nov 2022 16:24:33 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4KhvO0026517; Fri, 4 Nov 2022 23:22:26 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-2022-7-12; bh=5VBOIbxCmCDCbH7p7/9/NxCP7ayVegHA6gbJGxtXhXA=; b=H8DxPdmWobdwDbb1Pp4oXujbNpdbLJrTzSBVEA4LcRIsbvZVocgEPXKmMlCi/teD602l /ULiY3oiOPWN0YriNIgJd99rfz3SvDJnwrChbtREmF7zkD+YOZZPyw20OavZuyhQ8rNH R7TmRO5wss+a0CccogURt2QdSB7Jk/6RKSWoNWDPixLfvZWac/E2LGbirZ34qr+0Wbf6 H0NnXbId0F3AAKBEmHOO1OUOPWQqJcUQYXtMqHydG95xyknLxcOURc5fG+KGhlrKR8Nu R1juZ7GPbB6DqUpMuBKsakOWPxrfpHL3yin4d4kdRhRUgof5Aam9T0eAwV3vQBxMl+CN yQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgtkdgf04-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:26 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4MUQ5B029964; Fri, 4 Nov 2022 23:22:26 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpr9a9dq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dkS6x1rFmCnGjkEmQeXuKnt9GSUsNuDI1/H31l/wUYPQIdwPFIl2H9pq+z2vK5U3vNka46YjmuWTISLKu7q/igqsYOgl0NTJxTfGdVqy5BnpiL6M2rrOVyCA89BAHLzGF0BRFW6h0JO5aI1XQONychnNA/BhVYTHiMEjAFKgjaatdy9mD2uRSJYJNOYXbd41+S0nR223nxzPO25iIDzaDIEZU6jd2xfJta59CK50tkH/hytmNYM3dO/s+7jajzO3iQETht1LzcHbrok+S5y5q/IDH1NtrQd4/M/bOO+8NSENEJnxzICkSARdDOnv9tUMgThO+a4/Wb2cbNwS8tk9sA== 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=5VBOIbxCmCDCbH7p7/9/NxCP7ayVegHA6gbJGxtXhXA=; b=QmiBsFxt9hU+xY/tKrjR/cYe055uu5qUNI/J5xvTTFyZo9YYBHhpN7N60oeFIDzwmLWCL8sJ8qFXUblSupu8IGKrkqynEDAevAarytr1SF5BJJATPutNO08oEWtWsGQKFAxw9RA1m5m1INqGo60eDvI5oY+ctH5hWrWm1/SYZuZ7P1dAayajgImvuvm/2IvNiah0UZ8puj6xNa43FLJn7xCMqTrVKn5CXyrNbjjdm5o2icSQntDpDAjAGMrdlJNMm8CaSTj8wB8AWU6NMZFK7eX5Z7u4ac7Qs94dRIql4x2O4hjuSTz/6T8rRowoAHQdVA5MXGI4tTs67U+NvtuLFQ== 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=5VBOIbxCmCDCbH7p7/9/NxCP7ayVegHA6gbJGxtXhXA=; b=yJcu7NFGuQpYW8kVGD8IqsO6E3gVWMY9WqHPHo+IkoTIXNikuMn0GHCmdJkoBYrC8fdLC8xBARcxv/3+xJQvjBICT17YC7sSsFqWalK0tzMKFt+rzAoNw+/lw0s2N0w2lfoQORIfZamZiTvxYqVjW1Z2kf4WPlTfuWuo61qAeso= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4433.namprd10.prod.outlook.com (2603:10b6:303:6e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 23:22:24 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:22:24 +0000 From: Mike Christie To: 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 v6 27/35] scsi: ch: Have scsi-ml retry ch_do_scsi errors Date: Fri, 4 Nov 2022 18:19:19 -0500 Message-Id: <20221104231927.9613-28-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0P223CA0023.NAMP223.PROD.OUTLOOK.COM (2603:10b6:610:116::22) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4433:EE_ X-MS-Office365-Filtering-Correlation-Id: 0009220b-b52b-4c76-8f68-08dabebb6753 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gvZb+I+c/iacqmmhIgcBRPi4ZD7zk2jeXePpnnDEFKR82yklTaHsnG0Ft8vX46AOurt1gHpdXAqblG++fi/SnFRDq8TuDd6KeXCJhnhzPbTe4ezvOz8w4gkhJzG3OTlPlsvFAMIvFP/jaIA/DqNWdOL/c6SqZR1DimOMWm8N4FyMeIKgJmUeEBXmfTcemgsXyRlj/844vhzi0n9aQ1lMtYpMNMduEdTd+BRFFB9vvZUowHvv6TCmTyG4T5t4YVxcQokbyBspXikzXHvDGWwDpOIt/ud4f9iidGRt+RmwFsUPUrffJm8VpZd2Yc1uiUufjTQxbu5fPrk2Sk5K4tQ8vrlbtdtgjPtKkqqeM5C6iKSM9Q9ZO418PPiqdvVmEL27buJjNEXFtd0TETRIfNyuVvbiHRjmNAxNl37/g9oL0zz6qIo7uVl7fFb6laYFWAP/Z8SAL2NFKp3Q/tJdGnFwcyoZQjVHLi4OPpP6FqM9OR8KCCBsby/uJRCRA8+adO4uAJcx6JO5FgzRwSnjMZQEKbVloeIPHLSxuAbapLzaQ2siiu9e3yU27Vg3dwm8rDIt220Ge8eTpkH/z6WrYN79Im1Y2j4ZKqE5pCVgss/SqX1C1xs2XGwlRnoZ7AaAlz4IIRcIlloF5QqS8eW+WZtZYfU0a3HBYbUlmXlDHvRuWpafgIuFZEzdcWYGbu4jFeiaFVH5LV4rZTr4kG1koDqulQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(346002)(39860400002)(136003)(396003)(366004)(451199015)(83380400001)(8936002)(41300700001)(5660300002)(6486002)(6666004)(86362001)(478600001)(107886003)(8676002)(36756003)(186003)(1076003)(2616005)(4326008)(6512007)(26005)(6506007)(316002)(2906002)(66946007)(38100700002)(66556008)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DgUOW82DFMw23jg8b/o8z91bZ7ASae04neS+7MJjtbxEolg1uGDvtWfZaXgPuUoIoM8r/T4Z90u3M6r4xUAAdcZ78QEodbl1WlRES+g2FccOZCgGZ+faV8cAC2pD08Tf6M/fB2iaWV0jSNIYiBlwEkTALklztdZnBmVpChwqJAP4sArqa9lXTakkWVsWcWE3hpkiPjlxG8NhSIytj5aUzPb05TdAcbWvZcCaFTmwuugriScetaLjqNsxQ08kYZPfyDl7G4ynVkjYjpRL9daHKGJpjmqyVOYwxPUFwqELE8Ue61U67pwo8viZvCKSRhVMzY5IvwTXhcp9BfIYrg6pgsOv8QQ4Li5gaWG09vLg4zxoaOOE8SEyh/LHTl2nH4O3gGBdmHuhbjlHARpLHKMkqcLOdy7p01vd9N8Popu+INGKSC1ThVyRzWAvq1ZMVSRdegACJrX0Ga+BUZGTVOJR2l03u+96oiDPNmxLdAZsFOQi/US6C3CmWyaBZRYXjVBB7KL3+iN0sKeQXdgaixvl0KgD/t8Mh7pR7NnsqKZpAgzoiWuDWzg3jhZhSCuqlKDHw3dqWEcYmCIrJyCv6uG27tMiX64OFryzyGzqDKGomXMdE24NGI7s7DIfNotaqrulstuVgj/2qHdmwRs8ia2R+01BkD+XXcp7B6XIMY0TzoN7/q9dkMU0DPq3/BXwPFYGyvQo93yqmY+pPbqOnSEKDRqKIuGbODbkrMNl1vcdFkllo48Y1yBLOCuLYtt1z4wASCLCucJtOblZN6TRZxGpZbwmU/PZPIoikCd0UnLZCrCcYcGeO9d9W32JxxDCgmpYAi/6p+sYFJYD/dr6Kn4L03SBQH4DBUstcJvuR2KKDfpiGqKtor8JDNwI46UZXQgmW7hKsoZ2dGC/D1D/EZ7lfBrfOC99fqd7gs6U53A2xfIfqI867xYItuOINxkiy/iyyaJmPmR/kCXZCKC/TzNauaYLw2Mm3kevPyiEWBVNArZ7J8rNUWgxTxK3hf4Vysw6QdBh+i9BZmimjZaKU5Ks1uBBWbLULeDNrLj7wC58wq27GGNr9XiVrWImNNYDISjxe2PzrdAMg2nkttMP+X/nk9NbqbaeDSbNbm5VAQi+KVWqxjjngX4DshYydXnyfqBx1IMalGoXFwHQeDaVkq87RLDEImky+p/bCMKMPQ2DfD1Woi9O5X24cc4+acOGOyIagqhBlej+9o1U1PoF/VhfVGACPqnqTPztoRFUUGpCxecnvOhmuBFC+e2FU/ddncCqO/2o8oOAxrC+DgYoMLClKA7yJ1EPKRnV5yz+baY3NxxTo3JAw7BR++lQYFkUWJGL6GzcDX/Dqn74frjv218G5BR9l19UFuNkXVLM6v8ixCnqJsYwGAS9gb2I8AOyBYEgV719xFCEF4tVsqDQnNmkKrNOWK5Q6Xq9der/M1QaY15TlJsjRDON3hpGXgN3Bo2bPp1fptYxj9InYClpi+b6Nk4xpxztY0u45nh31IaPv4IFU4kdfJYfBvgTteA2aKMFALxOiUri15sE+r6shzwZxX3/mqgIaOkWenrM6TBPlZAZyjLEYT48x2Z9GpfrEkzMReQky+2JSZ0FPV9mUPq3pw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0009220b-b52b-4c76-8f68-08dabebb6753 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:22:12.9287 (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: U/YsYOlYu8T2DhESvLV2MPeYVRHPCaEi4ewnDRU43ecYOyGYtTZOOXYbokH9vtAt8xkuAsSrTg5T+kUusgwt74if7uhjvsbitTbR3Mijzvo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4433 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 suspectscore=0 adultscore=0 phishscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-ORIG-GUID: s4E3wrNSqaKeIfJLdX-kp6vwVpEHHTEg X-Proofpoint-GUID: s4E3wrNSqaKeIfJLdX-kp6vwVpEHHTEg Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has ch_do_scsi have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche --- drivers/scsi/ch.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 511df7a64a74..015cdc0ab575 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; @@ -187,13 +186,22 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, void *buffer, unsigned buflength, enum dma_data_direction direction) { - int errno, retries = 0, timeout, result; + int errno, timeout, result; struct scsi_sense_hdr sshdr; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 3, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; timeout = (cmd[0] == INITIALIZE_ELEMENT_STATUS) ? timeout_init : timeout_move; - retry: errno = 0; result = scsi_exec_req(((struct scsi_exec_args) { .sdev = ch->device, @@ -203,21 +211,14 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, .buf_len = buflength, .sshdr = &sshdr, .timeout = timeout * HZ, - .retries = MAX_RETRIES })); + .retries = MAX_RETRIES, + .failures = failures })); if (result < 0) return result; if (scsi_sense_valid(&sshdr)) { if (debug) scsi_print_sense_hdr(ch->device, ch->name, &sshdr); errno = ch_find_errno(&sshdr); - - switch(sshdr.sense_key) { - case UNIT_ATTENTION: - ch->unit_attention = 1; - if (retries++ < 3) - goto retry; - break; - } } return errno; } From patchwork Fri Nov 4 23:19:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621664 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F683C433FE for ; Fri, 4 Nov 2022 23:25:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229676AbiKDXZY (ORCPT ); Fri, 4 Nov 2022 19:25:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229537AbiKDXYk (ORCPT ); Fri, 4 Nov 2022 19:24:40 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F6D419C34 for ; Fri, 4 Nov 2022 16:24:37 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Kj6h5013351; Fri, 4 Nov 2022 23:22:28 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-2022-7-12; bh=h+4cg5VtFjy6LUC5EuUa5b3Vyu9XDBXBZUbYis00cLk=; b=mQPll6Jb3mxrsi2Ibb58x2+QiT8Ef444duigA6yvHfQsB5TkUzpCaIpXvakG6gE1YRqE Uh20iFrc3AhEEI+xYPwDMCJnjts87QJs1XwG5NyHIMQ/yUXRyMIdymSPfoIvvPN//nhV VBMNIqsJH+eXcfBpHz61eEXmqwWDQn4/7eiNPCBGuvr75E9ttaf2FT0o+IGA6GY38YF0 BmlGHMQE0LCuoIeHo00C16z93FcXJn18Fq7R75dKdQLBV3HatqzUd1SzMWOY4IGWy0oT iIZvWmlE7JL5X9/NNE0TI28XvcgAgtN6k1yNYLazaMrV9sJ82Bu8MvbUE+/iJi+YvpkW 5w== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgv2as1m0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:27 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4MUQ5C029964; Fri, 4 Nov 2022 23:22:26 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpr9a9dq-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oYKnLn+MAvAQDi1nGPPDXubXIzFuRDI0NQI9MpnHKY5W6QDg8wHCRQx0+LIyRot2CpFeVwqBN14YJUSZWz9c2lyv72/7KQXKj4RSLSqv8egPqwykuJwJNffpRtYkbXhmZZKj+3oa2Pm+AJOHNlISM79+A0XjPZhevjuLOVWqcg5UpkU5yrQwDRe2MzrGi/J09gIsAhxfcCmm2lZlQZXIsgQTOflnRwjoBXvRIpAmhzd494EYF2PiOb/DmZXWvKw7ELtym4MH/6Q71UK+LZTs6ZjIbszG9j9GLu6WnduRcqz/Mqx1iaWkjAzUUr3KHN8ll2+kaF3I2BceTB9nTQ1nFg== 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=h+4cg5VtFjy6LUC5EuUa5b3Vyu9XDBXBZUbYis00cLk=; b=WtrvicG1+ZA8wy7VmPcvNEDkX0fUBsPaqMvJJSXudDT8LbrxywOwe481LEpeXvBZRDt2VoqBXeAAJMhHflytBRlDvOsYoAdjevuZAJCGqipk6xmkr75TGu3ZwSwTFJU/Sm32pcyCq5OZq5zR2AWXcoaufoz7BJ9Wxe+DeORXbTA+e5t+TfIf/Zq0Sv9Bd74nJbLZY0iPLaFclKTuEGZVPRgsPUegcD76pK09nVcz2HMu3U41UIDtKwJlcYCoX6mLWtLsNsDsfPJiUlLwrFUYvKgNGbWminAXgpaMyKQxifyevYLh6hv/kOtkbmChoJVslSckQBqcoQ4yJ8YFf9XyrQ== 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=h+4cg5VtFjy6LUC5EuUa5b3Vyu9XDBXBZUbYis00cLk=; b=uP/98zEl2gVyT2VdvL0mK9mNkLraQcYbmyqMp+Hmgu7jp23yOeFu7OS1ZfEU21d9l1Pb1QkJuwOOwln1TkKfKNG7cedDcbrrCP0Mgqc2iL+KZNe1KRgtI657mTeCgHyvlasdWu/7cDsrEsagWkD7Mq1lMfHK07rLqdxy2fm7lRg= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4433.namprd10.prod.outlook.com (2603:10b6:303:6e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 23:22:25 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:22:24 +0000 From: Mike Christie To: 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 v6 28/35] scsi: Have scsi-ml retry scsi_mode_sense errors Date: Fri, 4 Nov 2022 18:19:20 -0500 Message-Id: <20221104231927.9613-29-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0P223CA0029.NAMP223.PROD.OUTLOOK.COM (2603:10b6:610:116::11) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4433:EE_ X-MS-Office365-Filtering-Correlation-Id: ea9aa786-cecb-4902-bc42-08dabebb6827 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6ljwFXwn9/+KVX5LxkBCDHl999anKxj+A41uzUYXMgX7dzQMGG22XLy+Ps0/ntI5fairj/cuZQ676btZDuNMosXHpUfqPUEiBTOxUkpCyrs/PJjHu1IKu6jGKPvf2n4okS48lmuSBkxjy1sicJPFLqm1hWSSMSXEPU0Xu/wlhjFZ+I4rKicMfLSGVmKcfJU5z49bCwJohF1OJQDGtQwxI9Fx3Mn6o9fCbF11F6en5IbD/TtLXlg80VMVJq4MBXIkLzQ9y5934bWJiAt2j1jnpHZ9CiGmP4DGjWAGnGmAnG7GPFt6mBrdfhpJj/NUkJSO7XqkmZaAKojcc7eKbpQF8AcNg2sHO/cloX7tKsuS1KO+/JZwexSSK+wBVopL1PiZ6Lp9zA8EfHFhMwU97/vHWrBEEtkAk93TXDtTok22doiCRbQ6nisYMcClPKze+OiqMH2v5BM51ETbfhw1gG9886lxZfa0D5G9JOSGTeC9VsLn3beJxholj09UdBe94nFrgRIB4uDOggI1DFZojrZcqXKVVkDc+OxI4v96eSNb76cXMtyBGSR38Jdq0V4wbNv2A5Sn13+Zlegi5NzZmrHjgopHmYuWGodrMn5liEIQrBtU9U86ng6UkUrF5fyAKrcHknjdYHBUKzeVIs42tW9uGLCG4t4/eDAyjdHDQNo3DsvD5Xg78foieMAlDOFDvM7qLwbrs35HYFlIDVWFLQLuFQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(346002)(39860400002)(136003)(396003)(366004)(451199015)(83380400001)(8936002)(41300700001)(5660300002)(6486002)(6666004)(86362001)(478600001)(107886003)(8676002)(36756003)(186003)(1076003)(2616005)(4326008)(6512007)(26005)(6506007)(316002)(2906002)(66946007)(38100700002)(66556008)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sXG/846wdnfyeta9Bjw7z1afiNC2nNqiyui+hdF6Iy2liZqMpSMviRb8IVSfVhYiY5lk5b+5UMzrePdYB1h0qPatxMw6yXOBiDR6ixnRyb8EcUSsDvPrHX8xs6EE5PsnHlRp48uR456R3M/zMvR0KeYM4iyBWSSRfQRrIoRHxOxq9cF9wWJwpBMpH7k+SVe1nGBS6dTXVf2QcYtuxvnk0TsNzqj30fKaBL0hWXjAE9CfUl1WeRcVHCw7StmL1Aj+Xy/BXNXFRbOeCb+RpfoJRchtmWqLl9VUHZt9yeIcZ+96ey8GMoin0es2xJmv/gGJzI0zMK46FJxWeaTZ3jlRQui2/H5ALYBdcgVf4QAQVK8EmIsRrcsC97xyHIYuRY8MHpyb+DnJtBROASgI7FJcoDXJ0KAlqAOMSm2GfpNrp2b7OtlG2C63JJYZ1vXIpoMzWSNrt6sv78G51vYTBi0PoKdKnn1Uz2bkgEiNVErTALy5J8QCoZIE3Pl41OVF2tvQWXuIlruTEjBg+YxLpW7DQui2hlO6fS+RbVFryvqZeOPuSwtR1xupFOjbt9CANJGlLRwok/UEdKGV8lruqeP/dV1nsjUDv1UAkjN5NTLeyYJFrBUDjBc7GD5UMPQXQFPu3vDuk9AMNdQ/JpiczMZsinU/+oW3RHrxJZ5xWvbK+l2a3ufW6HdTDWe8J6GeXs7x7yEa3kNPrH3jpovkOjuyHxa6rfQTONOadTse5ysvrUdGmYbIggysmcJON/ZbEO2Z+MCRVnb5Zsl3p4UdzjS5Pt1iMoM/hY8ZvD0eANc1iA5Fi74RBwUL2q+frRS6NjM6/ab7nhIVdlaSUrzIZ02sKC5eXnQzi5838+DW/NqlcY3hH5OTThd+SzP6NGr6XZzoEiMO0KGVRcS1uskB8Zh+PJeKmWajme0Evimx26IYAIWUftKOGdRdqiU6CQQkJciYKfKMCBRQw/VP5fRvPHJidbnYZSs7LsEqoxiJv7CwFW5BfdKcuD6B4e0/DBcSn6DTuuT/YahwvZp6JcHyUfzHP4Ch4ejNwzjGGWTvXaI3BRcEf51hh7j3I8Y9qn7xJRViJ79V5GyKq3PWHRzlrku2VmoeyBzZeLQU6O32dSCTygAFJvJCZqbS84yEu+GyERdeP5HzfSBXlZGjHoag9sqN4Ha1D/5o3zOCV8MEt0l/MBGWYYOxt7syMSDf60KUBVEJVZA8qAS7t2TRlAUsGz3keOG4Kr7wnnDBekVKtl/Qj6roQV/QhgZ7pDRnX9F3k4/L8JRhrGdPzwRDDteXIcjY4YuXRUwZ3mmiFA9vaqzYM68lr0ziCRIduvK1YaJmLOKak8OwSqUhqE/EZhyhpQ9/pbNKSHWFiQK4qzaBHSHQ2w6Qy05wqFDoZOMcg4Vaz4NEn6oOtwUmqIeThZDyrGKJsiNTAESESJB0K9nglDAxMPUvaGtVGk926XeB3caf49K6LT6hm8JkiEwQxThAuoMe8N1E8fGo4o0nCaGkA9bSrjG+mpM1DX3Guq7FIcxtWjkngdiz7u0cTh9Qm7tZTQSdVF5dV+92Fy61HvGh30Wak3TKthN7k/WaETElKd4VzOUe9c6Luok4wcryk6pBq74dmg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea9aa786-cecb-4902-bc42-08dabebb6827 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:22:14.3192 (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: gXo39E+Ec4T3M8tqMWAcuCl3merOhLUCr5WbkFq1QPopPLBH+IzB0uGUejIiTE13rq1WX94PzRogF6DIIPhmFyRilHDa4PILyrXgYjomJFU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4433 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 suspectscore=0 adultscore=0 phishscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-ORIG-GUID: oXBUn0P0gVaLtFNeCuz20uBkyXxpBb-S X-Proofpoint-GUID: oXBUn0P0gVaLtFNeCuz20uBkyXxpBb-S Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has scsi_mode_sense have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck --- drivers/scsi/scsi_lib.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 8b2a9388420c..623e53fe9a84 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2160,8 +2160,18 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, 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 failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = retries, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; memset(data, 0, sizeof(*data)); memset(&cmd[0], 0, 12); @@ -2203,7 +2213,8 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, .buf_len = len, .sshdr = sshdr, .timeout = timeout, - .retries = retries })); + .retries = retries, + .failures = failures })); if (result < 0) return result; @@ -2230,12 +2241,6 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, goto retry; } } - if (scsi_status_is_check_condition(result) && - sshdr->sense_key == UNIT_ATTENTION && - retry_count) { - retry_count--; - goto retry; - } } return -EIO; } From patchwork Fri Nov 4 23:19:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621988 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CDB3C433FE for ; Fri, 4 Nov 2022 23:25:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229650AbiKDXZZ (ORCPT ); Fri, 4 Nov 2022 19:25:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229767AbiKDXYk (ORCPT ); Fri, 4 Nov 2022 19:24:40 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DACB225C73 for ; Fri, 4 Nov 2022 16:24:39 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Kj7eT012102; Fri, 4 Nov 2022 23: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-2022-7-12; bh=uUBZYOqaE9VdbwFOZ94L4akeroQTWGS6NvOmHvPkkP8=; b=uk156CXO74OO8qkYRm+TtK74gzCipj6b0i2eY8OCK2UssOqez9em6J7HfFHSqukT+mQa 3mir/CXZvfxNqvLWTTB3j66ayVVySMQh3w68UG0GoUbBASCQ05AcZ+7ob+Y8STjgM5uE aWMkHlqf1X5mBivuBJ+1XwfGABw59Cy5ae+drgb8/HX3S6DCM9TneJnCQa88qb7gsWgP d7SCxFCgr5R52iLYKViwA3ZgKEXjshlAzJz5dOv6063G/iB1U7RurEwrV1j2YHTXpzCv TF5il8uKVi85Y4xJcGyA7NO0QMdDSbGkRvguReyLrUQzsgbHQ6KogrMPZVnsZSsIaoQB kQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgvqtshwn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:32 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4MWN2s016504; Fri, 4 Nov 2022 23:22:30 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2170.outbound.protection.outlook.com [104.47.59.170]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpr4ta83-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J2V+1rIur5sQD9PUnoSxvNITXxtXaOwbZdQSToWm5xlvsTAb0UNWRY0nOZW/cEGtOQCSpYwTTT9iaUfAVjjtL9dndfbcFZVGhJ4B5LfCJ/DIoBrqt/5Ic9SxQiaUPfc8OuFpG5TW5Mz5gUgPLeuG9PbeP5pCmbm/C/wiyDt+dtd/3aHVEF0viILaRY9/eYmpxLfkAG0giAVPy1BhoXTP0ovOM5xn2NUL2nHG/C14/5zr/vv8kCRTNWcFGwQxZ9PjDuNDmUHrvwTCNNsqJBYVGznXyL0JVAzLKY4wIdh7LUPPcCNitlY9SuRer2O8K06vIaCkQbpFOQyjrCltRxcgAQ== 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=uUBZYOqaE9VdbwFOZ94L4akeroQTWGS6NvOmHvPkkP8=; b=L6FXZa2QWbStjxCiLELtaZuakvMdg4DB2KNC43QvC4BiyOvHp5IOaBA8KeiKEbjuSJ2RdZ5TgRRFS00HwAzOUGysQdro40s7d5PO3drbl6qWD8EcXOAINssq1khg+JGSGjjsCyuo0+OQ0siD35aEKT4+OmGqGtVZTYO8syNxsq5KVNfqUjjfH4sW2GfCb5bxW0mK2sqs8RXnO0s00orpexJD5Wko/v/aK3xKHcqiXT17D2Kqdbc04NvoSYAJhIRP1z6FMsl1mqWwdzOJ9F0qhihIilscbR9h6GqCvSWNRqdls6wybDuLYHfdZna85sX7/YKNNCe0COvZOnBAdIXCuA== 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=uUBZYOqaE9VdbwFOZ94L4akeroQTWGS6NvOmHvPkkP8=; b=cX8PdBcZztm65fS2alIpsDdu4FxFc0+Uh1IyRhvK6Fvf47eb7mRXWJTSiPDmlIqMY9XyhAwye5ktxPfXY9BDti8G7El6LO9rbXT0LNCNd/CU8eZSy6bFqAFp09hbfRIEisqZabjpCPxh0iRBM69Nf8oLYsd5lLN/VcCwXQXR8xs= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4433.namprd10.prod.outlook.com (2603:10b6:303:6e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 23:22:28 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:22:28 +0000 From: Mike Christie To: 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 v6 29/35] scsi: Have scsi-ml retry scsi_report_lun_scan errors Date: Fri, 4 Nov 2022 18:19:21 -0500 Message-Id: <20221104231927.9613-30-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0P223CA0009.NAMP223.PROD.OUTLOOK.COM (2603:10b6:610:116::35) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4433:EE_ X-MS-Office365-Filtering-Correlation-Id: 87cd9208-b6b7-4037-0dfa-08dabebb6922 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pPZj9Sa2381yCn3FK1kmpvil8f1eC2kiMeUfT1AX9SgYNPlj30F0sdOWYZg8cKh/6xW+1Py6TStOhO3M0GCVDCDG/zOiSFgJpFLMQZUQ69gsYumBZERDvA4lcKf0vwwKF7OjjJaSxAAz+mE6eAs3m/LzhZQHDSGt5FG9ODWaTqr00OBiXKG/IAsJjpLjpM9A01kwYh+Ojs1vDhQYBcnL2yOKssHpBX6vaibNy7b2tnpcW6j2AdJdyrB9+p/2FMxIT18sU2kIbQ9TljpbwRaeTzjm+BsaMhvNZx7t7SM1LCqhVVPnr00wVRbzd7iKjBVROX6Ord6QWw0O3X1vIVXzlMn7Iw9hf3G7v6lVv9IuWNcTTqwBB3sDCKF3DV9sYYOOYp/4sde5x7qdNyG/HNwoUSsVfiVLdxc4u/a5uMlDFU5pkzmyMJn6dGLHiwIPNGGka0FHIw9CwqBZstwO03ui7udhlEt5oJKipZnF1MPssDQE5p/boKT6pQnb+aDCMUg8YMeMZraE9tYOYPUfPS9SkWSj9QAZrWQqijnGL18FpAWziWhroEs2ozbt/Po2sWTB6p6UMZbM4yxB/vWtKNKXnhEWgFuA4/oViUr7Kg2IaWsItbb/Lct9IqBRKgPxEu+BsbWO1yS6CyIC6r38cPk+oI7vs1WScCCsPX5fSvWAVHLXv0Z4QS7JS0H4VxnDafs7MGfCSKi0+Bd11hSpEusmxA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(346002)(39860400002)(136003)(396003)(366004)(451199015)(83380400001)(8936002)(41300700001)(5660300002)(6486002)(6666004)(86362001)(478600001)(107886003)(8676002)(36756003)(186003)(1076003)(2616005)(4326008)(6512007)(26005)(6506007)(316002)(2906002)(66946007)(38100700002)(66556008)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1JL0GbQgXbEM66qJqk0d1OHUt7j66oJmNrEBbtGH6ulAltvW9fHqRZiqTwTA17eVYQJXJm30z+pFPtK1dUfrTusYE1wvLAxnLP+5JDcyXc7ba3R3Epf1aby9Az8ewEzD1lzhmAOSLqoJADkdpe7JM5A1mSK+iPl9iA2YRquaa0g75qqfbfs4UD7Ky/5HwYfx+huCvju9ir+/UG7LGfOTOly9bn7ChBXoCW47LtiFLnqkK1e63IKg3ZiSRpmcEmB9I6QGScZU4OARpIo0TsqxrmjoLjcsUNMKYUveSRP6C0Br3jWV0ry/1t93AMgNyaGa5X3k2cmNhJ0ERr2z88d9kNJIeJzvHUmI8SnKaPeqh+FTz/6p1oay54xVUsi2O1xCCe6AyQeju5+ulwzASilZD5SHmf73DoQEUF+iGZCG90osIgbXgznLOhUl2w+EzU/x5qYoV4nfsmbMVeOa8gazJe7OdTpLIMHPcNCg9aRKK+K3hmUi0yWCfG4GY21vQ+xBavYeogCShKgFbVZhSb0Oc5H6z6pgfRidsFCfyGiBTXc3sLQfc4ZiDRZNahdmIuKJJRpfer50msGBXj/00DoXW5fIOfl9eZiZJbuShUING2Vi5DQGr3QjNfxY1+rCyiENT0B+euVMdhHU0MBgp+wGGPnqebF4Tq1R0yWuVE1TJfTQSAG2HZWSkxKPYqdPdVyk6LUCdTl9dAo3tuscn6mBrc5p9J3pT3giIroLP8m7Nl5OvFjrpSrUpeBItr2n5TULdx1ugMmOu4AHO/ie6BDTHLfevt5sPLIiypaSQg1MN9QkurzkkxBfTVOXm+YxsqnKycTCbmtAcQfipwfOPH29qUjOLhm13NIGjx8wYtDlUABYdK1twFZSDYQUXVgKxbdMJbic24XViJF5lRfMZDiz2TuqDpHf5YPoonY4ubSSLTjYlaAjWBuuq6/2kGJR2i83czaIEMB0HSiT4N1snWapyviVNDeDKIsa5ZQsMvkUUiD0RoC9ZithUTi+ZhnBOOMM8FAaKqUaD2x5aRk+jdMD6crgUhfegdUpZm47LI2c5JULkGWAlpfOMkD8Ri5IBVL064XwvFTT5a0HqDDza928k7AmVQu/sXMtRttKNm6vdKyKD7eBoOrxGDkH74jGKsVyEmvSeGc9CjwKbAj0Rgm0YH2p0c7HTVqfmbPz5+X9Ehwo0bgtri6OkB9WLqvGLl3GQM23Q5o7qWj3oPAfF2KXSsZ3H5vxkYQTHInVbQV94IxR7If3+mxVZN7YvXaRe6u2ckbKKd+y3P36w4KEbwD+IG5hCelZNm5hX34uRbJU6JQxOgIRxz69miIxqOjiISE6ACRjacDNfR6FW25Nh0Zzo11lWOcfKBQh0tgI9YsbbFu4oumXIQutfPMT636rqkCNIvRph4Ygw6AbRkq9PTGffmYkM1JX0LolrRCbXLWLdCYQxvjDs5YHssMt6IQ2suueEZCVTTj1c/5pvKu9n12G5RkYjRuEnHy0HZfwIozlLJlDrJucDF+Tlut32yAxmKMzZMmaQA/Bj9NBJi2b45LutLpAuImhNnbQe2fz5Q2ZkMiDrvszU30q0vnNuI8IhTDoQMJbAtWynfd7I1oKyHOQ+A== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87cd9208-b6b7-4037-0dfa-08dabebb6922 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:22:15.9441 (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: 8LWXd/j4H9xNXM9THdC8ysIua7IRU84YHkvNvFHAEZ6AgpBAuFLosxtQSngXBTE6kwg6oN8FBYKhgAxYYgppIIUCh6Jx8WzyvgrjrioHPoI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4433 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-GUID: T-mn1dRfps4xzgpdXykqH7iBtZHEGNgS X-Proofpoint-ORIG-GUID: T-mn1dRfps4xzgpdXykqH7iBtZHEGNgS Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has scsi_report_lun_scan have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche --- drivers/scsi/scsi_scan.c | 68 +++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 28d53efc192b..1da0d2687c6e 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -1425,13 +1425,32 @@ 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); - int ret = 0; + int ret = 0, i; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 3, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Fail all CCs except the UA above */ + { + .sense = SCMD_FAILURE_SENSE_ANY, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Retry any oher errors not listed above */ + { + .result = SCMD_FAILURE_RESULT_ANY, + .allowed = 3, + }, + {}, + }; /* * Only support SCSI-3 and up devices if BLIST_NOREPORTLUN is not set. @@ -1500,34 +1519,25 @@ 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)); + for (i = 0; i < ARRAY_SIZE(failures); i++) + failures[i].retries = 0; - result = scsi_exec_req(((struct scsi_exec_args) { - .sdev = sdev, - .cmd = scsi_cmd, - .data_dir = DMA_FROM_DEVICE, - .buf = lun_data, - .buf_len = length, - .sshdr = &sshdr, - .timeout = SCSI_REPORT_LUNS_TIMEOUT, - .retries = 3 })); - - 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_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = scsi_cmd, + .data_dir = DMA_FROM_DEVICE, + .buf = lun_data, + .buf_len = length, + .timeout = SCSI_REPORT_LUNS_TIMEOUT, + .retries = 3, + .failures = failures })); + 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 Fri Nov 4 23:19:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621663 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BD89C4332F for ; Fri, 4 Nov 2022 23:25:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229689AbiKDXZc (ORCPT ); Fri, 4 Nov 2022 19:25:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229761AbiKDXYz (ORCPT ); Fri, 4 Nov 2022 19:24:55 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 386392A72A for ; Fri, 4 Nov 2022 16:24:44 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4KhwDA026577; Fri, 4 Nov 2022 23: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-2022-7-12; bh=DWQKBkcxjGSuQTCm1iiBBb8oB3tX+WUgckUi9AlfG2M=; b=IhOozfkqyrEAQjTby9/uTt9NGRYEx3jLXPF/kk000U/P9gc+6VD7yDxCY3JaWsVvAttp aeF84IwA3HGMFmbK6Z7gqu1veR0hVLIsW6GcCh/cY9COYbWusIbMHfNFlXSSQApnU+6c Qd1jWpfSEnwT+Ud6lbDXy/9KruS3XflOAOVwJXxDohI/bQDjwMnCj2ayYpBe8gMXgXey f23Vm4LGsuZ+OiEnfAmZi9G1eaeufY540/HhF/7PpJwlqi2x8KAsOd6Yf89Hp6DfE4SI 6HpaEkoG6EIIcuo5GYNk9y/Zs9LUSLXqfGdxkonlN+91S79+xBrmuM9YaddPSOkJKQzQ lA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgtkdgf07-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:36 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4K2H9n032976; Fri, 4 Nov 2022 23:22:35 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kmq86ge1s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SamhA9F8TB3mP2qyvNIu+5/YZ5EpGKJr5yq9eWYoY1/Axx8APgctnXsAj3s78nh8jAfhTXKfyOTrxsWnLMFWQAxbRzCGRg+qmZep5yY+ezWULJKfsFfKWRdd9zIkqs39p8NwdSzao+4XlL1LTG/q03drirHj2SxRzhZvxwondzOCrEMkhLtwFrF8bG9M0zI9i0TDIt+VPJMaXGvoQ9/Ggk28c0DOR0NZFW2Xz+i9A47zQbWSsE6tWbOMkT2LUs61GUe4Bah0HwJS07CXnhKZGohJr1n3FPUuuRMXzmwg3iKEUI8vqFeELCKFk5fcRni+pffamGuWyjToEdC+PtlnLg== 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=DWQKBkcxjGSuQTCm1iiBBb8oB3tX+WUgckUi9AlfG2M=; b=ateW52qyaBlz60J3wqxEIvVPOWKP5DKd97vDcNybbGZr6y8itbupI3ts+q7NxzOjm/FuKvhEBOy3ucv5cBVaZQodJtpdDdIqdBAhr4cqbOTDfwbxLEb1p5jxPTEeiJC8qYcsxnu2usjZOMOm+zCNCBw7N50hOxubYD/jyChdTQ3Oj3W4NNNv36lmpxtyOfmsf+Y5NhnkRvN51YHyo7efe0+NF/ou1E8esSbvP9MbqTNXGDRzBFINCaN7aPqQ2j8ClAsX538LN4Fk8SUpEPDGG0STgJbi2B8W67bNhOoSxOoj5Lhj71OhIyx5GUrXkcEmUpY4B0oPUiDAiLqC8jahzg== 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=DWQKBkcxjGSuQTCm1iiBBb8oB3tX+WUgckUi9AlfG2M=; b=sGXmdvcybQ+DddthnSTkKvtRM+fPhpIA4k6zu113jLHezXNDq8YXZKc7v5VsIF+eB4T8dLhpOcWtSi4Y5wc4PXzGg7PtzsqRhZ9phVRAEhuDCJW3+h8T5FxaVjRQzBLsEed+GPu1JicwM26ipj8GGgk1DB/Yi7HejGRR299Tnbw= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4433.namprd10.prod.outlook.com (2603:10b6:303:6e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 23:22:34 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:22:34 +0000 From: Mike Christie To: 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 v6 30/35] scsi: sd: Have sd_pr_command retry UAs Date: Fri, 4 Nov 2022 18:19:22 -0500 Message-Id: <20221104231927.9613-31-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0P223CA0027.NAMP223.PROD.OUTLOOK.COM (2603:10b6:610:116::17) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4433:EE_ X-MS-Office365-Filtering-Correlation-Id: 83cc54f9-4530-4025-8ab9-08dabebb69e5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: X9+usfKymUNrr97Ra0mA60Y+SCz61r//LlUxf9j+d5ComphedWyUJn0KmbvFoEdCGyzOclRRm1HGtXo8nWmSR0Rp1F/AYdbS+hkvBUDQV3tcaQo8nOtYsZjf32wtMXx1P8+WnKKCck/KN/7oRsbGSNKejzTgitWCghk2Bo+CLN1yoZIjOlG+xsltPrOKnjh8AV2FiY4K9fCZ9G3mTfKTv6g2S5ZKcwQ3vPlNLGYiN/q3MgdBg7e1lgQWPRfxy97DooiB1RLSt3cU57MZFxhJCw2zh/IyL3WHuXSFdEPIC/vAozD9C+C0DR09tvC+j70E3/jMtb+WJrucIMYQ/3afnop7V5t08gq8q0w+EaRXGpD5GTUshvCXaGNnrrowI3O+fJMNhsYNNQgv+gq5CC/ga4a4AVyf7+BAKNdscsuRrKh8Yz3TgtnBOvRHaHHxWIJeuuRpdAWeqG5WIk0EYzYWW4jmYo+lr6B2nySLe6zaGVwOz6CSw43VRaKsXBsNZjOGuJKiBPqAQYwK9+l43eE6nPH1m5+P4BSJruXEiHqM5IR6sNdg1szuAxbbrNa2Ucg7OQIT/JZSBoITKwNGkzq/Mkh8HGN/xEOCcGLMkmK6J8uZARfJbdW00z+dii26DTbvj4MDUupbJd2D92pqjni7kxDipB8F7QKjA6A3ypA+rHRBQ6otjLbnJ0ApQF3Zytl7mRmRGDZbR3N9AIKNBbwyxQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(346002)(39860400002)(136003)(396003)(366004)(451199015)(83380400001)(8936002)(41300700001)(5660300002)(6486002)(6666004)(86362001)(478600001)(107886003)(8676002)(36756003)(186003)(1076003)(2616005)(4326008)(6512007)(26005)(6506007)(316002)(2906002)(66946007)(38100700002)(66556008)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: o5vqJw74rIWq2XFcnNsPYmHimNroXPR4y6iVfjeWO0sXNQMKIA/zQ76ayTWXFFqm/3l8cRSSd1I3Aj3prK2cCyanzEHN/xIJobeeOFApgQRAbJaXyOsYf5VvRk+pOduR9a2gdc3GYwt0L080JXwAz8iwYLl4mWCZlsSvDzQ9VIjVY48c2jqcKbWbFNk/huwd35HeNciKITjx5KDVqSDXVCJY6W5bi3iUP1nu0ZVHCZhCfhMT+l7Q2MxK8YJ8ScNbjWQVTL+mnV0sThyDWCFaKTvM9Th83ammzNO1HLy5ViTn5UnJSU5krbhHtTqcr4VhG/wKh4krVO/goigbG8yI07YtEWb6EpGRVmktSUh30WAvuQwNsTNTq+rG2Q4r6rrKIxQgTHhAnijXZUiSPKwT7yJi0cuE2xNtkDwDKNrnK/bJEyVxIPpkU8WTL4po7ZdYZpVQXjuVpY9xbgAE6ZVUeIu7Q8bC05mKKe8SE1rlRbbmWSN+lI8IeABTTxqi8XTE73rOqzmu8s2/7mNnmNKvVEkWtgYUoQ6vne7npF2RrPTMdWJHKdX8ttzh766EbnI1Ys7ge4PCW+MJBRUJlMyJXjIMKckCOlr8P/m6O90YGDY/7CYtvSLsZ5QaNUXZRhseUc56Hy9rG0k4DrdUDkzGHFFJvMgqm8wUh9ynYIoiNKM4aXfYeXiFFM7+JKsIq10ecne+MFYKXRms6+cPoczUQ1aHZx9eoxUANDeknINtlVkcldfBuR7b9BzPWq7sB2ETD7Mfnt+SWwr+xLfJlivzcZAtsikyAsKtDci+0aAHQwg7/STEdCvPH2hyWD7KKyAfUs41M8uefkjgU5N9FIEPIF+aO9s5TZfBufsV0bgudgYiYOjCRZ78i3wdqis5wUMs7XEO8Sxh4WzTiX5w/ZOoDvVrXdSd+2bsMFc9Oin6lK1iiq/X4tr9gBMjUpEjtTnjHBw8BAK4IjCImz4F6GK4tjKI/UYbCH6vg0vJQnb8JACrgsDrXuieJ3JUlXlrl7P9axAUxeP75Qer5MHzsey4VMfOvyd+XhJzDpdoUdh/zdLkuXDmoFSGmO6IMBM9Vcy/BYlt6Ekl8pRMwMM+2ixZ6l5zsCZc3w90GUURwjsqRYH29BsaGIHDPADoVXdkUOTPpwZzhmSumglsuaoz+6KsyADD+ViNmyeNa6EnDOlo3ikmmMbCajtxBy5OvvRIRFsXTJ+BK3gmAwTZru/5gp3x5IFKg05LPoWhum5pARMs21jTj18vmUiuZtku283R74YEsb0TuJIe41a/4Oz0ueXxIx05CbD1AddLF6iYKb8KnFby3r5hVE18pRjODkosPN96x1u1MT9VoPukiATkkO3mWrhUfsNQqPgIvWR9S3vytf8dG8gTvyUti+0XMh8eXKhe9nBU7/5pU3oUjzEbFA50eRyMKMJRRS9s9sW8Y4vYL8ymiutHWHTG+YcMEO2LkGDajZ2faF9p0//7i3R2TnjxN8fWm8AfpdBleiDKhE90wXPL8h1OeNZwEX6NvLF457Va6TPR4B90JRwPZcc0ERl4/e9aBuieG0AVs6XAnabofSfFL3Ql/skOP6k4n9Ulsi79A20iQOD2a5FpDjgWQ5Prjg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83cc54f9-4530-4025-8ab9-08dabebb69e5 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:22:17.2096 (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: b/Sw6YpM0aI0htIcIWGXyw2konVXyJp5rmKNt4t9sE0W/JTTYtoXcCB6ecdJ9B9e75ESbOjawVJbGeeOwYXDl/9tP6VTaGoOKMgcPVdN4uw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4433 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 suspectscore=0 spamscore=0 adultscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-ORIG-GUID: 4F58PmCUg3VvBljpNlfgGEpkC8BHsS8Y X-Proofpoint-GUID: 4F58PmCUg3VvBljpNlfgGEpkC8BHsS8Y Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org It's common to get a UA when doing PR commands. It could be due to a target restarting, transport level relogin or other PR commands like a release causing it. The upper layers don't get the sense and in some cases have no idea if it's a SCSI device, so this has the sd layer retry. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche --- drivers/scsi/sd.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index a07f569b5812..0545fadde8c5 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1723,6 +1723,16 @@ static int sd_pr_command(struct block_device *bdev, u8 sa, int result; u8 cmd[16] = { 0, }; u8 data[24] = { 0, }; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 5, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; cmd[0] = PERSISTENT_RESERVE_OUT; cmd[1] = sa; @@ -1741,7 +1751,8 @@ static int sd_pr_command(struct block_device *bdev, u8 sa, .buf_len = sizeof(data), .sshdr = &sshdr, .timeout = SD_TIMEOUT, - .retries = sdkp->max_retries })); + .retries = sdkp->max_retries, + .failures = failures })); if (scsi_status_is_check_condition(result) && scsi_sense_valid(&sshdr)) { From patchwork Fri Nov 4 23:19:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621662 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7589FC433FE for ; Fri, 4 Nov 2022 23:25:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229642AbiKDXZk (ORCPT ); Fri, 4 Nov 2022 19:25:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229881AbiKDXY6 (ORCPT ); Fri, 4 Nov 2022 19:24:58 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A473925C75 for ; Fri, 4 Nov 2022 16:24:55 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Kj7CA013354; Fri, 4 Nov 2022 23:22:46 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-2022-7-12; bh=It7zWFR4Crwixio/uNBBVNDZjzxAUoXnX9vsoCer7iE=; b=NM0UkGAO3+JNU0WEVD7m9WQ57YhdHl7puOYkz1cxX12A1jr3LeKT/OTtnWvQOsxqC+oE 3rB/F8xsV9Oz3il9uThQhNyXZ849gqKaJzFyMV9srJ2i+Km12DxEexfr1lK06wYKBb0N inwe17pPzeNwv2oJmSO/23aG+6Xn34ceoam5MV2cat8zALU7gxa6ekoiRTx3Kl9eqQnL B3OOpVsQ7Yi+WiYCD2P5lEF1UzrtRxaQo7WSU+pWDSLKFKe5DINsUksLbmtuhJQ7gW4c zCVQYmmgWQk37MEv18ODqBectdXjJmknIAUMb5H2JDN2C/rz93Ij+9VyY5Hrw4c1Obs2 8Q== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgv2as1m7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:45 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4K0bo9033104; Fri, 4 Nov 2022 23:22:44 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2102.outbound.protection.outlook.com [104.47.70.102]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kmq86ge4b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P0xWnM875WD9d/igJechgR9RPDbpuFwlHqluZV9pcVaGCEteqE8jMJZ/q6FgpsyZ9uow/G7I6VY6G9zcmAjJqqjxjCIB7JD5TPlxbr3TanjTZdQgD1L9ibZ9R72N7gXQ6qNwv3aj3d0avpFXd2JiWIDEM+VFsFoqm/PVywphzOrVeyLRgXGhKSKGCHfEjB99RbrKDqT8uLfgXwZ7qxBCAFfYHuhLyEp0W/zKziIL9kcpXBG4R3CQqD5jx9gDkp3/HSqp01l33hxm7tWmRJcq6LGAaD9kQFyBJu/DdoKmwx8oyD8BqIi0rT7juJhWRJsU47ZcGM2xFIXfUZ7uNFH4qw== 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=It7zWFR4Crwixio/uNBBVNDZjzxAUoXnX9vsoCer7iE=; b=hgkslh8etFPp76nF+deeiO+OPfhOXFNA7tinfBatW5vyZZF4dX/NwAqnH3KmmF4s1DbnsY0HXJ6q2OKPUbPPcvezwOr17v3O27M3MAC6fzErJ8WVq0kAN/STZurbMnA6czibkAtDD6FiD1YFBe9mV5uIdA71IBFytCNGQA3q2dzQ/bA2cWHVlSr2Wxkeafr7ZqAbLnz4VX/2gKUEl1oSk0aRgNZpbIH2ihBOZ98hSoLVRUn8gWV0fLmpxSDEawgTXahPp19P3FGEwvrxT1wkaCQXjB1HI8Fdr7uL0l8pY6m2SE0zxG2BaXWiRNHXl6fDqc/1nVd1ZcEJOWlGvfbQLg== 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=It7zWFR4Crwixio/uNBBVNDZjzxAUoXnX9vsoCer7iE=; b=UmqeWsSeOiN4Tp/LwZzOjV7RidrRjpbeDYLH1Y13hvJtiK+jjIO0hVLZ+tSfKC9Qf9MIKeU++M90YHjzRFylVxt9MVawuoEFRpvg8JquEWbZFErwmYAbOz7dJQ9ZZ45bonTZ8QoaP1ahJLtl1fRPFFogmZeeDWE8ccQvNBIXDy4= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4433.namprd10.prod.outlook.com (2603:10b6:303:6e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 23:22:40 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:22:40 +0000 From: Mike Christie To: 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 v6 31/35] scsi: sd: Have scsi-ml retry read_capacity_10 errors Date: Fri, 4 Nov 2022 18:19:23 -0500 Message-Id: <20221104231927.9613-32-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR18CA0008.namprd18.prod.outlook.com (2603:10b6:610:4f::18) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4433:EE_ X-MS-Office365-Filtering-Correlation-Id: 263ff192-31c1-4ef1-ca01-08dabebb6acc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KZ91g+Fkwvk4az9xeXO+ZuDWfaB6k7f+l1RVUou6D88tQgO348xLoN598W1WPaA4xdB6+6g8vXifmVd1FYidlFqbk2pkURbGYGhsHzLW/M1Hi5wHRB7tcMCIclL+CgSV9866yi8ao1xLX2lkOOn4X4r8s37rshFOw+62JP1CzaAx7Ne0EqYbdsKYpFzdnqYLFE9jyu+6POgd9Slckevvk9Sep/BarfO/z5TFzAFN1ito/0X1uxwTmZsDdoz5hNMGfNYYUHVQAtrRpZkFbA8HXplr6pXtuaaeaHHnWpWV3LNhWLIwm31xRIhN00xx9+SI9+3wUsIDbcsXbIm+z96PpgVqJmBNl8cCBzRHfHX1tIjHqiIVBkgHFnuCZSpLyG1c9lEzjbP3Zt9D2rcF1eouOf/vwwmWUNocK0GKPbv7qOzVnK4oPBwTw0DurJJyzdE0ZjQ++1y+wgrN2eTUjCNyGSztiAsIR0kmLn46h5W8exdpISTjpHGVSQDttiNf92oEUmpPhUqdRJuaZ2iQ38QyfxHuChfzLgWqSgUB3gRvZJbdCfpMJOJjBJBap2+l0XxyWuJIe+fHhZfs4Hbe56pcpQR2uQg/4xSnSwmfYjvzyfgldxKKVamjL9NNmENQ8Qay2Kkx5PxuIjM1J3J/m3Q1ef6rmD7Hj3EbdqHJ7jtHYQMYkif++ygFZn7F+67GY/+/wA/1XECe3mjIf0guIRdX2Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(346002)(39860400002)(136003)(396003)(366004)(451199015)(83380400001)(8936002)(41300700001)(5660300002)(6486002)(6666004)(86362001)(478600001)(107886003)(8676002)(36756003)(186003)(1076003)(2616005)(4326008)(6512007)(26005)(6506007)(316002)(2906002)(66946007)(38100700002)(66556008)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Zuxuw7YfHuoUGmAqDiS0hymLEGOJApkZpTi9Y3hxGqYd2UhRnmJYOU3h56eAxQ4kcVaLNLGxqvaMmIeO6EgUhr42LG04Y0UDgwAmmKY4jp+muvnXOiooPcoZ8Z9WtZ/hk7zCgmDXAXIR9LMSxyKfeb1Jf/2qV9DGVc8iD+RKuMPTnRV58ljA9Kcq8ORidYQ80YI6IE6YnppnAlROpP7VgSe6BoY+h5aQtyo5OcrVFjKpEPmTlmNmhPUdEBIpg2TJi9NHvYU7FDylk/r7I5IJlwup9JFHhDgit6oSBxhnIuFj+JSI62VfvgWtexSRx3uNv2GvdPzIR1o/e/3b6inP1mSjsh4Y1GUvqwKGJmN/bGXtZMgYpqd4nVxf6iHWHMXrUV7y06nXpLtdWDCcuOZEhui6MJLE0qvAmJdIlBT5B0Yzq8FRd8511mN8TXbgZQm+4AP7lnRBynTgDGA4iIcYvmxzDdN8uotrl9xq53efElh4ze37Qeth5gIK7K/4OoaN9OPQm4MRMVA7ArelIZoIpR5kAQwHJPG5MY2y+d3tLZ2U8wyQFNNaprpnHsYUNslRpxaJSOD35bBxA6FRWQduYAf/lr3kq2uX50ivwYqQNa1sit8PnZt4IwlO1v8XsApB3E0CnypX8mxcFEqwbh5KKirya7+4BMe7+ZdLIwKxczDADV9Ze3kALw1LgKRg4wZwRb6dRMC1MRFUfsLCrJ22+2hdWGOQvcWzxs3681R5a1GGuZo8D2xEZBMHMAJlSFcS0HOvnEJG+mTyd6QGxAzKucFu+oikA+QO0LbhR/3mLMeX3K4zYZ88EWe8+ohjUsksStAVlcMHoD+YVqfrIytZ7U7zTqbbZuEvf4zjdzmzQusrUKtXHZwjHqk8HN62d0APOB+kogRhnaH308u8mY1AMCfCWQGl+vgmm0t9S2KFwLknCZAPg4C2s6v4yvrkfUJvkFM4JgZedPMxDv7t5z/0G0H7xLSJn/FvzObgv0Weaq5BW8a+G8QnZsddoLmXEzm1zZ9J3SGq4U0Csc5hP2Ob9euRFQs7/kIpdp/j3lKWgtND/dAOEC89xuhXp4/x00rSDqJjTgBFFkAMmMKvbwjT6ECWaMvdXoBH0JkrGkP6wN/bdq64u3ODBEO9XH6HPHNkXWmVHL0lWHKsSxlmfZnEdkh2A6I5szDtyq8d9u4tY/62JBQcYVy4yz9EwC/fpiyu8dgGBGQDyi2zjcBGIqj4MKhmW7Y65Q1goVgB7ran86+L6Dj10oAFREOMZeJnliN8PCDSLQQSG7ytTYm5uOSe9uWodQotSGkK8LYbjiouRlp1RqWWAzMUiT4aFHmk2e1EFgxuFzmuMXPOSWAILsIdTpDeZGaWoLz79lad2EWQG7aWJlpmUvLRoHZbzzsZZfUB4Gzzujk30iwN+b6WlILiwl2IHbP33n/aP73FaDMv3505i3KfsdDDJW70WPVXzCzRmLO9xZwptHrwPfZ6AVTiIsoeNn/WsrVtc+spxsBeiMoEhZTVuhFIUElS+5btPEIm20WirtovEmrY8EnDbivNTdrT81Obui3W7jTMDyCMJ2ihJg0dAJSxR63E1C4xVrWTnkrL4RTiChOn7QhtA0GhsQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 263ff192-31c1-4ef1-ca01-08dabebb6acc X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:22:18.7407 (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: X4h8p+5L3Ce0/e64OfRYootSCVxtiW7Z3OUK4EmQ2zgd0R2IxbKKA28JTGpJjgdaPzLc85hJUtOV5pkFNqTUKfF6F9N9cVVbESQGyJHEM+4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4433 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 suspectscore=0 spamscore=0 adultscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-ORIG-GUID: 43p2uTiwrSO5PEszk_MLbfuw_GgVSHHq X-Proofpoint-GUID: 43p2uTiwrSO5PEszk_MLbfuw_GgVSHHq Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has read_capacity_10 have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche --- drivers/scsi/sd.c | 76 ++++++++++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 31 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 0545fadde8c5..96cf5189dea3 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2435,45 +2435,59 @@ 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; int sense_valid = 0; int the_result; - int retries = 3, reset_retries = READ_CAPACITY_RETRIES_ON_RESET; sector_t lba; unsigned sector_size; + struct scsi_failure failures[] = { + /* Fail immediately for Medium Not Present */ + { + .sense = UNIT_ATTENTION, + .asc = 0x3A, + .ascq = 0x0, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = NOT_READY, + .asc = 0x3A, + .ascq = 0x0, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = UNIT_ATTENTION, + .asc = 0x29, + .ascq = 0, + /* Device reset might occur several times */ + .allowed = READ_CAPACITY_RETRIES_ON_RESET, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Any other error not listed above retry */ + { + .result = SCMD_FAILURE_RESULT_ANY, + .allowed = 3, + }, + {}, + }; - do { - cmd[0] = READ_CAPACITY; - memset(&cmd[1], 0, 9); - memset(buffer, 0, 8); - - the_result = scsi_exec_req(((struct scsi_exec_args) { - .sdev = sdp, - .cmd = cmd, - .data_dir = DMA_FROM_DEVICE, - .buf = buffer, - .buf_len = 8, - .sshdr = &sshdr, - .timeout = SD_TIMEOUT, - .retries = sdkp->max_retries })); - - if (media_not_present(sdkp, &sshdr)) - return -ENODEV; + memset(buffer, 0, 8); - 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--; + the_result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdp, + .cmd = cmd, + .data_dir = DMA_FROM_DEVICE, + .buf = buffer, + .buf_len = 8, + .sshdr = &sshdr, + .timeout = SD_TIMEOUT, + .retries = sdkp->max_retries, + .failures = failures })); - } while (the_result && retries); + if (media_not_present(sdkp, &sshdr)) + return -ENODEV; if (the_result) { sd_print_result(sdkp, "Read Capacity(10) failed", the_result); From patchwork Fri Nov 4 23:19:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621987 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E9E2C4332F for ; Fri, 4 Nov 2022 23:25:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229782AbiKDXZj (ORCPT ); Fri, 4 Nov 2022 19:25:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229873AbiKDXY5 (ORCPT ); Fri, 4 Nov 2022 19:24:57 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63CC725288 for ; Fri, 4 Nov 2022 16:24:55 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Kj7dY014044; Fri, 4 Nov 2022 23:22:49 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-2022-7-12; bh=bv2QDst3SvZ9Om5sDv86682KKPj3G+AqO8+l3f6Ty5k=; b=ddBYzrX8+rS4XYhCCn5V/giKYILrr/QaXwFzOXB41qFgMI9vFN8zeu5n/cGWpggSMtZW akc+ES35wGsiryjqnjU68Elp2Sz+RbFuc8Pv1WJmFsbTCRE+xfITY2hdFC64PshDBkip Q4SrFBWM77knKzu27cdzEgiwCjLiFQR4NMqLFd0YZ/VuT5ALGVdjusG5cN4zCOodPDU9 KB6THq5wN0Jv5yOYZq6GG4cN+4gTNj+AgyctnIiJ1rPRX9jri9VYg10BkGpzNRbRMKuy uKEA70h3B2/ohHrYY2IW1UGutGvp6utIjPrxJlDj8kFoeCDPTHlNRaxwIUvzskLWhYsz 8w== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgts1hh00-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:49 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4N2Ams033107; Fri, 4 Nov 2022 23:22:47 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2174.outbound.protection.outlook.com [104.47.59.174]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kmq86ge56-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=frat4gJnGNWmh0hsqQeqtxOSOZJKn+CPzN7F/Klhlbx21Eq/6zWIOwzUfRa8JBrhQdNeYshku6J5J/Gsds6M2u906InE6DIQ7lRL7d8dFqEsoPQ8G8GmVrJTv0UG1hbGdijqjH8qXV5PB5T9aGKFVZ+FadAJByjI8sE0PXrSxHqwkR08ATkeKAw/tjN73PL1f2KvvA7B97PbgcjBEt1Gf2rFy5BWhs7/gzMASCkCs/seAkpckZmLiAov+RiCzQBW54c1ZEqJ+ByDPAB+9DkMqAJJj1Np4LG0ZgeEeuIzUsw91sOKrZlvi+QHZ+leFulw3ig7LjEBqupxdrI44O74xA== 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=bv2QDst3SvZ9Om5sDv86682KKPj3G+AqO8+l3f6Ty5k=; b=Vr27Ibj4d+k/6gasfk9nHU2Eoh41mIUkSiOCcgpqDn9MBpC5zfyjFsDiFo2JNcCjk59JrKowDUCffCJ2f94DpjMJgqNUq1r62ZRhAmTBSFr6vKear8yg3dvIVy50E8fxuhw1Snv5S0x6/kXRmP5K9IByr1MomD/0xesK2qS9seLB/zvcF0lmDVw6e/tDly9R7tagRvUFPdLgo+jLUYRkk3oTTxu+eaaP8GjI1PARl/Yr5QlRsGwiQ2Mb54GLV1do1vERTwsuK+2vttGhj5n7/Hmewt6R+Nxkror8AXnACdhMspj5RgaoSpEISUpZSzeboPEUy6MYVbtxciqg1cLbeA== 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=bv2QDst3SvZ9Om5sDv86682KKPj3G+AqO8+l3f6Ty5k=; b=J9wGr+EP6rGYCbsLCIJ5uttTF0jLPaWHsHipF662lYVJKNMbS/6iys/+XOfRh1FdA/dPHDF7BVU9ldSf6kPTinSoLeQb/Nwc9cR3trwMIfHLdWc0fgDcwhFk8JIFcwldvGAwQdh3Nrs84DEZXiDJeCVr0m5Ry6Jjmf3bdvkCf+s= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4433.namprd10.prod.outlook.com (2603:10b6:303:6e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 23:22:46 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:22:46 +0000 From: Mike Christie To: 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 v6 32/35] scsi: ses: Have scsi-ml retry scsi_exec_req errors Date: Fri, 4 Nov 2022 18:19:24 -0500 Message-Id: <20221104231927.9613-33-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR04CA0010.namprd04.prod.outlook.com (2603:10b6:610:76::15) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4433:EE_ X-MS-Office365-Filtering-Correlation-Id: ab1c77dd-53de-4ad3-9066-08dabebb6bdc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Wm1I4zQGPl3p8rHPxBNJ9bDKCGL/D/+XvIqWfV9sY9I8GurQqvTlAdL8oPaFNPeYuPTCi/gfKU6Jni7W2OAG5XNcbe3E1lL1smMyO7sMa7YqBygsP+tyj5bqHBs1XtHUiv2W0d0AEiqzi/oAkKTBETimGpGYGeG6mBr9xLK1vlIYht6DP6cfSRkP3m3QR+C0RXVdKxMnOVPf3cS4X0nv7dN9xBxVSKeFR5N/q79+8WLGgG2kH1tqaJU31vJSf1EdNnGx3CYYwGdtfVTQKjG410wdWagXRdj7npaUuRdMU3HrGTwAinv6XTAWK1d8HQozB1jQ1nHJhw2x8XWM5fR5RXt9ccrDWXV7gSvqTJQ/12/e/MPbf6C93fxaKZ+VZBwG1XUX51B/gJyQ0o57TP5MIrj4/SpSAFpNJ7PWb/fljUm0ms3d9Ar/TXb/t4fasx6ntwvmQ0mkeWerRrAX349KzTSzXQeC78IgvlpDN9OucMZU0uc8x5wiTPi2Ety12nNpEYhvvVhDFIHLbXcaIhsvHm/Qk5sxoYRRuQX1vs9TJKNuFjJZBP/hAxvfUA6U+iugGDegdDpR5OqLBejaaMu3IotQi3/PWd4maBy3F0rFBI04FAONUx8O2LaMJmU1b1pF/DMc7bVNagYkJv1aO1+5+3Zmu906ogAi2PtYhH5rx2X4YWEzbH4I75QVkOtBHucP4bVvnFP8KB4jI3UH7xOUtA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(346002)(39860400002)(136003)(396003)(366004)(451199015)(83380400001)(8936002)(41300700001)(5660300002)(6486002)(6666004)(86362001)(478600001)(107886003)(8676002)(36756003)(186003)(1076003)(2616005)(4326008)(6512007)(26005)(6506007)(316002)(2906002)(66946007)(38100700002)(66556008)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yIWt09E+B7ZBV5P6mRS7USKQccx8DSokS6X/cK2Jav8AK4HaXb/BYD0JvRne9VFRVxvfJ+iw46eUvof7xOJ1ePw/yAPrJHaldnUKll1ehCg4XDS2BOvn+T6g+B5uHNm9ObbADy9VJQDxapKBkSm3GSwp2cWPrPqPhNx1SWXJHS2ekYdau7cmoenCZ5NDKGiu7wnZ4/ch9PKHXGdgOZciOnTfk300F+FSgO2eyNKhjOIMlcvbQEqoG61rlwp0A4y2zQltGHlzJmmJymLErc2K1grGdFYA/oDYJYgbeyBMJL0LsYsyX00TYJplWSoOTpnBbltXJjdiBAF9A2ohBPC8mO7l2dUbn8uwSaC1/XHrz+8wcgdypJhvxRqZkJX3mUXSkFHPfCdKVXGpNZSrGHBqgJE8OvMvd22sFg+WTUN6d/A5+rc9ySAm7M+8rZ3AH58EvdCYDDuAMBeVC+bDQRVkmebMsQfKh9a+Yhgq+URwfjjD7USx2TDa5JuXS2Koe2AChpub7+PH8vsXT+9/0eBZE8C2gU4Te62o4U4+ba/NYsvatZDw5kUMNZE1S4TBvH+Au1fQYP/G/hQb4ZERzfCQtMMJzif0uPRdbSMS7A3ZYQY9pKWeaYZFT2FJVQ8D2ISj5ZUbk6dpioTcCfkdqmixx7uTxTXAdOe+3xjaO3ZMcaKlICQZ7Uq+PufgnO4vVv2+L43lTEMqyHDu/LYlPg+CT86KN/tHcVhMXuy1olrKaMPV5lbhsRuFyDrbaG4SyJdyXEnEK7qz/a3p0lpSDYyffw2FiZtvRHGncpk9JfrTOfS/N0x5oyETdAed1kZAL8gMKthZuvW6N5SMiKNJaVRS4B3IF3+NUMJJJACGYH64bSgZEnuwNqVOF0Ekiw2SKZCk3jq42rtvknY3oKory/RU9bs0Y0vYw1JOept+6uAwvPG4LLppanq9rFUoJ2fzcGussQcHQ1bExDLj5bv3EhNEzU0q9NxWMUGgFQW6NPdgB07qHoDYE9Mz19ppUnqZDp1cmuua00fi/hF+lraplb0cSZyoB6epV2bez5W7JQIXI46r/r542oH00l12diaO7Bn8smRsu3WoJTPRXTpX20PTWPOlZffzYC9tGd+hkg7AKexa0cpJyl+biFK3RfoB/Sf4el6auo0yKVkW2hzdjnmXZo/MOMeEqxoGA/ZkCxc0hVTqGb6Mq4rZE7kcwm+gnIVN2QkRxnbVHEqkWsQUbqM/cWa5WxAKzWyQu6Hb1ZqTEkELAAe/5khIL5/60P/QM8r2Vwp+hUyxlHQUi3RaR/FdmeaNq0GWJ+Ms9qSEkJev/WPspYzWc5UqbkPniI3Cawyt/lHJ+G1z3Ri720S/UENMtUjFiSXBqwWm8EPSaVpUFQfZrqEX4rW7YvoZnuV2/UyR6wWK9cnBLFfuZzVTdbohJ1Pi0vjh3DmxXiMgUWxhxwk26b+yS0/1tDs8UCe2TxqHTJmpFeNIzRpUFkUbsoZODPYeEzzJQ2Bm6J3tNBVHjEpEPW+eeQaC69HqMDOEqc2wEoYvpX2a8+0CeH6qoAWQsdYdoUvR99u410EZhhDeGubmSzit0Ik9VbR98QpXxecNwIMQXKiK0Ipd4MubGrpIFw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab1c77dd-53de-4ad3-9066-08dabebb6bdc X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:22:20.5218 (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: DFLG1YnedBlYGjsb4GHzDRHLz4KV6MHE/RqEjmr5U0iNGMD/pUfLl1iADmrm2+oabHvujvfZxMPwqkyh4gUJOdkljs/1Na4yYGNW8XkWWIQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4433 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 suspectscore=0 spamscore=0 adultscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-GUID: LxW9tEtDgX0nnmtAycMlH4qgr4QzmH4L X-Proofpoint-ORIG-GUID: LxW9tEtDgX0nnmtAycMlH4qgr4QzmH4L Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has ses have scsi-ml retry scsi_exec_req errors instead of driving them itself. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck --- drivers/scsi/ses.c | 84 ++++++++++++++++++++++++++++------------------ 1 file changed, 52 insertions(+), 32 deletions(-) diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index c90722aa552c..d8b31c0b0125 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -87,23 +87,33 @@ 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; - - do { - ret = scsi_exec_req(((struct scsi_exec_args) { - .sdev = sdev, - .cmd = cmd, - .data_dir = DMA_FROM_DEVICE, - .buf = buf, - .buf_len = bufflen, - .sshdr = &sshdr, - .timeout = SES_TIMEOUT, - .retries = 1 })); - } while (ret > 0 && --retries && scsi_sense_valid(&sshdr) && - (sshdr.sense_key == NOT_READY || - (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29))); + struct scsi_failure failures[] = { + { + .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, + }, + {}, + }; + ret = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cmd, + .data_dir = DMA_FROM_DEVICE, + .buf = buf, + .buf_len = bufflen, + .timeout = SES_TIMEOUT, + .retries = 1, + .failures = failures })); if (unlikely(ret)) return ret; @@ -135,23 +145,33 @@ 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; - - do { - result = scsi_exec_req(((struct scsi_exec_args) { - .sdev = sdev, - .cmd = cmd, - .data_dir = DMA_TO_DEVICE, - .buf = buf, - .buf_len = bufflen, - .sshdr = &sshdr, - .timeout = SES_TIMEOUT, - .retries = 1 })); - } while (result > 0 && --retries && scsi_sense_valid(&sshdr) && - (sshdr.sense_key == NOT_READY || - (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29))); + struct scsi_failure failures[] = { + { + .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, + }, + {}, + }; + result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = cmd, + .data_dir = DMA_TO_DEVICE, + .buf = buf, + .buf_len = bufflen, + .timeout = SES_TIMEOUT, + .retries = 1, + .failures = failures })); if (result) sdev_printk(KERN_ERR, sdev, "SEND DIAGNOSTIC result: %8x\n", result); From patchwork Fri Nov 4 23:19:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621986 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EC65C4332F for ; Fri, 4 Nov 2022 23:25:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229556AbiKDXZm (ORCPT ); Fri, 4 Nov 2022 19:25:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbiKDXZF (ORCPT ); Fri, 4 Nov 2022 19:25:05 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C9685FF9 for ; Fri, 4 Nov 2022 16:25:04 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4KhqoD032430; Fri, 4 Nov 2022 23:22:54 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-2022-7-12; bh=89V0qRUOzhqQ8z7alxDt1RFC9kTsIE3HKelb/jO2wwo=; b=kVs9xVE/cHAwRCxkzP7lXQZakxqZVUicnXAS/CZDrAgVcLSss1DkgP23bOzhKwCtnvlA eDBA71ee14DdxoZJanktqv7M5KKwGTZ2EOvHMjVcnCSQCuFnrb3Y3dUO0ONt+acmqCm2 fYmpMIdjSw7+j5noMjVBk3FEK8YOBNXFBexm9CbErt2D7OG3x/h4L8RydkzSrb4tSnv+ L+glGxd/8vkqN4B9niCsu+jwKtgtZU43yxGmKrbORYnDU9/W3Y091QtWbcFnkzzaGjE9 YKYAB5oZPRj4iqxEUZSA7yAeJMRg3pcgGFTua1WH7u4XCx+CrYpip1oRF9HcVskPlfz5 VA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgty398bw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:54 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4JYZRN029604; Fri, 4 Nov 2022 23:22:53 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2107.outbound.protection.outlook.com [104.47.70.107]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpr9a9r3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gmHkOrVMLjYY09d+gl54jaCjq3YJ3a6wjwXlWeAO4NNLfmnIuV5+gU6ohif8ZaqWFw5AD7WGANIYBXSTZtB6JqQUb+mvRTJ0ApdP0t0C7yEU+uk3QHvZIy9fmhTYMZYYjInK1I1OBW1CveGLSnydb90KbAHjl7f/upVW5miyXtJI0DoNPeBxh6ex69b5THhIwwoWwbN7fjl4l+/fPceA0H0L0txtIKKii/3Uq5eN8IkTaJBsVBmwaq1+x5ql9izussMcCbqK0UMIua9CfgRA255M8feunZNP+rx+/kZzHiWO5Y0xDAW9L8vXRB/LWFeE2gsTjpVYfY0XXxW8b8K3Wg== 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=89V0qRUOzhqQ8z7alxDt1RFC9kTsIE3HKelb/jO2wwo=; b=WnTzRA7Nu2IUDv64IvLiCa6zUaug1ph/CugtiW6xgEFEyv1KS3l/8tuyOiTa32NRT+8ziw9kpn+9lBqPGwFrD7ax9ybuv/NQBNz1/SurvY0cVkBaX00rlAkxkmp7jwUAdwjUZdMoa7eli/LUR7f5fL8Ts5k1Ifl2nwFsni0L1yqsjinORy0wiVpjLU5oRMNNcnSPBL+PYaJ1MGFfFKIhxlSRvHM4QXNHz8FwbAhXjCz1cjb/P/PjJn8s1dxXx33LgaDq9ZGxli62ZtxZCG7dZ97lxuK4a1zk9iKywVNUS+X5u6NLljSEgiGVCmttn1xhoI5BsqtPzSotdMlBhAxURw== 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=89V0qRUOzhqQ8z7alxDt1RFC9kTsIE3HKelb/jO2wwo=; b=H5te9ht3MUhyctRFH0w61WT3LSo0E+yheAgUyD02QA2jx059q68ZJmaW56RXxllEw8m/6Sa+yR/BaxAc/VwOAslI5krK9IRkpHSWT3Jiiev0fNEl4SQXYHiyDfHn3aoEn0DyZmZh/amT7O33JSGULg8ig1jcfSK/EEqddvjtVbw= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4433.namprd10.prod.outlook.com (2603:10b6:303:6e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 23:22:51 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:22:51 +0000 From: Mike Christie To: 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 v6 33/35] scsi: sr: Have scsi-ml retry get_sectorsize errors Date: Fri, 4 Nov 2022 18:19:25 -0500 Message-Id: <20221104231927.9613-34-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR04CA0007.namprd04.prod.outlook.com (2603:10b6:610:76::12) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4433:EE_ X-MS-Office365-Filtering-Correlation-Id: e0629b65-5861-44bd-aad2-08dabebb6c9d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eUqeNTk3IFx6CW1Fyd5pxEjPx/yCM6jIFDg6UgnATNMYc1iqKPDUcpJTMFzTRx8nZ/k7jly2nuXsqaO3H17Q1ngmyrEM4mtxcbIdJNi+g6PDvaRqaPixQMaogRyxRCgpzyu3lQqVPFSP9z3C4vCXQJPlzQc2WDjlGbKNwQ+vS57KaKzBSo99629jfVNKr1fAiYqFx7BTOa/emzgkqCuu0EaNjo8zznJlmOOZG1AI0Df4hrdVNh80V/IZl3wBRi12CSZgjHiEsTneXtUgDgA+NgdRYgzPr74XUEdfB4Q6o6EkUHNk1iVHPldvJC3mqJ43dU5CzywH9ClVDgZdtCDE8Z2z/bYIA3AQjI942oYtrnUDSJptV2PKCSpeADOrqvSZvkeDG5QD12dgNuqKRjRfXn2HigzZ+IL5x53h6prDtShu6dzUCquzP1SoiqaRHSOV9nkB85I+K+nrJ+n8qVFdXoYSxpwic9GH4fuswp6ScP3TJjjmt528l/svLqScmJap4LI24gskPUdZs65Y9+QuD+ZdsW7sLPbPC2K8nsrmIipCzfhgDwgeWYo5My7ukt8FEuZX1EGCXZrt/iR1mCNlK7+Ch6R8j042b6L8pK9+EqIMkyRyRX8fZ8jpqzkpnvtgwibp9MWLSyTK7VrddBEwzS45TE5TJ7hPVnzubXXev1V4opPto5YnoOU2+t/bHT5ea0W1mwfF4kLuuOjk8cTSEg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(346002)(39860400002)(136003)(396003)(366004)(451199015)(83380400001)(8936002)(41300700001)(5660300002)(6486002)(6666004)(86362001)(478600001)(107886003)(8676002)(36756003)(186003)(1076003)(2616005)(4326008)(6512007)(26005)(6506007)(316002)(2906002)(66946007)(38100700002)(66556008)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aSof6pt9pTvmseJwmXhMgJ2cxJQCoU0AmP8kTVAg/6iGMWFP2nOM7UBW4Yyde6UPDwUwlk+aszmJwDOxezXtNk/ZwmW+WEeusHo+DBBAyHnnSfyDTat3q5/fk7OBowGddzGwkZpiffeJR/0t5zIssDGQA89tglHCAwClZw2LWKMWqQ7Naqlw/G2CUEhARFZATxI/McV1vr61ZFGZSOoDx3Bud6eZHu+NMJViZWtc2+XtPgRRkQ+C3aSdCnHY4ENzfwaREgy6NZ63abvezwSFCaVOiPfhp+h8ZyeYWm4UoahaUQ+rR0XxbRkN1zHt6kD/7GpDmuO3bjAa3ugTqyB6X4JQ0ogToKMbvnVQG6PPZO66USShA1hB3J5GST3Gyz9cfYVTjlVCokjHJ1oa+aGex9RGpa5LeQ5XzSJraRFgzmQz8hWC0SpsnV7huT90v/spjjEpgnyZNIFaC0j4SZr5T2obV+vlpMUCivM1+OLBcW2ohxmVpEVh4E73CiUEsQB1Mrsd0usManUlrSLQmDh7nQ5cm446vgC1ew6JzlsbPm6+LEpCHJwVuNvYvmuSMLVm7+8EepLZwW++yvDL5hcgjxPM9tvIklphVGkmdtAaAM4GbXnHZvxcHaBBFQ0FXktyazqefuH+aOFKgrkgS+lYntCm2i3x8WbeRLOfd9TGvPcQyC/iNd4T4w2/FdqkIIW3QlEqoNfloudWshdc9qzmQeCpjof/J4/YzoQzdxp7eSloiEvBavpZ9esad3m1GrlsKJtDZi+rWE0R1K34l6G6Meu5TrzEvMHwk+K7oQpxjpnXrsFusPLA3cf3gErmDKzMO5DcJKbohfO1fyFTy0xrtE/DgK4TTX/Kgz7lPpWyP1CHaLQs7j+NDQ+rw2WS/Czb4uPWmSt0rtiSIqOCHHVQwab68ngvvdHr4quKQLvwYu406A0COPIjmxRhLnIzfwRToSYUng5kCgxwn5DoPn1oaMnUo3cZ0kabGYZ2Tu/vvBcE8tt6LSSU4mdNV6Cjqz0WBt9i7O/OoQtjStwp4nMrPqKc6gRgQPFY1tuRPqXp+r2WXUn4mxu2faI3JX6DmaeoexjQVk9PeyK4ejEoh1kfaJ1R/Q1krIEbrYAeSwzQKhyjeZqicIOITYJFZ1mCscDlULOBUqMKtTQ7Wge6e/ZxTU3y3cgG/ioJbNmL1Zb2i3Sh/TQXQcZpf03fTgBUb5qu7NRdxvDlCHn4X5WQ5dD9YTc9zZG6ZSWZpsOGmzY7ahEkc/ragw9AoSPRCRuF5R/kfCd4PIv3vZ3fmuS/A5FxSZdfwTiHtSJ8rfCYGmtu4dePR/j7/66R+i8hMC/b48F5mjBhanguoNb8ZNxkbbwvtVAtKPC0ZdOal9K58xda/aCE0KpdthxytHV4FjgUYGD8Ss44ZmGodnC3nYlFRogFYyV27hIaR7vJH2uxaYFX0MVthmCokTozHSzTXpGFhkxXXFuwi2k3fPFprIELO2cGAqv/qNAq7A97iwqCdVUk6navg7vjGUPmHRk26KJi3kZwqkJd5U5t68mb3V8z0og1MGYuQ6YTzfLqnJnw53PlMC9WG1QayaZtDmxja+C6uBHClqkXFLcrI5aC4Su/Qxmuzg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0629b65-5861-44bd-aad2-08dabebb6c9d X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:22:21.7874 (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: AsRIfVLiCm72fGRQCYzIK5coxHd85Tm5TBplg02Je/7JPnQBoAmyK4lnobBZ+J4dIItk5cc/rvwWkrWP55HPNIefRscPBG3ZxDOq43O2e6c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4433 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 suspectscore=0 adultscore=0 phishscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-ORIG-GUID: M86z91dnsEffDZkAob6OwDMBGzkYruAM X-Proofpoint-GUID: M86z91dnsEffDZkAob6OwDMBGzkYruAM Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has get_sectorsize have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck --- drivers/scsi/sr.c | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index e3171f040fe1..1edc0647a15c 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -725,32 +725,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 failures[] = { + { + .result = SCMD_FAILURE_RESULT_ANY, + .allowed = 3, + }, + {}, + }; - do { - cmd[0] = READ_CAPACITY; - memset((void *) &cmd[1], 0, 9); - memset(buffer, 0, sizeof(buffer)); - - /* Do the command and wait.. */ - the_result = scsi_exec_req(((struct scsi_exec_args) { - .sdev = cd->device, - .cmd = cmd, - .data_dir = DMA_FROM_DEVICE, - .buf = buffer, - .buf_len = sizeof(buffer), - .timeout = SR_TIMEOUT, - .retries = MAX_RETRIES })); - - retries--; - - } while (the_result && retries); - - + /* Do the command and wait.. */ + the_result = scsi_exec_req(((struct scsi_exec_args) { + .sdev = cd->device, + .cmd = cmd, + .data_dir = DMA_FROM_DEVICE, + .buf = buffer, + .buf_len = sizeof(buffer), + .timeout = SR_TIMEOUT, + .retries = MAX_RETRIES, + .failures = failures })); if (the_result) { cd->capacity = 0x1fffff; sector_size = 2048; /* A guess, just in case */ From patchwork Fri Nov 4 23:19:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621661 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74BD9C433FE for ; Fri, 4 Nov 2022 23:25:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229686AbiKDXZn (ORCPT ); Fri, 4 Nov 2022 19:25:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229670AbiKDXZH (ORCPT ); Fri, 4 Nov 2022 19:25:07 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CEC860E7 for ; Fri, 4 Nov 2022 16:25:06 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4KhrQC027173; Fri, 4 Nov 2022 23:23:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=QEuLKIm4P0f3UA14Bsh/4CQLtOg+hMunZ7QEJvmedL0=; b=0vXljBNnZiFY/FUoPqQd2jKcSQpdLiewyNH4h3hLM6+Vz6BDqq7r2i4Kwlk47ErkadCm SWikBM/xP+w4Gw99dovlpV/1JuKhPlzLPnvQKPuR7MPf6782r8r4dhIYkrTnhcHY85Yl 6a7bRfPW4ylIBhu9xwqeeGPApw1ut8obtp3cKr3dIBq7Bic7nvgLvN21OJ/m72x3LkAu TI6nrh1DHt4d/ZpA/fO6d+GCiELl+5N5t0d8a8itGVDy4xV7dp1jU4MJVl0QKzT6mhfx aWhiocSVMYB7clvPUY4KRbzuuRkyh2moKjqpx0AWPwJeO2UON1xlbgaOhUBIj6zIlx01 QQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kgust16eu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:23:00 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4JXc6o012157; Fri, 4 Nov 2022 23:22:59 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2173.outbound.protection.outlook.com [104.47.59.173]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpwn8ddu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:22:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QKU6gv9k4geLE4OrOjsvXxjGxrotymZuai8dudkk9zNAIawLZhM7qTLVTW5dWFHwycKpunSsj6vDjMg30VKfu994h5scEN4qOp3R7EyliMGsVQN75GSbcxCwXB75L5lCgTr+WpqqIU3OAkeAwLGRQ/qqiNyiNP019NsnKTxwzOvDdQrANgKHYX8m5gWsliK8TTP4YeU30vwvycwa8YOT57fIdaLJJxPYx82Iwy8J5h7+ASkkPpstbLPMlhoBZPIeVS6mFmCUotD0NyZTqN2MIfLx9CPaB9Cb76iYUIQiq90DKygkIKZUMHIfngaXTnE0x6+oSK/jv+UCsQtd+xfQAA== 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=QEuLKIm4P0f3UA14Bsh/4CQLtOg+hMunZ7QEJvmedL0=; b=Va7q19hhDfnBc13sX23K+n2VC6lRrf+Fc7deOembwepkqlGyMP4x/WweU+gHVkV0MdATxB7FyfYmLubGKBYfVHAmgG/DxXch6/HChYkA/xRK8o2un0qATngIHf3Z4DviJU/B50An1kzWpNRZ+ckYOUgnrYQfzxsuLS6YURWlTewsXKUy/p6Vmq1r5dzLL+CY3BqW20SCmuY42VapCl2RJsON3tsRVCT7MRKVsRnMDx+imZQoQ2hWWPAycJsbqxUHQUG3CQRdHUmYlEB4oiX0SdTmK+8nszt0OsZkOghq4mrKaYpCQNEZ4hS2a+ILLC6ko00xaJJj4fRSqjlH/2o5QQ== 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=QEuLKIm4P0f3UA14Bsh/4CQLtOg+hMunZ7QEJvmedL0=; b=uvqHN1oNgGqw7eNUDNrWiMzWzyrE8chiTWbVtnFg13N0gQWXALIu++XghlOdrgSWJagc9UNLMabrr4lJDjDsamYQheC/3wiflDjFRuc/TSWp3PlYJYPXtdkeKOXgJl9tLahGVH5r/yeM1DR1NfTqxY2BIRJJMfI+rhjYN+PbrWs= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4433.namprd10.prod.outlook.com (2603:10b6:303:6e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 23:22:57 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:22:57 +0000 From: Mike Christie To: 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 v6 34/35] scsi: ufs: Have scsi-ml retry start stop errors Date: Fri, 4 Nov 2022 18:19:26 -0500 Message-Id: <20221104231927.9613-35-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR04CA0005.namprd04.prod.outlook.com (2603:10b6:610:76::10) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4433:EE_ X-MS-Office365-Filtering-Correlation-Id: 2f6fcc42-0d81-40cc-3a07-08dabebb6d74 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H/lSqmjTZC2Ngppq17V9vGkE6a6Sj8PzfWCWZmZKUzvq31K+9h5Az7LRxoC4AWi3UE8P5VX4/1soF3MeAXcv506NvW0ZgMlJQvS8aU7zOUxJORuNmUIOOzmmV1ONDuRT2dWdZgG4Yx+0dFw6LJ0wDE7+z0fGzJK4QKj0MaMhEq+ndfGVXQhf+CYkwYN66jdMvfE8UuhYaTtHwEfXHRmFDpZMgmYgQacGKHnrI//AtVgbPhDvRA8l8Gf7rNYpzvqVfqTBGtmXuYmVAJ8a+wrwMN8vp23Vlqz5L3SG1BGiapN5890dpgpwEHzw/WemYDGbAmSguMsCnK7dOQ9gD0SYQdSXUJ8iX961HBzPCLk7omUNr/uEMlo6qlmTOLffpL0Xf1jTj/t5eGBdjwGbFuo9VFeORwmMX0AQm/r9n5vnDXF0OWSEstovmAnxATn499tOc83RFfLENypsE+3VkVB4V3ZC0OX1OhYfzJi3kfB/4zeZXFBP+DoawU/BMdzp8aavKjP+TCqQFWs8uuF+XZypQml/jJrU0oDsTWNoMqF8zvR5WzQPFTYVb80c1QnY7n1oHOa2jKWgAJTag+5k4wx/d0lHCc0v8erMHYmbVtDduMwfPaN2pF6ZLcwL0MacjpYUjaWj1IaREFn6DEcIDSNDNIETPM5s0vBFY3o4NkofGchzIR+qqUWCCVsK6OeA20jDrXK99ESY6zty2O78FpUz3A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(346002)(39860400002)(136003)(396003)(366004)(451199015)(83380400001)(8936002)(41300700001)(5660300002)(6486002)(6666004)(86362001)(478600001)(107886003)(8676002)(36756003)(186003)(1076003)(2616005)(4326008)(6512007)(26005)(6506007)(316002)(2906002)(66946007)(38100700002)(66556008)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6NcMgra0tFIChu8aIIA8NRQZR8e5pyT5nbo5xGu02M5l6CszU+VM5C8RqLfzsF62uPEYhTu7HaJHgHMQWO3iOGx3V1PYYKj3VVoH5Cq6juRvEFTp1dAo5GwrazLv2zKin29K/NxttoN3T8rWp83IOstoe+F3xHjKWg+E7DU7z70FDXz6bELikhFTqFGtNZUkF4I39DraMM+AAWE1Mu5DsNq85WCT+AqXOFKScv2J/DWTn90RkjmNo/G+FmvbUUr9Ad8IDHdG/vF/bHXjrE3m1rnRy8TKIisbNventrc04zWC2a5dm0r/U1iT/HrP29TNLZuiShFxWk7rV/kfyopa2naLll9+kxtzJvn4nf3m6+sJ+3ZdGMq0cb1EpY6izjUJqQv2/yXbSIqCyiFOtQRXNol1c9/9ddmlYTLSI+gGYgsYsmV0fmg20UiC6yelfirFUvGtzrgFyNn550d07azHeIhe5VkLpqPrbAZ/OJ5gKUqB81OSX7fiPHH+6S4h2lEeNynX8TA3HOJKxlqxW7wZTNaJHhAF33TS4jKFvOJ0XK2+1P3NFUh8iE0xd/X6HjxTTpNlOCSsUN2LDHrKSFY3KbCGlHDFX+5WKOEKnU11tFgx0bQhhmHwULvnQ6uYIcSV5G3/RTg3eij0Vob9w+0cx4RverN0ULT67cU2++nLRJKrUaA72H8tavb2MWPpJdC2GAPZJ4q5rEjLYMhgrxdJkNpMfHmkJF6zXufBUYBEZyfqryp1+BkfOWKiiQHEKVM4DaK9bOarQSt4uNs+FkAy9mUn3W3f4n7bWm0WeDFg4jcPAd379NVWNlC9AD5lvDsNmbPHE1LDyJfEAXI5scVLwTnr744+qBCepmOLmkEysGrz0kifMHykbxE53mFIjZt0u7DtDA53iV2HpiSsGFKb88QuxMQOjK0g6u0yJwFSYk5qdhVgNQYRN1vQuTzUgkLh41uGlE92+ABGvK6MolWa7jK3QR29im0P8ScyQk1x5nzfoeIz6bxWcMqedoIyxlouFUaDkS3atCFer9z8a1dFqjUebjkuYH8D55zUNre0HXyRv1PHlMIpwp+uBEFexwZwXjm51AoJRjiusH+RBLtbh0ZVVEbjGzeoht7H3xKiAoeugabL9l2Dmji2EPep/yLbCgt5C9UbbWMWhDVn4AIIKIPL+iFymnOoAZuwAu/mXtTShU0dxRlKPTudTlCfFtOhGfavf+pAmkeVTsc2f4Up2o3nGktMuqgJppSM+VH6ShurmcSMCzQYKCf6K4uTcANUtKlonG6gLzUNETSa6vVdgsFDR01ukRoeGv1hhoLw6MHX3Cnfd1yTJ66TpKaNfOyHFmssgtg/v7ffaltt+SkCTXRJmkLTLBdVeNCoXcMjCHNhjM6nylibUZArzJCYz9MyXHHsCzVFAurvVJQh9E9BDt/drhE7AiK/Ly0hhWnffr+rCEt8kn4xwWW5Awvmlts3YfJyj9YPaDNnck43HSWg+d3wGxF+5s8HRreXiQjwiHRca/1CYzbnAAUhu438VpjCX/cR8LqSm2/1ffSVaZAhdz5CVmtEpP6MOLAO9A4XVXQXyREEU1Wsuqek74keDckQm99hKAUMkrV4MA3/o/ifVg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2f6fcc42-0d81-40cc-3a07-08dabebb6d74 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:22:23.3029 (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: A3S+lbcdZjy43Hi8jqsVej96QY0Axy2DSEU6E9+ZuOcDD22pzqN740mGPOCeNfLECybitMeG6BzKvCihHSJMaqIZnYKOFcVaEDFpjIMtE6c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4433 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-ORIG-GUID: hf9CkMryURXazf3w7-D7H3941xMNAjst X-Proofpoint-GUID: hf9CkMryURXazf3w7-D7H3941xMNAjst Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie Acked-by: Bart Van Assche --- drivers/ufs/core/ufshcd.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index fbd694bc4ef9..a8415e1b8a4e 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -8719,6 +8719,12 @@ static int ufshcd_execute_start_stop(struct scsi_device *sdev, struct request *req; struct scsi_cmnd *scmd; int ret; + struct scsi_failure failures[] = { + { + .allowed = 2, + .result = SCMD_FAILURE_RESULT_ANY, + }, + }; req = scsi_alloc_request(sdev->request_queue, REQ_OP_DRV_IN, BLK_MQ_REQ_PM); @@ -8730,6 +8736,7 @@ static int ufshcd_execute_start_stop(struct scsi_device *sdev, memcpy(scmd->cmnd, cdb, scmd->cmd_len); scmd->allowed = 0/*retries*/; scmd->flags |= SCMD_FAIL_IF_RECOVERING; + scmd->failures = failures; req->timeout = 1 * HZ; req->rq_flags |= RQF_PM | RQF_QUIET; @@ -8760,7 +8767,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; @@ -8786,15 +8793,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 Fri Nov 4 23:19:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 621985 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC7B0C4332F for ; Fri, 4 Nov 2022 23:26:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229588AbiKDX0C (ORCPT ); Fri, 4 Nov 2022 19:26:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229816AbiKDXZt (ORCPT ); Fri, 4 Nov 2022 19:25:49 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9A5C2610E for ; Fri, 4 Nov 2022 16:25:48 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4Khr76032446; Fri, 4 Nov 2022 23:23: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-2022-7-12; bh=EbNd0LS5doD9Zn9IS7Pq0qJg+Y/krwuitf1gqDy8Mmk=; b=1Epkc1n0LZxLlo50miQ9nXOwTatK+sdgGoys1zx8mVCmTgJblh1kfW5geRpJjOCh3sNh Y/sG5P6oA6g4s7IoI6Sdws1x18v18cgbyN7L8683EaEDeAd3bcb2AdMgzeL2B2T98Rw0 usOZbbJgFocopViE52eeXtqfdYpfNsux2FI4mF/Rn2/QToxX27S5zNMvRVo46rqfMIOE pG+hNdcOb3QbH3jqXmB1dIqb1PsAFZQN82h1M6WF6QjCXevvKNKbQEPIfrGACYc46yDA ti+x1x3d/Sra/CPFs58MEY1PGPQi9bwv5THdVRgHayVDQeY5kr+qDxh6Xgt8B5J9LnWz 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 3kgty398ch-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:23:36 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A4JwIpk023290; Fri, 4 Nov 2022 23:23:35 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2172.outbound.protection.outlook.com [104.47.59.172]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kmpwp0ag9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 04 Nov 2022 23:23:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WOodxPQ5RtM86lslediOfqebdODcGBZA2VVnf1BBnQJYDW54Gul88AWcRlJx/J0347GsCQlsVjY/G6zgxbGsxmLCgVeQNbU0LJcG7vogcbPEAGhhGMq61jDmiYJOOPuwtcItPqlGoT7tplJCwDUCguGtrsz5IOuEcH3cO8mASUgzne5+kOKI5HU3iu2a59xJk/5cZOggvuZevCg608GOLRF2NK5dH2sRatMMat9HhBZ5SOdUEfLgbM4dnAdc02T0MB6/tYnRhWrnRyoo0chB1kfCK1sdOHNWprO/jRIBP9VCPQrluKhCZQ+h8Z79T/PeoHAp4M9C+3WHwUaTUiC3bA== 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=EbNd0LS5doD9Zn9IS7Pq0qJg+Y/krwuitf1gqDy8Mmk=; b=ZpEce4gSIOtBcoeMaDBgva3bPcuYsHJSqlMvZd7YggHR9KA8rZjpYMcNl0PWdMzWM261U01sGNvhA0tS6+li9cMaHCyd7OTzUlbk/94DjDi/HDr63CFnUdhInk38xEKYKY8F4X37yP/yEX81dgJsYtXnGwFDmpBtcFmkrKNLkGDWGciWWNlb6S20aWYxausEMDoYpOOSqhC/y03rHU4oGYjYV9HJuBeGuvxysM4NUBxusFHZ9Za+4P7NcNBwtu+hd+5Itsr6jcUj86x+yj7BUbSaqILjqkge4j5spIDg9vKfol6VyV2Z/G1IzmgWOXK90wHCP6kSYaJtfiXM2psRwA== 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=EbNd0LS5doD9Zn9IS7Pq0qJg+Y/krwuitf1gqDy8Mmk=; b=nDjr4v87vmhJ3DvFwi1AWXdqqmzYB+58ATd5E1UURp+d+EDKEfkQiDcskVgCUD/AgGdERam16aWOqmjBcQM924lzRW5SmIUbsJjgthBsfWFmTqzvGWLdjUoGNzl/DQJQ8e6d/QcXPYv4nmKPYrAesgTroma+SEHPHJBfZ46zBXo= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CO1PR10MB4433.namprd10.prod.outlook.com (2603:10b6:303:6e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 23:23:33 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 23:23:33 +0000 From: Mike Christie To: 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 v6 35/35] scsi: Add kunit tests for scsi_check_passthrough Date: Fri, 4 Nov 2022 18:19:27 -0500 Message-Id: <20221104231927.9613-36-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221104231927.9613-1-michael.christie@oracle.com> References: <20221104231927.9613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR04CA0022.namprd04.prod.outlook.com (2603:10b6:610:76::27) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CO1PR10MB4433:EE_ X-MS-Office365-Filtering-Correlation-Id: ecc1bb85-5db3-4e97-a249-08dabebb6e43 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w4t8k7ROlM/hkooCX9WV8zlXNrZpw4T2Wima1xZnF9KYgrllIFTHhCp4/HaZLcXXUzdihwGa1okx44m7gDxHz0qiXb9WKenFeSAyMCYnrupBhHoZKeFJekWZcl7CJ78MjKFPV9D+4fT3K2PGGt46uqaXPEO0FhJIDujLyWHO1qFWAlNX1ogKqlNC6FCw/HtEY4RYjFSf/Ft0PuSsPsovD7IGbyvWQbpimQN0uhYlKXn6TBdYQM+hBVNjJ5WkpcDTdNwf4/T8wSm+JNtFeTAHf+cmSfYc/vLQKeZbwDV9O8hepyYuaNQlMCBnDMCZ/2OgJXkcam5N81O8HyGdrEUMuj4J8oYnVYZhOH9gsKq6BlL17NECSAJ3Cn9T1Hc9CbnH6ijRsFhaM4P+iQgkgCBMyDzZPORtQtA3n6J5SuGLf75K16KoW8SrgzOPYonEzsuKqgOJs6OlfcOlm1vZMGlAT8nrHcdWK42QSnLDHSB81COZ2EW5H2Xp5ej+fY7gsPnPJ8Km32AQVt+pX1fneMSaojGog8dUGRMU1ydMldj8gG/M41GgoT4rgR8Ta4AzONIE8ucs/9RI4wwEfwK15rVVS9TMwJv8aU2Rrg4R0koWvh49ZRuRFlNeZGnfITronLpW2ma0jnVMT2NnGbZKWObnaBzqgPLLerzP/rhLngqA7hJa39NzN3tZ4mROkBi1zaATqOQWunUgX6ccDHGfUR/9yg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(346002)(39860400002)(136003)(396003)(366004)(451199015)(83380400001)(8936002)(41300700001)(5660300002)(6486002)(6666004)(86362001)(478600001)(107886003)(8676002)(36756003)(186003)(1076003)(2616005)(4326008)(6512007)(26005)(6506007)(316002)(2906002)(66946007)(38100700002)(66556008)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vquw6xRLCe8XnfYqx81s6Ui3IURZwd3d37TsZRZboUfY+IungxLZcp6tB1H3jJfqAsh3X1NuS7FZ2U2LY29ksPazxo0w+wE+ja0RvOtOyyZK6/RLII/NMN+ECLAKNjMtrHj8zhdRNZVlhNEY8PvOI3XYdqG3DQA0G+JWlT8bJ/eKnudpe5PZLePTL+ef1lTyQJO2zPeYjxqMgcUNJ4Iz6ja3Gqzv3SHRTR9B7BDM/2lp9CKrVgZB4v69bdquEm5gnsjCqXDfZyotTENn5aY366y7G3wD1Lns1Z+xgfDyTw0abH5sZFlp31FQ5c2z3WG6pDkvQ8Ale809MwAyI8b1d73IpmVtF/cGENdaw+C7tXbhq9Yr7L1wVy85wYOdNo1oFq1WtBLYfco5whBO7nmbjvLIV9q8VKNee/SpZ4E7bZ2edzW+rV7Oynw/vlafuYEZxOnLQhPJYkoUHwccGefgG55T0fIS0+PTvuJciT+XkHT34OZxP9IuOu++YsrpMGNO/XqWu43eJKbPS32c/mcDBdwggL+Twv03g9RK9AgV5W0gkcQwgAK88yiOiKWVYkKJ39vDzoBlfCr6yUd9+Sp7AZRo2n0ZsWiYymMfOcpmcEfLcLFJyAYNs1cHRKnAU+cxhpUtJQgQAp1P8MCW+Vbx+V+auHGkILIAFb0LU6JJxrO7lyK3yD0ldofiRDm5bYX38NFOFdiNks0/Sg/eA4nDysrkCGnajkl6prAQCczJ8y83SQtHITUrzwmPwdd/Roy0Ct6XedDJh9k1fxTGEEjZhupxfFRKB8oFIO/GsZ3Bx6iHNj2o4Tj50TtXeQPnRVwqUxvyqjuWlW808io3YgIMQr/B9AAM+3z9ykUtWETX3ycV8t0BOGsEd2ghgTyagvC2n4fliTaB3Yqkqg6NHxpz/FX3UY59/Mh5xVIJuChP9f2U2xX7I1mLEGCISLKSZwoOXarl9/GK2pRMX3X3rW0qr/zf2jgiShKSDn+gJOWJGTQGbV8N36OO1As4BpPMPf1iToNxZruMfVNFcJNKGLem6F25flzEyShmrSG3bAnzUFB/TYxrXJel/kwalWXPW9dJVBnEHO4bJxo8Z3focUFLSx6zTqzwmFAi7BcnEJoV144PzWPRnA0AMSPSH/fXuDRE62VfDb4jVzCIDvy1cPlcYMbzelQxwRiZ69tQIIPrjufye6OMHRjTTpnlkncOWcZGWeSMIceb+eIDqFcB/yRcKVf8wK1A57zrlBZ6jtzZ2W/gvMPYuZVlsytLyff83G53L7NF3Y4v9i395GlAS1gkVjQrErHoHG1wsikeKit4iPLvsUv9DR+PAIVLr7v3wkcMfRo0PySn940IkCmqm6GavHtiZWWXq6EduKZGBQrRpFdG9opk+Z73nG0CzdnUJw0POxYYldqZ9kLMokUzA2mtLhjt0VCxT3RiurGX6/zp28JkUiqPZlcxp4j3pmc8l5/8BQ8pqt1Y3+0CiblFrb8eMu+BSBffEpHGWtCTEDW3C9mCigrJj7Ejb6WN1271RZbLulQPAr8FpnU9wyr7iWkiAawNtHkHrxqzWH1LzcGFtYFpz3ojwRxv+Y29NQD6Z5P2ZB30GsPBpQexPKlic0K03Q== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ecc1bb85-5db3-4e97-a249-08dabebb6e43 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 23:22:24.5528 (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: fKOuPd8VK2ADzyzWM0C8Z176i7sn931sdfY2BZVHV3Sj/UeP63eKC495o3Yhhc9zL93h3mRDqWdCRynpSqfdzjvpaf16Qeh86H8lQOmz4mY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4433 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-04_12,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 adultscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211040143 X-Proofpoint-ORIG-GUID: Teh1NvzJb-tKhuY6bVbitiy8MBdryYHt X-Proofpoint-GUID: Teh1NvzJb-tKhuY6bVbitiy8MBdryYHt Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Add some kunit tests for scsi_check_passthrough so we can easily make sure we are hitting the cases it's difficult to replicate in hardware or even scsi_debug. Signed-off-by: Mike Christie Reviewed-by: Bart Van Assche --- drivers/scsi/Kconfig | 9 ++ drivers/scsi/scsi_error.c | 4 + drivers/scsi/scsi_error_test.c | 171 +++++++++++++++++++++++++++++++++ 3 files changed, 184 insertions(+) create mode 100644 drivers/scsi/scsi_error_test.c diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 03e71e3d5e5b..52147a848824 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -67,6 +67,15 @@ config SCSI_PROC_FS If unsure say Y. +config SCSI_KUNIT_TEST + tristate "KUnit tests for SCSI Mid Layer" if !KUNIT_ALL_TESTS + depends on KUNIT + default KUNIT_ALL_TESTS + help + Run SCSI Mid Layer's KUnit tests. + + If unsure say N. + comment "SCSI support type (disk, tape, CD-ROM)" depends on SCSI diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 77d7ad07645a..8d1a34a8bb3d 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -2613,3 +2613,7 @@ bool scsi_get_sense_info_fld(const u8 *sense_buffer, int sb_len, } } EXPORT_SYMBOL(scsi_get_sense_info_fld); + +#if defined(CONFIG_SCSI_KUNIT_TEST) +#include "scsi_error_test.c" +#endif diff --git a/drivers/scsi/scsi_error_test.c b/drivers/scsi/scsi_error_test.c new file mode 100644 index 000000000000..23a2e7edc5eb --- /dev/null +++ b/drivers/scsi/scsi_error_test.c @@ -0,0 +1,171 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * KUnit tests for scsi_error.c. + * + * Copyright (C) 2022, Oracle Corporation + */ +#include + +#include +#include + +#define SCSI_TEST_ERROR_MAX_ALLOWED 3 + +static void scsi_test_error_check_passthough(struct kunit *test) +{ + struct scsi_failure multiple_sense_failures[] = { + { + .sense = DATA_PROTECT, + .asc = 0x1, + .ascq = 0x1, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = UNIT_ATTENTION, + .asc = 0x11, + .ascq = 0x0, + .allowed = SCSI_TEST_ERROR_MAX_ALLOWED, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = NOT_READY, + .asc = 0x11, + .ascq = 0x22, + .allowed = SCSI_TEST_ERROR_MAX_ALLOWED, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = ABORTED_COMMAND, + .asc = 0x11, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = SCSI_TEST_ERROR_MAX_ALLOWED, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = HARDWARE_ERROR, + .asc = SCMD_FAILURE_ASC_ANY, + .allowed = SCSI_TEST_ERROR_MAX_ALLOWED, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = ILLEGAL_REQUEST, + .asc = 0x91, + .ascq = 0x36, + .allowed = SCSI_TEST_ERROR_MAX_ALLOWED, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; + struct scsi_failure retryable_host_failures[] = { + { + .result = DID_TRANSPORT_DISRUPTED << 16, + .allowed = SCSI_TEST_ERROR_MAX_ALLOWED, + }, + { + .result = DID_TIME_OUT << 16, + .allowed = SCSI_TEST_ERROR_MAX_ALLOWED, + }, + {}, + }; + struct scsi_failure any_status_failures[] = { + { + .result = SCMD_FAILURE_STAT_ANY, + .allowed = SCSI_TEST_ERROR_MAX_ALLOWED, + }, + {}, + }; + struct scsi_failure any_sense_failures[] = { + { + .result = SCMD_FAILURE_SENSE_ANY, + .allowed = SCSI_TEST_ERROR_MAX_ALLOWED, + }, + {}, + }; + struct scsi_failure any_failures[] = { + { + .result = SCMD_FAILURE_RESULT_ANY, + .allowed = SCSI_TEST_ERROR_MAX_ALLOWED, + }, + {}, + }; + u8 sense[SCSI_SENSE_BUFFERSIZE] = {}; + struct scsi_cmnd sc = { + .sense_buffer = sense, + .failures = multiple_sense_failures, + }; + int i; + + /* Match end of array */ + scsi_build_sense(&sc, 0, ILLEGAL_REQUEST, 0x91, 0x36); + KUNIT_EXPECT_EQ(test, NEEDS_RETRY, scsi_check_passthrough(&sc)); + /* Basic match in array */ + scsi_build_sense(&sc, 0, UNIT_ATTENTION, 0x11, 0x0); + KUNIT_EXPECT_EQ(test, NEEDS_RETRY, scsi_check_passthrough(&sc)); + /* No matching sense entry */ + scsi_build_sense(&sc, 0, MISCOMPARE, 0x11, 0x11); + KUNIT_EXPECT_EQ(test, SCSI_RETURN_NOT_HANDLED, + scsi_check_passthrough(&sc)); + /* Match using SCMD_FAILURE_ASCQ_ANY */ + scsi_build_sense(&sc, 0, ABORTED_COMMAND, 0x22, 0x22); + KUNIT_EXPECT_EQ(test, SCSI_RETURN_NOT_HANDLED, + scsi_check_passthrough(&sc)); + /* Match using SCMD_FAILURE_ASC_ANY */ + scsi_build_sense(&sc, 0, HARDWARE_ERROR, 0x11, 0x22); + KUNIT_EXPECT_EQ(test, NEEDS_RETRY, scsi_check_passthrough(&sc)); + /* No matching status entry */ + sc.result = SAM_STAT_RESERVATION_CONFLICT; + KUNIT_EXPECT_EQ(test, SCSI_RETURN_NOT_HANDLED, + scsi_check_passthrough(&sc)); + + /* Test hitting allowed limit */ + scsi_build_sense(&sc, 0, NOT_READY, 0x11, 0x22); + for (i = 0; i < SCSI_TEST_ERROR_MAX_ALLOWED; i++) + KUNIT_EXPECT_EQ(test, NEEDS_RETRY, scsi_check_passthrough(&sc)); + KUNIT_EXPECT_EQ(test, SUCCESS, scsi_check_passthrough(&sc)); + + /* Match using SCMD_FAILURE_SENSE_ANY */ + sc.failures = any_sense_failures; + scsi_build_sense(&sc, 0, MEDIUM_ERROR, 0x11, 0x22); + KUNIT_EXPECT_EQ(test, NEEDS_RETRY, scsi_check_passthrough(&sc)); + + /* reset retries so we can retest */ + for (i = 0; i < ARRAY_SIZE(multiple_sense_failures); i++) + multiple_sense_failures[i].retries = 0; + + /* Test no retries allowed */ + sc.failures = multiple_sense_failures; + scsi_build_sense(&sc, 0, DATA_PROTECT, 0x1, 0x1); + KUNIT_EXPECT_EQ(test, SUCCESS, scsi_check_passthrough(&sc)); + + /* No matching host byte entry */ + sc.failures = retryable_host_failures; + sc.result = DID_NO_CONNECT << 16; + KUNIT_EXPECT_EQ(test, SCSI_RETURN_NOT_HANDLED, + scsi_check_passthrough(&sc)); + /* Matching host byte entry */ + sc.result = DID_TIME_OUT << 16; + KUNIT_EXPECT_EQ(test, NEEDS_RETRY, scsi_check_passthrough(&sc)); + + /* Match SCMD_FAILURE_RESULT_ANY */ + sc.failures = any_failures; + sc.result = DID_TRANSPORT_FAILFAST << 16; + KUNIT_EXPECT_EQ(test, NEEDS_RETRY, scsi_check_passthrough(&sc)); + + /* Test any status handling */ + sc.failures = any_status_failures; + sc.result = SAM_STAT_RESERVATION_CONFLICT; + KUNIT_EXPECT_EQ(test, NEEDS_RETRY, scsi_check_passthrough(&sc)); +} + +static struct kunit_case scsi_test_error_cases[] = { + KUNIT_CASE(scsi_test_error_check_passthough), + {}, +}; + +static struct kunit_suite scsi_test_error_suite = { + .name = "scsi_error", + .test_cases = scsi_test_error_cases, +}; + +kunit_test_suite(scsi_test_error_suite);