From patchwork Tue Sep 5 23:15: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: 721419 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 569BBCCF9E4 for ; Tue, 5 Sep 2023 23:24:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234568AbjIEXYw (ORCPT ); Tue, 5 Sep 2023 19:24:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232289AbjIEXYu (ORCPT ); Tue, 5 Sep 2023 19:24:50 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12F029E for ; Tue, 5 Sep 2023 16:24:47 -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 385KniTT009361; Tue, 5 Sep 2023 23:22:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=DEZ75sKHRKKsziM1j5XF4AaqkVGnRHTGS9mDfdtHGSw=; b=o3zx+vaRcNt57Z4Nlom/MA1pANN9xQYUoiu80rbelEcRz0mlmfFMF0oMp6fDEUMN79Ex xVitBQI7Vc3ITB4JbdSQrNjMQZbmjmeN6TjlXDTuJ9xtn+2r+KAxeEAgvYf2i/FkCyxa rvHL4280JhNyho2Rkhl8T8E6ucvdVSn7E9JtbTsC8jH80fJFLXfJCC4rAz+ExzHxzRgc sPXEqto/Pj5w0TV65bhwz4QCM5MlBU2v7QvkEC/UDS1RqnjQMVphnAV/UbdU1J4W7r2t 7+OaiFMijNkGYzPsj/Y0vRLa0KQh2065Kd7862CBDZ+nPzmSOFG9ul3fxlDy6ahUqipU 2Q== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxbq389bv-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:22:18 +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 385M2ToX037100; Tue, 5 Sep 2023 23:15:54 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2104.outbound.protection.outlook.com [104.47.55.104]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3suugbpc5m-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:15:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cScUc0RyCzPW/2HjLGTrRww1FWomvexGVEU91DkHzDwTLgM/5Wtp7zQ1Pl/5dt01gAOrX+LCsHLlkVqBdlvQ5L2XHT3JP/DUSv1Mj6xq4YkE66yvxaU9C95fskA8b5TFnUzjtHENdVbTTq/i/xp99Y0AkX1A7O5dZSTmjArR4DLeAF7dCDJkIPBgt79E/xoRxzlR/NcYI7vW40JEasoxx8tchSmUt70k3UQ6HcCJztEpzps8RlfZoEUDh87tb/APtRTCfvIZhGbndf37j0OqVQB+K589oWKst1LS3azYELymFNtMDPjVbqVQ+qWf3k+UFZlAwbEpdg+9tyNhgk6iRg== 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=DEZ75sKHRKKsziM1j5XF4AaqkVGnRHTGS9mDfdtHGSw=; b=LryXku6Z22dI41Zj9oE3C/1Le9oNTI54pWTqDe+z/O4OPt18eCViIaJOSg3K++fK47nVaZDs064NQ/6SZC7rvrHLBHjDjLhCCGFlf/G02uAvJNi/GmNXow3vfavWoUeQe3jlwexpJH1BKIu5g15w7izmc/+8pjHCtmM1l4drYzen7vRVUrDgAVUjG454yTWSAnopmvOEQxJxTR0OX7K9JirmuSANTP23N2fqyZa+kwhcjJfsEQ//GiALH6Vhg6iqnoBe4+QbJdN3UcI1A0fFPIbDZE6iWF9xMvzghoII+3NIbicKGZc6vNRIVTJZNZ4o6Zgd6ZfKosRAKQX08hVrHA== 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=DEZ75sKHRKKsziM1j5XF4AaqkVGnRHTGS9mDfdtHGSw=; b=lbne2EUEkPl5Ip2BpLpxCWTh5cppJf2Qbv6Kzt5nILRNWGcXdmhePozZGhDqjZZg3fCh6IJfkwvxRoeJnurCIMWgyHQqO949AeY/LR53SxmMiUaQwV5lXXzSC2MHmzguY2vOeeMaWTXtaHScDghaynL5Jcr5mT+pWPFZNWOSDIo= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by BLAPR10MB4849.namprd10.prod.outlook.com (2603:10b6:208:321::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.34; Tue, 5 Sep 2023 23:15:51 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:15:51 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 01/34] scsi: Add helper to prep sense during error handling Date: Tue, 5 Sep 2023 18:15:14 -0500 Message-Id: <20230905231547.83945-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR14CA0061.namprd14.prod.outlook.com (2603:10b6:5:18f::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_|BLAPR10MB4849:EE_ X-MS-Office365-Filtering-Correlation-Id: f13f7729-8c39-4eac-d7de-08dbae660bad X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fE5uYkg8HLeZ9wGHO7m9lS91TOjQhO+wkZ4+E3q9VHcThR4aC2l5HnnCZsHKzK7PIXA1wcSDOP2sRuDi91khO2nJAgZfci2pb7+96+qfG9Dq9bnWLoZF2zIwFSm6VvAwgvxy5jJZqQx7OIyDsBz5X+RycZ+VWpuwmztBgBZSP2r5UTDIjC5sXCIocwyst/UEGJVkL2Firmz+3SqdNDoQGBhHp/eeGRRxVNDJNow/rCpava30lPqfOP9J0uieqrempni4+bRyE6CD8otdAlItk+AAFu/tjr4FtT8E82RZcTYSFWKSMIwl4fH2wXoirMuj8V4qCA6pMDVQHtSoFJPgkeF4wGrDHUySiBaru1Z+WFKoVRLMul8Kprgj0GgZC/ixAWezhBXbROCiDeAlciACEUT5y2jFJKZulBg1RgtCJdm+JD/YppgquWAMubOMwzQBCylw5he+mVjcoSoeN7ROzU9WE85h6vgHsxZLZMziZj3OoUAfdjyKODj4WzW0cfCj1jzB/8Fg5HRYJ+L9zsZPBreK09+uIiSaLBjKKeImuq2tGh/w6QCaWbtVPgosMTOt X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(346002)(376002)(396003)(366004)(136003)(39860400002)(451199024)(186009)(1800799009)(41300700001)(36756003)(8936002)(8676002)(4326008)(86362001)(38100700002)(66556008)(66946007)(66476007)(316002)(5660300002)(478600001)(2906002)(6666004)(6512007)(6506007)(6486002)(1076003)(2616005)(107886003)(26005)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: txPAnU0G9ulOJtI4r4TGFbDmpF23EORUOpA1DMOpBowU36R2Mb62N34OB97xUNcs0qo8Aigjni5NSc7mN63ou10JbB44xcfOUIedQkulB60yPDcpcrgflNPZSRFwvseLExQyX1nNbZiO25mVc1/onqxnn4Y+MKbGC0gvcEHBpDJVKYugqk05SbXFnWwNsfI7CxeKrNrtCiZvcU6h0BSEq0GnCUIPSfypbOjHh9iGz+tyMiSS0Irw4ozdn5LlRYD/aV9vtBWvL2BP7SiCTViLoPnfZQ6rDIIXaYVbpK9G0TEW8a/mO3EO+Q0NtuUjv4nkbWauqYpEcaVwcz6i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aH5fwxfr0sXuCvQIuF7YeW/mbFO1AobDkK/bUF9JV0lvQmhals01jQkGGSVXKRAdgssx/76K3rqCipvDW3fcdnzAcTRwtpnMgeZE10F3Wponimi X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f13f7729-8c39-4eac-d7de-08dbae660bad X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:15:51.0524 (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: 6TDAxlxYZ0N+Iy8BdFweTuoKQx7WZeTxmBVcdBGp6VnL2zfixYQHT2rd4PcH0Zm2DJtMM+/2Hm5lMiS+qfaIYAg7fUYazrNR3hiqSZGPb80= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4849 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: lG_6IWQUfjnV1M5uEwsWChq_K47NqLe5 X-Proofpoint-ORIG-GUID: lG_6IWQUfjnV1M5uEwsWChq_K47NqLe5 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This breaks out the sense prep so it can be used in helper that will be added in this patchset for passthrough commands. Signed-off-by: Mike Christie Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Reviewed-by: Martin Wilck Reviewed-by: John Garry --- drivers/scsi/scsi_error.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index c67cdcdc3ba8..7c3eccbdd39f 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -523,6 +523,23 @@ static inline void set_scsi_ml_byte(struct scsi_cmnd *cmd, u8 status) cmd->result = (cmd->result & 0xffff00ff) | (status << 8); } +static enum scsi_disposition +scsi_start_sense_processing(struct scsi_cmnd *scmd, + struct scsi_sense_hdr *sshdr) +{ + struct scsi_device *sdev = scmd->device; + + if (!scsi_command_normalize_sense(scmd, sshdr)) + return FAILED; /* no valid sense data */ + + scsi_report_sense(sdev, sshdr); + + if (scsi_sense_is_deferred(sshdr)) + return NEEDS_RETRY; + + return SUCCESS; +} + /** * scsi_check_sense - Examine scsi cmd sense * @scmd: Cmd to have sense checked. @@ -539,14 +556,11 @@ enum scsi_disposition scsi_check_sense(struct scsi_cmnd *scmd) struct request *req = scsi_cmd_to_rq(scmd); struct scsi_device *sdev = scmd->device; struct scsi_sense_hdr sshdr; + enum scsi_disposition ret; - if (! scsi_command_normalize_sense(scmd, &sshdr)) - return FAILED; /* no valid sense data */ - - scsi_report_sense(sdev, &sshdr); - - if (scsi_sense_is_deferred(&sshdr)) - return NEEDS_RETRY; + ret = scsi_start_sense_processing(scmd, &sshdr); + if (ret != SUCCESS) + return ret; if (sdev->handler && sdev->handler->check_sense) { enum scsi_disposition rc; From patchwork Tue Sep 5 23:15:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 720325 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 1CE08CCF9E2 for ; Tue, 5 Sep 2023 23:21:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242388AbjIEXVc (ORCPT ); Tue, 5 Sep 2023 19:21:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242001AbjIEXVZ (ORCPT ); Tue, 5 Sep 2023 19: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 94E1EE8 for ; Tue, 5 Sep 2023 16:21:21 -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 385NKkgt029633; Tue, 5 Sep 2023 23:21:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=I/csYn6D4FRCNBnPQU2CZhFm2OeS/wCs30Ju53Be9VE=; b=JNxDF5n/2Olqn10mnCCqZrRiAdlZO0KBZzFMPPrpQyK/SopicFXhI7IiQIul1fgQ2hSS h/WxnleIIIS0hs0Xedhs+WFQYNdI9bubZ88wMFuhggMOpFht3xvyyUSkTJii0vy034gZ jEmcEBpGjOuWUkmATcprfDJjqyoY37CEbfcCHwBLaKRlqlNIij+G6E7YAoey+uHL9FKR /qHbOrlzDXvHJOIrWtcJmRH3bfhQpLvMJjkeqmdW+IBk3cLdfmhS8ZnCcYOa055zQs4Q OvUgZf6Fa6ttDCmCQO3p5op29HJQfT/DV/em3aoE7slub55QBam9LIAnNSlUh2IhXCZJ 0A== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxdwu800q-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:21:12 +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 385M2ToY037100; Tue, 5 Sep 2023 23:15:55 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2104.outbound.protection.outlook.com [104.47.55.104]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3suugbpc5m-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:15:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RwG0aW0oRZCtPqvEsb21vq2ng2UMoIjYix83TxLNv5huFHJVX9QHDFAU+x1ZTd9O2fGztjkEmPomZxMEzrvMeOBHkrLzxQSaSggN78a99c0oBw9PWaDArmuZZ1q9O4X9PHfhohmMpkipUKlTe/5/DBOYrt1G2zv3my6voEO6gxmICMZ8BkyrZbUP6rLiYF8aTiCV4GINlaP0rOjLoVOoEqOAbUh6lTY5vKe5wqSn1xJAkW/6x3QIqVKeAlimKy8HwzBnlevF8qP0SyHf1pH6M6Zbk8UGPcOXE/ER0TMh4tyY+MCChRFy3Ndvl0NT4Lt3uf6FKrT2R5kWKI9yN/ojXw== 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=I/csYn6D4FRCNBnPQU2CZhFm2OeS/wCs30Ju53Be9VE=; b=eOMZBtEarVkw3HIAMqSey2hD/UGy16wP00SqtmdDNiKpJXvf/sfbX57BUh3MXfoXINz46hAsPEIeQ5iLylprx4GTt0xfECSBpiWJ0+3zGVaDmL3fgNDVR2oeO/rixgfaw/wfOvchKwPR2EKlz0XoYtbp4IEuLWyY4a0P7tRcbo4W6Qo/anYByDP/tjHa8cMjInnjTc83fYmB4PIdV+YuW9SCUtiRNdaG6O1JS0kXFELtwN2oVpVaFoJgiS8CHqhxMM68rNqifsfITv0WO10joVY/7X21G02iZjzxzLHItECnbZqI6B3jv1pGUjvM9WT4F1dL2TcCCY8Pudnb6+fRTA== 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=I/csYn6D4FRCNBnPQU2CZhFm2OeS/wCs30Ju53Be9VE=; b=RfpVASF7nHvEwt3a9EZ4ruAQBrBO+ZOdH0uxgxvn7wsBzyPphC1BFYdVNIbx8Xsbs/yMKAbeEeMI3yYV1xredcfuK78iES7kC29RdvfpzAb9+EmwfldL2hVC4RUsBxTdJukmzCQo3W/TwTcncLodqmAl5Uy+ZL44VC2N8Ec/plQ= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by BLAPR10MB4849.namprd10.prod.outlook.com (2603:10b6:208:321::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.34; Tue, 5 Sep 2023 23:15:52 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:15:52 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 02/34] scsi: Allow passthrough to override what errors to retry Date: Tue, 5 Sep 2023 18:15:15 -0500 Message-Id: <20230905231547.83945-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR13CA0057.namprd13.prod.outlook.com (2603:10b6:5:134::34) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|BLAPR10MB4849:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b84c9ce-9cb6-47f0-e7bd-08dbae660c99 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iFuTSXA2vvRkGf+eB8OgbLdTx6FBSQ9ljag2rye7pPbXnCh8FM4kzPcm6AMwndUXY5HhGZ7geJ6onxI3O8HPlwRkpVMlqVmqUzbG0noEQKiRkesaan9vF4WgN/7yDJJUxvuPdmwewPzebS+D5z5MvCOR4Z6ovZBEAHohFrhnCHghkz/gX/JaN4nr8ymbL24ga9dLsgxkbl6Uj3KPd7b9+pD2VEua/pFH5UIcG/zQJxCfvm7OGFtsGad9HJj5bc5q+S2X6JoMx8tjOudpU2k8B00OMm30o1kHaLp2jow8Kcizf2yHqWWxG9HKuf6ir5XNFk2zfbsXL09Jv1ETtisAXiWdbT76htCOzelXCS5EkO1V5Ad+wwVs9hGP3y5dw+EwiDcSyXUTn2iQ3c5D1TkakXJ9EcSyTe4PKCysYIBLgyTKXFBnidlOHwWMMQyxf2b1XmGyRNQXZp9l5rKZoq3eNpqAgfNpKjBrrsTY4+ROEQAD/XPwwyQMY45w6tFCWqhTW2DKeRL1Ec72EhgeNamD7G2UWxqCsZk22YwRG+ttk3iSL0f8qzxKmdnphbJhYfA8 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(346002)(376002)(396003)(366004)(136003)(39860400002)(451199024)(186009)(1800799009)(41300700001)(36756003)(8936002)(8676002)(4326008)(86362001)(38100700002)(66556008)(66946007)(66476007)(316002)(5660300002)(478600001)(2906002)(6666004)(6512007)(6506007)(6486002)(1076003)(2616005)(107886003)(26005)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KIfpUkbdSFurLL0W73wuCeRwjubeJrhR5BHIYH88YeHOlJcB5FAalug49BG+nGMvlsoWy59bOFE7L++57aagFvuIkcQ/yfxPl1rHXBBsbndEte2RBgr7JEIuzf3xaBLZc2Yb2rc5+pfCTN7PBWou8S4bwZm/od+QkUFqbzF2NfHJK2f88EtoHD+bmy2H42LeMKq11D5vHVqi97YwW6Mw0SOEyGhWNugiQaLktIKXZOtfOM6Op96H/WulTaZ6jGFCjp4NmIU5iDM3wWC6Bhk4k97uJtFyHdGtEWAuvQNi87KlUhIK6pNWwohQOEUTWyqLFMhwLYJm0E7udJFPM1Dk7M2+hbijcROBBjdyivOowHnymL4/eGNUKR3Iw62HiPnBFCoLd7cKoWnA8mGyS4eDQtpTCgNzaCw8WvKAUh1VqRA7r7GBxcH/SytCoTRzPb9DEZlccAX9sjbpeTrpQy9CHd4RiKG3lSr5/1SDJWKMXB6Zl3cmyTiS1dHBKGSFGY2FEFaPmWNZvQCB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hGiJ/rGVXyA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: bOJWz79pCsqkSNFdUW5jAy21EUU7wslGWkjupFzysQ+Ix0QgSHxIUiYMTDCtH3ssZYrXneUn3AP+f2BJHbfdFWqUhDKeKCdTBoRirjPsLaEWXPdfNBVSImK4BRg9w8FYrkQv+hNzNSu9gYy5PcH224pKILcCjpl1DGpD1ARVVl3+KwYLGU37H7AxfwC65OjVL8VHl9J/Iii//stcvHwSQOSYzaZSTi2iGRJ9v4HFIyD7/r1O6jiK7HeIavM4Tm+rsUYIzQmHaTeb+e10gyjaIffeUf4qmYkcmBDt421YfHLPwulemUMkCqSH5h2DjNjlZzSBzpBUeAMGB4tyAk+BfFig5LI2S61bVrPTdE+aq3plR+Rq2OpD4/MXj3o6bqj95lFexBfg+PQtoEqDgL1uBGJPInVlWAPb/alvhnzJZSC/mfzDw26KvMaG1nXvc+55NOY1Uzh6UH+dadEJN7J8vNpOXHReGLUb/XWfYI0oeIZnD4/3JvAjs1nXGZGpqpfVsQCGuljdrI5UUIkkw93J3EnQPs/Vs9pUdpil85pjJuxrFclHm2EVOdleokio3YBV/GqZr1dgaZP2vID7HbxOkH7yURhyt7BJlgTNXfVJa+2DMcbRdY2B8QyAtUhpBDHyrTqeEqHPDC6plfzirzLX49pfJenfyjx5tkYJstxtkPnGc8dGglDIQvWWt/vWjbgtWzWEIqtpnKflim2Hv0JyA14fc2PWEvd0tUMROYUX5yN7wFBZvofXpV4ojOI9AvETuDufJ34COys9bl8RiiAhRAHvDgIz5OUh2hOqu9tDirRqRRY6aMw//ZtfTfMRnCOajf3A9bTJiEn0PBgmktQW0ICR+qPu1ggrqcDEd9Tq/Kp4oZzlknK0Stqg9jPcY8hl X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b84c9ce-9cb6-47f0-e7bd-08dbae660c99 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:15:52.5698 (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: 0bsaZaZotsDwRbLk+3ZX1o8pTxJqm27rbeuejijAhZNi62kHCp65s9lUeyUxLJwikhbSpRUu6gcSYXXMhyQyal6lvWtB4rMUJOhNwOH+35M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4849 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-ORIG-GUID: woBeyQWOjYO7erw163UB8rUOX5GXc1ut X-Proofpoint-GUID: woBeyQWOjYO7erw163UB8rUOX5GXc1ut Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org For passthrough, we don't retry any error we get a check condition for. This results in a lot of callers driving their own retries for those types of errors and retrying all errors, and there has been a request to retry specific host byte errors. This adds the core code to allow passthrough users to specify what errors they want scsi-ml to retry for them. We can then convert users to drop their sense parsing and retry handling. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Martin Wilck --- drivers/scsi/scsi_error.c | 80 +++++++++++++++++++++++++++++++++++++++ drivers/scsi/scsi_lib.c | 10 +++++ include/scsi/scsi_cmnd.h | 35 +++++++++++++++++ 3 files changed, 125 insertions(+) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 7c3eccbdd39f..d2fb28212880 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -1872,6 +1872,80 @@ bool scsi_noretry_cmd(struct scsi_cmnd *scmd) return false; } +/** + * scsi_check_passthrough - Determine if passthrough scsi_cmnd needs a retry. + * @scmd: scsi_cmnd to check. + * + * Return value: + * SCSI_RETURN_NOT_HANDLED - if the caller should examine the command + * status because the passthrough user wanted the default error processing. + * SUCCESS, FAILED or NEEDS_RETRY - if this function has determined the + * command should be completed, go through the error handler due to + * missing sense or should be retried. + */ +static enum scsi_disposition scsi_check_passthrough(struct scsi_cmnd *scmd) +{ + struct scsi_failure *failure; + struct scsi_sense_hdr sshdr; + enum scsi_disposition ret; + enum sam_status status; + + if (!scmd->failures) + return SCSI_RETURN_NOT_HANDLED; + + for (failure = scmd->failures; failure->result; failure++) { + if (failure->result == SCMD_FAILURE_RESULT_ANY) + goto maybe_retry; + + if (host_byte(scmd->result) && + host_byte(scmd->result) == host_byte(failure->result)) + goto maybe_retry; + + status = status_byte(scmd->result); + if (!status) + continue; + + if (failure->result == SCMD_FAILURE_STAT_ANY && + !scsi_status_is_good(scmd->result)) + goto maybe_retry; + + if (status != status_byte(failure->result)) + continue; + + if (status_byte(failure->result) != SAM_STAT_CHECK_CONDITION || + failure->sense == SCMD_FAILURE_SENSE_ANY) + goto maybe_retry; + + ret = scsi_start_sense_processing(scmd, &sshdr); + if (ret == NEEDS_RETRY) + goto maybe_retry; + else if (ret != SUCCESS) + return ret; + + if (failure->sense != sshdr.sense_key) + continue; + + if (failure->asc == SCMD_FAILURE_ASC_ANY) + goto maybe_retry; + + if (failure->asc != sshdr.asc) + continue; + + if (failure->ascq == SCMD_FAILURE_ASCQ_ANY || + failure->ascq == sshdr.ascq) + goto maybe_retry; + } + + return SCSI_RETURN_NOT_HANDLED; + +maybe_retry: + if (failure->allowed == SCMD_FAILURE_NO_LIMIT || + ++failure->retries <= failure->allowed) + return NEEDS_RETRY; + + return SUCCESS; +} + /** * scsi_decide_disposition - Disposition a cmd on return from LLD. * @scmd: SCSI cmd to examine. @@ -1900,6 +1974,12 @@ enum scsi_disposition scsi_decide_disposition(struct scsi_cmnd *scmd) return SUCCESS; } + if (scmd->result && blk_rq_is_passthrough(scsi_cmd_to_rq(scmd))) { + rtn = scsi_check_passthrough(scmd); + if (rtn != SCSI_RETURN_NOT_HANDLED) + return rtn; + } + /* * first check the host byte, to see if there is anything in there * that would indicate what we need to do. diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index ca5eb058d5c7..7c3e18663c64 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -184,6 +184,15 @@ void scsi_queue_insert(struct scsi_cmnd *cmd, int reason) __scsi_queue_insert(cmd, reason, true); } +void scsi_reset_failures(struct scsi_failure *failures) +{ + struct scsi_failure *failure; + + for (failure = failures; failure->result; failure++) + failure->retries = 0; +} +EXPORT_SYMBOL_GPL(scsi_reset_failures); + /** * scsi_execute_cmd - insert request and wait for the result * @sdev: scsi_device @@ -1129,6 +1138,7 @@ static void scsi_initialize_rq(struct request *rq) init_rcu_head(&cmd->rcu); cmd->jiffies_at_alloc = jiffies; cmd->retries = 0; + cmd->failures = NULL; } struct request *scsi_alloc_request(struct request_queue *q, blk_opf_t opf, diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 526def14e7fb..0dc937511f2b 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -71,6 +71,38 @@ enum scsi_cmnd_submitter { SUBMITTED_BY_SCSI_RESET_IOCTL = 2, } __packed; +/* + * scsi_execute_cmd users can set scsi_failure.result to have + * scsi_check_passthrough fail/retry a command. scsi_failure.result can be a + * specific host byte or message code, or SCMD_FAILURE_RESULT_ANY can be used + * to match any host or message code. + */ +#define SCMD_FAILURE_RESULT_ANY 0x7fffffff +/* + * Set scsi_failure.result to SCMD_FAILURE_STAT_ANY to fail/retry any failure + * scsi_status_is_good returns false for. + */ +#define SCMD_FAILURE_STAT_ANY 0xff +/* + * The following can be set to the scsi_failure sense, asc and ascq fields to + * match on any sense, ASC, or ASCQ value. + */ +#define SCMD_FAILURE_SENSE_ANY 0xff +#define SCMD_FAILURE_ASC_ANY 0xff +#define SCMD_FAILURE_ASCQ_ANY 0xff +/* Always retry a matching failure. */ +#define SCMD_FAILURE_NO_LIMIT -1 + +struct scsi_failure { + int result; + u8 sense; + u8 asc; + u8 ascq; + + s8 allowed; + s8 retries; +}; + struct scsi_cmnd { struct scsi_device *device; struct list_head eh_entry; /* entry for the host eh_abort_list/eh_cmd_q */ @@ -91,6 +123,8 @@ struct scsi_cmnd { int retries; int allowed; + /* optional array of failures that passthrough users want retried */ + struct scsi_failure *failures; unsigned char prot_op; unsigned char prot_type; @@ -394,5 +428,6 @@ extern void scsi_build_sense(struct scsi_cmnd *scmd, int desc, struct request *scsi_alloc_request(struct request_queue *q, blk_opf_t opf, blk_mq_req_flags_t flags); +void scsi_reset_failures(struct scsi_failure *failures); #endif /* _SCSI_SCSI_CMND_H */ From patchwork Tue Sep 5 23:15:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 720326 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 B24F6CCF9E0 for ; Tue, 5 Sep 2023 23:21:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242202AbjIEXVa (ORCPT ); Tue, 5 Sep 2023 19:21:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241995AbjIEXVZ (ORCPT ); Tue, 5 Sep 2023 19:21:25 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 849D1D2 for ; Tue, 5 Sep 2023 16:21:21 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 385MtGbU023608; Tue, 5 Sep 2023 23:21:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=zRpp60yOn36Qig8mH9tbnGp+ZIWAhy2zVlEhlZSj7cI=; b=vKKtfQgkeBZNFiNNQ6lcfbLqXLUWKfXzhPKBeaC3d4cSAJTZ/PZ4cSMyMafPsZx6v+h3 DePQSizpGO11inJqmUral0/L/w2A2Am73s350y7KKeDT8EpsMuaaaB/rGT4t6SxNojT+ nGMO/Mzm9rE+0jfF/PIfSECwyicEr+0DmaB8iDBFlXF5Ux2a1NTjxTOcOGnLWVSUZUFV JupZjsjEB8ED/upjSS0IEomHGVVzIKgVqE/pJfyEAzXi1ed6b+wEkSSL4Fc6YnCGHd+l DjCS4SnUWAjO1ayHmnHntHD9hF6Ukk0f+naGHilSBB4hBqGYBxBzkopzE1Epqivb5MEI fQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxdhg81jy-9 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:21:14 +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 385M2ToZ037100; Tue, 5 Sep 2023 23:15:55 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2104.outbound.protection.outlook.com [104.47.55.104]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3suugbpc5m-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:15:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kLE5ozKWgmm/osGCMeffVl4h96CLtHKBenzLhp/oiLWRkF0xhWRlXh/VoZIGGwysHg3+f1yVZ0Mze4P8rfBdUbEnKqaM5hNNZoXlIaNtUypk8ghOA2uBPMUGCvaJlW1FBUYOFwoiVkTXQPLmQ8JNLiNolduOzz/wR3rJutuZB7pPGz36VFR+yFag5owaG0rp86MF3zps+IIlsMZ6jGMKfRyYL4mh/vjqAmv6e+Mzcb9jjiuPcO90MxxJ+uPGjQZutwkOrSiaq1g8YVHTUWkayr08z6qwd7xaVIXShDPHndsM0gsQMFg3ml+YGFnzt1XZftv1kwQ+aItt5zDJHwBCkg== 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=zRpp60yOn36Qig8mH9tbnGp+ZIWAhy2zVlEhlZSj7cI=; b=gw8xZ9HdARALnmicv7QdZ9H2lUDTrh0bIBJq7reB47ulMmhl7eisZfCHGiIVeE+jzQIQRqiarvhSfqombvo350QvvzLAIXOKzXhfayfV7+A3IwqO+hOWSWwmh0R1Fuxj3yMSG0XFtx4sAaLHATD+QJRUgaiXysOUOQ5NMHdADeNr6Z7vmk04N6RLVmNkbKknYLyCdl3BGjqLfUCqzTiQxL+galM7D1mo3M8vQoLWlW/cTD3pGNc9HZvSpfARkAvT0Wy8QB9pFtnDFJtWobDhOMaOkLT+CUML50/bi8Pg9ugKFwqWdkRE91cTTAwLCqzZfixZkvmp1R1J7s7AMtB8pw== 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=zRpp60yOn36Qig8mH9tbnGp+ZIWAhy2zVlEhlZSj7cI=; b=MMp/QCGr7NnHFUXzUyKfUB7cpu253ya3zJx3DEEwK/nZ1SA92/v/xakM0bcilaSX5bHskYjmDQwpSAe1QqFO0CQ7npNgrGhNLCXChlcv5FYCTR9Cnk6CbZ7fBfXzHeNgtln2BIoLI1RXLaunPJPy8lcYMzY+XDOY+b7zF/SR+80= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by BLAPR10MB4849.namprd10.prod.outlook.com (2603:10b6:208:321::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.34; Tue, 5 Sep 2023 23:15:54 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:15:54 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 03/34] scsi: Add scsi_failure field to scsi_exec_args Date: Tue, 5 Sep 2023 18:15:16 -0500 Message-Id: <20230905231547.83945-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0023.namprd03.prod.outlook.com (2603:10b6:5:3b8::28) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|BLAPR10MB4849:EE_ X-MS-Office365-Filtering-Correlation-Id: bccbbb0f-7acb-4c89-9564-08dbae660d83 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z8qclF+fn4PgqxuUfFDKceTP8OE2oppPE1Q7UHp7D42CIXfROdG3papsxAUBYlPcIJyCRO2YXX+PRpblwx4V4Sf5jRbr6xi3sCGzftzWWySWe5F45PmI+r48YcBSWGFKZja3nL7WvAmmT9801zq8zKlwrkJW4VxLNj35mAsfnDtV9TUEwAouP81EiDKohhLwa3tiGTSLTbRYDGgOYgJUHjlfhj0GtnMxuvHYkXrB7T4T72k8kMT/l7lk3pbwXAEYLzjJdBLaetZ3pxydyu3uyTcuiGDROSTgWr/mGrS7uYhVP0DS3/5If2RAoqN7ij7FafYyB+vFX1KVhh59NjVnfqTofdOTVzr+sFD/5orYlCHhq3TQHckahnin9hpM3Sy2OFzjcLc3dZ3iAyWi/AZp4ooqJZJnUdcJ0VwnoJMw+8bCCORGEoV03dTzmPbzFcaMuQJheM+JgP9oqH0+aSQBMq/Ja78l4DnKwSw2b6vu8aFhu+vcS/WGfrpYDVwBwXlpzT2XDOiyXsQJRidr8LaySD1qdeyyoS7lv9dCY2QWFfDsxrxAS/+VSCjk3PDQJPzY X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(346002)(376002)(396003)(366004)(136003)(39860400002)(451199024)(186009)(1800799009)(41300700001)(36756003)(8936002)(8676002)(4326008)(86362001)(38100700002)(66556008)(66946007)(66476007)(316002)(5660300002)(478600001)(2906002)(6666004)(6512007)(6506007)(6486002)(1076003)(2616005)(107886003)(26005)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BIKzJjAPQmI5rvsl5j8erv+kTZQWFJ9sssiCjXkmeFufDauibDk0EBFYO62I+bQPfHXGVpp2cyVxX2vrm2AWKi8JOThWplS0QVC2pTvUGCsU0zqykU1fVSbWLx3e2o4nUwAjJSsiLiguQbSo7lklWbgzJIbGdaaUAMPPCB796qHpDaPF12xkLPF/FwGiw01wLz0ToANA9XOLRZ5h93R58uOra5baQy2jSXxqOmcRQ0A8POMKJVniG4kf/9nKYut1VCMNtBbJcf6LQly75vLyrkNC9bLCurw+1IrQveAP1JX3WtGFEl6cegwy99hoMcLwOJCYxnptZvTbQnJlKp+OTx3Fs2o5bJN9Uw2eFGGstgLIdIrW2CYfCVuCrvWuQ9qr/3ZU3NVJBAB62iQqKkmvlEHw5l2a0UtNt3V/RTaFXYrlYQL0mQC5wqHmuGFaSThCeIKLhnrrk6rIuSiUjlqDa6Zg0lfthpxfe4m0zWE4w4DOmKIQySohcG6yJAylpQ50zpD/VKZzDMGZ6sLnWJcjLgtzHD+inVeRwRiiH/mkg2Esnkvp3oLz4eKbVigoFPALkcuABYYoJ4PtuOnoKVtU/ukMqj3xDu6Pr8WFDwLQgMmaZY5VN4HZ6wNwqRdIgHQkKNuyP18M6mehfD1zpS6kRwp0RmfT+9gIqM1XjRa4OYVZEo/4PnXhnjmg0J73xHO1wT8d7ZqnC/hrYisEaTe+A0cuwoWWgqa+UJl4zPpiy06ktytkKvUGv623SDV0ONMW1k9XN00vjMB+L2+2f60R5vEM0/fVZtzgTA7gWeFeAf62M2g3J+APCcjatNvGHZYVN015FAwIobgBhpQ7dRm2IRq0hcDXgYk2Y6KbGJsndb5gZi7gsv0rb5g55e1v4YxwDqe4Ua3KneAn1Kk1hz2df+OsUPAqupVgnGZ1bfO0zsx3QPrs85HqExd46J3LHuskUfADKsFqFCsKovMF8Wi7rg9Qf7JtBBhcpJRtdwav1iFqSO0gXF+11xnpgDrqicvuYq4HuR7hN6updq4sUs9mAN4HCy3835Fj3XHTB6U5mB0AGxn6YmxoOUAdZXPdQwwt1y/JW72zVZ0TySPE3LSI7+41T9KJMgrSlj19CBI+oRChcEoanbr0Zvhw5Raf9aIl8Shalhw206Csrk6ZzB6xh7OSXzm0ZFP78xj9pONnuM0WgzPQV/9qhzV+h21hX6Yvc+vg5sPoV6g5danp8O5K3FhjHpSKJVlgUghZZdds3nB+HpzIWR5mKGTO64JODGHiIazIBMDmUsdIcEpuKo6qarZxxNe72Rwlv2uQJwEST449dfrgNp268WVTwX4ipSXNgCyFNRuaNQaqia67YTZv9hI6zp/xswC+iZB2Ct1J9c1YnO5Q15dDFOIIRgfJdT59AWWhl0kBgNBpZkP+P4ihPVqX0urak8BRSpYdxk2MXa22ZkYrzPCMtIx2P/opyJvuddOzIUCyGKjSv9ED/9+mSQD1m61EtXpwsFTV0jq3omBlg0kulBEbDGb53JftZSoA/z2k0Csu8dKZOyJWTgD6JsRSQNNHvdvx/golnoCzc2JKAroile12iHoDv728GRG6LJhTp3Hh7PgcNSQmpjUZJg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: wXZbKtnTBR7AOXwqAUe7PYxAN4qfqPIFM2DD4yg3hVsUl3w984rB4bm7PnmxN+NSLMn2dcY88AyJDLDoPyYVTjF43azXa2zReuv3dqiUh8vpPXQWqAntMduNcd2+ZEcZdZfdrvsHfH/Fh4ygt7wc1hRi7im5J8vecfj1vakBDtx14gzh+j2k6Y9/HNbQknLZHlaaClNY9fnU0JrfTl+HsCN7y9p20iRSjTB3jwT/+2prnjnmVDANKhXC9qqqjJfn+lRkNZp6WuOTigTuG3o4HNunL8b+Y0y6d0Wx2thvAm4i1dpo8Nu579qeKqLEOF2fSAeAUvRkyS2WR86r9YcRWD6lJXIDMmUxJlS3F+0gZWWj7kP1ySCsoOU40XfMhvzcT7YWW3yWhVhgVY99hq2RFdDCX5V8MW/IUmpeCthjRr4Z1M+bjPg3XcSjBY97Hsq7/BZ3dFa+HP58QJFTZA2pwDL/F39DIv7Vs62Alspiem8xHqdRPPjIL1NQZv16XKewDHSHnLrYNRmdxzVE5wo7nxj4NwKyp0VlHHXy5tI4qqR5zU9Eq5A0EC5ABYR++H8QDn4aRl0p+BS5Va/46JcO4vy5Zja0V1aLN6VrQlFga3wB8VPmpANyufnRV9OQOBJHvHkeLBiKv1C9dqznWK5khrXtiug8IfYvmIq6Nmd4CsPW2YmpvpBlAQjOJP+eHx02NofcirI/I7gAoG0ZGuPTunJmoObIr/uaWOT16VVygfLAqIBfw8PhVRG1ewOU/4tXAWDzR8gqa/1TN3IB9zwFqsBNjN5xUaqBCfXACwXkKdtrU7Og0cLq/b1zMBVL5EHltdfpbotFbBuZDXtcWq+NVDO9xC7bLDd6+1NjE6eCUwr9wmlB31g5cwNdsYh7dNlX X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: bccbbb0f-7acb-4c89-9564-08dbae660d83 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:15:54.0432 (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: WdOY81nkRsRd8hRaEViaRcvVrVP4Z77LPPp6eJQbifDiJ0sBbnHGuNGzL8nzWH5sCqHxOH/LVzGIWpxNF59jvfzGFy3uWwCVDbXyA+ad22s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4849 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: iAtwqEJYapjz0ZGWcHosLeVLPyL2xGlx X-Proofpoint-ORIG-GUID: iAtwqEJYapjz0ZGWcHosLeVLPyL2xGlx 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 Reviewed-by: John Garry --- 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 7c3e18663c64..d9432bbb64fd 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 75b2235b99e2..accf6c80591b 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 Tue Sep 5 23:15: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: 720322 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 828C2CCF9E2 for ; Tue, 5 Sep 2023 23:25:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234568AbjIEXZL (ORCPT ); Tue, 5 Sep 2023 19:25:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232289AbjIEXZL (ORCPT ); Tue, 5 Sep 2023 19:25:11 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C81B79D for ; Tue, 5 Sep 2023 16:25:07 -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 385MtoWq029259; Tue, 5 Sep 2023 23:24:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=CdfSgUxES5P1/GDzqlLq7p9aFKGHApjxNDVY3BFU4Gk=; b=GZoBrn19ZHXlNXNa3GC4KJqLKZVZSHYzmGeUOCh/INFMzPVenzHvESB3JZlOvzBUUO3w GLeb52UY0HfITxSnm4/1BlxU301HB92+vOldX7w6eqxgG6gc0Jei5lEaDS6kzX2dVNY/ dqIa7WtSSr38i73i3Hmg45LSXDKSkJxVG/FSiZS0ry0aP7vpSws4Jrnwpv1NqGG9M4UI Pg/fzxdPPlcfMjWnX5zUoIM8i42Lol55nu1pnDZdtM63ZOIPaewyl4tZu+cZ6CWF+OjP Eua5l0v4Renfdgf2aPYGB6Yh9zkexZLSQg0Oun0zBk1u43IofCumeGWM6dxydf4wAkM+ Vg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxdj50183-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:24:01 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 385MQhTM029162; Tue, 5 Sep 2023 23:15:58 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2103.outbound.protection.outlook.com [104.47.55.103]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5dx8t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:15:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cl1+kIWKgPfaGmLoTyqysFsL0+BsrR/NvDyLiNmOGctkZIos0kJ50nQG6PQzg6QufECCiuSEEbgmX+UJsG31t0poKfC+5QByxjHIdI7OJBZ7Sa7a3IJSiVX4zziAlgmAv4dfyMfls1yeboL5jZhdrgXffY/qJ03xA+9HrzrbiE07kCpS3InIBuzWVaoU0ps6CTP4sYZbr3Sm7GCcf0VMnOqrxHc8+TKHVbQ83JeEvDIHtNxQs+ViLEmwT+OC/lZ5qIMhqZRVB2XJZBzfXc9QRZA/eIAMZtv7Y3ywOZu9E/DdltyLZmWYqLwv6iXXM4ZbYh59wNsakHw9jyuA7ypI3g== 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=CdfSgUxES5P1/GDzqlLq7p9aFKGHApjxNDVY3BFU4Gk=; b=Rgh4gnJ/isXclymHyFiE4HIz2YkyuN5ahzXcJ3DDHD6sVKws8Yl9Vg2hf//6GGlsE6jRnDVzaXzIqp6JiCcipnbe5YtXcDXeHU3gGvaldZ178kQsHkOyCzSfVqa6EuHSKAvXRwtya8B6ID+/sXUZdsjfqEJ2+TijwQKpQyBpu50D+PYQo9B/3ap9lSud9mmWBAL1OTBUA0QxEcZ3/ZJ3YQy8fj0OKHzUs2zT6GyTN3pmEavMWEN7k95WmZNHudQ6u4lXCRRGUSJBxgL8AK/hR5M1AngYWJ/6w/SwkEJXo6QwwivQUjj2xeoec8L1pfnLErcaQaNB+Vaw7Rm+RpUcbg== 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=CdfSgUxES5P1/GDzqlLq7p9aFKGHApjxNDVY3BFU4Gk=; b=VEK8GtfdXrs1D/rTKxCLtEcn8pYUaTNc9I/SxvfOIw1VUNmATPy2KXfuWBgDPtMR19pYe42OpY+b7rv5RnK7C1OX6QNoU9uUZbhXZf6bu5PmW+UhONn1NV546JgTgA4dISTseQjfWsWp9S1w+CkUQEL8HnfcJ+x5tRdT7bXO6bo= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by BLAPR10MB4849.namprd10.prod.outlook.com (2603:10b6:208:321::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.34; Tue, 5 Sep 2023 23:15:56 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:15:56 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 04/34] scsi: Have scsi-ml retry scsi_probe_lun errors Date: Tue, 5 Sep 2023 18:15:17 -0500 Message-Id: <20230905231547.83945-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0150.namprd03.prod.outlook.com (2603:10b6:5:3b4::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_|BLAPR10MB4849:EE_ X-MS-Office365-Filtering-Correlation-Id: d0cd792a-349e-4077-083b-08dbae660e53 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LSw7nfOvyB+noZu63IwoadHoWEbuXg9hj+y0Cqigl9/cNnBbM7wSdiKkhHfDHzKZ107ADBsOyyNsk1CycDfSrqC2k1Qekv0J51mx/q/ttEhdY2zeZacdr5LhDlu0yPqwZ+0QFx4SZ642N4hXGOyur04uBp90ysxtTKYi0e/MTk1S7+8X53L6PkdzPfGQaCB6Vt9lkBeLZnvJGOYQfd5iE0HH0wzLcqUzd1eA/qsbMns02Vh3lm0UUt0QIWatLbCYhMbiQNmFwMK8Slbh40Dq04VlJWqnDEaeHvC6JjpBbqOCg98lDhcUB4VXZC9iiUdr/lGilG4TFRlFsHDVFMrjs+cZE/xj6SA4X04wdEDLCdOsn65Fdiq2hdud3IvQKqOO9Pcml+A/niD610k71FrddMfib1bB5KAHPfj0gbLmft2TSWIjWpSdKcP1MRcR65dP1Zl2GiChZotY/tv0RydapI0d1AVjbl4FbLUQ/oblyKmOlej86hai0JscaEINts2wpnThGpO+q4hYSaz0qU9RmuNIoeQhAxSmnzGdbtjOgNfyXRnL90Bj+K4dABoxKMd5 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(346002)(376002)(396003)(366004)(136003)(39860400002)(451199024)(186009)(1800799009)(41300700001)(36756003)(8936002)(8676002)(4326008)(86362001)(38100700002)(66556008)(66946007)(66476007)(316002)(5660300002)(478600001)(2906002)(6666004)(6512007)(6506007)(6486002)(1076003)(2616005)(107886003)(26005)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DxC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geInyeMi5ZURBcnVVh9XX30goKot2ohnvcAbt/grHtukWoILgsgtlgQCY0/6vioVY25sTqEv7g+TY72V3rFDB/Y2qd1/LSXF5gCX6i+TaDH+MCb31sZicmV4JAXFsjgwtbtFSc9kxjXGaHQsCgYHjWsw+fWmpiKIFnJf9MH1dDGvSlGNsf26fvUphjvZoSZy0/3Wf3fedSRC5kdxKQj7j9fLUmYR3MlRQct7422Rqw6gesT2ThP33LrET28AKL9Oq8s3vI+UlSamARZ4rsE81rjpekqPG7SndPHVDWilJf/X1FwOA7kq0FGVYOuerQJXhCpc9sIipFNq5w0ASfF3xUCF9/y/MzmgF64l67PYo3KQAYcHg5eCFE5Ypd9PS/Xk4qzO6bTSkkYfWR0+aYkdIuzaPj2HzHPeOvNhNQLqXM71 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0cd792a-349e-4077-083b-08dbae660e53 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:15:55.4968 (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: bKfVYn7KsWQkMCRlVD8xFnyyAPE/Kn2Mc1fCnXM+thlwhpjEXkFTCJYdRjDNiILy8tbXcZ02B2oYW1ZeRND358kBc+g+tcqOF7QdEG1Q1rM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4849 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: p1eTJxsBn-nsCCdSEvfrw3Dld3dzSkxs X-Proofpoint-ORIG-GUID: p1eTJxsBn-nsCCdSEvfrw3Dld3dzSkxs Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has scsi_probe_lun ask scsi-ml to retry UAs instead of driving them itself. There is one behavior change with this patch. We used to get a total of 3 retries for both UAs we were checking for. We now get 3 retries for each. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: John Garry Reviewed-by: Bart Van Assche Reviewed-by: Martin Wilck --- drivers/scsi/scsi_scan.c | 42 +++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 52014b2d39e1..0accd2f0f295 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -647,10 +647,29 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, int first_inquiry_len, try_inquiry_len, next_inquiry_len; int response_len = 0; int pass, count, result, resid; - struct scsi_sense_hdr sshdr; + /* + * not-ready to ready transition [asc/ascq=0x28/0x0] or power-on, + * reset [asc/ascq=0x29/0x0], continue. INQUIRY should not yield + * UNIT_ATTENTION but many buggy devices do so anyway. + */ + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = 0x28, + .allowed = 3, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = UNIT_ATTENTION, + .asc = 0x29, + .allowed = 3, + .result = SAM_STAT_CHECK_CONDITION, + }, + {} + }; const struct scsi_exec_args exec_args = { - .sshdr = &sshdr, .resid = &resid, + .failures = failures, }; *bflags = 0; @@ -668,6 +687,8 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, pass, try_inquiry_len)); /* Each pass gets up to three chances to ignore Unit Attention */ + scsi_reset_failures(failures); + for (count = 0; count < 3; ++count) { memset(scsi_cmd, 0, 6); scsi_cmd[0] = INQUIRY; @@ -684,22 +705,7 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, "scsi scan: INQUIRY %s with code 0x%x\n", result ? "failed" : "successful", result)); - if (result > 0) { - /* - * not-ready to ready transition [asc/ascq=0x28/0x0] - * or power-on, reset [asc/ascq=0x29/0x0], continue. - * INQUIRY should not yield UNIT_ATTENTION - * but many buggy devices do so anyway. - */ - if (scsi_status_is_check_condition(result) && - scsi_sense_valid(&sshdr)) { - if ((sshdr.sense_key == UNIT_ATTENTION) && - ((sshdr.asc == 0x28) || - (sshdr.asc == 0x29)) && - (sshdr.ascq == 0)) - continue; - } - } else if (result == 0) { + if (result == 0) { /* * if nothing was transferred, we try * again. It's a workaround for some USB From patchwork Tue Sep 5 23:15:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 721422 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 3E903CCF9E2 for ; Tue, 5 Sep 2023 23:22:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235535AbjIEXWR (ORCPT ); Tue, 5 Sep 2023 19:22:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241424AbjIEXWQ (ORCPT ); Tue, 5 Sep 2023 19:22:16 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B7A69E for ; Tue, 5 Sep 2023 16:22:12 -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 385NLEmW030783; Tue, 5 Sep 2023 23:22:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=oxAQ3FNjkqjMOl2csKjPoDHXUWG5w43B2A78nnG3u6o=; b=FiuOBQHgGCZD15IX6gIqoQK6XCMJyDf0hetPn6vdGFBmevxtDMgoAJXxcwGMZEaev0dc D+7LwoZIT6b8ksaDREIygkJYb8t87CdRZqwjLZtzce0jCsx7gEYQIZ2aX17qj6q63qL4 kXnH1kMuRiWaFSm+TV1mX8k2CUKdgeFM6Lf+qzh60sgB7xtgZFkSOu6KwGLxqLiY73Yd n3QB7fx6ccmKyXxQvoI6OobqzxnXJlJv2FgpYsUECgkGMuvX1P5odTDuuQmq+X+6eXkN uTYIkDpXTVGoDNVTJNcM8+LDCTQSrVHj/tYJJRXx3rkKBUmXgBKnOWyB/kAbgEOIU4YK Kw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxdwu801w-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:22:04 +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 385M5Hmv006596; Tue, 5 Sep 2023 23:16:00 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2106.outbound.protection.outlook.com [104.47.55.106]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5wywa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IjFq9DEA7kbWl7uATW0S6StnnkRZNspWBwZ/chddKHjQ/WAIhCHQBycErngzwvgFJ7rcT2spd951t15S0b6bvLfM47G9f90MGuKMkz2Twb4GPzzUBvl7v18/4COUqxnFQ+rSnOozWjoIYKbvuYrNM3q5GrlSwRVc8MUmVVFYvhXhbcyoAJfo+rQ+X0EEj8yb1P3f3qtLANM/bTKSLZ7oMyMCqRiC4M/SvLb9UH4+iDSS6rNh+kycYS3cLBi9b3e2DeH8l37xiPUSFy+42eyn6isvwQMKQz3WtAZn/VlWvxb5xdqjP9t5aX/N1laZv7Bo2Frml7pp7is/MQ9zrJhwVw== 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=oxAQ3FNjkqjMOl2csKjPoDHXUWG5w43B2A78nnG3u6o=; b=G5lc0Ufm0QjluRTwKSphb1XYzR0G92UnM2lFOdlePVPYroSQLLRNgfmrloyTYO0QH3WrUnpy6xGKZdpwB+CjiOXACV8D3Mwr75/IIfyALLMCXU7TyGprNp8o6cvtoqD5JvC+1ICSqS2vftpUas3yWRGea818zpIyQ3o+jOUM4+J5otNLHhXNpetFVC1nTF6bP/QlI3oLeOFCqkensFNpJ5t/Gb0CtY0DdWe+57t4vLI02AAIAahfAF6kSbVts3XBy3Ow6QpyBL9VIPEYcYQ4UjmeUf6niQFRfrrLLBMAkMuCmhSjmneZ2tpseXgZpo7q3z+rfEFGfZ1J+DwFPsZrUQ== 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=oxAQ3FNjkqjMOl2csKjPoDHXUWG5w43B2A78nnG3u6o=; b=b1pkgN9Dj0YDYINTGv6VXYtFB/XuIbAp1dq322OU5NsYOerkmWFIU5i7fFyDokSt8xpv+nvH8wwlLol+BEFutzMX2zP3s7Um3FHEJg0lMPVx5UqlDHmVqvoungRZ1C/rVmGYaXO43QIKqWfC9ZSryrvZVso1xbQfI+Pz2NltHfA= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by BLAPR10MB4849.namprd10.prod.outlook.com (2603:10b6:208:321::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.34; Tue, 5 Sep 2023 23:15:57 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:15:57 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 05/34] scsi: retry INQUIRY after timeout Date: Tue, 5 Sep 2023 18:15:18 -0500 Message-Id: <20230905231547.83945-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR03CA0086.namprd03.prod.outlook.com (2603:10b6:5:333::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_|BLAPR10MB4849:EE_ X-MS-Office365-Filtering-Correlation-Id: 51d9070a-f980-43af-8df4-08dbae660f54 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WrnJbPDa1bRnk6IDhOO/gdx64N+H9CYTXqXnnG6K3MnYs6tCQWaZhEQQlpFqvfavzozebBOd3zh3vVui7W0bYOoZ6sgz7/2KJ7IMajduFEUbUAP9mUhkXfY9M+UHxSXp1ddR36IfqV8gPXloqVPS3BoqB1+nKD8klwCx90s8wYKFkO3VTbPtkg2H3OCbaPW12RWEPm/fh1Iiei5q2XfFHlXj6hcR8+WdE0LKIAPzyEYgqTXeU8+hUsGOmZeDaKhFGPurx3oiNg4Srpl6dip5tBbP/c1C09jjCw/g6zK5OhS0gQf6u2tukceaM19OQGyLsQml/ZBuElrps3A+agCHQAHSDVGkjaLJ2O+UOfAIFnGPDF/Aez0kYTbX3vAsUMazdpNKyBTijuRpqCgtJoA3yXEbVx6ejHfl4Ps6vIcVxapx5REuCYgpD3T4PEEAqjKiA8N9FMSHIPXr1j/CJoVL3wBl/zzXkCZ268ifeOxwjKuabPJujJnZmmFvSehpb3wDPVYGiwABiyTPjmeObXrY4o3emJti5JFJJnLcajCcUJ5Fo+FgBAMf4WKSuGbgGtps X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(346002)(376002)(396003)(366004)(136003)(39860400002)(451199024)(186009)(1800799009)(41300700001)(36756003)(8936002)(8676002)(4326008)(86362001)(38100700002)(66556008)(66946007)(66476007)(316002)(5660300002)(4744005)(478600001)(2906002)(6666004)(6512007)(6506007)(6486002)(1076003)(2616005)(107886003)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xrrMIGQOSA5QmnHlHHfs6EGVvnwW+okcOFLFNMi/iCbaXDHROalMYZoP2j2sbdOFg3BRgDkiflKNEnyaAIvRXALki025F3yFTSrBt3GpnGqaabOTfjRzt+Y+FfcgGyOMGy4Bxl8wvfS4F07wkgtOFt4L7s1W0Q0kWrEkOZ5XCvmzicaEktto05VmHiffTw/da5tqgKCjLh958Ob8h98hK4GUBbvkwdJyy5RIjxTyw5UuogiPfQVlbAKaH4AYxprWcAX9jV42uzb0hjTylh4NqIl2VVMYMuOTBpfVLRPvBMBLhSpalitu9XPC516iIiqfoMsph74YkuG755etSjA8XdLQL3KnFfuT5Ee0AkmrELvyEapqKivg2MWNFqJvE5A1ywAS7mzCW1zsU/xNgxamfm6O9aXlUmyxjG1sD2Kjdgtz5OwbW7GC4inqSpg1deLy7Ib9lxtorxYa1wosImBFKn7ecuuXOV1ojpbxQgVVYbK1+WpmOkKKTLelAvDnTCn+jgzUP7cZtmPY/0XWzpAwR/67IjNXKbLBTb8rYi19kgCZu1IGx291ARaxv4zY26voDg+3ykdY0FUbtP5DhabQIHg4UdTRrONUzEhe3ZJ7vf+Inq1bhvF2+Z63dgUtCzeoKNdGnrfbOvp95ol3nGfcEPIptzHzw6KkSIdd4rIi4TkE0wcb0djlXpXxa5l56EU01KK4bLsYMe8b2MIc/PKSwrbWnPEYWEhdGWHKT+DtGpdKjKCjwN+rmUdkKd+gdXZZKI6M4bSIanpRNrQYxlOy9TTrEn7kNKhHwFHoSUAgtpVygHZmyHhSBa1IC4aZCO1CGsJLRdo5BDVxMaPlwUr/2MmA1zu4WYAS+gpHJ/HcM/jqhjkijUTFUmxaLjzG69po3TovtFrN5uYjqCl5sgM9XGtGVLLCrftzsC0c55Ere0a8DkMbHu3+0q+8njBslZaVm8Z7VrWBy2NQ6eYBkeK4QFEa+fpLZNAPPXhemumCwviClhpuIJcliml9o9D4/n7KB3oHiNhyXiyqIbUTwsd6BLMHVf10+L4FUTJn0h19yfvinCHv3wMcEI9zhkO0c1LluqTnKlPDnGKMGxi0HUxz4x/FEFXTKA12pt2N6uiFfbyVHLj/oU4T4Ptxn+KlsPzjhloidpAilG0nA8UN4dbnkNxaA2oIJi2BWdi5th+b5T+Rcxi2rsbQTDptfS+uQmttjybAwaTpezilyw/ZtOBrWjTZSQZGKF1ta0y4xzJx4JRKp5cJX6gQa8//tuexFmVFO/ailh+k1PJSmnwdsoh09+pNS6Y/yBdXsBctckFJdCcJEDCWgVQxTj015Kh+5gNtntNmxsE7fozqCJxXI+hh2iHoq9vLgMBKaeokujqfi4pAjhmxhs/7eXtBD9hHVkyjnMMCpbBMC3S2owX9Cv1YBnodYxAdh21axy+Jn5eGQ/2psUSmLLA7kCtqMWTQKVgVJprMH2CvUmGxFr3Ykba0zJcMYnv9utzGxESSGOV1BA22hbGLg+LGbh9tY4vmeABh/XqYh919Gkke4LNSEEEtg6aG/Tb5DK7NGvpS8HV+G5r0mPbpkNpGDiuZkYj9ViyscSiJ6fmsQOwxeOncduYXAg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: qetTBuUSD311zY/Q9OtG1D79VT58cY78bR7paYRoXjYYTnfNWuHQklyVjL5ntLC5I7o1m4og7T21tPuCTn1OjAB1FTkV8FxMuteDULj0TTtr7XHjIoP8Dqg5p5vSKBzYR6RY8V7pC0qSm+z4FbKa1nrRame5xp144SrgB0GO9C5EqCTQN4+WtUL3fdxzXSKKMpcwPY9qJDtddbqy9bIQQJp89svbWqFcVnmO9jWJphC7acmyv6FEAV4EJPqNf7yJQNmUhQvZLW6dluzBJwVIKF+vC8AQeeDVFsIEnFqEsms7IIozHzRU82EITNPJ7cwetuHr2VbOcskgHYfFUXkZlrae12B6Jbn02tClZEaJVIzlZeD5lDxzfzXvekBbu6CHNd2JRWZ/M8lenRYr/lQaCEIPfyFyU55pPuugWM8HLsWbpVvXOlosidtHPZMOCrFNHKlWsQ6kcBKxoAKn1aFLZAtL/k/VDGD4STTklc+RZhjRGR0EkEcKwo5npPpll6YU4i6uVOa6ShUlQlsZvhXnS2TZeqcZH3WFMUta+9TtLDmLESa0EbyPR4uj97v+6IRwyW278O+SA0AI3xPe/VWfOCy5FKPgh9zjVCX9ivDqkkIC8scvbpSaSq+DfxMl4hGakHH3AFCYi1gfQ2aRmX/QsXz5HhQQYDB4lyYjN2cTMB6Fnq+enGzf3dXbmiyUKXQQF4YC2pVQ0TOqlUODI85qgTDmao/+ayoDWjf7O1ZaxfsaONmMaJbiQtL9qYgkocCaOKfB3c2lercLaf66ZUwqePtXFUbqNajUH4fB/A+zAk1k6RrjyiJDDvxtzpUGvard1Ub/Y58Rbn21MLnOCOlI77fTVClLdVORWIe9sk1IEhyjemLRKPYfOoyyNYH+gtRi X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 51d9070a-f980-43af-8df4-08dbae660f54 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:15:57.1694 (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: L1GIdxS9CR3RcZu2RY0iCakRoolKi3OjOweLj2LrFM1mYQRNwFBcg0RA/8EbitoERmwq9uQO5JzuVx3IQNFuBWH6aNpvABRlihCIBYvY7Hc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4849 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 bulkscore=0 adultscore=0 suspectscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-ORIG-GUID: NurYix2dwdLn_V1H1WEbCju6oHkzD4mx X-Proofpoint-GUID: NurYix2dwdLn_V1H1WEbCju6oHkzD4mx Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Description from: Martin Wilck : The SCSI mid layer doesn't retry commands after DID_TIME_OUT (see scsi_noretry_cmd()). Packet loss in the fabric can cause spurious timeouts during SCSI device probing, causing device probing to fail. This has been observed in FCoE uplink failover tests, for example. This patch fixes the issue by retrying the INQUIRY. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Martin Wilck --- drivers/scsi/scsi_scan.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 0accd2f0f295..c27b64a1b239 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 Tue Sep 5 23:15: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: 721434 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 47336CCF9E2 for ; Tue, 5 Sep 2023 23:16:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240114AbjIEXQU (ORCPT ); Tue, 5 Sep 2023 19:16:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238111AbjIEXQS (ORCPT ); Tue, 5 Sep 2023 19:16:18 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78899CEC for ; Tue, 5 Sep 2023 16:16:12 -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 385KnmCn009395; Tue, 5 Sep 2023 23:16:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=d8wdGjs7rwZx7ffAWeXlfWGG4DEo+UtPBzEVKZKWq/c=; b=k3tpnYeS0Qn/F5G5Dgpm6/4Vwj0Sg2Cmpze+wP1FLhNUvIrrhEi24NvqdMWYYViTn5Qa MLIxrobgux1GP74i1TELRSIDhufx0inBZz2Ypfo13XZl7jQeaaRQGtunGCDmZXbA99fo TzA15RG/CmPlP+ad5sen48qigoABCTbB1gJqxMtXgTuQnFSpbrfZbFYwDkG9YB85D636 OAyaL4+qw5n9yHNiC3SFcGsjsvqsOJV4htYXXMZe4LOMd1sw2RYbxL1ofeU4j3z3SUd5 3TtuaTUeN4H1lQeKqHXIPj/abHwDJb1Adnh1IaViHco/7ooXnokcBNJ7bKUJf/NIXxDm AQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxbq388x4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:04 +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 385LV2Ud007675; Tue, 5 Sep 2023 23:16:02 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2177.outbound.protection.outlook.com [104.47.56.177]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5exba-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NWpw8E7pMK83MtgPd2C7Fa3WFYgQw4/vZM33HTG8jJhn7xT2Zi6MmrbjJFGnlby7LwF5LwIiWcwXiT6IOd0UUZOauY8jx5sW4t6PULg4d9cUpvu9N5ZXysUtqVo+WLVe5BPP4YGE4Ltg5jCf7dTOxhYCW++/GDiDFraqU8o58XSSrGnyA/gaSSFHZRVWvwDRaxSmnwmkITRFaeINvzGdPH43c9c56ouLrsKe/n8Mmx8XYT3oRb4nMqnsgcSr3yC5jZ4QWxSlrMXaXRajN2P4Zgg1DpK71Got5xPXNmTXQ90bYABYzaPmRwDdNR2Ce72K4X+mDj3nzCYDGxlyX3lhbg== 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=d8wdGjs7rwZx7ffAWeXlfWGG4DEo+UtPBzEVKZKWq/c=; b=AGVfrnKHhjdS7lmRCSVicQNxZSZT+MIXYDAYhTJDXY4yUJ41qfSj0G9HVlONrFjmvmk0ugwY60G6ymwZnrvXZOVuBkhWeaPYRWynRcf3zj9jo6rKqmI18PicO3KmJKit7sbBuPnY2QEANWtLFnPduwsAqR+YpLIQa747mnGAOrfAMfnW9LZqwhzKjAPDxxNw+ctm/45JeAt8omDFlc80qt9hNs1/jI0h6vYRUty9K2klgeH93z38O9iLkkQedHuOyq3M7QnkWvLDwFexc6tIdGs/c4mNu7fE3RO1W3ULJ8zbbBb7jA6iHpSURfA2WyKgH48JQJCz8D90S0Gvzg2a/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=d8wdGjs7rwZx7ffAWeXlfWGG4DEo+UtPBzEVKZKWq/c=; b=r/K0LgZ03MPW5Mb90lJEDOHEcNrYYameY9PH54OEmllOkElf84+oItwrTUrp0ID5MDp5eld2MvLL0lzdHihE9gpZM5n7xysmpyPqikMErcSrCGNV2MrLvBYMV+78/DrNXcBM9diZ2HPopCFQsvnS3cnX4Ij9DN3XgdVhfIlOWDY= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM4PR10MB6109.namprd10.prod.outlook.com (2603:10b6:8:b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:15:58 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:15:58 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 06/34] scsi: sd: Fix sshdr use in read_capacity_16 Date: Tue, 5 Sep 2023 18:15:19 -0500 Message-Id: <20230905231547.83945-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR08CA0006.namprd08.prod.outlook.com (2603:10b6:5:80::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_|DM4PR10MB6109:EE_ X-MS-Office365-Filtering-Correlation-Id: 9de03eb7-5d9d-4ef6-8a87-08dbae66102d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: u+qE2PAf0XcjPHH4PIbew/uuPLgi42umEx9yga41kKtcYAxHesACuFV86cSNcQrVYwDC39sfTHnmUIn2eS2qQEwcatOWbm7KTPVLQfA+G59yIosybf0T/b8UU50edrrmaVHIrwYrQWgAQ/WGK4adzq9VnPYR2GI7iMgmzDGqq22ovR4bBXv3UL60BrcunyW8BJKAAbNu3r4DCr7hI8A+iAwXz5jsH/zTH9f3E8GkiMt8BW/5zXgnKLdEfOLXfA276T7AxiwCVzkJm65zJuLEn79nU6+icU3ZT1W0EoeY6bMIrgTWaWNYgUTZRH+5Mp/ppnvWWaVAYvFo8L56ACDLnG+yVlRWZMtinTBVFBP9LpH9WI5XsHE9sYvWMB/hrsJk/dt46+dQSRPtj+jyEsW37h11NdBYqcBbLhfptmIxFwkW5T+KojUnFAR79m0/eIyuDXZp6oZrr3bNAjlxJJ6wCaUuXcvyILzT0NN9lwLQOMB9KF9GaMavvG2hYhaZVcSM5+VOfdcIt7qJMMT/xK5dqyAYWS7kcUTkAK0NBhL8Tng= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(376002)(136003)(346002)(186009)(451199024)(1800799009)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(316002)(66476007)(107886003)(66946007)(66556008)(8936002)(4326008)(8676002)(1076003)(2616005)(478600001)(6666004)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ltpBsoQKcakueueokEdftnsW+n3SBjOwlT3q2DFg3GF07IY4iwV4VM+HpAisc7uHV/EB4/WxttC3HEDz6S9r9kgH+0nAXYkBpHldSAYFg0TGaW7l9nshVPs5o2k0bAXQK3NBhZrqe+K4AF42YHHWCJm4XayOKWNsyxq2d5AI8wFmm41F0a1nDVFJV4ud/PO0mokkYdiEJqGB0eSenw0ldSNHygtPc33HVjuKF4689QnJUhZzE9ZNFFcqi8YZzCWrdSFRBZiUmWtAUUyafhrpnTStEwF0xNMNtvvOJ5kfXavUJ3thEaKqKYnASs4E+CusNIfYhzmMsDuf9/HtpHmq4Mx4n34oVmvk4Dn/CTL6Ub7H73SC3mqFZ44fKAqcGP5KSoHWvW547+y6E3vNVuoeHQa2CyR/sNB0ix1z4nOtweSLahVUawFbmzNRa4dYyYPWq5AJvEpS+w53jFXHRjvo4l4WIjTgAoIy+FsWliMkNAbRBmMpNZHoN3fMRFOcy/VcvIgMSItjTw6alJKD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WJ7og== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: csDK8C9XXeiknHzqcMHgx1y0l0WgIFdwNLJwg+pjudwsMTxBn1qTCGqjW1GhnxcapOzyMFMyNyQxT8742RfgsayK7utoDKRgRNJwviWpzdkZ4zswiqPORq2rD7Cxiu+2b75OEzQf4qHtHQrMDzK0N4B6aXlNM9pYBhtW6an/WYplQppwH4k7ZTStIkZe2r4HzviW9r+EuTz8kHoCgaLn8T28DLIOU+kmypyr6/EXfc9xDcVc3lAQDbNK93/NmcHUsgD80bJO3ylytpsIhmkFcT+Q8Twc5kok3/YKxtnuPRAcKnqd4eAx59OnQb/Q4R/BQOIROgg3Dyq/exGw6RYFvuj8v7OLRM6BWDq6zrrxAfTdt6XybfBzEDzyWuKIRKaR7vqJ4+GFPCUUWv4NugVwHmuSyrV8lCtZQyWCh4S/F8aQoQmNt3yXu+4WJhdaTocR6D0B6sWjBhindE3PaROelYGh+yLGtNrEYBGofBKiNFnCaZC5WqbPGdTIEswKa94fBp61jRVHqngxr2q0y++BdwAtbFvJ0ppNw6QVCe4PR5EoW1nuHO++VhaSBZx77sKXY6ZI3czgB33GpAK7MEc9ocL8dnxusNJ10JXhaxe35H/nbHmhjUcX6xct0cH4OAMf4gNJfKH90eu4nHRZ7NbEXAVwFhnOOODuNr6GiR0Rm1jIGvd/uAlskE/wgn1wR1bkpLYM9p8s+tgw9gAb15MyNjA+pGJM6166fRdwpGtfjFWmg4h2WphAbvFNnb4DA4lRKZA2fMxot7Sc1OHasG9YWxxotEGG3A1qeMfa0Z7/lcaAjoaiTsyDlFJ6y6mFIuewT4FVH1fnPGalkjZhTJae36y0yP311q6biufxOoa3c2ESb+8M1m+Wg/viL04Rffz+ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9de03eb7-5d9d-4ef6-8a87-08dbae66102d X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:15:58.5329 (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: EHL0aeRmZx/NQTda1BTidq40ic2FH6gr7CnfhNzLm4O1Sn0iIEUFoBIhqZK4wrgqI25Az3Asg47TVx5Keo56DE/P7lzfjRVnZyHSfmCYBxk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6109 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: Gou6zn6GmYkzjVE1qPOPxx6deaKDAzWG X-Proofpoint-ORIG-GUID: Gou6zn6GmYkzjVE1qPOPxx6deaKDAzWG Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0, it doesn't initialize the sshdr, so we shouldn't access the sshdr. If it returns 0, then the cmd executed successfully, so there is no need to check the sshdr. This has us access the sshdr when we get a return value > 0. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: John Garry Reviewed-by: Bart Van Assche Reviewed-by: Martin Wilck --- 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 4cd281368826..70178c1f3f8e 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2388,11 +2388,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 Tue Sep 5 23:15:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 720337 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 A3495CCF9E0 for ; Tue, 5 Sep 2023 23:16:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239436AbjIEXQS (ORCPT ); Tue, 5 Sep 2023 19:16:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231845AbjIEXQR (ORCPT ); Tue, 5 Sep 2023 19:16:17 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 161BDCE0 for ; Tue, 5 Sep 2023 16:16:11 -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 385MZn0M004023; Tue, 5 Sep 2023 23:16:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=9NonmR+JLLDIXvaWETvFNFaSn8aUlYH5NTGf9yVPnWE=; b=m4tAVaJnqcZntuHTUA/ICtAk5EO02lj8jI3uD6kRXEYg7xzp+ieIajhEfsI4vPy8kBSv bjVtoed3FeV17heUxniwsCwOe58zqEwsK0PBh/nyVoGOSS6QTm+mwrilpGgLD+TYSMHK jPboIkk2q2c37MtnMRkS4GBFAcLsNy03P4r1OzV1Z8jhEkyQ0ur9ps4KmDkjOn0oxhXg OdaymgQYpAfOalNawMTjUcp8XZAI5lLK3Mff2xmZ9dG6+cYll5jREt+Etj36D6/4X4Qd 4On+UlrEYd6Jc1xnX0YGNaY96AeeycrIDxRUcMl4sbijbucwfqfs3Ejsdzzng+yKhWlJ yw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxd8d81y3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:04 +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 385LV2Ue007675; Tue, 5 Sep 2023 23:16:03 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2177.outbound.protection.outlook.com [104.47.56.177]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5exba-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NQ8CLDR1WqsZl7A+UUZrN4/afNTL/CFJ8ze+NKHaQftNJNIdv0AOmWE0UePH6cHE5HVwiaCOSraJZ992TNExbv1xJ6jN/65B5mNo8DEkmcAjMGX9ZS0nBsLeOd/HjGl7Q4DEmtPQqUkRXwn4UN5Wu8Q83a0R8DfgK+acxPLzRKcjhoUJ7ucmQ+2xtS1JP2M/tkA8Q9gdN8DsRVtMnvkixYvrkkuLGdOGPqV3XdOG9PCVzWNK7Tx8a/yte/uJk7tkGEN/Oc0IhmyfTz5q+VwFKiGovpet9nv/D1NQAygtg0noFgqMoWcIu8pM6Yhq2fx4Gnybf7ATbPQKz/ogwQLUTg== 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=9NonmR+JLLDIXvaWETvFNFaSn8aUlYH5NTGf9yVPnWE=; b=Uqwhx8yiUOOD6sqJTZITfqIAtxpKLXRDuFc7PlJZxm/jCI7A4ETw4BGHzjfwH04DMix7QEfh8bekPfXblNHpOhNskgxONjXRyBgz7nBsVIrHMqQLDe3yg1hz2VavpNaaqbLRNTYfbrwkN0pOBG76xuYMFtMrxjNuBjvSzwQaqiD+r+TmDWFdoqHiyXTdHlOS08hNRRBbrZ9EtT6V3OS1NcxPB/eHSts4Zwp764XekIl5nTog4hHLaX6Zur+vSKlDz0kY2KhxR0uI55p1LWefGllmZcAoszxSy8BQB1vJsfU5HdzJrWiLe1455xdxUbZieIwEpc8wzDDYorGsY6L5hg== 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=9NonmR+JLLDIXvaWETvFNFaSn8aUlYH5NTGf9yVPnWE=; b=Ez+U0fNxknedVTFzwGdUTSb5ukqtBeB9HSkI2Aldns6JtYt7hd75sTFrQu3QRsBLUWELcI82s6qtqL9MSmohwXIALho2/X1bRp0afuWZKsQF2RrkK1qCse9P1I2rGPHzhv5mYoFWTXas0M5lAuX1Pn2U5bLFKNk02Qi1/hh78Qk= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM4PR10MB6109.namprd10.prod.outlook.com (2603:10b6:8:b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:00 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:00 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 07/34] scsi: sd: Have scsi-ml retry read_capacity_16 errors Date: Tue, 5 Sep 2023 18:15:20 -0500 Message-Id: <20230905231547.83945-8-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0149.namprd03.prod.outlook.com (2603:10b6:5:3b4::34) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM4PR10MB6109:EE_ X-MS-Office365-Filtering-Correlation-Id: 0e7fd321-0c36-4af5-4b62-08dbae66112a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +T6bvG19Lyx2YISOAxa8uhpHSvzHPjw2e0Ch7DpCdvr6B2b02LwrLZz16XjnXwzTsmpOjx6ACaYWYrPy//360PK0pLfL7Pe/iarcrpL6Z6C69BA2x6phUDpFA3wnY07mkNssA39kyIHIDWhaLwFCvUTPbNRNS1PDkcACNC07K4kxOtVqWL9ITUse1WrWk7uP0SNhhnXs+XPShlpat/G2/JVn368NrE69QUHENR4EKrIDphf8iFVVe67P4OVZLXJwnxM9QQ5q1i66vWb63ubhSxxCyMN3qM1R6rl+ur15WgnyzKZxlAVNmVFyepTB2F1bUHLkJ3WIkUL7Ed6HPlNK6Dq3XBYr8rwIR99OazKAAV/qzBZa8Xp5pxZFJGvQB2JzMcXn/wamcU3A3poHEFWvB6O9tK5KZmNHzvhcqYN8f6Np3ZFG0/o5RIcaeIgWG1L6dXJamSSjpebXpf6n267gnAoOJvzvcIXbtKaJ9JrbZ+Y1Pj0saxTxwRfHMoXvPpGQdTYXbTfSSzfWSYNsIhq1Q8T4NNvQppN57VuzzqXVGowW0rPJRRFjGzDozXYN8+3x X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(376002)(136003)(346002)(186009)(451199024)(1800799009)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(316002)(66476007)(107886003)(66946007)(66556008)(8936002)(4326008)(8676002)(1076003)(2616005)(478600001)(6666004)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-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xwvMV/QxPx0XDtRtYUAT3eUw2D+UYII+fqslUd0brXOCBpushR4HZPiDGbKOUTXD9U35MMsOXxGWnTFBbqeOR3mUkcluDdA3WnbpmctAmaURXki19MFWgdbUxfM4+x/WXr035quE37WXS9B0K4brBEgJA38TmIYbcOE4QrexDmjYN7geo38UlX4ajrAr0afDDZWcby3O1dZ+IoZFtJwS/pfteaYrl6kQTyK1FSK31wgQrv7uwoVagyeJpG+gt0Bvot7q2ISSZTp+tmLEh44Kai00Jhnzx35jk+BI9ntCs64sGTIlDjO6AKBcJNAAf2A009hNATmkSgc+s/mdBzpkSTAjURV4JdjHS7oAef/inTHq6WWz1KbnXT0C383OUnRLYr4wb97D7FV8mKyEmz/6iVZtPwr1 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0e7fd321-0c36-4af5-4b62-08dbae66112a X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:00.2654 (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: eVEAHlgM068xTYYLMtai8Jp7q8O4HT589jpHx65BswBVpRF/eQ0XjudwXxb/41I7r66UXwnCfGqe+op7XZkYCwy4yT3rK+Qlw0BivmCjOuM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6109 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: uH839_FiN0e9PvHPBgXm2AW1Go3gg38H X-Proofpoint-ORIG-GUID: uH839_FiN0e9PvHPBgXm2AW1Go3gg38H Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has read_capacity_16 have scsi-ml retry errors instead of driving them itself. There are 2 behavior changes with this patch: 1. There is one behavior change where we no longer retry when scsi_execute_cmd returns < 0, but we should be ok. We don't need to retry for failures like the queue being removed, and for the case where there are no tags/reqs since the block layer waits/retries for us. For possible memory allocation failures from blk_rq_map_kern we use GFP_NOIO, so retrying will probably not help. 2. For the specific UAs we checked for and retried, we would get READ_CAPACITY_RETRIES_ON_RESET retries plus whatever retries were left from the loop's retries. Each UA now gets READ_CAPACITY_RETRIES_ON_RESET reties, and the other errors (not including medium not present) get up to 3 retries. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: John Garry Reviewed-by: Bart Van Assche Reviewed-by: Martin Wilck --- drivers/scsi/sd.c | 110 ++++++++++++++++++++++++++++++---------------- 1 file changed, 73 insertions(+), 37 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 70178c1f3f8e..69188b13f5e2 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2363,55 +2363,91 @@ static void read_capacity_error(struct scsi_disk *sdkp, struct scsi_device *sdp, static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, unsigned char *buffer) { - unsigned char cmd[16]; - struct scsi_sense_hdr sshdr; - const struct scsi_exec_args exec_args = { - .sshdr = &sshdr, + static const u8 cmd[16] = { + [0] = SERVICE_ACTION_IN_16, + [1] = SAI_READ_CAPACITY_16, + [13] = RC16_LEN, }; + struct scsi_sense_hdr sshdr; int sense_valid = 0; int the_result; - int retries = 3, reset_retries = READ_CAPACITY_RETRIES_ON_RESET; unsigned int alignment; unsigned long long lba; unsigned sector_size; + struct scsi_failure failures[] = { + /* + * Fail immediately for Invalid Command Operation Code or + * Invalid Field in CDB. + */ + { + .sense = ILLEGAL_REQUEST, + .asc = 0x20, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = ILLEGAL_REQUEST, + .asc = 0x24, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Fail immediately for Medium Not Present */ + { + .sense = UNIT_ATTENTION, + .asc = 0x3A, + .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, + /* 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, + }; if (sdp->no_read_capacity_16) return -EINVAL; - do { - memset(cmd, 0, 16); - cmd[0] = SERVICE_ACTION_IN_16; - cmd[1] = SAI_READ_CAPACITY_16; - cmd[13] = RC16_LEN; - memset(buffer, 0, RC16_LEN); - - the_result = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, - buffer, RC16_LEN, SD_TIMEOUT, - sdkp->max_retries, &exec_args); - if (the_result > 0) { - if (media_not_present(sdkp, &sshdr)) - return -ENODEV; + memset(buffer, 0, RC16_LEN); - sense_valid = scsi_sense_valid(&sshdr); - if (sense_valid && - sshdr.sense_key == ILLEGAL_REQUEST && - (sshdr.asc == 0x20 || sshdr.asc == 0x24) && - sshdr.ascq == 0x00) - /* Invalid Command Operation Code or - * Invalid Field in CDB, just retry - * silently with RC10 */ - return -EINVAL; - if (sense_valid && - sshdr.sense_key == UNIT_ATTENTION && - sshdr.asc == 0x29 && sshdr.ascq == 0x00) - /* Device reset might occur several times, - * give it one more chance */ - if (--reset_retries > 0) - continue; - } - retries--; + the_result = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, buffer, + RC16_LEN, SD_TIMEOUT, sdkp->max_retries, + &exec_args); - } while (the_result && retries); + if (the_result > 0) { + if (media_not_present(sdkp, &sshdr)) + return -ENODEV; + + sense_valid = scsi_sense_valid(&sshdr); + if (sense_valid && sshdr.sense_key == ILLEGAL_REQUEST && + (sshdr.asc == 0x20 || sshdr.asc == 0x24) && + sshdr.ascq == 0x00) { + /* + * Invalid Command Operation Code or Invalid Field in + * CDB, just retry silently with RC10 + */ + return -EINVAL; + } + } if (the_result) { sd_print_result(sdkp, "Read Capacity(16) failed", the_result); From patchwork Tue Sep 5 23:15:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 721435 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 2D5FDCCF9E1 for ; Tue, 5 Sep 2023 23:16:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240049AbjIEXQT (ORCPT ); Tue, 5 Sep 2023 19:16:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235045AbjIEXQS (ORCPT ); Tue, 5 Sep 2023 19:16:18 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A586CEA for ; Tue, 5 Sep 2023 16:16:12 -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 385KnrDB009449; Tue, 5 Sep 2023 23:16:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=Zq7qNAdJZjgzIEBP7/l2W78FJ5pHv0OCfaaegkaZTqs=; b=xFi9bXRP6EsIpVypbFm2BTfOwoU3w2fFWd++x2nJhKx5eoLz1Vgrhhgyp7+qUeXqbi2k sfuvJZQ+QHlyCIxf8ebHJeJ7GVxqBLN3Njx+VWyUCTAXZJ7bHNYyrja1+kyP8jBavJ0p G1oklz3IeVgOR6/TPgFog3q2KY4OL4j2RVf0d4IspG5s7Oj5wtFM8qKHcuzdcPrYTfts 0oXkdgx2hfx0PSipKOBUXAuBScAXln034V74mx3DAzc80dlDEPnguNNkbZ0DG/Z7W5/4 S5P2+x/MYODVuVYgVuzTYsbrhTKvu0Ng0611rCrTuuhccKC+RrNDu2S4Or/EOPv21g6N dg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxbq388x6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:05 +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 385LV2Uf007675; Tue, 5 Sep 2023 23:16:03 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2177.outbound.protection.outlook.com [104.47.56.177]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5exba-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z4HGIADeZTS/MYmf2XVAiO6xDrRc8Q54G0JCo5MIrWm0w7y4vi+hjMtiMTDLiNnC6UwciY34r38BhocUZUI2cFd5MNXpl8ykJ0kObL7ylfJuB2znOxP8Kcip/EqoeNzEH+Gb3dq4gNwxjOwV/3s/aTLKlAsoIx0M6kPLioSchNuXo2VzdFYv187YEyY/IUE7uVwNOqa9cj87CvItDcGeRTPgb2IsLPxc24Du2a4Mjz+Y/NzE4RyEmZx1ZLX4eZWWCQOUFY5BZQ/Pd3SzFAz1zWcoG8N+Unti1dFqYFUmeDgbebQnJHb+elUgat095dj7/3IcW8RpEvUdWVDF8q3Q/g== 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=Zq7qNAdJZjgzIEBP7/l2W78FJ5pHv0OCfaaegkaZTqs=; b=ZPFH6br5k7cLOMH/DJo2a0fiWzRFYYX8LxL9NRRbcjceAgqBKshqgyivfxWf4QMGWxKlfXOB+b/C4o/pgkMtQAmu0uQEEJNznMMRFOCVcdKqvFTLM05Mbq1iUzUKfxjh/HEsmPM1KSOZtV8WA5sMgxgpfmfHYIi3IMU3ycibgwh5qiSX+SruwXVexFu6RprZC+IzB0GIuKRBpftQbeb3FglcDQCv5tRGAdK0sCEpbHoTcg4SgwnfiEcZ2sZVLbxxOD7bkf838JJuFEoFnssAMSxgUys6mAD6ucLPHRlB7MMRBYtWz6Fb2y/aDQA9OsrZPU6Mz16He3JFNKzrJDl3Yg== 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=Zq7qNAdJZjgzIEBP7/l2W78FJ5pHv0OCfaaegkaZTqs=; b=dh+bG/uv2aRKTWnOuLL8RNlYeqA4cBqjMhliHYLVkRi4o4w18eLxw4ziUfa04uuEcIJYplR8dr3C08WHeIFlOMdEj55r6LIwRyeI3w+lV2pVuewPKFnda3ZG+oyQEdjuuwbRwZyKsQLiNoeOcQmkb6OXqfiIDfvB+pCCWvlVncw= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM4PR10MB6109.namprd10.prod.outlook.com (2603:10b6:8:b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:02 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:01 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 08/34] scsi: Use separate buf for START_STOP in sd_spinup_disk Date: Tue, 5 Sep 2023 18:15:21 -0500 Message-Id: <20230905231547.83945-9-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR08CA0015.namprd08.prod.outlook.com (2603:10b6:5:80::28) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM4PR10MB6109:EE_ X-MS-Office365-Filtering-Correlation-Id: 7fd389e2-d937-4656-6eba-08dbae661229 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: maTBvnIxI8w2eaWEHBr+mY88cbB6xWO414ZxY2dY0+r/U8EYsvJXeDSJ/b+1f8BuDNDkTHYmoLd5MJlARIywMbOK0RHvqkC6fgjaXwA62B/cj4ay3Y0L63UMOZ79HwyOkMmfhBeWm9MtfTuEAtuuS4zffe+lgo43J22i9Zzwah4qHiNqXXSoiG7uX7Ij0hLEr27N5DkBnsCQlI4aOJy+D36ySnj9voOFhYht89oUSvYuoyPkQBriAwFTraqMHZknAyQ7akS34PnGue2rKgpdmOKJK5BfVlomGZe5qgaO5xtllV4vqx3A4TCYh/qoFhUcv9VY5zRes0IvU2VeVXQh7AbxYveOrXzFuGluRiyCK4fB9Ub2i+jAHPMw2o0FK+31P2Bwv8t7b6pCFZ17cGbaI669ZgnA+2lcJawxv0iNWe2qgzSA5OnRUabZLZ/0XtZi91u4p83mM/rmEkXyS9/zYZf6tVuoSKA6Zmo+RHMW82uuPPDlauCLTWLzR3IgydBDABEyCOPAQ7LeiktSNAFYHsXCkTNE5qQD8D+yBGZ1Uf48p4i39Q3Zensu2z0fR6FD X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(376002)(136003)(346002)(186009)(451199024)(1800799009)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(316002)(66476007)(107886003)(66946007)(66556008)(8936002)(4326008)(8676002)(1076003)(2616005)(478600001)(6666004)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PoNDpWgUC6zwvNfhMr9Fjst88J42LJxhkzNW3sIkR+Qhy70Glb3TPto1rnjZ9Q6yurdSf2K4/4DGUDn406Fzk+8COdSdOpCkOgVUG17FYd6iq74KJCjrE4RExu1+FmEo8rhYxBgS4MJLGX+cSm22pHds4d78MP1l1g5yz2mMN/g+NESXL9TZGtv7kioqd5TQBoJbuMiHOnp081OtGOj030fPUvspxL8m0K1WeOjvCphF0Dz/eKx9KUBoWkWQA8dsJBxE33hVouF4zCMefak+aQgmBiSly7Xwt/C15yNlx43HMhHdhdzoTZJrVdGo205+cgLO4uUcwe95Vfj95bx/x06X7Grg5umuQBtuhstmZgsNDippLdG+IMscmnnJC24NOZ9UDnP0Ec/O5FIHVVIMo8c5sNQQBoJo3AD8/As3ZbenHzGC+y3j8/hV5saQesqTT3Pfo9AhH+popJqrfoxgTh7erda8OwAazv+DkVgFZoi2LliljxzMnAgeTO+hyHGyBTAVEjJH3DLHO3HaSX+tEiieCH5mlmB9QJGqwhDSIRWW43IiA7mjqtoapku9YxoSgulbx/a4wIvhSg1nYRO9r0ZmxdOqqH+1EGeeREY9IejczRRP3bzo3OCzyuNK2usK03qPsiECBIX5ewsFN6f/L3fbvduRFqVBAR+ZpmKKpo81srwQOEtPj6XGkPAUNGFigYGdmkDyiE+JcElMLdIs0pH0L5ex3n/mjagRE+NVee1u8R72pmt9ZL+UQ++DbkNuWhsv0y52X1UYvudHQL6/BwoTUi09WQAVjpXktOTFcpytL9SuNA85gN8S+dRTNlqNm3xY5SXDEr5hrlUb8UZ5LJdn+Wzyz0yTj3JNz0732geA4bnqN5qucQ3sEXCe+n9ZuM69UNXrChZ7ukw7Xl1tTzOUJS8Y9NtmL8LNBXLnYZjl0uUFiPGxhBCg6wLMwqIMf5hrfI21oP2TIs9GjH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pyN7b6hIgqqJ2PzSsTdU+dGY9ynPxkzMlAzA8hF2eRUVMI/aF0d+9lG0oTwy7MVpMgPSrQ1qHyoO/2olo/+MpaJKsQQW364/12/zQJEHlhIENLmunj/bH+Fsj8x3NXVvFdfZPnX6tzbdAn+7KsRhBj0HEFyyMtNRYP3iaGAz+HOD4nhD6ie+BZ/cIA8TZHAFg1tRMn8CAz9V7DHTEYeUkmeq0JeE17EqNiaQzTdTyEmO6TRwuC1ZjT/EwsNoa5yiRehwTHKmA/Y/nqxLEOG8ZzRu8NXTPu1VXRgUH092Os55hcDATgzrZ8BuCyd2ghJmqbpi1F41SsP33eeM0yckhLoD64ozGgfdz1IIfSpA3SDJLiEhURhAQpZ+8PYKktO/TzlGLo79LUSkjfL41xjNrknFVg9zj1wKwT0et4g/C6u+1WqKjrUeI+qJh6v0lVjU+8h5kppRAhPSmipELFhwfFw3E3e1xaIsIn/lR+B1CUU0SgO2B+5NkwxXYu+Wnak55SM5LMfCvJV9AbaWB0kGf8NvFwS X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7fd389e2-d937-4656-6eba-08dbae661229 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:01.8940 (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: uhUOdKQ/FfMUHTenLFacxdAY6M/zSte9VLqiWsiosQ7opg9Kt+wtNfUYR3sK7KOGUv+IsGEi76MCwBhhtQZyxX//VN15fSN9CCfwgEjPJnw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6109 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: i7K9oqwLct8Ut7TN7RvZPgGKJ85ul6gt X-Proofpoint-ORIG-GUID: i7K9oqwLct8Ut7TN7RvZPgGKJ85ul6gt Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org We currently re-use the cmd buffer for the TUR and START_STOP commands which requires us to reset the buffer when retrying. This has us use separate buffers for the 2 commands so we can make them const and I think it makes it easier to handle for retries but does not add too much extra to the stack use. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: John Garry Reviewed-by: Martin Wilck --- drivers/scsi/sd.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 69188b13f5e2..3aac3041c83f 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2228,14 +2228,16 @@ sd_spinup_disk(struct scsi_disk *sdkp) * Issue command to spin up drive when not ready */ if (!spintime) { + /* Return immediately and start spin cycle */ + const u8 start_cmd[10] = { + [0] = START_STOP, + [1] = 1, + [4] = sdkp->device->start_stop_pwr_cond ? + 0x11 : 1, + }; + sd_printk(KERN_NOTICE, sdkp, "Spinning up disk..."); - cmd[0] = START_STOP; - cmd[1] = 1; /* Return immediately */ - memset((void *) &cmd[2], 0, 8); - cmd[4] = 1; /* Start spin cycle */ - if (sdkp->device->start_stop_pwr_cond) - cmd[4] |= 1 << 4; - scsi_execute_cmd(sdkp->device, cmd, + scsi_execute_cmd(sdkp->device, start_cmd, REQ_OP_DRV_IN, NULL, 0, SD_TIMEOUT, sdkp->max_retries, &exec_args); From patchwork Tue Sep 5 23:15:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 721421 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 4F432CCF9E2 for ; Tue, 5 Sep 2023 23:22:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242961AbjIEXWm (ORCPT ); Tue, 5 Sep 2023 19:22:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229861AbjIEXWk (ORCPT ); Tue, 5 Sep 2023 19:22:40 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 428A69E for ; Tue, 5 Sep 2023 16:22:36 -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 385NL1s4029889; Tue, 5 Sep 2023 23:22:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=Axd9TLHli2jieWkZ0nXfGVUlLjRrPig60/zF9fNNrnw=; b=QI0ye/md35tE5eos68nvbi9hIoPEI/W5A4nzlb8Gh3+j3m3/rciEo5unw+gvbtiR9rMY 1ANv2uBVRzgR/2n+elpi4BTkqmixtjsKrDl/hnjqCFC2Xh7N0MG0dz+xhEfRYxeTcr4w QCKsgcN9L66PNI+CCakV3cn5X24dC1lT8JRqMaQjykOeDHvAUrgP1e8mVOISxlrf+xI8 yfogiqAckaDt835lEgHbsq9LjX67HHeDYl9rDASteOCS0Q/WonoUmJ0/1uOaGF3rjBbg gKUjc0UL3pWAnOtDeaC6YikwPp5y5p+6pYTZuobfXDwLYMJVJaT5WSPcFdierH/66sPI hw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxdwu800c-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:22:13 +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 385L6KUw006574; Tue, 5 Sep 2023 23:16:05 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2173.outbound.protection.outlook.com [104.47.56.173]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5x007-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R6xRUDE5QxER4oV/63A9R2c5UNeQFcbSh1hxM1ta6CdMElTYxXKRFIIOf/XT0/uFKVHqMuUNC+ak42JyLPVU63/eGpajn+7PhSEH02c7qEIVpKwvTxDraHrOxPgkRV2ccAg8b6OjVCu8pb14fI/ZtXEyM7XZ53F0vjnej+L0YpHEZED5E1a9OPn4HOPNqBXRyN8Rfs8A/vAG68ABbqBeBvj96NQ7boyaS2UBUvG8OcDgtXPPZXvo4iDHzrowA+/roFg2Rkwb/coYBvOqlOZBCkltPpKSiYiOoyEKKQQM3EVar8xu/C+XCH7Wr3llm3bLRN7P0bz5BolxxTxMugVP7g== 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=Axd9TLHli2jieWkZ0nXfGVUlLjRrPig60/zF9fNNrnw=; b=O7UmIq6PlzxK8bhTiSF3yiun+pPTHSt9sSvF6sdxjC3gcWc5BMpjlUIZU5eBcN3vtTN6b+omPgbDTSImGgX7zCzrTkAowpaSSvKzGwP3YFH7Fujwq+CbJZt8msK46k15DJB1T85N/X0RinMvIQyYho1IJGiQ6/1Afq28MFRae1W0J0vE9jHcfix8RfqqF/y/b0HYNr04/Fn5DFoWonru2RZs2QoOkOjCfhAZ+ECQpoAlAEd7bKq4t7su8TRO9FHiP6WqmA2Mcz7aOYT53FUKvDgVPniOrJZ3fPrgMPZgbI4k4hizKBcKXb1Su4o1Hiyohp5tzrFXyOInwm5l6U7jtA== 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=Axd9TLHli2jieWkZ0nXfGVUlLjRrPig60/zF9fNNrnw=; b=hwTS8HEpeWUdqsktxFfrgf5hki/JMo1tUQ7tx/D4cgTUgPyYi8xsQ0hepwJL+K3bdsAsAWYdN5Av/5fvFQZdrjuQQMPUbmsL7WkCiCpQFqyN7+ISD950CeClBR9mthJowVQZtwlw/2kh7zQL8M4LLAVhrNUX/yzOe2OQqkcIYZs= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM4PR10MB6109.namprd10.prod.outlook.com (2603:10b6:8:b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:03 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:03 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 09/34] scsi: sd: Fix sshdr use in sd_spinup_disk Date: Tue, 5 Sep 2023 18:15:22 -0500 Message-Id: <20230905231547.83945-10-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR08CA0011.namprd08.prod.outlook.com (2603:10b6:5:80::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_|DM4PR10MB6109:EE_ X-MS-Office365-Filtering-Correlation-Id: 7c3548db-f213-48f1-6b57-08dbae661302 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NyxXf/nNsKf1z7+EhIEdPD8UkXel0LxjKut8cWuThp54zGGELuRcuJQUwJHAjN4816hMZ5bxhQ4mMtOirql7rB+RbSNgOvQr8tPp+HZqYO0Z3LiHyqitfHmEtCHcMqJPTy7YF4cEgHUvO27T9g+B34+cJcRe80xWaVpmIYRPxKxqHfKNcJstoveCD4GtaerQEOp/74uf7bOlRSgs241i2pbmlY5opSf2zcJTawpJ+O32z917nrzkijMfePH/k7qxB9ZOPyj7I4lIihqjsLbchzWJAorJLW+ow2CMpCL3zmjCqO429od7doXt6R+rhHM/TZQEpMrYSptnsji2G3OYuJE99J/BsEkQyaegwuQ3clg3ssplJFFPZ7QpQ6J/gq4vHKghP5LW7/iQPJKM8A8XZiPjgGwzC9FCYKUaXfDb0WVczXh+yBJJieKNOtlvkrp9pn2oUV+ZWYZFaOEhgpEHjI8WvAMhhu6H1mMshIUArx9bHi+ZFzQjp7bt3tLKZQRphSkVk+t/QACOGm7o43Z5zttYUCySNykhzX0uwmKIbUayZ1sV/tKLFl/xzFFJVSBW X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(376002)(136003)(346002)(186009)(451199024)(1800799009)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(316002)(66476007)(107886003)(66946007)(66556008)(8936002)(4326008)(8676002)(1076003)(2616005)(478600001)(6666004)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: svnpim7zIzuFaLGZEB+gFjcWp6hGUPJs8N/DAxSUCfesYK2QHqc6/4UFpsBH3wsHmErQUy2Rz/WVAc7+gH9JBc9ZmxXxyPqqImKVumi7V8dBIH0OOSk3YDASKV6M75xrttB1htcfdPk06WHhmhttLRCr5QqUBiH52eDkag6L1tkkafHo2d8U0jyyQW4HhAwuG8zmHU5b7wM8soN6UdB164CTBDd3/Bkzhm2fQATVRq5cj9VS0FNInzjslC1RJmmb/MX1abNSUZsTMhjdY1k3OMmJUDqQ3kUmxtdvZxDI0cAsH7XTfDTrf9Y+HtO/OppjTIZy2uW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ER3DLwnEyV74hDcptXwmh5aBri34VeHT5ypXIyK1FjuKA23SWz+VNUJHSpJ5EdZPm6iRwr+3dMGyh1qkZDV7f6wYcJuMmd6vX4QQ9MV6XIqH3de8505zNw0QZGBwsLSy2oPsLmnrSifRn5akzZyBP3EyVEN+uW45Yn0z87U/02oy+vRDeUU3mpBBCg4Ry49u/yw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: wg7QN9lFrDK+N/VpjC3dkKsn/2ypASkqE8RcZt0EBRR+Dcugbf6JxryAk+7jKYasLdpOZidcNpg+KEzVT4XKfHVQcXYmeqI/8M0SiVecgfuLh7Ex0oNVpNc7BloPIh8z3VlvJTRFfvWtkvu2nuFN0bhaepooHHciakPi26oMOYbYtaIE4jZh8HX7BULTYJ5jaFurylr3ebZxOIU09ewBtkvAHFzpWqDnDW/3vv/KHZwzAOnJNKmrXatydw5uLL1D8Ft8Okvyx1IyY0rKI4m3HvVTtIcErgYx/ovSyTQTnpNGRf3tdOZdDlaE43/Zfr840CxmbC9F3Af0nd+N66tYbGR7oexdIFgjK5PorouHu/eF1OItu0y+IJKxlc107FZYhmg7jGaui4WW691/JnyWNi9kLnmgItjX52EEmKr+FmlKceLI8qRg5MwEDPKBHjIIw5Z92vT0KDJdr7IBEePqRrIDLkbCEpMpIWzEEAXHWdcmX5MlJVYBzoCxFGqZWzwOQ/sguINJhWMPg2eKJOJw+aurSrLEbMIvggiAK0MpqgLyHsdD9mX9dQLN6SECtp5Xl+pZRpOdABt6TSOwVwy1leE7936unXcRyAa6+fEUYVrkR/HRc8sNPQMJc8RkEVVmbDK5165clu6sXuJsAwJOBN9K64lbB1yuOyUWY5PezCWHAat92Jvoq2LJOdXOQqWNYFTK4x/T8BgOagptGYJAt1mplC7NeT8LlM9dQRDig0NxApJ7crOUf8VNlKsHulg8in/VDPoBe1txa0yYq/zt04pjc6zxNaavzTCKSv/x+aHkLocySQ5oBgGcRYQsWmr+DgC2sPRETM3S5x0ifZHfR5Oosgl43aGHQztxBuJyMyscGZvH7JQkFMZriCWliIiJ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c3548db-f213-48f1-6b57-08dbae661302 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:03.3088 (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: 6nlrf23Q4/Kkx0r1DXxVIHZzy3M3QtlHfDnz1hL2cTj9Oh+KsxhIq4SMHUNgewEPaXhueUwygVCz3zoHXKwkt/cMqP9C1pMhEMJmp2nPkDc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6109 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 bulkscore=0 adultscore=0 suspectscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-ORIG-GUID: 6Zx_4F0viknDXf42CMpBP0tKx6-QpfZt X-Proofpoint-GUID: 6Zx_4F0viknDXf42CMpBP0tKx6-QpfZt Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0, it doesn't initialize the sshdr, so we shouldn't access the sshdr. If it returns 0, then the cmd executed successfully, so there is no need to check the sshdr. This has us access the sshdr when we get a return value > 0. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: John Garry Reviewed-by: Bart Van Assche Reviewed-by: Martin Wilck --- 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 3aac3041c83f..74967e1b19da 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2180,19 +2180,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 Tue Sep 5 23:15:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 720334 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 32D51CCF9E2 for ; Tue, 5 Sep 2023 23:17:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240451AbjIEXRa (ORCPT ); Tue, 5 Sep 2023 19:17:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240049AbjIEXR2 (ORCPT ); Tue, 5 Sep 2023 19:17:28 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE325199 for ; Tue, 5 Sep 2023 16:17:23 -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 385MtjMH029203; Tue, 5 Sep 2023 23:16:08 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=H3bN2J++3dXRI+yKekNXfuDFv72H2spSYtIxlSeSkJ8=; b=lVnab2od85uwKE/5L+72t6AwEUGsF8KUoWcSoZLGrj8aXgMNkD/RQExrhuttszSGPFUC y5hHojRVtQziIqvZ+rxPcvebxDK+HPGr6oxHfjPgf3tcJ28BuPnS45qFHu4y84AMbacr PL1iEeIw0YkKZ0e7OV3B/cPKRhcD++AG6URZTkR+C9JwO567WdJOYVtHosI0buvcZhzN uqfjglXVtUEPequ/i0uJkIizkFdrSG6kmIuRpVWem6Lz2EVsF+2MD3YXFSbJshroxHD/ tCU4cALHOZ5PZTeoM1vf55BNyoXZLKXe3uEm7O9pw5R8O1wOwSXZwZrN2+muInXFqHi6 qQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxdj500v8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:08 +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 385M1gNF007729; Tue, 5 Sep 2023 23:16:07 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2174.outbound.protection.outlook.com [104.47.56.174]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5exey-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FYqbfO2sVqTdOscCLb6Kr5K/Vjl1/ieywMpfpik0EIVxzSfddlHBRAws2seXQLkPcpUL4LEJ3YjwZ3c6p1OJrEXukIhY4tYNw0DDRp4WbYAxHIaBZS8/QLDGjin5vzKrKWGzRjAi+8RMCeWU7Vfhq13JuKehYs8JqE9TD5ELTfnG400pXsEINZPg6pv+9Yy3K7IU4g5BCB0wmO/yPzGFQQd+HKGoscDdJCf+GMq81uaV5JggKofa3y1DKlcamrkcxLR3icHtm7Y/FFgwAoyN0AjyVjBl+vYNSWi2Z7HUmzvXSgTNyF3/gWJkkVF2zfCqe7PfaP9bsQGTH2Kg7P1NXg== 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=H3bN2J++3dXRI+yKekNXfuDFv72H2spSYtIxlSeSkJ8=; b=KHnq6v0HCSdBDyeieWUuj1aNStJi7Tw/YgfFgv6i0ctot7qfZ2M49mYxQiZqDVQg4SujSL29Nm1PJQOpQx0ZAgCrMZs1E9o/fdpXiQfqeZXGhD7Yk4CiiV9O9MZ3V4DvN2ujfFggopfH0zvuQgjW2IgG4hXoxcGRzA/mKDuKWyOUejRFT+bKDMCVO/1yp0FZ9SREQU3um05WcZ+Z3RzmE391Y27GNOK6JsQBcWrqj1QPNaliiME3dKOMSksw/npOE8Kn88ZpTDDZlOp1pF5fKrB0U18jJjRcL5BeS/5YtjePFLQyoTHq0yQwpAt5gSS+T39bFRHU+dafCJ+vP99jDw== 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=H3bN2J++3dXRI+yKekNXfuDFv72H2spSYtIxlSeSkJ8=; b=xovUCkNe77RUpxpu6npuHAZmGD1IYYlG11O6gwGvqwaJzPd/hMs1+1l9XVte/SylWaOCrnCPTbEvx8d9zuCMa+wUQA+M5a/bfOXPmKwbydDRWS9BeZT2gmUq/7Qr/t7KpVzgsNQZpG5qCuLX781CZ1eTCNk0MMVBpkB0HEzAc54= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM4PR10MB6109.namprd10.prod.outlook.com (2603:10b6:8:b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:04 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:04 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 10/34] scsi: Have scsi-ml retry sd_spinup_disk errors Date: Tue, 5 Sep 2023 18:15:23 -0500 Message-Id: <20230905231547.83945-11-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR08CA0008.namprd08.prod.outlook.com (2603:10b6:5:80::21) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM4PR10MB6109:EE_ X-MS-Office365-Filtering-Correlation-Id: 32a251a2-8ed5-4df8-5477-08dbae6613c8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YmDCu0xVm+Vr1+NvIsA6UnJ+j1+jpKIp8ClzQPJTV3FnFiBz/BA6ourGAZHrsQXUwDu0ggsgSuomRzdoUpV8rYfjaGdJzAZo8Lm/x2utV3ET601EyvpJs9iNeZ1zri+9YgxMerip0Ijt6QrEOac5MJMocpAVRVUAbeKlkHDbCba0/1TUJb9Hkx1V7zOgoXTVIPNfbM0dva/wuVaiww4G1jqlK7MvyvS8H/ipoKklFzuA75iZ3a1GG0Z0iU433YlUYMIC3lcBeGR6WPJqwTMKeimQ2R7V7fxgzztw0FfKSh7TIEzRX2JMTOT9UKIgbgyxCsEat6vP8Fm8U8wfJ+M3LGS+IfcswQEIbrYtJ7QQOSL1Ld+/vldJkc1aEu/d5GIjSCLDgPHbcBpLcicA4HOz21fH3o/gvJPfo0hPag5Fog7qd7ijbV4Wfyq6fgfbHJJxUzeJZw6sLA98SXamRpr4rsmBkBjpocRmhdnsPCMfj+fNJ7dcUeqmLm7cZt/D0PYKaQPfkE1y2/ueYm9qq0zO71utmjXzDAFutCV8j2DxanYt1FQejs2Y2hQ1OmVlzS3T X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(376002)(136003)(346002)(186009)(451199024)(1800799009)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(316002)(66476007)(107886003)(66946007)(66556008)(8936002)(4326008)(8676002)(1076003)(2616005)(478600001)(6666004)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6tTWimjcrO1LlCWQYU+fNkTDJ/ywqpWDRvf9YIa7egtFOHK55WfmZUTd2Wislh/WvUJv4w24JlgwnEF4gWvmPvv71IIWgPc9F5T5E4RJUbCbAUxCVD1b8DimaM9sIwyPYHxKYNfZrkpg7bmPwGqZeb1jr2WJmqMGfmhIrNZIKGIq50GB/kY3Mqzwvu95GfrDQrHvy7a2wMzhnDLmp1I5a2fDbLUM00scMqMCtGtYgeP84f8JWbiusE7gjpGs1YNCTx0/5UvGlB3lZO4g+Dhrt1sdpHEHuZmRDQum6RhxM8zgWchqESUq1EjzNePG1r8ASUZPYcggXg7fcxbZkefD4XbQKo63p5NO2ntMyIz0uIpUrQQkIG1NDa7QhgQiwaF2sX3LHd/q4tJ0VU2ivPDiYe3hM3vPBj5qDq24x+QQoW2cFn1+mTkBpNXhJ8SypV/3xzsnnQupTPb3M3vplPvmBlht0Wkb5ZVMUvmoSCRrEVng51dB6WUBLmaWaacwcfqXUlAeDSJLystDfk3Idk87jowL2yBu+0cjZ9XagxXXrzZnjyQiBHglEZix/X9h9FqSgxhoYaqF4qMzSx/rqHHk5OGDm2cn1/UtWnXsG9/nqb7bQyzVfCO5B5fZiqzqG+s4WQ1UU61KGUH/jlR4CNPhwsNKtimI7A50t5o9vtbE8JU7XYlfTYMZc4NHJm4DLmyBubU5q/ph5nARmnVhzvKd4lHgOcCLa3i4DEaj+xbChEP1yyqGSe4twNz+bF87lil3p+4C3c09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e5dAm9WnYnxGduX3e8CH95Xqh6WG2v7WtcZopk8zfMSMp/zUGfs0WeXC72/JUnglenY65xkfyqrC9ilNBYAtd26Ioz+q45WSSxVTI7rSysMvsf9W/kDCLHms7ssk34/rUwFJ9/QsbCJiPvllgktZzp1L2t2rgi2sb0cheIdAMNQPZQKt6fzUggOnK4cK7K080b1hMsAs8Qtb7fOUgOwOCHaocyVBKIXp5otaHm/yye3GgR5s4Pj0raxUXbR+qi/qcmC96mOa3NF2jDwrqmbrj/RMLhUJX+jqF0LwscZLUQAy4A2aa2fmEsLg9odWFWYJFE8Y/LvGTxMva5DBwWktqU8jHf2WpT9JsOFaaVfaua8IA15GDi7/nruFxdfJ6vNT+AgabML1e4J0yBkIk+0JMeLN2du276I/D7kRtryaFTWkNLebFDaP3yfAFlhV/k5a9TBSbRMpGaLJt+dW3eZ6DDzrwAOCbyfTksqX4uFbPW8t23D+t6zSbbJmwJf5/0BhFyS5nfOPAKFhE2Q48mjRkLQ/F29+saLuPzQupA+SALU236XSqXIECSG5VEC0c+QflpmqiZhn93NwbaMA62pF2LiMZDEc2xWlmauCI0cACh3loog9uuZWzd4nAxjwV0w3iABIW+21Zikd0O698oZ0274GPui7i5BKZWRgVIe/AzuUar6v/YH1F2dmNDi84g6LV6qlpnifPJX5rCc+xJtEKV4joQM4uMpV X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 32a251a2-8ed5-4df8-5477-08dbae6613c8 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:04.5972 (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: 0l5vjiMzBUfOm8kgjcOW7qnOvIC4UlJ0bOGtAnJkpWoYPx4iZfMz4w7IaW/GgnOx+FOA7H14h0FWuzIsxoTMljnhR0kTJTWROJighC45OMk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6109 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: lTapEZbjxF_BgGKNAiumNyt8M__zHeQX X-Proofpoint-ORIG-GUID: lTapEZbjxF_BgGKNAiumNyt8M__zHeQX Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This simplifies sd_spinup_disk so scsi-ml retries errors for it. Note that we retried specifically on a UA and also if scsi_status_is_good returned failed which would happen for all check conditions. In this patch we use SCMD_FAILURE_STAT_ANY which will trigger for the same conditions as when scsi_status_is_good returns false. This will cover all CCs including UAs so there is no explicit failures arrary entry for UAs. We do not handle the outside loop's retries because we want to sleep between tries and we don't support that yet. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Bart Van Assche --- drivers/scsi/sd.c | 73 ++++++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 74967e1b19da..f5e6b5cc762f 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2151,55 +2151,64 @@ static int sd_done(struct scsi_cmnd *SCpnt) static void sd_spinup_disk(struct scsi_disk *sdkp) { - unsigned char cmd[10]; + static const u8 cmd[10] = { TEST_UNIT_READY }; unsigned long spintime_expire = 0; - int retries, spintime; + int spintime, sense_valid = 0; unsigned int the_result; struct scsi_sense_hdr sshdr; + struct scsi_failure failures[] = { + /* Fail immediately for Medium Not Present */ + { + .sense = UNIT_ATTENTION, + .asc = 0x3A, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = NOT_READY, + .asc = 0x3A, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .result = SCMD_FAILURE_STAT_ANY, + .allowed = 3, + }, + {} + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = failures, }; - int sense_valid = 0; spintime = 0; /* Spin up drives, as required. Only do this at boot time */ /* Spinup needs to be done for module loads too. */ do { - retries = 0; - - do { - bool media_was_present = sdkp->media_present; + bool media_was_present = sdkp->media_present; - cmd[0] = TEST_UNIT_READY; - memset((void *) &cmd[1], 0, 9); + scsi_reset_failures(failures); - the_result = scsi_execute_cmd(sdkp->device, cmd, - REQ_OP_DRV_IN, NULL, 0, - SD_TIMEOUT, - sdkp->max_retries, - &exec_args); + the_result = scsi_execute_cmd(sdkp->device, cmd, REQ_OP_DRV_IN, + NULL, 0, SD_TIMEOUT, + sdkp->max_retries, &exec_args); - if (the_result > 0) { - /* - * If the drive has indicated to us that it - * doesn't have any media in it, don't bother - * with any more polling. - */ - if (media_not_present(sdkp, &sshdr)) { - if (media_was_present) - sd_printk(KERN_NOTICE, sdkp, - "Media removed, stopped polling\n"); - return; - } - sense_valid = scsi_sense_valid(&sshdr); + if (the_result > 0) { + /* + * If the drive has indicated to us that it doesn't + * have any media in it, don't bother with any more + * polling. + */ + if (media_not_present(sdkp, &sshdr)) { + if (media_was_present) + sd_printk(KERN_NOTICE, sdkp, + "Media removed, stopped polling\n"); + return; } - retries++; - } while (retries < 3 && - (!scsi_status_is_good(the_result) || - (scsi_status_is_check_condition(the_result) && - sense_valid && sshdr.sense_key == UNIT_ATTENTION))); + sense_valid = scsi_sense_valid(&sshdr); + } if (!scsi_status_is_check_condition(the_result)) { /* no sense, TUR either succeeded or failed From patchwork Tue Sep 5 23:15:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 721420 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 A250ECCF9E5 for ; Tue, 5 Sep 2023 23:23:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240509AbjIEXXn (ORCPT ); Tue, 5 Sep 2023 19:23:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232289AbjIEXXk (ORCPT ); Tue, 5 Sep 2023 19:23:40 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A82F7CEA for ; Tue, 5 Sep 2023 16:23:28 -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 385MZn1w004023; Tue, 5 Sep 2023 23:23:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=Z9vdPdX7B1WPXDw67RdMWgyje7Cr6/qmcvlTZ6vl91s=; b=ODLw3qNgGqEfkDbOok6rSHMCnzJQfxJ1jxWBl3LZUOnhAlNdGy5MQCTj8L2T3H4RhDP7 oMQQDCD5G5mvUoYX2wUt0lSzOdOS0WxP93swAXq75WGJsauxAkqww8FcgA3C9C0ULo5q mcQ6Ikl3RGmRjCZRcU8V6vkevkShk652cFe6K8INDRbdfhWSpk6yxqWzf5VhsnTx0exP ExSCIAkRMB3Ysk2LkkeiVEQEX+FYWR8udKO1UqwSqo+j5jSj85h8gp0OnW05pNTsdfxA f9xexZjG8WhWZU8IZzeA6jdlFNvECaSKa3Nh+MdarQPebzWlmLSYFiriW1f5StCCd31P Tg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxd8d82cv-13 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:23:17 +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 385LwYW3037068; Tue, 5 Sep 2023 23:16:08 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2171.outbound.protection.outlook.com [104.47.56.171]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3suugbpcfw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=itioJaL5CYpO/pYYB90vvOEJChKNpiNC/ZjzveralLkOKO1/+3+xOGg93xEZapB81i01ggCUGWGEoPIAqC/3fx15vRMpYTqfnHu42R4fXnMZrs5k170R6npPF21hIy+wiNOKbdtDm4YLo3yVMolk8FSqoEK20HK1jUg7g119UbC4S9TXFA5SWUj6Zlh7AK4vPpO+knNKbJAo+QeCjq1xeIf2yn3PLS6WjhHtAWYnaaGZUDVse2IV1aYxZ0oMBTTNfDaUhODYQQmlnJXOCPiXHzeF20AwbBr7qi0bIXQdJRm24VlMXKXani+WJ+dyWhjFmkeWkNdi6hXfTG8qqgKrcw== 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=Z9vdPdX7B1WPXDw67RdMWgyje7Cr6/qmcvlTZ6vl91s=; b=UIWnjvKxNkEnJ8xLcfHzOm9iQ0q8+wt9GIcQFsbb3T/Pwg7D9QVp1PvFQaWZhyOvI9/7c+qjImlxAF3BAoejd78s1qR81/45bQQsHHe1hWh9XdEolzsifidvJZcovzyYlPcWCmcRaEyzFMFAa5E/atQyFVnqTTrZD5A/CTv0h0nx+R3E9AysrCY7Z5bNtkbUvONYV0xmTjZnPkRwyALl8aDY2QCaQckEUnYit6HGJYTMLIA1AEZQOreIU2nULlK+lxbfQfsBTMprcG0fDNCBYsxJlkJLkI/D/YBYGRxokdKQD7D/ispfd7O0dkeRAGPvj2nxlg2lv5Zom1ULxlc9Gg== 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=Z9vdPdX7B1WPXDw67RdMWgyje7Cr6/qmcvlTZ6vl91s=; b=zUTFCWuzN2cdZMRiyrAW0GKjhypPqBHkdFfo7UUzLAlbpgPAp/gl185EOLemdysa4cEtg3IPFDS7Co/aZLMaCzrufwcSweWyCIOIZfpPmL1XnxKDFFQEH8BO88U8euhgOBfB81BfaDvLXJXz1watr5V9OM6fKycJIRQuA6gm3QM= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM4PR10MB6109.namprd10.prod.outlook.com (2603:10b6:8:b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:06 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:06 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 11/34] scsi: hp_sw: Only access sshdr if res > 0 Date: Tue, 5 Sep 2023 18:15:24 -0500 Message-Id: <20230905231547.83945-12-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR17CA0030.namprd17.prod.outlook.com (2603:10b6:5:1b3::43) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM4PR10MB6109:EE_ X-MS-Office365-Filtering-Correlation-Id: 722611dd-5e3d-4557-14e7-08dbae6614e4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Rn62RKYdbDGJYNSylWU16mX75rpngUQ7CFbue6ja17MVXKQjTdmXaYTpijwul3GyAO12QF1csTjfaALCbQlCumzqioE6H9iBztdrOophM28qgLuhEu2LLJ7IIJd3enblNEHZZWNH0ymdIBiH20e1eRduJHneWj2zRD9ACySwhavVxIItIj0XqjVmfKUvbC4d6vqDckpaIDtsWjMyFbO57llKOD5lbwM1/kdMF6Gvgqk8yRutT8Nl+NZRCi74oFovbzCgWB61oSz8ofh9l0WpgBb9LSIpSZi0IOhKvoRwTmlzj3D71xLGBLSTU0tjV0R/NSfl6oF29rm8qumIBwiPTbwPCyHjSXydhdZVjikrjzmL1HWMHru2ho+PTWYca9LxNJvYRpZHzpsAMhhAml/449EwRcXUPKHDshFZumbtCeB5Z7hDlZBuRXINGWvwArEZ5xg5XOmtnwa1bkw5NmwgTMhdmHOIQx/YrsmVgol7dE/067U4jWs277HK6vWZOUv8JCJwclRF2gQ6NLVFts3y74ouuEbhUHphvYh7kyR968cOa/CG1HjsG4UjDN4eiOYv X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(376002)(136003)(346002)(186009)(451199024)(1800799009)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(316002)(66476007)(107886003)(66946007)(66556008)(8936002)(4326008)(8676002)(1076003)(2616005)(478600001)(6666004)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8St4bcvOEgKt0tytjKNQgBksUE2sIc4mzhwo1718QinpQ2dwPSLCOKdnaWA2ObbsPlwb9EwDqDWW6qKAaxu8Km7QyTM5BEKO7ZaBPO7TTGmzg5DWkoYGTMriIMHSIWsj0fQEGyVwBA35OnGPdfEdYPfEl2G3vm68q5P2BvJm6W9wWIKlE5olQADitUZdkNFsik8l56jF5jdFBrvDhB2YHz0VrrVYnKl4DNtCRftqPgw6y94Zvlv5WUeCvbf5ppDy9gQ1QXATkfwHu74jD2f3GuokLnJLVX4Wx6AQ/RyWBvwATEIxXDRW4QO8Tcuznrog8KYONYsTlo4r+3374LuwrK6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Q98UKcAjBIrSzkVGU50jsyxBOmJP0ZF8pKXrTn7FFKvrWch9lf96I0G4EesvbHogVoOQov+haYvghCDphODGmDPXX+S9gkG4aLNjOs X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 722611dd-5e3d-4557-14e7-08dbae6614e4 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:06.4652 (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: EWjwqXheANyjp4OMmOQnZwQneAkgqLVt3FFtGH1t5YBzclAii1P/fUyvbMit5014iBMQfh1F9pRhhnywCCNoZrYGrLDuqkvQGjoJ6uJcyh4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6109 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: iK8k5ny8DqIga4ry3EDKqFlQxeJxTkCx X-Proofpoint-ORIG-GUID: iK8k5ny8DqIga4ry3EDKqFlQxeJxTkCx Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0, it doesn't initialize the sshdr, so we shouldn't access the sshdr. If it returns 0, then the cmd executed successfully, so there is no need to check the sshdr. This has us access the sshdr when we get a return value > 0. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: John Garry Reviewed-by: Martin Wilck --- drivers/scsi/device_handler/scsi_dh_hp_sw.c | 79 +++++++++++---------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c b/drivers/scsi/device_handler/scsi_dh_hp_sw.c index 5f2f943d926c..944ea4e0cc45 100644 --- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c +++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c @@ -82,7 +82,7 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) { unsigned char cmd[6] = { TEST_UNIT_READY }; struct scsi_sense_hdr sshdr; - int ret = SCSI_DH_OK, res; + int ret, res; blk_opf_t opf = REQ_OP_DRV_IN | REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; const struct scsi_exec_args exec_args = { @@ -92,19 +92,18 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) retry: res = scsi_execute_cmd(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT, HP_SW_RETRIES, &exec_args); - if (res) { - if (scsi_sense_valid(&sshdr)) - ret = tur_done(sdev, h, &sshdr); - else { - sdev_printk(KERN_WARNING, sdev, - "%s: sending tur failed with %x\n", - HP_SW_NAME, res); - ret = SCSI_DH_IO; - } - } else { + if (res > 0 && scsi_sense_valid(&sshdr)) { + ret = tur_done(sdev, h, &sshdr); + } else if (res == 0) { h->path_state = HP_SW_PATH_ACTIVE; ret = SCSI_DH_OK; + } else { + sdev_printk(KERN_WARNING, sdev, + "%s: sending tur failed with %x\n", + HP_SW_NAME, res); + ret = SCSI_DH_IO; } + if (ret == SCSI_DH_IMM_RETRY) goto retry; @@ -122,7 +121,7 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h) unsigned char cmd[6] = { START_STOP, 0, 0, 0, 1, 0 }; struct scsi_sense_hdr sshdr; struct scsi_device *sdev = h->sdev; - int res, rc = SCSI_DH_OK; + int res, rc; int retry_cnt = HP_SW_RETRIES; blk_opf_t opf = REQ_OP_DRV_IN | REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; @@ -133,35 +132,37 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h) retry: res = scsi_execute_cmd(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT, HP_SW_RETRIES, &exec_args); - if (res) { - if (!scsi_sense_valid(&sshdr)) { - sdev_printk(KERN_WARNING, sdev, - "%s: sending start_stop_unit failed, " - "no sense available\n", HP_SW_NAME); - return SCSI_DH_IO; - } - 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; - } - fallthrough; - default: - sdev_printk(KERN_WARNING, sdev, - "%s: sending start_stop_unit failed, " - "sense %x/%x/%x\n", HP_SW_NAME, - sshdr.sense_key, sshdr.asc, sshdr.ascq); - rc = SCSI_DH_IO; + if (!res) { + return SCSI_DH_OK; + } else if (res < 0 || !scsi_sense_valid(&sshdr)) { + sdev_printk(KERN_WARNING, sdev, + "%s: sending start_stop_unit failed, " + "no sense available\n", HP_SW_NAME); + return SCSI_DH_IO; + } + + 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; } + fallthrough; + default: + sdev_printk(KERN_WARNING, sdev, + "%s: sending start_stop_unit failed, " + "sense %x/%x/%x\n", HP_SW_NAME, + sshdr.sense_key, sshdr.asc, sshdr.ascq); + rc = SCSI_DH_IO; } + return rc; } From patchwork Tue Sep 5 23:15:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 721428 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 DEB92CCF9E1 for ; Tue, 5 Sep 2023 23:18:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240700AbjIEXS2 (ORCPT ); Tue, 5 Sep 2023 19:18:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239411AbjIEXS1 (ORCPT ); Tue, 5 Sep 2023 19:18:27 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED8C6D2 for ; Tue, 5 Sep 2023 16:18:23 -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 385MtjMJ029203; Tue, 5 Sep 2023 23:16:12 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=+iUM8H9ZtCIQfa6hAvBbhKdk1G4xw8DfNi2Eg6GoXcM=; b=A2kLz1bTxVzdc+GMCbAz40NJMiHgW3ubBqpcc6WN2dzKN9T84s1YGmh/rDi4DSnDapg/ TdaVOmtnUdJ0eGdTgKRBsYHE0LAciu1hxXdQgmifzwog2DfVpR3nn/uHc0Ku1E+pYXe0 QuF2ZVjqtxgIAgkMxwdzKH0AZDwWKWXdbeY9LarJukDX3vQNzXd0mW2GfaDuNTK+si4N Ccyc3KcKIa6LidFvY2RYmOjmnepd8NUSnrFVB8X4aLxNH3LRc+fTt3oBfe9W5xUHNh5/ AV5HlQF3HC+L0lOoguSShhZIIoMQpnZMpAq51JT6OApDF24Q1FtIiz3XxmXEXozhcono tA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxdj500vh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:11 +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 385MA0Xs007688; Tue, 5 Sep 2023 23:16:10 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2174.outbound.protection.outlook.com [104.47.56.174]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5exhg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bigd4AoAvfaLwWF9gLnRKFe8kBiBsIpb/JshQQ2CoJB9bUH0vRHVmXRqGpg+ZP7nmeSR51qbTll7tOt5pBHmRWmnMfA9KvAHrwqcR4cA+Wq4WHvLmjVI0lD0u6aaN/SNILu/Bj0CNe5ZGyqIVuae6TGt3HPWTzCAiA7uP+FDiCr85W14buAiblwkgR/Se5lVa46MgoWLk144IracHbKcfCnwk5wzxEKwTRVxtcACqET84lJ6UHu+CHOcq06RVT8pyGFktV20CROoPaRynVD/qLPeVCjINFIARpNVTToo1W2A2ms5cuDbWiyrCKlS924uZsZ10ZSNV/DnPiojp/lBJQ== 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=+iUM8H9ZtCIQfa6hAvBbhKdk1G4xw8DfNi2Eg6GoXcM=; b=hZI2qo04S13IgAg0b+FOpvch25i+ENxshhQQPvW9j+ZAi2Etzk7ItSS7AeouyJNWGW2gWZZN6nE6+RoQJNxui2L/ZtyiO1lue2zjYfLuq8ehryJnAxUZQ+OrBGCkKgBKy7sK2EpcDJI5QanF4mFoYN7tz2eK7szXsbMdQPRavCLt0J+xbsrdWVzoSnOzF+Yly18HrX5UfT2EmMxViTDFCiaagx6VnHs7JDTXH67qg3hlaz3ydlFNWHsNPgwZykrMwVVvJ5hWV40o9n9P8RyrmYQtvxVZ1jaJz6zvltjMTz9tD3uqPefgwWstTNdwZnG3D4Xcx1HI+AvjQBtIv4c0aA== 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=+iUM8H9ZtCIQfa6hAvBbhKdk1G4xw8DfNi2Eg6GoXcM=; b=lx1IziX57pGZTXzvrmTyTGDyyxCWdyWgnMohtc9haJf8+yVVJ9qdQAIsdJeNzSmxD8S1oI6ycT3/gvoPHNQW+PS//1p6kKm78P2xnIREHVMHU5qHtof9C+hxAj6g4AWVbGbJMaJXY7/2zs65T/tzGpZ7zxekIUT0B6kpzLiZx0k= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM4PR10MB6109.namprd10.prod.outlook.com (2603:10b6:8:b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:08 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:08 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 12/34] scsi: hp_sw: Have scsi-ml retry scsi_exec_req errors Date: Tue, 5 Sep 2023 18:15:25 -0500 Message-Id: <20230905231547.83945-13-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR03CA0079.namprd03.prod.outlook.com (2603:10b6:5:333::12) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM4PR10MB6109:EE_ X-MS-Office365-Filtering-Correlation-Id: 7dfaa8c8-9cb5-487f-fd94-08dbae6615c8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W4I6WnZwa45Ac0ljarHKadFmCa+C0ZZrP0C7vw4zQTtAeLDKRdYKfDyiXbzYM4D/8pJ3uObigZVlsqTErJy5/HAgB8gL1brE1wU/KN5p6pvJ61jEGXrDbpWBmmc98hDsV0UtnycPWyujq9jszVn7k/BSuvFIG9QtTXblSssl5RDvoQYgl729TZFEotC6AzDLsJzDSMOkESH6TEuSESktr8uuHXDc/cBA7RhoRlH+ewjf5ZAbEIQIE5O3bgamo5bWV8OTe4SFyP7fhRVW9HMLK0Pj81y8ZCE1EJv3eQZNtbGMY+0/ZSD+KvIjOg6HER6GV4usr/TqFXYfxbAawTMjdsq+Fu4UsYCVTKRMqsn10DWUfPMwtciccEJZUDG0+z+mvm7bXjvAtYHDiFD9tDzy1mjL88I2FvDDgIjgCYnv78NV8f7nBHNt8cc5NiA1Qi0vGJQSm6dE1uQZJucRr78AS1tx8e3xLFLz4VbmQGXwqxX3t01noqn0v1hcjjtDPpFLyWU0NvmIXnarybCABzlkpF9tWQN0YgnVm8Y0pH+PhvMhOgJ/JTMeMfPvReiCqDQr X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(376002)(136003)(346002)(186009)(451199024)(1800799009)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(316002)(66476007)(107886003)(66946007)(66556008)(8936002)(4326008)(8676002)(1076003)(2616005)(478600001)(6666004)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pA5kh7dNX1R4Jg1joEp+l81wnBmjFLj9/lCNevU3ZggEQoFvoXd7VnqcW/rLG6nWH7yhfBSmbshQYzHx0ZxzpHeacsuVwPQUOPGzuTIwaFGA5yLE4itCabFZH8En9Tv8r5KEre/5z8CyUqdxVLfLwMbaYUc6U3UDEa9PTcmXhQ1elbpvB/9uNPWjA+L7eO+QP+C6+ppokDqlkZo3a+8Amnv6OcjcoBDUQC+DGuv2FU/Y69kFfx1k6g38QWf1WJHB1sKFqn3Ap5xLrwVaNr1MELjaRnQ67MR2wcq0mszKm7ktvHNtkMQOIzhuG3ni19ud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niEoBQvruIt4tXe8jmth5/is6SC8CafVamun5AMOuxVyuFIWMmTK3nEawSE+vhNDI/8Kz41HhqZrlYUFCN4t1O+ftv4yP+MY3gUaZf1nPUGmeWJZUmam5IV X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7dfaa8c8-9cb5-487f-fd94-08dbae6615c8 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:07.9903 (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: PvW9bWIaPfwxcA8BCco0Pjd/F/rTBhqNxsYa1DDfQZfRGD1XmBjAKDolH/H6HuTDfmOKejHD6SSfYbM8cSY/2hFGMEKSotBbcCtK4+WSl2M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6109 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: xM37i056xIXzCwTc-wCRW32zkuoyHjdB X-Proofpoint-ORIG-GUID: xM37i056xIXzCwTc-wCRW32zkuoyHjdB 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 Reviewed-by: John Garry Reviewed-by: Martin Wilck --- drivers/scsi/device_handler/scsi_dh_hp_sw.c | 43 +++++++++++++-------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c b/drivers/scsi/device_handler/scsi_dh_hp_sw.c index 944ea4e0cc45..d31db178875c 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, 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 > 0 && scsi_sense_valid(&sshdr)) { @@ -104,9 +111,6 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) ret = SCSI_DH_IO; } - if (ret == SCSI_DH_IMM_RETRY) - goto retry; - return ret; } @@ -122,14 +126,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; - 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) { @@ -144,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 Tue Sep 5 23:15:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 720336 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 6E423CCF9E1 for ; Tue, 5 Sep 2023 23:16:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235045AbjIEXQa (ORCPT ); Tue, 5 Sep 2023 19:16:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231845AbjIEXQ2 (ORCPT ); Tue, 5 Sep 2023 19:16:28 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46B71CC7 for ; Tue, 5 Sep 2023 16:16:23 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 385MtYnB023760; Tue, 5 Sep 2023 23:16:12 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=rbTP4okj08h1Wb//0gKjfzNlketfL6wYAWy3bauGxXs=; b=DLx/Yb2S1KDqPIRNcO9VwGf25cfAQcGYMPviW9gsLJ5Z5SnjE2nHd1Px2y23EhFnkVqI r2J1rkDAvXjC93Kx+Uf9FUoU2cKBE0yuFishVWvgFaa8C62KlXUpkouUbR6ssYI8uG+t Hkr/sGDZqGE1VRokGa5nNQg4phoTDFAP9xALPMGEzo2fkYEfDn72ummGcSBnRzsenUbp G3AmtaKN05qhSvYz3E9kxfGVd6HhR/R9YRumjiHl4iY5LxqbXfoLRao4VhICW0CX4SUY xBxBXbP++CA9ArejdIXVGN+nSak/EUpY2ihFUQnkvuCDeelIEXPY52wW0wRqRV51Ng4O hA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxdhg817w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:12 +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 385MW4Mb028145; Tue, 5 Sep 2023 23:16:11 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5e3fj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VArRCZrRQbaLAtbMCAWDQDZdcqNL4YHAhUPmOY9D7O1x+dUjBnw/lLZ8m6pv2OKPHJAfZs55YCdScAY9NsTpSGyxpqS/UXlwoZtA4Axviv193wP2JaDkQ7BSE3/nQ8bYoFnitBH7x0F13MBYpO6QgVypaxZhQr6JzMYUejGT2gm6bHWujufGCufOlcYhTILvZthWcy45vIsFVGTSvRDHJTatk1H5M7k/9LiQpzBEhL/rHuF7m4416yRQt8sc7KOnqX8cNQTVpBz4OUMCOu9fXn39fj7238Lf2rtXXDIuEz+fkCl5j49SfmfEtC643XbvCxQQMFpHqm+slR7Z7hjYqw== 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=rbTP4okj08h1Wb//0gKjfzNlketfL6wYAWy3bauGxXs=; b=et3nmb+uKOIn3WnMEMFndwGVT178rJY3Il48jpN+4PrFoU3YecRCwcew393bfho1SiPNuQ4fWWlRfajKe2K/Q40V5v5wR8Qidjpv5izMaY+gk5D91stFUpCDOEFqAQXDv3vfxcFnJ9pOq+4Vm1+qWnXYhawidXWWJ5FJyzHsgH9XtueIknxsFflRPjQ36TIiMKMO7IPRfA6aOxAZYM/iaR521vBsNjG8EC0Sc0JI/WNoqGJ/CprKXSyZsjKrdObIf/qD+cxjYqfu8ZFG7wD7CGCr4gxS+9cuJiYaaL/Q/eV8LMJXilbQUW+ediDoV2tuNRRVsXFc4LVE0BYU4ttIhQ== 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=rbTP4okj08h1Wb//0gKjfzNlketfL6wYAWy3bauGxXs=; b=wuRCfeYKj0VMQU1WzzxLi4hJ8Vvu64EQDPo8QYBPIDDNYEkxCSOS63msbE9D8PJTCtdwlfQxPamZFmF91pSqdRgWD65A+meL3BRES31KnG63F6EO/zCaCqhCRvTB+jE8iFJ1iF1c492OsWnrNxWO+Gg5JEV6vQdYWqkGBJXoI3c= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM4PR10MB6109.namprd10.prod.outlook.com (2603:10b6:8:b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:09 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:09 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 13/34] scsi: rdac: Fix send_mode_select retry handling Date: Tue, 5 Sep 2023 18:15:26 -0500 Message-Id: <20230905231547.83945-14-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0080.namprd02.prod.outlook.com (2603:10b6:5:1f4::21) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM4PR10MB6109:EE_ X-MS-Office365-Filtering-Correlation-Id: 5a4f3630-d164-4311-e5d2-08dbae6616cc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SqbuYd6VQkTd/8VhTRJjx3T7e7Sui6eFSTmgeX9Ja2dGmGpaWK1WbadrG9ZrJ41x5YT1LwTDoVEUiaMDMgUVnRsi0xrpwzNjiN+kfsHj3pu2HS66uuiUz8PJ9EjwU/xRh1SYUbGRKaKdIB0YXF7NgIyPvnctxIfdWxjjiGl/zxZJExn9xJetWAN5nBj0vJ5TTXsu7HN2zqNlih5XijF28NQwbTF8XRo9KYKaKBJe1Ur5mNcnnU8xfEK5dUfdul+x+y2znSLuTaT9W5ruDNkLUzqIBRzGW7PUOnh3SyNXKPJrhUPJUZ0gQT+7Jo3p8KMkBakfbt5F00EXpdUHbySkMEyTWjoMtT+WrcV5MH9FWDH5YFhb2ERNAo3A6VFv+7lWuOq/LvtgPq9xq8MrWUnQV1PRj0JqIaT5x7I4MLcFAi5MIb5SP/otGfAKk+ikalpI8sU5JmZfMhWWDDBypKksCbf2UQUohagjRpnBDA0ffIsFbmNps0ag3tH1xHa1dRosDGm/3Acl5c7sZYPBn6nMGfZVYWOU+GvJl13AQk4ZxEm8HQwtg7ty2c0Awai7/zbe X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(376002)(136003)(346002)(186009)(451199024)(1800799009)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(316002)(66476007)(107886003)(66946007)(66556008)(8936002)(4326008)(8676002)(1076003)(2616005)(478600001)(6666004)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1zkBgBwDQcDkf8ofuYKZxppHGN8Ud83hNXSVD/2fu/dWztZp57N2qxrFVr1nk/uOZ3apohmcEMrL/rqWDINCVd85xTsQr2wljxdPB2tvUfm714yzCTcxaCpIqX+hJ2jWSOVGwnQi8Eq6tdLgaQyioFS+/4BOCJiMAGLp8i2qdZILujEnUXeiOzdV+GjfgwIF1QFlDHL3Amj1yNP6Dx8VOmcAO/iK9uRwCEDlEUmIXe4OXG4y5C4hRdufal4mTJTqPtJG1d4+rXUB18fc1p6J3s1R6UCUn8Oq+DC0n+Tx6/VA5xzQa1dtPe1Ecz653MKucK8HRBf3aZ1YMi0J72eBDJpdhJlkz70BjPfcppPPx8/BShcWYTuirYqia9Pn6q+D/2Ls1jC3sFZwRwrDzPWKyAtKs7zS014o2dISnmwQdT2RE8izHiD46JwbYjPJe616MG3X0FzJEXE18ZFEhMVcn3lhuYH0qkUq/ww/1ZsIrqaMjvl6VEn76qYMI7C8ToMsVVxAXp1PjprjoBrU4NfROckpb7mXHtLf1CtsMGtUE0jPelcwFFZDEOK4j/xdUPwVyLry8RKkGn49N3rI+Y+Po9RVO7TM82043ME2YMsAPiCVG1kmgGC4CDHypCu4TYSGem8W2cNX3HxlUqkxY395lBiyxHhImK0k4X05kcwkjJ0sdq4NQqaxieQvNl0VZXOClVrbRxG6Abq2CuoMvnd8xb2HPT+SS3EJ9NIJ9Jz0GW2wBDtkphHqeaqV5V+3sN3qZp4ZIlAj9dpVs+gaz3dllZlAWBJtdbsPgLdrsCRD5RJ8Z9zMKCwFVYC8VaTeoj+Jj+HzKMQIU3Iav1qwgS2yVU0pQ1fM/DOS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wFM4vLmNBcoLckIdkSrLyzgcwlRZQQiYGgQNBaoyA9BCzNr+NcsKlbhW/bnre4jDPDjnJ1JYpeOD8ExgKdki45VlvIzIlJrMfGhgKzSEBimJxXUgeCne1G87XOfGNEtjnoobhv7OuJSVXKgHkXMM6m+8R/lxL3w1LvGgbN2oEVsj6PZ6AQ9X3xYnQzLkPcdOVxS1l1ge2q6nvLq7uR4CUnJLMC4lvBkRU0DzC72ezrpFGnRO7VK7K/iToCSmG2zbgyeutfxryLGJ3Ank0U80sVv2urB6/KYVSaQjtnHERAQ/OVPpyNdRtgH8OZnQJpOTIMtLRysK8VLfY8D5OsFlZwhHd9D/H2AZMq2wGG+zwI3+JV9+5bhSdtvdijEIa0HlajmLTZ6h/2pmB84V2pB+oKyB3ZiUrp+NVLRLTMNx6iKTuX4iTCLeGZ+/Tybgvmey0MtAL1EkPzAZdCYxnSPLe8eWZ6iuCvFoOKPhdCQy1qGh4r8zuKYEGiWonGF4MzxgYBbmUAF2TDDmDngzwejG7E1EVQAKI7tt+FOOZCZQS64k4FxSP5aSvfFmQHNWI/47MIBdsBHr+lZ799xJqx3vgK1RV4YTOP3nOfUmolVfgyh7cKwyJCjJHveIebBYhYQKnFW/Dpnwh/ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5a4f3630-d164-4311-e5d2-08dbae6616cc X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:09.6874 (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: EMGXOCE8umGtO5LguIUX50/6nNH1nhs4KutQymNKWWzNvlFJEplpbCV9q9YmMom3ffmLMnfXEjz4gc2d63eMqbA2KYMOxzS8EjbpULqtGbs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6109 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 phishscore=0 bulkscore=0 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: gk4Y5Dy-9OE_JBD-mVLbr9R_v7xt3Ocq X-Proofpoint-ORIG-GUID: gk4Y5Dy-9OE_JBD-mVLbr9R_v7xt3Ocq Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If send_mode_select retries scsi_execute_cmd it will leave err set to SCSI_DH_RETRY/SCSI_DH_IMM_RETRY. If on the retry, the command is successful, then SCSI_DH_RETRY/SCSI_DH_IMM_RETRY will be returned to the scsi_dh activation caller. On the retry, we will then detect the previous MODE SELECT had worked, and so we will return success. This patch has us return the correct return value, so we can avoid the extra scsi_dh activation call and to avoid failures if the caller had hit its activation retry limit and does not end up retrying. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck --- drivers/scsi/device_handler/scsi_dh_rdac.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index c5538645057a..b65586d6649c 100644 --- a/drivers/scsi/device_handler/scsi_dh_rdac.c +++ b/drivers/scsi/device_handler/scsi_dh_rdac.c @@ -530,7 +530,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, retry_cnt = RDAC_RETRY_COUNT; struct rdac_queue_data *tmp, *qdata; LIST_HEAD(list); unsigned char cdb[MAX_COMMAND_SIZE]; @@ -558,20 +558,20 @@ 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)) { + if (!scsi_execute_cmd(sdev, cdb, opf, &h->ctlr->mode_select, data_size, + RDAC_TIMEOUT * HZ, RDAC_RETRIES, &exec_args)) { + h->state = RDAC_STATE_ACTIVE; + RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " + "MODE_SELECT completed", + (char *) h->ctlr->array_name, h->ctlr->index); + err = SCSI_DH_OK; + } else { err = mode_select_handle_sense(sdev, &sshdr); if (err == SCSI_DH_RETRY && retry_cnt--) goto retry; if (err == SCSI_DH_IMM_RETRY) goto retry; } - if (err == SCSI_DH_OK) { - h->state = RDAC_STATE_ACTIVE; - RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " - "MODE_SELECT completed", - (char *) h->ctlr->array_name, h->ctlr->index); - } list_for_each_entry_safe(qdata, tmp, &list, entry) { list_del(&qdata->entry); From patchwork Tue Sep 5 23:15:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 721432 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 64891CCF9E0 for ; Tue, 5 Sep 2023 23:17:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235568AbjIEXR3 (ORCPT ); Tue, 5 Sep 2023 19:17:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231845AbjIEXR0 (ORCPT ); Tue, 5 Sep 2023 19:17:26 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05B45199 for ; Tue, 5 Sep 2023 16:17:23 -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 385MteJt029120; Tue, 5 Sep 2023 23:16:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=ZRrng6kE3x/+8bDvCiVbmSBAYbA8WdwHT2oUwWBHcuc=; b=sgvjdsz3XgrEbmsSc6RebFzBzqe5VQpRjunBhBXECFqIii+coeo/zI210U82BkQ5pxb4 zdssR/eESPKt4rM6YFGor2zuAa3k4UqSckF93TdPNRHepnq2CrZuevK0Tl2IKHYtr4cv fVu6ts0y2MTbAq/edfmZImulkUqAhUoaaNah+edQJ5BLi+59womKPq891fGAjk9fBiN6 IVemRIyy8RtwJDPr61BSB1qQuHI+CVL2tH0TtCfPuz/lAeahJC8X5bzWMiVbPmnMiyJA Xd9vGzMl6fPmwzY3zrDr7KuAPP00+oJD6P+USGF5xHCAlbzRphz3DyfjsAfJdsWOGeXJ 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 3sxdj500vu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:14 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 385LeulI006539; Tue, 5 Sep 2023 23:16:13 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2175.outbound.protection.outlook.com [104.47.56.175]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5x05a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NXoGH0JmLzxtTLYYbvcu/YC3g6aIrO9+Tov/wa/mAR3OFmN8P3p3YZbn6VOA8y/z4saIXQ61ke2aCPWj0u81iYJn3YU/RvTLfbI4KzgUSfwOQtNW0UlJFOnDsDdv0GVKZY8bLjV9RKT08/0CCjSaV6aTUxQ88gHf16Or+GU4MmppmJvdlDFiLzNupPyTawT4lHe2H9OXKv3t/zobvp4RmgVdcdcBm3syjtTOasFfrZuROIYkOP9QFu35/sehnjO1meRo/x3Xq0LUaR/IRMlF1xQYAaJas5/r7ciJqq03KhzCZyS2g3iNvYsl6Rvq9kaWAKhn4fXRUQJw2b77kYMHbQ== 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=ZRrng6kE3x/+8bDvCiVbmSBAYbA8WdwHT2oUwWBHcuc=; b=F2hfGmno98Pq6L1kgOmM7azZgGjIebjV6Klx94w+qFrsqJomifQwlkDmF0dKQnDYvbs0xG594PSLehnzQzK5LS2tXzo4xF3/a+TOhHz/Gzt/XSNxoAzj4vrlW/cUjFSzkCvW1APLHHonXaO27DA1/e3d2MTlZ3s3i9g23EWIDs8OeXHfW5V0HnzOqfNmlHKIcuVz5ncCJXAzkvq5M+RtMVHHhvf6JFW7JQAeD8Vb0eaTgEHPWc97ElVhirSq1U6ETKKMuqE8btGs4i3y2Ib6Repqp1U/UjX4DoGM18NeOSx25+66Xpd3zTw2xDDfqPGCP2CD7s9eDEfzgNLVEJG7kA== 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=ZRrng6kE3x/+8bDvCiVbmSBAYbA8WdwHT2oUwWBHcuc=; b=pnO7XN/H2EtWyhuJ5ssLI4h/XDuAntfzqnWa3badbOQiHRj+sK9VgpBj7BIXlxIKQPMkoakhW4Xfg7bc7TJ2+HYvHNo+pmNIqBUoCbsXCb2xuT2pltRnEtUUJoq875VhvAafplMHm+znZJWqHl1nI3HAeS+ojBYDWJIy3PVw4sE= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM4PR10MB6109.namprd10.prod.outlook.com (2603:10b6:8:b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:11 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:11 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 14/34] scsi: rdac: Fix sshdr use Date: Tue, 5 Sep 2023 18:15:27 -0500 Message-Id: <20230905231547.83945-15-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0079.namprd02.prod.outlook.com (2603:10b6:5:1f4::20) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM4PR10MB6109:EE_ X-MS-Office365-Filtering-Correlation-Id: de550740-131b-4424-57b2-08dbae6617da X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SEZMFqxpWpUO+0jTKWdkGauXnvYaMHx05J+0LVPan6/PIgUx4iTi24pl2TpzwbScjeJcKoeFRVMuEu54WBseY7zwKmTSi5I6yn3nlRpmVkBZpskHdxwdYGZvJys/wzHkbO4KF8z1DvpTf+IKDCe50uj93MGVriL/Fn6CxyzYhV3246KVLoBGOEjIGcMvfV3lh4B7qsOj2BdmJQA4rk3x3T4VXMJjZXmHMJzL8Uw6tUnwEl5XLtdYDsZEb5L0cF8ZKFMZN7cXURdNY+ypZ9owjhunEmj51CKUBNqo0EwGl6G3PGYoO7QE/6sMVNmleBYyDaPmCXOvc70DpI4aQU/9nhwDFsMPtmPXzBlY0DjUWCY2zByaSLR8J+9Pble+9HeY+OXDjATLjKZK2+KxnbN3u8SpcJOijaYhWdsFHmZOnsK/Osy30lWjuHPUC1vUHddfxWq9TD5D9JLUeeRy6RVl8JFTFwgOl/XtAydZuYrvKYoOQruff5+vSqLARboZ7zadxFn82bxGx8+LQDTfuchfI/LrkUaAtBXszE8DZvza4rmKhcpJmIJFQhJGyDacEFp5 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(376002)(136003)(346002)(186009)(451199024)(1800799009)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(316002)(66476007)(107886003)(66946007)(66556008)(8936002)(4326008)(8676002)(1076003)(2616005)(478600001)(6666004)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MoBm+UfsRBiKxtxfyf4/mN2i4xRF5kcH1hdO5w7CMEhSoPdGtPFiEVaHiazZ95kq+F+vHwPYlDhvumfZBsjXRsJ/FZZcMgg08ma6ltmX7qDviEbXaE6k2CplmMZY0GJ6N8w0YzSgMz6la5nsrJ41D2XoBH9BKs0QxLQdU/ZaLH5/mRTar7O/q7BiDR0hvhwLF6CQ8BB9cH/BLtZiz9Myof4wVrPUWafOU762QZ6KBLViApMuKa6azIpjyGfAdUihw14TpZ6vjd/dNK6zuG7FveQVTNi4uzYF2O9S64OCBXgj918y9MHxApKKafRTz5zDdT1ATt+18KFLyO2s351QQ7A9JIwoIvp4noGuGqqda2Ear1tEqcSJYmEAMP4ObXjcyFRIHyaeQsX9lH6lhigv+1HME2AV9kwdHiiw4QEZGsAER/bbB+Zn7NSD1uq26pKODag3IP94K2QxxEOk9GCMijZOEiwgaJDvTAEaEGQf5mpeBlG54q/PlcyNpUiiEwoegkaQkU3bgvgcnerhCe5EzUEL5bGQd7jO4/xuINygr5zQGnV0rIh10EtyS+vh2W9Zwd2/wIuNdwLuSPu1nLiFjosKF+pVNZeqCKCiCMInnEm6QdVlgwwdGxvueFak66cphS41CHbeTVONAit8Xz427SD/BSul4xDUy+6EY43e89lU6jlk6sN5Xnu3sroJQL5Te2glgLlyiA8AcNRjfmYSC4t1cS1SG5IgvB5UWfQbrJoWeW6GCZsG/ZO+UdYcTUf8Z4jOsscRF5KR8ObITjTCaJ/a+CKja+gUUiXoqbHKsZ0FuiPK6gfiYm5CldyOd9P7zFDzUSu52IB/Sxsr73mwokwJKMdMg2GS+xPbyHYIik2svq0M5HWAOVRNyG4WmrhBtpNOhScVvYNSLf1q77XcgDBUoHFFwa0ikWra9rE8+3UbKeplzE5BI30DXvy+i3LMAAdDLvyaow5CBc80XlH+IiCLpl4XUd1QUPwaAx6FcL4lMhZXizH2uM+ampJIdNc2xX8Wogoq69/y06RtAfufSHrdB4V97DaElzxNidyNORvTunNR4sVsZdd60qsz7AYy8aH5fVYWLzeq0wNicEqRSCyHXadEIoMQ5laHGTHdHd6byUyEkYR7NI4cSoGH5LdL5V69KcYNIxSu/rIU468pwqvGpd2E/HYe1Xwe+jVJjqjOjPfeL3dYT5lcKy/pcUTwta5cvPZMaYDD+kyWR75tuuN8oBQc/GcedHO1i/o4Hw2zKP6j12AnFcssS7+tEQ5vG64yUfN8Q4A/5hH/wGdSK6JtS6FXIBTirwn8FGI/4TQVrwjnIfcLQP0Zr2yYQv17PvfLDaTdAW9902u1QX/duCqa/LRl2evO8mmJSXvECXgO+3C3hW51LLuGGER45zR3o6pkY9ho+6UxesUvinCWe0FQaBgRu1sIUqBx4aMfRGIcTAr8AD3VCI668r58j0C5EtTkukWxldbN6mol/70I/ocEe4Pv+STMyEqsNmaKxbE/SkR+20wO5UG2huZ5UWvXGRIAAiLQ2Co8bIsG+UytdS73sNJagZ9AvzayxhVCef8PP6dZ8rLCMdVarScn6QIVp2dB573UywPQuEKpjayL3g== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Y6DUT6h0oqxPRyRO06FTxtLdw40E8JWBzB9D3zi5DQ97onjUn7qj7hZVSaUSVi02Vo1oSbYJkWoHKQZJJKz3xHFeW6+et4rtf77Ay40jrhMX2fb2bUDZx0BMlL7wfQpLqTS6SL1nDguSBkiQnMUDXhW6gLVSCXHdbEWHOQ6a9uhTNm0Kb8Ei4XWi9yHS27SIfSK4W35++EZ1YGLAgaifVcOom+fpDdPz7yzzsV5jcgSq6/GWjZ5onADV/VcbxrDDygh+HyiwstalakNiCYnSTH0Xg8Zu57HSvnGnpj5/QgnmC1lwPQXzSFeB74gNgJstWwH+en3V5XIAlNffVuRSbz9QqHy4V3g+pu7nNP5iuczv6VBPYoRtF7FXGhJaTyIkcvhhmWCO0YMVld8TX5+x2r1GLwtpeLAvVai5TficzG4FtWN9Fq/0UTHmQFMmwT6pdrsuT7ruPKtSA2VExdm9m9BI/viVSNQmrO5sIVzNQLWVT8r+lnWDmdywmT+3du04Yzha2RXsK7i6gKy2J/1lTasBzBtBKFhk/a6xcDfzhesiPv3+dpvXVBnYhY8P141YrvTUKkKfd9t4RXdXz92A1QycnblRh0LVxe2q/hSV4AXOrB0VMb9/EW+EiHUlvW+u5hnLvSdKKU8ny++0dQh6N2YYhoI2oxrAW4/m+UIC80nkjypt0ft+jAFrWnA7QN2bavSSAG21jwKv9ulH99PWMuiGtHCjRvR+D7Bej60EJqdL1D+WyFbdQ958KDKuP+oXCdpKqmIWi5kqua6uaGOs0uZ1ERYLQW+f4ezhfArtVpjNjX8kt4/LmJBXoAF6rI/YzLRoyHrfowGZyoISK/xvHHgAtJT86S/sd4j9hzf08GEzv6caV6dfAfFIf0HIG/CF X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: de550740-131b-4424-57b2-08dbae6617da X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:11.4552 (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: epxPhzeCf7Wy200mLI+wz2pY10+sp1FOzTh6ExU45WLwsXMyaPArtq8zCJhklfauVFGyiuuhkrBVQLH9A3dNV8loVg4cxTGsTvL+0OE9lUk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6109 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 bulkscore=0 adultscore=0 suspectscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: Nn17VwxV9ob-uN4Ir2VKMmLH0c13cmth X-Proofpoint-ORIG-GUID: Nn17VwxV9ob-uN4Ir2VKMmLH0c13cmth Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0, it doesn't initialize the sshdr, so we shouldn't access the sshdr. If it returns 0, then the cmd executed successfully, so there is no need to check the sshdr. This has us access the sshdr when we get a return value > 0. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Martin Wilck --- drivers/scsi/device_handler/scsi_dh_rdac.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index b65586d6649c..1ac2ae17e8be 100644 --- a/drivers/scsi/device_handler/scsi_dh_rdac.c +++ b/drivers/scsi/device_handler/scsi_dh_rdac.c @@ -530,7 +530,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, retry_cnt = RDAC_RETRY_COUNT; + int rc, err, retry_cnt = RDAC_RETRY_COUNT; struct rdac_queue_data *tmp, *qdata; LIST_HEAD(list); unsigned char cdb[MAX_COMMAND_SIZE]; @@ -558,13 +558,16 @@ 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) { h->state = RDAC_STATE_ACTIVE; RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " "MODE_SELECT completed", (char *) h->ctlr->array_name, h->ctlr->index); err = SCSI_DH_OK; + } else if (rc < 0) { + err = SCSI_DH_IO; } else { err = mode_select_handle_sense(sdev, &sshdr); if (err == SCSI_DH_RETRY && retry_cnt--) From patchwork Tue Sep 5 23:15:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 720323 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 5EE4BCCF9E4 for ; Tue, 5 Sep 2023 23:24:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233331AbjIEXYq (ORCPT ); Tue, 5 Sep 2023 19:24:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232289AbjIEXYn (ORCPT ); Tue, 5 Sep 2023 19:24:43 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57EAE9E for ; Tue, 5 Sep 2023 16:24:40 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 385MtYoC023760; Tue, 5 Sep 2023 23:22:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=3sItpe9tMgXHLHTtVj7AIKCj7FEZrKMfHsvU7ofWqxs=; b=vmurvnikF3JvlNu4N+5pyWZOy0aEjS654RjWS55Mvue5tIzppxMOrfTg2T0PpTViHvFe f8ks6usf7jC370A1TmW0YgQRkbubqLL7tuNmV6/EUa2mEUlq8MPi5TqQU/OMV1iubroO fpPvONVrP3TjtKoF8QnUxtJxP78C7THmOY9+hAsspHYGOGo+D054ykwnAiITdIfoATdM o0QO1viAKHTLVQxbJhJlCmUiHNj+ZY2ayNt5AYfMWgbpMdFWOTRqr2KiqRpOByBi6B9u LMvKyG6vpyLmSVt3uo7/zVVOjlP4N5l2GTmPhYsL0Mek/79Exj4aC3zdPb1SfJ7PelxX 8Q== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxdhg81jq-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:22:07 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 385MRBCx010380; Tue, 5 Sep 2023 23:16:15 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2169.outbound.protection.outlook.com [104.47.56.169]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3suugbp2us-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aBlV/I7CPZM+iyYzEyi3vNFtNg8XBr4itLpTnajkbP80jjobaN/CJuWfnzejHIJOk0paFAG1TA53zfGlpEh5wwO3GiT4kR6cwmKsTIO/arfbsC5uNs+sM2exFj2RhGbT71pkRhYWMBV1omTb4EdNIYdRuWXLY+Mqopkr8yJ9Aw5COhRKR9T0zt88kdTBetsnxgmJ1Q25u1B8/rlcFkKSGleArFd3WtiTFnfRaN7sw4INJ1cSrqttB7XjtyolprQwEfcIBJ1+nk1/LGlVAXc2zWm5xxP9nKqBV9xDnEN+jiPmcoYAmIR3T/LKBud1c7uMzc1f37H9iAvdvUHKwYwe9g== 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=3sItpe9tMgXHLHTtVj7AIKCj7FEZrKMfHsvU7ofWqxs=; b=mn2Igpc0U+lgP5ntZgAe8VCGI0pPXVC4UZ+bgpQ3P3mTxF2hrAOnFzo3zUb9c0Zr6twG2ytlSf675M2yAXKy2q7Avgb0XMqjZ0La83W2JgsZlq/m7rw71mf4ygeZ6pr2drtSC0FcCMYLC+XFFnsGikYCLCK92HDEPRLHrqceJOd97a8rShMInmqiW3vqvAF1B6zK821/MRhdBjtHPZlOyeGY+pxY3wceCSZ9JOBwlP0XfC0IhGemYnDEEF2P+YTO6/SoEfP8CgRAfDusClPLCa7FkwLUFdAIiuAwhrzAgbK0nFdQuaCqm3hh+ZSGjXNpjY1zBR5MI0C0Ze6QmFiH6Q== 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=3sItpe9tMgXHLHTtVj7AIKCj7FEZrKMfHsvU7ofWqxs=; b=BRzeQC5rODqHhpGljcZLHJkKjyHkZ2ZxE9ryg7Xb/uga6NacCA9MHcHJgxC//DJImfCJTWKFzFXBS5HkftWgESwGRpn8Z61TAchrY0yklY5ElNOHEKB1ew0rkfc8Iv8JZrdoR5oOdhPZHKwV2GBzglWnZYiMS4eGzJBUquEwpBA= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM4PR10MB6109.namprd10.prod.outlook.com (2603:10b6:8:b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:13 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:13 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 15/34] scsi: rdac: Have scsi-ml retry send_mode_select errors Date: Tue, 5 Sep 2023 18:15:28 -0500 Message-Id: <20230905231547.83945-16-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DS0PR17CA0018.namprd17.prod.outlook.com (2603:10b6:8:191::18) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM4PR10MB6109:EE_ X-MS-Office365-Filtering-Correlation-Id: 7cfb5f71-9fd3-4e5b-0553-08dbae6618c4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sUGDJiFLe9htsChBoaVhsAmIOmaGN1SHk+bC86FwKXkmg1ePDED/6h3YssJDPsALb8/dlX9n6dVq1I17ZvMQXJ2MEa0drhN1V4DMHuVn1hG3zX/FUtCTUIwMNYbXf+2nDdo/pIZpNCIr1zQ8H27MIMxJCxE+ZDgZ15zOAnxO95UOU1IoeZwaO3cUKtQ8yT5dbAT4rW5O//8Z9Pvtp7wmn6kstxMFVpLMrzzLq8SGOQw7GG3VE3/S+yGjEO67MHUnVUgGdnboDF/fvo5cNXVZmVOMbIWvL6shKVLscDNYmRRWY2EcsK2Nd8wM7I9Kf67OlEZn5kitPC5AEGNP/JcTT0JHLiSXQodYQ9cGyv2lkhO4uwiPgVvYNpW1E4RqQgZP/CvHOlokg4Jk/7sKCTB5pB8B13/rzBaCcslPj2S1MCIk95rKByFAdC4XpIA1aS4tGPgjgT0hzkOpfPJVYq3lpit+icDWluNO+FntkO/CHG50JpZoy1KmTTRvlH5A7Y9HLZhSc23TDsZMFHNOMe0Jpj02caNLNfR4Di7K+U0ZVpnCTbEIn0snu2YbDnu21qA/ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(376002)(136003)(346002)(186009)(451199024)(1800799009)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(316002)(66476007)(107886003)(66946007)(66556008)(8936002)(4326008)(8676002)(1076003)(2616005)(478600001)(6666004)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MCElSMeXLiyjtV5E4cLswDEwj8xzeT4Q2bInvvj+vrNuOTw4ZbuKB+BBYltv09iVqfAJi+kYxCHyS5/llemcNti5NH3gjj77p1eb/RfoAQ8lZxLxC0bjZPyHsAmBcm2Ml4Um4Fgki+cpm/lMJGBTuZyK+bjq5lRsUywuYpu2AaFtQbZX6I/8boBfuSsBejOPzkxw9iXfTw95ecBN+pcJQvKRnKD9MInE70dqb3H1PI+zIFxhte179HENTTlyVzk7S284IE3XpHUeP8Z3FVNwvqZV69TzzlwoVCgJJzzmo0NKmcMsLZORM6QSf99iSIgMHRdQU29iPdx0Dix7TjAaDBGJT1qWQN/hQtNoYuUA9chOhdDUcepXlJMbNL1E5qAOlY8CTyXwjddN3MhFHayd2hUTFdPodHU+Aadd06qv5a8nygQ3o69LOSkBhjsUhtnXppvJ6ToUJNKfG7ntWv6a5LWP5gQQ2PJn/H3pLlFjD3hqbeyYaJgbkoe/4GC8dQD462NdnDzSScdZRxcvRiBONxy0/GJeSOUD7RRyjfjduP3YM57HQ+L3daqRSkpzGvFmjib/zCBOxHrMBzB1dFGNKTNW9SQJ+8xffmluBNOM/z/p4GMdfwmxcf+BS8/cXA5gGhGduYK09FuDGI79MP1x3nKn89f/wkIVyZzANA35/4X0NUYK3qrcpYgP4w/c5qvANz0su0ypD5jydBME3yWv06kBVASOPfoZFKJG0T2EW2qC4j/mys/QOFYZLQYREBJBV7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V/aEGPklVyZxF6Yy4AuDU/3338yQHSw5EJrDEFpZrWaHPK6UaIRqIWO0c/caAsDmIf8IxlqkLWhTNNYkZVZer72yoEysRwjtkb27bDfcuVgbgQfvwKgq4fXmdZ+FDf2wJK0OvHKVq2laS14RQfxB7e5TxG2ZPihN+owAQ17g2Kb4Gq64iODGSzovGwvQ0Yi8zvQGMb9+1K8zqlsdUFj7mZfIr/lIwHVLFV8YLJdzcgeA+6JHHpi3SVK4AJ0T7uAzuM6RM9ZqpkOeCI0Cm2MDI3hBZ6zK1WOqdiETT9MOwdJshAUnGYpxNXe4gob9nglDwZjGyXSGq1oYrdhyr9tF5DX5mLVCwD9etGRU8iO0HjVOHYGAd6o+l7HyZMtyCdkt9x3HEfokPao2R1BM+xSzleT2Dz208bNJ05NfJVUvuG5dZPQ6imnX9xWJ2TVkgJojRbN/BHkYl2ZxtlmYjL220MyAIauw8u4uzCzS5nlcsySpbPGXnor+I8cAOGyiDWlzX74L2CGsPUbOBgP7EftIufA7YD5hHhK3cfyVqGHvCenoQhChMxBKNHMuMDE8bRz30B5x0sEQmHy9CYfeud6OUJ3yxgMX8aMvwwmstLXd4hdEOd1zt3wcZl9RyzSpU9Vu/w5rw9m1MyK+T3AXf5X5nD2J1tf+dK99Gj6jjxLn6c8nyPb1tiFk19ulmmbMBYSSlMn2JjEmHihd+uZ5VAZORBTvUul++Mk2EU2F1p7EvURuK4 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7cfb5f71-9fd3-4e5b-0553-08dbae6618c4 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:12.9783 (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: 7grWOJ96qxf+y2URS5lWcxZUxj58Bx4ZKOg2kmfkn4M/Ok4lhLuq8WN+g+s6zW8gZ3gYFToqmJs13KNUUpifyoj2KKNYZRUzTUkihmuqvyo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6109 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: _XDWEO3gONYDz9zJROBj9StadHXVAlOQ X-Proofpoint-ORIG-GUID: _XDWEO3gONYDz9zJROBj9StadHXVAlOQ 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 | 87 ++++++++++++---------- 1 file changed, 49 insertions(+), 38 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index 1ac2ae17e8be..771108a332cb 100644 --- a/drivers/scsi/device_handler/scsi_dh_rdac.c +++ b/drivers/scsi/device_handler/scsi_dh_rdac.c @@ -485,43 +485,17 @@ static int set_mode_select(struct scsi_device *sdev, struct rdac_dh_data *h) static int mode_select_handle_sense(struct scsi_device *sdev, struct scsi_sense_hdr *sense_hdr) { - int err = SCSI_DH_IO; struct rdac_dh_data *h = sdev->handler_data; if (!scsi_sense_valid(sense_hdr)) - goto done; - - switch (sense_hdr->sense_key) { - case NO_SENSE: - case ABORTED_COMMAND: - case UNIT_ATTENTION: - err = SCSI_DH_RETRY; - break; - case NOT_READY: - if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x01) - /* LUN Not Ready and is in the Process of Becoming - * Ready - */ - err = SCSI_DH_RETRY; - break; - case ILLEGAL_REQUEST: - if (sense_hdr->asc == 0x91 && sense_hdr->ascq == 0x36) - /* - * Command Lock contention - */ - err = SCSI_DH_IMM_RETRY; - break; - default: - break; - } + return SCSI_DH_IO; RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " "MODE_SELECT returned with sense %02x/%02x/%02x", (char *) h->ctlr->array_name, h->ctlr->index, sense_hdr->sense_key, sense_hdr->asc, sense_hdr->ascq); -done: - return err; + return SCSI_DH_IO; } static void send_mode_select(struct work_struct *work) @@ -530,7 +504,7 @@ static void send_mode_select(struct work_struct *work) container_of(work, struct rdac_controller, ms_work); struct scsi_device *sdev = ctlr->ms_sdev; struct rdac_dh_data *h = sdev->handler_data; - int rc, err, retry_cnt = RDAC_RETRY_COUNT; + int rc, err; struct rdac_queue_data *tmp, *qdata; LIST_HEAD(list); unsigned char cdb[MAX_COMMAND_SIZE]; @@ -538,8 +512,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, }; spin_lock(&ctlr->ms_lock); @@ -548,15 +566,12 @@ static void send_mode_select(struct work_struct *work) ctlr->ms_sdev = NULL; spin_unlock(&ctlr->ms_lock); - retry: memset(cdb, 0, sizeof(cdb)); data_size = rdac_failover_get(ctlr, &list, cdb); - RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " - "%s MODE_SELECT command", - (char *) h->ctlr->array_name, h->ctlr->index, - (retry_cnt == RDAC_RETRY_COUNT) ? "queueing" : "retrying"); + RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, queueingMODE_SELECT command", + (char *) h->ctlr->array_name, h->ctlr->index); rc = scsi_execute_cmd(sdev, cdb, opf, &h->ctlr->mode_select, data_size, RDAC_TIMEOUT * HZ, RDAC_RETRIES, &exec_args); @@ -570,10 +585,6 @@ static void send_mode_select(struct work_struct *work) err = SCSI_DH_IO; } else { err = mode_select_handle_sense(sdev, &sshdr); - if (err == SCSI_DH_RETRY && retry_cnt--) - goto retry; - if (err == SCSI_DH_IMM_RETRY) - goto retry; } list_for_each_entry_safe(qdata, tmp, &list, entry) { From patchwork Tue Sep 5 23:15:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 721433 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 1F041CCF9E1 for ; Tue, 5 Sep 2023 23:16:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240226AbjIEXQg (ORCPT ); Tue, 5 Sep 2023 19:16:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238791AbjIEXQf (ORCPT ); Tue, 5 Sep 2023 19:16:35 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93FFD1B6 for ; Tue, 5 Sep 2023 16:16:31 -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 385N9cOR017994; Tue, 5 Sep 2023 23:16:24 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=m/6W3UbOmyxMJyuAbyICvD06uJId5s72vY2s/0gkdS4=; b=ipmGERXzNyux/cNQbi2BiWSGUGvkqdJLde/7uB5uAqlE987WOcxHRFYhXv50JUZgf/b6 x+GS6fZvuhf4hR9hjHSW6cOzjpW2zqmGPyZqqzEia1gusu1RgOWrL11pnpJK7AH/yM5n OJ2KyF7HFure5/aeuK1xYYPHcMyJxepZY2lWpg2MyqZJAq92Ssk6hdCQnW7WdhGvxEO/ h5DlGk5ZPNzfKFlXxop2aeunVSOe6H4RwOFp+djdLjN2pdMu1cpszwiHOoYZ4VHTbm1B FkZY4v9EgRrOfHio5+BIA84Sht7k5zMrpk5YIiHuGx9D04UR9I0agQ9viqfX1LYier/i gw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxdrn008x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:23 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 385MTji6029100; Tue, 5 Sep 2023 23:16:22 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5dxtd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bW4M66pEXpXIzi5JbSx6a1nkIkey9tSjncKnfRM0R3FnbNOZiJqzuwmJ2UUHp+T9QV1b2FCaJBLT+T5Q64AOfwauxoBiQ7e/kCvQvoAB3diBXghe4WMG9AmVcxCyX/IcL/qe8T/fyLxzoWFvgDcdCB8PX5226kcq+PEhaP0JRTDgPt5uchAaH12A+6R5nUecwJHdLF7bNvPATovQlmhtKE/BSRKcUdR47a6DHEn5PJ9ejb+ZfowIJbEuPjZFn1Xy8UM0U5wE5vYYh1vMtTA3qdLqUvwVdYkH4i1rGfRCQJTzUfxVNZ+OYZ5+WxbbQQm+teMhBgWn5qJ6I6E2RatFFg== 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=m/6W3UbOmyxMJyuAbyICvD06uJId5s72vY2s/0gkdS4=; b=dsO2fXh7+GasXr9wDehAPeD6RNhw+bihN2F6Vvm2xdhchZplBW9iXCJsC7LNy+QmQpv6cIuEhs6maQm0WEpEJezQ2ZPk824uavr6Idp63kbYFGLMupziHLzHZWwAeKkhxiHWt0IwEWlOuJsMDaqxhmjIiN1GCdRvbFOldYp6Gt91xs8noyTM0R0THBlrPxPB+DEffVjceAjsJB5ly3SaHlDKUpCEhTXIJ4bofrwoeUE607baU7dtcbBy8jY+ZP5hxLneea76S7X/oGh+U0AAj+ExMaUypx8bA1ptDP6J6C4c494hnM7BPu99MUeOChBrVkgJb68yIqoW74C7pzNiRQ== 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=m/6W3UbOmyxMJyuAbyICvD06uJId5s72vY2s/0gkdS4=; b=wn/FoOdMKLYHt3r3e8HEqEB6W90M2IgCZpqXIuSdlB1oB3UkM+7JQhnhroxwu9o3k1tFC7ZY8WbGAyFuwA+gUMIJNoyh5I1FJR+hxBcz7ri4BQPuWSn+mH05MUO8g56HOkbuOY5kO34Cz27Zzrt7Dl4mlKCZCeKN6TF964itPAk= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM4PR10MB6109.namprd10.prod.outlook.com (2603:10b6:8:b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:20 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:20 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 16/34] scsi: spi: Fix sshdr use Date: Tue, 5 Sep 2023 18:15:29 -0500 Message-Id: <20230905231547.83945-17-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR03CA0025.namprd03.prod.outlook.com (2603:10b6:5:40::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_|DM4PR10MB6109:EE_ X-MS-Office365-Filtering-Correlation-Id: 530c2e92-f82d-45c8-2d29-08dbae661d78 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wpZIws3tnCr28qivNDgKdPWhTdHfVnt3qO8gqxBTQwX2KgVfPXcnULBuEA2J55YrZDDkY7Z5gC8UXFh4dTKO4xWki59KCPrGB76DfDe5X8sjwp6OF0VTu7XFzlU0AggtZ8N9W7KhS/XJZYzT4B0bUVRwAdO+fK2DCBvnXqxbuWd25ROJkzWSbLiNb3wOye0kAJYu8m3XIvD3XJqm0JQIULy1HbLbUFCRIFd9oxhEUzp18zfpPSey7co/sY00VXB3GFA3d8Z15weoNVaWhKFlH11beoFQ9000oNFnniADRtSGO347XbrjbvUpq6Cc50qcOLMbBRtxdusXd/SCCk2AMkCHwA0cQeyf5y0Fi5ZE9eiVPSGYpWlYw0OshKfJWbsba9+b8kzgUmFxgdGW6kPOL1YMsBcMX46STLe7zHj0hZ3ZvfbpDKdigqHAuhHulx/o1fstY0waVymEaxGjEnMIC9DkHBW0XsGREKPRxv/OdiJejvNS31RUUYbdY1oqyc9saWMfeA1kn4RWALIb6+AstuImt39VaxCTcRSzmxAW7ESMhj7Fi1hmln2ZjjMqP+/z X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(376002)(136003)(346002)(186009)(451199024)(1800799009)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(316002)(66476007)(107886003)(66946007)(66556008)(8936002)(4326008)(8676002)(1076003)(2616005)(478600001)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5DUI4uhmC7WdRUt2XJHha9kM17pbOtxl/y6dbZBSV5MENI3LLLqC7vXsFOje9+Prh6WwSwqkg7gEHPnuQMb0sGxrNQVLLZPnD3bqGQdppYQr2aydAsZxRf+eLaeWNX+yLkFTS3dw2x3BbCgb/5rV+1lcTVJnnCCWi3jEwDJlvBWq56E/NZgFQQFVtGh4XWbM+eEV3zObtZjYy5OMGrZnUuQ3St6L95EHoaGGAV0nDeldFCj2gNRiEf4gkWrZq0gfd++Tmt7xi2U9hzEAgHdCmDSpjlhuiuDafB9IzCgXR2vZ/VMGOwgHZ/tpbs7qOy4bxvXutsCdm3ofNAmauQ7Ui8806DJhGz94jHoMlevkK0zfGdwuxeulWRTcEltbUiQjNktR+S+Ae8cMSRhhhY2fcNxeuIbshvumG3+3KQ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58aiBTkbH5FTT+/nl6q32kE5yCHn2h X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 530c2e92-f82d-45c8-2d29-08dbae661d78 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:20.8615 (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: pUsODwfXqS/WJ+bFDUcBJfBoS3fHhCaTMeUohKdj2yR5jE69A/bIN7f1FuPHJBOLHZsuwOijcE4tbZLUja3j/XRVwiMjNvmUiObwwlPPwFk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6109 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: 2S1OgNSAadMhYDpD_kuIGgWPAznej7XZ X-Proofpoint-ORIG-GUID: 2S1OgNSAadMhYDpD_kuIGgWPAznej7XZ Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0, it doesn't initialize the sshdr, so we shouldn't access the sshdr. If it returns 0, then the cmd executed successfully, so there is no need to check the sshdr. This has us access the sshdr when we get a return value > 0. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: John Garry Reviewed-by: Martin Wilck --- drivers/scsi/scsi_transport_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index 2442d4d2e3f3..f668c1c0a98f 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -676,10 +676,10 @@ spi_dv_device_echo_buffer(struct scsi_device *sdev, u8 *buffer, for (r = 0; r < retries; r++) { result = spi_execute(sdev, spi_write_buffer, REQ_OP_DRV_OUT, buffer, len, &sshdr); - if(result || !scsi_device_online(sdev)) { + if (result || !scsi_device_online(sdev)) { scsi_device_set_state(sdev, SDEV_QUIESCE); - if (scsi_sense_valid(&sshdr) + if (result > 0 && scsi_sense_valid(&sshdr) && sshdr.sense_key == ILLEGAL_REQUEST /* INVALID FIELD IN CDB */ && sshdr.asc == 0x24 && sshdr.ascq == 0x00) From patchwork Tue Sep 5 23:15:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 720332 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 67977CCF9E2 for ; Tue, 5 Sep 2023 23:17:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241713AbjIEXR4 (ORCPT ); Tue, 5 Sep 2023 19:17:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241210AbjIEXRh (ORCPT ); Tue, 5 Sep 2023 19:17:37 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3656E1B6 for ; Tue, 5 Sep 2023 16:17:34 -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 385MZ2nw003202; Tue, 5 Sep 2023 23:16:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=MBOdNfNlR1Ur03UvMUJT+vwItsUrscoMTfCj/TovQlA=; b=1DEQpXgeFmqQnMXtuRiuB32c5kG07wYLhB/5pjeTm8rKj5xGpHfQf1tsOzPqhbW7hOzj fejFRlLwrVboTqH6XMW5iARG4dcP1sErJBb1PctPLLi2C/n5FundtX27+X7J+HXW8svX YehskKql/TTgBkei0Vp/J7tNcSvo0yTCzN+EJQl52SWTnPVqsTzpWkt51gXWa9aPAlNg aoMLmN7i3gICjey0tvWuaONTKKiZbPSU8iWu1NIBm7JmAnnVITpe/nFDUO0p3XnkxWZu bwyVklTJPKa0A9h+603kyeSefNDeHhwKcBKxftCBnZUAihZFrk/44dnicrNs9CFk/972 Yg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxd8d8202-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:26 +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 385M6wn4007802; Tue, 5 Sep 2023 23:16:24 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2171.outbound.protection.outlook.com [104.47.56.171]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5ext2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NqFXQVBschzCD0KnzzY1PcX2tzsMkhaOk3pf1jP+QpMyOmJvffkLETOMbcSOao5co6nzw0eV3kAHKPB8huhD38lku1f+q9sLDHVcv4JbTcCtC/OJRXu4Nn3AnwJRMLOtEWm8KcwXVPrjNwOr14OvpVAh12tK311Y8TjEeArmmSABlxfCIO1x8SELyGQuj3DazdobPkjS2H7uw/vr0Nsw0CDNRH0LYdVZIJ41P8tJriJzBnvl41ndGAEO9JdhrtIMQUW04WbG+UoEPAQEYJkImZUUlGmvtUkxnPCJm8Rb6yPh4Xl7tS/oWp/NJ0+bRcnB+0ylj6E7MKq0PxT1VExrrw== 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=MBOdNfNlR1Ur03UvMUJT+vwItsUrscoMTfCj/TovQlA=; b=R9M3Fl4cxOlPZeyoBlMUZY0dNvVKDYhH4nz4Uc3FriCDMdb5Z4ykwW1aCO+yOvUVymHBdbsSN/KWRuI/AGHcVR7b/XDT7+Y8jieTNAZ5dlYW75uSRPEK47pwIuJYXZZZFjvCcUbYOafkvHhGdxXDPvoGUXc5HqhIXwWsbAOZYKfWBL8p2oxSXGUbuzfCs6G5JiZ6UsCgsikK+jAtSrZZx+AL2iGs9rPjeUgLSzFwUVFFx4/e25/lPPWFIcLQl7u6VB9k/HzMpNhexu1gCdSgz3amFAWqqK8Jr1ZKjSPZUA4yE6gsQluUZ7vwE7XLr/J9q6ED0YoKBxsUHN42SUAGTA== 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=MBOdNfNlR1Ur03UvMUJT+vwItsUrscoMTfCj/TovQlA=; b=CNdWZQakrqsFUDYvCjsMkyoziiNA6sU5FxY1Wl4Su2vXNnJhqzFoFt6eyRZvnQHqE1CHYpc06kLNs+b/58uIvR/aCwBw005GIFLaxTSKhD8IKNv4RaF23HTVoSQQkVFMTEM2T0kTfE7cjVMTVfiYsD8cC1HsPjdfqUPfMv3Q+rI= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM4PR10MB6109.namprd10.prod.outlook.com (2603:10b6:8:b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:22 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:22 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 17/34] scsi: spi: Have scsi-ml retry spi_execute errors Date: Tue, 5 Sep 2023 18:15:30 -0500 Message-Id: <20230905231547.83945-18-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR06CA0101.namprd06.prod.outlook.com (2603:10b6:5:336::34) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM4PR10MB6109:EE_ X-MS-Office365-Filtering-Correlation-Id: 61a8b775-069a-48bb-01ed-08dbae661e69 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NA38CjJNkgsP1eQitJVvC7q+h3UwXEgygy3gb8Cv7xFAoWBqsMoRzWX5DUOB3WRrhYEqQlvgu3SiXdsJ5Mg4ZOFEDM1kzBxTIL8aX+B5AvJoTG2Rsc3QeVHkG8kv/bwt+BASCDdcLysQFsWMarkPtgu9EvwXbgPjV71gsFFa4LiV/t1//jeZEr/hz1d08jZTYyjUQmeYnYizAYKOV0fpZss8Rk+OInUrCDWEAQvzcceWvKqwBp7g+wFprtn9UKs7Fl8BqwUgx0JrA9JjIXmGh0nhqbbQbrA4p/g2SS5xyPeEwBedLII3vSbOymATMFcatSvdNHtbj+d1k0HSBGPYCkXYPbaTb02/NcZtSU35y/0Q+AKe3urWYaKyIonNJrmlJBQuNvyXWsRCMiGgnfccgRkyznX1Qq3hog2Ql6nx1ztMtCdqLehQmy1V/KpTZMMWWLEelZHwfIGva5rJexfagl33aetnu9jVzyTUdt17+RejuRpe16m8pK9/npBGWSYoTYGfjlTCVkxyrjxDyYCqmK05BvV2JwjLVRo9PqQDNyrP79+qM+tt91EICtbM/Mon X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(376002)(136003)(346002)(186009)(451199024)(1800799009)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(316002)(66476007)(107886003)(66946007)(66556008)(8936002)(4326008)(8676002)(1076003)(2616005)(478600001)(6666004)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VSDv0/g06eCWOBG9CUTI9H1crVlzeh0sk0Zdtdqn8kLwNo19Pcul6Hm3v61TCK2lnMiJKPBfgyVvQmAKe6506iWr3e6U83OGUDkYxfHcUhnoH0QK1sku6lCoqSocdKZ8AnJdQXxCGnZkYrY3uuRJKP5eQKSF2EP4ECgyh7CLzQJCRZwLZme4vn0RCBa1eqzpnlUUvkDOUu4/9xr0WKuFzvRzM3gqEchRBWYO5I/LBrXP6pkQ0/NsaNpKtO6Jsmk5FKE6edXvtkFTBeyZykM8wbLCxc8x4Ie8ga4ra25a3QdL5p9+y8xZWT6F1qfKbZhO22ngIHzbz9QhcBPEBABbamE1Lfdelgi5yysXgXcGmPOwyCgGch9E6Z55GRbUAbAyJlCR4aWlb3cmscHcQZbE/LoJdZdjLs29NxHlvsoJloX/vMMxMMu7RvIOEbfPnOPGyilDlPytAaUXnJC2NE+OkB8RDJuauJgMnPmvfroZ2zNc+UWRiz+ZPDLJ60Bsgdvhd6LqcjE7DrKZTZWy7Y2Ps97FsGEjuEv5H34XZPZj7/aIVeQqs8oLxA9UGF3wkvoxHvR95EBYSeQ0+O0LihWZsq4GccaZwDcTbd96oOrYgfBJMAT0kH/Alk02ffUze0QX29gH2vJQ+qn/jVnFQdTH1i/X+XkylLbhYVefM9aegw07GNpMY6rDYy5wL9ORQFBcAbJwdteTzQPoIVQja+en74uqnnrWTpRiVBnQemfgE5JSXoC3Gq2F+9/spfz7IvaaIanY1xgEOmT5/t/4JOds9WUAhTe1EJuqMGPtuTiHpScI7fIyRzUUf6wXcOWl2RKNrSOKT3eSiPgQJNl+7HcyoIj1ofMDHcE0nxmsKTx4Tj3ibgp1+JzP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YAEpCBXe2ofGmw0CqWZuvs4U7qL2AOwn3oMvqO65tO/yVlReitVjLEt8cpDer9VjKGWN/2qeF2a6K7mSuJIe58bKK7cY/lnMT4IfitqTRW4KExPsRWYDfyOTB5nMvqsy5kQkufs5EkhyAElUS3V7JHHbidaQwwpVKqj8UBYaD7cSBhcEgz1LmTsat7tz3TDzYgCDI3NzYUFcRJ7YUebV/0vEfaH4AQ6XS6SExidOZzkNpQYnB0K7R21MDHmhuKj1bTtgZLm4q0RtRcV/m+WO1pbmS+r7u2BFdDB45iKzTQAm32I3YAYSmZUsrK70Ohgdi8GRUcdmLgJAbNrJv8VIK/wXaIzINm6nawAvZ8pse9T0zX94f/YAzmj9E7LsO4hEibyrffCvxM3N3p6qfNlXsm2MsED+O7gXWoV17cytxFnYXmwMKZBzohxwn+KXQg22cjUb+JWP2r1cDZ3AeSDtkzXALK5bYYCG6zmeQdWHzGa0U+10BR3hMJ8mR6dAK97ZTSjAyDaGiy8moBN0Hp6xQuODzQewWlZwlHPQ6pgkEycsk/yY/xnHehaqB9iCwtrRrICA8vNKcBHMduHM1rzgsBGanmFx0MBspRCvIPkBeO4ZQiWs/ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 61a8b775-069a-48bb-01ed-08dbae661e69 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:22.4181 (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: kaZKjIwcDXN2E2Ac25iQe3vD5kd/WTiEKUilG7D5KmWXEaqQAwb/cvYnHsZpqElkmJBx66g5oJf87J/+3lmJ92/i9Qvk3PesX1sONqclMbs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6109 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: _u2im0OR2RXilM1bmE1RIwUiJ3xvLq2l X-Proofpoint-ORIG-GUID: _u2im0OR2RXilM1bmE1RIwUiJ3xvLq2l Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has spi_execute have scsi-ml retry errors instead of driving them. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: John Garry Reviewed-by: Martin Wilck --- drivers/scsi/scsi_transport_spi.c | 32 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index f668c1c0a98f..e04b38a009d0 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -108,29 +108,27 @@ static int spi_execute(struct scsi_device *sdev, const void *cmd, enum req_op op, void *buffer, unsigned int bufflen, struct scsi_sense_hdr *sshdr) { - int i, result; - struct scsi_sense_hdr sshdr_tmp; blk_opf_t opf = op | REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = DV_RETRIES, + .result = SAM_STAT_CHECK_CONDITION, + }, + {} + }; const struct scsi_exec_args exec_args = { + /* bypass the SDEV_QUIESCE state with BLK_MQ_REQ_PM */ .req_flags = BLK_MQ_REQ_PM, - .sshdr = sshdr ? : &sshdr_tmp, + .sshdr = sshdr, + .failures = failures, }; - sshdr = exec_args.sshdr; - - for(i = 0; i < DV_RETRIES; i++) { - /* - * The purpose of the RQF_PM flag below is to bypass the - * SDEV_QUIESCE state. - */ - result = scsi_execute_cmd(sdev, cmd, opf, buffer, bufflen, - DV_TIMEOUT, 1, &exec_args); - if (result < 0 || !scsi_sense_valid(sshdr) || - sshdr->sense_key != UNIT_ATTENTION) - break; - } - return result; + return scsi_execute_cmd(sdev, cmd, opf, buffer, bufflen, DV_TIMEOUT, 1, + &exec_args); } static struct { From patchwork Tue Sep 5 23:15:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 720324 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 071E3CCF9E4 for ; Tue, 5 Sep 2023 23:22:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242485AbjIEXWg (ORCPT ); Tue, 5 Sep 2023 19:22:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237641AbjIEXWe (ORCPT ); Tue, 5 Sep 2023 19: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 D1CDFA3 for ; Tue, 5 Sep 2023 16:22:30 -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 385NLCKm030763; Tue, 5 Sep 2023 23:22:23 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=LHk/iC2TIzWyESrt1XKk9AeiPSyTJ9Nr/G4QaEK5XHs=; b=nmH4jLHuVHGD0aEBSZT1aTgnhDRUJTqzUehOEt4cs9knd34K0ZQhW4EqUpH/UMVzDEvw WxaP8vy0FoHQyxkxDKPH26VjNRtymRaL5weJRVTurRPxv+8lzSRShCX+g+ex5kop0k5/ sgGgTFmcJ8InO/fAr/m6zWnmM27GLYY509er01A7Rw2CdSGEeUqnvikgTfTYwQvHftRH B2ubpFRzDYk7C+X9zJzG2c49oxW/yPDOgbqexhkry/ElhhXuWCuUh0r348FYMDYY3DLw bcydR8BHCVgBcZPWQiUk0ouhG0QRrXEpk220JNzoJbBGg/9esrD035bAie1p5iFM0OEY yQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxdwu800r-11 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:22:23 +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 385M44fu037052; Tue, 5 Sep 2023 23:16:26 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2172.outbound.protection.outlook.com [104.47.56.172]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3suugbpct3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J5QicwtY4K547y9hBnf1HcY2FUbGWBEEr1XeI51HLwtajVMbyVnI27KQKFubfClSr1rfp/WCn4CAMJb7U1ODQ7nx7s1Lu3EWsxOknhDlNdofJqy9zIFYQtl9v5BJtjXRRXDwP6frQwpPKIEM+8sdNej0ItMJiyZiaPNubk0inVMnsTd6uUpia7RTPmOJMAeetCaeXcFBW5U4+IRa2Nj10TyC0/He6FySi/E4QBY8nZcft+WqlJ/NTGoYv0CmAoiK2PCo3DN05xsqPgcwc8+39Owvu/IRtXeoCHBzuC3IdhtrRkb/W/HT4IpPazYnzAaBAcUWK3LIFycqEGUDpStAPQ== 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=LHk/iC2TIzWyESrt1XKk9AeiPSyTJ9Nr/G4QaEK5XHs=; b=AiIXoe6FdlqUoC9dAocZxjCrc3F41SlOktqOkTcP+to0EmagEnX9CrMQl1XX06D9k0ZDsCtJTqq3EJ6/0A74PVSM4p0t0oxEQJq2eui7Jyz3SZKG71Ca3NfL+wkry6SmMp1YMQdbhA3NiEDQG622hvQIhBLj063rJbMKbxwMc0E6yUW6I0HR2NSQ3TgPGZpMtEVrdgxoDece80JJVzCtHYkDDTXyCakSiDwWAHqzp6nX4pDwNMbOVV+X2xvbSLl8qc3IWzju1wQsU0TgJxY8wRbrduZ1DAqjg4XfhgJNKdroqty6fGVs4lcnOyJuquLrroCr065U4DqMIsFtPFdbFQ== 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=LHk/iC2TIzWyESrt1XKk9AeiPSyTJ9Nr/G4QaEK5XHs=; b=dK0s1Zag0LYo40X3tPKI+fvCDyMbBoa8zoCbYs8KvlIG4gLuT2tLc6InaDgeEmmM22CmRqElKupQyY7XMDN2uUtGoxRQbxPGzB8EnNsNyBXn7DltxKfUAzfKRstSNdPPYzCmTDS1WxIIgoBJkA0D2/a9nAM9K1SUSJcf9us65YE= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM4PR10MB6109.namprd10.prod.outlook.com (2603:10b6:8:b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:24 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:24 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 18/34] scsi: sd: Fix sshdr use in sd_suspend_common Date: Tue, 5 Sep 2023 18:15:31 -0500 Message-Id: <20230905231547.83945-19-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR13CA0031.namprd13.prod.outlook.com (2603:10b6:5:bc::44) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM4PR10MB6109:EE_ X-MS-Office365-Filtering-Correlation-Id: f80f1d77-ebdc-43fc-1172-08dbae661f74 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JuOQHVotSrUrgQTSh5xfedwV+zIkorwBiWCN6E0F+s9+g/KX3A9SjKxIQL57VZKa2/rJiDKjIVFbRv2d9x5taxOUd+u8LOw5N1XwfJvz08PcpSccM0VagO5uN43JZyGBTCtF9mRRXhxabvlpeU3LhzzD3iZmKGdyN59R/7i7RKkFlG4s9Qntp9AG0tCUANPFpNsWgb0fNIjcGorzOY6y2Wiqx6Niem2fP3ppVREXx9TT+q82gvQTIFu+3cic7fucGueQkphnO0PGv6WBjaXrgGQyiE0NQrh4KhmFwYrgIJqDw/gMSgvVkrNpXZch052y+BBHPd4NNq+gVyWL3Mtyn2qBln+iVD0k24KgzZoYyPY6+kerT2J5qifwRV9CvOebCvcedTP5LxYY3isMXMQrfqveyBSZ1UPl6PIIXptKyH4dUEeSSrY1disnD2/oKOFUQUNM6cc/2FdhjjH/30pjD4eZE4sCHycjwtOEitdsASnYfp9yHh803tSTlmsfKRTIz9flalIdrnvsmwQoUtXYLX/li1YYC0OywaFhskGFKiYjQbLsCZIW9DNFylGHRBhe X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(376002)(136003)(346002)(186009)(451199024)(1800799009)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(316002)(66476007)(107886003)(66946007)(66556008)(8936002)(4326008)(8676002)(1076003)(2616005)(478600001)(6666004)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-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OvKlsi3NnqrmLEJnZ3DrChFkhcAZhT89b9XogpQkHl7o4sft46sW/8lJBNohoGBQ2cLWzvgPdHB75S+RnYLE2HSb5R3QJpad+haAsOKSqWIpc15MgZpAiSkLgn6u+UvSMVTQvzdYtYnXs9wWIxPIUb+da2i6M8WktEIkfn3G22b22+wAPdFx96uWruTFiBNL3CVOx+jHssgTweuSbn36N2xXkr5VVJy8GtHSaW3xg12g1jzTmIh6+G/tDv8MW3mTBz4BWhWdiTlAdGVDgAfkXYeBodVfR3l8zOOu6x3GcLQqEtAdP6yM+SKmkPA7iERwzY/KyrWlkNuSPeLZPPB9MXgDzRvOC1p/4OKGsit6LiTPTOCM8R5YYwk9tFk/+Oj8REey2OxkvZGrb1uT+b89h4NybjAST0ACssfrgoz9+U1SKDSvrIPhjt6OdN58fRk938Ls4f4z49wMm6Mu5OHOWgK7GDQUhToL2h/ngLExnlob8JiTSZ+qK7hAf04nw/bwREv1b3K5q3LeHat++9MeykiCkzaJANzNFdm5pzXV6XIBzsblgZRsvCf9+NvHo0Q== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: TodEu36ueLt7A7N+vd27+XSas6gfcx8z1gCtD/JLY9lfePVtQS6y/e2dDz4+5zOyTylbz8dAuRF5s8i7+Ohwa7SumSLRH1VMLtccjsm7sfuUpnKEoNhi0YXtWI1QNlGvotxU7nDOyKxQF9b8yLjZjwdwfZf8hGoMtk04UlZxObEXnSi5566MSQkvzswgJvESL4+OdNIAeJpMlSxg8i0caKSvHmox4FPofZBS1B08AwTWoX+AvDycPWR/+MlxXzHmctWsE2JlBlSYIpicVXwJHQTfE8mIOEeBZqkmGrLAjjZL/NlpBE5oR7QG50bwtRPMybfDo8wFlwPrQYn9Bf4Rf3s+2KHmlP+hIWeXkd1vkYql8in10I1xSThTRFuhCaEClTogDuasEm4CR8VkM9dIxTo35cD0NzEV6eRgAszA2BmHOgu6dGowwVm7e+TGdhxtfDvteHxogFc+KeGkEcj/6UxCERZJUTktl/qS94D04x0l5xjoK4QZ46QwRznnWGIshDCfrjHrh/86qrZ3Q8R4ROjVHwYIX6sK8/hGeBxDNwJvSd1f9Z3NyYwt83TgYyoP/b6Fkm8kWo3/Wtl1PF3vqd/tvua1y+kA6NJbMhPiqQtE6LTYxAVcz67k8enizRhVtD5yhVE2y8eAVt8L0JmzZvw8EadWoZTJCoTHQnWxTS8BUC24JYgkrOlWm5uzabRMwucPrQ0EEh8pUQdNScDbhyfQS9HFLXh/6ha/gmTiCOQqeuNrbifONJD9NNSeojRq3SVLIlMXj1KS35dRdiBxIKYvYRrqobxh3pzNqU3aF+mrSB9aT0oRFITXEaFcI63sbROVfdKgC+GXs0zu8sVV1yvxkuPLStlowEIMhB4Otl/pSQHUvsp5qvJLCvuvgmix X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f80f1d77-ebdc-43fc-1172-08dbae661f74 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:24.1817 (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: STfry1AHv2i9+jDqvH7+SXeVk2XM0K1Eh653KqWg4qL04wXl7CQafGK2fIQPdA5DeGe/0ig0gDa/kaPFv65T1o3ihW+6JcKEzvveXNcSVsI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6109 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-ORIG-GUID: RkzzFp4o-nqXnUF_v2kR_sR3WE_E2Z0F X-Proofpoint-GUID: RkzzFp4o-nqXnUF_v2kR_sR3WE_E2Z0F Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0, it doesn't initialize the sshdr, so we shouldn't access the sshdr. If it returns 0, then the cmd executed successfully, so there is no need to check the sshdr. sd_sync_cache will only access the sshdr if it's been setup because it calls scsi_status_is_check_condition before accessing it. However, the sd_sync_cache caller, sd_suspend_common, does not check. sd_suspend_common is only checking for ILLEGAL_REQUEST which it's using to determine if the command is supported. If it's not it just ignores the error. So to fix its sshdr use this patch just moves that check to sd_sync_cache where it converts ILLEGAL_REQUEST to success/0. sd_suspend_common was ignoring that error and sd_shutdown doesn't check for errors so there will be no behavior changes. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Martin Wilck --- drivers/scsi/sd.c | 53 ++++++++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index f5e6b5cc762f..1f6cc24d633b 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1564,24 +1564,21 @@ static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing) return disk_changed ? DISK_EVENT_MEDIA_CHANGE : 0; } -static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr) +static int sd_sync_cache(struct scsi_disk *sdkp) { int retries, res; struct scsi_device *sdp = sdkp->device; const int timeout = sdp->request_queue->rq_timeout * SD_FLUSH_TIMEOUT_MULTIPLIER; - struct scsi_sense_hdr my_sshdr; + struct scsi_sense_hdr sshdr; const struct scsi_exec_args exec_args = { .req_flags = BLK_MQ_REQ_PM, - /* caller might not be interested in sense, but we need it */ - .sshdr = sshdr ? : &my_sshdr, + .sshdr = &sshdr, }; if (!scsi_device_online(sdp)) return -ENODEV; - sshdr = exec_args.sshdr; - for (retries = 3; retries > 0; --retries) { unsigned char cmd[16] = { 0 }; @@ -1606,15 +1603,23 @@ static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr) return res; if (scsi_status_is_check_condition(res) && - scsi_sense_valid(sshdr)) { - sd_print_sense_hdr(sdkp, sshdr); + scsi_sense_valid(&sshdr)) { + sd_print_sense_hdr(sdkp, &sshdr); /* we need to evaluate the error return */ - if (sshdr->asc == 0x3a || /* medium not present */ - sshdr->asc == 0x20 || /* invalid command */ - (sshdr->asc == 0x74 && sshdr->ascq == 0x71)) /* drive is password locked */ + if (sshdr.asc == 0x3a || /* medium not present */ + sshdr.asc == 0x20 || /* invalid command */ + (sshdr.asc == 0x74 && sshdr.ascq == 0x71)) /* drive is password locked */ /* this is no error here */ return 0; + /* + * This drive doesn't support sync and there's not much + * we can do because this is called during shutdown + * or suspend so just return success so those operations + * can proceed. + */ + if (sshdr.sense_key == ILLEGAL_REQUEST) + return 0; } switch (host_byte(res)) { @@ -3816,7 +3821,7 @@ static void sd_shutdown(struct device *dev) if (sdkp->WCE && sdkp->media_present) { sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n"); - sd_sync_cache(sdkp, NULL); + sd_sync_cache(sdkp); } if (system_state != SYSTEM_RESTART && sdkp->device->manage_start_stop) { @@ -3828,7 +3833,6 @@ static void sd_shutdown(struct device *dev) static int sd_suspend_common(struct device *dev, bool ignore_stop_errors) { struct scsi_disk *sdkp = dev_get_drvdata(dev); - struct scsi_sense_hdr sshdr; int ret = 0; if (!sdkp) /* E.g.: runtime suspend following sd_remove() */ @@ -3837,24 +3841,13 @@ static int sd_suspend_common(struct device *dev, bool ignore_stop_errors) if (sdkp->WCE && sdkp->media_present) { if (!sdkp->device->silence_suspend) sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n"); - ret = sd_sync_cache(sdkp, &sshdr); - - if (ret) { - /* ignore OFFLINE device */ - if (ret == -ENODEV) - return 0; - - if (!scsi_sense_valid(&sshdr) || - sshdr.sense_key != ILLEGAL_REQUEST) - return ret; + ret = sd_sync_cache(sdkp); + /* ignore OFFLINE device */ + if (ret == -ENODEV) + return 0; - /* - * sshdr.sense_key == ILLEGAL_REQUEST means this drive - * doesn't support sync. There's not much to do and - * suspend shouldn't fail. - */ - ret = 0; - } + if (ret) + return ret; } if (sdkp->device->manage_start_stop) { From patchwork Tue Sep 5 23:15:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 721424 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 69DBBCCF9E2 for ; Tue, 5 Sep 2023 23:21:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242166AbjIEXV3 (ORCPT ); Tue, 5 Sep 2023 19:21:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229905AbjIEXVZ (ORCPT ); Tue, 5 Sep 2023 19: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 22F1AB0 for ; Tue, 5 Sep 2023 16:21:21 -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 385KnmDk009395; Tue, 5 Sep 2023 23:21:12 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=MBtUJ6Vg/raKLNep8lIYlMHaGAUCM1BhLTT7ygXBe00=; b=SYkwZIhq/u98XPAn5aP4pVXOp/upBr/0aOJLyng0O/M3uFCdKzbaTHoMwHLCcu7MBwPp k/f7TcyCxP25pAyXtInKZROuIJg3i5ifQHXTVkJ977yh+IDuzUF3/ngeIeAIun7K+CzJ CNXzrvJJ8e+LTSiv+4Ja5z8cJ1yIllRC9HAXRC+/MUgCD7W6FnGYj1BhVea9x6A5sSWA HaZIBEuRs2eg5RQrgc/6b1+fbV19uarfUlGaRy9CDF6f6Q8UvUVbg15DY3F0NQin5Vdd Ajg+A8OozKd38vkAIFi7s2fDSlJz3qBQbX6AyCGoHpSHZ0oFnwJFqJ/E8XG5QeJOOqEA Sw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxbq389bu-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:21:12 +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 385M44fv037052; Tue, 5 Sep 2023 23:16:27 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2172.outbound.protection.outlook.com [104.47.56.172]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3suugbpct3-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R8GBa/kxOWvTk5IopVOPjULLgwli0VQmgi5l5LGL7YqF8syOEYJc6Opo6D8tFvhBov/hel8m4cVbBZIUZVaye8IPmJQsW8aNoZW3wKkjzpBKwQoHBOeCuRmtgicDL+h65HOQWZJTxxPTCdVzQsu6Qb6TjR3j2rNqVrKYTxJBaids3oJHcJqc4aoX+SMfYxGrU6goIhBQk+Y5WzLmL/+5aI5NQBWMEYkL6KsPZFWqN4TleXj4isMrNhtBmCE1t9e6pXibvOeUYjWlHAnjTm6oRTAcoO/Hm8SVps9PMDRHeuYr+s5ZA4KdWAA7XN4etkE142Eks/V4j0/NgsJ+yQaq8g== 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=MBtUJ6Vg/raKLNep8lIYlMHaGAUCM1BhLTT7ygXBe00=; b=XJouLChoS4/4ELP/7qQU2Ry/VBs0DyVB5QY2oqHr+srbrfUU621WPPAr0f5vuGpwxYFnGRMvkP8l8BT9zJ359WvYRTNonWyszkingA8hZj/PM2fp4AfgLtbxb7cuYfILhoO1WQLMYMw62ZcR87ocskJwsrRlsDcHQynVCNaFV+fF04s6fVFD8jqj5j9EUITXg0e70ryI7SkNkg2luT2Jiqs+wgw2iZoCGZok0YOrFHsraMCyZRiMIvC8aQGF5HLvE3xx7QFamF+KU8OkDGfY/wx9ljhO/fowgxE9C9I0MVXaZ2uHedMMCMmjA176i7y+Yle8FOYf+sJv8voVrv0PmQ== 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=MBtUJ6Vg/raKLNep8lIYlMHaGAUCM1BhLTT7ygXBe00=; b=rjnkLqvsng79nkgN01Xu2Wcp1XMNQmQLKdnNZYL1c5QkM017hiMWSGURw4sw1dK8a2KbruRcrSP2fKGECHOlDJeOXfzjr72jIyWtVpPRoaeE7GXNcXz2LrcF+lfeFe78OTIRxndLO5o9FpV9AwYpjaXPWyWLvmAzktBdXGc2AeE= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM4PR10MB6109.namprd10.prod.outlook.com (2603:10b6:8:b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:25 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:25 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 19/34] scsi: sd: Have scsi-ml retry sd_sync_cache errors Date: Tue, 5 Sep 2023 18:15:32 -0500 Message-Id: <20230905231547.83945-20-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR08CA0029.namprd08.prod.outlook.com (2603:10b6:5:80::42) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM4PR10MB6109:EE_ X-MS-Office365-Filtering-Correlation-Id: 25d76134-0065-4448-fa92-08dbae662039 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tPSGQK62rPCXO6cKA4gjXxAsPgsiGtA3Z+ldyUyprBaT8TmqMxrxoSQMBb0XdBN99zANN6j/dFLKxBfhG6+1OLqHGaKTJ22xY9dVGkCnj6L/9F7sij8YOzca4lYsV05IbydBuKgBTMZV4BMWBhcP6w7M63olg9Zos5Cq3H+WYGaI4/YH6ZM8Ni9stQ3xnwfqpolzPLWmVkMTn66DemEc65ZOeThqeXBKpvPlSYfNajpQYvARL6UK2Tzne2f8aUy9xhkEKqJNyp6+BUcyeY2ShZGVCujc883rD7C5RS6tD+rfeXAoDAwYnMZW2oFiPt5S+rc6JOLWSX2olyhyCO9Ok/KJtSF6Dq+8f3kPXbyZwkJUNT9qphp6BQ5H+vhIVwczFPBHVNC5Em2V+xvdGXPpjJg40qv1bweM/QaDW+om9Qngv8J9mM0E/t21PzY4nOcLlX4vU/78ijxX4Hugt1nNHFBzZ1AE0kI8rMq5T03J4hbY1+VE6RtepyeFFqrlXM1N9SGhINQ+a9OEzhhOgdFBe37Adyf8WewS46FM47EhjyUyJiL/KjQL0h5RVUBkzbic X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(376002)(136003)(346002)(186009)(451199024)(1800799009)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(316002)(66476007)(107886003)(66946007)(66556008)(8936002)(4326008)(8676002)(1076003)(2616005)(478600001)(6666004)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X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5rdXeLEkZbB8fwGIX+FdD6/aDirl99S8DbARJdGiM+IudS4nOH8dhkSfrE3oPwsSl2M9zNJCZxsyEQM/7p5Vhn7e3p8Bhd03oA1qf2/Ty48PI0jCYNAZCPmcU9cR/lWBlhod4S/LbDBrUu0aGShQ4sjt/AE7Lkr9wSPzvWJQCF0OoDilXNHWLrC1PCZ6Ak9800ziC4RXYUtqy/lhxUWLodn16yUuDr3L8czVpWxrsLjmIPgAqmw/NGvi/Kn+Qx5R8mH0qsPKavGssMkdGRfYeYIWUwPesFATTtoCS9MYDau/Airaer55hghPgYTpttYUb8fYZOdx9rP+OPsLVECTC/LqQdVsEUbnKwbGc97DYLzdeg8Q/28jrJFaChbTqI0iG7mYkiez7boFPAaxk/o6np8Z9o+ZQ7WrmjAffThqSpj7xnwmT2NRBuDZzUwgOiGPL+H43qCT1ZCpQ2lf X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 25d76134-0065-4448-fa92-08dbae662039 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:25.4786 (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: 79BoyWW3xyoOqRJ2EcnHQhuM/4uAlkfKeAj0eyAkBFCEWfHAcebDwXSnmQveeY4raqDX1gukJSvBBa5kg84F4+5yhecW7St67bumbN3KbZM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6109 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: GqtbbSm7eK32tM7Aspue4WYQr2Tu8lb9 X-Proofpoint-ORIG-GUID: GqtbbSm7eK32tM7Aspue4WYQr2Tu8lb9 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 Reviewed-by: John Garry Reviewed-by: Martin Wilck --- 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 1f6cc24d633b..8efd5d8e46e8 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1566,36 +1566,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 Tue Sep 5 23:15:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 721423 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 0163DCCF9E4 for ; Tue, 5 Sep 2023 23:21:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242236AbjIEXVb (ORCPT ); Tue, 5 Sep 2023 19:21:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242139AbjIEXV0 (ORCPT ); Tue, 5 Sep 2023 19:21:26 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 329CAE6 for ; Tue, 5 Sep 2023 16:21:23 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 385MtGbX023608; Tue, 5 Sep 2023 23:21:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=nY5TO5NIYSPCyzq4veICegNAxneG5U/4sPYYo7dpkVM=; b=Z1pa/DK0ViteJNoTS9kGV0UUcjD+9cdUnpAQm9d598yf6qjpQWG1YPSooZJZZ5Oad9kL WUhdJLHq1cFXbvtm8zdEFcPPTgoQVo+jbbXUli8Jg/ctYjQbztlJ9wteqhPJ25DtXoFB uL4vjjoxQaO/RsA8fGNUwnUthcyp7zggcy6nRwxezrLHDTaQMRcQWxIqJcWqBF7jD1Dz +T3JKpvAbGh6vRK1ciMYDgecZ0yCo0nslD40bE3Zr5V4FcCY5xi9zUiPlFvqUdePWlDl LjP7xjd03TQvLfmZi/8aU5uouHlCC1o7UGnhOn/4ttyvqfGArkgG3MpmCgqw+pN1jFmR Bg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxdhg81jy-11 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:21:16 +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 385MDx87037114; Tue, 5 Sep 2023 23:16:29 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2175.outbound.protection.outlook.com [104.47.56.175]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3suugbpcuv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FrbmLtLQKrT5bjEIFUxzOJSY6h98bXIHEvwEpHoG2a0J+I+YVYdt1JNbu7Sw8uMTY2+qlGIczyDn0CvkvbSPlQYnPs1kgdSydXZb6b2KA6Z/T11GbmyXdNkf5oSfDAJa5AcEhl+0t74BLUwBqfnNIPt+EOf2s5SqRmo+JpjPB9d48Xjv9Siw+bjnQymCDkiMuDg866hke0nplE3qvkmZqz98F88VPtS3OTpG7aon0lHhCRyJshk8ddBfwkNWOnE9Gheag7G3RerdFzdEyI0Dg8PWWsepUm0pixGnR8LvgmVgI1vcdyFVw6Flz1HcvOiolpt42OG4nrV9L9N5fZXKkQ== 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=nY5TO5NIYSPCyzq4veICegNAxneG5U/4sPYYo7dpkVM=; b=ZeCNSFSe20pxxvPqJRop3oJPTZOV871q144nR1F+UoHar4fIRlJYFUoAuWjxVfNMztMmDNUbsgN+lhvjIrUYPtXygK3FFXrJ9YHTG5bOue7FMzVcIr7PxrQ8CtHZLmsBxvIfz6Bgx25QYtwRZY6RObN+tR4TFdh/bS+La0nmj6p9SkxO4CTYV7sm28QykwdOdXMdXDFOL/HSADpYm7rUHtl4CYBD2DycU6rMCXtNoQWqa/ccw3w0uKTp5lGjkTZk7NVp/pbZN3jgXMQX0act5Uy1GYYwvIFv9cF1F79L+NTaKesvvpexmuNkImfVwXoGHVKZrAgOUb/iZBKDOfne8A== 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=nY5TO5NIYSPCyzq4veICegNAxneG5U/4sPYYo7dpkVM=; b=YAa0OaMQtShX+Q2YrrRTd6fpa9Kxf3iiX0K3z3Mb3Q9crRl4kVySvsqakMJyNvF6AtCRlEtzWb6Fk7Nkl/MEkIewrrVeEekl5hK41/Ie4i792v+l5YV4qjHU+EhtrJi+gN9h7IwQXZr++j0VE7OPHXb/lBaooR1ACk2VF9ZULWs= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM4PR10MB6109.namprd10.prod.outlook.com (2603:10b6:8:b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:27 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:27 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 20/34] scsi: ch: Remove unit_attention Date: Tue, 5 Sep 2023 18:15:33 -0500 Message-Id: <20230905231547.83945-21-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR13CA0029.namprd13.prod.outlook.com (2603:10b6:5:bc::42) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM4PR10MB6109:EE_ X-MS-Office365-Filtering-Correlation-Id: 12d2a7d0-8ab2-451b-4543-08dbae662140 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eb5YF0FqbBs6/ROv64xfGwpR3SzF7I42gG2ItyALsbgcjoIcRmrZENxQnXKEQ/0hSnuzVsVZ3nmmdQOiC8P6OCo1rEA5649h7JM9u/Jrr1PS1JwISGFiRTlKJsLcoNzlF/TnbOEzh1VttlWbnBe00l5YsWbp69sZzYhdN9OlYWGrqJ5X0zpA9CtNCIdAKKpwLSL4HdpoxSfAusm7tXFQNyP/XZC9AGeWxwHk7OlEKQ+lCwm64cN/IHXn7Th9CuPqiCUnVrGwYaAkWxBIk5tQgBaSlEE6vIVUz1rHBDbXF8cY2X11JPY25/6LQCN1hF7USgWVYZw7BS/K8nb5ei8VCKx8fw9ucE3Nw+JczM2MEgQJF6LIKe3IZF/uXO93hd2ceccpQSkxTr89fIwmGdGVFlUUDFCdn9p3R34Xx0ww0o6L0xWVrpfTMCGP1ZFj7sIcsPSf+3+nMlI1DmA0Nt4lbxYuyy6Bg9e3A1MT2atEMhlf58Q5bgfxOY/SvY+pbgH5zC51pj8KZqt5g4LWtCkemqpXGsWOFIVR37JTXqFMasF5DW5Q+c94H04Pa2/JuOoo X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(376002)(136003)(346002)(186009)(451199024)(1800799009)(4744005)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(316002)(66476007)(107886003)(66946007)(66556008)(8936002)(4326008)(8676002)(1076003)(2616005)(478600001)(6666004)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-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wV+zJxY25u7Qs0jPQvE1Qu/xvP5ZqRq3IeMJOcf+lUx48kzuGeZSg0f319svYcylDBFuQnpgCzBdExNvtL3rGbCKQh38UI/SPGtgMCiwt6GTwL5M8LAr7tiFE02Ciu6C6be3JSJe16Gdy8/BYjhIqsQPtZoe4jOC+KcIyLmfUfTUJXiF7XzYVKkqgUyfa8agH1xnoacVUuP3ixnxt9b87EEUy47geOtCYkfCgW5Vt32+bH1CZeoj4sAhGVCMEykWBn/OApJ5K78hvASf8jhrozkivWo9k0uKxuyBuqpyhm1YDkna/lXLjvTH1sYgT1c5fkQPdi64p3biuoR64GJvOyAeNJQUgAw8FgeFCpWkip2Gjn5oXEVfI5/Rf7KiRv60vXSFEEsdHgZxkF2VbcEYfdF48XzxuOhlHdcxTPCJMURErNVM+JaqIYic66LRhiaGNhUbSpPjW8koE/S71Us X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12d2a7d0-8ab2-451b-4543-08dbae662140 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:27.1910 (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: pDWMBeGfLT7UzTrP5hN9gKGZS+ACU4uPi6nIBoIQqbl9KIYbTu2/Dwvo5AqeG2+xTr16w6iUKw+Mkq4RxFDs9tzQPKFkfHaTUSLNOKYQgec= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6109 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: T-E1Rga3cEe2ViYIU0BOqfHOA3jd1_eF X-Proofpoint-ORIG-GUID: T-E1Rga3cEe2ViYIU0BOqfHOA3jd1_eF Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org unit_attention is not used so remove it. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: John Garry Reviewed-by: Martin Wilck --- drivers/scsi/ch.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index cb0a399be1cc..1a998e45978e 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -113,7 +113,6 @@ typedef struct { struct scsi_device **dt; /* ptrs to data transfer elements */ u_int firsts[CH_TYPES]; u_int counts[CH_TYPES]; - u_int unit_attention; u_int voltags; struct mutex lock; } scsi_changer; @@ -208,7 +207,6 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, switch(sshdr.sense_key) { case UNIT_ATTENTION: - ch->unit_attention = 1; if (retries++ < 3) goto retry; break; From patchwork Tue Sep 5 23:15:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 721418 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 63213CCF9E4 for ; Tue, 5 Sep 2023 23:25:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234568AbjIEXZX (ORCPT ); Tue, 5 Sep 2023 19:25:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232289AbjIEXZW (ORCPT ); Tue, 5 Sep 2023 19:25:22 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 901EBB2 for ; Tue, 5 Sep 2023 16:25:18 -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 385NLEma030783; Tue, 5 Sep 2023 23:23:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=AuWYlHZve5noSws6GJ6JdOTq9eIJjpSRYCnVg/PN/Aw=; b=KBEUZTCMZlfav8RzRmuncF3i8oSZegDT3f5dTpkbgcScPBYgFLXm449dg4D9qB4sTFe4 qWyohs04lgE4UtYHkSkA0BDWmXdmUoIetYkWM4/f2rkvngYhcUMn3tV5SNvJmT+cAzyZ ssvjLBJ+pLxAzETlmgXrWXK33mz8lpQSOz+mVs81+jgFGN6oo8Jt3JD022AWOO5Up0dD uWJh4E036gn/ZiIsMfzyzRIC/EBaxySAFz2+4O0bMWxRT4wifznxgFd7358ateATt7OV 5ft8GbFzJp7fKDAqGhRZsfG8UMBOtQmepfa1RRg7dczmCG3NVWhQSCeP1EyL7ZiWDVNA ew== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxdwu801y-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:23:11 +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 385M0SBj010376; Tue, 5 Sep 2023 23:16:31 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2172.outbound.protection.outlook.com [104.47.56.172]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3suugbp34s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CW7l4PvHdBa/6y+Fg7RceJKStCVlqcVRWd75hlv3BsRcGFAiNr+pai8TTtf4BifdJ3RIrDFPAZm92+nWF5VbyOBVIQCmem9oVpkVhjMblcIx0TzHLJs3vBCvLl72Pr3j6vD2P9YTM8QR+J8Cnj8x1PwdjNg7aYbfmb+AFt7WWtwupqeQBEWE9iItWxLqwPeBGDIh6B2oS8495Y8ijNuaPhXYMypqLK19i/jvNnLI8ymmHmrITT0tzAIvCXIXQAvPY/L9ozk7EkFXlUBGMsScL2I3e/CH/TV1MKtHg2Nh9zyopdZztKEU0na/eN7JkG60zG3ktNRKfLF0EQxsnNsQ8w== 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=AuWYlHZve5noSws6GJ6JdOTq9eIJjpSRYCnVg/PN/Aw=; b=j8hS2ekoQYmM2apzv7ZbIi0koBxxNFvOeAs2BtHUkia1E8p0Ic7vjoGZ1eUKXf9Eyea1bLw7xSxI4YhmJmm8eUmIEDgMt/mcqyBc94r6ljCRnh0LJfZBQlQxy2/JZlGraHw4eaOJyuArTR5RgPEmpPWrmiwGGbVfC9cpcA7K9jMR5pWdn2kN/floUpn6XM8JHcjZHudqOxY39Ob12g9AGlIODleG2M1HiLRL6WN56JUH3m0miQH02GegNGucg/el4mcMQUGzc67o+fO3j5fvHuBHfhi5IjOd2kvO2LD63j7XoQTjFswJVZGomomFbPkvPrAZaLwXlp1AhkcuGGuwOA== 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=AuWYlHZve5noSws6GJ6JdOTq9eIJjpSRYCnVg/PN/Aw=; b=Hcjtou4fnxmsMzBszl2x4yJsVP0m57Co3zSHX2/7oq9EXUp2VWIoB1LYNatNQ4GGX2ezsoUngp9jMDRKruuo5NS5DAhsSbd8unDcmtmHrek63lNFpxzPqi4mmUOl1hbvLx9fM4W+g7k2alBrpDZeg6f3C9y0dc4zEKO3Q7TAyIU= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM4PR10MB6109.namprd10.prod.outlook.com (2603:10b6:8:b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:28 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:28 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 21/34] scsi: ch: Have scsi-ml retry ch_do_scsi errors Date: Tue, 5 Sep 2023 18:15:34 -0500 Message-Id: <20230905231547.83945-22-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR07CA0108.namprd07.prod.outlook.com (2603:10b6:4:ae::37) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM4PR10MB6109:EE_ X-MS-Office365-Filtering-Correlation-Id: d2b5e13e-3d18-436c-7c77-08dbae662233 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: l9vRqTANYLB57msjlzUKQvU+VY5iDvQQMHfSt0jzPEF3oXIYLKnmYfhwSHFypRL0XQm1qd8FOCpRwnq0Xshz2GwP+jhtq7rwKu+Ne0A3GQdRASoGhU3OOWfuQNPt7nZxLSDjc0XsiG4NzmzcxoJCDdiexs58cTADifczS+YOae0EXf2T4AlsiMlqMbrFQuo/gH2wAa68L8K6tYd+AQUXJgnWnr+97Xcta4ZgxwySaapCau8hH/mhJ6J3HfsCH6Sq5nBIa+uisBYdtfxQnByA6waR7AWhJE1DkL+NRkR/ILJZlzmGha/73BoiXYJjFGPjuLTd3lXD7ViR7wi2hjtALafIaXGWyuHw7d78zViIseA9/fQm/s1ffVAX5dQhdPTjRhfkdETXR8nZLEjD1AqPNFL+5KmAulG837Tu4GAaJxwGo8FstQgRpNL2cIEy3AgoRTO1uyqHxMi5tO25yg3Wh9JieIJZh6pL9sGzINfGv0Fxit4V6NI5Z+5KcnLs4R7n/TFTkG1atmLLWSuiZxDdPiFGN60YzkPWwA4ld3MNTfGlvug7gci0V+yAly8sqABJ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(376002)(136003)(346002)(186009)(451199024)(1800799009)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(316002)(66476007)(107886003)(66946007)(66556008)(8936002)(4326008)(8676002)(1076003)(2616005)(478600001)(6666004)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Uew2dLvvdOE01oRdLhh7hnUAKF3FrXp3JwI4waYCID288SPTLz3+uF2czPva4Al25okA18zdEzqmPM23AhbTHp4G+UnO4voUJ2u8Mgn6490/KFkkdVSVG4dDb78rojfYRiQoLBfGm9ERl4z6WeQseAZiYsMSY7Bv3dZ7v9n05xUslZ0nZkPd55YvUcwyMMOvIaKWWiQNQdc7vFWpKlK3ZBZbBd1xxxOuuvgM9hOdrVxGy7z4qKRuHpQWKzn7+ln5ORB1u/hkQYtX9LaznH4o0UXyuGqsoPDj5vF2Gqq8IL+wRlTKss1GrAceQDZvMZiVlNSiiikG6D4pPIjXubyGO3i66wr9ASNmEp+JMa0XE9lymtPKuM2Hz2aiyl7HnWJezW3R9qQazGCEDXUQKZe/05Z+yhOBDn1SwCzs6zqCYMIhijcvYuOHo+ylzRW0u9+QMTbe3RmKFx2CW5vsxvKNJ+n0GiL/U9Sw11cBasmZksYbcFk+4L6WMGx29Eo+8sleS1yYC3iLEHukgHNq6BQ06owi5DS7tQecP1moRXz0ROJwreL1EVA6yyKl3t8XzddWkWj0rRf5tzM67lRIRssCtx6SFZuag/Am/tt/JPnjvWZLM6OD9mNxLhtJECIVoGsY1S7XH7sEFJSuftxVzKEFqb8zv59ScAKchXS0QwCuK2G709PFsx3xbUqLpIddURizBMU2KGxmsKNpLeaqZLcrPbKuEjpMSyA0M7kfm5mU5TQlkzJa0ppqYpvfHY0XAuHrpvsBzQgrE+MXi8PSE4itBWPIT8+XSDatoWQdHJmP8kFI7205HnSRXJF1iMkcfJXh4uUIMwayEfFKaY7t2CryujA26wdPu696wpssULhJ+wI0DmEdLiCklfHnXULrP1dRW+62kanERs6SR0jR8wNfTfcJP0nptGtbIp9ESWaVg0eHDUU9BoMAL5Rgm7vsso9ctPdzc7Ke1rIPmOaP3gHGICkPZUZBA88OU+ahWYVxngQ3VpHuCY3g7rYvf3bKNknHGtTvwBTcep36+M4t49YweJsymqka1Df238BrDq2pAgGfU2oeEt83ASW7bEM+gWIHmUixPKiEJ7NRWwIiBZ3dWHDqktKYmQcpNZGE9seXwIp5mJN1yQlOT76WngDsFxfcOMOlPClxKjKrCDQymQ5KIDy5yaPysNV/u/pgoXnrTGyRIVBlgUXmAoO4/AYZ2O0i9rfvS7D+ql2lTW9SAU0leA7QD3RdG8xBVYCsi3EygtLYgMDe8nxTDcYEpUpRRifb777ufaui5yZNcQfu4oQb5DpiaimBBATwUDSRPjNh/m/BssU1pvHQ6LUzil76BtuwyjOTE5Gj67U/KHNM+Q3wOPFRr7vSMmkoct4K+KM6mgYRZpUS4Lr7gOVtzS8FaY/gzTeacw4PO2Y+wtqUFGbF93eAreW9APz5BTGb3gHAb9n0ONCryZYo78f5KJdub6HcR/G9IWGue2jJO7+73dz5d7bGdKfO4mSQ29SzFl7NAc953v0UfGe0f/kWpHNJ9adwpm0N5hUK2JJfYhUVByylAw+TNPcyV1AzC3GO42qdcWgd6sMeD2yKEylwArFo7z8t/XEik0xqjvd0/sQG9SreqA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: LlssVi+6N1uzUQDNo17LF+kGLp33fSjTvRSLWUNFrWN+W9bTaLF/MsZleIat/WIfQkL7EZbpLWlGiq1ghfnK1X9+AVMm3vIdz3YDxlui5lX/zzpMgcxtToC3mylVHTwGVmq8pxgS7GHPZVP4l5CXGCxblb2iGordiGJq2tJz9eSyVAhaf1pP8vV7wFdoJYAObhrLHi3hlRUHnozb3zQQzucp7LiGxx/iuaMBALWwQ6VEJ/6VHNnSabON3L6H0MilsqDJwPuB56eGxOl6+nS7pIo1UYF3W8UaR4pb8LYHMGe0iSM90nnOi/hY21ejEQkO2JRI3LvfgK1HLPLucWHDaPIaZ9Ky079KyJIm19aQN6iIR6xya/L7L42N+l2TiNg9nuDlzsJCF48fVCDgjctOrDnwoQhY48IDARDL4hxtE3VPiDdMeq6UyVbiJ78Iojrhd3f0s35xmlU7Z1pGLbiManH+3M8SCzqrpDx7OVh5/pRGvfJskNWrhl7JQPzzGJUBGN+rVlYupgSgAlndawHUHFovjhP5GazTgChMLdqGPtlsHftOW+h4xZfoi5MpsKcIPG6MfLtSRViw5Us9yIQKUZx49gBlVDL4hvW9OULQeggF5ONKlT70+NoM94fxs4D8sUcCm3SigwqiYKciGMWMLbwi8NfzFRGhgT5OU8EPj1D51OPmPNz+wSwNtMPH+34DAAVQETrET1alJSJ+0Tu42jJ1wf/4n7yG9/DMm7G4prtBmeohjyBZco0YifO6njAtGuL1A84eKFgG1kIvDcP8355R4hHOAxPkGEyAZ/29oTCHuLRyvPqky4wEIhzOqj4suSnjUVzmrsqfzuE6xMZ4qKNamQaz0rSftrrO8tM9jSy+FYmfs4yEYwSUAdFLcWei X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2b5e13e-3d18-436c-7c77-08dbae662233 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:28.8259 (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: ZLQD4SWfv4zyIaMigiSAWhBa5LDIVCeqU8yajnRI4i3hJc8KbNuyqzlUAXtxCCHhoDX2+THzbg35XSq0wpL2a6ErXyA5XHzE4g55buSGMcE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6109 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-ORIG-GUID: FuGrtygPdt6NrrW_TvTjlQh-UlyzNx8j X-Proofpoint-GUID: FuGrtygPdt6NrrW_TvTjlQh-UlyzNx8j 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 Reviewed-by: John Garry Reviewed-by: Martin Wilck --- drivers/scsi/ch.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 1a998e45978e..4412562a3df8 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -185,17 +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 = 0, 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); if (result < 0) @@ -204,13 +213,6 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, if (debug) scsi_print_sense_hdr(ch->device, ch->name, &sshdr); errno = ch_find_errno(&sshdr); - - switch(sshdr.sense_key) { - case UNIT_ATTENTION: - if (retries++ < 3) - goto retry; - break; - } } return errno; } From patchwork Tue Sep 5 23:15:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 720335 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 6FE90CCF9E1 for ; Tue, 5 Sep 2023 23:16:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238111AbjIEXQo (ORCPT ); Tue, 5 Sep 2023 19:16:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231845AbjIEXQn (ORCPT ); Tue, 5 Sep 2023 19:16:43 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49640CC7 for ; Tue, 5 Sep 2023 16:16:40 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 385MtGaf023608; Tue, 5 Sep 2023 23:16:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=gTSE2a6BO3s2C8UMe7WzTaLOcg3O0jUxS68uzH2jhkk=; b=VI7GxuPZ7DObN3vcAbZeitTXdLxikBh1bdNYwhB9YP6nuRrePyCm+jyZ587/D+MCTOfp 0Rn7v80AgAbrmJ0AzWPzvcFrZVUCgxjUOlnY2H+8Vw+tuXaecNCAttZdXaT+0CteBNTh 6LC3bLTaYEmkWEaX5p3Mu5JFuwAblYjeittv2/xXEXlBL6g4JdMFeKBu1of8RDYKQf0p 78Om4S9v8tYLUwNeDz/+VXOcwZ4sRjItwx9fo2W9k3M+8dtgbR0pnNC39OK1ymAByw0n Gm2aTmNwtswfJEmTHXtPPXrM2ecKOxXVOu3Lsbl8rRUdV1dtvkbDL1LRWjEK54i1Hnha SQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxdhg818j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:33 +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 385MtVoV006568; Tue, 5 Sep 2023 23:16:32 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2170.outbound.protection.outlook.com [104.47.56.170]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5x0ge-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kxLPeIddA8MbaYCTme1Cw7LPzlRtiNcrEu+HKe1m6Qj0OA2m/OW2Y/Nm8Wk3nd0zms9jPb0piUrZkKeZO+KSxQpzTMU5LIrFsls73N94Lz0ZxGafKq++gnKJkzzN5wHtdQ56QI/lfaT3HLcWKSpGYoN/OScunxmrEeIeRMNV0C59Eat1FjoP4hNdCEQEiWxcgH0+G24HNaebsZvtC9+tGW5JDmytJUU2tM34rGlUPLkYMyZtDPiBkKgXjmNBEwgWyHh0gMaGS/+PG5vnIg6HM26XEoxRecoULeOBjwT4E60g3CdZBZM8zUb4fq7xjIXMpwtClu+D9WyS5onMI7x13g== 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=gTSE2a6BO3s2C8UMe7WzTaLOcg3O0jUxS68uzH2jhkk=; b=QVLFoSsGtnd+x9pYdQQxZlhhjQTetW3lXJWiim1wU5Y1OtA9Kh8bE2wJj6jeWrjfWR6/ODvKzUF4mzf1wHsB1rqlqTFYFoxyK9Z2kcZiZbH5wz/3S9wtbIB1bHvB5/txVaVlDAVZNRQH+gEqObKzUf6uRauRqW4xWrD2UZ20d+OcavlvugVYEQmGdBGd75y8HIkemHXmWcp51UgsWIZtY3TxQ5LbRjbhcMSRfefPZMeLEXI9WMKzb0SVamRhFMW61mGdkVdHrCv/3ZZoXGeoBedaOyxkfrkYWL/Spj9RYP7CGOcnnHo4FjrWrMvczpDdal/scDLgA0f0Of3giJ6KEA== 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=gTSE2a6BO3s2C8UMe7WzTaLOcg3O0jUxS68uzH2jhkk=; b=mc0U5lxu+QwRr8iQF49pkA3eNAWgXrY9yq80PfbY1WUBD9V/qABKZukkWjs0hQqRMaxiSesBsn4uAyEFBkhXyP5n9armmgDnJpc3FU9KE+uFPzka2x5Pk8C55a/vBguh942ZdwLfougHuVpc5+vecJh4qdZL1iAdUwAxcB6m7YA= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM4PR10MB6109.namprd10.prod.outlook.com (2603:10b6:8:b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:30 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:30 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 22/34] scsi: Have scsi-ml retry scsi_mode_sense UAs Date: Tue, 5 Sep 2023 18:15:35 -0500 Message-Id: <20230905231547.83945-23-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR06CA0084.namprd06.prod.outlook.com (2603:10b6:5:336::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_|DM4PR10MB6109:EE_ X-MS-Office365-Filtering-Correlation-Id: 50c4dbd0-7773-4ecf-9f4e-08dbae662351 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xFdPplmj7TPnRlEhQqYR/eCElE2dnqZD2eefIJmeuSOYlmi7aTieohLHh6/1wej+BKVUNGMrbeju+AUdmJPZCNBlVaPVUjqIRiW+5LJLDfBvmr4AkKjhoI5ZnUV+6ljXtTXh2SVeFfirEHSH7KVn5cBP7hbYEQcBTOHh3tGHVd9T54/g8OGvliPzM8JlmHzqMMlPDkNz/tz1yxVQzbQHX67iHUEzeWPBk0+pcw6xMZCsuZymAYLk3Baks+Syiu9Y6D8hafOlBVse4dtlqGWUaFBh3MQzzY4B8F3u5v35224KaBc5a99kW8hA1m81FSOxSG3KxJ1QSwb+xL4hRJIbZkodNU2I7V7ql5+N1EWfTw/0mWcJYYjqA7f7Mmgg/jA+YjMp1/sIV17b/piv1F8R9VV9VVZBLqekYEtwGvXNWdLyhC5aw0k1mRP+qnXR+PTZomXtwy8lhiWGOW1R9jifpKWkoq3YeFVOPYX2DXZG/9ltYMx8tc6zQ5dEknzsM1PGs974cTg8a03oCFVAyo2SshWcYLLRyZlsjf62hy0He3ak2cE+N7utzoV/j30/41A3 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(376002)(136003)(346002)(186009)(451199024)(1800799009)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(316002)(66476007)(107886003)(66946007)(66556008)(8936002)(4326008)(8676002)(1076003)(2616005)(478600001)(26005)(5660300002)(83380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29tpPcTnMIMy3yfNJLPMJG8oKoBaVtMvFSnvqA9VTG7hofWyQZcY5sxfV9uud6jgR2h0/kKOem0Bfks0P8/xeCyWWiPVLsxnUK9lwm+0wKLd8xQxWjHVOQCpVQ/F3YeaJyTId9YgpZoN4MMl02LBiPWhexYiV1aU19Et2Qr1ZPzcDRyf3rCtnQgZo/SwLGgcRlo50qubEydVFWkhkOfZFHmRudfN0L7UIoS15s5z5f0FpH+8PgIeNOKfvBr3z+dG8dxrBzKC7vLoWCFZf9vjaxg9tU7/k4FQ0IwH6ZCOI37jCIO9M4IBnYC8sh6pvb4ki6eM3n4bPpCgjVmCgkUUhTpLPBXUJ+/HpRLXzaFg89XRIBMh74fPYg6Y33k73CNsTWmmCD6Jnh9f9rCSaoVJLMhfNv5RyomBCOaswY+vu8fckPI/tCzm8pWBpmX9wNRqfCNHvxyQpAfh7Y0BGtgm6jowXCehDj97swF7Ub/yw4LF0ISbdOb7/Thj X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50c4dbd0-7773-4ecf-9f4e-08dbae662351 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:30.6927 (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: s8CORZEkUij3/m3a7g+B2C9W+rDT8JuYkeGq/onb2mH+/gaIOOpk1kyV7NiV4v2naBj/CIkfktJrAqXqP8CsPSOXejf3VYIP+wsFhbMPawE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6109 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 bulkscore=0 adultscore=0 suspectscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: 10-7Mt3KbRjfZBmC8O07_kts0Wh4_M8e X-Proofpoint-ORIG-GUID: 10-7Mt3KbRjfZBmC8O07_kts0Wh4_M8e 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 Reviewed-by: John Garry Reviewed-by: Martin Wilck --- 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 d9432bbb64fd..67d74f175c4c 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 Tue Sep 5 23:15:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 720327 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 63FE1CCF9E2 for ; Tue, 5 Sep 2023 23:21:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241874AbjIEXVY (ORCPT ); Tue, 5 Sep 2023 19:21:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229905AbjIEXVX (ORCPT ); Tue, 5 Sep 2023 19:21:23 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC2EED2 for ; Tue, 5 Sep 2023 16:21:19 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 385MtXle023737; Tue, 5 Sep 2023 23:21:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=YUCRZJoLfc0wZenya+ki9LarBfioXi21pMCSyP3OYFo=; b=2TjPFf7vhOOnlAs5ojr5gvT0hGXY4Kiu0rSpVQrliwBVGZqBgDfB8Zt+wQaQ5yml1D4r RKo3n1f0GqD4PH2gDGN0oPZti6w6u91BmmXeA9oYZLZtV57ipqEW8rlv+iEtLXytcShg HHfYdNQXr1iYlXrwNGMqwScFttOWS4/T1exu3zj3g99VEbzsCddRdQQgsVcefQ4zB4qV QWHCyo9EZkDvjzyXrT6+dTsR9s9v+ML4uBv25mwNmwq/0SFww7FlCvqIGnpyjZi2eWBS XXQsu2027G9lblRm2US/mQTcD6CWZwXfUWZQ7IwAdMDgzTDtqP5LQLI07DGrtioTNn5A 0Q== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxdhg81js-9 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:21:09 +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 385LtOOo010429; Tue, 5 Sep 2023 23:16:35 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2176.outbound.protection.outlook.com [104.47.56.176]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3suugbp36k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XTQ4MZAPU4zmQU2mBWLaw7+BI0lqmRwXKNus+gQjm9onBffRIpTSwGYNHImR2BFHVgybfOomBi4tR/+2ZOL46PngQw1LZzgnhfkKl4F45vCjhl64p2d0Fc6bQMvOs5UOhwrOHEK4MqpKACmam04nCP79Tm4BHtq78BH3SrB7aTEG24hdjvhtw32hnrvThHyx+TBsqX0IIv2WCLTAlrI16mbGcPOYTUAhhKOLTV+3rtPnKObFAjbLnzGmqmhmEj/bhPKLcB4KvykTQBMfisH15msruyMoCiQBIOQpODAeJsSzqvcIPqFXQA4RwdTzxeDuy8bC7z8UttoTCMOUK0uoig== 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=YUCRZJoLfc0wZenya+ki9LarBfioXi21pMCSyP3OYFo=; b=F+Oy996V8LhZTeM69ONADmyLjt3jJdgw7wxNd5YnvYL21QtdQgh49peHl1bZPLGXUYh0ovOp/hQtbmnd7n5e0KOZZ/1zPk5b6FjCMjMl8Ty7maFDEGyqCv698Xz3iJfFwy58lyO78gMBfsJvULle19n+/16k+H2P9xg5M4aXCOKA3B890g08zDYieWAhAXP2+3ib2Xi+WkOYfmj0wc5KZYE2zwYs89g3PKvSlSghycit+Oop5vvx75AbkmgmRvtFtVHyIrKkET46Cj1WaHk7ejTmQykyEssMN6MxH4F94a3k2oUDrFOucccEpwup8g7Qj+x1uRgOq0eTw7FwRy2ZEg== 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=YUCRZJoLfc0wZenya+ki9LarBfioXi21pMCSyP3OYFo=; b=Q3g/yCFUOFLMzoRymMw9i7eVGnoL3TixcQ+EgSa8LPOZkNILLF50i5WSiQRqiIpsgBWP5dcKIZPuDIiIu++7JJE0uYaLXNKFULAsO/a8nn3VP7kuXbj5mpTmMuMKknsJQ27RiCyPl+hu+kscA9iFp8KPtZBI5s23+x5j41TAufs= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM4PR10MB6109.namprd10.prod.outlook.com (2603:10b6:8:b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:32 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:32 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 23/34] scsi: sd: Fix scsi_mode_sense caller's sshdr use Date: Tue, 5 Sep 2023 18:15:36 -0500 Message-Id: <20230905231547.83945-24-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-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_|DM4PR10MB6109:EE_ X-MS-Office365-Filtering-Correlation-Id: f2c9420a-33f2-4f47-c1b0-08dbae66248e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tgtcREbrxD7e3Dnw31SlFrVoAKJZ+g26uReAY74nNbFwNDfm24+4FnBP5pFJyxmiew3lKBrAa+uBdN2KStMiDnSy5lt+CKHJFP9EbNFiltFgwHcaDtoaTQPdXsrgr6BIevbcrKeRRB+NVKOStuV5T1wabZpXxacY8UeQIKNMECfGU5DcyH/S2G5Y5aXzOVmZSxrFnFQM+nyki/Nh8sUFHBFqHa6Zlq70Pfl+qsb7sxwUCwauEKP+kHzpodgITRZh/RZUDbAQFiVJlxUNkPn8mEvcNmAcJRdClSJ2X2UNq7BEkZyY676a/x6D2/1qTMqNjw5I152npRWKTBZtE2BfUMLp4ZCE+jrJOrJPRWeGFAiLgo82qeNkcNOd++I66JOc8P176eRXD4ZY+qC+EI9HKfNq7nhtNn4mKiRsE5tEJ79xN1MnpNy6LggeoUGyF+Zm+3bycJdFkalO6j/983LQ5jjSSCbfX2RI3Ukmrvy5DN/NQ0u6kimBiIzCf4nmA0pHKamDONcNhdJacSr3wc+t4MAfUICfcLBhoo6T5kEtO1CbXo7BQV1pxR1NEcfJxo4B X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(376002)(136003)(346002)(186009)(451199024)(1800799009)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(316002)(66476007)(107886003)(66946007)(66556008)(8936002)(4326008)(8676002)(1076003)(2616005)(478600001)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iVTMr99Qm/WBBUTqeEBRm9kHd+4OiS7V6F1dqd9apYgXryrZR7cIkdfB+0bwwfkduNnaamp3XDzouIN0EKiPoYCa/Ocih/l01EjWtnD7AeXhlMJwyrsk9aQHqKUcF7MBR12jt+wKWpTXNDpzlwRdkf7tKv9SWr7DXlB9cd/brQzRtBFLOyXTd3UNqLX+jlcSsUnXaRPJPGCayQeh/nDNdab+UF/a3BWHYE+qHzpmeOAPU7YQxLwx28X+TlghnGRV9COvPzHoZDv9Ca4g3cqcY3zUN7udKk7swOn1VnURuRzTtIBtx8fqir9XuWpcU/MEv/C2XwdXx2uS4bHR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RJXpLiC2+1RGlX8wyNv8eCe7yk+aiYznj/4b+HqqH+B61r3xhsxPzxeGWQwiBWXyVSHkSVhdVTZOvAeU57J/1dZ2N65VVb8hY7Sfble7Mi9CDtGTDR5IUrbOCt4CS0E3KFwuAO0vUqlxG8EPPgPy8sOyD07stkLB+FnXWWA5IS8f9pIDamqGskjK//DWfQRnZw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: HITcUhJAGXt1EQAZ5s6xhq337/WPECkqMyFqmccHOCcqyO0UoORxPvDGu+b0gbrggvp073OLk6YefelbZfDminNsZQpW4t8xWQcZSYYIka5rqekDsoxgLFm1yuO7erko+dRVjilqqboKzDUEHsdbaQd0vERQE16nzV0TjRY+VXQynl6XdH4mg31sxThZBHYcPJ6Rr9zjq+TzT1sdjHbo3bvR+ouy56bWE5pYpCFjfEvmczxmXizRknITUGkFOEksn35/iPDqrOjziCxeRCEJO5WPGm9jkP34jjlyZHnXGIbIH6UhjYJzQy6aS0j+2JBoBs59kP5skY6vWgAhNIY4D467hVFDbPmuy9iv8dUqlXp9d4CZ7qL57+cOOtNfRNjdq3cNz865pGchn82/WQX79rbKcNx1YZiI0gt3lVAagFD/eUIPcf2SoGp4TJywqB/DLT/NB6M+GtI9rbj0f/9QGAIUv07LYIIK8EjlCwAdPzlAoinNt8Qw+5Q432w2ELTebPMsYgPfPeC9wHJwqj0Fhu0diHmIhvUReCJgsUaqkzlLCZue9JLsS5e3G4e4N7rnureZqIz0rms59HyWzIikA6FZO4iZHrifZJUiSyKZrn/cagqy3YCR7x9l7Va9c6sjaBYINsUxsrjD9a22mTzGKvu0bcZMPTR4Yfd/lKT8aaQAHFT0xhOA/iJeJYKQPFRvouF9YB8Vh44b/U5TbPkj4QdI2CjvNmrakp7BYE1t8RNxS8ZU3U8OpLyJ5gARER+VYzV64IK8NcYamAjG1bM2m9DAkACcL6SxdAukDLf38mhiG3wcE9L6MiZXRMpjVXoTnaXFQ+Jr3SHMUQKkzgQm+E1S+JD/u6EdExSv/m9JSle/XrpvfXA92gosVnt+aqnF X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2c9420a-33f2-4f47-c1b0-08dbae66248e X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:32.7484 (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: 0vRD/JIG8MmQZSyt+6W+XuFjVpLlAASoyBjCa20NMh7xNmSYC1/f4i++E21WsNgHXTmPWC05P8mr5LYtxYDrce8zk/s8zIpRqkduLENNak8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6109 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: 3mHnKHrGWam4PdaGzbekxfj-vx9316fQ X-Proofpoint-ORIG-GUID: 3mHnKHrGWam4PdaGzbekxfj-vx9316fQ Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The sshdr passed into scsi_execute_cmd is only initialized if scsi_execute_cmd returns >= 0, and scsi_mode_sense will convert all non good statuses like check conditions to -EIO. This has scsi_mode_sense callers that were possibly accessing an uninitialized sshdrs to only access it if we got -EIO. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Martin Wilck --- 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 8efd5d8e46e8..6dd2dde75354 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2938,7 +2938,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 */ @@ -2986,7 +2986,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 Tue Sep 5 23:15:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 721425 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 DCB7ECCF9E0 for ; Tue, 5 Sep 2023 23:21:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241424AbjIEXVX (ORCPT ); Tue, 5 Sep 2023 19:21:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229905AbjIEXVW (ORCPT ); Tue, 5 Sep 2023 19:21:22 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 459A9B0 for ; Tue, 5 Sep 2023 16:21:18 -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 385NAAgA018624; Tue, 5 Sep 2023 23:21:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=rGqIjL2BEoDerG581WhKY+B05xy5ECIGM99ZRskov9E=; b=k1ME0lcDm8TcITtbqRlFeS0v91x5MeYZ1Xz04oiZ6tttRJ2Mgciy5T5IIUTQQuuTnUHX PuILvHLWqUjz3h6YdrVJZ7UoRxNVXo0Y4lcWWluWbggF8Gpqz2mSJjuyL6tE83J2cBCw Jy+QyNjpwrjR5dUieK0icMmMBe1ypiDpOQjmeBS1ZmX5jTwjL8/WdQPdfqOG//pz3K+H mOpTd471hIc4AomlwLGZ3Ilr2SmP04lClmN+yZSXpax1HSXd9heqaqNFwesBfhI82nH0 6wf1MCvNYT7eGEViSZ5MMsm5aIr+d3n77TEGdksB6yJMur9aKZIe6zCteXxAQu+Hgll1 8A== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxdrn00k8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:21:05 +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 385MDVk4010582; Tue, 5 Sep 2023 23:16:38 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2173.outbound.protection.outlook.com [104.47.56.173]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3suugbp37f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kWGMItHDlwymQSOo0avQ5UKHZbyAVlW527/fO1RVmWaQ97wjSoloWfJhEfl5b/O+I9bHRk7kK5gxY/obpGlvMFUYH0VTGYXGCCUTTIFkddpnZ0q2H2mkGRTBuJ7dNEIb9utLFGeHHWvJ1LfqM/By6aZyK/uNs31lipU6upNLdM4ujYPZPaK0qQ2xAWidE5dFhieEWSiA4vWejNLiXoqBs1tt3d1g7+83n+26hBoK9b++wW8+T1lpzfocKRYN5yD/bpp7xXUbkL3Z8Olp1raqmwzsejKPJmCF4Z+S2h0UGaxN7CuNiIdwZi4PCjGlDofp0Y7vEx0I/MEC/U1WvozeRQ== 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=rGqIjL2BEoDerG581WhKY+B05xy5ECIGM99ZRskov9E=; b=ioT0JVaoHRCvTWWgxVDY5vBo5JGHBgIzqYWGJ2UpU91xpDER4uFE0912ygyEyK6scN/9q+zABybYw8JtqDu0ZGpUQzSOSZ3M1ArIinJGrtuX/YxR3EQqhG6k0LWDBPZyJVwUSL4uSvBzS9Sd17KRVFX6Q9DCxCp3loScVnTpgP+4uT+rOQ6NRaJpSVtqPh0sxsk9K7F2HkS6HzI1KILziSvnl3MtyKIf1CYKk6xR2OTkPlcLSr08UVk8IrbZIXWeAHzgoNpQIlZLcgrEj2AUIHQ0pC1wYbK23LxmxcRP/2qNj1+yDkhM6gO1lqmvOE1Nwp45XCvkR0BiYHcasaILMA== 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=rGqIjL2BEoDerG581WhKY+B05xy5ECIGM99ZRskov9E=; b=fVOFLZgFiRlQx77nl/RoAwnkGp+pzuuPxOxP0f8yIUuADuyu9PstjiGPOpI6c0t3troM7s0SCnNCoBAym8t/o0D5FTTkE+iU2OOUqj4ij0K47/YDJS719fIOUcLEvu82/yGDW/9L90H+rottd4x8u3YnhnGLumr2MbC4ktKD/lk= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM4PR10MB6109.namprd10.prod.outlook.com (2603:10b6:8:b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:34 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:34 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 24/34] scsi: Have scsi-ml retry scsi_report_lun_scan errors Date: Tue, 5 Sep 2023 18:15:37 -0500 Message-Id: <20230905231547.83945-25-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0254.namprd03.prod.outlook.com (2603:10b6:5:3b3::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_|DM4PR10MB6109:EE_ X-MS-Office365-Filtering-Correlation-Id: 77673dd7-d1e4-428b-bdb5-08dbae662586 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MXXkJWgxiu35x2eFoxdWA0xYhaoV/GeVvwLHPHq1ukLtNH0KdOfx80gNDBYpAo+eo0Yzuu61EB9WWPPWNgGWNsVX4gAtL46Nz2gxoNp4jUfmKiA7Rb4mTI0GXlPwI4GltW1Ns9an+vpJwLUGXEwnC+qf+nkY7dAP9vrmjZArFSCGyHAEaC0fmDuF//SyQP58/y/bnvKa/tn9b9hrQzDyE6oJ6btNpz+EiKsrmwgJhlUa3rHQVbso13RDhBinffmTjd9jim21WuQvsICcbjsb/uvPjsmcPT738mSV1O+uoDlbXjE8Vij7/XFZOI+hJfzncWd1dlTAxGeolZ08TFksyiT5daIjdOaP1NVlOBW/7WdyolAuqtV3IpiC0hMiS1GouZA/2FiKymOxfuWVBAS/aOTYww6oXBCCYwdNBi5Mp/MZsJKiwtP3FPFNOFe+EpYdZY0Ntie00jnrJXhn/CVNNpeMD+4j3gwh4eSq86J8ocogjmpW3fntXYH6EBnriZ07mvbzZ+U/o+ScyrUH/scuHaY4D1Efv80Az8Z4VAXfdOaLVWaWPlBWLLsD54RU5Tpt X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(376002)(136003)(346002)(186009)(451199024)(1800799009)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(316002)(66476007)(107886003)(66946007)(66556008)(8936002)(4326008)(8676002)(1076003)(2616005)(478600001)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: b8p6Dw0oWi1xC7+anjbCC2BlK6NP7eJ3Y4qB/LodxhKB32CJrNxZXwFODqovRbUSSR96kElHH2aYJJ3w3ZCq+JLNQ1EIWYHnpoCe4UU6XzbU4adpqbdnElolxnlV1Tkl9Sv8vjIEw4aTObzZGpr0z9h5Q04dlMOrVw04DTR943Q0UqPLjx19UJyi/4bOpTKs4IENQf4fSoCuznZUQJt/CpuTr+K1owUiJDiFDaeTcsLQKEpVG1k/W0tDkFEu4LZvFeH7tvmKG7s/D4CPg/Hbqg6MvTvakqkS4owpoA9imVnWoNYqpmluxHC09LgyjBxF9nYEl3YwBZZ56wXBnpF8V2MsT+08f5OMUvQ/FRrzBRVfA1oldYu840THQzrt9b1qUTfXlA9bxkIdCZEm33zWY5Y5Q6BIBDJOTYWohqrYYf5pNkn+u0Gig5+zPR8AcL0eDhh2ywhMrRnI11M+Sctw540GcRrW0L7wyU69emA5XYqyQmZbM4XBZmOR4RAOEIj54Zos9nvfI4p1nbr0awdh4OJEIjkm2y5LcHu9ss42j7bmDaMFR37ijIMAHh+mPvhrmFM2xB3cRaf+isCt3UnAlcuIqdfZLCUWIqmNlOp0HF+yQR+VRRrjybtzDaamh1pmcTOM38AaPhnT2z+FcF5dKLa+H6/qrDBRCcym+QPcg39tHTBwX8iYNHp2D4DdvcwdPTe8S24zAeRfX4ELv3xXPENYxck3vEoCd2QcNSzAP93bfq2hMieQHzg71Ka8mEvsXUOCVDT65hBslbH7lWnpdVYSZIW78IMmvq2tcNaIGRBda1drnVznL5yevlBKKeHDiGWk06xpXaTE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uYhyN2YmFoXGu344uoraJ6lDTcEZr/E1s/YmucImF7X9+Jo7NGa8qevqiH4v0fyCo5X/ERtXRaMZsUOz67CwoQ5dXVELKx346bAd8R6PjRI7EDMycJbdVVJ8emRN0W6zuO5D5u4N6093eBK8GmDQIb1eeJzG7NJgPx2V3UdyFcAzYqiv68oAjLFMnzYJxK1YlfuX6Iap75ctmPzZJ/4f39oZxuAf7F8pwg35ae34G4tum5z5enxm4BtneqCTQlgVNmIipVO6yTPym0Vkn5TNVsk28A035sfqUqs6xA6MDAvjk/ZxLD3Hkbehuz5kUqXwrxx5Kb1ICVXKm7Uno19GH8HDBVyOjn5JxvetAdbjJamT4/PZJ+UTLYaAhgiEcCZHaGNK9vsw07t5lDiNnkaz14VReL0oNQqxAlalLjrRX7ooXC49EvCX2JTJngnRXrbUl7lnkorDAXCbGRAi40gh/fqdurIhH63RTz+8z7j6LactJpotp0Zqpkqfx97jTdfeSu+3x1hXHvrR9VlWBgmm8D2YOhYzpcMPxQoT4KU9XTT6y98fJ5bm9AnFOl9mvB1BLGcLVlfwhuAK67s/xydN318zCbb54EfY4skrVqbhnBBVfldnK7kEw9RcCN7OhzyFvrXOjcXU4A9xKq1rXpRlRaXPcI3 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 77673dd7-d1e4-428b-bdb5-08dbae662586 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:34.3821 (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: GtRElbRRQYC60yZXPTDutbmdFoq94yffGZHJkeTSlgvVMtSSPKIX93W9ADdBXIK+3DuZdRA6JhSYt1dfxUS8TWkiCNo8BUuQF4Bj8UNctuU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6109 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: hduaxdFT3b9E0K3UjUBD15PeuuQccVAL X-Proofpoint-ORIG-GUID: hduaxdFT3b9E0K3UjUBD15PeuuQccVAL Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has scsi_report_lun_scan have scsi-ml retry errors instead of driving them itself. There is one behavior change where we no longer retry when scsi_execute_cmd returns < 0, but we should be ok. We don't need to retry for failures like the queue being removed, and for the case where there are no tags/reqs the block layer waits/retries for us. For possible memory allocation failures from blk_rq_map_kern we use GFP_NOIO, so retrying will probably not help. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: John Garry Reviewed-by: Martin Wilck --- drivers/scsi/scsi_scan.c | 56 +++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index c27b64a1b239..b29c47c2a5c6 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -1412,14 +1412,33 @@ static int scsi_report_lun_scan(struct scsi_target *starget, blist_flags_t bflag unsigned int length; u64 lun; unsigned int num_luns; - unsigned int retries; int result; struct scsi_lun *lunp, *lun_data; - struct scsi_sense_hdr sshdr; struct scsi_device *sdev; struct Scsi_Host *shost = dev_to_shost(&starget->dev); + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 3, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Fail all CCs except the UA above */ + { + .sense = SCMD_FAILURE_SENSE_ANY, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Retry any oher errors not listed above */ + { + .result = SCMD_FAILURE_RESULT_ANY, + .allowed = 3, + }, + {} + }; const struct scsi_exec_args exec_args = { - .sshdr = &sshdr, + .failures = failures, }; int ret = 0; @@ -1490,29 +1509,18 @@ static int scsi_report_lun_scan(struct scsi_target *starget, blist_flags_t bflag * should come through as a check condition, and will not generate * a retry. */ - for (retries = 0; retries < 3; retries++) { - SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev, - "scsi scan: Sending REPORT LUNS to (try %d)\n", - retries)); - - result = scsi_execute_cmd(sdev, scsi_cmd, REQ_OP_DRV_IN, - lun_data, length, - SCSI_REPORT_LUNS_TIMEOUT, 3, - &exec_args); + scsi_reset_failures(failures); - SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev, - "scsi scan: REPORT LUNS" - " %s (try %d) result 0x%x\n", - result ? "failed" : "successful", - retries, result)); - if (result == 0) - break; - else if (scsi_sense_valid(&sshdr)) { - if (sshdr.sense_key != UNIT_ATTENTION) - break; - } - } + SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev, + "scsi scan: Sending REPORT LUNS\n")); + + result = scsi_execute_cmd(sdev, scsi_cmd, REQ_OP_DRV_IN, lun_data, + length, SCSI_REPORT_LUNS_TIMEOUT, 3, + &exec_args); + SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev, + "scsi scan: REPORT LUNS %s result 0x%x\n", + result ? "failed" : "successful", result)); if (result) { /* * The device probably does not support a REPORT LUN command From patchwork Tue Sep 5 23:15:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 720331 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 90774CCF9E2 for ; Tue, 5 Sep 2023 23:18:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240460AbjIEXSF (ORCPT ); Tue, 5 Sep 2023 19:18:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241072AbjIEXR5 (ORCPT ); Tue, 5 Sep 2023 19:17:57 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA5F6D2 for ; Tue, 5 Sep 2023 16:17:54 -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 385MZn0V004023; Tue, 5 Sep 2023 23:16:44 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=vDCrrL8MAoxgtZcSnNg21nV5IHjLXopdnb7bitjejp8=; b=wdf98Na7r27AW6mfX3XcLhp1EEX/F0maCwSqa+2CkuqlexBIKjfyRPp44T1DRPx8Dm6O f+jLgZ3fmaPIeaaZlXmp8GoGqsaR3PGvu+HWooCc/KzP6JmRWFDiTxGDdhQZPFMJ5bC3 kMBlbf1vt7ETaAJmaVDGuOGCNhpGujry5vsPIy5uq6XmbvO6HLYgo/BPYoNqg+IPoBHD j3muNnlbxy898mzX0LwAZ83THCADzi1uwHFRO8Ed9nezDxM8IG7cmdD0p5uunXBE4Fcs PAyX6Lv5G8BnGZiUoiVFiwjsV5z09bNj/J3SbSQj5LfEF5wWrgzJeJiMi5uMMkBMlU6x gQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxd8d8206-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:44 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 385MD1JP029122; Tue, 5 Sep 2023 23:16:43 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2045.outbound.protection.outlook.com [104.47.66.45]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5dy64-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Di6nmLkGF+ctoDXBH/2bqFBiWFjj+Sht26iDWXw3wjhcZT3jIeyVvppY8mjJargmXimQpKDLs+aFJ8iuG6yAwBx/3dcn6zUaEde5s/iBodK2K+HnSwLTCSHVaCI8NT0WjxHmi8mEPAgw23h3yKWGphyadqLkwLEbQjH6Ji37TbUhrIqGD1aR+hwmmM2MVqiFEvA+eVIAK/tXFMhpxNTueulPwQY1fYleZ28Jf1295ehhSwh45qJlNycJczOsRPHD9KFwFDuoxPxoI6kwCDGKru79MI/uVivI0w8AlrP1P5QufcugK+fRukGsX4h0d8xypURtxW94tNW53rVBKcSlPw== 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=vDCrrL8MAoxgtZcSnNg21nV5IHjLXopdnb7bitjejp8=; b=LM3YY79ZHqxfb9LBYbljNnNmPpz8gDnH/WPlk24FwnHaqu7JVDs51QIxjKhKmwsengVSPAxsj4eK+cd/HzuUNoBy8Ly/ic78GezGInIfMY/ytgtehncVaNoxG0ghqZkU4xvidap9XEq+NCs1wp9gyK2WZPWCV01OfhVrSxrchvpU527oe2Wem38o+tRrnxNMnoDk7avBJ6fPyUnQ3Wn/AIj3CyBNeT9PJqIwL7//otMYvOnB3S+ya5W9qxquj97Gw1kref9j+I54Fu1Bq7MDUgLAbykeFo+nyBwnzuAXCj4+b3+886SqVJf2LVGI3BhOTeqOcsO9lQjLAev1GBWDLw== 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=vDCrrL8MAoxgtZcSnNg21nV5IHjLXopdnb7bitjejp8=; b=LvaFxkwqZsVaR77/Dv0R/15Slh/CwzC2BeAkrCw4Q2bI0tzr1ql2XQBDibplnze+b4jX1Z5LCxy/+7kSvmr4GNg7uBO+DV0pxcxFvKav9nKs350DB3+YHD+OBh2lWSH5mnNxdrRAjktWL24eZnUIKvUkVBLYuUI2oPgdpOA+WNU= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by BN0PR10MB5287.namprd10.prod.outlook.com (2603:10b6:408:12f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:41 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:36 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 25/34] scsi: sd: Have pr commands retry UAs Date: Tue, 5 Sep 2023 18:15:38 -0500 Message-Id: <20230905231547.83945-26-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0307.namprd03.prod.outlook.com (2603:10b6:8:2b::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_|BN0PR10MB5287:EE_ X-MS-Office365-Filtering-Correlation-Id: 4f593e50-9de5-402f-a5f3-08dbae66268a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9ACGW7q6BbaM4aqlGAqxCXlxkge5pAUVsrDyMDKikl46+QLa9LtEUViSaFbNcIWu+vZsFEOyvi8Kta9E1dsd5Eoz0ckMVkAzhPt01039pngZIgHhXMH803WB9+85vlwDeCUrx7UxjQN2taqUtj+XLlivc9H+LWCR6IsBBeeOqIWqpBzzwIW8Cv0KvjnfZrSULb9Tziij5+iFsamjyWhJqw2D5rWLqGON3BMUAVkL4x7ckFo/kZ0OnftvnfM1eQm87fmOyePlB5P2ANTZiwB3adUBnSPePDmej49yGkYIwZN+BNDuQMr3i4GmevJNZjYCDfrAqK+DtItCdIXRB9F9V2gIRQ8pVRFBxiDXKpHkybt0H/EAaTgZRMNMZvDVtrrqBl1oILthXYMqcjFI8rMO0IKcJOeqGbgO517YlbAwufJBZc49a6l6fS3/nXZQC9IOxCctc/QhHvjmWvHJXUB8VwSj6gFhXUrIrEoeCt8BleIJabTMLtutND4INZRXcT9iv19M16CIj7+UDtgVRNqXjkFgtYIdcR+ofl3wYGU/dbiuxOU8prWtjV0MjdoOPCgJ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(346002)(396003)(366004)(136003)(39860400002)(376002)(1800799009)(451199024)(186009)(5660300002)(8936002)(41300700001)(66556008)(66476007)(316002)(2906002)(66946007)(478600001)(6512007)(6486002)(6506007)(1076003)(107886003)(2616005)(4326008)(8676002)(26005)(83380400001)(38100700002)(36756003)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iwSLXMk4N2Cx5H7bdfF7LFIa+I5KzO0pxr+aYsMpANp4FutQdTZg+GHpr+sYDrZPffZYymQ3u3Y65cl0svIdEFlMRgngNnBSH5UdooqHhh1+82syJX//HnfUmovPUhJxgUsKr6nQUJddGEt4sZHFLme3o9qSJep0d54KhrhWv99Omt5dHTtv9ivuxRaS74cyhvxqFMQLVPvNXl04g8Gz6NUe2P1ck0rSKycOjetCyZtM9so28DUNSxifb6Bo7TgkPtjoEAIb12PEWPkwGPcZxssQkahptuY6xBaZJvMVQiO5s3I5ktjAVPBsU6qBMhtxe/a1Kvl0iE/Qxt7QHI5To07OLVrQ+qEzzmRA9izojyZK+YiOBMHkCQgdfNKq2rC66Zceli2fSrA7HV7isv4zxYkfCU6Gf3KdR1ePgj20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MyYSndcfKQB+fv0UEnh6viFgWp8jYk+89bCQhV833ulKrRc7tOOWPKuAvl9ScqpUiPSGJz3pIvfEfMOAZiRcMQTmjZSzRKt0hsjnhgw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: hZHpIMqb5zxv1WKQS4/HmRrdyszpXSYbVg5a6o7/ikG4OELux7T4nZcI970hw/k3WMdQf8//IGDwN1hwShIhd8zPJi7Ygn6qZFku01H2x9nPDcs3PCfJohvQMFVqD0QIw8ja+W7mdBJWhqef4EZD2XFAuq+JIChmrXDZqhtOZlUR2E7YnYFHmCVwOqS0O39HQBe1TbPwUYcgUBAe+IPn5JZ3pzwj83Mpi2tuY8YtxuQNabW5yxfvMtdrRCwfPNApsSYlw294f4tw1ctBkyq6bjy6w3Hcx39GifbqluBx0oo58kPpb2cG6Wqv8BrbrsItiWLrxTThnIoefdix062ZjiBQDQa79P4YRvYLNP6CHW9DiEcl6EnGyzXwPbCOHMEIcc8Zce7Oro5IzHL40ceLX9BQ6ecbUepTpM3UA8fWMgzxARtgPDkmqdXVRUKhlBUXPJI+yzfQc7QkbQoeWai+yj/rhMosw4/qLarOhvnak/XpSC9WEjST8qenety8c132kE91hC0EC5Ctt8lKFtOhrMv2FVz2MK6vJI67mr6M6dr5aNYyUnwGhynn78jvyvi0K/MLk0y7RJHmCqwNxbWLcbkxv7EbRxA5tLn+sY/XMQwOwNyur8/OqpAze2vYCKwJLy7i752AdmAu/DOlt5ZuUqnT7DS5+vCnFgSz2kxShO//4NztiOavZNZA3c2ablexS/m7EWJDftH2A2/fMCO7auAkKDGj6O1yMY1SXIYZRUAkCw9pWJD4GJuBAnRpbAu2wTfLXvfAe0tQEXUKTfK8U4Wpv7Xt8ZeKDVU3LyvXZUIKJnnlXPG2A8DVI1Yv82Cr91qBrJZMnzkUdr47nYc6SDqKEs64NMA7xDeTsJYM2N3IOWF21G7WWCUByWQyRAVK X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4f593e50-9de5-402f-a5f3-08dbae66268a X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:36.0591 (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: 5PnYVFeWYpCwkRbeYhnIO2vS6S8nQ8nQl80xDWexsh+25FJBXYKAotK0+7Bvj+fd2ThrhH8HWTdMn20Gb1l2c9IxwmeGaLJ9tBcWUVWAU4U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5287 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: edbjNXl4TNz6SKteLgu-_O3iveqMKcgO X-Proofpoint-ORIG-GUID: edbjNXl4TNz6SKteLgu-_O3iveqMKcgO Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org It's common to get a UA when doing PR commands. It could be due to a target restarting, transport level relogin or other PR commands like a release causing it. The upper layers don't get the sense and in some cases have no idea if it's a SCSI device, so this has the sd layer retry. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Martin Wilck --- drivers/scsi/sd.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 6dd2dde75354..5b80f1df4cd9 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1718,8 +1718,19 @@ static int sd_pr_in_command(struct block_device *bdev, u8 sa, struct scsi_device *sdev = sdkp->device; struct scsi_sense_hdr sshdr; u8 cmd[10] = { PERSISTENT_RESERVE_IN, sa }; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 5, + .result = SAM_STAT_CHECK_CONDITION, + }, + {} + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = failures, }; int result; @@ -1806,8 +1817,19 @@ static int sd_pr_out_command(struct block_device *bdev, u8 sa, u64 key, struct scsi_disk *sdkp = scsi_disk(bdev->bd_disk); struct scsi_device *sdev = sdkp->device; struct scsi_sense_hdr sshdr; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 5, + .result = SAM_STAT_CHECK_CONDITION, + }, + {} + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = failures, }; int result; u8 cmd[16] = { 0, }; From patchwork Tue Sep 5 23:15:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 720330 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 15E75CCF9E1 for ; Tue, 5 Sep 2023 23:18:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239411AbjIEXS7 (ORCPT ); Tue, 5 Sep 2023 19:18:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233757AbjIEXS6 (ORCPT ); Tue, 5 Sep 2023 19:18:58 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82389D2 for ; Tue, 5 Sep 2023 16:18:54 -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 385MZkkw003967; Tue, 5 Sep 2023 23:16: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=CAmU9slHKJuJY/yjF4NP0LsR326+c7BwsXF2Z3pR6xc=; b=cLwPR8rHvDVgTiWgNlKpX6qgyT4KVmBEn03WBYt7zQ6XmIEWsvoMP+/wQ2mq5q62d0W3 R7NmNJ77+4+QQ22wgNbJfF7k4uEQQhRmiwJxVnRGvWb5YSqqnM0tIg/JxWH/j3szIJP8 CseOP5rRO7xCfabpYZSRtrzt2+wlT+f5iRn4gYLbzYLw6+69ZewBzBscEUUniZ6ustRU RybwL6y6HWb8qpt5xONavMkct5pD+aQBqe3Kitt2rZhT+uRFt+tlqij8Ye6mDw65zyub z0/zNdSOR39wD5izB003FZyWwpLoAIy0t/G3bldjiUz9bdRVlHd/qInLf02i6hps2mo/ vg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxd8d8207-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:45 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 385MD1JQ029122; Tue, 5 Sep 2023 23:16:44 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2045.outbound.protection.outlook.com [104.47.66.45]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5dy64-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AXzmY1U7vtb770u0QjblUFohsbvLyQISQiXEFDoeXOloxZLvfuN5jVqWmQTXOmfv8m/GBcdzrAOjAIpHF4Hnp2NoPye9gkg7BUgCatWBcoAxkfuukjnYWlLev0ibb/A2dz0G2jibNuTBYW5FC4iOtkdceLqS2499hh1Kyzpt72hpRoxOJjJghi0hSVRqqY3A7pYxbBycn6YBzh82tFZerl6Xj+AQbmIgkxWNawTXHbmkcrRUs+++D3tZHGOOGlNRsKbj55dCuAO2lsa5N6bL+zkmW83Tk9hE3UNQyNU08/04nuVDCDdKkWumtVGvrg5Xy0eJ571P25SM4JKFFb9LKw== 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=CAmU9slHKJuJY/yjF4NP0LsR326+c7BwsXF2Z3pR6xc=; b=Dhqc2z2vY8icPR6cJqoOz6v02Nczv61l8ddhSXIjGvlxYwGjKzNPFO/Co+joz3MX0ZvR1gEjHC2v5P+YTxY3DcpZV4IgDEy6itn+j+sBw+vWeMMglNbde8HOq1KC4/uWzHIipjIHS+MuM8iY/1ncBSTTI5rxADCvKwC88/6kPJ3nP9T4KghsaSdxRjYBjJ2lo6R3XNFJPEccYSMfBOf9EP4lHes8Z39YzCx8VB8RU2cAQ7KZ7aNOLyYkoCT1avRXT8seZleXOc71Y5VqCER6DQuDOD57oz9STlbjexWgmLj0sHCI8zKy4oJX6+QYHNgjRyyziHjQJ6zghDZQ4xHkLA== 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=CAmU9slHKJuJY/yjF4NP0LsR326+c7BwsXF2Z3pR6xc=; b=lZzlRlwOJORS3wfI9ec9L8YhwZfgstF9nkqUlHnKgA4PsENGD/ZNC/Gs1k854PAarLnH3QAa1jV+g8SY8++kbhoKZ5PRme9sOYlWgC6xnxyUKOPc75KXb2B9nHOUyIK78ZubtBvSxtZrBXwhIqfZEba0wG23MRPTpYTu9rRW42s= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by BN0PR10MB5287.namprd10.prod.outlook.com (2603:10b6:408:12f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:42 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:42 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 26/34] scsi: sd: Have scsi-ml retry read_capacity_10 errors Date: Tue, 5 Sep 2023 18:15:39 -0500 Message-Id: <20230905231547.83945-27-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0173.namprd03.prod.outlook.com (2603:10b6:5:3b2::28) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|BN0PR10MB5287:EE_ X-MS-Office365-Filtering-Correlation-Id: f0d749bc-d4a2-405c-66d5-08dbae662787 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UiCSoUmy3CaSkHcmEMxQCF8acgKwW/zyuSKwNwb3qLJhaX5pLcIqeDdVksjnuWZedlEAz0aRluWK4W/RCuCrwbsEqIDq8OOkwLr4llrlhkjz66JW32Lg1B94WBmpligumjQptdlZdmMb1m8K593DGU35b1hKpohAlQFaELdWKj0NhPqDhHy9QMEdku9+P2j8M4SqMpH6kdw9k6TNXfZrVqJ7ZPp24gpBU+zzs1pKx4DPEpqNLML4JTH+A5JPC5QipKC569tTB0Y5J1hh0qLN4SBgkh1H0gjh+TkxPNl19z3mSXjE7YFIAMqbtfi/Sf2Kvg2irqBdZswDS5YBQykv4VMBMz9bpEh73btceut93sUhDs1r731wIyiZyKP/dimLr/+TmodjHtjq+/ThvL2gmM6uolO6CQq2qw2sgd2MUKQC3dA6wOxxMztL5ayYWp+9w2cHwrG3oN8TKz+TTb6jwBitiz64ALAPRa7y63q8iBgr90SLUCAPBfCVVerSwcXo/LzWUNfTH3/UTlqijERrtc4j4jkmQpDvKDt2lGO768wcoxjaZ6SEX9TV1PWLGWE+ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(346002)(396003)(366004)(136003)(39860400002)(376002)(1800799009)(451199024)(186009)(5660300002)(8936002)(41300700001)(66556008)(66476007)(316002)(2906002)(66946007)(478600001)(6512007)(6486002)(6506007)(1076003)(107886003)(2616005)(4326008)(8676002)(26005)(83380400001)(38100700002)(6666004)(36756003)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6Omn2VaD0DWL+CGok0m1h1DpGvf3SaFKgWLDjQqf44no4n6u9E8f0U40/TA0xLDQhAKv6j/mEGQnfzObwkePJAs0f8e7wObQNOzhbzujoNy+imH6A9++QdzNtOLiold2SaqdsqCOm8OEi/Mup68yNV0nSSRYTUln8FtLOK0yG6kMWbuLq7wOB8r9IL/NYRl+R5Fv/ZcN6PAlFXa527o17YNWvhJFK45cTrv9QSjkda5X8IQ2midwltjBynfj2nD1TcmtBjW3rboqZxEXZF9bqsb7VJYDaSk1xgLJ/gGfbj6FGbopTiUFPQ28v7UQYy+3s943Rfp7gwn75taLl8sP0gYql82IJ4YFpt36BQ2tiEtDkYyXqXLwwk8RVSc9T+evSfEXteV9ufP5pehlalpCvvZ4AxXekfjpBDZ5bEe+n4IUge2HGIHlP2j8KKqtbLN1Mcz3xUV7/ikDyEfj0EwoOCOhpUIhs1uruHKBOlXu6F+b/Pury7gNjtyLLHHH7yGqcBS1gdgvKK0wJoPcD+t2RK2J9x2vfYZKsvAT6GWUGVmd5Vt/2Tc24HBo7OZkee3SGNdPE9K4ddZsbC8y5RKnQWWxeA/fUnKvZ6CDHzlZNWAik3b3ea95FkZkGepJ6Cv6IZ51zwwKgsaqpOkYZVkvW7Vs16hMIlyaHggEvQinEDcdCWqj9syCWBcW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Irf6rbRz62FTjCXNR87wN2tlC1Y9CWrvRF8d3VQ5nElWqMlX6oh+1G0OTxeH3L5JIKPBeYluIzAuyGg3jgpUL1v/9VUJ1+JfvKuEtH9ioqbNHtPKdo3U+HgOotDDyhsXYzixcnBQGrh1M6f5Tj4STt05M4iV97MEVUtBucvm5B26rew6Txr3LICgPhn88AsUWt1YpPdzIvqBsbywFS5xUZOZ/dGxu/Z0DgtnXiV5MUErbnuJtQUraXUO8TZnVol/50lTPX5O1EKLjdN6UDr+ualhD6R83dX+EO/+FPZmJMy556ySebcIBBHjxa+6bLvS/MYUtQzMCVfrrWeoNCPGgbe26Zkib8MaBccqVoCIXRvqSaczwnR+Fz7HgiX/Wshl9PPUkPox1pNbDqU50aiKWny0zj8YV2uF6PQLEs0WKIZbL+688gP4yA8kX/jCJCvRcJefHzFLV0AYNYCOV+DxTHwEKKyJQF2vn9keAm6ZIkBM0fcpUwB+c54vQm/MFSRLT5Yl//6r6D1beIkjK5GUkft3oHrF7hzqcYNylmzZZJYXIxY9GAmMLV4JLv8KCPpvWue4aCt35Hm60qx0WuLKVe8oNaTcWRZJCI7RsqXKTPYAB714TxshRZoJYoBYGz5SHIdWe3hEPyKhzG0swvxYPekQiewrn+CNrf7FRFw08TF+LGxEny/5NLqjzqlYNe9Giz71Xz3kxl9n3X2sALT/O1BJBa9ZauvyhZZIaQj45lLjI+z0JAOaEH1UBbo1ldpXMNnkZOG4UOKMFFM/c+B75uBJt7B7pNMQvE5oUVsMVnAtitlKA2JR X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f0d749bc-d4a2-405c-66d5-08dbae662787 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:37.7496 (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: i+We0RSow+KdnSl+b1Ev1N0V9X2RDcqSdRvK2dC/IkS/xMa7PrgYQr6L3rjctkbkuFRFcrjmwylCrfOq2KtZ2JbSfs76l7IJcq2O06tsqXE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5287 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: vdSPZzWhVXbvJ3U0y4iGCKo1FJUNWG_S X-Proofpoint-ORIG-GUID: vdSPZzWhVXbvJ3U0y4iGCKo1FJUNWG_S 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 Reviewed-by: Martin Wilck --- 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 5b80f1df4cd9..781df1fefa84 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2528,42 +2528,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 Tue Sep 5 23:15:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 721429 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 3B9FACCF9E0 for ; Tue, 5 Sep 2023 23:18:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241424AbjIEXSE (ORCPT ); Tue, 5 Sep 2023 19:18:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240460AbjIEXR5 (ORCPT ); Tue, 5 Sep 2023 19:17:57 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF4421B6 for ; Tue, 5 Sep 2023 16:17:53 -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 385MtXrP029033; Tue, 5 Sep 2023 23:16: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=fAOCTf0mOfg0GmgaiGHbbYGPWx4hGLLimLoI0hEJihU=; b=VkQ9AoFv/hgT2Kek0x3WcNFJZpR6MWffVjCR1+CsiAkXpjU7+8iHfsxkFO+ra5p8J9SS jrNweG74O518TP0EigaZGHAEF6DzWJQ+xKZjWiZrSEZFCPgVgexlJvqwuEzObUNVNFx4 mEx22FLaImhh2kbCJDzfnSNB4VUKcDIY1G1Bq2UFKknZ5jcAvsvFl5gH1ilVhP8yUEnJ vnjr5pUP7+7l3X+lB+gNx8da3rXUprSSI/xcXJf6V+fXxfLWPiS9BeKFgamHXfEn8KvJ iyK28WQE0g7VqqCEVoKleyV8OtmnsdZfV1r7pPMI+lLDkb83l41F8E6DFquZ1XS3ZjWp CA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxdj500w5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:45 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 385MD1JR029122; Tue, 5 Sep 2023 23:16:44 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2045.outbound.protection.outlook.com [104.47.66.45]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5dy64-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fqNQTknZk72J7tmbHUMT8JjtR7Sm3DEAi4p9BHbkoWUf4DQXTVAxDMuTO+IkNjywNSeHIRxjGekqmBR8dvGuwRCt6N6Wx9dUPco0xz7NqlR72Hl5/fuKEHwvx4685sXF/UMqA6VZ8xMU06vcUbkVrVjbrPuntleZafXHIBMMXhIjzF9puPDzEkOfm+assyGlPKKi0xFUTwziTSzwu3FL+K2IziDgJ8lj905WoqqvsTZKggeWni+SJ409xW/1PE7nYAsGg1hgbOkQK3RkdqaysqqIfWvymplWPUVaEScLioQdaalr90MvIpEeq8iXprdH0gOnFg9+fNcgv42sZD+rMA== 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=fAOCTf0mOfg0GmgaiGHbbYGPWx4hGLLimLoI0hEJihU=; b=IjJlt5H3LaiZLapD0dbMQAgMx6FHLciLstppmGWD0pFrAmmdku2V8+TSiwX85pTCdHC7howTrzI1yEo4qRyUyBUYrL8QNCNdR3xqC1frzwGC23w1hV9AM0/CIVkppxGTZzmZzjO8Kh2jEOZOvE11QYiyfyX9e9I4/y+hzTlB7KCHMuvndva8pIoUvla+/t+AE4Wolag94nb1bGw16D4+7DCVxXM9RMYlXh3drL4hdK22ZPu6wt7hD+xlDMojn3TmnMpWqUgKMub+Ky8hJXi20zZPFdy8tvLA+vicm6ivZ45hfYByhMFUR05AVUQTKDG3DajOAqyrxM+iHhyhi5H2lw== 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=fAOCTf0mOfg0GmgaiGHbbYGPWx4hGLLimLoI0hEJihU=; b=xLUesZoQxrRyVAQrgRtdd5Dl61S6waszIwFsteJOuBGTcRbTARarN+7Xn5xpR+GxySza1CnQhgi8A3qFIqps7+iEDpxmzhVyzUvu/X8cnKXd5/o1WSDAiDVJcBvKr73LGQ/ZjvD7a5aJbj42QWMMM2xElp+inLymGHV3q0QxDEE= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by BN0PR10MB5287.namprd10.prod.outlook.com (2603:10b6:408:12f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:42 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:42 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 27/34] scsi: ses: Have scsi-ml retry scsi_exec_req errors Date: Tue, 5 Sep 2023 18:15:40 -0500 Message-Id: <20230905231547.83945-28-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR08CA0033.namprd08.prod.outlook.com (2603:10b6:5:80::46) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|BN0PR10MB5287:EE_ X-MS-Office365-Filtering-Correlation-Id: 60e789c3-e3db-4127-9e0a-08dbae66287a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OzSJT4pJrK9fYo8h4dXD/p5fTGDpnCAi+LamLIrKZ1CQL5P7t/77HQo7NiiXVqYBeIJrFu3MSz31nAsA2xgRWGVZi2deMd0HVI+OrCr2IEbdubRAvvcLHqUHAwUx6tdsDRmFzUz6e/jEfKxi2CNuVb5ioqAu0DM2d4z35Z3dffqot+5E7M8yP6hg4vSt/3iNZIHgTbsSKrYln78CKe2uzY9qHPAHLkf7WtzppiLu5AYOSgLBxT/gK9Y8Qr+evb2JeecDt4ftgOHmlPJJY/HYNM3WA5LqmLazKbHMWtzQ/4L4PdeWjBVYabXhHoxKR6hIC5HUOc8V1nYWvN9tSU/TajP7IuyWK+MPoXIq+zVAGJjylXEzRHLCDrE8xal68pQmnoBpIcYuy+G+VS0I+HftGkn7pJGi4DliTL5MTteiQmPz2wHkDj99YGifgOnnXtnJ9nQDVMLU4IMDlq/OlARclNV6jjom4GvT9d2v/9iZSD0/2AN3cZMeofd2lFyf1aEofUvsZk1ehXR+ERM7WGaau61aFOR8SwGLdaP+QO2vUH3GH5ydjZQJiZ87e0Q8BU69 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(346002)(396003)(366004)(136003)(39860400002)(376002)(1800799009)(451199024)(186009)(5660300002)(8936002)(41300700001)(66556008)(66476007)(316002)(2906002)(66946007)(478600001)(6512007)(6486002)(6506007)(1076003)(107886003)(2616005)(4326008)(8676002)(26005)(83380400001)(38100700002)(36756003)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CU090Ksj5GNVusYV8F+OrCqMNgzX4PGr0xZEM14g5Gmop/uxivTYTTtDxtAsZa0gxPGsTUH0gTNiFlJbPWGwY1WWqVI5U5twMgO1LO7DURTI69TKelDm+eESdeaPUJdojEkrMmtyXKXvFiVjkCmcKnDbeWRQkHyMhhLia8Hbu5cbLp1GjvJX1o+bs6IhcMr1O3aOI2wmYMnCfuUCVAV8jDzszx5LYXKSbAPmVUw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LhdExTJHPrbAiQzficLueEoT7XRwBN2LHEZbqC/nQmzQ+PtAka0QE3nHXzT+Khvc0uquE+L392jv63yaCz7SqyCvwBXD9SE75KSHInjXWhzXWHRgXXLW//sVi5ZfPvYqcjnrll0WBX0+bYTzlhGT9gy0NzdITQFiKS15fFxfdg7Y59WK9yM2fge0YJ58n1RbPvkHk5Wj8Jp5NbvVxKXO7w X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 60e789c3-e3db-4127-9e0a-08dbae66287a X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:39.3299 (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: BCWCFUwbU9WYIVA6Pv7QNf1Vmz0jU1e6G7D/BFrtkgsyGsESBR0sPx754vsxrH0Zdg72MdJiUDbNg9jGu+Od8AnydAw+5UpJz4vpXUKfMsw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5287 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: xtMBS0BE1qi4xHaYxbnA4nkuLkx8htRa X-Proofpoint-ORIG-GUID: xtMBS0BE1qi4xHaYxbnA4nkuLkx8htRa 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 Reviewed-by: Martin Wilck --- 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..f3d497366af1 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 Tue Sep 5 23:15:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 720329 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 E8561CCF9E1 for ; Tue, 5 Sep 2023 23:19:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235045AbjIEXTD (ORCPT ); Tue, 5 Sep 2023 19:19:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238111AbjIEXS7 (ORCPT ); Tue, 5 Sep 2023 19:18:59 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B96D71B7 for ; Tue, 5 Sep 2023 16:18:55 -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 385MthKg029165; Tue, 5 Sep 2023 23:16:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=cVeL282nvfOA3+yvDKdOMj0c+JdqSKOdqKk3lKBB+s0=; b=05vN3NGo8WX8TX37KFEhCeWFzjdwCnq+GG/R3yUmYZoec5RrK6+hCnGV0hL+sUL7TWsk n0E5RToG6i0XjUfngkP0wiHChDSWCNWiZeyF0ycQPRFAMNEtTmhhw6Io+gidoqgn6GFl q0lgfea71JOlvmMp/a+ovJxvBVFxmju6KgLfn7dkMkOZnAY8J3foq4wA6RmiDewWLM90 ewbAw+5ccoB78qbB4aIqR+hJxz83SdZbrN3mHr/41f4F7xx1gR6zHvMUEpzgXy1sggVs VNzaRix7bADqj4VXyul1elK2sAg+WG+JOpswQMks1esfD4Ty2sbItMCnlJWErdB+mt// MA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxdj500w6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:45 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 385MD1JS029122; Tue, 5 Sep 2023 23:16:45 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2045.outbound.protection.outlook.com [104.47.66.45]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5dy64-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f2EiVpukfM161MirMcXo+pEZBdpozo4qcX0jJ5cY4N8tS+ONFuw8Mns/bq1Rp3TzZ5Yblm8Lem2ot0y0zY7glA6DQDdlsr2IPAK4b8KHvalMMzCPDm/9JZifkN5iZo4rpm2jYS3iRB5CuedXgfnqApM3wykKlrPydMuouFxkuMBq6OP8Mclix3hQv4WmMb3WoMFaBGz/1fjzEH6TylUKn74Z1NCmy1b5yWQq8Zqa+IazyIHVrAKZ6oTDbCwEQ9gdNxBbysVfaOlQeblFIf2PEBgM3H4WwmrSN4EtbEjJ5XezKW0xXNOlxAX74FroM9HY9tHnJ9Od5KPWDwCg5jDmfw== 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=cVeL282nvfOA3+yvDKdOMj0c+JdqSKOdqKk3lKBB+s0=; b=oZXt3egzbIUjdJytErnoROAWkEP6M4bp2SFcnMpAytKlZqKuCY1IRXCMBDymXzvLKbA05wiGJmBOrA9qkMMg23eXhdx1vwOf0McL+73pIrgoBUAHJqpKfjtcwN2LaT97DIKZlkKxPQvNiYoV3kESaq6gc0evs5dCilqyT1ikkSLg1oN4NDt+AV3atIXsMQsMsp1aolK4uORDU3TXFqq/lkmKhaY73O5lGL9gGaeeIejcmu10+rElHRZVCpiSroik/wx3NUVBcSPtPiMNvml3Y023z4ClE2kGD25NnM9A740pqps0u4VDWXu68WFv6cZc3TThcqwYOo1Y6eFjxjXGlA== 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=cVeL282nvfOA3+yvDKdOMj0c+JdqSKOdqKk3lKBB+s0=; b=F0wNvlqObiv0qrZxBndGXGhQHcm06OtuNRDriRarZt+WhpoWfF5ZXpbUdlHtz4hdxtfaPOWvMxMqY5DEtX9lNQpatbvS88cyOFZk+erPKfu1uxQbUOivzAml/2cos7l0UTckLNAX4HRL9JKx6f0rQ+ytomUcOsg6Bb9EVaWcDYY= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by BN0PR10MB5287.namprd10.prod.outlook.com (2603:10b6:408:12f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:43 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:43 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 28/34] scsi: sr: Have scsi-ml retry get_sectorsize errors Date: Tue, 5 Sep 2023 18:15:41 -0500 Message-Id: <20230905231547.83945-29-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR01CA0006.prod.exchangelabs.com (2603:10b6:5:296::11) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|BN0PR10MB5287:EE_ X-MS-Office365-Filtering-Correlation-Id: a10d4e7a-8541-454a-ad04-08dbae6629a4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mARXFiJzt6WCvyiPb3khdfyqbGoYJlHEPJE4vaL18eNwWI3/1Yyd5uL98lRet3F6b8titRnAMBdlI1Drxf1I8Y6qnxs4KYuOVTweiZozvrc+N9azBBsYjnPt5lTlhMdYIMWXe2fSusIkn/ykqP42qdry3WpVRRmv6bvoVEhbPM6UcCxXksGEUaaYba4G/GuU4iUu1ZRr8CZINjFI1LfgwTCfRQpMrEGNVrHTb4NMd4u7wp/5qxW0BbOWb944rIqp32RfhJRteSIwiYzSaJbWAPaBDlX9Kld2StWbvVr6WODlygruXUEIA4RQkSz3qw7TvuW6UnBq10b1PAoHLyKfXj732nxV/Onie7CSRNIq/myJ1k4/Ble6a2S36VEq3+vUc0cdBRL5J8bxNacIkG2j31tGvoRpfKepM2Uq6y8arq7cbdtp0viuLwAGxNzSsqSXj+NG47JbwCxD0ChxeaQ90hD3ENqbtCp4tl5DaCrB8QEQVbdy4tuKE13cfc/8TjKTE0O3SmCSW0RhBT2h6+DmGp7qflBHcYnB8CW4z5ELZQCtzUfE0d1ngLQAZHKxwTgR X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(346002)(396003)(366004)(136003)(39860400002)(376002)(1800799009)(451199024)(186009)(5660300002)(8936002)(41300700001)(66556008)(66476007)(316002)(2906002)(66946007)(478600001)(6512007)(6486002)(6506007)(1076003)(107886003)(2616005)(4326008)(8676002)(26005)(83380400001)(38100700002)(36756003)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3ns2Rf1jZL0BQML9AeysUYjp5D9y+6ecHRoET/NJ+q/MxzbaSBxp5Hm6pDoBvvQbyzM23WJiq8WDMjkRug1sRiJijFEwQkEcNscFKA0i2/uEuQtUkG41S6WB7yblswn9bsYQhCJi6/W9ThhczE7ZMd6yp1hjTjvVa6AzrABp9sOs89b6qXeLtmib8pUtdNbZqugeexLNZJhva+/oT2ZcTpjW5nSSLAJCIWEdFxvmlb45mZcQzeeI2NiLEtMyY+7iVzJ7pTetL4/9aYX3tuNx4TNOTO26SFjB5KDDgX8ApQBHrGkR/ciivLX+3V/e2vKGxXSRPCOOxEh1BLAnU4P66qi1LbauYBqcqO3nNrISzGK4/OGg/wyEERniVxSRr1yoU1o8fb9Ef5Xz6QvUGAe+zgIuGK0qgkAbdn7zD/hhmhTp8Mklxm534X45EEZdWMoi4OKMjXaKlmm9A3g94v9wHCO5EjmpeASQRLtIUnetyCyJBHIbcsegMQO5GqZ1TIBtGo0oS91Oeske9QkuING4y3PotehTbL452ju6d2d/K8e1TFoO5OcMjQ2gbCQ2TjfXTx8NVjyEi17+73bMzpcyXxAuLQl25vzqTOyPO869ICwnSpaiGFXxnVi7bgHXuG/tW1wnc1ANBFozmhELYnqTW0/2YPOlO6n5No+MZDvQt8cxhb6/LiqZ8phtyue406ZVXg6En19OwuGcBjjPegHPk4OcDUATkWXVXuk2jn6FpVgarU6sF71AjWLf6Emyfbb7i2RyZ79nCSEvraCokMdHyX0E2aDNS0Hwf2kj7ZyKI1up20EwJrM6+JehechybtGf6SNmRd7bnTqk7f7jMDdIdMDAwTTIfnI4U+C3rQENQxEqNjlq+cUn0Oqo7P2acIaVRaQReGN+IuHQK3s7glsf2MrlK14093kozsF92olmLg5pj22InN3XZfIx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OuoqQhFAHoGH1JeCV9q9MUoDBTRm/QFjT8m2yej6gDdRJAvMDkH+azgelwOL/1bi6GOGsWd8Ts/EOBpwj4FfmmMjctTUyg3wYWZrj/oWFEv0Nnn0HkpqNjZur/8SDF0NedmVIRgeW7Bjm9f9hZW+bknjlJMTaKMXMLr/E/Hj+zcThuaz0FH7d3EP0GJgMcs+FV/Wg4AhAOXbR/rbwmrGDZX9FmH+X03B3Hm6h9LKzuQVV7aPakGdCQUal2P2i4/onEwUBc928YYX+ZR6P6j3Fq6t1F+seNzteeUGlcy22aHU6yLOOXmmJr5x0dMbDH09ZG8uObWKMcvmGPpSnYPEuWicgMi66fFTnXVOQUcW5CYVPTMBgBGIqsVTpReflmhFJWN2KWnuK9ERroeZLxPo6/QRapU/EHSwYZxXDFTqTnowSeoLlqqFNWN5cKkwhd/g3GU8uMDxmBkrHoMpuiXVykyhNwerp9QG4s26yRwcPA/NOOTuEaOFd4jDlcFOumhyTmzNH3HCjeF8hciQuvN3BO+PZUVQhEv2M0bFHMWOF6trajV X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a10d4e7a-8541-454a-ad04-08dbae6629a4 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:41.2851 (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: eocso+uApSZTgGp3pVkX19s+NpGj6kJVXVxGF7+RaVEPUBu1QXVnyTkMgB4CRcE3SYlcEvbfQMo+j3SHIk7uC/fIs5j633hWJtkVtyAnmug= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5287 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: A2MOWDJONMUB4BQkp7cuwttAZI7xbJ9W X-Proofpoint-ORIG-GUID: A2MOWDJONMUB4BQkp7cuwttAZI7xbJ9W Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has get_sectorsize have scsi-ml retry errors instead of driving them itself. There is one behavior change where we no longer retry when scsi_execute_cmd returns < 0, but we should be ok. We don't need to retry for failures like the queue being removed, and for the case where there are no tags/reqs the block layer waits/retries for us. For possible memory allocation failures from blk_rq_map_kern we use GFP_NOIO, so retrying will probably not help. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Martin Wilck --- drivers/scsi/sr.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 07ef3db3d1a1..100480f5bc2c 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -716,27 +716,26 @@ static int sr_probe(struct device *dev) static void get_sectorsize(struct scsi_cd *cd) { - unsigned char cmd[10]; - unsigned char buffer[8]; - int the_result, retries = 3; + static const u8 cmd[10] = { READ_CAPACITY }; + unsigned char buffer[8] = { }; + int the_result; int sector_size; struct request_queue *queue; + struct scsi_failure failures[] = { + { + .result = SCMD_FAILURE_RESULT_ANY, + .allowed = 3, + }, + {} + }; + const struct scsi_exec_args exec_args = { + .failures = failures, + }; - do { - cmd[0] = READ_CAPACITY; - memset((void *) &cmd[1], 0, 9); - memset(buffer, 0, sizeof(buffer)); - - /* Do the command and wait.. */ - the_result = scsi_execute_cmd(cd->device, cmd, REQ_OP_DRV_IN, - buffer, sizeof(buffer), - SR_TIMEOUT, MAX_RETRIES, NULL); - - retries--; - - } while (the_result && retries); - - + /* Do the command and wait.. */ + the_result = scsi_execute_cmd(cd->device, cmd, REQ_OP_DRV_IN, buffer, + sizeof(buffer), SR_TIMEOUT, MAX_RETRIES, + &exec_args); if (the_result) { cd->capacity = 0x1fffff; sector_size = 2048; /* A guess, just in case */ From patchwork Tue Sep 5 23:15:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 721427 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 C38EECCF9E1 for ; Tue, 5 Sep 2023 23:19:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239898AbjIEXTB (ORCPT ); Tue, 5 Sep 2023 19:19:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235045AbjIEXS6 (ORCPT ); Tue, 5 Sep 2023 19:18:58 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC03E199 for ; Tue, 5 Sep 2023 16:18:54 -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 385MZ2nx003202; Tue, 5 Sep 2023 23:16:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=ey8Lqc0DNwnKq3aR9o5Fio9/3nA2sbmc3NWbV0tsOtc=; b=xa2VKwOpZt1F0wwJm0RFrvHwBUv4X2tFWUX+f9zbyj1oZJy4QVoD/YHL2P8A9wiOAOPB V0iDtdpo4ESJDORCkLqn6lbVK6yMKenFCvitbbE4KAWlj//82YhiMjtT3v53wESDHpHg 9EsTDMAhRPEUoyS33+wq3Iz1972aSmXyBtSrQdpsjD1Z2UhwOgSQbNn+dGEPTmQx1iFO zSBI1aykm5qoU2gRvfAEwPtJyHzSS5fpMN2+agMyuzhCG5GVPXbKkpRHpvtJGdA+XgUF eiGcj0HSEcnF4nvKxl6WBoTOrotNBeh1DesBFNZ3FseqzDbpe+bO5mj0Xj86RwXmxc+3 OQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxd8d8209-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:46 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 385MD1JT029122; Tue, 5 Sep 2023 23:16:45 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2045.outbound.protection.outlook.com [104.47.66.45]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5dy64-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:16:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TJFZAGOxjeihz02lZKsmZ+h26Rh/H+D0pnbPWmrhnz2lJwg0aUNEACBHM/xlUvSngBu/4N65478095TcgU8acWSEJx4WCjebPl//mMMXjHdJDh0RWVz6WYgrKw5pA2hj6Goq4/SM1+WB5raaBFIpgm8VyIggCSBT1RcS2Mnm+DQbWePdjVBFEuSjF99b4vpCY4fUj5jC/rAwovL6IpBiSZmHEGzncXK09BSHCZQiVeXOHXJ40HdGwVW7j+MEiEa/gzV0xpqZM2ZfadvcOtUuq4+HiM7ACfte6fi/756pUI6CB8VLJhjw4XKQv83rPDg+whpzeWQANp+5rYi2NzojQw== 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=ey8Lqc0DNwnKq3aR9o5Fio9/3nA2sbmc3NWbV0tsOtc=; b=Nrue7I5rmaMxhmTtsadlZLlGyezb9yT+MS5ENdjMkmCCnRaa2pv+qnVoJ4L5NSPbjyu1/vRvzsw9kE3MAJrA4qAk1cwWBzTX3R4eIek49A1gzsRRq4lCd5qsSrtmCSkXRX1n/VWdlgXEwKYQYAvJSSg4F3M7hhao2UVMstdeMfTvoK3E4Hej9sg2hl9BVIXTisuI3HTFDmZF0mof5MNY1XmucWhUclClmXiAgmF1LCFJye2JV/TN4FGY+6WIdCUWYNm9BqtuIqYuEDN5iWKTehpgDidJbf/VzUa7F22Tzb7fMbkNs7jrIMWS26CdI39mgyqk/sh0i+dIJSuhSfS7Mg== 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=ey8Lqc0DNwnKq3aR9o5Fio9/3nA2sbmc3NWbV0tsOtc=; b=Q54/ml2qINba+lz7XGaBMdx9lNs88SOFtcBHHOPGHoEynbLF567xxMWi95Acc2/Rmc8g3q9DK9+wb0/REnRcYHQPWfVfOBuZ3AivDnicasURQtsh2dGucF4ZnVflylgYqcvWVp8GVd2cjIFYpL1qpV1N5erM0AQSUs2pizOxwWo= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by BN0PR10MB5287.namprd10.prod.outlook.com (2603:10b6:408:12f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:16:43 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:16:43 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 29/34] scsi: ufs: Have scsi-ml retry start stop errors Date: Tue, 5 Sep 2023 18:15:42 -0500 Message-Id: <20230905231547.83945-30-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR05CA0037.namprd05.prod.outlook.com (2603:10b6:8:2f::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_|BN0PR10MB5287:EE_ X-MS-Office365-Filtering-Correlation-Id: 65d07cc3-27a3-46ac-bc83-08dbae662aaf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: S6c5WTOyPth4tNHe8oDL8LGAYFfwB2nNv//SpKFnueprWz2gtr003zJ4dc79C4DsVaBpeEIWMADydjPt/LECPLrCx0i1zSBRQMHdw2CpXxFmN1AiHlHAZOG+sGjbgNlhnqVbuyNgbIaeLJA1HNQmszQoFPitBb2sluKu/JMjuyPUv/agexl4JR5YMbScrNlXMXMxSuwWWRIHpStlE0AC86k+B0xayteXZityRztDkXJZGv0pn3kRA+lQjIaRlZ2ZaeK12BU63OpGZ79RkoHShq9SnWQQq7oq2VwUvKnhCLQi/DP0ynaVRWBtqU7yoZaks/2bh/9pcHNeIm4oC4ABTfdbUYNUFmhHRnlkJnO4hJsQ4WpgJevK8TAHDygsYTUm3f3ZPems8ktSW+eJPQn8ciuHxSrtLiGd4FCMG925E/wxhCD1E8XMbTYuivExuScpL5rl4BjA7GS+9yGh7IdgiANOvJboklwvykl8UKna5bbafxHv7Ik9n9XF72vzSouNlH35TBNn8ZBAPOT8rtiWftAPiqdxgnhHrZOeAXU5W7ry0G1KoWTTmp2ijUp3X5AD X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(346002)(396003)(366004)(136003)(39860400002)(376002)(1800799009)(451199024)(186009)(5660300002)(8936002)(41300700001)(66556008)(66476007)(316002)(2906002)(66946007)(478600001)(6512007)(6486002)(6506007)(1076003)(107886003)(2616005)(4326008)(8676002)(26005)(83380400001)(38100700002)(36756003)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CiBUPvftHaUFqNYA0nQLT+8H9Zk88/ftz1NjFLqRyU9dgulwytkgfNTCkVDnXcAM5TeyZhbkru4z1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d5cmuxfkmnzYb3tavXzGZuk66DQoRjefrq8wtc6iDd91So3ftrs1Q7Zx5GywFpLC5U+nIWHjV+s1dFGxPUtqKIVQeDvn/xtgB2nx+3dsa03xiMAe73B1WH+RCwT5B5AtLF3mqSa/hP7oX5LXYz1+YaVPK0QmaCw83e5TBLBtVppcw0byLYmPJXBR+u4yjahubWjJXM0Psb68T3jcDcgQzQZERN2sw4suiZteF3i5t9IQQ9v0up19B01aKJccLc9fQjAfLzMwVJECBnnE09CK312sEzIhbwsQriEzvU+sxyXvqLD8aSPF/ALvd4xtE1g0U6qgguLNtrzx92O+ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 65d07cc3-27a3-46ac-bc83-08dbae662aaf X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:43.0439 (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: rfTq8oDeZuDwCst435ahp78PUBy761nD+mBhshxR6/Id4OaPINr4WmqQkycuwuGh/GXzhap4WL6ecZQOLPFwmWNGal94H+YnCsuKUry0BZ8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5287 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: fkRX_J8yLoHnw-T0mqhm-uCvEpoiIMMY X-Proofpoint-ORIG-GUID: fkRX_J8yLoHnw-T0mqhm-uCvEpoiIMMY 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 Reviewed-by: Bart Van Assche Reviewed-by: Martin Wilck --- 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 c2df07545f96..a65b62d11739 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -9266,7 +9266,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, @@ -9292,7 +9299,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; @@ -9318,15 +9325,7 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, * callbacks hence set the RQF_PM flag so that it doesn't resume the * already suspended childs. */ - for (retries = 3; retries > 0; --retries) { - ret = ufshcd_execute_start_stop(sdp, pwr_mode, &sshdr); - /* - * scsi_execute() only returns a negative value if the request - * queue is dying. - */ - if (ret <= 0) - break; - } + ret = ufshcd_execute_start_stop(sdp, pwr_mode, &sshdr); if (ret) { sdev_printk(KERN_WARNING, sdp, "START_STOP failed for power mode: %d, result %x\n", From patchwork Tue Sep 5 23:15:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 721431 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 E025FCCF9E1 for ; Tue, 5 Sep 2023 23:17:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240992AbjIEXRg (ORCPT ); Tue, 5 Sep 2023 19:17:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240049AbjIEXRe (ORCPT ); Tue, 5 Sep 2023 19:17:34 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EBDE199 for ; Tue, 5 Sep 2023 16:17:31 -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 385KnVxF009289; Tue, 5 Sep 2023 23:17:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=zeaxAonKaiQqN+p3SwlkicF8o+JQW42uspkAmXUybac=; b=oNCZXuMzwY7ktudraoRwia4D4jbz1/BjFujOGGtm4wXJAGbYuUw5XIqajYVUjjJYvTJU MONKHwx+mZ1UEMt1swemjnr8/y5ZSR5pd6exPBLyhkfnYDx9kISPyRTQh0QNC0NkCn1a M7idjFa+ez+NikvhAbNUFw7XvqrItlz55DhNgcTpdkX0aLw4a/bF8Y9wm4NQbU6iA+kv wQ3Kzwtyd4abMCVqtOgPvUkid2Og0jM4zRgb80YAlnqh7Z8y7QPKTM6AswcbthrAa2mQ ADISQ8hiemNLCBMdIbC1zF34Sm+bnWrIBMINRXAJK/wDEFmeDt54wlwa5pLdkPdXTjOM 2Q== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxbq3894h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:17:17 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 385LwVYh028173; Tue, 5 Sep 2023 23:17:17 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2173.outbound.protection.outlook.com [104.47.56.173]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5e4hn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:17:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bhrY2PhtU9EZ6uBSSJpAsARE3/7qfDk6dJ0SqQpm/wCl9QBV1vUP1zkZ7/Y9z4RnaWgTOKAk1CEr6lvHKQTwY3+HEYwth71781IyiLUiQ8nITZdTDgVlLgSYNaVJ6Ao3MemS+e1k+/BFsTyaZFYgEe+j5OcDESMssHVhSLVVcST0uhZWa6Dj5EausidK5V13LaNxKtGb5lQlpGoMWV98t96e3tmwUlo766+r2Oqbd1RCudZKDsa1tBHoX7v5ZBCOSOHIRL/woKALD77W3jFGxkNdM3P7+LWzAdHN5CzX3+orrbsf8u+18NC8kfMEkGK2A7F0c7puMlOtX1Vc2IMjlw== 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=zeaxAonKaiQqN+p3SwlkicF8o+JQW42uspkAmXUybac=; b=G1hAdYmRxNygUq50IksifycYxDPAF7iJkY37qPu19TlA5y6gGhWlao4JgQZVNB1jHgqPT+3Ks/U074YJ/TzsD+DbPVMr80tLv9893GO2L+eXhVnNaVbgR2Lf4w8rdzEIm4Xf67rfDKVSU5BdXKksjJij7kgpTyPM9bcSclGapnP0p3JDtV1777tFT47CZUB044YC/HQPBEl1AEO9s/lPYgXU3msFZPSLn9HlNjoX6RlAVAei9Tmr5bjPfF619B7k9djenkhSbiMiaXsk8N2E/ge45vP/fbIz9pMUcFBPytycWY8lMjiiXplDaGV8/VTDdxWiuAzTOwgWyq3fJNPv+A== 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=zeaxAonKaiQqN+p3SwlkicF8o+JQW42uspkAmXUybac=; b=PBKR6x3rLaBu1vBKVGR6ab6lX498jsALmMhh2HMbyh1hRPcTBJs81xsBJC4hZt4vtOoxqqMO9wxsIEVuLPClgph0CfImioahnguzmzsyqNPayhJVfaaHlOCnZueraVcrEb/qZ6p75EGZpDAFCmZKNp7PT0jVJZ2SIP+BRLHUUPA= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by PH7PR10MB5748.namprd10.prod.outlook.com (2603:10b6:510:131::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:17:14 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:17:14 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 30/34] scsi: Fix sshdr use in scsi_test_unit_ready Date: Tue, 5 Sep 2023 18:15:43 -0500 Message-Id: <20230905231547.83945-31-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0290.namprd03.prod.outlook.com (2603:10b6:5:3ad::25) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|PH7PR10MB5748:EE_ X-MS-Office365-Filtering-Correlation-Id: a4177ebf-dc66-4596-561c-08dbae662ba5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UqLUsx26ixrHtKekPaQQIo2DVG2tYnJVSShzrIZUNzwiV/AhaklDL0AwLp6HgCvYuDMQRyDuJGoCjHkn/sgzQRcyvIAD71hF8M84KZoGQwaXP6fLuDM9lADpHD0lJaTnBErOOF3MfbVciNfpaTa5eGDvygxbet5n2BhhcGc13DQiw88C8taFiGrF+35+QxE+4Q1sVkNKb5uzGcTGTPUHy29ZP9s03LscnWIuufF4OYoGdsp7Ez3NvrmiZGurhv2zKMe403Xp/fWy7JwstI8AR2I4purDC0nZJDhovB1p1M7La19k5CMpKUhXdSO9TjRWPRh73hgdjIed3y3oUV1+cBeaAcBXwdcEUTn1X8XLckwifJMiJs39qTS2rpjuEHqOoPH/XxNv1qSLCWUkomMlUyx0bmE0P7eYR218vMkDZP3fKY7l3nhzsFVPM5AIOirJDA8Dx0fFxKSDdy4d8o5sk0qvhwh3K5P7WWz3ZymVh8Tfnu0sck2wEA7Gs6gR3On/te29lABdkDXGMy8iz472SIKWSuJlK8a2u0a7y8qtebo2DXVRfVYJFltKOo/aEFqU X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(346002)(136003)(376002)(186009)(451199024)(1800799009)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(66556008)(316002)(66476007)(4326008)(8676002)(107886003)(66946007)(2616005)(8936002)(1076003)(6666004)(478600001)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1idkpEI8OaB1Ieu6+OlUAdXQQDWF2oK6wh7LiKl1IZDEwfwikWdh+H1TGVHPt0o5yQWSq/foug5G4xiIYJfExaKCIZcN259witPmONt2ggatBcgWDTwnPzvEIcPxJA/1S3E4LRBybvEnOEyu9qPQIhUOrKy16s5ZHF26hpV/rtCS6qmk+xebJrZnCL3xkd6Cq4anHe6aq/ukE63lJdpLB1sGx1Wf9NJNwfWMauE7yaSymbTfawtMEe1xcayuLam5fNDJEaAMOBqiQXmRendSKZ7bpj0pqheODxI+NVbQHx4bCOA+6RtJrWfCCOars+UpRDYYMW7tEPzkmmOeKQwe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ZujLk63QSHc//Fr1Q1iFQVc6wro/1bD1SvwcgYYCSKcauimlgkTqVzQe84FYG+4DRcd8pq6dbqaZKabP5tj6rbaqV65s4d4aTa6kNtFlpMrD3b+kGdr5JyZmRg7NktB4Bq8EXjQI2XU8J3gH1uvUyE3+ytIfAClqnzhEmgeIFA60pKc1+E5eMi8H0uVmOF1CWK4SNE3r/dVxA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: sWXei7pErI1U+78OoeE/kQpjb+cy09pFR1KOlILps+w8iSstgtNF48bC+QR4louN4NvGNAoL7AOVwBBeQd0pZ4Hsk7VlpkNk0Y079LKgt55AiPDzYWWaFriDNs+WkyNTF8Ikm7qU7PD9tDJ3EGt1DBJWxdoVoF9nnu+Dsy/On7XqiszlbqQ7kAmxW4KiHH/7AFY5RVrvoZnW0YvsNpmlWL+QUI9JCBAWrlgYYMMRHdOuwLTlHP3LpUFTKRqzwz6vKuwaANzeFVIchJzgLVjC5zF3Zs/MF/2SYBJPjzhhiuzLxtx0PcdMs8UA1gpLoG/FGpI3IyK406vPaUBsyGgd0feJgAXq0ECfrbSVaG6Vi8ciGbaV3QfH/Op7DAI2EJllCi1WscypVhkLsUKOanpzc1oro1HSZKkMibKxSC87hyCb+vuookfwFQyWFjU8PmC6vdycaQGADtntxB/AV6NZPThLuM79VXUJUafHrA/i8G2TULOPayby2wrmaZtHCXqunvHoJTNILDcbS+48zv8OA69wsu9UwThi64vNvxKuDcbZeuOIF4QzF0NfTmjaQFiFbYMlbJkRlg5/Omb3/xJTh++XYmB+feAUZOM39bB8BVF20SSKKTb6O6iVtX/P2jUTbQdWAHrJNAjMTQCEB907Es0aN24ghEHmpRMj2bKs5ttTSg4luA9sNMciui47y8+ILjZHOqZX8AqSVL3pQTS9ndPpU5Znx5/+DZEssARg90NsMAjIhN1LObsoBEnevWZ7K6XRUNmidFb82AXUIVREJ1oMVu8xTaecTTsQ1n5j4ZIDlLyBuaI9wvCIa178NmZNUoyohh7oDJN17trg6Ld9u2VyVwzq1mY0Ryl001i0WbHt/DG6bal5ydlAr6jMxJO3 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a4177ebf-dc66-4596-561c-08dbae662ba5 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:44.6336 (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: hdS1TY86Vl75nWMddbooxVXVnjrITMVtflVYGL+3NWjjr7aTZNzhttgn42rwDcXg1T1FpaLCe/qWAzEX4JjDuJaeutYAJEhj7fnUDtWv3GU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB5748 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 phishscore=0 bulkscore=0 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: jdPHArp9Wnfy4qp7fTOVRVQYVmx5xn6S X-Proofpoint-ORIG-GUID: jdPHArp9Wnfy4qp7fTOVRVQYVmx5xn6S Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0, it doesn't initialize the sshdr, so we shouldn't access the sshdr. If it returns 0, then the cmd executed successfully, so there is no need to check the sshdr. This has us access the sshdr when we get a return value > 0. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: John Garry Reviewed-by: Martin Wilck --- drivers/scsi/scsi_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 67d74f175c4c..756e13637f15 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2319,10 +2319,10 @@ scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries, do { result = scsi_execute_cmd(sdev, cmd, REQ_OP_DRV_IN, NULL, 0, timeout, 1, &exec_args); - if (sdev->removable && scsi_sense_valid(sshdr) && + if (sdev->removable && result > 0 && scsi_sense_valid(sshdr) && sshdr->sense_key == UNIT_ATTENTION) sdev->changed = 1; - } while (scsi_sense_valid(sshdr) && + } while (result > 0 && scsi_sense_valid(sshdr) && sshdr->sense_key == UNIT_ATTENTION && --retries); return result; From patchwork Tue Sep 5 23:15:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 721430 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 65EAACCF9E0 for ; Tue, 5 Sep 2023 23:17:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242166AbjIEXRz (ORCPT ); Tue, 5 Sep 2023 19:17:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241072AbjIEXRh (ORCPT ); Tue, 5 Sep 2023 19:17:37 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95803CC7 for ; Tue, 5 Sep 2023 16:17:34 -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 385MYx7p002873; Tue, 5 Sep 2023 23:17:18 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=vn1LlRYjOsTH+U7UguqzC8GO/ATJbuphW4usSB9v/NA=; b=nl5KnGNiuFJeoS/Wh8SUzKaI2SMAwRHJdetwRvqMayAx4rFFLao9D12cnx+K0XiN0iV1 c2a0wmzJALU1bcXf12LQKJv/bgoROg93TfrhVJ9YnYNO3IM/sDT/a6NhZOBcYZVtbzkj TzMCoqSMn+ETVv+cMY2CNiCVICfKLQjhQ+8kkutqwoccoFsrRGcqW08x6Bhl+60qX3YI qBVe/Vnx5iD1Bj1MX6txL8xa1tjhNcdbo7J2mBKqB6jZS7SQx0sy/yTWwyR7XSBPz+v6 kKPXzKUAVfJFUBjHb5PE8Yb7f264aO0+sFJPf2l1W+bbFgxJL8lJ4rgADcvJoxYZqAmu 7g== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxd8d825a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:17:18 +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 385LwVYj028173; Tue, 5 Sep 2023 23:17:17 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2173.outbound.protection.outlook.com [104.47.56.173]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5e4hn-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:17:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G8PAKGfruLwbZDAc5kBoN39LSuB+DvGJR9UQxp5haslhCsNaFFEls+QjBR/dBXFoDN9rkLMcWYQQaAlg0sApKy63dm0gMHTXB6bpyXFKmGMerHbxzWHd7sATHiffn8euazKpwB0JCXcy0L3djxKvFcI3QWCYHKGc6cRYOu7MnoD/oU7/Uwa5pz+AdK4/B2IBlZUgClP2FYQA9XqNMn+WDlrKakPES5kME2H83h4jJcssx6bnaBPxy74j3kBpEGENesxez9LPGLol2fxNrG4MdtFGC+CuRX3rsoTSazDGS6p13co4WIXXFYpkC5k4VbC/F5bEg7VeYHvHFfD868Cuag== 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=vn1LlRYjOsTH+U7UguqzC8GO/ATJbuphW4usSB9v/NA=; b=nwqevOG9Pm/cstkZCfiwOzeTZq4kFaBPVLzSZdZT/InIfa7gvRoGJSZ5+gvsxpGKri7FsY/wu70aYJRcaWk21xgK7d56xh28Pjc7m5MgJLaBeuQgD0yENjrbwIZ2j0qKddmI3ZO453UBlCoWWjcRZOw9Se91ouCNQhy+YXqjYQvzq3p07Tz6znyf5HeazfNx40uCwgn0XNAWnfOHyEOIClxpob6mvFUT+6iNl5QoMuuFz03NCZwtaiUkAMMRxbPuY3ko6ZjHSrvCuyqfiEPCs4wlNHFCoUOXu6s6vk2Ay7ymZd6GitCNaaiavGav9AXIKY50k5Nz+TUr4Bj3zXsRjg== 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=vn1LlRYjOsTH+U7UguqzC8GO/ATJbuphW4usSB9v/NA=; b=hPWDBSW4MKNk4hp/cGAjX7dinQ+geflLIkcM2t1TAnufOYAMw7z7hj68nThTMylCMtWFh1Yo4vgme1FGP2k0T11sOy9mLI84u6KZhIo9VJC1sqr3OvOm/L3OeTu0NNLsXYj0g6tLcJfUEXIluuab2M+D/wXrtOD1eSaNW8MUkWk= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by PH7PR10MB5748.namprd10.prod.outlook.com (2603:10b6:510:131::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:17:15 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:17:15 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 31/34] scsi: Fix sshdr use in scsi_cdl_enable Date: Tue, 5 Sep 2023 18:15:44 -0500 Message-Id: <20230905231547.83945-32-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0177.namprd03.prod.outlook.com (2603:10b6:5:3b2::32) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|PH7PR10MB5748:EE_ X-MS-Office365-Filtering-Correlation-Id: 064bfa0b-dea8-464a-2af4-08dbae662c96 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: htm41k7O2avbDrWoAobBYOb8ESWV3Ca+4rvwnKcoTAX+sOoDa9ybyQ8+eWQj2Nibkic9Vm7KLW2uB4UvBXeEmpxqKyjT80Yf6Gyktl9mOQArtdyRQs9np2nwIacVeaep1uQ+ulhvtYNoCZY48zm0JUgG+KjtuYQosMLKxwUrznPxmDWtaDVWQeA4aVgkdCTjpE83Yuk0/M9RSHzd9AsXYgomhZQw+rOGFxY5c7pjVo2LR6ZkiN0T4MvfGM3yGgOpcZxf6s3OlbwRJgVbnq0pCksV7O0GhoZPQiK1apBq8jr5HOfab+EJOdQM1vuEaj9wjhqIStZfucQrhOwkErVfM6cixBjiE/TirP0pFnoLAL3QoxXZzzkl49I12dBwkrBhLeRy6Qze11pQO/CaWpo+LdtG3x1YKx87nPLV2C5xcxdGOz48iMySdtSD/0M6LRODllMmFm3lw8Be4wxF9Hz1rqN6whe3LOdraTWir5VekXnffiVVyZk0b2PNfoE3qz2Nkv7sapDtKVggm5ph/tFHXAfrRXSYN7/AQ78uJXp95mCRp6pqTp82ONw1DQ8Gk2g0 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(346002)(136003)(376002)(186009)(451199024)(1800799009)(4744005)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(66556008)(316002)(66476007)(4326008)(8676002)(107886003)(66946007)(2616005)(8936002)(1076003)(6666004)(478600001)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: otLocO4Ww0bk8wusvsGuay4HYvclQwEvrLwGefnh1xgTdHemiZvjDwKD7x3LtVBoIKvHla0D7dNyoseIEr6b1FecPPjSiMRHAU6+mmSCdCJmco7+AG4GbNWWXQotybtUERJGn80gwXvP+ZsGi5Cz4e+ApFLj0Gcauu8ZWK44mLkRtdmPz+pBQgNL39gAIbxpQpajL8G7hEEA+eLy4xEwF8YKhefczsNKb9pLXu5Hl9QI3N5TJFOAj9CxwxYrarbRHxP2ZetCSHE3A+BtTw4IECXORlq0sCr1wAeJEzrzh8bCRRQSGcdwk2E7ucOIwVyQTWExpnEz/TPeERL5RxN+xaW8Avtv+HdpOWC5+oVojm/D8yTgiL/oStXljBbMmeyxqckgIMjD1tA+12raEG8n81usJlX5CoEfDXIqaHayuLpXl3MFE6fqL7uSQ+3sZAB+TZGtY1N6g9umcIUHUrV7gAdywmbDFZ21nHK8X9Lltws1ae+OoxPx8T5Gg76Z/6iu8oQhjLx05PwZWP+fpAZwK0gjDrRx7Z9j3C+WCiLfecosxvLquhNovHY4Ip0BoKGis0REnzD04F8j18tlUWEVZmxLPNd1y8nd/tZb2mDLMXytFI3/xNuF0W2dLGaxYBi3Io+zg3KM2vP0fM7OdK/8m2Gh8xbu6jdiAV3eXVlQPEgZ/Zs0H52jI7HIamsPkMMd/Y2wLAYu5b+dQb0lYpAtvFUnG9kzwtulhoYGk1y/o2Bgd1DMTyju9sYmHsgzl+y77uu+CEh7MPC4UzKyxT+WfmFa8/Bteg77kq/7qkjgaInRoYrXmi3F6ZtcY6AU0HCoqcXww6Oy/LbRkxX3SgVMCZ/O3eZexXiL4mYlPnMfvBXtT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Gd7ykbH+ruylmzam1aplehM9tzkDtU1NSatwiK4kSXoM3bPXPKy2P3bhT3wbhQY3kF9Sfi2PLNiQ+pCrqLTEgkQVtrFcOn+HulhtZYTFBt3NZvFFS83BiRw7QiG3D3J4y3aopDSweo6r1CxeugPhjo8KJHgrwCa8h+Y1O2ZYZARMOchLMcmU1e5axnSb8zNg3j3kS0+7SK6+/5EesjeokmhZHTGWjq1lZO9hYO3/8Cy8W2IKVrrMsuW0t3G/IYMcO6PhGjZFH/QTPPB3+4vCZrtHQrTqol5cxphBP+eRE6Un2lEG2pwT80vb4rRKIEpIb+9yKWgkCMFex/0aKuPjOZOvV/t9OgU2cDiGhOqzPYHg1g8Iw0X6uc5MJdxnZwr4Pkp0VgCDd/dzpaxZutKjGH0WZYT3FF1SsoE6sx7KxwKgK8CeTsoZorkC3fh46sbAFufhA2bnuUe8OwGbnuzPTpvbpotzUVEX6vow37xOWGdl6Jb8ugc5kKB5TXUA/waGPhEQS1LecatGKVCaESLjsq3/g1371fg19384rjBzBj6n/33Hl4MXt6lY6SGA7ZGbgN7xcB9WHdBTR96NEwqL7Xz+Cveq3Py2ofFcpuMfq2AOazs9MHPQ64AHBmc+SQ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 064bfa0b-dea8-464a-2af4-08dbae662c96 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:46.2139 (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: pvMbQEseOgMuQ+MEAf3KJ+OvLprlh4Ww8Bhk36pvahI5nI/JDYat0NfDAI1fjBUo9t5MykFQRQPYSfWrt3asUA+rVWTIlUF3aTvM6HYEKVg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB5748 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 phishscore=0 bulkscore=0 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: RyzNzdKXTB7LcDSx1XmSSnm6gJ8lPOZ4 X-Proofpoint-ORIG-GUID: RyzNzdKXTB7LcDSx1XmSSnm6gJ8lPOZ4 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0, it doesn't initialize the sshdr, so we shouldn't access the sshdr. If it returns 0, then the cmd executed successfully, so there is no need to check the sshdr. This has us access the sshdr when we get a return value > 0. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: John Garry Reviewed-by: Martin Wilck --- drivers/scsi/scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index d0911bc28663..d1c0ba3ef1f5 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -692,7 +692,7 @@ int scsi_cdl_enable(struct scsi_device *sdev, bool enable) ret = scsi_mode_select(sdev, 1, 0, buf_data, len, 5 * HZ, 3, &data, &sshdr); if (ret) { - if (scsi_sense_valid(&sshdr)) + if (ret > 0 && scsi_sense_valid(&sshdr)) scsi_print_sense_hdr(sdev, dev_name(&sdev->sdev_gendev), &sshdr); return ret; From patchwork Tue Sep 5 23:15:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 720328 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 BF722CCF9E0 for ; Tue, 5 Sep 2023 23:19:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241713AbjIEXTg (ORCPT ); Tue, 5 Sep 2023 19:19:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239898AbjIEXTf (ORCPT ); Tue, 5 Sep 2023 19:19:35 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3C5BB0 for ; Tue, 5 Sep 2023 16:19:31 -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 385KnmDA009395; Tue, 5 Sep 2023 23:17:18 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=OhKRiqSA19KCDNZA5NyVJKsTQbD4gsZCXEXls1SlHnY=; b=cv3e3QO0Ae2UScqnGFbedlWqWATFlAV9gR1yjBhQV1iWuKiQ5W9MBPASx4tp20wqScmf +dWOtRcY+hFQ5lbekPhkjKJ6ebYdEHx6DHNO/1TzUDb8iTVLlTtxLHf0R7hNAwta/oj9 Ko5NxzEpnQXDyIfepx4zaqgsYGR+6CC5nTD5yBEGLIgkckNV17L5MyNKhJ7vyvRCmsye bmV04vIU3ahlrgjfGtl0V/g2aNTqHTeyyBlJ2SMhrs/Kgjx9mIpxwpwtaa36Ue8eCdP6 V9vGh8yg4JgImlT2TEN5/qKOY4lC34iXY/UXvhwRbWoxYZr8I0vQ6Q+MSjVWt7DgE/Yr Og== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxbq3894m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:17:18 +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 385LwVYk028173; Tue, 5 Sep 2023 23:17:17 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2173.outbound.protection.outlook.com [104.47.56.173]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5e4hn-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:17:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MZqDrDqfbBtXz1Cl60zu1qfRPRzLU5A6+VmPazg3BPCl4rjj7PtbzePVw27coZKqKwy3pVCuuE+hMLA5Gqh2MOTWM1PN9ZJBhr8wuVg4ARXYAppG//cSrTjOtGUe7ZUrHGVCXYhyXn3Lc+Ox7IJdhxHcKkYfVmzASJXPYDj1mVm9M/7Gr9JS71XnRzChi/oNH7TQvQtoa6p5x4dIyz4j1Q1f0mfiRFRhWw50tPABXzMdlg7JywKqPzfvUH0uQ5Z6LWXHmWIXqJS7MaEfgHnO5QGmSaPkEwHHwwqKYiBAm5ix7diz0g5Y87Q0wnF01l668A67n8z8H/ijTtpsuajp/Q== 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=OhKRiqSA19KCDNZA5NyVJKsTQbD4gsZCXEXls1SlHnY=; b=bZoa6m4NqQIcbqFXMay6ZrdsXA7dACZHYxdXbcMZ7F1osLwANrQw6Tw0GIUyMMuEL7TEMdpRx5nnxaHFJBhYB96wrF4uhyW98W9aGuHqHyc0txg6qjSKSUliw4RlX58OUUWnjO2yM1vU6kegkxj1aoz7m7L/ASXmRncRCSEmK1AnDlDfgkDSkoBFipVA2T3gRrFy9xKQ0zbLGWNP49XHhTNibN6XjZ348pmGJgCXxau7QQKIcJd+kzgx+qhJCAIvNKqDoOS6gobNZ2zj7KUwWMYluDCqCQBmv+6fpVdRf/pqkIgjYpyOWIj1IF3fjgoWvzeOfVIB2xA1YnnL9fLxzA== 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=OhKRiqSA19KCDNZA5NyVJKsTQbD4gsZCXEXls1SlHnY=; b=pBuzp3qmqwtjABDihY4knXuPeORRlMM6NNK2qT0Z7DtZgETAuJCq7CepdP00Jq6VMExWHDUo4AiQbhwcI18OE0X/e5LKLKL5D8VGhzazZbf4QG0diSJccAZhG+++UiLqc/ovbvIPtPVM7/LxgEwuNfQ0dngsV3HKUSuDZ2TARpk= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by PH7PR10MB5748.namprd10.prod.outlook.com (2603:10b6:510:131::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:17:15 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:17:15 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 32/34] scsi: sd: Fix sshdr use in cache_type_store Date: Tue, 5 Sep 2023 18:15:45 -0500 Message-Id: <20230905231547.83945-33-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0131.namprd02.prod.outlook.com (2603:10b6:5:1b4::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_|PH7PR10MB5748:EE_ X-MS-Office365-Filtering-Correlation-Id: 3e8bf8d2-3f27-4a6e-26fb-08dbae662d8e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U6vhW8NVn6gcZ9LBweKpWvXl5Pl1khEfM6qmhTL++e5jlOB5K904bnWqN7h3cO1TTC5h6/zzQ4kutogDMlKpq0EC8edggquo0vltB8WsLlYkEf4Myhxe1KEhzf7CpJ2S3mD4Pr6NAv8GCCwCCUmaMftBo+0gUaEjCQyHR3Yti4VTtdTMaIN8kxo31H7I+UT04eACk4twF4yDhgl9L++zCz/Q7velGRQy/sn7IBi2Jw0ufVBRLzIelq5c/qN6fJXB7JZf5JWNnGTxrMI1++J55xtzhZQM9Q4veet4EkwN7WD2VtaxwS5CppgXORuwEGt0WMZiD3t5iERBCT0xKaoNPt+6qCs1ClDRL/HA/3685TbWb4OyGE0yHiL+M5XCjTIzD/onq5itflKObibyfvolzbWZOcBz1HI7E2jooYAcT2HANT1eYe4rQ1gIwwPzrNQg68X/drU4Hd0FDBFRFCf+E8q/tkgWu9p0WXG6MWqBKCLWoxEEQ9PDbpes/sgrQXrL73aBTtMAXxisk650+OECSBiNmMO4BFsuonlfGCX1Xp6v+ZqmDzTVfn7u9ScdYJow X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(346002)(136003)(376002)(186009)(451199024)(1800799009)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(66556008)(316002)(66476007)(4326008)(8676002)(107886003)(66946007)(2616005)(8936002)(1076003)(6666004)(478600001)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HRtXC9h6WVGL//mwjqomJ7t0Vh7cMdtDa6y6BWvehYkefu7XaD3I+MrecTbi81+mXn9OmMzYw8PaV/ujpGamUyPSRAp3BHvTvVUyGqHoP+sLaCj7JD30IrkplGPvMoZU7Pfq0Sys2ehyRBwYqkYECPX9aQ5p5ejqCID+VmoV8hwdP3bKLIIVqwsmv1QY7ahCGEjq4HuBcvXR4ZlMIKYWEvT0dFX1dOrrmze5C+ewxVw9MvDl5spHygNDbf2Y1N6EH9/XUlyZ9agA2b9VJJ49OUrMSgNSSqP2hMcYlT4dFQGgCzJhmewN0mKFV8X9Uns15HKIQe5VUQtHzr6Asnyv22eT2c7eKcqOD49TDJjpiXlxiw23KU4cAiYUaDg+6uw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q+2Rc9qII6sdtOF256pmLDLPmmngFyLHZtDlf/SMpHobtJa3AMfePy7GRdlceWcB437xdFn0uNH46251v/d1K195Iq7E5TqMzKJZnjdBE6pvSkn37WIHcbv1oJNlJt27ZoMSrj411eHCVAWdVYoN//D3yt0W0yA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ls2tRBDOyNP9oijumVH60IQsSB9cUXERt07M7yh/y5QWg9vm4kEP/K13E5Z0eYwgfIyXFP4EtiOK5lxSJKiZ/tjGHUwNCax75iBVUkI+VsSteVbuuSFK9WNFeWQOvPRKyZJsnSDrWz7X0aix2+sSsHN6y6CURo+1NIjJAyv+8OCFIyBg7ybL80/aayxkhknMtZQt5gs5e/rowFLBKGdePwW+y6JgAmEjjKY/8CuARLm54DIZKOVN/Mtooy/NzXMmRfLF6G8K461OWQJll4Gb+wF2LWW96hYDDZHJBZ5vanV0cs0fi6T3ZcGrie8t3nujlu9KVRF7yiQJHJZxKxKpiFE4yC0ebalqXcLXxvcHwfJYg8Z5RQA5AJ9TKUvQ65aS3fB6EqPVoMbwfzVeeJxTSc4MNyPMeY7uJyVsdfGLZGRS6AZhzBGM8ew8n8ZJZmKrmneU/7Nh4FgPh1OPooEX6APX7jXNVg1UAbx74t8sKcijzYnouHZWY953o/WGMHoxPIhSXxfMshYXhW48fmL1vR/CweK6ixVL7ksxskS7w2hFsw4wLiBS1I2hctd2wigSawU4LcYSYNp8G34ynTLhSS2dcgJ+dJYmDk6ZTiiq3nONZHrV6q+jjglXqnJ5O90sYfVMdOD/885bMKxg18SKNu5UYVcHcW4JaJxv5ihqbWKZx+SxPxalzurCUjP6RpSmvsgFpeKmCZg47meRk8BnZTklXPlSdJ9q+oXkaB1E+BxIRfumCAadsKOo4YosCfn8icKrwX4zK9gD8Vwf7xm2WdvtjcNdsvc18/XueRuYVXMf2o9CSoF/78kHDsWe2Qo/RLTQDZY163C1qfPXoSr6XGtnHO0b95ssq9q7M1bmJSPV9o2tJ5QonaDzsjUH8o1N X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3e8bf8d2-3f27-4a6e-26fb-08dbae662d8e X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:47.8658 (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: mmfkni3WfZyeVabhcy3OBpCxkiW7I6cAm+/A3YxIA8SuWLlBD6+LxDe3IH5bM8uTbcU6pIs9u4YXLR7p5MLYAoPPwHDGUx+/PrI0s5UlxGI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB5748 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 phishscore=0 bulkscore=0 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: 7pFdp_Xw5wnac4dCXDJAyTSUMc_eUtGF X-Proofpoint-ORIG-GUID: 7pFdp_Xw5wnac4dCXDJAyTSUMc_eUtGF Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0, it doesn't initialize the sshdr, so we shouldn't access the sshdr. If it returns 0, then the cmd executed successfully, so there is no need to check the sshdr. This has us access the sshdr when we get a return value > 0. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: John Garry Reviewed-by: Martin Wilck --- 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 781df1fefa84..a5c67129b0c3 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -143,7 +143,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 @@ -190,9 +190,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 Tue Sep 5 23:15:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 721426 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 10DF3CCF9E1 for ; Tue, 5 Sep 2023 23:19:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235535AbjIEXTf (ORCPT ); Tue, 5 Sep 2023 19:19:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241210AbjIEXTe (ORCPT ); Tue, 5 Sep 2023 19:19:34 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77493CDE for ; Tue, 5 Sep 2023 16:19:31 -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 385KnmDB009395; Tue, 5 Sep 2023 23:17:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=W5IcfVcpivrbnwC+my+4qfZmIaqo79uJ46GgISj5Ee8=; b=n7qyJh49Rmu1lD0iZWG9YFoCiFk+M1X8Gw4Z0b50WbZLwtN/UAnXnCvsGMcYLwzXDhyc 1XWPfgb94f3sS7eVeZPu8465XAD6o7l9KyIO2YmzgbhvqPp5FZiKSXJ4MaqDmDAVCmB/ ol04b/FevIDM0X6GuW3zz2Hf2ZrZz3Bclc3Dq1Mc+I5kxzCAAfcsIo0Nkynn9tmlshKi bKsHD8joUYUa9xLESDdm4veF+yNsdgwYqrAJvBYhzO/fiX0eBN3SR0vHEV+XP5RTGyrQ U/rLg2ebPzlgH6dGMaIeftp5U0u0nt6MLF9XsEV4soaW3T5b3GUIztZuNLa6l5r65b5C kw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxbq3894p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:17:18 +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 385LwVYl028173; Tue, 5 Sep 2023 23:17:18 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2173.outbound.protection.outlook.com [104.47.56.173]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5e4hn-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:17:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U0ROEgrwzrrlpyYjBpuxOAafo8DxxCFL6u7zLgi0ch96fGdfZGWYP8LGt0UKf/oB0TnG/dS0OuWQnZ+B1rc/7ynsi/HyoTnyIDESj1gXaWQ33LeU/PUNcGrvStHzbKp+x6oM4gtXR6s7k3j8497VNmI53KdxuXTyowrvrFKDxUNGA2bYTXnHaZdvyR3Xw/WhFTd+7bXOcnhnC5ZHHmkCGX4k4ZeBIv/6N13/A9u+weIhc+pUAnTTEUdQvD+pSXDdWacWI0D4ifCNFkTtEFSpM0nKT04McbmjkB/57loBGYyzisv06GFf6Aamb3Il+vmseLOVAz3xxtfYxSaw8K1MqQ== 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=W5IcfVcpivrbnwC+my+4qfZmIaqo79uJ46GgISj5Ee8=; b=Yg5k7pZjIsfVm7CRYkGa41mESivaz3he8XWRlCJUl8pY0Svfspos8tNxLIJcvE569R0Bj0IUQMFozgYvEXMqiN+kcz9NrL7rIi9R1QL6lRhb2AGIBiXtca6f2UPWMQWONcOEKDER7v3E2LVdMu30uNnzMEshLjP29nEHDp7Hnpyc0uSLRAhty8IPpmMI8oz/t6U33ulduYqdwvtoEKLWa4/DnCV2uJZ17PBO1zNIfpz3ujQZKBeL4i96B76OWC9NY1bWvMKe+roUH19TP7cwXZ1IoAKbocqc/5usAuW66zsOW14zPHXKd1rK/C7Ovm4w1Qe1jlv/YNmBZu5Z6e9XLg== 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=W5IcfVcpivrbnwC+my+4qfZmIaqo79uJ46GgISj5Ee8=; b=yAQ9/k8A+knOffj9X4NZ4h3WD37J+AuwBcQoCtMnjBs61s4Bs7n/spi86je7ECPIpvg4JdKlSThCD/NJ02jX/seCt3RBqQ3spheTXMJzDT45Uy/zGALO8WM1ab81Wh+5SS6qkvDzw9oCbcgKia1IaKLMd9fNk6rHy62rkg65Teo= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by PH7PR10MB5748.namprd10.prod.outlook.com (2603:10b6:510:131::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:17:16 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:17:16 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 33/34] scsi: sr: Fix sshdr use in sr_get_events Date: Tue, 5 Sep 2023 18:15:46 -0500 Message-Id: <20230905231547.83945-34-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR03CA0038.namprd03.prod.outlook.com (2603:10b6:5:100::15) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|PH7PR10MB5748:EE_ X-MS-Office365-Filtering-Correlation-Id: 06f7b1ce-1bb6-4086-5e49-08dbae662e81 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hYkyqEoeMZ9Q2P51+ia9sKCK2hjEEV9GwO+iUT60/IEjmPfyolg8UjjAlLE1PuaQ19TZVWWUEodIqi1TXGfp7jCX8bVPGWJoP0UX+/ip8CxoUZ5HNYS9DsREYEyWnRQHwvCqdeaMDlaeSGNFOglmcDZedggMg07CT8hjjDFZXDc36HK4kG97aJpJoWLLmYHKGGlMw18VNDHGkKsYVf8yS80rvmGrXjx6YmiFxljQgtOnVxI+8hnDHPuC4FyA7QHZoeguqkqesg8d1pfSvUoUZyTk6prQqZP+urR1f4F9HMNnv9CEFeA1UQneW74Y66wIPj6QFl+gA/XIpcDj5RQC53Tzg/OHsMC2Ba/2ql5ZGCiOB6E3bxQnkQix1sBxv0eoz86kLabPALXbp/js6VNz/YqXUPS+NPJ91tzgrI1OevVJzgcR5S8m5VKHjrgCvHNaGfmlH4knL3QkmwM76mz5KrIBzCfLipEQ7tsp/cdkkIcLuNQpHRw7Ppi6+jJtcn2v1nG3ra7wpwqXPxwrwDBWFr48LOooEmfGdnth9+2cWpvvMqzWg/+4xaYqZXW0eFQo X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(346002)(136003)(376002)(186009)(451199024)(1800799009)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(66556008)(316002)(66476007)(4326008)(8676002)(107886003)(66946007)(2616005)(8936002)(1076003)(6666004)(478600001)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DvbEr7pndSdRKuc/y4ViyUVGkfWLMXZXJ4bknmtDyVDATYBxnYhtbHWos5VMstXkKzy8+q71PZGou8OsmF90EARhmBKjfBt5pQrmmpEMt5Ccyq8cxL8m4goLtbe81yUW8pLCgRstQiekBK44ta2MRsba5zhY29EnRaX3X1jlT9o08rj3SA6oIi+IWkkPv6SO/yRI3UDiuXeJmKQehYQahh0rjdSVZ6rMEc2nUNP01FbIWURKnlM3zxz5pQrP7IfKauJiY8mxgrFpwtg1ypI7Ki4rdUH6tEGfi8+1MhMSSH399/FYMaASeEbTFNih53T23vmmWUO16IhFsbfIhdQEtak9z09NdN2apdMPFMWL1bDwZJrnh290zjf82gFHuCko9FbPcEi1KluylO7/5bOysfXzxkDyMwy9dvKZMnlwSDx76GCngPtLhagt+2d3ffMQcIrbe0wKMPh45+fVAMlctOfUzv75neh9ZNl+/GgjlU6BRH6IzU6AfyQpk8qfk113lXrrhytC9b7gn1+yd0SZB8mD1HZKX06ZLLaMFhShUburh5FTzMHkJha+aJMp2JHwR8xKeN8WK3mpAPzWe1zGYmK7yD1c4iSRuIpA4mPbbfFadzkgtx2ZWENFqNtB76q0G9rRSy0mU7g+tvaOKxNMDWuKU+IN12z76qh62M7Jy2dpq7q0mlltv588kBISwM/jHqp5gczQ/Dk+egdSYMw3KVAcIyWye5fGT1wqszK4MrTUpIdxzdx7YveB9g94gq7ZAx3iMuOEOKX0+XJkq7M+6Bd9flofVcIssX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+F9wYVuX+Nyze4RCcqBk82jkeoU4Du7odvOhZ5bUkK0r78m+sqx0Y/qVZL0V8TY4DoXhwoT5QbRw7p2NRxPYNbk+SMd153C1Zm7Ompn1S9KjLta2xjdVvFM5x7q5kN0VapuvYiwNBMGGddEJSeTFE/DnN7SbH5UYByKWeBqOdbRKvF+I8XnbRNCkKtrMctBGlVVxTg2aO7HCfqb0mIt+4u/aRfGm0FBI4dZLwDWxVJCvt9oMer2Samo8cthI9fbp1L2q2nzmkyQTF3VPdtEArjKRBjh+5VYNj+uun/NrEDQW0WoOw+VWqqp4EqYeZuky94rJyklxylrHL+ttOzosrz5GEYHHIUpItKBGYLsCIb2GhVLvtq8kjOVg2wcuvhF5Y7qjb9XQFsEjR86QO5Ev5azZ03j3k0LEIqXp7wkQa3bXLptp0P7GAbqjM86y9BwUgiVixz1QLHFTkf7kbTDlD5k6J8P/0annb3ucDg9Gw7gQS1EScxa2VM9v1cPpb+8TddcYdAAcnd3uVjI3ttQnHC8UiFz53FTvyajiQpBLdODZMz9P0tbz3IUybwPBIKr4Z0bZJ1WyHFiJ/wmI+OaC56m+DKiiJbNNHBu08nbDD9DBVjiAM4oOcIlI/W55tVaClh/zor8tm92OWaduxQV5/tCihEC4EOQJg7gXr0EQDghEcJZqtNPtcwJDvG4Ixc7orPqpoKQkYAcen X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 06f7b1ce-1bb6-4086-5e49-08dbae662e81 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:49.4312 (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: DN4f3GN1eRHSkhKNelTTsqPuGdJOfS84WphGzRIP7mVhGaBuIXjgNBdTGUZR8cDfpMA7qGlDniYjlsNjarY/BzUhXG6+ly+vWEXqEz0zGaE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB5748 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 phishscore=0 bulkscore=0 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: mLvQzdA4921LTgQDwMnmKiN_iR9Hko2F X-Proofpoint-ORIG-GUID: mLvQzdA4921LTgQDwMnmKiN_iR9Hko2F Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0, it doesn't initialize the sshdr, so we shouldn't access the sshdr. If it returns 0, then the cmd executed successfully, so there is no need to check the sshdr. This has us access the sshdr when we get a return value > 0. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: John Garry Reviewed-by: Martin Wilck --- drivers/scsi/sr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 100480f5bc2c..a1889709c84c 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -177,7 +177,8 @@ static unsigned int sr_get_events(struct scsi_device *sdev) result = scsi_execute_cmd(sdev, cmd, REQ_OP_DRV_IN, buf, sizeof(buf), SR_TIMEOUT, MAX_RETRIES, &exec_args); - if (scsi_sense_valid(&sshdr) && sshdr.sense_key == UNIT_ATTENTION) + if (result > 0 && scsi_sense_valid(&sshdr) && + sshdr.sense_key == UNIT_ATTENTION) return DISK_EVENT_MEDIA_CHANGE; if (result || be16_to_cpu(eh->data_len) < sizeof(*med)) From patchwork Tue Sep 5 23:15:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 720333 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 B84D4CCF9E0 for ; Tue, 5 Sep 2023 23:17:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241713AbjIEXRk (ORCPT ); Tue, 5 Sep 2023 19:17:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240460AbjIEXRe (ORCPT ); Tue, 5 Sep 2023 19:17:34 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58E801B6 for ; Tue, 5 Sep 2023 16:17:31 -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 385Knnut009401; Tue, 5 Sep 2023 23:17:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=hJi7gF7W4IMBy3HnZ99YekM/GbZ6vP7twLnLbOd91OQ=; b=EG45FpG4jrtV7ikBe3Kk9M7/G/i9L21cSPw8cS/LvE/NQHRzIVRJQvuUIj1wtHGa5Q48 VFu9jEs31UJhmqrXHs8eSAy2TAy/sjy8pD6IRTytZB3+u88u6Mnyo13SWPxxHXtLonXy vWgC9gs0hGnDrTcYegil4FNo6cfEehTQRYEXJQ8D7a0YakVSI5DKNkLZlp53ZCaWePCq MFu6cNQ4j36Q/ECTpknHY3nUjAJCLbnLNja9dED+Glmbnipj4o2VZfq2Lu+F3MsPKoZt XlR/m2P3Ei4IB4AUcdEzrmz1rIX2tV6TWnt2P+pkwVmWvQFhIRRWo9nPq0BSeMVK6XKk rw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3sxbq3894q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:17:19 +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 385LwVYm028173; Tue, 5 Sep 2023 23:17:18 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2173.outbound.protection.outlook.com [104.47.56.173]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3suug5e4hn-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Sep 2023 23:17:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MPcQ4fkUwVfcXEwBnPdKeB+L3vjHFdDAg40Oa7gH+IkT4+T/TNUB74vGZLxp5k0VPmT3S6wtWb3mISL0bOb8jY5tMPVd/D30k/IslwF0tTpd7MtATSbttCxCrb4fC18txV4WlYUXgiImPzGNrw6e85ItAT2BpbhvDs+9J9vjJrz+dEGecTcr1IqNdfNMX5vlVcUJAQUbUK+GhmTIydY6yBwOSdtR5UPpV6uKm8di6IfwfVnCt3S337vxr/F9wUu4GJfj314yPqyfHsSPX53JNissMNUWH6swzjv8Vi3ET/jf3sp+lviEvib0bYAj0prWSEVatbXayf52GtDn1ESu/w== 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=hJi7gF7W4IMBy3HnZ99YekM/GbZ6vP7twLnLbOd91OQ=; b=j1BWPmKQB3bVp7Ew+7lLSiLY7uKh0/ANi9RMhVHbYsCLtrfd7pvwURqRQqR4rYQZwBSTU/Q6M2EVT9bkdvSt/T6DZ6cE/9XEybO7Ky4B6qKRJRHAPmrm2zyoWMy1r/viTDsWtLydBfjaA/5pOu58tUXYV5IyMAK4i56Z2oYkYHANi3PWkvxuelQTgzdliPtxMY8ozLsiRu1zuP1uDDJqQvTgV89/E4X5GWXGuCEU7gGZbx/f60izNfVDcxagRAPrGOysAZ5ZzS+SHkULxODr4xkygfQBZiKzx2fdn32MLzO4Zo1ki9OHf9BrbcZ6VF6eMfR880Uf3z1rhabrS5RJxA== 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=hJi7gF7W4IMBy3HnZ99YekM/GbZ6vP7twLnLbOd91OQ=; b=LGdWt6mL2R7h86PYuyOZ0dFcTFauDm7uilOPVPG9P/HIqc1YI+DMop1X3fBGpNeXBTiZ8yajunjGLTqcrWs7AZWZnv7b6Wr52CA69WkClttCZ8U8XtI4gbBArEVe+24CC6yMsSa+0NcwXwTglJhtQWND66HM7B1IbpknaNvGeC0= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by PH7PR10MB5748.namprd10.prod.outlook.com (2603:10b6:510:131::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33; Tue, 5 Sep 2023 23:17:16 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::2a3e:cf81:52db:a66a%4]) with mapi id 15.20.6745.030; Tue, 5 Sep 2023 23:17:16 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v11 34/34] scsi: Add kunit tests for scsi_check_passthrough Date: Tue, 5 Sep 2023 18:15:47 -0500 Message-Id: <20230905231547.83945-35-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230905231547.83945-1-michael.christie@oracle.com> References: <20230905231547.83945-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0144.namprd02.prod.outlook.com (2603:10b6:5:332::11) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|PH7PR10MB5748:EE_ X-MS-Office365-Filtering-Correlation-Id: ad0a3bbc-d065-4c9f-0c3b-08dbae662f4c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6dCynh/PqvEvYfQmpcbNP4Wda/6iKWv7y3//j3oK3tsw6HuOoxDzS1g4EpfPfSJ8O9j5+z3iTgVuYAxIRcq5lp14TatzmUwzb1uGEx3tDWHI/fyV/jTKwJoEDpy5Ome3xrshh4B0wkKBwevWvJOjtgMBwQI9c+ybQzmNRDBFTh7PepPeI0sDoLs7MUvnrTRpLeOPqCUpzuzhvEvcrGVsniCSqcgI0PxxHGSE11LzxJUsYq+QvIpu8v/BxPnUO21qgkP8IkasuN4K9AVmmnDIfA7ZKbdEbho4iVo1o6ZbB1unJzOSRuzjJWT+IBdshm/Xa7gQC44B/LHlptmjxrD25T2ZVXOyZv/idqHwwzv76kQLojo6XffAaEvu8g+lGWtuX62Js57a/xYlt1YoWI1NISsLsbiLK1j0nwnjQAIVDLLWiZ3vJDiPb90pl491dn0YCSLL9BKXnTVw7FUozd+BiKUP+ifCCFy9sy5bmDhNjHkr/p+cxP4sHaHyvCJ2U5izwt7Ahvz38CK1ritYEZmEGuDprXsvrYc/P80JX5uhjVjqfU6+GMkb2vwdN5fc8pLp X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(39860400002)(346002)(136003)(376002)(186009)(451199024)(1800799009)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6512007)(6506007)(6486002)(66556008)(316002)(66476007)(4326008)(8676002)(107886003)(66946007)(2616005)(8936002)(1076003)(6666004)(478600001)(26005)(5660300002)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: J+CqRDJ5Xk5q75uDqJjcuqYM6eSXX6EMFkwouDu5ijuK7xYULuaA7YleqS3QXbcb22/Beyk7W56qAEXTGUeUs7FWI9DWto+5zZY1azsa4aD+ENbuEaI1IBO7FSa9IM9lSpgu++6Wb0e4NQHVWfqTLWWERqgh6d3p958EVh9AWfrE0c+TvlYLPJzu+BsBy83nHxQ+NC3CwZZomdcVCaE+PCY/wrtteZW46cS4Tdyw2zMfDKDeCZl5zp42ABGYiCZzyRcA96MBW22ZIfNs55kmwR9srx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ewwGOvgoxmNhyt/Nt/o8tp0cH1/juy29ADUBjYaGNHburuH/930iS8QUB6R58uBtiBWR955MeTNejMSkDDecZ4VYHH+iDXrWSXoAgPpr/+bADCS5ZbGGIcjFW2RdMH2AE8+RLewgINrAH4NLPDXpXb2gWH X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ad0a3bbc-d065-4c9f-0c3b-08dbae662f4c X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 23:16:50.7617 (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: zPXaaYhtsfWBPwOpxfBKEjiwG7aQNb4bmkCfEpm7O7ZlwwBpzpPMBzTNXffdtm7fi7cVPmL2A3XUHk6gmWbTBYwHb/tAokKhywA3Emtw2e4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB5748 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-05_13,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 phishscore=0 bulkscore=0 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309050201 X-Proofpoint-GUID: _DgxDDwGG9t_QKkHaDq85gnd0cyE5NqB X-Proofpoint-ORIG-GUID: _DgxDDwGG9t_QKkHaDq85gnd0cyE5NqB 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 695a57d894cd..b7ffb435afb5 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..f12ab199a03f 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); + +#ifdef 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..c01201ad8702 --- /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);