From patchwork Wed Jun 14 07:16:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 692952 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 87FAEEB64D9 for ; Wed, 14 Jun 2023 07:21:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243382AbjFNHVy (ORCPT ); Wed, 14 Jun 2023 03:21:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243376AbjFNHV1 (ORCPT ); Wed, 14 Jun 2023 03:21:27 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7F8D2959 for ; Wed, 14 Jun 2023 00:20:29 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6k2cS026413; Wed, 14 Jun 2023 07:17:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=RZUJPlfKtztXPVD/evtRhkN7c36HQXXfuN/S0ofy9kw=; b=JS9i1Ij1NIQHA/MApkzSGHCKNuEs5bQwDd/IMkOXEuhV9KfAljinLsJSjRegBOj69EvZ wljOn1+wNFclVSX5pbmd1rrneVc8EG1KKahzq72y0p1ht8ixKVeLXRwwDzGWls+kmxVZ V2/FzcwjlXMtBJwVbDBwGKJun/tLsWvNqC0ZNWWRFPlTnXHAWNnpm3dqYCAhSvSwFwA+ K5KfjPVyzLy2mO2TbQIUkvr/eHqHDIgqiqy43oWRSZqES0rrltY0VXMgcz+2wFrhBspT wyCFzd5lEbprL5rutlPrHs36tca25dYjn6SC2fcNvGxmHe3U0KjfvxUgzOKXNVH/kMP6 LA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4g3bpyt6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:30 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E72W75021596; Wed, 14 Jun 2023 07:17:30 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56byv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ek2xHxlbVrMu4hKLFNtzVa0v5iCFN75fqok+YC01DnZws7wOXjfmQqz5MwJT7YVV68hPE0dlY7VFaauNDBEL64Nz+Xd45V9BYcfUzquc5Ah7j8LIYpTadLPcH564WeMgT+wKPh3F53NKzYQ49SFrSjnfo/9nAznIVVwHA+nVyVgnBZVnlQFlRnfe9GAPUAlVYL/PoLybeHJfWprrM2oJWD9yf6YH2V+7BI1onitgYhj8Tvdu0VB38cFbu8X5zC8IWXF9kf890BLQd2hD1iL73HWUtz6G/Pay5zJlOdRQpp60lUMo5SXtPOzhgFBUQtkkE7gbslBtnhWqDqEQGQWv2w== 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=RZUJPlfKtztXPVD/evtRhkN7c36HQXXfuN/S0ofy9kw=; b=i7kBVqkpDsudaw06P1//K5OidtvLVWv7pix+N2iznegKKqMW+8jJvxc/0XzxEhsjqyfhczBUY5yQgV0P7MDY91JxeMPSOVayTSnGAEtHeEgWEz9Or9fhpObsqOsg6fhV+uHl7ffyOI8CDu7nO59AvNFonNXrEOTR4z5vzygVed6OaYqHza2EnzQxTT3K97/dvItMVAe95Uw+ClTZTIjlKV7DU2AjIJ1HhDJ3AYEr0xcmPOd4CREVkcWdElicqlo/zwVuetmW4QKx9huOr8UUA2RaZUiM3AInNGpY4EipU+41reFrGw3iUUsyv/eNUBjHPgNW7UgpvlQvAzLtcfLh/w== 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=RZUJPlfKtztXPVD/evtRhkN7c36HQXXfuN/S0ofy9kw=; b=mm7njwuMSi0Nm67h9nbV6JopZhuzfnYFpBpZEyLTg+FIdSdA/W3PtWadri3ym3tx9Ve9h3OEuu6xUIrxvmcU7eHXEdjOTcNwfGlCoy4B/voZBvHq/SDdpRuMSvs3ipsM1h+Etbk0S1rN53zOTjSeg7WpUKdSdRGclR0XDGuUvm4= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:28 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:27 +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 v8 03/33] scsi: Add scsi_failure field to scsi_exec_args Date: Wed, 14 Jun 2023 02:16:49 -0500 Message-Id: <20230614071719.6372-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0062.namprd02.prod.outlook.com (2603:10b6:5:177::39) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: e943901f-0f1f-4223-bf9d-08db6ca768e2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hXk7XB3kh+6J7gXfq2d5JRzilmcwrrdFv+bHYXJVmbD7IEh2Nq7J8oVbGoCMRVEvx5jK0cAD+da1Ff5lyDgNn/cUunWdnVA+MkLiAyJAs3jGcy2/nYSk0BXeudYQpIZLQmu5tzoVtKaU+4v7OMlMjjfecBWtogI0oVfwG4hKsLCNr8GL+10p3R1I69znjGR9xkCfBaGDdFNI2f1IJ7LW9fH9tcSlZedcHsrZ61FZTNdw4er1gYLglJAZ62jCsMG8ELa4aEtFCDqDDR3pYZnmzI0kM8OBEpaYsOrolGfmQPqSwtrcHPhteHEI4qInAjegHrJiE7D6TANFEEZZM4aqotGAoIxGab6v0i4dJM4AQ4w45JtAFAnqppyi0GGtKK7Sd2fMAmhkTYYH95LJbwQMyqRY078Szti8iqNeAHQ7I3q+Ye4bkMbMdvQjzW5NAj8CV55j+aNHHtDtqspWEh7Obr7saynSAk7N/6LEFrAykSppvLqoRetOufP7zdGRp5V4DQ7mmN75BvTDUsBBrgB0cjxK6uO7wlDaEhJLbcbYj5sCsm7MV9c9ahQN306zny99 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(83380400001)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yUNB/5mLkARh88mU2IGwMdd0mSxOXmwcEHLY5/5K4ZCthMkGrJVFJsjE82bvBvPGVXts8YDOg20PI5suLqPuR5FtzNy/onsfsweHvWQ42kHUMrsCEBiF53Y1XNDr5kXpAPrTZe0DHjJP5pXWp92ShpgDx7lXRXUbjoWLwRPOvgWeAaebICjx1H4o6LEt2ilevaiKStjiM+3WxztoVJk87Lg40WJA4X1eDK3eOYPMlCrGUzmViZ1lqaV9TYD3wuAy6LB7KOZHisfyNUZ/UAbYgdm3T70pPu7Xka15I8Bs+gnyv4DHn4xDFyTrn2pFLbFN0mM/wOHP7AXA0AS5IKE89zHry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v5riD76vfUthVIzZroQ/gM/rO8UDxUvAsN3+n5VU8aolXyBd+IsyMWZQ6amqzHiQD2vHM1XsJlfzDK7a2PfF1QHBkqT9d8ZbTgP X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e943901f-0f1f-4223-bf9d-08db6ca768e2 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:27.9171 (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: I4ueGiNBdwmCq1u1Z/8BtQplAJ32CHKJFe4aPvHpjSq0ZPlr4J/Pb/qN8VyOIlxwvnJ9uqeQis61l6P6TeSAv5fXLb9YgWH3/htWAExINpM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: -ThxQ1zHilVvuRX9hdTyLdM9FFFnFRyp X-Proofpoint-GUID: -ThxQ1zHilVvuRX9hdTyLdM9FFFnFRyp 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 53cb649b2f28..f539fc4b7148 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -237,6 +237,7 @@ int scsi_execute_cmd(struct scsi_device *sdev, const unsigned char *cmd, scmd->cmd_len = COMMAND_SIZE(cmd[0]); memcpy(scmd->cmnd, cmd, scmd->cmd_len); scmd->allowed = retries; + scmd->failures = args->failures; scmd->flags |= args->scmd_flags; req->timeout = timeout; req->rq_flags |= RQF_QUIET; diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index b2cdb078b7bd..381d08220665 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; @@ -472,6 +473,7 @@ struct scsi_exec_args { blk_mq_req_flags_t req_flags; /* BLK_MQ_REQ flags */ int scmd_flags; /* SCMD flags */ int *resid; /* residual length */ + struct scsi_failure *failures; /* failures to retry */ }; int scsi_execute_cmd(struct scsi_device *sdev, const unsigned char *cmd, From patchwork Wed Jun 14 07:16:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 692953 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 312C1EB64DA for ; Wed, 14 Jun 2023 07:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243374AbjFNHVk (ORCPT ); Wed, 14 Jun 2023 03:21:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243366AbjFNHVZ (ORCPT ); Wed, 14 Jun 2023 03:21:25 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C641E294A for ; Wed, 14 Jun 2023 00:20:25 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6k2cT026413; Wed, 14 Jun 2023 07:17:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=+8h5Q/GBKYXwK5pBMb+sNzt0D6jZHtVd86NT5V7jdAI=; b=zM31qmCj3ccQ0Nb1qlyp8yxwrCpr2NDNWDG55UcqCbuImnH3jfZvu2MednZnR95KhY5L ++8J3aztRjSCHqEbeL7AeoNcP1mzXP3kfyEmtkwHAB+5hhMZ3C9laJ+J5puJKfyWy/ZW XFHhhWmuXzZcR+hNUHl4ClP3W0+J9TboXDgjuWJHG7eXcxfkGV0Kx0Qddopv61rTTO6G QRDvAVFZF7D/x/wUGBrzfQRUBObj2DXh9Pd2PoBERgPWbHgYfapt/aXNq+3tD/JARTav odTYB2n0eqMJKd05gPuWTiFI6tCX78/PATWROLe+rnQhgnj0241caS/YUuFlg/R5/0lO cw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4g3bpyta-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:34 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E5aFRd008455; Wed, 14 Jun 2023 07:17:33 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fmbex98-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=erevcWtfUkgaACeWbpFdtT//GdWqKdI/7ZqL3JThNr2hg4BwiHV3jH/lizdRU6yDF8Fa+Ed1XgdUwdOUKYjVqWkV2bbJW/DTySnNVfXVxSeV1k3tb/0xJgJxJC8p3F8nhsZYIaHPDWbkAuRmjF6qFiUpxsEnVZcuQQPzXaEKrOcoUw+N+ckcsrsq/bJvBDpOcxBlmvQw78qjAkaNSU0Di7P4Kb7saGqmcbUCt77m80IWH08rDNmcdMqVRk37N2KVdiyFvU4FDGmiy1Xe7lvYpohXOdsoQqUD11PLMu9t5c5MiPIeBtA0yZWhU56hFxTCLMkjNGkhesh5prO5EUOaTw== 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=+8h5Q/GBKYXwK5pBMb+sNzt0D6jZHtVd86NT5V7jdAI=; b=kVEbM6O0oNWqJDDL2+lOoxcrtw5bv8YVL42BaN4gIibByu4KMV2thvmWT06bYOdVjwvgwop6mCix7BLhdb3yUfA6iP4JXhCuOjFI8cItJp9TdQNBWgGSS8drg2lqC+Wx/GIqPFwd5175pAcWop7bni/ECodCpIef9VIxR7y9s+99sAMTqF7uh4d+ryp2i9pttbULMk7wn4GinGdRvpZkN3pduRQ1e99PFfAFbmuPlgicqnfnWDiBH44AZE3iKP/CdXVQPfMkX9i6AoouKZjSgFz3mD0hrsIKIEiMthWLLW6FghT5YBwZupMsTeGXtdDKfm8P4eo+vxBr4K2wJnpagw== 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=+8h5Q/GBKYXwK5pBMb+sNzt0D6jZHtVd86NT5V7jdAI=; b=bKws4fNhu9CA60P0jPALJhMoqn8N9TO/M+yH3U8Gsp1NVLNmMQL/iZNt6VKG37lOM2EXJnoOQl4CIOsAf6c1NUFRvgRB6M7AHdTqn5+2zZvIXxEvqxFifKhwYNFlxwxmTW9NlDX3oWx3ujMcvHPLUppv53qBFmf9xu94VIRq2zo= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:31 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17: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 v8 05/33] scsi: retry INQUIRY after timeout Date: Wed, 14 Jun 2023 02:16:51 -0500 Message-Id: <20230614071719.6372-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR11CA0062.namprd11.prod.outlook.com (2603:10b6:5:14c::39) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: abeaa2ae-219c-481a-e180-08db6ca76b17 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k3TZANoGXnB1ZRT2fYcW/rgVPf3LLxnF5k9ZGn57/giyIqQVWsXPUz8Rr93q3ew9Y0bbzS6Y4aY5zCiMuM8JkFXBp599PM4sn00x/Icnw4dQXbEvvwn9yul9bHznuRFlNP8s+4lH9qPTPR6eU6RAWhMckZ1L53oOG0z3I6bbmc3xshScKtvSZ13hRJC2tQEhWiyO/1W950uWhYp6PS4jUhh4HvRMt0rGxR8ocu8IU75WX6ZwuZ0A1IyWg4heRoUP8W+rpqlLhLNWaMkuj4wE90Htf/W20ySexDU0ZUGHdKV0IXoc9Tq9y+ZV8UoCABe+0zZ4RpuD+cJ8Lehev+Uh/3DkxJdv2av7lNZQ9lPhbYKpPqhk2z3Ks+kxp9lidpZz6LzlaRRs8PTEDhDrskYaVk+OS5Z8+cdpq570ox7mzYLl85NGNfAFDOCr+2xJvvel45FnP+OK6yJ12IvAK/gBqWv+Q71gW3VD5Cnb49mEwrT2OUSmhCUoqmue0+ZlODDlYI/AiHHTKbQCoUMdXGnZhsfAPIayd8QsJ482SXY3RDsa0/N7CvUP+hV8N+RiqTWU X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(4744005)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HpkIGL6tw3oUv+8+9WjbKRKEC3jT8eZYQWNg/ZHb4FI/82RfCy9e6Yl9ctp3qivqg7DZIvo+GFGBmjMplTLt6EMMYFV2wEvRT6qtR44Qy43v/Lq+OHTBMW0m0yc8jin9+fQ6lkkZPhgQzdIwpaTKh3BfMSysXW7wFFyA68mGsU9mynJRGqzraCjVHZWiW8wVBZZHgedKqh2aUs7O8HkqQBpe8qmRGJwolzTNEvwBciE44oAAZWSCPJaHVB5kbDfTSghEAehd2vboy3/2i3wD+dGfKw7Fx7Cd2sP7Np8KsUxDXs1rWSs4YOgEj4STxJR6b3WK0A0Biso2gXzRku4FhGCz5f3NynR7Oy4eR/Ir6aw/VvB0OzjMkWfaNiZvp5NvH4LV6jO2GOJ4fdaX5JiDT8eNnxeg/vfvjfPuwQKKtisPTzLqD20jPHtr32DVY5b2SyAQKfuxmuy34914ANE/yMLXBcuxHAJFCu8ZYeSFiDZFYhN6rPOfhKcpHR8gUXZ4/VvITGmEUCP4qfCWH+sGn9v1rWlZtqYLp8aXs2b/ZWwU28JbvWtvwF6icc3DCyoM4ipC+YiJLPAgsh/xqkkQpG/oFdtugGxFE5wo5yf8XXqjy4rjOaXJIzxnrLdt3TrnKWa4xe708RA0B5dEaNnA1zxL7AgJfTtqpaRGueEn91UDXIVrhyR8j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LrPU2VImntb4hi6gi7WmXkx+y515+fDES4umDr24bbqrnmF/Wes/+NW5FwlnHrfFwZkHLfgHHJKzLkWIZUyOgYhqHOogWlQvE8hdIPyXU2xouhdXKW75BkdbEEDPj+aYuvGvSmGBs3jq6L3Wo0VehpeNScQNddMxTMOicrsLrdJocgOk+FV8bNeoqAV74aZjLcCzGDgIcmQj/2WfWV3KY9AEgXC9Y6go3RyuMmsNETCP2SBv4KR5KHt882u/YhYa7E9WTKENSWlKGH+JShuh6gmBH+ZYfEwamf2qUx/Ym/j45y9JK7KxKsczNqu+3TxQkJp/JUuHRyl/2W7u40RcY0bL0VmrXfyU3irQs1hP4s2lr3Hzbp19fyI3yU1cBpWRK4t9qFG8tEhpKK7oS4wsWvsmz4Oia7VK7j05Qh9h2w8xnQ94GwYNhQ5nknZ4qxtPfFb/apN8aGbRq1JNxO+/qNTowQFVNO12NxD2OkixOxPxhi3bpOoD+S8EjpHbNMngJCgjUX6rjjGX3YsO4+BrqsFiR3h5xuw4OYALELOTETlXq6D7Fm8KoZb8DmLej2wM5tpxX33E/uNmx5kNG5ZoMgJIFyxdzYInuOnOEtzTRTEAfbG/xRmR98O5c2qfnZ3/Y1NkCUbSsp40pGi+BJmbaMzeT7UPk51BECBZjPoo3N+VVKZ/xlc1zKmgk3ZioOksKm3qJAvCPz6R2FRBKQIyn+CemSRBSel1zZdmtVDojq99eldgwyNTylZv24t9hkHt0LCxDQTjjphHHAu0lLXD/bso/BgWFJ0FLqAx9NMHXuqUB68/CaIo// X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: abeaa2ae-219c-481a-e180-08db6ca76b17 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:31.6457 (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: ErKn7187AchAwUOjl5yQr9MBgGSRDsX//VG+fN3nXc67jEqgtyixCpRLZn0gS+Krka0VfsNdwel+oQrTOwcBmzKGjLUDBugTwghVoFZDYPY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 malwarescore=0 mlxscore=0 adultscore=0 bulkscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: LIWzSfrzjbt9VtkwZHhXMwPPzsfg1Ror X-Proofpoint-GUID: LIWzSfrzjbt9VtkwZHhXMwPPzsfg1Ror Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Description from: Martin Wilck : The SCSI mid layer doesn't retry commands after DID_TIME_OUT (see scsi_noretry_cmd()). Packet loss in the fabric can cause spurious timeouts during SCSI device probing, causing device probing to fail. This has been observed in FCoE uplink failover tests, for example. This patch fixes the issue by retrying the INQUIRY. Signed-off-by: Mike Christie --- 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 519755952254..eeaefba6c9a9 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -665,6 +665,10 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, .allowed = 3, .result = SAM_STAT_CHECK_CONDITION, }, + { + .allowed = 1, + .result = DID_TIME_OUT << 16, + }, {}, }; const struct scsi_exec_args exec_args = { From patchwork Wed Jun 14 07:16:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 692955 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 EC574EB64D9 for ; Wed, 14 Jun 2023 07:19:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243388AbjFNHTQ (ORCPT ); Wed, 14 Jun 2023 03:19:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232697AbjFNHS1 (ORCPT ); Wed, 14 Jun 2023 03:18:27 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E81026AA for ; Wed, 14 Jun 2023 00:18:01 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6jpRN021304; Wed, 14 Jun 2023 07:17:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=3uyodE3R3q3yhZoSXvEGv2FAyi2ghfpYkwumj1XPy7I=; b=CVlyoq4NTrHqsN4Yw1i6Z5L1C3Ci/kMcXm32IaeHpwy+xXLQ8upK8EDTmkH/XptDgsLR mpFLb0/TJMeK281gAdQXxplUydzWXfx14wGHyV/MMy/4BqTo2NbcClRDvWPE4Ncd3ipW 84gSgsmdk1y9OCsHuBpeOUaiQRGRfTsfiBNXik8JaQUTaM4tPCO2tuTpGKZZVHTVDpun 1vHawldJtVesMIRoitrMv+Ql6vj7Iuj4BKHPDDAiIOtjZw+Wpxeq6KUUL+NugbhQshR+ AIIuf22jpveV/KP2KmW6ap0dLxp40xUlQnBNPEK+V7mittmLnmT555Pv/E7mYzspl02J DA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4fy3evq7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:36 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E5fLol021717; Wed, 14 Jun 2023 07:17:35 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56c3d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g4IQEBx84Hm+VYj6u3HHJYAC75BzAO7xzA/gfHmJxXU2NU56yvu9ywgWy4VUQ4ZICNVQt9f4yU+/SiwGnpWV/yZXt0vxfuwplpvbZanFbDcUq2dcWAYfajsc9U8Axb4xubU2K5QdVxvljDzF0U1dU+uDLicbwg/kcXwr59tLf+CoF684e8nLkQDUfSUsCmI3qN5SAkFLALUUyvbMkeeDxgWnUq+JLbWOVGP0/VPL47Mrg2GGRBpoMxFhUmas+wAu50ikmei5w9Saafj9Wf7scGmLDRx1vzLCc6oD31c+XrjtWV1pgX/1lVndlScd2cwoUN3F2o/F7LeVom9+tmAdAg== 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=3uyodE3R3q3yhZoSXvEGv2FAyi2ghfpYkwumj1XPy7I=; b=Kec8cMaDh5fPDAxppWPOQfz47ovJCdOUajHB0e/yRs5g+K0q7W9D3HwAnf52SV4l8sckWQHMVCnMVYYpOkviDyghX33YXMtLoUHtxLX/JQ0eilVeWqeJqzgzcJqjicNMvn8u443elQ0cGuXh2p3T0Uss4FK18sOy9bfuIt/9bSkTbYZWDfA5G+xfx4MIWqtOSdlGVtltsF50Y0qvoJ1MxT6v6jlT8pkPvgF2g5kZ+VgFdxtm6RWouvdC4zOBfJ4tfCeNv6T/ZxrOM/3qw4x7hP4XwxrUaTDG2r/UkeI8Mhvs2/vnNX1jwRfeuQoXlrGw2l5nagQmu8X2DYjIz3HeNg== 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=3uyodE3R3q3yhZoSXvEGv2FAyi2ghfpYkwumj1XPy7I=; b=uRPfdEIpsDNfdsVNmzfo6MmqQyX63IC67iq9jzCuT4P607fhh9/FhoTzg9aX+v0giM0BTi2hnnWiX5hkqsn29gNRDLKzbwZfCHY7eEmHmeXrLHTfPK5jI4JcQtWZnXyGS0xexc42JK9DMOgJZQGnFp24PnCsc7mgLiyuHXDXMis= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:33 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17: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 v8 06/33] scsi: sd: Fix sshdr use in read_capacity_16 Date: Wed, 14 Jun 2023 02:16:52 -0500 Message-Id: <20230614071719.6372-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR11CA0061.namprd11.prod.outlook.com (2603:10b6:5:14c::38) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: 6d9b21ba-ed2c-48e2-4173-08db6ca76c12 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vcjP8VGWw11FCSbyJZzQKJ05yJczQCwziHq/7k31uYjCOiAFy8KY2FhcT8H6zQA7pmyUZ4yfH7Yfh6wDHJNpLZlpRP0cENgg82FR605wSs5Qa8ISpdQjGPZTc2RkJC7iCnsSYMbdImvk52CB6/r3r7WbnWL7DFGtMz29/ruRDGNY/OJ8FREY7U05aug5Y23OO4XHRa+S1LpdGzSyUQLhuj8wV6NGVGLWs1VqoZQ4wdLH55X4KF+RxoRl2dvsulZejgPQ+iA7p47U4MCU4TVk6/H30cDdS20Wv9/il5kb011o0/5n7f+OCHicYaYXZiL+LZFj4Ok+WzJLq77NIL6qt6EhOeCLQp9PeN9d8zS8CKCTbRpUJCFKrVe1Xz6cikjojHPWdPWzN2FxbcMZB+lvYMX+aH3qFMGPMsRv+j5Atvv/3ruWlMzPf+Pfr2kz6iKLPw7WmcKEjSc9hr6/B3IF7FH3QjDAB+aECF6G6V7/JFuSziVLmjCmL9hJDO2T6H/SSrYTIjiiIzDRwdXU5Y71zJb0FMWBXOvY0D2dXajIxK+0dGueFOyFMQaZcLyQLRtl X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(83380400001)(4744005)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WN8fqIiDwbxW++gYBn4jIo2r09Y+qG9/7oWUtUFceRmDSmApUS9pbgzLGh+3AMyP3xrzUHZGw+AOanN+f5nog2kAekphu657KeBVThXvoN/T6YRumLBcLzytzmArsusHi7uidu6lA7iwn04cR1uCn1jVOnLJ8qXbGHQL9HavIc74beNQ/CMSL/E8L3qphYI+RZLEhvvE3AJ4equ/UmYyeHCHfpE48B62NaEfKQB1ziomEB/X2CnKGWyvH2zy7Xo+rOOLhEOz11NYlWlqR2cXK9vXdWDuVsnxuZeO8k6hemgkTRYdxMQPlIuCri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Tq1RuycGGajOtHQre7qCAML1bSQahqPD318sUUY6S84cmug3fXy5zZNIMMrfN9AVfcYJvGxXRFv+oYKWLbEcso8x8FjSuFKoSRX/parptGQIxfbVf1eX X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d9b21ba-ed2c-48e2-4173-08db6ca76c12 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:33.2834 (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: lb2lSlIKDU558zw1r1P97nTL+wA9K7HsSd6l8RxDBnTlckq/oaqG6PSPrudej8jqiiLDtWPf5bTlgt0S7vkAoMDL0Ysd2ooujsSgRxtEf9Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-GUID: D5GcqrBbDWfws6nqdOyZE4I7sGLuL0Sk X-Proofpoint-ORIG-GUID: D5GcqrBbDWfws6nqdOyZE4I7sGLuL0Sk Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If the_reset is < 0, scsi_execute_cmd will not have set the sshdr, so we can't access it. Signed-off-by: Mike Christie --- drivers/scsi/sd.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 84edbc0a5747..a2daa96e5c87 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2428,11 +2428,10 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, the_result = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, buffer, RC16_LEN, SD_TIMEOUT, sdkp->max_retries, &exec_args); - - if (media_not_present(sdkp, &sshdr)) - return -ENODEV; - if (the_result > 0) { + if (media_not_present(sdkp, &sshdr)) + return -ENODEV; + sense_valid = scsi_sense_valid(&sshdr); if (sense_valid && sshdr.sense_key == ILLEGAL_REQUEST && From patchwork Wed Jun 14 07:16:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 692951 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 2E577EB64DA for ; Wed, 14 Jun 2023 07:21:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243212AbjFNHV6 (ORCPT ); Wed, 14 Jun 2023 03:21:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233310AbjFNHV1 (ORCPT ); Wed, 14 Jun 2023 03:21:27 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE120295F for ; Wed, 14 Jun 2023 00:20:30 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6k6u1015552; Wed, 14 Jun 2023 07:17:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=q3Lgco7wqD18t6/6i4FAJLYtfYYJ7t//4yJltDwkcaQ=; b=c1js+58eKgDY+cRrgGDzgOodfmbFzrDa2PBd3cQNQ7mKpn3lXoyaiUzQNZ/Lq9JO9eal TIszCiIZJTBeBe4TVBeQqrh+crpq0UHOe5pDA1CB2tEF1kN7mRB/53dA6tGgQ5YoqGjR DaGMji5r+F6bsdpCuuPQDKPJO4hc06U4J8krtarc7ZB8aJCjQR+MnmD0YAobJiFZaH9I uYzwDLldr7CebLEgT9+QTwFMQ8khTCSvVtYFU0Mu99aY7/jhxIx876gy94h5XyLFzWl8 6dUBPu4MjJJGPrk0H13JYUX6JLJJcuH+zjyQVbOXouF6h+EuGAR0PDEgWVMKusKIuoyQ 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 3r4h2aputa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:41 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E51DTH008450; Wed, 14 Jun 2023 07:17:40 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fmbexd3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iscN6WW1PNFpa6cb8nVIV9kmpMg2sfiV7xDRHEgbajDerADjoWoyJfx4+19dwL7Q/xZ0h5dBQ4LhOXo6nKlkiOiFHhuJJamfYAt/1zn3r4kcuo6HFDnVH12DMPk9XLD2NVYFS5456ByWSGg6NTVwFz9eIiJpK7uHt7nnVqqdeHJW8u3AYcrpfvRObj1xFyrc9HHbatgd41Yzum9NSbpGycImnff0tdZ3oVt1mz0DhU+4QuHU5SSiOdWGtvrTJKgq+dOV1HN0c9FrW4xkCjMyJqRzx8Mb0tp6H8IB2UfloBpwIAyk4pEXpMqmGrt19xVG/uNp+EWh8X5SW8+US2wQzA== 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=q3Lgco7wqD18t6/6i4FAJLYtfYYJ7t//4yJltDwkcaQ=; b=cJ5i1VYvEoTQJ65e51ZLXFZHesrqM5TmtC2kI0vDEPNn+NXKivK9JwvisYSKIoUpLTgR0hsz4f4dDg3EnPrGs1tbk5wP8F5wO+xmLuthFuSbvwS37oAZM5RS6UfSrVDbczWwaWqbXgaLfU+ssr2ubWq4h0W1X8V20HMxi0jIEvHMLp++hqK7bhjYjjpbA4ZWERGe5j9uZ2lYXinzrzDt+KiHOS7xWx6snfDUx6AIhYXy6cebYuTkE5QaDLsr3YQ7Wcms2/prPxsk0yLO6JPLcJJGhP8xrpQemMKvHWWhk9djHv33SADKz5lXVubxBFC/cesAR3Wps/OfUfQj+7V0AQ== 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=q3Lgco7wqD18t6/6i4FAJLYtfYYJ7t//4yJltDwkcaQ=; b=oIItIjOqwli6uyzn+iJY1EkxVa0LzVNKz5YIGDbv6MnEmyOSu1ElnzjVZdVNpzwLY+4At7mD/MR+TqzdjnaXfFSSMAD89wIWNBbu2/IzVKi6Bmxz3VmbYBLsw7NKdndXT/eUdX+nk1JpvZUL6DLr1E9wjA7GaD/GG5Ujq7Xg2Yc= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:38 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17: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 v8 09/33] scsi: sd: Fix sshdr use in sd_spinup_disk Date: Wed, 14 Jun 2023 02:16:55 -0500 Message-Id: <20230614071719.6372-10-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR17CA0020.namprd17.prod.outlook.com (2603:10b6:5:1b3::33) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: 259d41c1-0316-4635-11c3-08db6ca76f50 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jFW5/7xX3i6lDbSar2UqcacXXYvIIzKz5bDL+97jThGR5V5N0hssWVjk36s+uULh0zYdxxxTg/yr3MZ8GinxqNnw6gSsofUDubDRYvYYcgtglaGMzKAJR3OAWG5WlF0lFukFAKjI0VLs9+8y/EZ7SF4XxReMQVFF0VnqqLmV73sGjYYpzx8HP2S8VsGWVNbx19vaIQHh4uOMsAz6WzNWVVO30NTg3qs/CHYSxei4sn2P4nBJIj4z6NgergEJVh5TzpjhGNjNl1/PYd1xXCGosQloOGfAMKjumqCr8rp7daXOgxjCe+xISvOuQPz3UDH9uevIQHVLuGLIt/a2Zsz+l3pkm6b7OQPkQaVA8+jxKHRP8zqBqcMGrjQEXx80PHGIAeetdZqXs8ya97AkJFTZMbZRXXYacJhTGacMe4Tq49eECuu2mt6ObBgcQgJwqcsEPnhZWXizrw93EZ/Y4YKlVN5Y8o1J1Cta2694Ayt4ZXklOUFiJ7c+NxTXq/ERjKYQLX75rshoS54GBYzZe/8VEujLTEvnFNTrHEbvYeqkTMXTSyj5ILV5/ux6cVJd37No X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(83380400001)(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4aX20/6wAyUTwltAXn8I9oPWd1CRAPG4bALEwBK8q0FOzUi4yP2XE53Pu9KoLMXrJk9qgeCr7N8pekYnTpj8ADvC7HSIJgRY6c3t/fHIVBb11JUHccD9y5OUVR+bVrzQEsovLKhNUWiZuQBl3pt07UI7CfaCoc4N5J6La46hivk74MYir3TFQPm9OKO37FzjWkXWXWGO7Lug78nJBDzU34q9BnK/JphLoo2Ur54wHwJVLjljyvZa4J6wcxEH6qIjaolJ7j+TePOIHskaILYsUBYnkWxGDk4u3/tYWt7ONtvSXFuhTk5ouUJzAFKZtg+iznCFsJernhwBUmXz2AN0tbwO72BYZ6M6OfKk32JIwkvFUgIfHlEeZIA1XdkoUelXxVEUndC4UDITyEqQroIw39bdgxXoRGjZ0YTzv0KxPlO0iuFG1ub1sxT3F+9YEolKTa/IbRrYKyAodrb8s46Aah8UxX7/QG76QM8WLqQlhEIJjI66wVeNyvAH+BEBuAq X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 259d41c1-0316-4635-11c3-08db6ca76f50 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:38.6998 (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: 2hZkUqqPd8B3lkEY5cVUoOPz0iOtJ/U9JSWvKdabecXxt7UxfQgMLX9qMQX2jHAKvgDUyVwJ7/PI8dRKbfl5JlC5b5JRg7sv+FuQoMUNREM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 malwarescore=0 mlxscore=0 adultscore=0 bulkscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: 5_OLZtBtoCNmVQUEjvxlJByzAFtCKhBF X-Proofpoint-GUID: 5_OLZtBtoCNmVQUEjvxlJByzAFtCKhBF Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If the_reset is < 0, scsi_execute_cmd will not have set the sshdr, so we can't access it. Signed-off-by: Mike Christie Reviewed-by: John Garry --- drivers/scsi/sd.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 1a1011a8ae53..e34cc9daddce 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2220,19 +2220,21 @@ sd_spinup_disk(struct scsi_disk *sdkp) sdkp->max_retries, &exec_args); - /* - * 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 > 0) { + /* + * If the drive has indicated to us that it + * doesn't have any media in it, don't bother + * with any more polling. + */ + if (media_not_present(sdkp, &sshdr)) { + if (media_was_present) + sd_printk(KERN_NOTICE, sdkp, + "Media removed, stopped polling\n"); + return; + } - if (the_result) sense_valid = scsi_sense_valid(&sshdr); + } retries++; } while (retries < 3 && (!scsi_status_is_good(the_result) || From patchwork Wed Jun 14 07:16:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 692954 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 22423EB64D9 for ; Wed, 14 Jun 2023 07:19:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243368AbjFNHTa (ORCPT ); Wed, 14 Jun 2023 03:19:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234403AbjFNHSm (ORCPT ); Wed, 14 Jun 2023 03:18:42 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0A601BD3 for ; Wed, 14 Jun 2023 00:18:17 -0700 (PDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6jsO9025325; Wed, 14 Jun 2023 07:17:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=w/c3h+o+2hEC1e8B/KzTC8Xi9FEmVKbs9/jf+qpkx4Y=; b=jVMWCsJKKMacvjtZEm1hRE9dK3FD7OkXUSZY6DJUKAPT/2HmIU+JEJynMQtLrEAimAOq rTmpA40NYJYUS1Omc26QKbwQWu71IOOpbuanVqKp/iy+4T9cSoR0g0PVsbECEtZgLeg0 ECTW5SyddeSbLuslsNaLfr7Q/3srLnL1I807Ocp/YiMNv+v9xJGP5XLL6VHnLgfQnvfq eIL4jx3OWCG1P5/cvPYeyaIWFB82NF3EJkRCztlIekhnlwXnvvdHXLIIb3TGQARtgHPX DC0hXBr/gRBXhcMYFwcQtaYB/ASmHUG3S6KCLExUeTKE0KHMbrRC0ahXR9GDxs3YAL10 KA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4h7d6vph-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:45 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E5JmbC009030; Wed, 14 Jun 2023 07:17:44 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm5ese4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JDF3q3aC4/ATTzvKxImdbIbqgLHQqKxYaR8lYNAzgCAPkb8oH0h0DtjbDkLsR06p/9EKT1e5f/tzmjk8bAFn5J5MDLtEtlddTjo/TiZ1tOiv0OqHNJOXyLjpmg+X+vJU7ikCmm7zXJBa1mdUQiuoUXsgjlcf8IdEngNRvkGjZ4cQOqkNqFZn8ZCaWRz6i/15uC9fTaFtNLZ7AiK0GXJCZ/YVxtbyJWzTdSxvLXyifGYq4L6QRERFEA/qzu1ThqEt8OCimY/AvB0SbCnmTHMD6H0M2nT+M3o2VAd1jDhbXSz+lXmVVOVnelFCN+OePu92djyrAe9hCrDW9598dz0LgQ== 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=w/c3h+o+2hEC1e8B/KzTC8Xi9FEmVKbs9/jf+qpkx4Y=; b=iICnBGdnegfY7ufWFGGA58kh0GHxHl0d0K2HPUO4Y6gphv8+/fNKAITI8wlBRJBTj/xo+Opjd2BwyzAIwn7cZdCaGH8wys0OS8w6POPaYJv/dvGm8hC0myO1Rv9eQsvkYJ+7v0dZMhAg6Tf23uapkD+u+CT9EkG0uKo8R8XFGRWBNTiZU194LSh5fHhypB96oGL6r5lhwhB9qRwWXAywbJAXNo0wF9uqAwLSumITa6opvcPu8ecLVrD2rXTc7XSsTH2znc9bc4EiZbjVVzi6jyr1/kbmELIXXaU7NEIFlpMHabUfaFhoIBf889PdPDkZDBsC+duw4e5gLUPHKWIerQ== 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=w/c3h+o+2hEC1e8B/KzTC8Xi9FEmVKbs9/jf+qpkx4Y=; b=qpjgVdyFTDJrE/om1YgN+gdHf5sDswRkItoIQs8InNuEcuYWN4OUXBCo0Y8Wue9TW1uIVRz452rKD1/LJ53gBxgR+Lwi59jrOmN2nf0ujqbrr6gyEZFmkTC0c8EZmlOaIa6FLcX7aD5LmG+H8gROsUsl7gUZMMd8UbUgM3n8Xbw= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:43 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:43 +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 v8 12/33] scsi: hp_sw: Have scsi-ml retry scsi_exec_req errors Date: Wed, 14 Jun 2023 02:16:58 -0500 Message-Id: <20230614071719.6372-13-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS0PR17CA0003.namprd17.prod.outlook.com (2603:10b6:8:191::17) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: cc91bee1-a652-4cb5-8084-08db6ca7720f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kAE7gvPpqJffLSyjZ3XQfpbPjVycbXy6H0/Bxolt2yACOQ/BSpsz//d05Cy5m9vaSrJDA/UV3LbY4YcZaul/XEvCmWImIAPU7PHVDj2+6TOiC/6itMamrtEP+MBy1hkAD+/gqWi6dt9PCK4KzLnSw/GYhHguvTtKdqdVqFbf3dkB4VJ/xDNmoKrfv7zT+DRINTUNyF8YnV5PMBi/8/XTd/hleK80eneuoEnYSTwuOnoUc0uGwEhdk9mK3pPiFEHOha3nm5ylGsVVAn4/KzwuGZ7N9K2HCAs5yeTsgaMYfUtbzta+1Lso0bXOlnkXYIN5sQsz3AYMwi5kgtyH6P1uQrCs3jwTqixLJ/uO1iAPNt1acoDt+8UtEub6xcoxNXmU6OxCBiKr9M723GXNA6yrvhAnjSXeTpytzlY19wmE1wiimYea3HMyoD8VP5vmrgVCM1gbcYsRij2vJSiPEi6VIfmmqO0XWzPyAyB2cN89xrf1j3k0m1sCBO4LeXjumcmn84vVE1v6h1sB6Nos2zRU2LKtEENX+jJOozmmQAcW6rb7BLVVVjdwD65xCgike10D X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(83380400001)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LuDRH3KKDWE5i7h4BbjAEVUXyEGyEH0e7u5N3M9OY+cSFqR/StkN1W0f8GR+KRueGSwCYQSvdmbzhEUbfTgr/Wm8D65+dRWNAE1bPpy59v3WsNA5qx8w26mgV5t5Rx/971KzQ2oFO6OVZpCKlm/NCc8Z/2cETgAIfNgWBB2kZp/i8BZ2dPWx8pp5gqPIwDj7v9Ph0a28xIJjDHOGDOHKbpoLRSXY2CAHr404CU5RRPuCH5ybHQ1zkLsW2k61B5xqE29tTuDENCV7EWE6F7b6PdNdacsl8Bl/MYcV4tPUt3yt9FyO05iepZ8OrLKxm/yYF1YzfwroGLTKEMme/fHR4CU29mxs+XG7eDrs53LV9buCfaR7IF96qebJ6RAyM5riiWOzGN605KsUAA8ZIo5zSQjOc6UxQsyaj1lUNgtgu6vd9g3DqtevIxY7xl1ftfhvej7N/k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/yMvovYtz8ulIl3UWrpjzlW3WY5B4eW0T+og0V07eroJUcGzlnB/LkLzErhfbM59H/SMVGsQGzzJth1gkgQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: F04PuBjbtRS5pmjHAdWl+q6mF/MeokmIBHatA09t4wxxydxpmFLBtndI2nJpiUgUrmfbWwiufqkgxJe8tKvjWCibyOV5Ft0v4UxdCwZdPCrW5hGNBekc98whoInvAY65m+PmX9uGAK/x5V5qR3j86CTvUZWPeeY7JfeVWagz3vMjd0h49wK/AVUTuHZH82Y5hIvgzr0LmZKexgRgZ9iBkMx57Q36w1azgWxpSlKBEugMPqABobiSc/ueUiq7A6m9oxfQ81t4m+KrR9OeNbwof/4/ucmzrgp20r/7kChcfPaQX8Xt2IE4sCi+vcB5CE55DAKWTPNItnjlLWMRvc7tIM+50G60lNC+kSjjee/NBnO0cp21hwBIVWt/1210NIzRdFyS93jyJ6SmWwCo21f2aJWZ3kr+gdcXKQPEbNOR6cAaXzxjSKUvXvzQB3qq8Bern5KgI33X0nxGYKoKqhRM1WSLf/p2Z3ouc/2nc6p47Tgcn1nmdLYWob07PpfFc5rTH6GPe2dzx0pz49ZPJP776++gnA96VpkMxy7akmN6FCe2cZOJqt27Rdkq1lwR64UFWq4qwzB10RGYEcu5Y2YMZHx4lsQgnT780s6sUj+52FeuaHopTXT1jYFTOSM7eQO0ohJhx3VNWjJ8eCzyM0f8azisinayZk0s3cOQqmmRADjlVJVISlCnKokg3CHg3KruTBRJ99XxcMG9mIPCrPZnoWLe+Qk/vAkM5COr0F8T4VTbH7+v4CZoSZMJ8Epe8Ff8yJwAHxlbaXYwKE1F8P3gixdegFlxwQHLoRiZWXEUBFdlH4b761hyyNCdXV90mcEe2uYrsSLuJQ7s616jdjCfY0uoxpinStAJG+z7yDgnvCj3IWs1q7NqsOGZ4OSeFUYA X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc91bee1-a652-4cb5-8084-08db6ca7720f X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:43.3249 (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: ouv9OxUbfXY9/8f/jdvnG8XtE49bgpF+Oaf5UNt3o/DtRzepWk86kAm5g4Kmc3Ek721V5g6rX3ZeVjzmBTM3mKE6W2R4pw8Zdxyn0CWiY8o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: PLcdpIu3RZ1RLV-auNq8QCSO4rshfbf1 X-Proofpoint-GUID: PLcdpIu3RZ1RLV-auNq8QCSO4rshfbf1 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: Christoph Hellwig --- drivers/scsi/device_handler/scsi_dh_hp_sw.c | 42 +++++++++++++-------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c b/drivers/scsi/device_handler/scsi_dh_hp_sw.c index 785ab2c5391f..63d146f933d7 100644 --- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c +++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c @@ -46,9 +46,6 @@ static int tur_done(struct scsi_device *sdev, struct hp_sw_dh_data *h, int ret = SCSI_DH_IO; switch (sshdr->sense_key) { - case UNIT_ATTENTION: - ret = SCSI_DH_IMM_RETRY; - break; case NOT_READY: if (sshdr->asc == 0x04 && sshdr->ascq == 2) { /* @@ -85,11 +82,21 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) int ret = SCSI_DH_OK, res; blk_opf_t opf = REQ_OP_DRV_IN | 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, + }, + {}, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = failures, }; -retry: res = scsi_execute_cmd(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT, HP_SW_RETRIES, &exec_args); if (res) { @@ -105,8 +112,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; } @@ -123,14 +128,28 @@ 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 opf = REQ_OP_DRV_IN | 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, + }, + {}, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = failures, }; -retry: res = scsi_execute_cmd(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT, HP_SW_RETRIES, &exec_args); if (res) { @@ -143,13 +162,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 Wed Jun 14 07:16:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 692950 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 76748EB64D9 for ; Wed, 14 Jun 2023 07:22:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243428AbjFNHWM (ORCPT ); Wed, 14 Jun 2023 03:22:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231720AbjFNHV3 (ORCPT ); Wed, 14 Jun 2023 03:21:29 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51D312965 for ; Wed, 14 Jun 2023 00:20:33 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6jrND021335; Wed, 14 Jun 2023 07:17:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=a5C0CYeBLfticU0+IYIu3CyY2cvtbRlGSH4pbzdNGtU=; b=tnsk/O0nDGDwe/4evU0MnJkL/8mWswtOzSDnbku8xjAEEslFIJG/+joT8ruOWheCYc1m ytAWcIYtQX0BaPsYhcg14dnvlxR4PR74mGN+2zum2URVke/HlYc6Mxt/dl6fALMo268M d8LAAd2+lr7G3U9x0ygJZJVL1jVcWECuqlV2I21ey3MHb9Il+w9NMNXDoq46MUnlMEEj Nu0X79YqLB1lPeJB1SIJoADDiTP0GLQ+P6jKIbd30wfkHGNkbD2fLYP5KJx+NZcUy5NC eCyxXDfg/pNebERFQkX881F6n9MM3wRdIpKgLD6qAJREMWJUZOSiS8NASRQxr6gS1vAR Tw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4fy3evqe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:48 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E617xO021715; Wed, 14 Jun 2023 07:17:47 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56caf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NTbfMjEy5EephpUPLq+4u9diCD03LFfumuyksochIEy0IzsOIdJRyoL4PpIwrVvMgfpzfcfXx2Rp9Dp0tTiqZaPuWhnCU6dfP0i6jCFibwXB30j/4/V23bshIxs+z9rfWELT2Qt6v2++70/XbIKlIw1obGv5ftdv0goJKzElNDvAFjkochg/Csek6tUcLJxDv1dRnqwMm1Tn5WxZoD/kyYyHxkOzutfjbAKwTp7ZukvX324lsBw7gN9Vwde36wl500LGIKxZHo+DI8u8U7d5S9W04JDTomUR5WIdlc2lGy7Q7HJjKMikv174xTNFBL610kIOXGsjfv5RjCFrhYcD2Q== 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=a5C0CYeBLfticU0+IYIu3CyY2cvtbRlGSH4pbzdNGtU=; b=FSGdUVJFTVcO/YOBzIMdoNjWnoaGg+bdWKJMX5zoA32aF4hptWwuVfcXB1qTqZsFqtgrh7dXpzLiTX555P75McRPQfCbnZ7t39AUnUPrPLPY5XpeAUYpruTDxH6A0Cj4EkiCcTssDF9Nyb2sZubGba/o2mgavHgq9NSFDjPdFvT9LAP/QCDskBghx+Zw6z2J+EBtOxh4aABnZRTyVOtP9AufhMUsxNrcN8Emhbz9m4GHX4KBm9+aDyhCRhiH3t94eyakvKffunuzN/aE1x6C1kYnoJNw9FwfmovEA5yzWXGTGq9XSD/SWIat2r5qhtVqXagBW0VlnVpYxqQjlO8X4Q== 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=a5C0CYeBLfticU0+IYIu3CyY2cvtbRlGSH4pbzdNGtU=; b=W4tOkK0VgjQKPZKEs//SpP6fU9jE+Kq76ZUYjTlRgbRTL7G8hccKjVjNfdPy7AJouX9hvLVkL3RiI1tXi7qonZUdUk/e1iKfdT22Kjg1DNn9XIOPRLbV0yojofpcQrTWIX247c/6Hg61txWEISH0H2QxASlgEbRLa+9PjUqatkw= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:45 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17: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 v8 13/33] scsi: rdac: Fix sshdr use Date: Wed, 14 Jun 2023 02:16:59 -0500 Message-Id: <20230614071719.6372-14-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS0PR17CA0014.namprd17.prod.outlook.com (2603:10b6:8:191::10) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: 1821f5b0-c3a8-4ad7-916a-08db6ca7731a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n8t6mwSaTQNfRu8KewlUg/PXlCpJTEzVkbnRIRngIbrEAaUXm4DkptyYItU+gBi6glTs5nivk1kHTj8v2td9AyplrZTnuNvUzsaE5LC7tKAjdgOtHCINz1aaS7LofEro54RF5Je+m4dN3G7aEd84aM5n9XEZokx2ah+DSfygMMy72a1YIcFS/vn2J3wW0L8P6OebUxLr4+67EBeXVs5CIlcYB14gDr/Qw4YMbcaTKoQQvI/LfvIYi2RFY59hhMHdGAL6zkt+A2ZU4W8ULRPK78GR2CoDec399VfGuEIsvgIDcuyxnxtpolZl1XCaMhodvFSCiLZk1C0zR3FP8uaMrCRGOsT+1WFCmXjkfIwnhAZCaBFMDNZlFoGR+jqS94pAo+e5jBgmGrTK1VgtRw2y6MDh8Sy2lAJVIHTJfx5EKhC7435RbMHfPsIMh3WnD3+TNzKphjteDfb3oR8R7R8vJA6XwxXseThfKkM7XjFmFRGdir7GCHTy6LFFc14JZUph9Gre7Zs80n8X/mL41+ySj1H4l2AW1q10sxKolGM1MDls9nas62FRa2Cy0h6apRK3 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(83380400001)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nHBF2ZyKjk5BZ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RwRVlounKeDLz2lqtSWHcd99+Qf7sMZZdZclQPdzcYPD2R1BKesXiv5VtygIyj9z3yaQmObKYLvyefQTovjWJQ8cJ4uHw4JP+GhX9XhWFndFD90qJD+IUR433V6hNSkiEXnbaolfEL5LbXwcogNe0kiYAFfEwQkKSYvA2N0l9uBQ0JFGCYnUy0pyVObb/zASEHWZ+YR9UBqeX1rWvT5pjpSwC/zFx4swmiybKoS13e+nQdpHmi22ElejBweMNxr7fuOFZ1q8dX4P2vvam3LqhLVA2akbUYcJlKSKNsEAXs3f2U9DL3fT5hDPDMDd3/+xUkSAUCFsBb7nULY0pmBxCHHFYp4lUi26p0p/wZ+DH/zQ4eAkAAw8FIkl1+xadcfKW2hzdnB+D/IZWkbR8Pon/HKfZ1oxGjdJv7H+Pql3m520eogigoo X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1821f5b0-c3a8-4ad7-916a-08db6ca7731a X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:45.0582 (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: Yj+axT6QOhz2wsO95CCEjMYCJDmHxyJ8sEjoWPlQd6tyN9YLRHlDgQPWOTx19CogNQnEuIs5lleRtRkerBkds5cotjDt+/Ko2ww0Qy+247M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-GUID: 32YbnMk4rlUYreOZYIwwfVf1weobomhZ X-Proofpoint-ORIG-GUID: 32YbnMk4rlUYreOZYIwwfVf1weobomhZ Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0 it will not have set the sshdr, so we can't access it. Signed-off-by: Mike Christie --- drivers/scsi/device_handler/scsi_dh_rdac.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index c5538645057a..cdefaa9f614e 100644 --- a/drivers/scsi/device_handler/scsi_dh_rdac.c +++ b/drivers/scsi/device_handler/scsi_dh_rdac.c @@ -541,6 +541,7 @@ static void send_mode_select(struct work_struct *work) const struct scsi_exec_args exec_args = { .sshdr = &sshdr, }; + int rc; spin_lock(&ctlr->ms_lock); list_splice_init(&ctlr->ms_head, &list); @@ -558,14 +559,18 @@ 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_cmd(sdev, cdb, opf, &h->ctlr->mode_select, data_size, - RDAC_TIMEOUT * HZ, RDAC_RETRIES, &exec_args)) { + rc = scsi_execute_cmd(sdev, cdb, opf, &h->ctlr->mode_select, data_size, + RDAC_TIMEOUT * HZ, RDAC_RETRIES, &exec_args); + if (rc < 0) { + err = SCSI_DH_IO; + } else if (rc > 0) { 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 Wed Jun 14 07:17:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 692949 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 57D6CEB64DA for ; Wed, 14 Jun 2023 07:22:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243404AbjFNHWV (ORCPT ); Wed, 14 Jun 2023 03:22:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243395AbjFNHVb (ORCPT ); Wed, 14 Jun 2023 03:21:31 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92BD22102 for ; Wed, 14 Jun 2023 00:20:34 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6kNXf015669; Wed, 14 Jun 2023 07:17:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=xwBsut8nJxCe9OU7H1Ote3aksv63jRE0lqFzmAOJN28=; b=XMp1lAePxLhl4dllfukikLoo3Bdq21POKuGVvsepioWqZNCuVyVRgF9zu3DcKbCtM2kA AHWe2ZDgv9OIA3KwoW5dlIEG6as+xZoWyEipX0Hzug5fgZe4yXnrGb/HeJZ0c2nS59Hr scbw3boXXryRwuFM4tSwopOKwzmY5RXDorixbfUAbTfZSClQpx/cBqadvFIGFyMGLXVM PmH+PbXS/oMJC7HTJrZe+100mLr/pSq0rM0MziYnm6du2WPbTPyTmq7f5/UgLQb2/oIm o+OlIPb//mV5rb6jjkfrBCCndSHygI2bECy6GVvOi3E+SiDo28mL1rBJ7LErS6yjaaDM 8g== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4h2aputm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:50 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E5ZBp7008322; Wed, 14 Jun 2023 07:17:49 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2046.outbound.protection.outlook.com [104.47.73.46]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fmbexh2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RQKLfom+srkW4T+lY/dU2goAHx04bs18YkM6gZU9LPiYkBnZFfBxJoq8QIWPOFmZFes/oUeho0maHTIbeAIo8F62oHZ03u+WScq2SwYk5WUw9k0Hw+S0a9kHRJIHjxKlx35Gp1Kxw6iVGmjdqrqy8PZhIwyOL4t2j6Us+5cU3nPO6tjc1ZKpiCMbU3tepxVHLgP3wKC5ZV1NpSkNgqw5oN59+obpj7WgqMUoJTXvuf2zwPfIrDmncHdLRg55i5P8/onqX1LH0Rg/YEdw1Kfvgb3aaMFITvuUScrV98aTUok7mDqG0Hf0ZfF/5pxNV4IIv65q7VW1PxDS9IwUS7vPdA== 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=xwBsut8nJxCe9OU7H1Ote3aksv63jRE0lqFzmAOJN28=; b=W6aIATmKDHKIAA59I1Ce4BQlmAIGPdc3JuscsOHdVd7W5KHiX/qNQzKL+4WKnuEk9IBkDXt7b4geKkI4BaLLrLSVZC209nStFt1Y+FF8Yk/3EseSmsYn3eQd/5XUjQLSMu4DldhTjs/1sPbuCAJWDFOzYldXGqiwLPctzOC7q9Px7wt+XydPzbKsHxmqgSevsytIOnLCvnB47+fjhcK2X6nWrV0wPWm9xuzJg4jroakSHqwzyp3IWCHWwxuiWFVmNk36zN3kEzwtf9k77pKvale0wbWYD8BoDA7GqE2itwA+LPCPIGNi94J8YNErQnhRnDUB5DFg2J7Vcu0f9YcHAg== 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=xwBsut8nJxCe9OU7H1Ote3aksv63jRE0lqFzmAOJN28=; b=Ntb7/9CShqgi/UP2rfio2VIx01rXsBd6o+SXfa3HpObB8PwDy5v8j/SYUb+j+IxqB97krqtQvWBxT7/TWPBsJSs2SMsgm6Z9sePO0XwoM6rQpyvo9cm1VV+xTTnq1F2zes9F0jowh7k5u7SErm30MCT5AlI0BpfDrVxPaDo/D88= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:46 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17: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 v8 14/33] scsi: rdac: Have scsi-ml retry send_mode_select errors Date: Wed, 14 Jun 2023 02:17:00 -0500 Message-Id: <20230614071719.6372-15-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0278.namprd03.prod.outlook.com (2603:10b6:5:3ad::13) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: 11871bcb-961b-4351-f0de-08db6ca77433 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kLjjDCGs8jmrq/oDqwJ7T/TPH/H9HAlaNmouosQzGu7kGKMGeVASFrvrm1u+6iMnLbpRIzRNgyO4PlwTDg+hk5E+clfX0k0PSLkfKJ8UUl1LXwjysz4S3gwPgpaxjhHKF5hrcf0h2B6oH+2Fk95kY9giHAFrhV94HNVBmU00NONsnk2MRJ3TC6g30hinOWjw0yLhkS728+RAzZGbbtaDXNZCcspGjKXidWnhz5Nv4KoQkgGin6mJGkxBj5sWvfeSew+e7i4GsJn/KeYHb6fd0G9wV0tEipLaiZIWgfFNILXxIog159/J5ceDFcJr+7/M+PKLISssXCTSTIDzTFo5DEjHogyGR07FhEyIGzQaIvBn+c/hmsy0N8OlkSSy4TK4NEBYHZ6Qa/DeVuKbbtao8MqVcAVMP12BudyN1pA/l0iw9a1UExyrPnzoymvOcgQ8v78EO1bHB7L4AC0wyWr9ndH8v2WiXxUyQMKHfV/2aNzIpoLEVlPG38B1PfTc2RPZYiCHv6729iNnVId9BuBgqbdtVMpmWrhOsPTKz3a5MvtFNLFUlumFknjLUiBkayxM X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(83380400001)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IBMbZJlzq5VM7InBMms4JzstQxAf74Rq5kTpol+fKbJzNWrHdEW7ALgiCnKZ+tJNb1OZwh1M89Okozc/CLP3tWSdH8WmaUGytUqM6mOqvTxW28EUZFgfOsWte6d2zZnuFX+iKiGbQAEuudvQe+/XZ1UvS8Od2fB2B//pZitwJVAvdPuGkLS/nFBajRN0Ff72uuKpyWIEUsLWOCtvThwleSTqr7Sayzsz7IX+hFJzyia4Eojn1H1G0/8hiV3eCZoG0Mk3PrKYxNA0WRaFqI0WnXGyJrxLSHBEkPMPUMfDh9uL4gDojHuc63spnR0hjKSGAJu5b9d2f1Osbd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J9wPi6wZFpUqo94pnGR8JSdbyif7iw3HAc9mHjFwGCgDwDk/eH7q4M0nYNPq5PTJDMAVfup0HvFqBeDetllgyMLd3kxZfsi4/Zw74i X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11871bcb-961b-4351-f0de-08db6ca77433 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:46.8853 (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: BF7ZG8XONGwkcFGr5PbwlPoT/RMB1wXxXzBn1W7+5LyHp/rvS7b4svAkeMHPPjwL5k3ePa0Cu7QI8G3ij/kDnMPzGvTqptChvqNtLM9a4vo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 malwarescore=0 mlxscore=0 adultscore=0 bulkscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: 76CQkn6luX-jHBq2NX_9DFUTKBGBNJoR X-Proofpoint-GUID: 76CQkn6luX-jHBq2NX_9DFUTKBGBNJoR 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. There is one behavior change with this patch. We used to get a total of 5 retries for errors mode_select_handle_sense returned SCSI_DH_RETRY. We now get 5 retries for each failure. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/device_handler/scsi_dh_rdac.c | 92 ++++++++++++---------- 1 file changed, 51 insertions(+), 41 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index cdefaa9f614e..9811f9788432 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; struct rdac_queue_data *tmp, *qdata; LIST_HEAD(list); unsigned char cdb[MAX_COMMAND_SIZE]; @@ -538,8 +512,52 @@ static void send_mode_select(struct work_struct *work) unsigned int data_size; blk_opf_t opf = REQ_OP_DRV_OUT | REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + struct scsi_failure 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, + }, + {}, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = failures, }; int rc; @@ -549,27 +567,19 @@ static void send_mode_select(struct work_struct *work) ctlr->ms_sdev = NULL; spin_unlock(&ctlr->ms_lock); - retry: memset(cdb, 0, sizeof(cdb)); data_size = rdac_failover_get(ctlr, &list, cdb); - RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " - "%s MODE_SELECT command", - (char *) h->ctlr->array_name, h->ctlr->index, - (retry_cnt == RDAC_RETRY_COUNT) ? "queueing" : "retrying"); + RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, MODE_SELECT command", + (char *)h->ctlr->array_name, h->ctlr->index); rc = scsi_execute_cmd(sdev, cdb, opf, &h->ctlr->mode_select, data_size, RDAC_TIMEOUT * HZ, RDAC_RETRIES, &exec_args); - if (rc < 0) { + if (rc < 0) err = SCSI_DH_IO; - } else if (rc > 0) { + else if (rc > 0) 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; From patchwork Wed Jun 14 07:17:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 692948 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 0F046EB64DA for ; Wed, 14 Jun 2023 07:22:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243403AbjFNHWY (ORCPT ); Wed, 14 Jun 2023 03:22:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242938AbjFNHVc (ORCPT ); Wed, 14 Jun 2023 03:21:32 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36E8F2106 for ; Wed, 14 Jun 2023 00:20:38 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6jvRo021369; Wed, 14 Jun 2023 07:17:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=N4iNcKsJQ4wXczqmN7bmTl8ctNuRtMBaznVs/liy3b4=; b=aHW4wuIbIlJcj4ooGOSHnDCFgBxovqQUnG70TdYns3gBhtdKLgGiD/ObeUoC2qP/5g+D 9WNc3/y6tblfDlqU0EgQkDg4reaD9hYAu36sE7wXKzJ8NNa1gp3Q4DdNTvUW9fRaQ7VJ h8UrFpo+vpls7Ayr3Tklg54DtRDjUQVenDs7vDaUuaXX0TGbjXtCXB1sY7+0x/PkLPZJ wyvFE/2tnmWkpnleVsNjpD8DKaAdeiuwhLQM8VQmytXbmJ4HeBlaPNWhDHPg0pi5nGOO 9dMC9nFKOtEmLZ2mf0pZvqz2Ei4A6Sj81QBS8KbDQ1bj8wtJd1Ass8jClkboh6XsbRRh OQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4fy3evqt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:56 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E5pJOm009118; Wed, 14 Jun 2023 07:17:55 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2040.outbound.protection.outlook.com [104.47.56.40]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm5esjh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ccjg1ozGMYYwUqp/j7CxmkvK+KxtfbUg9jtzJm/m16/v/ahNyyVAK4+9RRnHjypfgPXB9w7C9wEE3EAHRGtHlJn41WzUn6MJuZN28oSjoGc5nAw9eUzOD5RS4MUcWQKqt3y8I2y7rpgWb/3IIYseA9EkmcmLNkMVExjt74pRhY8TtSrS3euds6SEYyP5HB3+ENJmc9/Iu3dJvh9av1bWe9py0j68x3Ju8Oz10dh6NEY3fZ5cxhVKgnKVN+yjSPeHQvotrGyCIeq1iksuPciZqP1oiT/gKlXt2zmI5IdsKFKP0Nld/0Kq7onm4xeD4lTALKQ7iwySDk78FrHj/tCNIA== 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=N4iNcKsJQ4wXczqmN7bmTl8ctNuRtMBaznVs/liy3b4=; b=e60sy8y/It6lFj2H61bOZ6Ke74U7b3bZRFIPbcNUohlhV7pN1TqMw445q/yg7DnwP1PW2jxufcSaQ4N+pWb4CF7x8cMaPdEnMI/F3y2Q7aWNjEyDM0X2BBpgS71UlcQVu+xaSSXatOAb01+YOn0pE5xuPw5Z+mJTGaj6LQVk66k2SNmkf4JbrJyJDOBgVo6EcoUBhXzkg0WPsZnLNwI5XivsoCkwCOBVa7ETw5m4nT/f6AIE2UjpqdUnJt7ZDPGnpKh7fdh0482ifnLp+q8sealrMLuAkHjmheG+K/Q2a2LMRvFSfJD//wBvXeb1tP9130CYxQNJobIVX5ju0LBokQ== 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=N4iNcKsJQ4wXczqmN7bmTl8ctNuRtMBaznVs/liy3b4=; b=kHJ0FNf4rtXsGOQyja8dEgiGcsaeG6A0dne6mJvTfDFeINuh2ja5n2wbSo2kJW3clnxd6EMphr/kKR/F6QAL6wQoeGh7dvF5TFvBVZ6kaCSbfZX/fXgsdeL6tn3L7JtnXI9EEGxBMozgzt7TkrnaAGd0d8BzWGWnsxjL3F6LqSg= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:53 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:53 +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 v8 18/33] scsi: sd: Have scsi-ml retry sd_sync_cache errors Date: Wed, 14 Jun 2023 02:17:04 -0500 Message-Id: <20230614071719.6372-19-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7P222CA0007.NAMP222.PROD.OUTLOOK.COM (2603:10b6:8:2e::24) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: 112c157b-1257-45ef-3523-08db6ca77803 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WcqfgORV53newbc/c4z4190BP+tE/J5/Jg1Ba1L5icFHhFM36D7uZBIDfqXSWtH+/M3N8ZvetZzAvS9lwCReR+CRyaqoZsGnYPdQlrogtmPDb+7bLc7zbt7J4KqinpdnV8G4cco5JC2jTPT7EkD+pCoRjxoA1hka+Uhk9Cmn+5HDZapHd53zdW20MqBkHIlMhJcVxE8IFTpy/HiJgRwXcN9hCqs8Sq9CS5xetHLOm9NMlXuHQlAln7PxBCXA6CGbXSQRz6LTGAgiWRnttjg24y/17LFXu3bCyGAs7dSojZ0NX0LNkUzwBinR9Es/Ypy5+pAecM8XNRYGkTiKwBIs24PJ1zq4hromE7NBKGIMeB3fTUXxly1ndrLNjWdlSQvmHdwXcaXGs4a7CmIGAKv0lqt76iyqoH+tD9rSHROl/NTBdD/fCp5THRv8JuUK25gxhdoTnryQF+HeB2IdI7iqiyhzy1NdTDOkg9n/901IchOsrn6MndQkydq4/8Fl+4i8/4RpAN02bkqfQpzpXA4T4sgpoc7UT+uaBN4/DfoBBxczK8Z4G6Z5aB7b0SXJyfC/ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(6666004)(8936002)(8676002)(2906002)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-Ant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ySZogNN6WN4fJmW1ZLmPpyr/JYXowFinsH05I/GQ2AM64Hyq6Tf7MgPLdvHBc4m8eEhV7rmZ6AMI3spfblYLo+timNDEwyzg5BfnNKDWw2Soh6HbUvKba+s6dPnm665wkYYRY03l/L4LzIrrT5BpkbpsUYXTg5s/hRSdYayF+hirZvMxK3ktpOEDQDNdGS4Ub06bUPD/srG3ySpN+ahC2kj/VCmCsk42Ibj/I4BqTPXPcyW5jIVElhYOg8tBgSHOv2aXm+e1OAW8VBRM70zAt8SrbTy9KKfg8YdGlZWjJttHvff6AE0KHdAyfsWDb+ECgbIqXSMI+rZrouCfbOqHxgCv2oUxVWwG7PzeKqgSv1aBsylJRW1bVPdRWgoEu5Z2C4PMSDwEB+Y7OxJ8FmGY7NKbkNdZ/oMqfiPc5iS43B3gMpSb/sQs57Z0zT9ZVQwVdhLV4q95zLZnl9Qh/hTXKczMdXe+LO X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 112c157b-1257-45ef-3523-08db6ca77803 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:53.2873 (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: +wLhihmFNr9Ly1eBybE9cTmsNu6eQF06p0t7AhQ9rvGBot8t4A1zyM53FZcqawfI2Kr08gHU6jmH2sMALXzS4ObYvfII1L3gTkbCGBxF7MU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-GUID: fFm_THzcTEOxL9vGmg26FvSVgeEckYAi X-Proofpoint-ORIG-GUID: fFm_THzcTEOxL9vGmg26FvSVgeEckYAi Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has sd_sync_cache have scsi-ml retry errors instead of driving them itself. There is one behavior change where we no longer retry when scsi_execute_cmd returns < 0, but we should be ok. We don't need to retry for failures like the queue being removed, and for the case where there are no tags/reqs the block layer waits/retries for us. For possible memory allocation failures from blk_rq_map_kern we use GFP_NOIO, so retrying will probably not help. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index bb2e5885e41b..ab0d6b1835be 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1606,36 +1606,32 @@ static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing) static int sd_sync_cache(struct scsi_disk *sdkp) { - int retries, res; + int res; struct scsi_device *sdp = sdkp->device; const int timeout = sdp->request_queue->rq_timeout * SD_FLUSH_TIMEOUT_MULTIPLIER; + /* Leave the rest of the command zero to indicate flush everything. */ + const unsigned char cmd[16] = { sdp->use_16_for_sync ? + SYNCHRONIZE_CACHE_16 : SYNCHRONIZE_CACHE }; struct scsi_sense_hdr sshdr; + struct scsi_failure failures[] = { + { + .allowed = 3, + .result = SCMD_FAILURE_RESULT_ANY, + }, + {}, + }; const struct scsi_exec_args exec_args = { .req_flags = BLK_MQ_REQ_PM, .sshdr = &sshdr, + .failures = failures, }; if (!scsi_device_online(sdp)) return -ENODEV; - for (retries = 3; retries > 0; --retries) { - unsigned char cmd[16] = { 0 }; - - if (sdp->use_16_for_sync) - cmd[0] = SYNCHRONIZE_CACHE_16; - else - cmd[0] = SYNCHRONIZE_CACHE; - /* - * Leave the rest of the command zero to indicate - * flush everything. - */ - res = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, NULL, 0, - timeout, sdkp->max_retries, &exec_args); - if (res == 0) - break; - } - + res = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, NULL, 0, timeout, + sdkp->max_retries, &exec_args); if (res) { sd_print_result(sdkp, "Synchronize Cache(10) failed", res); From patchwork Wed Jun 14 07:17:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 692947 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 4355BEB64DB for ; Wed, 14 Jun 2023 07:22:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243315AbjFNHWh (ORCPT ); Wed, 14 Jun 2023 03:22:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243241AbjFNHVe (ORCPT ); Wed, 14 Jun 2023 03:21:34 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00AF5269F for ; Wed, 14 Jun 2023 00:20:40 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6jlGV012646; Wed, 14 Jun 2023 07:17:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=WhbQ+TsdeGVECXzngggvbLiEZ6YKyvCRlmU26+Rta2Y=; b=T6bd3uOVmH+f5XI1QpCbk4T0r3TSr9z2xoyE4Um68KhA69BsBdSByqTI7BvJtPbonGsM KIU5PQuNWb/Vr6eCQnNMEke6esQEYLSItZ4fRUdp5m8ySikIcw0Pqa4uAzFrjM+1Bo2F iqfoE+TSF/l9FczfjLYA0F9hfG8BW1itEdBR/FdWek6whK7eJFO5WQPvpwmGiOo6M8xJ DzJSQYwZl9oOZof1en17n7IhMo8onWkxnfbs5tHBH6D0vDBsC9QC/dn8mRaHevPSSZ4J yQE9CvM2NgPEVncyu/znSREN47/4wpGchq5qyTlMEaAxk9rtFZKpGiRgifYaTJdLLez0 Gw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4fkdpsu1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:59 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6k5Ap017793; Wed, 14 Jun 2023 07:17:58 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2048.outbound.protection.outlook.com [104.47.56.48]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm4wsfk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c30mk7ROvLyqq3PihK3Odz7+lRjQmJrzGRyRcGI6HQoG7nBkuinrPH54e8mlCH1kEhbFe413qK+wrN8J+9Wn8y/2+8xUwf4U/qTLG9v8o3+ayh5opQC4F4QkuB/1yxEcHZYP4V3YjZ57BDZT1rST4mRJi9q/23GSFZ6jhDODs2EuOo5rOKIiG413JN0/TO4wXvHmmQDMifItqTF5BGBZA4CIitmGg22HmxkNEjZaHjYpPHNQcmNzsghbDjZzCsvyw9WLljDwEo2l3ShfRNVuA1qilH7M2zlHOl/421vnzlHeC8Mr6SS10OxNI4vA4isdN8zaYQCxUrwvleIyLksjlg== 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=WhbQ+TsdeGVECXzngggvbLiEZ6YKyvCRlmU26+Rta2Y=; b=WMPs0Tp9MzzEqs3EpYbAlWT8wi8piJOBv4yVRkmshC3OrE0oU0ujwKnrHz9hhNaT5DkGstNbWtcc9mFz1K4gxt7BtyPkgWGckzEQaRRaFZrbL9wPmReCqogCoMAGEAHdLfggSRJCdztKEfPCO8uxIjfffA6OmhXG8H2cj6gpL2JnvARZ/ndbJGvAK9P48I4IADCrWWvoaqYuBRYWSTvPvG06Q+jOq/W/8AceWmSLMkjrzwrdtoGWmfTtCvjTqsnqNHOMkRpU8d5losfI4smxv+oOBi5SOfEFUBu+EPPTqps4O1P+8W7iOcMszpy8o/muc/KTElA+8pqxij6N181lrQ== 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=WhbQ+TsdeGVECXzngggvbLiEZ6YKyvCRlmU26+Rta2Y=; b=pXFn23P7Ib4rveNhNZciweDffDewgK/bDBEzWrgvrKryToaP1VPkPWE4y7Z7NgWhNAOBZheZYBXGNw8L1nffZm2gYsp9PYigLBPYIJEJhBB0+OcNd85bqaHYYyGPKIDi4gSthhyvv+dNiZNNr6txAmJXHUcCCPc3ywBIJxAlKmc= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:56 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17: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 v8 20/33] scsi: ch: Have scsi-ml retry ch_do_scsi errors Date: Wed, 14 Jun 2023 02:17:06 -0500 Message-Id: <20230614071719.6372-21-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR11CA0036.namprd11.prod.outlook.com (2603:10b6:5:190::49) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: 5a6a9f85-a968-4542-2f65-08db6ca77a12 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nEAj1+HsfVjwpKmoYLxqEyrQHpueoAF7uLc/9/Q8MK2i69AoNCKFZPoDeAl4ey/+Qu7OzVsYqu/D7nY4UjoA2Spm1DEZlI/0V0A9XbxT3GCY66Ik5+VrJFsUn2Sr0EWBmhvwKC40YTKEwtoXqg5w3E50FtnBFSfhpWztEWYUQPbTUr89qw7y1Z0xYsEUfmY2zyVs6TjHI/a3fGp//ec2f9lKH5/RZ5wohh4Bzq+vlPf1aSlHZwpgC+/f76e+4rlf5dRmSDkwlC81XrIdN12SJXwzd8J/ulADsW7FfgTt+voMmcAiG4wXlF34kQbxtHAvZ8n2iL63aHotk8IT5EG+tEJ5yGJXjjYw2Ttqo1FG9JuHiltdYx5h+WgfyHJf3gtgt8DV2CEewSZbZpMoLu3vm/oqZ5Dd/gvyn0Ykn3j8rA1z3cja8CwnOcU09WDXnTKwBbVfE3hSqvpuYjCCv5ExI+7EEeEYlAGZKqo/G5R4rt9zgLsGLyFBKkxZr3U8B6pGlGZv7tCrlkJkceYPIthW882o+Uq/IeQS/KP8ZE/xcZv4QBsu4I8pnrXBXiyOY5ot X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(6666004)(8936002)(8676002)(2906002)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-Message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En+QWQOvy99sAAQAlrXJJCJsJTAGQ9fAkZfJtEFBuZDmbqElnW54Pc9a29hSjFMCf7wvNll9DoZQDswNhB4XGakk9jRx1DBiDOWnFeG7Kucg9KRxtT135uN/xvNC038mM7k+c0NtTgMAC0E+vE/rxbg65tDKNY4/Fge8JArsir4UkRnEtQrG0KCPCMeWc3eHztiH23927abO8q8wdWE7WsTZmfhHU2IG7bjKY7l7ryDH5S7TjMsljJlMQnEkVE3mBNkrcMad7F1mub+xKP8cqSPDr5mCB4Durjgyq7dS7nTV3EtWy/FRUdLG54XHrJDtwXPkaDRWBRtnIX0mLWdG9l0IkoI5u+X1cZ0h5U2GnN9KJGE8JFeotn3OvwamAVrorZwOEIYm628/V3MnXsQXtWeho+QdkUMEGiCeokCpPVY7394sXrHjaeb+Mm X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5a6a9f85-a968-4542-2f65-08db6ca77a12 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:56.7414 (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: qMjdxz12fuOYYkgkeDYBI9Yw27Rr/QQ2g6+8V5nvJ3ykq5PINd0LdgUV1Vg5lKvG8tF/22ewAJ5pqY9kkDVwoMRk0G6wypllS5vXOirHbUk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: wtkv4zZr39XHqTREvH3uQ6ugQOfCvaSb X-Proofpoint-GUID: wtkv4zZr39XHqTREvH3uQ6ugQOfCvaSb 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: Christoph Hellwig --- drivers/scsi/ch.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index ff4a81a1b056..f2c0778afd50 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -185,16 +185,26 @@ static int ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, void *buffer, unsigned int buflength, enum req_op op) { - int errno, retries = 0, timeout, result; + int errno, 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, + }, + {}, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = failures, }; timeout = (cmd[0] == INITIALIZE_ELEMENT_STATUS) ? timeout_init : timeout_move; - retry: errno = 0; result = scsi_execute_cmd(ch->device, cmd, op, buffer, buflength, timeout * HZ, MAX_RETRIES, &exec_args); @@ -204,13 +214,6 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, if (debug) scsi_print_sense_hdr(ch->device, ch->name, &sshdr); errno = ch_find_errno(&sshdr); - - switch(sshdr.sense_key) { - case UNIT_ATTENTION: - if (retries++ < 3) - goto retry; - break; - } } return errno; } From patchwork Wed Jun 14 07:17:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 692945 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 21947EB64DA for ; Wed, 14 Jun 2023 07:22:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243448AbjFNHWm (ORCPT ); Wed, 14 Jun 2023 03:22:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243412AbjFNHVf (ORCPT ); Wed, 14 Jun 2023 03:21:35 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CE322974 for ; Wed, 14 Jun 2023 00:20:42 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6k3aR023008; Wed, 14 Jun 2023 07:18:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=R06SqSAgZhjpz3iV682hTJ2K0P66WyKn05n7M6BD4lw=; b=xJHq/3usc6ClUWfSUgi7IZoJupyRZ6gBzrEENE83rV6FYE0zmyiGL2TG6Rv5pLWagup6 usELyzrmnR5WKlAWI/G/KwynjfHOkwbJVnquawdG2AO02Q+VHCBy1FGs86ScFm41KPq8 gYkuCd0XVFSVhaiWoZpJyNM/2nAc1K5DlWXkSwR6yA+PhiglY3OQ5XCEyZJlYSq6rCqq gCldiS2MavAToKd5sWDuu1AW1yAixNbMgARqB2N2kpUxLfZqvuOyVIJGH0Cn+f4z1b16 xjjIHnURS/BUgYguZKpNoXB637yAmEzNKPuT67iM3QVdWFAZknKF8CaEeLMFP1vwVgYV OQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4hqupw86-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:01 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E5n4ve017775; Wed, 14 Jun 2023 07:18:00 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2046.outbound.protection.outlook.com [104.47.56.46]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm4wsgm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XYcO1y57QnQZ51yv+KGQ8tDrgPOcKVJKN3rKsRkKRc6A5ObDp3mB+RQUzUUB9Id5ELf504nm/L2s2aek8RA5wtuQKYKH6B2BHN1y/NiX2hsmPOGFryVB85hxfCpSB/k0aeQWDYAAaxrSmbbfgZY/SQGOzuwNMm2GcFvg0kI504aBTFD69s25qN4gFEzr+z4wxxIzjrYzFOvN/EbVvkpU4IL6qjwGHfAetlUL/9zkrNtkVlVrWwzk1avqTZx1woykungxdOR5nnqveKww5fMSKlTANAy8EWM6uZ3mmeUjh0z1HRo2r/2vDulxo8TrvMa3K6FClBOO5vGEvFUyfDte6g== 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=R06SqSAgZhjpz3iV682hTJ2K0P66WyKn05n7M6BD4lw=; b=Hs3hrml3R89PMG/qyqCTKvmFq6yHEgTsYoZgh3ULRQVE3N6KNVohVDYK4Rk3eeBnZFIJTzWtu5qOiI2P0xWBWoLeehUat9X+G0NAN7ypibmnbxv/DJevkWxQXCJau/ySteedTYyCUd94SKzlmWG/x/UEH6ZAJmAoZgO17FWBCmNuWwU7pYRXqxigy6TU/Ple8BYedTvozv6SIo59+/RubHVwetTc2SxuNHWkBJBmbztMirOHMzlOxvx+5rPJ6M4iVME2DzXGeQ8ruLVybtRFOy1o6BhTkUMxsIno9z+RsezkG4s0Dp5axWSspusx+KhpRWa+HZF2CFryLNnFB2/MGQ== 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=R06SqSAgZhjpz3iV682hTJ2K0P66WyKn05n7M6BD4lw=; b=VmIKoYRsDFEvTg5FpWuoQEzwSZi0dUanAHkuYJ5GV4PLhaQPNL+TW+IZO3ods3UI7ZNN0tDFd0HMlrVOWY/eSEP9pFBPqea8aAT/r7AKiu4GdWn5621xT8GbPv1CwB+vqX9am1yzYHCLV32Fz/w32f0GHaYXxvhm5YuVrLnzjNk= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:58 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:58 +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 v8 21/33] scsi: Have scsi-ml retry scsi_mode_sense UAs Date: Wed, 14 Jun 2023 02:17:07 -0500 Message-Id: <20230614071719.6372-22-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0194.namprd03.prod.outlook.com (2603:10b6:5:3b6::19) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: b4abb300-aebf-49f3-0503-08db6ca77b22 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P5RY37rd1PP18TvU1jbMNgZTR9hAjLSsAmlohpqenrR5K+bF/9TSLPlry6j2QvMN9RrapHR/0m+cLvCANTeg/TyCfKDPt09/RSkbiZs39XvmjkSGVq49xAAIE4sTAbTLwu7HxrPkOms6JBA7hMa+JMxwgNGmEYk6FIHBkDZ26x+vH91V3OUDmpghQLPmz/Br/W7ayWRu51Ppcyfx0y6VtxOwoZ5WZqsPXnMpJJUnzUvzX8aCRu39nCmnS2Y3AEzP/YSY7yZd3xInPnKJQk8pn3iqKndjMo0r+cZquHGdHXb65mH5Iy7YIewcGMj9jZcpOJyoM1Ut7kbmc0DsUd1soWsgtrakqbO9U4I/hbqj0TQ1EVYYHH4sST+Twv+eEwAKM940GWUDNL36oZVcre0Ydq5r7lSMwsxwfs2zCdUHa1/0T6Mn0b5zMX13sm/BjYzCXSW9UbrRvrUnZPT6BPdea1p0U4t2Iz5HCx0m3U1b8A2XVhPgGNFprGUxS1LLwxjOOUOBFTvEwfaic52dJs19RozLviCIsNVYcJYjPGBMVOhf2O+yY03OpCKeWCYGxiPT X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(6666004)(8936002)(8676002)(2906002)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: klckiu1eLACjTSqaUP4xMyETh4IRsmtdmNG+bKxqMWuLW8Lcw/4a6s7bjhrBgVkpYjze1fh41i30fJQdnuyb031hQ24pS/1v4/MCvCTk8xRekVrdq73I4Y65LH+VOsCZXSeJUyAI2fD9L4tEhiPVS+o12A/qDsp8LKvfy9/2oECjZLq9GLmon2iN0gonrqfv217QG3lQr9LRIsjyfw/j0iN8fdpptcLKPElWtVRXftwDOEk2lcRcPHG5AGhobOR+mtLlviFjqo4lbBNOPRKWLuUZcEKH7pLr0u0BxWgcEjcksh2aQkfTRNqPfBWRW9CaVCjwUUMvcXyzRk29NkbFsQ6ZkUKPAW8XSYY7YTjEefFPAK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6MIz/cHAN2EY4KdmMrl4RlsHLLMYg3ImXrmpcXPEp7i9ymMGOfBD57PFJT8feIn5zy98XUskwVuzgm X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b4abb300-aebf-49f3-0503-08db6ca77b22 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:58.5334 (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: WXK4pxIWY8gHG8jMd92qrkV8sTRYra3j162o7kN/cOWx+8ypytAWkWcJJict3cD/tCTBqtxT7fe198Y+kYp4mfxTcb1k9f0ca1UdxXqNrBM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: tdBHvF8GDAx5FSR2NCu4bSWBK5ZxOLnF X-Proofpoint-GUID: tdBHvF8GDAx5FSR2NCu4bSWBK5ZxOLnF Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has scsi_mode_sense have scsi-ml retry UAs instead of driving them itself. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/scsi_lib.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index f539fc4b7148..0d28920d088c 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2186,11 +2186,22 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, int subpage, unsigned char cmd[12]; int use_10_for_ms; int header_length; - int result, retry_count = retries; + int result; struct scsi_sense_hdr my_sshdr; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = retries, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; const struct scsi_exec_args exec_args = { /* caller might not be interested in sense, but we need it */ .sshdr = sshdr ? : &my_sshdr, + .failures = failures, }; memset(data, 0, sizeof(*data)); @@ -2252,12 +2263,6 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, int subpage, goto retry; } } - if (scsi_status_is_check_condition(result) && - sshdr->sense_key == UNIT_ATTENTION && - retry_count) { - retry_count--; - goto retry; - } } return -EIO; } From patchwork Wed Jun 14 07:17:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 692946 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 75585EB64DB for ; Wed, 14 Jun 2023 07:22:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243320AbjFNHWk (ORCPT ); Wed, 14 Jun 2023 03:22:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243316AbjFNHVf (ORCPT ); Wed, 14 Jun 2023 03:21:35 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CE6E2683 for ; Wed, 14 Jun 2023 00:20:43 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6jpRR021304; Wed, 14 Jun 2023 07:18:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=wMvrcw9irRTIb//WU9tPFA+BMczXZIa5kiEo4MY/48k=; b=THhZNOYqnAzIHllMu+d15RE4xkACwAMZeAABaW7iCJAGUjUNXoZhvEGxEDCCrXLUJrSc mHnOBagDkWBYV9RcNn62Mgk/WKmyV4COe5cLhWUrGrAkhsjgAysRkCXAPuxsqoV6GlJF TMWBhbPJBvMIWqzicmOo74Kf63DLVxqfjzMgOcij+TEz7mlH/zQ7fty1/zJGH6umB+u2 C6NOMfwJcPSVGXL9ThW7VPv2n5g1UHviWJ4G431hxpSfSdwK4J171ryLUGG3hYfZ1i59 2jwZeyXkeThsRYQHEmRnPecrJMHhUorX6bpx1NmHSXEYVvP9PoAhwv4Ov1/WM0+SS2Wv KA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4fy3evra-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:03 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E72JBu021666; Wed, 14 Jun 2023 07:18:02 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2046.outbound.protection.outlook.com [104.47.56.46]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56ch7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KljvfNyxuZiCzsxqrtFUQkQ9uPhrhTVZUym0ofzMCnJkUvDpf1lBDxj8P0X70vqtlbiU6x5aX7Dv2MC1Dq8QfQSyVxD+/nhIrnCyOMOnl+/Idd3i0vXMhI2wmAlNiP3jqKGj+kVms/27/W0f2SS2dZTeCpQSCf8Ls0ScksD9Eh/HGRwFkU5vZDSCfTHz6GuFI/AqOX0rV4tz/9pnlCXSFqsyAY2pr/jxzBCnImOplfc8QW/meHSaaccxDfWJCtEsEOo+NAvt7LfsNKtBGEyqJt0r9wo9PtR2DEjVwm1MUaBi7qc8Zi3Xp48Cxof1iZOZslLH9QIMO5ObbZ8Uz81xWA== 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=wMvrcw9irRTIb//WU9tPFA+BMczXZIa5kiEo4MY/48k=; b=RO9XC0Fts5wlbB3Ot7rmZtm11xItBFB+DWIuKKBjN9tQZ+DbGrhTEFQwxIvH436KzsP1ZZh+iBuuBkcIm1NzU3vZsAMED/epH7cMgEk9WLHSjmk3HmB1MSI1aYd5D+y+fEBs95ijEZH0400rugS1zVuxvvm2+M0xem0hTiYGqJPIw0B/Zrv5q3xQBDKJxM4/mD+Z3+J1VT5krxeg2K5w/gXUIHtBsQkWP3xnaDuNg/H8sG8SuT2IoyK43t5x4gLWkcSGFPp4ByzFArQP/h1k1zJGd3K7hFxQ6SMbT04741wm6zFw1L1aCeof+y2mnNNXu6l7SmS8OpIQyG0pAJHfZQ== 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=wMvrcw9irRTIb//WU9tPFA+BMczXZIa5kiEo4MY/48k=; b=TXPitkBdO62Om4ZT/U9FFt8l48+NStJ3gGbkwPduAmhYLFyi/qikEvKbb3p72E7ERAt1NKvyqC3/uwkLii1vrchU06RHVYpkYjtXFUOTRljUbyd8zdJ6RNhLZeo83v9bLwtg2edMR8ONX4p3NCpOi/20GntmXXn2zeJjQjYOmyo= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:18:00 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:18:00 +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 v8 22/33] scsi: sd: Fix scsi_mode_sense caller's sshdr use Date: Wed, 14 Jun 2023 02:17:08 -0500 Message-Id: <20230614071719.6372-23-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0201.namprd03.prod.outlook.com (2603:10b6:5:3b6::26) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: 9537c47e-93c3-48f5-7839-08db6ca77c2f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /ME+M+hrLV2OBulBvL0xsIzjr13FWdp2/UnxUhDqRyCh/9+fmqzlNx1TEzBhp7q+O6exLYclt1P/32VIVybKeeE5mRixm0dxo8XB4/Q8Jsdf4RsMTVv41Y3b1P3naY5DgJWTalPnEN0dswMa5oCyif7UWPxKv3bf5+8H1Er12A4in3Kalr+b5qJWslWrZV+injgPkw/v5Hd6f8nJyWteOPAV031gmgYumZiZ6hdeDS863Z1e7l55lpk0CEpQbRl7e2RYQo7IzQqEdJagE6krjDDmuUb3+D5zYbeE0PhRsHuX1CPMZZeqiHG+btZvnlM1SGu6bionPnLEYhX1TUVQMjqNQEcZdIzXJss1Xm75bLphuxAWTtsRN4Djorri7BFiKJkhSJ9NHjpTUu/XJ0xueIEquM1GcScgMuoorwj6C+X+Vrb6XDB8ZASDSGTQbdhh1uOSgq6uZu6AUe3jKwoMBy9i06eAU207i+QmwIfKOb5IdWxlfasgjZT0nnrmHHhEXpmqSfd2LQ4XQ750AEOE8XLIyak/1PtP8ibKWJKp7x7Cu0SVj3Av2pOb81umVXP1 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(8936002)(8676002)(2906002)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: beHh7wCLWoqv2FOid/DTeEYx28/FSc/2Z/eckmFSJxxco9hBjvIZn6Qzs+7C/UdTOfySMfTs75OhAvL+jrUzAO3TzjOY9yQEyXYkxDXlmODdx9qUf3Jf15IkUty+mlxsmQ1/UNnWdpHklxnWeRoG/J6NhNb1/n0HnEubkOvgkbkzc2DZqUmvmhJ7YEVzJD396DVrt4XqnjrSt45nwSgZTzfqQoBvybExb3ai7io1r6oIzoL4SNk4SkJ6MVRgvVjv4sOg3l1qNxtnlfmt+aVWutSpMGQ2586qznO6vJbdv6fgcCVNKR68uSffBeomUzo/Lx6H4o8t+aJB+OfWCvSTCAJkDbgprkqFKj7MxVxPyNuB7dZ9WS/d0wAyJzjspEdFiVVlSBece0dNL9c2M+YXoBBW/u2f3eAODqRz0sRX4gRx48JHvRFCP5J63RpzBrWhOOtmkHlMRdUlZJzNevsTUMAjKHiIrq3oAvDXWkCMNEvrj1UpO6vfu5VNO8q2P4KOuB/xfMVWP5+svjQNv4AZMsSvOEAdttQP4Hd2Z2CxRDKqp7A7Mej6OmFuc7d9RGldj7gMZybOr1j0i94tR+NtJq/DSm/f8RaEBflNDbo5OAVCV6pJJDRBAWDKzPpTiKujoetgq8MnUXHG7PU1s8hPxyIReLOafPQj9cNElqbOHZpCZ/FBBsjeN90EMDxQvNdWrIpQHUJEF/E8Tn/yiMI+d+WaspkU3IzDHjUdL+1ZwISew1lbiFwqyg9fdPOs4ylUDl4X8g6T6hCl6/FeIxYZq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qlm8jopKI+ATjdW+6i0xqW/wqyXZggVKaYNyC9SDuIFIkcSwZwlnK5pX+dHUOI2tyJ4GPynpytd4S/RrTAldhoyMSeCBlcnJib6yG+Dc9ExbS7s/34HPkMkm5mdnl5zooCfDgCrZSWty1js/9SqWTz5aqU4tUE0YddP/d/nmj/v+o7fBRXK3RSkxlx2/LQQD6w84tPHsCE/IUqzkw85ah3FJawnl9vE8jZBsBNMYNTBRnEbXKh+4ap7GkigqdQzjbL2wPGb/x2djMkibyaSDINwcx/bR83P2UPMCglZr7UlAGV0nifYT8ebaSIjdEHQuvIfNLcSBSupWe+4L0y2JCnFmTKH2gd9gY5hyYOhFsrVQOv0zjZLLH0LYIfYMd3QQ77RKdZLBps2BaZ9Px4GJuztay+KUKIDcHYZYgDCRnmUiKSDTFoBjfwBgz2+zXwNg2QlApaFM1PYoz9SoViQMmlD71mvwqQ3MweJ0MEWuFnQZ7spJes9XFw484/i5IQ0UtRD5oO2H/1Tez9S0WGPJtREt64MC+mis1C0VjxmMORCR1iwjglpG5O1xpY54IJJg39VZghOQnSC5COOWuuweXDRF59bUkKPqZXQGOajNvEoeY6t83JpKx7RdNWKQjhigxbp01UkzSwHWPTQXs3baXTb8B7lVMMrscFOb5XoBnlSWxCwyJ76+r85tcXeviaful8is6gy19rZwZRZDXgyn4jRYunnyzRqvhgxHGwuudVTc0FB5Sr X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9537c47e-93c3-48f5-7839-08db6ca77c2f X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:18:00.3124 (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: LzeRf9gRgUGhR3V0k1y+Yc7REBjA6iFVtWswkNXdW5A2VVn0Dz0fnEjySEKPWEOeiaN1C3nVPeFZ0ov8PXvyMiqFN+4W8rDY3cyA+JYjWoU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-GUID: QUUdMt0EWpEu9b_gQaVkFzoPbFsI5IZb X-Proofpoint-ORIG-GUID: QUUdMt0EWpEu9b_gQaVkFzoPbFsI5IZb Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The sshdr passed into scsi_execute_cmd is only valid if scsi_execute_cmd returns > 0. scsi_mode_sense converts non good status to -EIO, so this has scsi_mode_sense callers check for -EIO before accessing the sshdr. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index ab0d6b1835be..48b727b2bf1d 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2967,7 +2967,7 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) } bad_sense: - if (scsi_sense_valid(&sshdr) && + if (res == -EIO && scsi_sense_valid(&sshdr) && sshdr.sense_key == ILLEGAL_REQUEST && sshdr.asc == 0x24 && sshdr.ascq == 0x0) /* Invalid field in CDB */ @@ -3015,7 +3015,7 @@ static void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer) sd_first_printk(KERN_WARNING, sdkp, "getting Control mode page failed, assume no ATO\n"); - if (scsi_sense_valid(&sshdr)) + if (res == -EIO && scsi_sense_valid(&sshdr)) sd_print_sense_hdr(sdkp, &sshdr); return; From patchwork Wed Jun 14 07:17:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 692944 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 AC9A4EB64D9 for ; Wed, 14 Jun 2023 07:23:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243438AbjFNHXR (ORCPT ); Wed, 14 Jun 2023 03:23:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243202AbjFNHWe (ORCPT ); Wed, 14 Jun 2023 03:22:34 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83E512704 for ; Wed, 14 Jun 2023 00:21:01 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6k8mG015557; Wed, 14 Jun 2023 07:18:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=OjS1bduE9UagQhlQyF/qwLnnO4QqggpSFnKAzNm+lMQ=; b=k/LeQ3PunsTJdiR5LSBeJ0DJx/H5Tcb8iOuqZe0T+E3pVlO6UpyY1gCgdhlNnSqd+7/3 6czFIWmEUNXvugFAlRbDCdBPtGOA6y6Eduodpzgry4RJA4zL3huJccz33FBcOvXM/S27 hiVMk/XeAvbFJ68R/gLIdItSFvf45XZ6IGJM8HRmcr/AZ3K1xOwv19DqAZ5QAReiJlHc 1JywsadsNVmmBJ5aWdkIiqLfKOAprw+OR2ynCW1w7tGy0aJeiq0UqNHryX1NSs3LG+mx Is6DK/7iHbYGp7w56v/wRULWFM271eRa/bNkSaO9XOdyFxezAjK5zduJ6zL6K0SFkdSF uA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4h2apuu2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:32 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E5bIXP021593; Wed, 14 Jun 2023 07:18:31 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2045.outbound.protection.outlook.com [104.47.56.45]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56cnn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cstAWDYRwmmPud8Mdy2ZKIWYXkc7FyHYTpXBrhTbqE1CfQ5aCSbyWXG8jlN4EeelP5UCVTDr5yVyhcHTlxm/M5+JjzYmKFOKx3sjIe3JXueOTWgRiko+GprN4mwQCNWLAJX4NV0FZHAUPRY7oRyu3WqugOzW+C3xEqAlADiuHyQ0CNfBF4peKLKBNZF7LNJybnvC2IWaD9DDP8okABTx9InzANojojt9Zl8CGRAvJ8k3AL4azijEveCBrq+HjInxb+t5bl+AQC5S6hMIpZbO7O5GGX4DVB/zb6wFjLJMeLOGzawqe20DX5qukMHuw8I7CHEN7UqMGviwlagkRTX+pw== 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=OjS1bduE9UagQhlQyF/qwLnnO4QqggpSFnKAzNm+lMQ=; b=UosvgUnenUOarUCBtXP3Y8h1czCnxAW/l8zfpoNTB3QuC1mJ9/3c0op39wtg/G5pXwUdAVry7O9178t69CG3Yv2NB6b5G5i1V5QsRZkYoH+Gjt6aHUNJ7PKYUW7WDwhcqg012tEUplk9LdYrFX9lT3344PFC9HvA6J1FCc/rhwDDOHTGQyH5rwUEUpP+ayXjR6pkAoX6buvniUxr10AqVVTJRQXATCebSwLxBJthvNvY/nXXXwRIxAF2Q4nwKCxTcSQC0vmz9DLLlgqWmlTxFr8ndAC6Ng+ZMbSjR5K9ADo7d52jkpC/oF/KIhEvnS2ag0Vfp3WPMnLAg9xX0fT7XA== 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=OjS1bduE9UagQhlQyF/qwLnnO4QqggpSFnKAzNm+lMQ=; b=EvX+DShMDpI9b+z8wblbwIiwxNqcqeGCEAm2LQQ0s0LPPOywNR4iTB3MNG5pMyZp7Zz7Td3WHjwMfkb2d6IWHjKGvKVgw+G6PTAh+EP6EF5hK3YFHGaW8PpK1zp1kpTOYwE0lYAODf721wppj+JDQhss8EkCerxSJaZqEoqlTAE= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:18:05 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:18: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 v8 25/33] scsi: sd: Have scsi-ml retry read_capacity_10 errors Date: Wed, 14 Jun 2023 02:17:11 -0500 Message-Id: <20230614071719.6372-26-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR07CA0039.namprd07.prod.outlook.com (2603:10b6:5:74::16) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: a55f25f4-3aff-4df2-6eca-08db6ca77f74 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z7VfJDmhmaphlgC2LljXmqNp+PlJZA9vMBsXNbaloLcSqJuXCcQo8wbJymnD7og7L/T+DLnsjf33fkELVnbhqC174S3RVu53NekXEclAUZ/XE8zKZWYyEcVUZXU68NeuEJcbt3tUmH7AhZcrlvd3SvWzlQzLR225ohmCPU2PTb0414/ULtdc4b61L4Blgwolx/hlOBObh0kQL0v1xpaBqWRInnOMNZuFaGNzT6vvFH5ZkSM+6fTJYMbb03UJwtaKbF94+rbK7kLi5a/QaFvArvooWayOv1S+TnMi/ep1WXXsvObFQcHxnYcP32O7XqZx2WehfU11tqrBvGgjhPlGZcU9AIRsaJhZdl5z5Ipi2zY3OufSIut27XmyeDLpb3PCKyRiyigKc6VbTGMXJnzZLELF7aJZNzsB3SfLoBFfR8Ir7qp4bkBxAYO9avKHH57GWOMg57GTvhzGl/mpYYIHcUKP1dVimyUVJ+j86YQB5wxTm9Z2KbhtpqosIv7De+5jTMCwVg/8r/QGtOSmeO2bjkRz9bLC7+xLPZbBa+hYsc5MFjFRSZO4tYEqsxNlyig1 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(6666004)(8936002)(8676002)(2906002)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Vs+ZaE55FaqlCBU3nIq0hv6pPncg6vpZkICiynTaVltE7ryypne5qmbdSMOpP6+ztxmQwOtA0TjSc00QuiDpst/sLPuGdw8QtsRz6xX0R0iJzs9WT68qM7aBx8vfZNGreWU2WZYA+HnNvhA7D994lP92sBv+ZaMD1JLiPD4dRiI2JAgFOrPWltGL1WRJJ9U0OFUX1gXpzDE7UPBN/HSYy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c9b9K7zEPEd446JRNMD1j3RAxbgISsRq2luQxRdtiWkLcLPKpejzFswuIh33lcGnwnfgdv6g5hlq4BHT8OOIFhgTICyk23pXO8QtbRE3z4IQeptGFZrHqh2VVtsnqJWVzEzYhtw+MYMpwQXdbtFmRQ88Odeo11GP3zWFjx2RIGsI0iv5zHshrgJ2T2kV0MKdweUSU0UY9j9GtEiKYTp X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a55f25f4-3aff-4df2-6eca-08db6ca77f74 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:18:05.8086 (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: EQ87irjvxK1+s2zHEtaw1kv09QEZfkGLXrdFct5uDb5rw+tkBuyIfHqlAFbMnVZfLnn3Xy9liN7pX1Ws13IqdNVlxSVnPmTWu+cr8BgWsKA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140063 X-Proofpoint-ORIG-GUID: QBF6LthnTXXoOE0ramjZW0X4rG8NLpwm X-Proofpoint-GUID: QBF6LthnTXXoOE0ramjZW0X4rG8NLpwm Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has read_capacity_10 have scsi-ml retry errors instead of driving them itself. There are two behavior changes: 1. We no longer retry when scsi_execute_cmd returns < 0, but we should be ok. We don't need to retry for failures like the queue being removed, and for the case where there are no tags/reqs the block layer waits/retries for us. For possible memory allocation failures from blk_rq_map_kern we use GFP_NOIO, so retrying will probably not help. 2. For device reset UAs, we would retry READ_CAPACITY_RETRIES_ON_RESET times, then once those are used up we would hit the main do loops retry counter and get 3 more retries. We now only get READ_CAPACITY_RETRIES_ON_RESET retries. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 64 ++++++++++++++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 23 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 87450e14c419..f6f0e483cb13 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2557,42 +2557,60 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp, unsigned char *buffer) { - unsigned char cmd[16]; + static const u8 cmd[10] = { READ_CAPACITY }; struct scsi_sense_hdr sshdr; + struct scsi_failure 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, + }, + {}, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = failures, }; int sense_valid = 0; int the_result; - int retries = 3, reset_retries = READ_CAPACITY_RETRIES_ON_RESET; sector_t lba; unsigned sector_size; - do { - cmd[0] = READ_CAPACITY; - memset(&cmd[1], 0, 9); - memset(buffer, 0, 8); + memset(buffer, 0, 8); - the_result = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, buffer, - 8, SD_TIMEOUT, sdkp->max_retries, - &exec_args); + the_result = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, buffer, + 8, SD_TIMEOUT, sdkp->max_retries, + &exec_args); + + if (the_result > 0) { + sense_valid = scsi_sense_valid(&sshdr); if (media_not_present(sdkp, &sshdr)) return -ENODEV; - - if (the_result > 0) { - sense_valid = scsi_sense_valid(&sshdr); - if (sense_valid && - sshdr.sense_key == UNIT_ATTENTION && - sshdr.asc == 0x29 && sshdr.ascq == 0x00) - /* Device reset might occur several times, - * give it one more chance */ - if (--reset_retries > 0) - continue; - } - retries--; - - } while (the_result && retries); + } if (the_result) { sd_print_result(sdkp, "Read Capacity(10) failed", the_result); From patchwork Wed Jun 14 07:17:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 692943 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 019BFEB64D9 for ; Wed, 14 Jun 2023 07:23:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243442AbjFNHXU (ORCPT ); Wed, 14 Jun 2023 03:23:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243251AbjFNHWg (ORCPT ); Wed, 14 Jun 2023 03:22:36 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58C341BE9 for ; Wed, 14 Jun 2023 00:21:03 -0700 (PDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6jxrH025387; Wed, 14 Jun 2023 07:18: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-2023-03-30; bh=Z4l0y0WyOcdKSv80swwNM3UbRKwigIdTdoj7ieGgWLY=; b=Mp8RVF+jOS5QMlfvMFNIW4BVkIg0Bgz8rZ4OO7NSqRaGyAzWE9foQRCQrD45amNSG+/L BeH6aGDSMQpOcmrTji3rSqz33oe/7gooCfT9QJZazSYeO3ZoS43R2G7AxLJQEDOxHdNq /NmT50K3MPVu531xSmkWRGnyntHbesWxXgFLA7lcwcPqh2BSwGPu0bJwAXBtQ1pE9s4C TfqDBWF85vBlzEsTMIdnCuX+zPSR7sWKwEBYyxH2jo2S4TPP6Hdc6dyTvJDcmKqW6dkx jh5ahPCk8R1GF+nTotsGz0J65kG0oRAu9OLc+91cxDyhj2cR8O3TcAfRnpL7LJC37+qO 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 3r4h7d6vre-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:37 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E61KOF016307; Wed, 14 Jun 2023 07:18:36 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2177.outbound.protection.outlook.com [104.47.57.177]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56q0d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KsNWfvwYaRxdDF15j3ujEquCi/sTURfiWezchdm9MtovZWl1lHQdx4G7iCsS9iOlaEOjy+6Hc2hrbHvsANp9ZIOzGN5puTZyDu6fg5A4vGsaEMCqpWShEw6uRnaosDvMeHe587rQ8pfpDONcZjtNRqg9MkjjQwBtEeGsKGuEb1omT1BOXc4GHOjfr0z5h2tvhJG16tIE5cOKI0339+lnBp9CL24cmd5dXIbRyXMAYfZUxUI/PjuPNnQ/VpFezf9S0slgWzSX7V0HUrzPbs2/FhJ9xrp//YU4fTg7AIp2ZbgQcaRhkgXoxeFa+sg+5y0afUZSjbSg6aKIILvhLYRjug== 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=Z4l0y0WyOcdKSv80swwNM3UbRKwigIdTdoj7ieGgWLY=; b=Lhr2AWHMIBwEpno6WqoSpKv5KhFuJ6ReTwMeD40Kx9LNp5Jp3aw25G8F05hjCdmP0j5aC/cv3/3dR5gT62e34eNFRakIs+Dwkzy7c/c+rGN2M31Q0n3ngsKCRv2Egvr0fPUk7AMBmbGOui2EjyOOyIYgaOMPB+vBkIZhd9ZQQ+D3rTZQR0oK7atbwmkLTqFFTSvTkDGASeeud7g/zEc4y985V3CmXj7mUtQYzLNgF1VRA5+hDwYrDBH/BSAIqe0AATSP2PTXEsj7YO+/lRyFyHe7Y+6BOL4uu3DqcEsd9y9JhMFjjzLnUyBTWWe77mdef75/9kMv0Sb8Xr04JHJRlA== 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=Z4l0y0WyOcdKSv80swwNM3UbRKwigIdTdoj7ieGgWLY=; b=HdjCJNAn2Z7/2YwcFHHv2KQLbBH2IpiKXphMWBOV70K8P+QVMIVZOc/iey02htHSHDWEwmVyIcTYymFa0kPBOJHkjfYbBA1+oInLa73gow+EkV/tbdYAfB9g1hUFkgeUK7gwVhYQ6Gq/A5WbakWdFjxDrXbiQ15DgeOMITWFKpc= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:18:07 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:18:07 +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 v8 26/33] scsi: ses: Have scsi-ml retry scsi_exec_req errors Date: Wed, 14 Jun 2023 02:17:12 -0500 Message-Id: <20230614071719.6372-27-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR08CA0042.namprd08.prod.outlook.com (2603:10b6:4:60::31) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: 7342d7a7-c6f5-419d-5834-08db6ca78078 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Otz0aqo3Hdu1p7SVWo6u+GaLOfW+Qc5QSGdmLRwc0WYS5Z5Gd7a6VmCJZO2V4lu8m66C6Ugd9Uecmwtfk43aIaAdsK7RRrVitVCLsonJcGWWIgckMGXG6s1cnidFz2EC53k7o5F5YlFWsfq4WvzXEihJACusaiLWLVEPHLxrJaPYlBXoe1ifTHxXlLwDXonASwlouAt+79VIWJWujwQR2K6R7I96SSYw1W1Q4+8Rt1T862mxFriUlPSGSN8js+SiuooDw6hF0rwJP8cCWiyXPEDB+3htF2kd+jXhTrWqrSX7M5qodPdAhayhDNt6Yzl1mYweEPnSGsz2vbfEiqKBFY45xforJCS0PGIL3SZmB9jgzZe6FfueCYxkT2QuZq7vZxqJr/+gXPZoiHGrAgjJX4M44f+JlXf9DZ2p8TCJefNXSqJnldTE1FLG70KKf7LWQQzcm3+C1L1xCC9mw8tzpK5sVSnzHGKpcji6ZfjcKTsNM7ilZ7JWT2PobYDgdQPIP973mytxED7SisLhQF6q58oSwLeJsEC23VyBi54z82bGkZAb/lTXeI1GlqZTYnn3 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(6666004)(8936002)(8676002)(2906002)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: B6w/HECjexIFsETxh50uS37UhNe15A/DQ8wD/iwLGnY1DQc4ARgHVzKgEfkVTxJqzLLCl/sV35qYDw20xm2q+ENupNQ2We3IGOXt1wW2qtieq4/pFGhnWFI8aEpfi2DEIjRvkoZGL4cHxV+EPtkFX/H6sh0vrvP1LbOoGjqYmYMs2C1z0Zm9EINCemifHz7I3XNc4pXSSi+JQEpRmekHAWd4HMxTv1yuTN5cDRL9NMD/PTu/J/lk+w+fsfi1AlnRW5OHaTBsq07liNXOzMmfBJuI7q4s2g+ye+NBTp3A8lsLVBuUVN8KffaPUzEDDuQEKiUCJ9pFahejmGJ2nG0ViXSJNBj6OKFj6DMt3K8/70jmPQQ/S4asiUVrnxz6VbWrJqCFnhDG/8aDXBPwYhcQH4JS17LBNTkzQCZMEX0UW1GPLvtljtqiMe/nHvvyzLeaOmI0aLP7BophXGoxSAcsmj9To7VGIqz6stCDsXHcIhZDe6zbso2SemKFHn/Xvhpz6MXOWw9DFUh5rDhRgUKyzVNM1lTBd4Q73j9woK6supn0NYBfPKKCAsd8Oo3qef8iQlfAdIlrrde74nwBH+bWldaeU/Czgn6DETj16rq+ljgPcW8r3hK458SiQgQEQRuIISdJ+u8EK2rM6zdi95e1OEVfIjnB7LClCaXGgA96VUr9O/TOoOherKjVXJ/BzDwAHrh3cZX8tLygs9vadqCEOFGqk5Ab9l4qs1HAANNa6fyS6D77Y5sUioPuvzT2HocrBls2nntPj9uWuSA7tVSuW5SX36pv9sBg9SHhJwu46ojbXNLhWmyzSzWecZhiCaC7yttMB9Jyj9iyZ3UQZkzD6hDALP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ihigWihZYNFwMlhav9ZW0Ryg2jDgiOpNAgBqeSsmXF6069KK/fjkKDKJWqYzKaMjXHEhRjzRYXQMtH2ofzpdMxerXEddUmgjZfqvmVlze6bZqKQoU941cJpqj81UtR+jg8GvgHvOFyXx9bpvX6fgfVTqdvxEFN3ag4mmr+IhTvTIXxBFmUR3I+0e0g/bDVcCCI9Uo+fKHE8Y8emQBX32sgU64ZLjxCwF40pbqRYMyKPeA5lBrsRTBOT56uOrJ54g939+H1saiNqYQE2YRaS9dXsINj7RmTsdv+Xujl4Extr6X/h0zX26fmPGc/pknKDH71AfGsP9vPu667tnP7m73Xx7SZUyRWla5VlcZ9u6I9n/xZCJVuHzra2H6HezCLhePHx9Fbq0RdmaTTNDdfoSnuOSnNhJTVYhO96Ewa3FMm3hCZy+otSXPxI9wXvCzV3+fedtPrYgQt7L32ccpO+LlOo0s8Lz3TDChTScHk1q+akLp45EXQG0BfBUC00nLSPZBjY0zmV3qFRI0frr0UgIHreXiY4w1KTSrsPW9KMWCTeNeRj+lzOeg4s7cfWJi/zkZsw94+xzWg4rgJjTCt195E4cqDVv4r60RNOGVPanF6o6cIXxXRaw5xhXhn/p5Nf2+2ro6g3rFkZx28/ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7342d7a7-c6f5-419d-5834-08db6ca78078 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:18:07.4870 (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: XEmZ7qY8zAVfF+HN+oGdEZsPLWOUfQM5PwHSuI9e6IuztcmWXab8CcaUGY2iXI6f9b/NefRzhYSupQxSKc6Ce5oCmSAkatN7X9Aj55LAa7o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 mlxscore=0 spamscore=0 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140063 X-Proofpoint-ORIG-GUID: S6sRwKjXogHQ-o_gc3wgC6KtA5oxS4I0 X-Proofpoint-GUID: S6sRwKjXogHQ-o_gc3wgC6KtA5oxS4I0 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: Christoph Hellwig --- drivers/scsi/ses.c | 60 ++++++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index d7d0c35c58b8..678666ed9cce 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -87,19 +87,29 @@ static int ses_recv_diag(struct scsi_device *sdev, int page_code, 0 }; unsigned char recv_page_code; - unsigned int retries = SES_RETRIES; - struct scsi_sense_hdr sshdr; + struct scsi_failure 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, + }, + {}, + }; const struct scsi_exec_args exec_args = { - .sshdr = &sshdr, + .failures = failures, }; - do { - ret = scsi_execute_cmd(sdev, cmd, REQ_OP_DRV_IN, buf, bufflen, - SES_TIMEOUT, 1, &exec_args); - } while (ret > 0 && --retries && scsi_sense_valid(&sshdr) && - (sshdr.sense_key == NOT_READY || - (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29))); - + ret = scsi_execute_cmd(sdev, cmd, REQ_OP_DRV_IN, buf, bufflen, + SES_TIMEOUT, 1, &exec_args); if (unlikely(ret)) return ret; @@ -131,19 +141,29 @@ static int ses_send_diag(struct scsi_device *sdev, int page_code, bufflen & 0xff, 0 }; - struct scsi_sense_hdr sshdr; - unsigned int retries = SES_RETRIES; + struct scsi_failure 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, + }, + {}, + }; const struct scsi_exec_args exec_args = { - .sshdr = &sshdr, + .failures = failures, }; - do { - result = scsi_execute_cmd(sdev, cmd, REQ_OP_DRV_OUT, buf, - bufflen, SES_TIMEOUT, 1, &exec_args); - } while (result > 0 && --retries && scsi_sense_valid(&sshdr) && - (sshdr.sense_key == NOT_READY || - (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29))); - + result = scsi_execute_cmd(sdev, cmd, REQ_OP_DRV_OUT, buf, bufflen, + SES_TIMEOUT, 1, &exec_args); if (result) sdev_printk(KERN_ERR, sdev, "SEND DIAGNOSTIC result: %8x\n", result); From patchwork Wed Jun 14 07:17:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 692942 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 CC9ECEB64D9 for ; Wed, 14 Jun 2023 07:23:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243254AbjFNHXY (ORCPT ); Wed, 14 Jun 2023 03:23:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243325AbjFNHWm (ORCPT ); Wed, 14 Jun 2023 03:22:42 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46E852707 for ; Wed, 14 Jun 2023 00:21:04 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6jlbm025270; Wed, 14 Jun 2023 07:18:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=4/Ia5W0WVQq4f4aV5B5uZgO45zDkb5N17gJb7mkbDlE=; b=0IyQIXGOCREAd11qtGMx+lXW7bRUECOu1gz/LFVBBrHy8BTAEjy55rUdxK8otn2R1UTu UEr0h1b+6zdLhOlimKSFxoFKa3AgnleN25tGP9iZ+GljLv7YWgNWkoWuwo9LnFdpHw/m 0YvvLVnV6B8/89lERlWTXQTqU1cgYtHYGNk3dgwr4rlKUehpspj1HQ4cvmjg+3SSP8KU 8vFx95pn5JYlNlbgIlgN20c8zRznQErj51llyoKQWVWiuHnC8tT3EAhk5LSjHHRXJSe2 6zZ/nAX3blbJTA2AzfDLWYoYCscQ32mN5MufUJcbGP6zQxUfn/UnYaNJFgyfBjfk3gAa Sw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4g3bpyut-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:35 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E5bIXX021593; Wed, 14 Jun 2023 07:18:35 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2045.outbound.protection.outlook.com [104.47.56.45]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56cnn-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lOiuz23TDr/bxp22hw1FlYbpM6efFSA3E+GXo6O/15nI+eNbS9xk5NuroHLnSvkC6YV3agwZza1eJAvbmdUsNilnQYFi7BvOxrNNwaxewnHpmCAYKOsZuj3Uh6YGfyEu/iIwBV/xRoQTlKkGC809b9Av88Wja3Fhnmz6bBE6blExxnrOLo/ruoiD+H7df+JxqFjAyzY7fLuaZqIZBDyukdtrCDCJYPZUd/Ov6TK76wWhXpDPFq24v7wH3UScZtWeTF5c65Zu0v+9FSSR+6VrF49gNrSyfJiCk0kBzLLDyNMI8Ls5+g3hsVu7S5Ur3anpJEwhGButcrt4jEJ7fu+WSw== 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=4/Ia5W0WVQq4f4aV5B5uZgO45zDkb5N17gJb7mkbDlE=; b=WieqloxqK3kCJHZ0Mt7UW9aR12nEhbKxvGgSwhjnwXgfe15Oll8BoNR1gnCI4AIcZ4AoFftQUqbe7ESc1LpNYK09UKCGKe6b1TPTl5+oEM/FhBCKBXcat1WAgd+aopYe3QH3puf6moxUX6H/SjT0GXN1QpvmSGtXoLFCIP+RJeVWI5RVOAjLq1s/Egj8S95qJ2XVwVbQe2nhRLpBEZ88rkXqym2HBdLgOqunnVjYJmgdQd5JlsaaI2lFTV4XHuX2m4TjJVF56D7kJb12CCZKLwDQMRuzBCxMWuZ2cbFX0IehfRDwCKs93YDYTsZxR7sTZ+NZ3JK+7l0cZenv+/7eXA== 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=4/Ia5W0WVQq4f4aV5B5uZgO45zDkb5N17gJb7mkbDlE=; b=z7mpSQy4ZY1kpw3Xiwgh252+7FkiuY8gdjbmIDHO0CBU4PmoIZaUqC7mFjpByY+eKUfI7+pLHukS1nSYWzXO7W1pX7mzC42N0q4zNFhzo9BPo90yVPMYVhyCKdEvJcYTuUWPWaI9sciTGExVU9wiWKOy8EO3fzhoDiiu4OJ6Zy8= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:18:10 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:18:10 +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 v8 28/33] scsi: ufs: Have scsi-ml retry start stop errors Date: Wed, 14 Jun 2023 02:17:14 -0500 Message-Id: <20230614071719.6372-29-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR08CA0033.namprd08.prod.outlook.com (2603:10b6:4:60::22) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: b48e7c7f-5b6a-45c5-dca4-08db6ca78252 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qjv10ULQ5D3xQ8Tgy3f+tRsMClUhqa5GwN/nNLWTEwKi08VjCuaZujexFRBcxzxbg25AS2ocMCOB5amIpqyLY+YciaNv5XtBSOMWvBKzk1mLh6gyr8HeNzW4o3Cy2aWixeYsEv6IIW1Co5ub2jKu2McSfhzZMMH7uD7QHKqna7kPNvYG3o4pa2iQG5ihAJIB6B26hRQoIKixBgMSiDAgvV0t4jsU73vihDng4JzwtwDD69oj2LfIofbBOwbLqSByw4T6PlEeS9bkMv8H4JH36v6Nv/k02rglUZ4oHJQotMVxGNAAIt6KvS1h3MepOzOfg5vjvddfqPfTYBCR+Gf1ejvmaDt99qWK72bON6Lk7YrehKXWv86qDxjQ7YmuOfca2Pdzk0snVc2RvejHUJrvpqPlRHBNH0vDaUYl+mqS1BSUJL59pA+moQECr7RHHdDGAkOG3Lpg8DlrRwXALv+5b3yBmb7aDli6UoEVkn6bm9OxHCdP6zFkwp6s+XA88Vx+RI04dAMFmCXcLzhg4mMi/7oJj5uYvY4S2b4jI0xlbpJda21C4yl4fs9zrAavE1F5 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(8936002)(8676002)(2906002)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qgaIeiR4GTr8JQWPiNlMujkE8bt7OufMG574O3luADV1jx8PNJHyPQu38bMtaV0dgY7A4Vp9EaZA6JJcIiaTKjoPhFSeTIE6njR7PcWZgtZmELbhrjIhnfPQxWAwu5rUWfF4+xV7tUQUdF6fO2Hg64HfVYECdQYeYqxUapw1egwdhqOawsBm0v7nzPAsHNGNv39ICpzOVrt43XSAkezdTWqrKcKgIVe+R2jYFG0PqGYfhOfvoS9AmtMkHaiNyVioEToF0L5NqguvE8sn1AHvVkWQ7tUg4CEN24AlzwLQtB4sPlZoLcEk3i6CZ3VP+QDfleLMZUfqg9Gymdr/ImxJcbTULCT8GV6urP3ehX84B0LTczuRkE2UXvP8jK1L5X1fqFhbx9Dho5pnHFPx9a91hkQgyWu51x1O5jUvMZaYUx+Y4lMlHXU1lfSkHmf2hKN1ND+Y6eEbs6j7JaQSVOrmh+j7A5K+RiBwdErR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Bh9yPnSMuaKZyxyZma7jNcAaUJVQ9Hpt8Rtf9fQ0W7/2ro6BekJkvg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: WNREgn/FuyXMRptmvqxJCbuLFVyNSgjK9AzeVGM3shpq+ed7IluPyasYEbkSriWBmBxioN+QF7z4L93gutmvqWrGsv7dhwoIWa7yUhD7IS6UMvfdT2vMFjnXeSfwOhOS0ApO39TfVmPzcHi2UrfphVZV6XwTc4tgotNwSOnvuSNRPOuOb455oIcXAOM5XIBiOvOs0G4vrvh4hIxlOUwfeRcfd1PALRbD+jNmgLkUununMkVjnVOQyasKmqj4yd3fzpq3KXMcWZHyCiDU9L0sUpF1OYftVoUGX+Lz0WB7ex+4nQXTT90ZLGOSXyp+BdyqmtFQ7ArSG72wtLgL3PdXs/4jkx2jkqOtzkLr1aehSltnF4hTLZzBVNyiwBoZojNCEtE8397H1FrBPaOJpoTaJKrU9l9qlG6hjZrD6QCqkQzv5Yvjr1U7+TqGX8DeK+PTeHa6SUYLvQG50kxDg06JEwqSh0tU8x9g+louMs62UZSzvwFc1opOfPMre8s1/bwa2wykfPOy7StapT7AggAsFTbQuSCm2kf3rMuijkTGLxbQ637ZtbEvgk24Q8gG8Oc499MAy6Q4niWbynJVulfH9IHFz0hr02zYh35dVuxFjGm3BhdwtIqRyMsjPGJGWGEWmROYwoE90Ljj9RYtnFF3+4oRkMDWypmnZr5WXvapF0BmONtH7Gmcv4ab5nNmi0TzItvui3T1f/Fb0Mj/jnP9FKk9ib4wY+J92mu7kiO2cYtMhMMV45jmCNrz+wPjsNs/IBkr/J6EpmHT/tcU29gHEee41xkvZZtnXZncmtrkpyQ7kuvtKkkys/owTnC9QZh0aCjHDBZcTkCzWQqutHOmGHGyk2b642HVcjVIFJ+VGo5rus7HI3vMm81rJEpzDaqY X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b48e7c7f-5b6a-45c5-dca4-08db6ca78252 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:18:10.5974 (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: eGC+cx+avaAQJ+QHTpx+XsqG87FHHLE32pnlDmwuDxa+CRNrpyUBhrxTU1s1sMBGn+/FpAWdcOZTItLwiT/5KaAwd4EcYGIxn4T7EFozCJk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140063 X-Proofpoint-ORIG-GUID: b0JrBQ9igFRo4cBxonAbn5qeNBkeD-hX X-Proofpoint-GUID: b0JrBQ9igFRo4cBxonAbn5qeNBkeD-hX 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 Reviewed-by: Christoph Hellwig --- 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 f2b3abafcffe..66ea125f5e7c 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -9284,7 +9284,14 @@ static int ufshcd_execute_start_stop(struct scsi_device *sdev, struct scsi_sense_hdr *sshdr) { const unsigned char cdb[6] = { START_STOP, 0, 0, 0, pwr_mode << 4, 0 }; + struct scsi_failure failures[] = { + { + .allowed = 2, + .result = SCMD_FAILURE_RESULT_ANY, + }, + }; const struct scsi_exec_args args = { + .failures = failures, .sshdr = sshdr, .req_flags = BLK_MQ_REQ_PM, .scmd_flags = SCMD_FAIL_IF_RECOVERING, @@ -9310,7 +9317,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; @@ -9336,15 +9343,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 Wed Jun 14 07:17:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 692941 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 86538EB64D9 for ; Wed, 14 Jun 2023 07:23:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243462AbjFNHXe (ORCPT ); Wed, 14 Jun 2023 03:23:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243328AbjFNHWp (ORCPT ); Wed, 14 Jun 2023 03:22:45 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90734211D for ; Wed, 14 Jun 2023 00:21:06 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6kCOH026738; Wed, 14 Jun 2023 07:18:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=qGzPE80A/pbly1s2+Z3bS/c7JyAzYtwjTGARwD/R/zU=; b=WKNn3NKbj8g90jsVtKz6HgXDS93r2zy1EUv7qAcKQgjGxLaepXMFLgWCg1zV/KrUolRB xA3dVjLB78p35X8qVQlQrmzhgottsbPaciPK28l7x2Hp8goV1k3ZEjhjpH13M76ppnlW INiFz+jpna1s7YC4LdbAZgJ1oVavh4cuIzUUbUdAWYl2hCdzbBkpBMpOC+pC3em7aHw9 VfZ9ttTxpsPywNW29Q5m21ZqWmyvDjra54GcgLG6RbxPuJFjP1GRCouSyMTipvbWsIDd HsCtxyZJfPTj10wk8SPslTCRCXpyfW7Z+JH4X7zt3ufD7JS0cT3FaOlYde/uS2EdsXCf jQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4g3bpyv1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:37 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E5bIXe021593; Wed, 14 Jun 2023 07:18:37 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2045.outbound.protection.outlook.com [104.47.56.45]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56cnn-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dPSxOftvSGE5tsoFv1YNUvIig2d2O/TZTyTDDD+KNY7wC9rXfrSB+BIFmnGtyrsZTm+J7s1sowIMb6uMXRZxNhXPPbOWol8cILasfoyxYYpY1QW+oaJDS2fgcU+sIWNmTwtsGSVO3xxsUB0X/Z7RL+GYF6bv6SeE3TXCP6ayWhk/X6ZZqFbhO14eVrOqY9X5Y7Xr4BbthVFn7S7rV76GjP7snvz74KAp/cvp/FErY72/LVPyYy/opQcr04Mg6v8B3Q1M4Y/RIwM488DzsOXok3eLOmjmiCMcp6kjJBF+YSeawIXB/n/syLJg86dQXVl1JaiXWRyaf3Wtfji3Ix2ltA== 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=qGzPE80A/pbly1s2+Z3bS/c7JyAzYtwjTGARwD/R/zU=; b=Vjp2iDnFztwhAwtVnVBCg0BoFrz0L0/6qq0pVBL/Q4vT9nfgSNn9i9xcS+f4LFhlc+BJb/+a0/gvE1VVccV3mHCU96cV0zN9HqAjvnETEvw/ZrXJ0nhZYBecZlpG0G5Ad2T50kS02mFOFf5DHDRN5DzHYun1xNAuRlkshtw0CRCvQ0U/586vSY5+WRfhNreSMX2cLknvkEHbCtrkiaN3CZQI2hRrv3S/rKnuqYhF+6AIEXS3QXKHtT0HdfTcteXbF/aS9Dvc5iol7yFbSU64F5ZsBvjs4xAmq3HCIzrF+0qrpDZG8ppbiLb39dNWkndrMwb2z5BygMANBg0LGYFqAQ== 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=qGzPE80A/pbly1s2+Z3bS/c7JyAzYtwjTGARwD/R/zU=; b=pT/ayDyxoKzsNTLuldpL4+Y0mpuRwEr03oVb+BGGGGTOSC0wak+ABD/pUASMNpufUI4HEH/UueIUIihanseoWzq3qLHJGxcX1Lkp+eR5FC+/K+ActC9Vdl5c0sLWwx/xugtt6tBYC4Pxd79ydru5+RrXV/j8CH+w/hjMVfjYA9U= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:18:15 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:18:15 +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 v8 31/33] scsi: sd: Fix sshdr use in cache_type_store Date: Wed, 14 Jun 2023 02:17:17 -0500 Message-Id: <20230614071719.6372-32-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0152.namprd03.prod.outlook.com (2603:10b6:5:3b2::7) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: 9ebedb45-2355-4346-e779-08db6ca7854d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KEICzqpln3f8V9T61MFO5ONbrwQSJDYSSBFpb8EtAFRswaeEYFALyPLcfIeSH/4FMVDcife/lsvVSy/ziYdL8OpTDXGykpeonKyiEfSET+JUPOrCQqyvHby/qxHs+Vr3NizyUdOAPrsHKW9HEgCyT1ocz2nLoPbKRK+BnHLgQ8jgnwDtqRSmhdqzcZNuRH4DK8rduJ7FihKPyDvjx1qngpCks/zA/awZJz04dMSHsUMOyvTp+A0B7S0lXf3MhaFffbDuv9RJEdE0pKowe9oUuYViXXVioiErUBVMLyV3dMnyJcwHzCAsQomNMSi6vWc2Sc8CF2DwcjaMqqzwI+AkH14/CGRvJq9te0AogKTfncH+Kw9jzS3zvAsKgG9GM1uL20oguQHdMozcPydCe9aR5OShwfPmLa8hYfqw4uayjydcwxYta36BYorAEqBSO1a7JoEdYjN1/0+uvNF/jEhPDHLmDQFLKyGD5IXO3kPgmsNZ6Lf2Gdk8J043pkARMFaCX6UAhLdnhTULl7y67Rzbb7+s7SGujPgG61AJgHQ4aH4BD8o/A5W1R9IJv1R7T35m X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(8936002)(8676002)(2906002)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MidZS0sdYnn+G1+zkyM+teL3b8Oq91GKFaMUP6Dc2jsiXwsa9k7/2ctYoZK4HVocRMatU5I15UnatV7mwlC7lZs1GSHTGlesrYjE+0pePb7OUNwA5e1M/dDxkLIziphvB8lXFBn++LN0DPDLj1/l5djjgYPI/JtZ3NjLj5p+0Jaxj6/KFyORBDinoj3WuNz0OhmCk+X4Yfl+YCC4wd64LXhSbShKF9B8+RM91Kn75Y8cFCIaGUb3X1Xwi/k5Conm4Ag8pCCNTJl6AcE6a8Gb96YOcV+Ngv9ALD5FFckZ/7U4aU/0s6/J5y1fqJgxT7ufQQu5NpiPTTuEWMVqbOmMyXXmdRiQA3kGg0EOsNGjIYPbVbNRK6TJcpSX8/yv31Ynm7ByD43TQ3tSQ8S4dkyw9GVPMsukE6EI8NGULKBYrUbSj9E0leF7sowlI+N38fipPeCXgQ+AqJqJQVjmRLxW0yN959ICw6zgCWw5oq5vpq8rq6hYfB+nyg3YLfPzaBJwOXu7zVR3yKVydSbFy7BhG91VSyWIbZJJGU+lFBlXKYU8Riv6V9m+xa3QJaMplo7HjV50gWuOKNthgOGS/I5Y9J3yRW2Odj6co65/vJ72+KmE9jLsMueQOZpCVpxseZIWYoc4G2D7bqQHFVg30AvJDqFLz+blOU7DIY0ywenrS00KC4caGVClqlkc99DMyyhRNvlG4JWyTsu673fzlzTyGMSzkKnr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39/9xGwCBP3Ved+1KnYIZr1KeOwk94WkwixaYY/5fq7d3gQyPTyfSbs4fZUU4GPlZ3dLn2ypaWyCXU3tj47yZsHQdGqcGada1R4Rc9bWgLBb1l5DwS6Twz0bfLi+jcquUMGJxvk4AmbNJEp2RDiPGZMA7e+FfGLnn8hZl8+PnBdzNlw2lgVntIOXWPFJRyj6BMQ2vbNBNnpVLHRer5ii8KbPd3flj4HPzXKQMh0ytnJ5n7DmCV+htCLbxUyFlLOjHGXeRyYh0OsHykflNSKfNXPWBwPCkPMIgrA+84xjp0aPJCH4TvIojNrd5vYFrHnaD9bTNfR5oQMRi3HSNLlqkEE8ykjYmPnh7xfoFJb5fnRneBI5D6Cp7UO+tsw8nTLLnEDKj0SCbTEF/m/rzyNzJtxJCKFYgna9CbJlW+G9uRE67Lbxyxfx3uh4gx6VtB2RGZa+Gfzplt7nAznuDdLYNa72ipeR7M3uz9ji3eSeLOHZeGY+oMkP8Y98EFsgR0jeMM27x29MmhQuMNxkrYGARMHVqfiye1lXXA/Su2fnuIPTdLQROcRIbuWHQw0/98YNEB/2FOnx/rHjCN4BtwGXk4yVjDc7GcsqyKDxAFyFO+5Y/VyCIKoAP6UoLSl/rAZGsJZV5Xj8gb+gZ/p0lWVltkVFbtPyBx3l0OfJ6Kkir7v/bgx1uly/fapMcVkoE/P2F27NwyDLeNAu/ThyYnzjLoTWh5Hwxsbih7bYr4SqaD3MRhdqdwEWK7oDGM4qGkHU5uy2x7CehCyE8T8MTwptblg X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ebedb45-2355-4346-e779-08db6ca7854d X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:18:15.6111 (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: hLMiax/+/qPQ6sp1//ovuR3158YJH4VqTfYYZtUxHIxRKrkrFO0TAqbq04HWjNfZ3svZ0qAOFuQr0mytWX6HedpdDtGL2hDMNrg0rQjeS1w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140063 X-Proofpoint-ORIG-GUID: ec6vd4kLVG7HnrCgL9gQI59i-kvPwaVy X-Proofpoint-GUID: ec6vd4kLVG7HnrCgL9gQI59i-kvPwaVy Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0 it will not have set the sshdr, so we can't access it. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index f6f0e483cb13..3f3b7dc818fc 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -155,7 +155,7 @@ cache_type_store(struct device *dev, struct device_attribute *attr, struct scsi_mode_data data; struct scsi_sense_hdr sshdr; static const char temp[] = "temporary "; - int len; + int len, ret; if (sdp->type != TYPE_DISK && sdp->type != TYPE_ZBC) /* no cache control on RBC devices; theoretically they @@ -202,9 +202,10 @@ cache_type_store(struct device *dev, struct device_attribute *attr, */ data.device_specific = 0; - if (scsi_mode_select(sdp, 1, sp, buffer_data, len, SD_TIMEOUT, - sdkp->max_retries, &data, &sshdr)) { - if (scsi_sense_valid(&sshdr)) + ret = scsi_mode_select(sdp, 1, sp, buffer_data, len, SD_TIMEOUT, + sdkp->max_retries, &data, &sshdr); + if (ret) { + if (ret > 0 && scsi_sense_valid(&sshdr)) sd_print_sense_hdr(sdkp, &sshdr); return -EINVAL; } From patchwork Wed Jun 14 07:17:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 692940 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 5F4FDEB64D9 for ; Wed, 14 Jun 2023 07:23:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243349AbjFNHXi (ORCPT ); Wed, 14 Jun 2023 03:23:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243337AbjFNHWq (ORCPT ); Wed, 14 Jun 2023 03:22:46 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AEEE2708 for ; Wed, 14 Jun 2023 00:21:07 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6kCkU012076; Wed, 14 Jun 2023 07:18:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=WaqqMVzCBGxC+EJtedsgsFpRmiuDCvfonBqDWNise4c=; b=Jrqm38ee8BBCqB/Juxc2l2tpnryXiEmkQsomxVvB4ZjPszj85QTCsAh29P2bKcYDf4dS mFqm+jFDahBAHLiJVhw8xQ1RYDLsJgF1SfyKaG/YfLU/BdnDv2lTwC/8c5BlF66SQ+q6 lviXwKv5Nf/cCL6zLxer9rw+rSbdEOk//mAIJNopwznpWdd2rBLUpMF7+an3qdGdxNIB P80yd0YOyx6Fnr3e5hEoeXvx9XPOqAUHAnbqiBjjkfXjCx1Iw14rftecZhToqBNXsg7L Jlp/YJk8CRulqwjW5srKvnVxzwFCukeecd9jMrrisbH4aXxjLAW/dmxsddYOaAGiK18y Yw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4fs1xxx8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:38 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E5bIXh021593; Wed, 14 Jun 2023 07:18:38 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2045.outbound.protection.outlook.com [104.47.56.45]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56cnn-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J04Kmfm0FrLo8x+mfN79080LeEtne2gpfzMz3HhBMr7BRG5z+1UI+HLQVE1BZjd4zrhymLi/oKFsNPETZKeM8yA2b+a6JEb8nA8n2ImLKz7FgRHXvjsJEuvrePv4pY4xFcCj46joYX3dGQZKFo8/ziSPub0sNF3TbiKwG/ZsVkOsI+2ch73SJcsQ2HNPFbRQ7fWTbMJ++xYJj3JNTOtPP3F1PcHIXpdcUd4NjU2DcZmsA+pyVP+b854PIMLD0uUwjY3DBR8HrzqrC0Am05hQDAhylMJMO9CoeI1znYSdQGzst1YL+jTyXdCz9A3L15HCvgrHxE7kVdJl5nHLSIsb8A== 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=WaqqMVzCBGxC+EJtedsgsFpRmiuDCvfonBqDWNise4c=; b=QL7hyEOYHp4jhgd7l7KQEcV8zgcwrxEKzairGy34/Bwd/WeCzxZ6NR43fkoMwsmXY3YUjcqEOYKuHl1eiYJaDfT0tXvcK5gGzf5S8YhCQFurKBsjfxRPm0VOsIrerAohJ1f5P63OvXDGrxwyuFq9ra8gNLbALwZRgBorLQX8r9l50LuoW9E2xo15mrL5rt+qBi1j9LxBzKenYg2ENV9HYRoAagtiVkkh68bf2JWzugdhcWNRAdDQpnXN5Bx9KfCr04mRNL5vvAx0cFZNyups8jcuPuAcCp8braUE/XIZfeoAry3zn5mFEz796cetEAXp8+QWaW9btAG9/ryrke436g== 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=WaqqMVzCBGxC+EJtedsgsFpRmiuDCvfonBqDWNise4c=; b=xPD4I4JVGhqG6nTLwUkbO3zQVb/bzGrQq4kvO1N09v1ZOShpC4uEYEBDbH2O08iJVOzBft/dgfcjj0SK34TnA/+cbZPk70FakrKj/hzDAfME39LJ0nBJJUpgeVV8TKV4+mRFq/QUTc77rnagkLbSeLBdHjXp/lVtLEYGm+yrfxQ= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:18:18 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:18:18 +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 v8 33/33] scsi: Add kunit tests for scsi_check_passthrough Date: Wed, 14 Jun 2023 02:17:19 -0500 Message-Id: <20230614071719.6372-34-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0180.namprd03.prod.outlook.com (2603:10b6:5:3b2::35) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: 87874479-fc64-45be-6bbe-08db6ca78728 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3Y9M01olw/dX6mWIHhfuncyECuac1zFWVWAjRGC09LP27iC5xyoFihKsRM6Bx6bXfqtsOlGJJzkrJSZhwxRd1NemW1Zv2/prNq5zOpio1MUW0m2IITnMJqyGu5JkR4+QYRzdHr76K0gUDcTglJYdBYneXIAvYql93B/nhsiorkME1Ad7K59XT22N1BR/7rP1PxANmo6ZZO3IADcPouRk7KMzM/XRar8U5HKvq2GidhSwNu15CMghoS9yr19nbmMcdXmhLhmhEORfR8zJyU8PYPAJGXeFjN50zLQFNugBlTV45Z9LELFBK8zl/LinTUJeI9yf1kMURFMWya/N8Kq4o873qak4VNFJupHMQKVXF+YCmV3ScEqE7P/sLy9lrG3wdSwGYkg17lO7KGJ2LwzzwN30thysMsQFa0ZXt3tkwq1g2Q5sMhVJ3u6mdXsIMVzmWVaWkFnIJaJ4UW2oS39dg+QJsgl2ZW7mMhoZjujsOSUwNwf8B/gCxY3AJQZv9flnKXHso8P/rxJoHOW0mAd8K5HCLsRPqr8eKE4Ovma6+1uEsE1Ci+kxlKjYmPDU38P3 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(8936002)(8676002)(2906002)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XsD3cPxsXg0F1vU8/ItOz9QD7QDqrF+njUMvxeFfSt8EeD/zmx2ghdKDJemGfHdpqG0OCdLDMPIdCQZjDdc0G3D5x+vm08xHc469b4DTCTAJUamZ2vAHLaV6u9FzfUcHB1Rsff6Om+alc6Bug6nHw+xP76ECJhevTK3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zZBS4T5tk4K6tP3gXK7cOEZyNgW/1/ItpXOM1NI26+4DHQW3J9bCeB6pPdNFJa+v5187Lfif+5OGXxLQ45vafEjmWToGDoWwTggyc/0eUTnXKiL1FDnodhx8HqnM3igQYsDY7Incl4sibp1yi3s8TExz51xk6fCDYWo6RQBwv74NxztuP0I6F6jZWY8i9EZny8OQGoDNfjn1+2yzEwAaLziED8DDoB/m+sViZFvmAEl8rYCB5NYaffHMGgu X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87874479-fc64-45be-6bbe-08db6ca78728 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:18:18.6918 (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: FXvby/UKrZlswkcStb1rAcO+ys08vQl1JksnG1we2uPgGYVKJwCiH9cSi+IXpUgxfbSI3mW6yrBQoRd7/1fvBYoA08vWcgK0W63vLYKzRS8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140063 X-Proofpoint-GUID: 1dbxEkjstF_uI8piF_sf6nf5hmLAKVmM X-Proofpoint-ORIG-GUID: 1dbxEkjstF_uI8piF_sf6nf5hmLAKVmM 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: Christoph Hellwig --- drivers/scsi/Kconfig | 9 ++ drivers/scsi/scsi_error.c | 4 + drivers/scsi/scsi_error_test.c | 170 +++++++++++++++++++++++++++++++++ 3 files changed, 183 insertions(+) create mode 100644 drivers/scsi/scsi_error_test.c diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 4962ce989113..be9b6eb2fba2 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 d2fb28212880..82111cdeea16 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -2663,3 +2663,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..951fec0fdeb8 --- /dev/null +++ b/drivers/scsi/scsi_error_test.c @@ -0,0 +1,170 @@ +// 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 */ + scsi_reset_failures(multiple_sense_failures); + + /* 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);