From patchwork Thu Sep 22 10:06:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 608551 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 A340BC6FA82 for ; Thu, 22 Sep 2022 10:07:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230078AbiIVKHW (ORCPT ); Thu, 22 Sep 2022 06:07:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230018AbiIVKHU (ORCPT ); Thu, 22 Sep 2022 06:07:20 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9892DB6565 for ; Thu, 22 Sep 2022 03:07:19 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MA53jD023889; Thu, 22 Sep 2022 10:07: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-2022-7-12; bh=mr+A+RrREF8LJAJhSHufqfWGdHn1kz76hIun2vI8R8s=; b=GSVHIHse3re1Tvn1GPPW5Ewfo6yoUOkSnLmUNbFSwDfpSFl3c2xc6xJCwB7xQZc4x/gW O3pqRiqOz6G8nGk85ajIfEBPwVVtRsrdPq9q4HMM7qwrsj7+6F7aA+iH1lechfr88IZU kfnusHgAa01VpqyJPbFb0HwnjNBmltbXLSw08Y0MwxpvA1zC40QrA/2vSje+UVZKPcTz 84lksZE6/tUVTqnyLX0RaV4+MO2gC+nXsCw47Lw/lMy1f1JLgtiO9QynU68v2RILKpJd xCtDl2Y/X2JRbavxdPskOzcFYgiV+bzZFteVjRimtiwsJW21/OCv3doUiKtWzFIY6q3Y Ng== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn6f0mn7d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:12 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28M8lWe4033863; Thu, 22 Sep 2022 10:07:11 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2109.outbound.protection.outlook.com [104.47.70.109]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3jp39nedps-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kkoGQV6uzS9mK906ydTcN33c/i8EPRFxyLdWYgVqZr1T4vwjEcv0EDMKlSiIx8Gbikt1YVVn3r/bLNtJBCUG4IFEj8Z4Ak0/Zjb5FQzJ1X3c/HaJqPE85ZHyWmt3M/UQtm/oQQHsoEexwLsl8E48M9miXkNHdRyinS0NpnbPCCbtXAPcffESukdkf8QmFbOs6+YYMfEl8nP3RbC8bSSATZFGLC60hyKjWn5SAyR9udKhTEDPvwA10wwCkqd8SCg0KHGUF61J1gosMdV1y088txHn6tuTjmobEj0tq+/Si/TFbAzVm8mfHPgT+eRsGE1KOTobYGBcn2Gf0qBHmGv10Q== 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=mr+A+RrREF8LJAJhSHufqfWGdHn1kz76hIun2vI8R8s=; b=XGzjjQCMuLEg4yWjVv2TW+xThJ0HL7HszozLt8qtcdaVg/WqMK/ZjqD9CMa16AfXMk/EoTGM+ydCjeZ04vrTjfsKfWcZVAL7RYAD0jJzoZmqtrnZM9pahQfqP+zt4CV5HmxyNG2yaP1rOMq3d2AU/uw9o5HFtWDQ9WINwcZwaJ09mFMdEnEiIFVk22VefKl3Wx08rRLtANFQc6ikVDxyfsvD5dztoRXOnDx8nMCDAIeSbfzw/vXXNX6KValJUGZCfVYHeyZ7nblc3+F34eW4kQ+UidvnNDEWhJ8YXIHYWBtxOJPKt2WNqMWkc/pCXicLrejFNatSqodf0MkQJ5TrVw== 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=mr+A+RrREF8LJAJhSHufqfWGdHn1kz76hIun2vI8R8s=; b=Kg7JsIZxcus5J86aNBmVfA3Ee8OXO1if+mlGH/Dv0qLdVqU+8/LtYhRTZ5+gNAiRC/DQtmv9glYNoa2HMXZIsuZKcGVTBmiyEkesg8PJN6rwZdXRDcH+waXQKyOtcXlu5NKaZ3evhioqyLGgUaTINA+Fte3OI4K7QXIDDROCByw= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by IA1PR10MB6243.namprd10.prod.outlook.com (2603:10b6:208:3a1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.18; Thu, 22 Sep 2022 10:07:09 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1%9]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 10:07:09 +0000 From: Mike Christie To: mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH RFC 01/22] scsi: Add helper to prep sense during error handling Date: Thu, 22 Sep 2022 05:06:43 -0500 Message-Id: <20220922100704.753666-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922100704.753666-1-michael.christie@oracle.com> References: <20220922100704.753666-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR12CA0020.namprd12.prod.outlook.com (2603:10b6:610:57::30) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|IA1PR10MB6243:EE_ X-MS-Office365-Filtering-Correlation-Id: 1b42ee44-3172-4879-41ee-08da9c8235c1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hIJTufhg27M5HzrpWu8PBPeSQJKKJVhdC3x3SuVqHr68zjVtcqmZSb+vLD0HNm5dzizzP/FHKQCCAvxHweG/SFOnzZErqqwx+m+uve+gDcdyPlHRHv/r9XVxYuLKLVtRArEqXyAnzq9pDF/gK0K3/e6AlxAMZCn9KFLjFyPxwOwDaD6jdCO7svB+ppE3+51Nxq6HfhugK+v8OCz9NcjS0IOPelHjTAgRKDscNax+y+y71sy+OGpybDmDGxMzO81hKy9cM/+7Nhijq8v/Ar/ZbARNIrB/HtvkjgHQvMNawm7FDFgSWoHvTuRNpIFageir3M14XhSuDdGmtdcd3GQm9PnEcFMFXndPTbHu4NG2nX+xDTciglk60GcasZOKgR9MmGxBQU8E2mWK1ogG6E5YfjpXCT3NYuEGnGFl507RGekZpis7wO7J/86/tdROWBR4hciD5Y5aEAn7YJ2Pzwmuia0i/tpGsdcwMgXHM+4YyzcWUjt9PqBRTF1Hq32dgWrPczQlybfpahl3QaoQWSblsqx+rlO3fuDUGNO4n/YFtcnUBny2qrZg5WTPgc10FXrSUvqXA3lXmTRB3PXXkK+sDdA9Q72XRFtrv3Q7KqHqrrP6xdTJGhbLyPRrBIXmlaw04/Ga+0TKyBI40pdOPFv3cYkcbppPiPBeqkxs9oOhr5eSKJovsQlRgoHMp6/m8fcZrPsEFIGOKgH/dJNfPRuT/A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(346002)(366004)(39860400002)(136003)(376002)(451199015)(107886003)(66476007)(38100700002)(66946007)(4326008)(41300700001)(6666004)(316002)(8676002)(66556008)(186003)(1076003)(83380400001)(8936002)(2616005)(6506007)(36756003)(6512007)(26005)(86362001)(5660300002)(2906002)(6486002)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dNYEnYr3Wl4Lh3jn7DbzFaCfnvfcI1/t+ZvipAlMAXKt16xuKqB2ltMaKITHQdsz1bTEfnuCFrN5Ie1JjVN1aiiX2JmiJ5EqbNpt2cRB+wDjqfkqLpnHldEiAKAcXHqk/PdPQCRfYooSXosuqQavJqGoSUJEE61N91oUjNdegxemtmeeED3SgctqrYFMfDX2hIqWAIkBuGxG6ksMnWn4Y2IKYBN1L8l42LHN5IyyuUaoi/6Lj1CQQTA6dkVTZL19jB8aPlCw+UX2vYlpTMcSlFPo4FTx30z5Ywm26lsAvCOFUX42i2qcFwqy9bi+5+VfesP9g5R9bgQ2DVqLflWwONcx6/h4ovE6xkXzMlhwBHf5Y1gIxxGblFKakd8fNTVUycm4guz+kSxra1Bd6uGN64rukFI55e4waBdlEpLfnh2GXNoww/pLu7ojTfQWHQtCEJFXQrExRr2GKxtKITMaqq69PYv5ClR67lYU8/DUiVeEl15P9ILJsyZds++wldTQ1xqx8KbauCqozCGpg432+OznnChckLJbmhmwjvRXc8R7Rg8j79k2rRYBXlPNt5OMrep4Vz0z92tCxCR94xwgeWU6BPm4OJIGVdGfLqRDllc7+7V0LuG0zXMk0j/Q6hAxBGK3P5ysmmfi/HMwZzlO4uej66hogdobY/duGluH/PGvCO5PsL1JoZs8EtYirwafnFG6PcnoVAVE8TUvxotykT4YeOZRb9Z9012J64G6VKSjzOVjJIx3wTcP2PN7T5VLpstpJY26ILgEKPuXxiwK/fHWCaejkFycSB8tdajL2p23F/82oB3YabCAtJOhMPhyemZYMmNorphPyqsNlaQTjDkYTQ/sZiz62hq4z7v9qQETsQeCZa897Qbrb+5gavtNgJjUKjJd++ie/av+qDZKsAtxJ23E6GXJVptKDCOC6cCNsd+8Js+H9xaenwdwsmoxA1XO5YitUidjT4x8/4tPtAUiQ5FY8LQ3bs0Va0V4XY4p0UlwAxWVR8X4zJR4tt6lHzv/pp5Kiac78VzijBUul9DGzs4HOxojXjEkbGxa5lN74WMg81pThTPnakVHbjUbdW8lkPxXE5lluu6IW5mp90HZjR5dBxQU4GPhJtS6DwZK3lUVVUeKHe86+Wm7mRH8RKhyQ+jSHCwbb5SsixAGaX6bL29ifi8Rt4o8SWkNXnHfCeTJmC0CAamjfj5MRtLykb98Ad55XzwfM65sbU2TQyIuezuKBXLSqhxEdieXyjRsCQnFZd/5EAyMKdwalVO7HdTbiHuhIczN+1TazxItbbuJcW7lHygXHzBcOSSx1VjsRjwpMItQOAwkt0Uar8FbKXVhpppP/PfoPtvbBOkPBk5IJfVhLbyJz5dgUp16NgSvuKrdLxOZz9ClDInkfz2IB06z+Jb6uKuBXwJ7EPYUdupypxek64QTPmH84B4yFI8akTMdo8hQUltYMoe4BFUdPoAu3Kj79TWf5+SWDKTOD5jsiupFhN0CBqlnA6c0Bg9c7eHofDVdu054vjs/pL6d9idrMuiItgvHnObrvel/U3c1tmj1JBMZGavU6UsHEB2Il/uRbv7fG22JFK9HGR/XEyMiY2NdgJhKF2ABMTFtpg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b42ee44-3172-4879-41ee-08da9c8235c1 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 10:07:08.9604 (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: zqvIjSEh+DS1QlRCceGUn5ZvwFKE/DC4/vboCPx7n8hQ/UQkbv0ryOI8A0moQpApO3md+61gJCrGI8AgdvUgRE/TdkeGlyoQivtqjSadA4Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB6243 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_06,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220067 X-Proofpoint-GUID: AXyPNbr7vj6Ckspmlm0lEZifOvsVcgzD X-Proofpoint-ORIG-GUID: AXyPNbr7vj6Ckspmlm0lEZifOvsVcgzD 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 --- drivers/scsi/scsi_error.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index b5fa2aad05f9..5fed56b6b7c5 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -519,6 +519,22 @@ 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_prep_sense(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. @@ -534,14 +550,11 @@ enum scsi_disposition scsi_check_sense(struct scsi_cmnd *scmd) { struct scsi_device *sdev = scmd->device; struct scsi_sense_hdr sshdr; + enum scsi_disposition ret; - if (! scsi_command_normalize_sense(scmd, &sshdr)) - return FAILED; /* no valid sense data */ - - scsi_report_sense(sdev, &sshdr); - - if (scsi_sense_is_deferred(&sshdr)) - return NEEDS_RETRY; + ret = scsi_prep_sense(scmd, &sshdr); + if (ret != SUCCESS) + return ret; if (sdev->handler && sdev->handler->check_sense) { enum scsi_disposition rc; From patchwork Thu Sep 22 10:06:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 609103 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 56CF4C6FA86 for ; Thu, 22 Sep 2022 10:07:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229585AbiIVKHi (ORCPT ); Thu, 22 Sep 2022 06:07:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230261AbiIVKHZ (ORCPT ); Thu, 22 Sep 2022 06:07:25 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89BA2D574A for ; Thu, 22 Sep 2022 03:07:24 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MA53k6023893; Thu, 22 Sep 2022 10:07: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-2022-7-12; bh=lEyr6Pk3lD2YGZCvKFxTAo4u4/fo1g3E9hhktAl94wg=; b=T0krdEdHhtgL60EgwAOVgA0IY4wNrb3HM+FU5xZw5CxwwQ5pK1TabcJ6vQ8OULbXRPfA Jvef/7eGnFE78XlPbaivsdYA3ibQ9zOPnbojSxoqaPdBYtWIDEZj9cVgJaWut4shATXY YqZoa0ohj/3453MH7y/UeDR0YcDxOQR89glr3Ze+4Ea8e+QLAL5DnP5m2ElQCat+B0ba qaLQbQ6Y6TZuiRH8oJer86DfpAIztGT9nVlJq1xd12H7EvM15MjJ7krRcIsnc4OygGJE m20DX2bWrU/gggx7Mi8h4Bv7Tlo+MU8kp6l5+M8lSe2pGwMlv0/rd137j1P8V1YAA1/N Iw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn6f0mn7e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:13 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28M8lWXu033855; Thu, 22 Sep 2022 10:07:12 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2102.outbound.protection.outlook.com [104.47.70.102]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3jp39nedpy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OfzQuDERQ6/FFG7lNSnDLylRL0c6T8bhaDyKAvDNbEo+az51Q2F2wS3ZmMy+Et2vbEtMzz/tP7z7ku5z85K6ZeCELHwTiH/tqkgnFskw+aWUqwBwBpA9WDEf2dlUeiUDitSkMMxXyyrY9SblyHGbGzwwdostRBMuxE28lKn/8vSiBkQbDGuqHP/eRGHwCHq/7WHytZ88pKqQ84dgKKurYMa+727r6lUTZjp7wtEkod7ghbHLHi2Wxq5C2Ejr7KvXX+I7oH1JR2GXFYVZSW4c+l/EVHtYLZqsDOl/aVBPAmFN7rc9WMxYwgYkKRRKSEMloil6Vw4wnaoLXCmOfB4Wdw== 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=lEyr6Pk3lD2YGZCvKFxTAo4u4/fo1g3E9hhktAl94wg=; b=ACyCBgSa9aKUrzotYy9Pseivo5jHoSKH5MuaZr34XsNYIKmx7oDaW0iADYtS6+6hFi1b7sf5uJICt5yJlH/q7jHymm0njxlHFZNyTFO0aD/bHIslC/cZwjd3gcsimoo217Dh0zrhTeJaevWV3EQaMPweV9L+A4foMfh5S+3lVI3w12dFyDu9ovjCzBh7ApTTT+VXjh5IIZNF/iVC+C8jxBi1kThzXVdhofQAfS8mAr6BB/xQCxXUbasb/nPg21dUCWk6LJ4V4Nm4+F4AKoYKGB4riEGxsEwLJwG046tkk/AS+wn/aixXvFQJD90vpAQGjUSePF3k8Nj4B5RTfACfEw== 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=lEyr6Pk3lD2YGZCvKFxTAo4u4/fo1g3E9hhktAl94wg=; b=taXhjklkjbvyFXKS1fkB23/MVUyhYNtrR+mnXn3t4HbnUpafOSNbWikmoCcAl6X886OBABbDqLFQBKdj1+eFSzDWctkF+hABKqgM3BiHIQdJKXU0zVdrT1coAveuckIMQ5M8/Lx4oJtJ4zUkRd7jp9FCmBm5QlY9PjckcEDbjvw= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by MN2PR10MB4317.namprd10.prod.outlook.com (2603:10b6:208:199::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.19; Thu, 22 Sep 2022 10:07:10 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1%9]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 10:07:10 +0000 From: Mike Christie To: mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH RFC 02/22] scsi: Allow passthrough to override what errors to retry Date: Thu, 22 Sep 2022 05:06:44 -0500 Message-Id: <20220922100704.753666-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922100704.753666-1-michael.christie@oracle.com> References: <20220922100704.753666-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR07CA0054.namprd07.prod.outlook.com (2603:10b6:610:5b::28) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|MN2PR10MB4317:EE_ X-MS-Office365-Filtering-Correlation-Id: f75b0d55-55db-4816-b861-08da9c8236e1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HU26BlDJLe+bWOIYK2z1RpOn9LLhJ2pQ4ZegXtdHtVlT2Zz+aznvnr8Qsp82CU/ihB+EcSxM8JQzhHT9amWcZK3JQCmrDXy2AYxAyVrQyQqlu0zL5FyxyZVhB45kU3T/nAC8bzE8DJtTCVWSo6uEYsB3si2j+sUzGW/04F9PtAWSiKqBxnC0MVW2kt2eh8M8nt5jdFnB4uVvDb8W47rdolOX7atlf8UIJBNkMtntM29AznGhrwAaZhVFw7aPRZEQobl+svxTSoEn0oDHpjlsm1uiYkJ6TPhg/qchV7g3Oo29LGsxykpB6GRV9cAIwWk+cwTh5nN1R4C5NgPfNRh8HrG4vN3wP1I6NcNTAGlpx1v7faCxSHMYYdwBiezpZteffY0Qo53LrnDHxMZjJxhIK41qc28I2rljoGY9tptFeooTd6vVfUc3HeuNai3kcTzA/IdsNgoYAxjp7QGCbhIx80hV9rSNNICCi2sYFaQ9GxObdgSCIaB+HzZXx/ftEELDujG2TNjbvGEeEbEqr+XKRpbOHGYsJm7kHASy5HZE9h/Di33FLQnIHr0EZzBe5MRuzFj6Iz/XfbcD5m0Wcq+WpZuICs5j3/Uwkj2RyQVvYPUc5Ys5WvqdKNYzjPX1eAZomkM2n1B9SWi3lTp+871pxK6eKLqKQwQw7VIfFtdBNx8AyW0c5dmLXdJ3+Lzmsi3BU6ANpvvLRLAE3gxmEOkHXA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(346002)(39860400002)(376002)(396003)(136003)(451199015)(2906002)(86362001)(38100700002)(8676002)(6506007)(6666004)(107886003)(26005)(6512007)(4326008)(316002)(2616005)(6486002)(478600001)(41300700001)(8936002)(5660300002)(66476007)(186003)(1076003)(66556008)(83380400001)(66946007)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Un3tqrHpiF3KPbTungoN2lYtelEwXD83VPhTOoz2EyzOAmwgf2Ga6plSaGK++9ML974aFahWYSWKlZYQDFqA1C2tQVqT3gxJSKE2drpmaRztO/3d8fuDVySSHQL9ZSjoTf6rkywpnhb5JQZuL1lG6EK5m6DdOPvAavORP1t0U4+my8RXVH59TIGyGL8ol4OaZtZG2wBWC+6V7uZH1A66HSUO1j/Mahg/gB+JMw263OZVrlASgLODKb3F2UzpJ9RCos8f+sFr9kj0RBMl+kXCXvi/j2puUYtkxKSAIfwQmX6DuWS/X25tOXwxIfLuqlhJ61Z56WQQlJZ39y4fFFrFj3sN4aTPQajZb/NgtRs+0oZlG86FX1G071fX8CFL/L2lrj2JuVYpf/KHRmcWQxqBOBjGi5fxXeasJuXJdUC6KlIXNZNe77IAqZwvHfQFBw1XEwF4/8AAvE2QNZMQcMfBqB6HGn+lg0bmTT4dzfOKIyswnzmNXdFNPC/1QgTnv6yu6Kc1/JSgwo19WGjYgVzyVeQU1EKoAoXyGiXSgZUeDd7tcLS3JcPxbxShTo+WQotfBlRTfH+h4ThyrNDNSTokfPAHClOOsTqdyZjUVTMDhEkkX74jyLQFPkvngIoihFFGhYiA8VjphMvmWNu7zyGsx2tSMnAv5kYcFfP+utmLYrrchawN3NK9BRqfyOu3Eu2beFdQYmPcPuCjtnW5PUiCoLt0CDPstTIdHg/R/YYNp+nggKb/Uz8T6EcpRg29WoW7y9k/C6ESn3dHtz77Wo5Omh58W4qu4WKD4tbjNWQMAIU1Yipf6ltMj90c3k3E93ujpNQ4OB8HzBSUWYaR7Htl+UI4fad3IiTjjt/EoxOeMpdN6smDhLoJgFuQreV6O9Qydkj9SvafAQRWidEnAS8KWMEzSqOzeursA1so8asNfr96Ylz71zNu1n73uuom5J5pXfsiGvasFZrj3ZqQpqfgABQvQw54Pvd+SfNikCDGNgXINwWEwC6upCi9OHDQe6keqry6SkH+h+jR4/vw+ZDmxolFqMenSnVzzMIm93NCbgEwbgx4/k4sJ7/SyqwQExLoR3URSyZyiIaMXmLat0BHwDJFs1IbS8v+mckYH5hL4zwxW0iFF9P7yjV/LsouC16MaTGeumfwVRuX2uVJmi6m937z+GJwmQDnv2/27QInt0Tmk0FtwXuzKBJXOix4teNXCW73eNT69zAyPtgUDOyE6Gt6QVEyu07ew3Cy4beFeDsbC3nklSWpiHiTCdDM9KlQUyr0kA0rcQtwxvHTPehAuRAODhI3r9AhLbiezsyOlMfzyk/9cxngqJjhPFXAg6+xxmF7AVAEW6t5ww+EvbWkdA8atj96fay6/AWWksdF6zSamV+nsAccEWIU/odqVTgJZWqtp+16NZN7zRqJof1+Nr1adD3woTNseQ5XRf7l56FBs1QOreQMOmVQRJjaRIsPZAvon1TkBf6VDXv9XamY8CjivJA/vJ6PDb0ne6vgGPg8UtZ9ok5UVFzkJQH2MAwKyJhSRybbS1+StbOoLtUFU5/IttcZyM81qOsr9zfJmyixn/H8KJJAO+4mVcmr7gDmh0j/eztT757qWX+etRoYtA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f75b0d55-55db-4816-b861-08da9c8236e1 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 10:07:10.8196 (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: 8UeZGH+udmFjXpZ1if9mc58rWLOFMPMbnWSMK/+woa9Kq9U0J9dUi/hX9cR6zT18fTi8pWClQfgZKmOrzqVMAhYi64irvXdJ2KaIGhcSMkI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4317 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_06,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220067 X-Proofpoint-GUID: Z1nUewF-YSQ-1ouCtp4pF24X06XHlN_z X-Proofpoint-ORIG-GUID: Z1nUewF-YSQ-1ouCtp4pF24X06XHlN_z Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This adds the core code to allow users to specify what errors they want scsi-ml to retry. We can then convert users to drop their sense parsing and retry handling. Signed-off-by: Mike Christie --- drivers/scsi/scsi_error.c | 63 +++++++++++++++++++++++++++++++++++++++ drivers/scsi/scsi_lib.c | 1 + include/scsi/scsi_cmnd.h | 24 ++++++++++++++- 3 files changed, 87 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 5fed56b6b7c5..059c5f40d236 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -1830,6 +1830,63 @@ bool scsi_noretry_cmd(struct scsi_cmnd *scmd) return false; } +static enum scsi_disposition scsi_check_passthrough(struct scsi_cmnd *scmd) +{ + struct scsi_failure *failure; + struct scsi_sense_hdr sshdr; + enum scsi_disposition ret; + int i = 0; + + if (!scmd->failures) + return SCSI_RETURN_NOT_HANDLED; + + while ((failure = &scmd->failures[i++])) { + if (!failure->result) + break; + + if (host_byte(scmd->result) & host_byte(failure->result)) { + goto maybe_retry; + } else if (get_status_byte(scmd) & + __get_status_byte(failure->result)) { + + if (failure->result == SCMD_FAILURE_ANY) + goto maybe_retry; + + if (get_status_byte(scmd) != SAM_STAT_CHECK_CONDITION) + goto maybe_retry; + + ret = scsi_prep_sense(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) + goto maybe_retry; + + if (failure->ascq != sshdr.ascq) + continue; + } + } + + return SCSI_RETURN_NOT_HANDLED; + +maybe_retry: + if (++failure->retries <= failure->allowed) + return NEEDS_RETRY; + + return SUCCESS; +} + /** * scsi_decide_disposition - Disposition a cmd on return from LLD. * @scmd: SCSI cmd to examine. @@ -1858,6 +1915,12 @@ enum scsi_disposition scsi_decide_disposition(struct scsi_cmnd *scmd) return SUCCESS; } + if (blk_rq_is_passthrough(scsi_cmd_to_rq(scmd))) { + rtn = scsi_check_passthrough(scmd); + if (rtn != SCSI_RETURN_NOT_HANDLED) + return rtn; + } + /* * first check the host byte, to see if there is anything in there * that would indicate what we need to do. diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 497efc0da259..56aefe38d69b 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1608,6 +1608,7 @@ static blk_status_t scsi_prepare_cmd(struct request *req) /* Usually overridden by the ULP */ cmd->allowed = 0; + cmd->failures = NULL; memset(cmd->cmnd, 0, sizeof(cmd->cmnd)); return scsi_cmd_to_driver(cmd)->init_command(cmd); } diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index bac55decf900..ee3986401f52 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -65,6 +65,21 @@ enum scsi_cmnd_submitter { SUBMITTED_BY_SCSI_RESET_IOCTL = 2, } __packed; +#define SCMD_FAILURE_NONE 0 +#define SCMD_FAILURE_ANY 0xffffffff +#define SCMD_FAILURE_ASC_ANY 0xff +#define SCMD_FAILURE_ASCQ_ANY 0xff + +struct scsi_failure { + u8 sense; + u8 asc; + u8 ascq; + int result; + + s8 allowed; + u8 retries; +}; + struct scsi_cmnd { struct scsi_device *device; struct list_head eh_entry; /* entry for the host eh_abort_list/eh_cmd_q */ @@ -85,6 +100,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; @@ -330,9 +347,14 @@ static inline void set_status_byte(struct scsi_cmnd *cmd, char status) cmd->result = (cmd->result & 0xffffff00) | status; } +static inline u8 __get_status_byte(int result) +{ + return result & 0xff; +} + static inline u8 get_status_byte(struct scsi_cmnd *cmd) { - return cmd->result & 0xff; + return __get_status_byte(cmd->result); } static inline void set_host_byte(struct scsi_cmnd *cmd, char status) From patchwork Thu Sep 22 10:06:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 608550 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 98607C6FA8B for ; Thu, 22 Sep 2022 10:07:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231288AbiIVKHg (ORCPT ); Thu, 22 Sep 2022 06:07:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230018AbiIVKHY (ORCPT ); Thu, 22 Sep 2022 06:07:24 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98F72B6571 for ; Thu, 22 Sep 2022 03:07:22 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MA3san006440; Thu, 22 Sep 2022 10:07:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=VVgu3lYKvIFRr+GLVoSKfoPBoxtramNcHfYQbQm79pk=; b=PUcGDMkwJh6L9lTxZtzKLEiYI6yxFlQ7bQTyqlfTO/7k9EcEYC5vxZ+DdhLjXxSQhdFJ d1IoXXo4Cgb9JIAaLemPNoyoFH2GrTdyRb7IRNf8zwE7E12zgzx4NrH+QMvor1Wn+6GY MO1hDWX0/EyX/SIoCbyr4+5hOWTnWb5sGbtMhUW/zC6zo8AUD0La/T+zE1f4mPXbyZyN P4JbzoOK3xWtbgeHyVR3u90tmC5HrGN7PYLrU0oEXgqPnIDy6fxwfGRc0ZHSJGOMJ+zJ SK2JMnx5CXBMcgTCBm/cIEVF7Qu9cQ6uAw9DolTHq9EapKN1ureDb2qys2dw2vu0SpVh OA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn68md276-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:15 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28M8liXF035391; Thu, 22 Sep 2022 10:07:14 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2173.outbound.protection.outlook.com [104.47.59.173]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3jp3d4dyqc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gDOKuu1PZtcG+XDFcYSGZ/B2Wtkswos9KK0HGVpJFJIBuSmSVXCy4HOamHk34RNYCccNvRPnS8i6OJTgQJAAMRxN9x+R3CWQI8gmqGpJdrPAdQjlMW4/0oIjApV35HOFhbpZhJQx29RrFVYcV1mPeqqIR7JfAc0A9PreM7fZvSlt3PEPQ+xTlPRrX/wm0pjZYZAXX++u4eq5hwYt5nq2uMGUa386S6ccbXPyy6CzLnpHhyUdcbfZ63uEZUMnGvGvsYqow9Tb6sAQvhn1lwbIvJfAGiS8UU4/k3/lkl/DCU2BlP1EWzzXNIsb6lNk/G0EBUNm9S/OWni7R8mciRN60Q== 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=VVgu3lYKvIFRr+GLVoSKfoPBoxtramNcHfYQbQm79pk=; b=TqVaXW3Xo5Wlv8nXPWc9lJAiUvz/PJHJpseKkb2TPoLNNv+Fg/hzOO6d6GflPOE7ZQ6FZKBzqQD3nOvViU8/MqgimTpewyxkD1RjtSXghnLvBwmwm1mrbfZ7ihPoz8pHEIzG8E1b4Uc2eIgwHRuTK08gQuWMZK5TWR1kwlfbERKG6eZZZ76kP1J6h0y1EFVncAtqBuzLdPB+I0vEhQ0hXU/j2ibIk6q0wGY60e/J0oWXzYZY6GBc2n8wfwCf4rHhs/nz0a9sxQ6QMpDEPfGtSESOnZm139kOt58MK2IU7gN4YRJs7ViCNp7kSG7PDWbpQ4fji8zDFYnaFhDe9bHr8Q== 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=VVgu3lYKvIFRr+GLVoSKfoPBoxtramNcHfYQbQm79pk=; b=Z0B5/Y5JkCaqHE9MS9k4+W2JVFSAl9gRsTHDUF39bxweBb1T7juJLZGgyZEf7QiNrOgyCvvQoqLtlDnvj92heONOAcywbEfNt27vHi0q7CtAXyAHmKxVPZrtdKg9i6bqcCVuYla5eHhhVLjDOCm/eiFdfG4e8uyEq/e9gKbysF8= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by MN2PR10MB4317.namprd10.prod.outlook.com (2603:10b6:208:199::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.19; Thu, 22 Sep 2022 10:07:12 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1%9]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 10:07:12 +0000 From: Mike Christie To: mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH RFC 03/22] scsi: Take an array of failures for passthrough Date: Thu, 22 Sep 2022 05:06:45 -0500 Message-Id: <20220922100704.753666-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922100704.753666-1-michael.christie@oracle.com> References: <20220922100704.753666-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR12CA0023.namprd12.prod.outlook.com (2603:10b6:610:57::33) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|MN2PR10MB4317:EE_ X-MS-Office365-Filtering-Correlation-Id: 880a01ab-6fc1-497d-32fe-08da9c8237c4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: q28x5fW7T937Zd6B+TwvZBQeEb6zlEGqjhfGF0noaMWRGm0zql0mtoUWFQz6BrDoBpvRSvaXN1aE3Pb22Ygnj+GwRZRjgiUZmhwLEqZqtRTkX6cMnh784Otq+1/YuxuXrBPIb1KG0Orl9B6n60DfNrpNknsasd7P8y2Z9eAkGUOlwkYo5edfk4TNx+OYgf7JR3WJYS6TBuswkHPwr81H9bvZ5AOw90AyVmaG8MWC3y2tnqjEmNBCu22x7C3ICh01tTF9eV9FHpPGOdZChNuMxa8iY+KOIwL1FLNb6tvJVEK8MytcJ1geBShpiU9NQjdXeoOLFL/TCeVqUmfh7KSONw/MBVKaELEUzfdHxJN7z0Nc057bj3DtDwmgofRMZKzCupCExdotcQDC+hcpMni/KGtwmzRIebetEquZShr76RqcWDEl3/pOn3AqS/pQc+ORFOxH85E8yFdYXnlgi3CTYIIqUEeE389+EHcmBqrJdd+R0Dw2qq5MRT7vzx9x4aQnkIxhXiUvu0jQmYyoSf27f5wtXI81KcX6BfMIt+b5ezNzEza/Ww6e9EH70Q8mLnDfXtaqzvppf2R8eWpuT3iKeB+vM7aznt/ga2ptwmGtibxlOVLofZ8GdljsANUoZqsRBJxVdg1dQ+F06PtQR9+hG5RX0nRSO9Yk+8I6VdxUkqsUQ1Cr4M5VgaRp00WsqSiHyBK1hXUtZPhWojAVFA5sqA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(346002)(39860400002)(376002)(396003)(136003)(451199015)(2906002)(86362001)(38100700002)(8676002)(6506007)(6666004)(107886003)(26005)(6512007)(4326008)(316002)(2616005)(6486002)(478600001)(30864003)(41300700001)(8936002)(5660300002)(66476007)(186003)(1076003)(66556008)(83380400001)(66946007)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iPisH1prBlVS8FXnco5Sv4OdXC1N8ndAbFjyFe1rZRW7uOmB7PKUonq/BZCpf9WgQ/VmsrYl5tWJUNRFg6prBMBD9bwy9fnhxb0GNT36QsnMfC452ubS2nhas6dBynMoeU76OXsV75JrZyfjwl5bCx1Ru9364mwi97ukM+nG2JmFYSqVs/W4FHyInr2V05YGQkW5G++RFNXXApsG6dGzir2xB+sf42HPjZgohdf+EvuQI0lSa6iWAnhTmkNDDp01yzLG5Lv16CvPZJX5hPcW5lGQBh1sSz8xYiREws9VcwMl73VV91LoEtGsdEPaW5NaXwBVfvYSSxtPqwscFEZ4c4kDxqXTr16PYtgVg0WazEYzPzB9fcID3r+UjAtOmant2ocIqq7pyoB4jZ7zroia1DQu9r/XRCqllieWkCegVHhBUHGN+Mwi2cR7UihgqZuIwqOsCpqGvhkJFWqI6MQ6yVl8aNyR5hjmRrCe3KqrpcKcH8PZk6Fn7zRv7xk3rqP5nQuqnKEj2RXwuMz9Pn/DfefnuCPs2c8Jc0vZOEmfbexEWboAt0mSFYlIKYVcnwrLZUBXuX68o6GSoxhfIYqX1uFURi0u09k/VQVOdLEBWDCxkG2u7oGO8zRX8tfZzOuezB99l9flzRIeZP3HjSRC3GZvTgIYvRGLWP+9HcfbMxzqnawnP50YyK4ipscXRHiBMVbv7QF/cMWsA0g+CHjWSxqA40LuWaaAehTPZMtZ7QsM4k+z795qI7mC96xdK/Foyt3kHF8hgHczQoZJcH2OBJXU9Vkd6+z7ZXAlS8nnN97p54fEBVai11Mo44gZGOZQRGLX02xFreH/biFVWAdkdmEn/+PF/pddXj7KIw5mhwAnszpSJF9Y0FkI4p6uvzSr2JYEVxHCgvYjUqAmTaiCazoggYKlZI5zWASwBuC+f1/slm2Xv3JIf0Ubk7S8J7A96FTPP4TX8KQTqbC+vgH1NL8QK+x5D0psWp4bZ1bSpA7cZw/BquShvEeNmSmHhRl8jr3onZ842sWxPGHPVa45D/tNy8uZpgKiJpGDTGP2btTzj393OgM0vk38s1znpUO6kb8+jE8uREUTHrwcYi5+vDyln00w2mWoqb7cS/2GjL7VcOIfNLYFquE7Ck+2xVCCpJ7wn/yDjWwRp8TJxnSFotj03oE2pZJTJiaEYftIV1FR1Wf7DkPaDTNhFFdprnanos4HQ9qEVTFFZudFRsylOBEpmQ9932bljahUQry43w0FAjnkJ/u9ZWx3KZ4NP256T4SLn8TXO/DgGPNcXoaUxpCjGtmYGXsUMnm/FjG4GgfyZOJlEr7rYi/uYXKgcgVHdUxg9kWHWm0SdjEi6GKEP5h/dKbVngk+HEj6FTk5y9v9V4WAdsKvIh9YK3hiiQ+kygmU0NSYGkU2Np6GPvOIW9MEhG8OP46dBzTptOZZAmbY751OGov/bVbGRXD9bLwKWIkzCY0z84Py6mvlOkmWlSA40EClImWyV0aH9OtWWTFBP+qJDF2Iv1BoxIAd4+aDf5oCpLmUbaR+fezezKes9ajmYDtUfn7bQNg/5zxahIuiGJAsSV126hMZdPsBZpjzspIELCjNpQlTQsIIuhn7bw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 880a01ab-6fc1-497d-32fe-08da9c8237c4 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 10:07:12.3351 (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: lYm6XGm2Gfjl69oJZWQw+QlhbhK6Oe+xLScFgDQJxNCtAoOgss6OJzwVKw645/PL20hkxw7ifUbM854ShcgmXacUDLgsRwZbIjcPbqfvUL8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4317 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_06,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 malwarescore=0 bulkscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220067 X-Proofpoint-ORIG-GUID: SAHaFIepMlo3Yz_vWKx6pPR7e3e0aXWs X-Proofpoint-GUID: SAHaFIepMlo3Yz_vWKx6pPR7e3e0aXWs Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This allows scsi_execute/scsi_execute_req users to pass in an array of scsi_failure structs they want retried. In most cases they can then drop their sesne parsing and error handling. Signed-off-by: Mike Christie --- drivers/ata/libata-scsi.c | 6 ++++-- drivers/hwmon/drivetemp.c | 2 +- drivers/scsi/ch.c | 2 +- drivers/scsi/cxlflash/superpipe.c | 2 +- drivers/scsi/cxlflash/vlun.c | 2 +- drivers/scsi/device_handler/scsi_dh_alua.c | 4 ++-- drivers/scsi/device_handler/scsi_dh_emc.c | 2 +- drivers/scsi/device_handler/scsi_dh_hp_sw.c | 6 ++++-- drivers/scsi/device_handler/scsi_dh_rdac.c | 4 ++-- drivers/scsi/scsi.c | 4 ++-- drivers/scsi/scsi_ioctl.c | 2 +- drivers/scsi/scsi_lib.c | 11 ++++++---- drivers/scsi/scsi_scan.c | 7 ++++--- drivers/scsi/scsi_transport_spi.c | 2 +- drivers/scsi/sd.c | 23 +++++++++++++-------- drivers/scsi/sd_zbc.c | 2 +- drivers/scsi/ses.c | 4 ++-- drivers/scsi/sr.c | 5 +++-- drivers/scsi/sr_ioctl.c | 2 +- drivers/scsi/virtio_scsi.c | 3 ++- drivers/target/target_core_pscsi.c | 8 +++---- drivers/ufs/core/ufshcd.c | 2 +- include/scsi/scsi_device.h | 15 ++++++++------ 23 files changed, 69 insertions(+), 51 deletions(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 29e2f55c6faa..cb8f8e1c8065 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -414,7 +414,8 @@ int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg) /* Good values for timeout and retries? Values below from scsi_ioctl_send_command() for default case... */ cmd_result = scsi_execute(scsidev, scsi_cmd, data_dir, argbuf, argsize, - sensebuf, &sshdr, (10*HZ), 5, 0, 0, NULL); + sensebuf, &sshdr, (10*HZ), 5, 0, 0, NULL, + NULL); if (cmd_result < 0) { rc = cmd_result; @@ -498,7 +499,8 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg) /* Good values for timeout and retries? Values below from scsi_ioctl_send_command() for default case... */ cmd_result = scsi_execute(scsidev, scsi_cmd, DMA_NONE, NULL, 0, - sensebuf, &sshdr, (10*HZ), 5, 0, 0, NULL); + sensebuf, &sshdr, (10*HZ), 5, 0, 0, NULL, + NULL); if (cmd_result < 0) { rc = cmd_result; diff --git a/drivers/hwmon/drivetemp.c b/drivers/hwmon/drivetemp.c index 5bac2b0fc7bb..cb4549194771 100644 --- a/drivers/hwmon/drivetemp.c +++ b/drivers/hwmon/drivetemp.c @@ -194,7 +194,7 @@ static int drivetemp_scsi_command(struct drivetemp_data *st, return scsi_execute_req(st->sdev, scsi_cmd, data_dir, st->smartdata, ATA_SECT_SIZE, NULL, HZ, 5, - NULL); + NULL, NULL); } static int drivetemp_ata_command(struct drivetemp_data *st, u8 feature, diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 7ab29eaec6f3..cdef392be5fc 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -197,7 +197,7 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, errno = 0; result = scsi_execute_req(ch->device, cmd, direction, buffer, buflength, &sshdr, timeout * HZ, - MAX_RETRIES, NULL); + MAX_RETRIES, NULL, NULL); if (result < 0) return result; if (scsi_sense_valid(&sshdr)) { diff --git a/drivers/scsi/cxlflash/superpipe.c b/drivers/scsi/cxlflash/superpipe.c index df0ebabbf387..cc1a63986bff 100644 --- a/drivers/scsi/cxlflash/superpipe.c +++ b/drivers/scsi/cxlflash/superpipe.c @@ -359,7 +359,7 @@ static int read_cap16(struct scsi_device *sdev, struct llun_info *lli) up_read(&cfg->ioctl_rwsem); result = scsi_execute(sdev, scsi_cmd, DMA_FROM_DEVICE, cmd_buf, CMD_BUFSIZE, NULL, &sshdr, to, CMD_RETRIES, - 0, 0, NULL); + 0, 0, NULL, NULL); down_read(&cfg->ioctl_rwsem); rc = check_state(cfg); if (rc) { diff --git a/drivers/scsi/cxlflash/vlun.c b/drivers/scsi/cxlflash/vlun.c index 5c74dc7c2288..dc934800edda 100644 --- a/drivers/scsi/cxlflash/vlun.c +++ b/drivers/scsi/cxlflash/vlun.c @@ -452,7 +452,7 @@ static int write_same16(struct scsi_device *sdev, up_read(&cfg->ioctl_rwsem); result = scsi_execute(sdev, scsi_cmd, DMA_TO_DEVICE, cmd_buf, CMD_BUFSIZE, NULL, NULL, to, - CMD_RETRIES, 0, 0, NULL); + CMD_RETRIES, 0, 0, NULL, NULL); down_read(&cfg->ioctl_rwsem); rc = check_state(cfg); if (rc) { diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c index 610a51538f03..335daaf90bb2 100644 --- a/drivers/scsi/device_handler/scsi_dh_alua.c +++ b/drivers/scsi/device_handler/scsi_dh_alua.c @@ -141,7 +141,7 @@ static int submit_rtpg(struct scsi_device *sdev, unsigned char *buff, return scsi_execute(sdev, cdb, DMA_FROM_DEVICE, buff, bufflen, NULL, sshdr, ALUA_FAILOVER_TIMEOUT * HZ, - ALUA_FAILOVER_RETRIES, req_flags, 0, NULL); + ALUA_FAILOVER_RETRIES, req_flags, 0, NULL, NULL); } /* @@ -173,7 +173,7 @@ static int submit_stpg(struct scsi_device *sdev, int group_id, return scsi_execute(sdev, cdb, DMA_TO_DEVICE, stpg_data, stpg_len, NULL, sshdr, ALUA_FAILOVER_TIMEOUT * HZ, - ALUA_FAILOVER_RETRIES, req_flags, 0, NULL); + ALUA_FAILOVER_RETRIES, req_flags, 0, NULL, NULL); } static struct alua_port_group *alua_find_get_pg(char *id_str, size_t id_size, diff --git a/drivers/scsi/device_handler/scsi_dh_emc.c b/drivers/scsi/device_handler/scsi_dh_emc.c index 2e21ab447873..162d822241ba 100644 --- a/drivers/scsi/device_handler/scsi_dh_emc.c +++ b/drivers/scsi/device_handler/scsi_dh_emc.c @@ -265,7 +265,7 @@ static int send_trespass_cmd(struct scsi_device *sdev, err = scsi_execute(sdev, cdb, DMA_TO_DEVICE, csdev->buffer, len, NULL, &sshdr, CLARIION_TIMEOUT * HZ, CLARIION_RETRIES, - req_flags, 0, NULL); + req_flags, 0, NULL, NULL); if (err) { if (scsi_sense_valid(&sshdr)) res = trespass_endio(sdev, &sshdr); diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c b/drivers/scsi/device_handler/scsi_dh_hp_sw.c index 0d2cfa60aa06..64345f9125ca 100644 --- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c +++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c @@ -88,7 +88,8 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) retry: res = scsi_execute(sdev, cmd, DMA_NONE, NULL, 0, NULL, &sshdr, - HP_SW_TIMEOUT, HP_SW_RETRIES, req_flags, 0, NULL); + HP_SW_TIMEOUT, HP_SW_RETRIES, req_flags, 0, NULL, + NULL); if (res) { if (scsi_sense_valid(&sshdr)) ret = tur_done(sdev, h, &sshdr); @@ -126,7 +127,8 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h) retry: res = scsi_execute(sdev, cmd, DMA_NONE, NULL, 0, NULL, &sshdr, - HP_SW_TIMEOUT, HP_SW_RETRIES, req_flags, 0, NULL); + HP_SW_TIMEOUT, HP_SW_RETRIES, req_flags, 0, NULL, + NULL); if (res) { if (!scsi_sense_valid(&sshdr)) { sdev_printk(KERN_WARNING, sdev, diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index bf8754741f85..fce6886b8319 100644 --- a/drivers/scsi/device_handler/scsi_dh_rdac.c +++ b/drivers/scsi/device_handler/scsi_dh_rdac.c @@ -556,8 +556,8 @@ static void send_mode_select(struct work_struct *work) (retry_cnt == RDAC_RETRY_COUNT) ? "queueing" : "retrying"); if (scsi_execute(sdev, cdb, DMA_TO_DEVICE, &h->ctlr->mode_select, - data_size, NULL, &sshdr, RDAC_TIMEOUT * HZ, - RDAC_RETRIES, req_flags, 0, NULL)) { + data_size, NULL, &sshdr, RDAC_TIMEOUT * HZ, + RDAC_RETRIES, req_flags, 0, NULL, NULL)) { err = mode_select_handle_sense(sdev, &sshdr); if (err == SCSI_DH_RETRY && retry_cnt--) goto retry; diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index c59eac7a32f2..d6c9e18d8044 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -310,7 +310,7 @@ static int scsi_vpd_inquiry(struct scsi_device *sdev, unsigned char *buffer, * all the existing users tried this hard. */ result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, - len, NULL, 30 * HZ, 3, NULL); + len, NULL, 30 * HZ, 3, NULL, NULL); if (result) return -EIO; @@ -532,7 +532,7 @@ int scsi_report_opcode(struct scsi_device *sdev, unsigned char *buffer, memset(buffer, 0, len); result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, - request_len, &sshdr, 30 * HZ, 3, NULL); + request_len, &sshdr, 30 * HZ, 3, NULL, NULL); if (result < 0) return result; diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c index 729e309e6034..cd7d25edfc77 100644 --- a/drivers/scsi/scsi_ioctl.c +++ b/drivers/scsi/scsi_ioctl.c @@ -74,7 +74,7 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd, "Trying ioctl with scsi command %d\n", *cmd)); result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, - &sshdr, timeout, retries, NULL); + &sshdr, timeout, retries, NULL, NULL); SCSI_LOG_IOCTL(2, sdev_printk(KERN_INFO, sdev, "Ioctl returned 0x%x\n", result)); diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 56aefe38d69b..7e4cc0b28f61 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -200,6 +200,7 @@ void scsi_queue_insert(struct scsi_cmnd *cmd, int reason) * @flags: flags for ->cmd_flags * @rq_flags: flags for ->rq_flags * @resid: optional residual length + * @failures: optional array of scsi_failure structs * * Returns the scsi_cmnd result field if a command was executed, or a negative * Linux error code if we didn't get that far. @@ -208,7 +209,8 @@ int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, int data_direction, void *buffer, unsigned bufflen, unsigned char *sense, struct scsi_sense_hdr *sshdr, int timeout, int retries, blk_opf_t flags, - req_flags_t rq_flags, int *resid) + req_flags_t rq_flags, int *resid, + struct scsi_failure *failures) { struct request *req; struct scsi_cmnd *scmd; @@ -231,6 +233,7 @@ int __scsi_execute(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 = failures; req->timeout = timeout; req->cmd_flags |= flags; req->rq_flags |= rq_flags | RQF_QUIET; @@ -2138,7 +2141,7 @@ int scsi_mode_select(struct scsi_device *sdev, int pf, int sp, } ret = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, real_buffer, len, - sshdr, timeout, retries, NULL); + sshdr, timeout, retries, NULL, NULL); kfree(real_buffer); return ret; } @@ -2203,7 +2206,7 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, memset(buffer, 0, len); result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, len, - sshdr, timeout, retries, NULL); + sshdr, timeout, retries, NULL, NULL); if (result < 0) return result; @@ -2288,7 +2291,7 @@ scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries, /* try to eat the UNIT_ATTENTION if there are enough retries */ do { result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, sshdr, - timeout, 1, NULL); + timeout, 1, NULL, NULL); if (sdev->removable && scsi_sense_valid(sshdr) && sshdr->sense_key == UNIT_ATTENTION) sdev->changed = 1; diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 5d27f5196de6..ddaa9e7b3e34 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -211,7 +211,7 @@ static void scsi_unlock_floptical(struct scsi_device *sdev, scsi_cmd[4] = 0x2a; /* size */ scsi_cmd[5] = 0; scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, result, 0x2a, NULL, - SCSI_TIMEOUT, 3, NULL); + SCSI_TIMEOUT, 3, NULL, NULL); } static int scsi_realloc_sdev_budget_map(struct scsi_device *sdev, @@ -677,7 +677,7 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, result = scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, inq_result, try_inquiry_len, &sshdr, HZ / 2 + HZ * scsi_inq_timeout, 3, - &resid); + &resid, NULL); SCSI_LOG_SCAN_BUS(3, sdev_printk(KERN_INFO, sdev, "scsi scan: INQUIRY %s with code 0x%x\n", @@ -1479,7 +1479,8 @@ static int scsi_report_lun_scan(struct scsi_target *starget, blist_flags_t bflag result = scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, lun_data, length, &sshdr, - SCSI_REPORT_LUNS_TIMEOUT, 3, NULL); + SCSI_REPORT_LUNS_TIMEOUT, 3, NULL, + NULL); SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev, "scsi scan: REPORT LUNS" diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index bd72c38d7bfc..4f4c2b155da0 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -126,7 +126,7 @@ static int spi_execute(struct scsi_device *sdev, const void *cmd, REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER, - RQF_PM, NULL); + RQF_PM, NULL, NULL); if (result < 0 || !scsi_sense_valid(sshdr) || sshdr->sense_key != UNIT_ATTENTION) break; diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index eb76ba055021..c215da95fb8f 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -673,7 +673,7 @@ static int sd_sec_submit(void *data, u16 spsp, u8 secp, void *buffer, ret = scsi_execute(sdev, cdb, send ? DMA_TO_DEVICE : DMA_FROM_DEVICE, buffer, len, NULL, NULL, SD_TIMEOUT, sdkp->max_retries, 0, - RQF_PM, NULL); + RQF_PM, NULL, NULL); return ret <= 0 ? ret : -EIO; } #endif /* CONFIG_BLK_SED_OPAL */ @@ -1595,7 +1595,8 @@ static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr) * flush everything. */ res = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, sshdr, - timeout, sdkp->max_retries, 0, RQF_PM, NULL); + timeout, sdkp->max_retries, 0, RQF_PM, NULL, + NULL); if (res == 0) break; } @@ -1721,7 +1722,7 @@ static int sd_pr_command(struct block_device *bdev, u8 sa, data[20] = flags; result = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, &data, sizeof(data), - &sshdr, SD_TIMEOUT, sdkp->max_retries, NULL); + &sshdr, SD_TIMEOUT, sdkp->max_retries, NULL, NULL); if (scsi_status_is_check_condition(result) && scsi_sense_valid(&sshdr)) { @@ -2065,7 +2066,8 @@ sd_spinup_disk(struct scsi_disk *sdkp) the_result = scsi_execute_req(sdkp->device, cmd, DMA_NONE, NULL, 0, &sshdr, SD_TIMEOUT, - sdkp->max_retries, NULL); + sdkp->max_retries, NULL, + NULL); /* * If the drive has indicated to us that it @@ -2125,7 +2127,7 @@ sd_spinup_disk(struct scsi_disk *sdkp) scsi_execute_req(sdkp->device, cmd, DMA_NONE, NULL, 0, &sshdr, SD_TIMEOUT, sdkp->max_retries, - NULL); + NULL, NULL); spintime_expire = jiffies + 100 * HZ; spintime = 1; } @@ -2274,7 +2276,8 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, the_result = scsi_execute_req(sdp, cmd, DMA_FROM_DEVICE, buffer, RC16_LEN, &sshdr, - SD_TIMEOUT, sdkp->max_retries, NULL); + SD_TIMEOUT, sdkp->max_retries, NULL, + NULL); if (media_not_present(sdkp, &sshdr)) return -ENODEV; @@ -2359,7 +2362,8 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp, the_result = scsi_execute_req(sdp, cmd, DMA_FROM_DEVICE, buffer, 8, &sshdr, - SD_TIMEOUT, sdkp->max_retries, NULL); + SD_TIMEOUT, sdkp->max_retries, NULL, + NULL); if (media_not_present(sdkp, &sshdr)) return -ENODEV; @@ -3609,7 +3613,8 @@ static int sd_start_stop_device(struct scsi_disk *sdkp, int start) return -ENODEV; res = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, &sshdr, - SD_TIMEOUT, sdkp->max_retries, 0, RQF_PM, NULL); + SD_TIMEOUT, sdkp->max_retries, 0, RQF_PM, NULL, + NULL); if (res) { sd_print_result(sdkp, "Start/Stop Unit failed", res); if (res > 0 && scsi_sense_valid(&sshdr)) { @@ -3752,7 +3757,7 @@ static int sd_resume_runtime(struct device *dev) if (scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, NULL, sdp->request_queue->rq_timeout, 1, 0, - RQF_PM, NULL)) + RQF_PM, NULL, NULL)) sd_printk(KERN_NOTICE, sdkp, "Failed to clear sense data\n"); } diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index bd15624c6322..1c9db71335a7 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c @@ -159,7 +159,7 @@ static int sd_zbc_do_report_zones(struct scsi_disk *sdkp, unsigned char *buf, result = scsi_execute_req(sdp, cmd, DMA_FROM_DEVICE, buf, buflen, &sshdr, - timeout, SD_MAX_RETRIES, NULL); + timeout, SD_MAX_RETRIES, NULL, NULL); if (result) { sd_printk(KERN_ERR, sdkp, "REPORT ZONES start lba %llu failed\n", lba); diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index 0a1734f34587..8f5a6370f334 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -92,7 +92,7 @@ static int ses_recv_diag(struct scsi_device *sdev, int page_code, do { ret = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen, - &sshdr, SES_TIMEOUT, 1, NULL); + &sshdr, SES_TIMEOUT, 1, NULL, NULL); } while (ret > 0 && --retries && scsi_sense_valid(&sshdr) && (sshdr.sense_key == NOT_READY || (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29))); @@ -133,7 +133,7 @@ static int ses_send_diag(struct scsi_device *sdev, int page_code, do { result = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, buf, bufflen, - &sshdr, SES_TIMEOUT, 1, NULL); + &sshdr, SES_TIMEOUT, 1, NULL, NULL); } while (result > 0 && --retries && scsi_sense_valid(&sshdr) && (sshdr.sense_key == NOT_READY || (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29))); diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index a278b739d0c5..8b28a8a28b45 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -173,7 +173,7 @@ static unsigned int sr_get_events(struct scsi_device *sdev) int result; result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, sizeof(buf), - &sshdr, SR_TIMEOUT, MAX_RETRIES, NULL); + &sshdr, SR_TIMEOUT, MAX_RETRIES, NULL, NULL); if (scsi_sense_valid(&sshdr) && sshdr.sense_key == UNIT_ATTENTION) return DISK_EVENT_MEDIA_CHANGE; @@ -732,7 +732,8 @@ static void get_sectorsize(struct scsi_cd *cd) /* Do the command and wait.. */ the_result = scsi_execute_req(cd->device, cmd, DMA_FROM_DEVICE, buffer, sizeof(buffer), NULL, - SR_TIMEOUT, MAX_RETRIES, NULL); + SR_TIMEOUT, MAX_RETRIES, NULL, + NULL); retries--; diff --git a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c index fbdb5124d7f7..40146ef3afa5 100644 --- a/drivers/scsi/sr_ioctl.c +++ b/drivers/scsi/sr_ioctl.c @@ -204,7 +204,7 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc) result = scsi_execute(SDev, cgc->cmd, cgc->data_direction, cgc->buffer, cgc->buflen, NULL, sshdr, - cgc->timeout, IOCTL_RETRIES, 0, 0, NULL); + cgc->timeout, IOCTL_RETRIES, 0, 0, NULL, NULL); /* Minimal error checking. Ignore cases we know about, and report the rest. */ if (result < 0) { diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index 00cf6743db8c..052b30b00b50 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c @@ -349,7 +349,8 @@ static void virtscsi_rescan_hotunplug(struct virtio_scsi *vscsi) result = scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, inq_result, inquiry_len, NULL, - SD_TIMEOUT, SD_MAX_RETRIES, NULL); + SD_TIMEOUT, SD_MAX_RETRIES, NULL, + NULL); if (result == 0 && inq_result[0] >> 5) { /* PQ indicates the LUN is not attached */ diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index e6a967ddc08c..554f9ccef001 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c @@ -145,7 +145,7 @@ static void pscsi_tape_read_blocksize(struct se_device *dev, cdb[4] = 0x0c; /* 12 bytes */ ret = scsi_execute_req(sdev, cdb, DMA_FROM_DEVICE, buf, 12, NULL, - HZ, 1, NULL); + HZ, 1, NULL, NULL); if (ret) goto out_free; @@ -196,7 +196,7 @@ pscsi_get_inquiry_vpd_serial(struct scsi_device *sdev, struct t10_wwn *wwn) put_unaligned_be16(INQUIRY_VPD_SERIAL_LEN, &cdb[3]); ret = scsi_execute_req(sdev, cdb, DMA_FROM_DEVICE, buf, - INQUIRY_VPD_SERIAL_LEN, NULL, HZ, 1, NULL); + INQUIRY_VPD_SERIAL_LEN, NULL, HZ, 1, NULL, NULL); if (ret) goto out_free; @@ -231,8 +231,8 @@ pscsi_get_inquiry_vpd_device_ident(struct scsi_device *sdev, put_unaligned_be16(INQUIRY_VPD_DEVICE_IDENTIFIER_LEN, &cdb[3]); ret = scsi_execute_req(sdev, cdb, DMA_FROM_DEVICE, buf, - INQUIRY_VPD_DEVICE_IDENTIFIER_LEN, - NULL, HZ, 1, NULL); + INQUIRY_VPD_DEVICE_IDENTIFIER_LEN, NULL, HZ, 1, + NULL, NULL); if (ret) goto out; diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index a202d7d5240d..601648352aff 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -8782,7 +8782,7 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, if (remaining <= 0) break; ret = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, &sshdr, - remaining / HZ, 0, 0, RQF_PM, NULL); + remaining / HZ, 0, 0, RQF_PM, NULL, NULL); if (!scsi_status_is_check_condition(ret) || !scsi_sense_valid(&sshdr) || sshdr.sense_key != UNIT_ATTENTION) diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 2493bd65351a..85c5baac1b17 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; @@ -458,24 +459,26 @@ extern int __scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, int data_direction, void *buffer, unsigned bufflen, unsigned char *sense, struct scsi_sense_hdr *sshdr, int timeout, int retries, blk_opf_t flags, - req_flags_t rq_flags, int *resid); + req_flags_t rq_flags, int *resid, + struct scsi_failure *failures); /* Make sure any sense buffer is the correct size. */ #define scsi_execute(sdev, cmd, data_direction, buffer, bufflen, sense, \ - sshdr, timeout, retries, flags, rq_flags, resid) \ + sshdr, timeout, retries, flags, rq_flags, resid, \ + failures) \ ({ \ BUILD_BUG_ON((sense) != NULL && \ sizeof(sense) != SCSI_SENSE_BUFFERSIZE); \ __scsi_execute(sdev, cmd, data_direction, buffer, bufflen, \ sense, sshdr, timeout, retries, flags, rq_flags, \ - resid); \ + resid, failures); \ }) static inline int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd, int data_direction, void *buffer, unsigned bufflen, struct scsi_sense_hdr *sshdr, int timeout, - int retries, int *resid) + int retries, int *resid, struct scsi_failure *failures) { - return scsi_execute(sdev, cmd, data_direction, buffer, - bufflen, NULL, sshdr, timeout, retries, 0, 0, resid); + return scsi_execute(sdev, cmd, data_direction, buffer, bufflen, NULL, + sshdr, timeout, retries, 0, 0, resid, failures); } extern void sdev_disable_disk_events(struct scsi_device *sdev); extern void sdev_enable_disk_events(struct scsi_device *sdev); From patchwork Thu Sep 22 10:06:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 609104 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 C1EF6C6FA86 for ; Thu, 22 Sep 2022 10:07:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231274AbiIVKHe (ORCPT ); Thu, 22 Sep 2022 06:07:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229585AbiIVKHY (ORCPT ); Thu, 22 Sep 2022 06:07:24 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94515B6565 for ; Thu, 22 Sep 2022 03:07:22 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MA3s6Y006449; Thu, 22 Sep 2022 10:07:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=RdrkLDWQ3DsDLbcHnzyDTnE8C6MPuiCWmbDoFaywF/Q=; b=JTU+UajovrB79HWRbRuBE9sgcK39iAA7XlwMhDYSpfHP2ydh7RbbkTQmXpk5KlvhIQMA z3yxyeg7pvu7Sv3DlZBjORjv5yJTU8iwsWXDBAgyTg45Qb8DHOl/NMWWSaDoknb2ZknB KWwAKMhl0bOEqTkuc7iFHuJao3eZCJyAaEnQWUvgeQqoM2P/JHsuU2pPv2fJPeZX1y/r GK0BLCiI9IugCVq+P67NJF8pXKFnpTr0YA235Qv4cYGf02QjGkQWye9aXk1820FhiUQZ 5hafXinkd0UioFeknAHgD2+QVK6OpAGz9UI9RIupZGsthCfQui1EXmfCUzv278iNhGYt lg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn68md277-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:15 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28M8liXG035391; Thu, 22 Sep 2022 10:07:15 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2173.outbound.protection.outlook.com [104.47.59.173]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3jp3d4dyqc-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O+5HprN3PkPqh20OdqNmmSRJxNsGa5zIKGxROl+On4NoSw0jifcbM+CzpaS/Qv1GAJRzJqkViMXfwNvf4l7sFPCqWIdtYbcfLt7H7VN4KldhUPkzorkXSgdagPvWVIIpkn7PLxSD3yyBbPyUr8VS8b1JbWLxcChZR1nSg8u4JZBH+z9R2gU0G0lgbAGVt5TpiHB31aEofpE/KcZcxZwuoXUVCU+rDqVXLjRyj9mVV+dIE5vaiuPJJq9qwfkL37DgGEjTt5J4l54U9FspnDBtR08Sh+HIwgCWkJRNPBtTQCYPfHGAHCun6E8FFPUxQcnLcV6N9ZAoLjlUes5fpElCaA== 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=RdrkLDWQ3DsDLbcHnzyDTnE8C6MPuiCWmbDoFaywF/Q=; b=VP8HyM0ZTyDYzg7cr3Qclv1XtXjQcNyq5Afo7zQznaqnnhxrHsqpNXtmVv930c1bH87AlQZH2qdmlRSRxWPro4/NHSVD0eDJRQRHWXnBWCbrWo4CPY1fA5uPWcA6ds1RjNfkZhwGZ+5fIGEWbvf68hhS622raVt/7suI5yCGkT1goCNYKwazqjYoZs/JmtW8EJZzRvneeS7/Yl6nSswOxd6EVQS02jIaP1+DSQ/zKaYP3Jd2TexHfFw+KzA+jFW9djMs/V1Tvyr/Zm0WW6K/X6bIw8sKNyiVBE/B88OEQQExK8Ia/TwPtqsRk8ORT/iZZBot3J2Y4qZcMd45AI+bHw== 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=RdrkLDWQ3DsDLbcHnzyDTnE8C6MPuiCWmbDoFaywF/Q=; b=Xpp/5k7ShDtq38s+hCqnM8LbWu8NQh7BD7LlYKisoUgBSA5dp1OtEmCv7Ao+p449gOS6njisLwYO53mkwz3taF3AGbcRtXWuIN+O2uOxtCVcuu0WA5ShEMFM2FoH16n6MlC/N6mcF+qdDvBeoI8YtiMAPFivGRS68J663ZvkX6c= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by MN2PR10MB4317.namprd10.prod.outlook.com (2603:10b6:208:199::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.19; Thu, 22 Sep 2022 10:07:13 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1%9]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 10:07:13 +0000 From: Mike Christie To: mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH RFC 04/22] scsi: Have scsi-ml retry scsi_probe_lun errors Date: Thu, 22 Sep 2022 05:06:46 -0500 Message-Id: <20220922100704.753666-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922100704.753666-1-michael.christie@oracle.com> References: <20220922100704.753666-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR03CA0236.namprd03.prod.outlook.com (2603:10b6:610:e7::31) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|MN2PR10MB4317:EE_ X-MS-Office365-Filtering-Correlation-Id: aab0d53e-acba-4566-246a-08da9c82389d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: D6rmEZjh4JODspJQ1shxBtdAoOZI4kpevOagxjwKkiWbiWCHs127Ji+knTJg3c3D/vmEZ96VM6iR1+MtjYAvrIXoVV2kMmnaBEU4t8uxeqDcywe2gT8yFRQecYSNh1AtG5w/gwbp+vY6IGDXl2lfC4TJ9Th6LflfhYPGaO1XmPDkGkMJo8ChBjLRzfgBaVPQ3MAvowQQUvVikLb2pkkUhXFLb9L/krUyl9KY04eQRdruFs8dHlaQ/vR7CL+8Lxa/td99fKrYqHaUb2VHUW7OQTGio/zb/B9WZ0bSGgBmsbsSO8k9rGHIBWDGoDL7QTf817tdbwtXB85sASSrjtjaIgKpFeHBZEhrVpnYrcDVPeBLIsvv4hNcP3SRBeD7czqiHLciUBdZybH/Zb+tPB3tYkv/vIFhkLSSCtEwO/Zi9SsGvnquH4PVO6Nq7vx1ze+JO5wV1AUyx8aUv850h3zxEQesSSbYaZNZtx6K7fPnSrAnOLLHPzooeghZUsvIkxXqfXTmtJikscpkltpi70dImRKJyZC9yEFs6XEOSyOjLDWlxi7kI38XrOz3c2E894+0NhwlHg3PkuHK2O0qULEBsNWwL0x22Ioz85P83wLn11HcyohTZxYrsi8DfJqDgDRlwar18cPMbEz6K7OyEq/ss/8WbhGT4marlYzNTq0FhrBLMus/kPDgvYD3S7mU+wDmVHUSf+QH+PVWrvzeGPxFfw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(346002)(39860400002)(376002)(396003)(136003)(451199015)(2906002)(86362001)(38100700002)(8676002)(6506007)(6666004)(107886003)(26005)(6512007)(4326008)(316002)(2616005)(6486002)(478600001)(41300700001)(8936002)(5660300002)(66476007)(186003)(1076003)(66556008)(83380400001)(66946007)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bmEqe/1YfSE+Voi9i39XuWDrWUOREzCCNcjoOktmdBW/gA/5/pB+sdma2ZANkn2/IyEHjcuTZQg6tkZKT5mKw5u6VGnkjUIyyN8dpzo+RDr4dOiyzxUwf05naCNt8oqj2k7unQs35s3E2pCGTeLtjR8n2Ueg9yqX6EWimxArgBRd2g4eF8YGGYWCPzoy1tP7y3OIntN9lGHos4Snwl+BgQMRR0BN6z8ciJCqKDt3uMVF/BKRXrB07kAWRqyCYJ6Oa0VLIGembny1f8SEgocO1u1WbHLw+l7cEHO8uolboQThuTdIKcAb4qFgwTR4g8O5/rytnA0AqNbjoJqyCwCGMUj306MXP4wMXsNdyEV3JWuB25qhPFT4adDdshzrKD1WTHto4yyIw/BWYz0Abku80o5JB3+VuO0NjzwjXzBcY7QgDjthCwd/+ewsS3lAtZ/f8f0XBcN80IJm7Lc9yUy7FRcnLSgtA/Tyb9G7kEVGc3cQ+uzsPJ9O6JcxecEDd5g/rU6JwKTztypPsGfgonz72qPKEO7xqaiGS3q6Xj5/Ljbptqm958xw39eW5pQLgitzpTe7ZRBcH2WYVulK7X0pfdYuTgUVF4qw6rYipESGMAuyMX0a2gMjc/lsV4zHfcepf1QrZqlxzKLz9G68yuf0WOdD9frp8andKcDSCbnSTXg7deNrRpxi0oA230yb5jZMTVCea5fOLPdWCTuEbcBVtEPSk7XXvdWUZD07nkW+6d4lc+NrwAt1K6U4HZ7ZJA3SNDIyNZgINdaG4zFwt6bUjDMzC3QDSIp7uWbvIel0ROBKtmfxiYNczoLc0xHpI5w1FnUtVnlb3ozSS+j1h89VLsdKjIa7R4RxevrnOAfD+ZeRt4YRPKymkPbkUAHQiYkzM8WzSQrv9SMgFxgh8yHuC4eplHXOoCPBQJI9P1UWcebYvc3KJs3LHNxTaUZpEqYqQULRgam1j3xuoGFwDoDUwvcAmS/F2OGfxw2xvHGd/cEeZ6FbS6oCGZCkgW4RwrRZXiTeONpctHCLYQIA9GONjd9v0Ct+g+jXEREFcVxQ4CoBE0CqnYIxkmqpA/G5UQl7i9z3TT/s3laGEUzY/m4iI5MMIssK0VNwbE9iZx0uMrq59Csi7g6jhBmPua7YFyw28EXWnvgTzs9R5v31MLLDh7rtvAqdG3u8xf57cYdaSDZ1NWKrzkMyK5XpeUj/1qqbT1SJZg3PT/1g4GIF0eyHeQXyTZGcdqZwnqsU0i2S4aWMqtjaZjHnMU9mj0CfhtPB+7dulwTLUm4G9WgeRjdL7I3fPS3//a94eIqg5VmOOwrS12NGyKllo6qMZeHs5m193j31u779fulDvsR64UOiAh00eGynDbYAN5v3k+XdjwcyLdu3kwn6kgQdxrTvxPevvARZYFJstiFOLj/Jqt5cvqa+IB/hCGqCCfTsHEAeJwT8jPwld68kcPMMB1CJybq8IdpNeK/exZOHuJGx9O8nl1LRZOVoaTGt6dG23aS7erXW1U+AJzNVhTAJsrYsOX5GdjyAylsuof+rKbTO0XJbmFHYjWSRF/nUlWrVSRMX/yCSJSXroOFUgZzp69EfWpe9h0JxXTo39A2DyYb+9XDptA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: aab0d53e-acba-4566-246a-08da9c82389d X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 10:07:13.6944 (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: 2VlgqJON3SVk1Jt+LvJtivS2kCBMuR0s9yK/ZjIJ//moNSCeEuUw2PZ4zeJxRkx+7dqKOUbOupLfxtCFaK+QhJQeuaFJZpNsGHt+w+BluBM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4317 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_06,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 malwarescore=0 bulkscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220067 X-Proofpoint-ORIG-GUID: 1wNInW4GwcxhBMfthUNo7lRXfEeg7Xfw X-Proofpoint-GUID: 1wNInW4GwcxhBMfthUNo7lRXfEeg7Xfw Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has scsi_probe_lun ask scsi-ml to retry UAs instead of driving them itself. Signed-off-by: Mike Christie --- drivers/scsi/scsi_scan.c | 41 +++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index ddaa9e7b3e34..08eaa7ddfb97 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -649,6 +649,28 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, int response_len = 0; int pass, count, result; 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, + .ascq = 0, + .allowed = 3, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = UNIT_ATTENTION, + .asc = 0x29, + .ascq = 0, + .allowed = 3, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; *bflags = 0; @@ -677,28 +699,13 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, result = scsi_execute_req(sdev, scsi_cmd, DMA_FROM_DEVICE, inq_result, try_inquiry_len, &sshdr, HZ / 2 + HZ * scsi_inq_timeout, 3, - &resid, NULL); + &resid, failures); SCSI_LOG_SCAN_BUS(3, sdev_printk(KERN_INFO, sdev, "scsi scan: INQUIRY %s with code 0x%x\n", result ? "failed" : "successful", result)); - if (result > 0) { - /* - * not-ready to ready transition [asc/ascq=0x28/0x0] - * or power-on, reset [asc/ascq=0x29/0x0], continue. - * INQUIRY should not yield UNIT_ATTENTION - * but many buggy devices do so anyway. - */ - if (scsi_status_is_check_condition(result) && - scsi_sense_valid(&sshdr)) { - if ((sshdr.sense_key == UNIT_ATTENTION) && - ((sshdr.asc == 0x28) || - (sshdr.asc == 0x29)) && - (sshdr.ascq == 0)) - continue; - } - } else if (result == 0) { + if (result == 0) { /* * if nothing was transferred, we try * again. It's a workaround for some USB From patchwork Thu Sep 22 10:06:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 609094 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 ED727C6FA82 for ; Thu, 22 Sep 2022 10:10:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231478AbiIVKKB (ORCPT ); Thu, 22 Sep 2022 06:10:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231343AbiIVKJ1 (ORCPT ); Thu, 22 Sep 2022 06:09:27 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37F8CD5751 for ; Thu, 22 Sep 2022 03:09:27 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MA53k7023893; Thu, 22 Sep 2022 10:07: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-2022-7-12; bh=FL1oLUYEbL00qEv7jhKKC4V/gY67TgXeyer0vkxdVCQ=; b=xPc2XHqAdfw0+zOAwtpJq/t19iCHzjK6Ev1HatrOetImRxsBFftjtViz7gTWbVieCIND GGZM/VRk3O6TIlrxKn1/eAZnTMM4/XQ9UeJsHlwtqttXHJ7FgdUVjuz/8+a1tbP0fm+v ZuhHK22FCQED3KnIOUVG/TP6eauUra4EfmcGObkLSopusqUCRVzSOqGGTnhaoJEaTDT1 OtsYGT6dALML7MnnhaNEE+DEK9aLuBQMQkfQ33ywyOEEM+P5E985bK6tK4D3k6c0s1lD w9jRjyLw9thRRT4mEK4fk5nIdUbke00yYtIY79z2pezUlVtRz7Hxpk2jX1ZYw5hEvDMv 5A== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn6f0mn7k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:18 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28M8lhQi035368; Thu, 22 Sep 2022 10:07:17 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2172.outbound.protection.outlook.com [104.47.59.172]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3jp3d4dyrv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oJRbggGAGpEmPEof+RL7kCQeaRG6gHlgEBk7f7XGEAqiKlYld0qzn5Pzz9PBia5VK+LKcNWlToQIVmnWcA20pcMrjGNgkf5PjP6VwRxjymn144vrFecJRdTX5372DbnzkF9BZumKr5rBx9KHgK7XdbUUKn8YCYn5mZTOjLjb8CGQpNFUCx+UQPTuNVB5zGjNchV43VGtn6iwloIrRFmk487wR16f3iH0z3wQ2OrGJia4XT0ZHt0SEyx8iwh3dle7++VS854VN1nNsDaJ15HahP2rLrbAZPt+sfnYrDsVBFt7FVh/SQkXN1fiomOyS2Fn5wTcKDRdLkuQ+qLezPinFg== 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=FL1oLUYEbL00qEv7jhKKC4V/gY67TgXeyer0vkxdVCQ=; b=jRm5QEzjo8KAOOPH2yUvKJTPr+jmPDDU3cCO7B45DXvTwIt1yQfZk2kcAJ1YPBRcoct9NsfN5T0Yfzoxw5/A2kQK7nftYCE1CbQyMz12k81rSa+hZSmcpgHrmqzWv17sAM1glQeGZLiMKLW2JUacRYBmKveZJ4R+5BqFUDGB+pKiRTSPX9tiivhzT3OtnhoeEcnXge2rF6iELp+HaSfLiEecJF7zxNjYoMmQnNDtwZ65+JfpXpgmMz5MnvHdrLX57si4LkfU5/hU65170RMKcIglDfYKr8VSoNDfAA13UtfLsISPi+M81pawbSQ4pmt9D9jA+SkHoCEKPQ1kzQllXw== 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=FL1oLUYEbL00qEv7jhKKC4V/gY67TgXeyer0vkxdVCQ=; b=qun/3QbA216s9chpClCANtos30JTqKFqnqrRcKq/6buhGvYH1oygcQ8zu8lackdb8E7bhRtbb342bGuh/IxUktlMjb/075x/yUxhQk/gKE+5zGHmU+yAlANWHx4qlZSwL/moPKP3ivIVjFDjnjwajKBOtfu+NZsyRiK5xB4WiJM= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by MN2PR10MB4317.namprd10.prod.outlook.com (2603:10b6:208:199::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.19; Thu, 22 Sep 2022 10:07:15 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1%9]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 10:07:15 +0000 From: Mike Christie To: mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH RFC 05/22] scsi: retry INQUIRY after timeout Date: Thu, 22 Sep 2022 05:06:47 -0500 Message-Id: <20220922100704.753666-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922100704.753666-1-michael.christie@oracle.com> References: <20220922100704.753666-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR02CA0021.namprd02.prod.outlook.com (2603:10b6:610:4e::31) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|MN2PR10MB4317:EE_ X-MS-Office365-Filtering-Correlation-Id: 61b7f9c8-66d1-4a88-c5e9-08da9c823986 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ya2WEmWWjhCwENJIqAO8HxcKAZJI2GBVmuZHjyBWpvqEh4OEuZFg0U6pWLOEhr9dNYM5FFbSQ1kIg0HH2MSE3SObOvhy6rtW3sUqbexa4RLR3boPDSKVGkxtLuz+DtCzt5OLPte8lZB2I2ObsA5MELoR+lNisx9ffuR8QvD+WgnSb9iRSKsS5nvstgpgY5Aadu/892uHH4p0giQgHvRGvb2mnAGbwxLpTaYDawB7zIsZrWIz+SlfAQ6ygBvRzx8mYahVpZ+u3AzlTbbVZzyx4HVT/FWBEsQ/gEaPwRWm0mz70RhzHOXC1CdL4HUlWxXzdUYwnlRkcKhNqIUdfjz9t6H3IBGachmHu5ER8bY4BciLH2B9VUdglaecjEeg96S+Fim6hzl3w1PVvepq39kyzrLMwr1rkYwd/wW0PY3fxqPMCyRSqDb9S3wzE1vayCsDmi2zx6ZzoRbe6s9mdjdlq0Qv432DbKZvPYsb88sguYfVJdS3EPNA8VsiViJqBbNochXxzaDQPzqI+etVe6Z34HRhw/xAfCxtyuY90kG7ESH6jp1xqXFFsXvbxBiQDg4pW8K12ov1bs4356kuE5nlWhb7wuUXgD52dx0qm1T2Mxv4lvcpCsP8XezLGQa1SO6eaBAPVBBiif90TJgj33hVAd3ct2f+1+3qQ1Od7dACd3gRFFpGZr5ptikE9soyNftIL7s7ybqplvGUYTpyqxVywA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(346002)(39860400002)(376002)(396003)(136003)(451199015)(2906002)(86362001)(38100700002)(8676002)(6506007)(6666004)(107886003)(26005)(6512007)(4326008)(316002)(2616005)(6486002)(478600001)(4744005)(41300700001)(8936002)(5660300002)(66476007)(186003)(1076003)(66556008)(66946007)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8mr6ZotBlo+Y9e3w/QxorxGy6SJddlYZ9Clz6vsXeVdR99mIhmxKyutaHm/wCw/tiKxX1QTBRE0iFt4djDeTuPWe0SMt6gweZsM6gDB5xQ83CUZc3a3nrBIaOF2LH1VWQl89e/uJZceafeCYFDtYzarnMbOzbxIe/H2APoXorPe8+iVjizDTDWSTUavCAaTxzRXd8OqN3epsMS+DwrOdJFZg6/YVJJ7T6HPiW50Lt7BiTdINWM2e2AgZpVU12oFnLlKr4Gu2BUAZe74t4ORSlQxvX9QxySWDkNbdkDE8VN4Dq8RPNLFgLtu8DvWW1iDzKBHdBD4RbCTbaD9xcr6W7MIldnKGlDyKZnPX5cZpGiuoNcG0KEFd2XspWT0Ay2xZtVGRDCg+wePKtMcQ6pFGZC9QBnccZbjtbRIVYp6pQOm0q5SiPdgmOBaAp0Tq7yR8lZu1OgXQIruGCkynLX1faoSDsZCAUADjp48fIqYLCafSEkANTF/8G59vKTfOn6HwXAcwEGIO+j3hXnHTPbqrXIFXdc+W5o1sXpmfQTtPGe5AUPw7wh14FKmJns9UmIRhYTw5T4FEnhXZHVwblsu47Zq/0XUTdwpxnJLY34G1nXpWqBJOcNk4iNe4f7Cd9RuLSTwkGf9jJe6K7zrtzVIBJS/n+o6SwgIEYctieDDQZFdmzGZ/3zoZSkYjBjL4iAuAMJeAyNadQ8TdaxIyAi6tkP6sZ+dvgZMOuTvOAsPJAgWL1AIeML8WRy2oa2tb3ggAg7lUg6JVUcnLmbw9syt722snPnFfxRqHBUtLOe9Ja21iWljxQkrqcjetvD6Vgpmm9mav1wPxRDYvGCF/eITZPdVpixt1wdauDNCg/+8Hh/A6wmjYAPLUJkIWm1anu/6Zj3jgbRSi2p+QQuj1eA0IIVRYrvlHQnsGE6+tuftFXQQ8HmD6MbvQwc8hjM9rbLnHXo+krdC2IlEuKQ+2n9249G7BmL0sU+dzL3xL68epDhVckyaymlZOclJW3TefF0NxxnzurehGKddXtqZLadHyPRCMocCjRFNektaLQVCRQzsEyCp7rwe8kPZ80uviNwfqURSvUWjjULgO19JhTg1R8C13Hw5GFpW1qTyq5CnfyrfnXWtTRkGkd+by7vUv1K3rNbu53AZobcXdn2C+13Wd678HSjEDyzXD9Pnq50WypFRBdItuZ4I0APSA+NXIy+9359N0OvcJBFvAH3S328pn2IZbl1Mb0pj1cS+PruV3STCLn+C6Ji336WftV8Hv2galtY98Lpmfr71MP5mOc9pHek/CTb6WuWxgRl7AXRQSVljabiFpooZFGCVsh73Uz2taWwkgDKh5pa/TQjJsq87CYl19uSyPKAKFW4BPw8OUh6sRRICd09qORTflFhqu2ZjX1CLEVjkRCYNx9Ujgyfwgxy1WTEiv/fQk52jLBbhcY04z+2tc5PvqSuyDuEwMZYfNNcKhcBVoSA4phQbM1JDfPxka7+s0E7aY3AEr5ifinNVxbxEoRoRYsLSOoEzgQ3IvXqjOd1X4ymVsskjEw48IaPOX2ElDNVMy94qltLvR/9hznWOq1yqiZb/0eZDe9/QHqPlTEfPfmfwPTu5z/mrwQQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 61b7f9c8-66d1-4a88-c5e9-08da9c823986 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 10:07:15.2411 (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: qjg7jK3izTb3BzSaik0cp5DMDx9q49GdQU4NGuMem8+jX7RZ1TgvrrI+XKLPO7VVEKdDFwudeftT0Q64B/Dyx0MLNyGLjjL4/jDjXfL/JJU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4317 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_06,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 malwarescore=0 bulkscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220067 X-Proofpoint-GUID: uJYogKkYn6j_QPkg_zOMq9IEcXq2mBL7 X-Proofpoint-ORIG-GUID: uJYogKkYn6j_QPkg_zOMq9IEcXq2mBL7 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Description from: Martin Wilck : The SCSI mid layer doesn't retry commands after DID_TIME_OUT (see scsi_noretry_cmd()). Packet loss in the fabric can cause spurious timeouts during SCSI device probing, causing device probing to fail. This has been observed in FCoE uplink failover tests, for example. This patch fixes the issue by retrying the INQUIRY up to 3 times (in practice, we never observed more than a single retry), Signed-off-by: Mike Christie --- drivers/scsi/scsi_scan.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 08eaa7ddfb97..744fb8b469db 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -669,6 +669,10 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, .allowed = 3, .result = SAM_STAT_CHECK_CONDITION, }, + { + .allowed = 3, + .result = DID_TIME_OUT << 16, + }, {}, }; From patchwork Thu Sep 22 10:06:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 608541 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 EAB9FC6FA86 for ; Thu, 22 Sep 2022 10:10:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231330AbiIVKJ7 (ORCPT ); Thu, 22 Sep 2022 06:09:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231324AbiIVKJ0 (ORCPT ); Thu, 22 Sep 2022 06:09:26 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DB8BD5765 for ; Thu, 22 Sep 2022 03:09:26 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MA4uj5018946; Thu, 22 Sep 2022 10:07: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-2022-7-12; bh=vff8kZJ3mfbyoUL5w5hdhU0XGj9rfn/7U2SDHyD2g0Q=; b=L4lFt0r0mgTXSLLyz2Js3CaH/gJSKBMfQSr4dBdrpkLCUVX5y+V547vF5qxlutjHpe1E 1NoasvnPnHkTv5d6xFBfxN5wbVOvOo2BupLOoKnW1NHa0axQgREZOJUUSWkNl5MTdiUJ hFvDOh88vTiUoC3N8gRgBwrl+AYM4DtK7VYE1/nwkBUycCg1IeX50ArWumm4oiRi7dUu 2R0GkpeYIrJgHB9aXF1kXphjn7omfi10TVTgF3caX8dMmUF490KcZrz4PAS0P02i6PHR UzTvc5FLFfdOMSQ3IKA5WRpWMHcCL3F0QjfsDnZ/vXQEj/C1iSAu/ta92np0lZKmJL+A +Q== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn6stnaj7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:19 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28M8l3kV001244; Thu, 22 Sep 2022 10:07:18 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2102.outbound.protection.outlook.com [104.47.70.102]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3jp3cb3fpd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KevBMq6sgkJIRZF7V3yoB+rIdt0i2tFr/7VlBc9rKRvQ/CvCbgKRNcXWkWsJokOY9qy3AK6S04IupLyQE8dnnRfAd7l2sd8RdS+RKiZrg+vqh4h4ylP6sKuC0GCTaV/A6eNwwwqm6B7HJKuOlorJIhKGnWaPZ+MLlTYccpOmzTSqGAZ05Pn7FR4/7TJ5hsAKto/9fpZQ8a6J8YrMe+TYDItPKW6FW4KcGRm624hb9u0FYxgh1oIz2jfOZcxFc0yVA/oy7wBbmmJLoxb7wabQm4hdtgSGipqUXUnE6tkt0jV22XLcKiaK8SsHEyjmQ9ad0H8FGxqY13G/S0CclcaPWQ== 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=vff8kZJ3mfbyoUL5w5hdhU0XGj9rfn/7U2SDHyD2g0Q=; b=gT2LqGvuK/Y0nKmLC/Z5NqzJdmPMWPSnc603BYEJy8Lq6lHvcM3JYyXvE6llLedWqbk/oE1uCYgF7L5a0AetEgxsUhSvyyPJ49LfwPulWzRqCM/W1Uye4Ss+3oZC0ahpqJHFSZaBHnEOxJJwdN4kPny42jpTCklmEHGwwrlL+RRYdNTJ0eQOw7dOMeje9IcUNigfuIHwC30dOz+TKVFlgII19BKOxuVqeomLOMfMGKdVZXw4ZlQlAPnc9jWsM/XB3tO69ktRnV5PyQh6uu5MgQQLt08srlkpUgXVl1Lg07IjvmCi6sWvGeXAW56IWkwoCgsj2heVFqjOHPz+xzOnvA== 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=vff8kZJ3mfbyoUL5w5hdhU0XGj9rfn/7U2SDHyD2g0Q=; b=bLcKm81+cTt9Rg9uXBz6Ik6aqKNJmeMSG4tuv4J7QWBV5dtxhEMkz8LE/xXrIviaYxRLEjIERp+/+Hyc11ELircSgC+O+i4vNLxFAVmCkAikY4XOf0z+s0ZNIDmPEfH0Brz1y6xGefb1AmaAwTtkVEM6DzpNbyujDgvsrb+Iqvs= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by IA1PR10MB6243.namprd10.prod.outlook.com (2603:10b6:208:3a1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.18; Thu, 22 Sep 2022 10:07:16 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1%9]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 10:07:16 +0000 From: Mike Christie To: mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH RFC 06/22] scsi: Have scsi-ml retry read_capacity_16 errors Date: Thu, 22 Sep 2022 05:06:48 -0500 Message-Id: <20220922100704.753666-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922100704.753666-1-michael.christie@oracle.com> References: <20220922100704.753666-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR05CA0028.namprd05.prod.outlook.com (2603:10b6:610::41) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|IA1PR10MB6243:EE_ X-MS-Office365-Filtering-Correlation-Id: 9a952f88-dc24-4b5a-b758-08da9c823a5f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tV2xw3T5MAdjkkMt7ehD6XFVKGPOIGEtnE6nYKJ+NP2Lnio6D0VdL9BqUctqjKGLXQZ88qI/T5duNJldnNfls0/zEml8PnVs1absYPU/GyyLAytpzkCAzBq20daIMhS31wzokXaBK4TG+c68w/e7QlZHIAuRWFGZJxxHlG4jI0j28/LCu8ZyKTSR3lCiXRH0Gii7t9KtB88U1QYeW0SFz9VwL3BFOY+aTD4r6c43yTXIferc+1JXkYkEZ97xhv8gEVAr0z+uLFbtvo6qtCEUPUJgjNTuVCjsqqEKkiT1b10d/nVnHL9iOrC1pCfaOn2EPhuv2F5EGScaTt0NAVo41LbJY+z5xhsOpqXTo+emEQ2oP6w1pwqZcGDVoiF8jMub/dZCLlwaeqkCfjQfjeBj745sY4ALHA/d8EHPsD5RP7d28sqrsHC1P7XdxYmjgQM8VOOdYxyPBW8Vu91tr3UooW/LPRR5YBHxSMbjal7sCrqgDKqUrkJsylAoybKOChE2P7/MJ1BDJTgsn7vJ2OC7GAoXzs/AoJKwFKV7WXC2eLxNHotBha3VSmYjNknfyNj4Oji8ZNPowZFeMa/DE7cfz7tcTk0dQMMZuM8Jaff5ptEQPZIvEpaiUlDHhA7vp5/7CNsAnJzgPmuAkL3vOFvoDli4UQMFbNpd3xvJAtsQpiqlayPUHpZayyKgK142ObNU50MIrXrG7p+iFLIMxG6k3g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(346002)(366004)(39860400002)(136003)(376002)(451199015)(107886003)(66476007)(38100700002)(66946007)(4326008)(41300700001)(6666004)(316002)(8676002)(66556008)(186003)(1076003)(83380400001)(8936002)(2616005)(6506007)(36756003)(6512007)(26005)(86362001)(5660300002)(2906002)(6486002)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RQVcmNUrd8K3joVEh01QRucTdlXWAjGz3StP+Lzbvh863onqEF6PosaNB9809dz55Ry0pYVZ8AZcTQO0vKjD9ReIUkVRkPsPGNYaaQNwCRIijUHR+ezqgF9uqGslGYXBs7EVo0nRUqOVNUmJKj+p3mDK8PvTsD39DlFYrp5w7zpBeG6sAHjoxV5jx0jqehYl1kkf1+/ETt9jRqlv5GCjQ58Fa4K1AuYCsqrWSmhT6hWA+nJIFPFwsjzgOFPtbmtAqpLbCLCwh6sriAtLkmqzW31/qYOnwgiKOvatEP3nAjvLAxHDcimg6+2PVskT01hSYQb47NOIHEDLyUnmVWdW7nwb9nZqIVxD0CVwzucpKszRV+5TK82CGeHmR5KJu71PLpfCPg7HpxivXpufCTJeXFE+QsIMzsJrPU7HTA+P1Lx9JcQqHEzLE33T/dcdukEGADZUtnaUn62DtA2E/GNnIO+Y4Zfv6uMpuskaOkuQPSlZBrEZ15k6nQ0gnCyHWYel54Wg6j7o356DVLN1SiFd0jyEciLKC+eJZAxgLN8AvKqHIgb8ldDpueEMtKad+YnVIw7uu65UcmJA4QJF4jxlR9WcWqFC3UbiqmIobb065pwn/LwFmhks849gEboX0jYHlM9grh8BnWX0q0GvN+B97++tkGCNrwcRFi+cfB7SLjLsnTUFvAqimiVi7wYiuT/pmEBoZ3nnL7h8SRrBsuy1LeySTunZAksxXY9wInB+KllsowHgpceetsyUeY61dH/PWkDtUPcCGPPiSgCNcoFjog5tc+TxS6oRNue6hucLv57LCffRm7orcShtOoWCRDgJBIPHPlFc5NUlUaqerA3aWNZ4skfYbMnhKQJ9TwvNE2Gu0iA9thfMRtM3CtOJg4E9I8B7e9aOmBpn6iZT3dzMqCg+mc2kWFdwgs/4dfB+G/HgCzTJ7WBkxIuBVJ+9cDjxdBEPkPN4nWwCfsQA7PdOT9TAXW/LZdGvoWRpJ9Hvi/jn6Lk26GervnxOtwmKQVi2bZN34lSiP4y+7ENwA2IHWHSwMcVRsbs4Y2ybdaQIIP4ZdNPvOAbbexV+qJPzYgU6V4Yk6LHZDSi2M/3wvYQkuIyiYa/V9N5XFMUYS+DsoxhGjVWGquCoY5rXqifhkDQl+gjxXNXq/nwl8PveRFCCrBdhCgRdimSpUqinfAotWjWAuKROKC+lTi/ivIfWB2rAlZLXAO+OCKHcTb5jUrMLKwLi7pWMFVMSfZCg4H+ZE5kSDcC0hbr7rwCJmlnBmwdHXlWE7dZo9910Yz95tEDPH1142FFkDa5iIl6UBkPQsHTuln1Ko7m1RzfZhGzpL2x3afHoBwWO0xZ0Y29Ls+73uuXoICjPH2lu2HGqjvijA6/we5vzLD1xjJwlufcrvUO4MNYkaQukQVdb4FjlEeZNRw/DMH6+gApsE8s+bXLN+s73PgTKwykhGc6hjMDagsZmxJxRnzpLdtU64F44N7kIOnhAbrhk38NVKlhnzNOgYqw+BuY+lPVughSoeiOURV9dPmBSBa0Yg5FPJDmMSz3UuMV11LtW515i6PpkqaQgVK+4/CIu7TYvVIkm07SRf9I/upo3rlTBA70pKFXUkg2xdQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a952f88-dc24-4b5a-b758-08da9c823a5f X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 10:07:16.6629 (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: 9V+UADoFr394MtiFXZFX1xhkUhJIII8v+55kJZJpCVkdMwBv08ewcAUp4smHEe6IXbbF+CEstTlWsSqhxEr86xaL3zB9HTQXkc0qRIiGey4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB6243 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_06,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220067 X-Proofpoint-GUID: YXi2FQRcAwwigFww_BX1biTpvnTZftx4 X-Proofpoint-ORIG-GUID: YXi2FQRcAwwigFww_BX1biTpvnTZftx4 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has read_capacity_16 have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie --- drivers/scsi/sd.c | 70 ++++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index c215da95fb8f..46383b680893 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2259,50 +2259,52 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, 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[] = { + { + .sense = UNIT_ATTENTION, + .asc = 0x29, + .ascq = 0, + /* Device reset might occur several times */ + .allowed = READ_CAPACITY_RETRIES_ON_RESET, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .result = SCMD_FAILURE_ANY, + .allowed = 3, + }, + {}, + }; if (sdp->no_read_capacity_16) return -EINVAL; - do { - memset(cmd, 0, 16); - cmd[0] = SERVICE_ACTION_IN_16; - cmd[1] = SAI_READ_CAPACITY_16; - cmd[13] = RC16_LEN; - memset(buffer, 0, RC16_LEN); - - the_result = scsi_execute_req(sdp, cmd, DMA_FROM_DEVICE, - buffer, RC16_LEN, &sshdr, - SD_TIMEOUT, sdkp->max_retries, NULL, - NULL); + 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); - if (media_not_present(sdkp, &sshdr)) - return -ENODEV; + the_result = scsi_execute_req(sdp, cmd, DMA_FROM_DEVICE, buffer, + RC16_LEN, &sshdr, SD_TIMEOUT, + sdkp->max_retries, NULL, failures); - if (the_result > 0) { - sense_valid = scsi_sense_valid(&sshdr); - if (sense_valid && - sshdr.sense_key == ILLEGAL_REQUEST && - (sshdr.asc == 0x20 || sshdr.asc == 0x24) && - sshdr.ascq == 0x00) - /* Invalid Command Operation Code or - * Invalid Field in CDB, just retry - * silently with RC10 */ - return -EINVAL; - if (sense_valid && - sshdr.sense_key == UNIT_ATTENTION && - sshdr.asc == 0x29 && sshdr.ascq == 0x00) - /* Device reset might occur several times, - * give it one more chance */ - if (--reset_retries > 0) - continue; - } - retries--; + if (media_not_present(sdkp, &sshdr)) + return -ENODEV; - } while (the_result && retries); + if (the_result > 0) { + sense_valid = scsi_sense_valid(&sshdr); + if (sense_valid && sshdr.sense_key == ILLEGAL_REQUEST && + (sshdr.asc == 0x20 || sshdr.asc == 0x24) && + sshdr.ascq == 0x00) + /* + * Invalid Command Operation Code or Invalid Field in + * CDB, just retry silently with RC10 + */ + return -EINVAL; + } if (the_result) { sd_print_result(sdkp, "Read Capacity(16) failed", the_result); From patchwork Thu Sep 22 10:06:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 608549 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 97B6AC6FA8B for ; Thu, 22 Sep 2022 10:07:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231255AbiIVKHl (ORCPT ); Thu, 22 Sep 2022 06:07:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231225AbiIVKHd (ORCPT ); Thu, 22 Sep 2022 06:07:33 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BF42D4A81 for ; Thu, 22 Sep 2022 03:07:26 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MA3rUT018189; Thu, 22 Sep 2022 10:07:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=8NZvvA2BuU/7boMXFHyMHA+2lHqR53gLmM3lGvh0A+U=; b=LTb/037CztsyiP1wnApBhOn7kF9jUJFmWty1Cfl/+YM2x9Uk9GTyLMCEmNGV5StYStkp G1bJmvXR9/puY+tU8+jRtJ7ceTsZpRTTlniox9NvqOWHwamu0kSRbKm2EAn86bZoMd2v vo3GpgJffpseqnvLKsd/3Nj6peTJz5w3GofCjMIkQCJH3ImpiSjg9n9FkufeMQSl7eMM JjkYjQT6Gce0Wyo3zulzbwZd2KaKx1ynTNOasDaAPXW6I+P2eBw/BfHTO19qdSDHHBHf lm8ZxF0BPpbyOX+BWqEUuHh4DRF56T90kTj01UAQSfBMx24MYWa/zzk6G7rpcMSyvA3o 2A== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn69kw1rb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:20 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28M8l4nt028231; Thu, 22 Sep 2022 10:07:19 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2109.outbound.protection.outlook.com [104.47.70.109]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3jp3cqdxrf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q8/6+ICP3ByDpLdxB5Co/cbJMtHuTl4Fj/CV3sZs3YFbY50eUoj+iiZjJpoHa9Dc2nzNklqHskJu3TLD1KCUTFUNLLpD8SwewRC34Nc9Rh6fU+T8WXmRSMR5bQ2TkaQGCj1oW0dxS6tRdUd0MuPbRKxPXSEiB6jSGTMghJHE3trS46AgFkyA4Q34SLsK5nniOmUjaPFVPAP2/yIvSXtrBL8x5uoIKwMaOLTurH6Fc0E24Q+DDgflVK01ulG04zZXIyYo5wWaZ0/EtuCEzd2ly8jzAeHQE2W78VlFzpitrPu13y+5LMMqCTsI2C2oFCPhb76N96xyMGuW2cQoTP76tA== 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=8NZvvA2BuU/7boMXFHyMHA+2lHqR53gLmM3lGvh0A+U=; b=EAeH+/aVetcc6H8+DpCH5PzAn6rykZxfcjndGTekheMBtKMuTERUoGCmU5dNPoYfkprR7iyPYgIprso2D/rZzxcqeHmXXPhO5HzemPX7/uYod7199fl3FzK6ukmEfxnKCC9t9zB+ryiJaQj7+XAEm138DrcKkliENT6rUoKNdQcmR7er1prs1+q01nAW2YjB4ZC8X1bv0tDhc/EBx4EfC186sFN0Wv9iaIiciJYokPRFZBpZPDssn60YKW5jIpFlFi9wXry8EA0euDgMbwrbugtSWg8NDeEJ7cMtDZyBcUh/l92AUvQb7I2Ntjdzkufd94UhJ5XDiorqOVcBsHertQ== 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=8NZvvA2BuU/7boMXFHyMHA+2lHqR53gLmM3lGvh0A+U=; b=HDOWqIaLF0xIXJLJ5JI1iZb5fG+MMPIJfG/IkuI1lZK0PUqDcJQLlssnUdPd2QeaHfd0CvKqeCGh2mjHrizVOqd/RjKEx2ibwfyxI/KKyhT+9oD4nx5xlTLWpePSOa34RA857Wl1Pw6q5DMmHdg2Eh891rlsIDfqwXxqYveLQpo= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by IA1PR10MB6243.namprd10.prod.outlook.com (2603:10b6:208:3a1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.18; Thu, 22 Sep 2022 10:07:18 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1%9]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 10:07:18 +0000 From: Mike Christie To: mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH RFC 07/22] scsi: Have scsi-ml retry sd_spinup_disk errors Date: Thu, 22 Sep 2022 05:06:49 -0500 Message-Id: <20220922100704.753666-8-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922100704.753666-1-michael.christie@oracle.com> References: <20220922100704.753666-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0P223CA0008.NAMP223.PROD.OUTLOOK.COM (2603:10b6:610:116::19) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|IA1PR10MB6243:EE_ X-MS-Office365-Filtering-Correlation-Id: e89bb414-df21-429f-f477-08da9c823b65 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iJbPAQvFlujr4MrEr1OgqMdi7bzhdh8XW3NFQ0OXnhkGEf3rDp37zDbonwkCLnnmr/theV23dCV9zFpfmM8oMCfIX3plMY01kcuQIxJ4GZ+I7LaHqyIoVxz7Atx/uSMxRCXjL1sROw0bydZQl8yg9rYCg/+5s6ENDwtjA4lSlvWrBD9fh5PcBR0u56nebn0PvCdONjyHJC9NdAXIG1rxORg+NT1gd+yvKy8H0MlapJP0vLEnNA72N97FokXWZ1rfZ21/+0PtVbHHdXbE2WeHFOurEdAWFOiJO4Gh7WAJI2GTeLtPMqOZ9G2h1LMgwrggG3pm1Xjqs22rPV4nsstmjKwVFeI15kq6KtwQtHvaJfMrNh+UfnxCrclMNBG/Qqh3bl/bz4zxvLd0V5lfMxFilH8Hgh4fdbdYt2gF3WNBEMdzivcM7f0l8oxvUSDWkTc+vFkjsVLDmdUIiozB7R+PlfuM1eHwzk3u4/rdfkZIeTOn9cW37GbsOemDnnuDwJ+YSlJ+BsGIKzDzVGUCmF5KDFoJQepPnNrbrZ+/DTxjR3JK0z2yuUN7U5eS6SD8XBpnjem7XjSAuztY0Wbzks3IQlEXgALDsAXud+aQMt95WlO3lPmMrjcLHdwdaxuPlmf1xYwL6oSTKjeem2AYjsEbenJiw5NJZWj1qSEaFwF9EvHfu5y4R4+jnwTVLSsi4GIqqnKhgiik7lOCQsxxNq/v1g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(346002)(366004)(39860400002)(136003)(376002)(451199015)(107886003)(66476007)(38100700002)(66946007)(4326008)(41300700001)(6666004)(316002)(8676002)(66556008)(186003)(1076003)(83380400001)(8936002)(2616005)(6506007)(36756003)(6512007)(26005)(86362001)(5660300002)(2906002)(6486002)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HAz+bNmQkR0PydvadMZX5vB+ReOEAUCX9+g3CKKbMxta9LVrmRJMoVZJOukiQ/SI8elpB8HAmsRgOTzM/IcboS0hntl/Jjk7sCCWFDCwm0lXlzCl+pYeF+06ymU/8x03JSunGWFB9H62F0sVdckgDRNCJdCMT6HELIwYnmuEyt9/vtSC3SV+XHyPcTKNUj1tjGwLc83ANQd/9NLfyYvlY8Vd2l2aIr5+ZxT0k6dz6uatU5ay1cmzMf63oq1/bOf8OkcJ5KUxuLCkf70HCJWxA2F9Ba1M5sUIfD/9/S2tITLRRB+UpaB0JVw7xrADH/xNRU83OO077saBBRI7bqmyVWVfLMyU5rLuPCRuRxO1DLHeYQStwwyZft+oag6QPVWGgB435sWlnlJSRHI6jRMPy9xyAe8Hj1bHcyqcDCrZstGzqEcTS86x/nJMq2gPMDlm9CYZsN4GLZ2K5fBdgyXEoLv5r6jfDXuEGtLgh7qTicXAJR147UkJviNUhmueYehSVMRpSdaMoora5MDo02HpSHaQXPCskdZ+0FDSsV7nLM/81+EfxGPAnQ5uJ13GIAkEVrq04C6UD2YW6d3D3uDm3X//PKOjACdjYomesPvJ0/oSATEPhtqsL7gg5bhFIoKqv1xtZcmPn4Vud8IjSr/3a/ov2WUZPN8vrSQFft2DFmXrGN4v/tnBqAAb9ry4hBFQUAW5zaPrVFMyfstKvozWz/4X1Mdkr7rZjIUcs6x64iK+hDtgrVHpjgxZuJnmTFR//p5S5RSmj9MaA0e7UlEHKAXZsLEpgUADweMc6DsEzDRUfleIBjRELDjZINCPWOtUlJWUJJPsiwoMeLiv1yL8K3iDuyKlMrtAPHZRhYD7hpVU3zgT0EErBZi6KhEcpuyrxglyDJj0AMryjocyYR0UYVAewDLFmD/49W5pRjH5lqTCNzmouM6osH3WAla/Ltv/AvHi/OeR8hRA7x+dPbmewGM7Tc3obh4reELkAjpvEkgl82siLjDzbONvFrUhD4vXhW1Y7AKoaFQFWBwon0oSXYXg9QoG955zdYwmz61vdgeo6ZZnCLUgcZ3U0fy6antRdW3ZxIggTDAjoc4RlZ6ge7f7I0e/053Hj/L9rOuMWVHJoqUdR3+CPN2F/ksIvuWzrHr4I9aglSgMoWoA48GLWUqOWLDnad7jXAfoWQb4eF5Bot32Vql/HWtaBhhYXi5EfjYK6C5oLm32DXm1SL9lKi7f8YPcAcCqa/JK/mXWVlqucgndhveNY5OTxn56Uh7zrpWZCmioSIA7Hssd6ZZoXlRE3RCZXqdBPYykuHaI8mB2Rrfisnyf/yljwO5eIMVNQ1Q0Ic2ZnKwnDlu7WXxU71SpAcz3z39pjU8Fmiy7oSVMkgTBbavRhXAzvNigZeBFi/ZUWv2P/X9E7xW8cm95Lg+7z7xKpYN6Y2FDXxqRDltvRFQRXfU9HG9s4UqFLGWGcDhkP8q7L1uJTaPhzDHGi8clufb/vy0G2vjvYzWCf5Rcqf45MnidYoR26HuqKGxPnuX3KHvPgO1dyzulN9T+nIcTGhhcMkVkaA529FAJOpoEYhO3QB9jn6kMnc6tn8QeyDK/Vh1v9UJFJ4vGNaGEWQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e89bb414-df21-429f-f477-08da9c823b65 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 10:07:18.4127 (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: ebFWcBi5td6UPtMjrEi1JOWV3WU/5m5RKZ0+pCFnQiFAEgqlv/7IViTA35n411dNWBEtLNknWx0yg67frxE3eCtlXqH6czcwhABZpM6Q8Cc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB6243 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_06,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 spamscore=0 adultscore=0 mlxscore=0 malwarescore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220067 X-Proofpoint-ORIG-GUID: sNL4_tPAUbnVNImp2HJl30DmsDSR3p8u X-Proofpoint-GUID: sNL4_tPAUbnVNImp2HJl30DmsDSR3p8u Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This simplifies sd_spinup_disk so scsi-ml retries UAs. It doesn't convert the errors we will do a msleep for since scsi-ml does not yet handle that. Signed-off-by: Mike Christie --- drivers/scsi/sd.c | 58 +++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 46383b680893..b76e0b1900a0 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2045,48 +2045,48 @@ sd_spinup_disk(struct scsi_disk *sdkp) { unsigned char cmd[10]; unsigned long spintime_expire = 0; - int retries, spintime; + int spintime; unsigned int the_result; struct scsi_sense_hdr sshdr; int sense_valid = 0; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 3, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; 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); + cmd[0] = TEST_UNIT_READY; + memset((void *) &cmd[1], 0, 9); - the_result = scsi_execute_req(sdkp->device, cmd, - DMA_NONE, NULL, 0, - &sshdr, SD_TIMEOUT, - sdkp->max_retries, NULL, - NULL); + the_result = scsi_execute_req(sdkp->device, cmd, DMA_NONE, NULL, + 0, &sshdr, SD_TIMEOUT, + sdkp->max_retries, NULL, + failures); - /* - * If the drive has indicated to us that it - * doesn't have any media in it, don't bother - * with any more polling. - */ - if (media_not_present(sdkp, &sshdr)) { - if (media_was_present) - sd_printk(KERN_NOTICE, sdkp, "Media removed, stopped polling\n"); - return; - } + /* + * If the drive has indicated to us that it doesn't have any + * media in it, don't bother with any more polling. + */ + if (media_not_present(sdkp, &sshdr)) { + if (media_was_present) + sd_printk(KERN_NOTICE, sdkp, "Media removed, stopped polling\n"); + return; + } - if (the_result) - sense_valid = scsi_sense_valid(&sshdr); - retries++; - } while (retries < 3 && - (!scsi_status_is_good(the_result) || - (scsi_status_is_check_condition(the_result) && - sense_valid && sshdr.sense_key == UNIT_ATTENTION))); + if (the_result) + sense_valid = scsi_sense_valid(&sshdr); if (!scsi_status_is_check_condition(the_result)) { /* no sense, TUR either succeeded or failed From patchwork Thu Sep 22 10:06:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 608548 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 A87DDC6FA8B for ; Thu, 22 Sep 2022 10:07:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231319AbiIVKH4 (ORCPT ); Thu, 22 Sep 2022 06:07:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231284AbiIVKHf (ORCPT ); Thu, 22 Sep 2022 06:07:35 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F4182D5759 for ; Thu, 22 Sep 2022 03:07:32 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MA40fc009734; Thu, 22 Sep 2022 10:07: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-2022-7-12; bh=xP7YpwjuYKhp48rG4vVdS1mG9aFQPipMGXTLYzeIBrg=; b=F1xhuhgkjpP6lihW6LBg2LDz3uypD7HlLC+HjxIOQN9wVxulp0I/kMU3wJW7vKhyQgRB 07BSBrwwmo+fhvjdExfxazB0JkczfjwM5SUxReJNA68lC/T3EFmIKkLG1ntwj6ZIUq0+ hIkJbSCz20EInxhEhvWUFDY+5DssiTWR3s65u5lOeg+cTe9qfNOd9iP06Dg8x9zt/5Sm M3WFodYd7RFVpCsDsckkYoZqWL8X9i7Ck/J+orITX9yE0rLc0ra41RBvmr6HZjkUZHzk 9zqa9PdgVXk/UvaaHI2MfellYBadldpfhcE5bplUHRJDqqEXFZ/e4DsAn2ZcoHxF8Bdg BQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn688mgp3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:24 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28M8l36W001239; Thu, 22 Sep 2022 10:07:23 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2106.outbound.protection.outlook.com [104.47.70.106]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3jp3cb3frc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ctm6lEhTQWSo6JkaFGhVbOH3txrNeWfapcPt2oVtbjVx0lkUYVGi5WwJ6NisyRp41bhE5u3Uq/dJ22HuHDm62etn4ekQM68QxJ+fvjFZDZleqH4AMAqTkERpU0Kl9nYCkcjPRN3Y4qpxEdm1e0ANJ5zXW4rZCJF8EyLqgpM0i6Tea1zi6s/s7QSw8RcXKxb6OQjF5j51nYqQlviGiAxComRHrX9IT7F69h6vCSW+BTVD32geeQsHYEdIlzrl2VtZKfYmRfQAlV0VyewVopO2T/t3sFW+hbLEDs3L4bQ4oyl5E3ghyFY1fP+VH1+ul2LUUjITR4vR43Nio+fxH7U0wA== 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=xP7YpwjuYKhp48rG4vVdS1mG9aFQPipMGXTLYzeIBrg=; b=hPW+ySYHcFQA4P3wgfy3QMJV/axN5YlCC78SWFChKwDcmPKKZGOz2SIu0gTJA6IN6GWg72eUv1/VG8W/AGSAxgU1uFgtdVEyxhFP+46bTz2zwPep+46QpjZJOV8xn83nSXukDOsWBJbqbldT1l0OIwtVrhy2tm+i6vqYqGUjXLE13TekKfs2xDpp0FpfmMzkJWTY4P5jeoZ/iiR4Wg4Vn4gsjg1LvkDysT9oz1PYpqwYk+/pHL25GguiicN+acB2y+iwhCNBqk7iVGM5EBr73SOowH2urVCPxhJ43yMlemlyQgmaDbQrKk8wCjuxPNBVpPdpnb+ewtOArlv4HFgEtA== 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=xP7YpwjuYKhp48rG4vVdS1mG9aFQPipMGXTLYzeIBrg=; b=F78rGpyJO+KD6Ht/R4rY0039NFh0nkNKsWdGYxkEfe31CiU/X7FVAz3dQCqsa1ojB7TbZpFGbJHyizqteghPni5UsFUl0Rm2kH9crHo+mEdnpsJ4ApJFyC+Pn4fwfuHmw2qIQY3eeBO/lWeGQJwHiJ7Ugd+Q+4CYNKQkx/upniw= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by IA1PR10MB6243.namprd10.prod.outlook.com (2603:10b6:208:3a1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.18; Thu, 22 Sep 2022 10:07:20 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1%9]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 10:07:20 +0000 From: Mike Christie To: mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH RFC 08/22] scsi: cxlflash: Have scsi-ml retry read_cap16 errors Date: Thu, 22 Sep 2022 05:06:50 -0500 Message-Id: <20220922100704.753666-9-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922100704.753666-1-michael.christie@oracle.com> References: <20220922100704.753666-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR15CA0001.namprd15.prod.outlook.com (2603:10b6:610:51::11) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|IA1PR10MB6243:EE_ X-MS-Office365-Filtering-Correlation-Id: 9dfdcd0a-3efa-4a28-f634-08da9c823c70 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0iSL9Qq0AwDd+GldEevdkOGs1/mh8RzzR3bs9rHEgYH0RafvOPi/p0HNm8XqbvtnzI5JMui9iUh9C9DfI4LH6VHo4Ykqg0mi5mEWFMvvLUWD1UuvDXPbLSSI+b+TKJR74IP6qiPIDZjB4usxI5IsrfjD2Xr21rdp/yn3qdza7LMmxB3LiU+t4pN/3fcrA0Mu2VSvOV+J8Yy0Y6NTXag7BJnyYoMQZ94ITtAs5LcMqRxPH9/FEM7SV5toTlkvFbP4VqT6s2ROcJMjGiC5iXi1zQSAKyTHcdIXWV/WHalAzKK4U6pDVDUfQCd+FEOHxH0kCep9KH8C642Up8gSrNIiD4FfWwttnUGv1aoJRA0f4Y8Uw4klT5w3iXj3jCcpGYqbuaFyboU6QuA6v0E0XURpv89+63/xn5q8RnKqLBLJkC/6ysEmZULYeAgBOK2G5b3JchH4m5xDHra9pAxFnhVjXdlHS0KSgQTizhCE/cKGG/mMhvs9GmluSk1rD/S07w5Uetifybk8329i4F7hW49VPr8Zh4101PG/a6ST98qnQRTRFrHMKX9Un7zkzd8i9jNTX3+yh/baMkGnKgC8RKhVcmX/o9NRBh/kqtvS6om60TwHiJ7BFIHS6Z6Dzy/v2wCjBPhuB8uGIJQgYLUk4wCzoAzGcLhtzaG2TpSJknwXO/Fs1QWNmVVe+Y41K9WlGLHiLt2nzMn/FIfDXWmZ/b+F8Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(346002)(366004)(39860400002)(136003)(376002)(451199015)(107886003)(66476007)(38100700002)(66946007)(4326008)(41300700001)(6666004)(316002)(8676002)(66556008)(186003)(1076003)(83380400001)(8936002)(2616005)(6506007)(36756003)(6512007)(26005)(86362001)(5660300002)(2906002)(6486002)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BRSPpA24aBg6Z/LXXO2z35A2wFk6PxZpPma2TyPfNJY8Yfh2VTRGy70SovIQ3qpxvFDwqbhXfQS282Lv/xSrIRiOdJG1R8HFZmQBoPzjvWh8+Y1SSdasdk9CO7g+gbUHbGG0E8MRgCS3te5Afq2/5910pNWCR0PCa4L0EuSDWsyafhX9M28fgwPidt5oevGQsEYwj+fgeb9SgZgKAb8zqLBxP9pPDJ6r6IHeASLTYOdlr72tbYHcrPAYxJ3XvCL5g2kbQqp9uBanxbOVZdBzVNjwNGFrQHMFegP2bo+eoZbGRH2vbYxPQGHR+Aiq7pKopXmI0J1bwQn4aOA4TvfL2uk3HEgf34Y5u/gIBFhRbFq3CMGT97acDBndfmDULeg6ISA6k17xSvx0XVRUan9MIDf5zIP3QSXd5JwX9PWKnNWZGb/AgBfkBqVI3/XGiU2krozXJ0dDxCxcDH6p5QpnGgtHPdUepXfjzvDc0VxyUK/iO34DJVzjTpQhSTLIuEf6hA6DkXOPY8RyO5aLmPWs8subsBzLtKZA1s0SL8Kn3+twkCVpiWbncLB2bVXU6UWdQfArrsfD5wCj3Fmswf7O7IbaCw/BHcvYqs/oYR7DS+RbQtwvtzE8vhCygkbymhC3WO/qOqZjkDQBQ8V0JUF4VwNWBDYF4pcTupgVqsynlJ9R9mFKlY3+V+BjzhzZDlZwXWv3CZUVXxj3d9eadP+qCpYE80KyAmFEbmp4+ZfdXJ/eAckjgX7gfPa7Q/qQBLvVRrPuZ4C/1HmKr4AZ/XGYDDLRZO0ABZjSb71RJM5B57kGhLGaWmmw5HIIQZo6sQOK36Q28a9DPj3Aq0iFpP7XEDG2hugquYoJCXkh4x7HySUTpIk7eKjCIgWRTYs7O+aPMRhTTC5lEh3kF88eqRxbzm9nQHa5wvPZmPPzMsnP3lKrL+yEMX0JRKMwMe50XseQ0xDYoMRoQBrCobwHkKvSkv4kFnPuanJBHHhdyt7zFM4tdFS6UOplZbUcl8hvwrfoJxhbSDXsa2/HoJ7EYYU3ME+iXrC0R00q3KVqXLdD2qubOVieqcg/sEdM9Rxn8Am4tbc09pglLMjeDO6kUcx5eN8rNm2jd7rJRrLBtf6og2/JPK4QysUKVZi/xFdRzXfXzEfyUtfqNiWxx5Jw1DDUTNSDLdPJYhgeXyBeHX8LAnpL4yxNExIM4tUjBduj4iTHXCrknqfMXAwWO6XYgMCCgtXEUNhJ17V3rEW5F6lvpgZrmKPLgO8T10wA//HGT8lVDD0oAKvFPXkzF8CwNePTeVffMc3sHLK/M+niI8GS4gObU9Ms4kFVN87KqysTwk1/cN0R7QBYAFcRi9TTKY+sjO30vu1qDk03cLuN4DPiamPG3D/keyCYZ5sCkMPVb8vKJ5gnPcBaiakVSK8u8H/u+sy30YfsovcoCl8aeIBFj+QKlwLxnJTI4VjQBZLhfY9v7fm6tuQ48pb5NEAvrE15IRzfTvzG2RceJFSnVliquN89U7yFgPpwLrqJCYnhXM1nK6LWd9v4yp9N/RyG8QNM92jwiqLKcOXSuFEvT+XzTjYD8/dzwgz2zdJOCcX25dlxjBW+qacmRhcM3Wb+065ulw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9dfdcd0a-3efa-4a28-f634-08da9c823c70 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 10:07:20.1157 (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: LcphL7VY60g4TKMncmbD9nCYiRwC/iL/n0RNU2oEt+ZE1p5HYz7SLAKZ+BvTBTxHGKPQRch7X7eniDnav6XVRm3ISVHLbUSrgzsmpOi/Mjs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB6243 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_06,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220067 X-Proofpoint-GUID: POEc-tk92GLrKFy7_wCu0kbrO3_vSyLu X-Proofpoint-ORIG-GUID: POEc-tk92GLrKFy7_wCu0kbrO3_vSyLu Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has read_cap16 have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie --- drivers/scsi/cxlflash/superpipe.c | 45 ++++++++++++++++++------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/cxlflash/superpipe.c b/drivers/scsi/cxlflash/superpipe.c index cc1a63986bff..ddb9a8f29141 100644 --- a/drivers/scsi/cxlflash/superpipe.c +++ b/drivers/scsi/cxlflash/superpipe.c @@ -337,10 +337,32 @@ static int read_cap16(struct scsi_device *sdev, struct llun_info *lli) u8 *scsi_cmd = NULL; int rc = 0; int result = 0; - int retry_cnt = 0; u32 to = CMD_TIMEOUT * HZ; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = 0x29, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 1, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = UNIT_ATTENTION, + .asc = 0x2A, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 1, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = UNIT_ATTENTION, + .asc = 0x3F, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 1, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; -retry: cmd_buf = kzalloc(CMD_BUFSIZE, GFP_KERNEL); scsi_cmd = kzalloc(MAX_COMMAND_SIZE, GFP_KERNEL); if (unlikely(!cmd_buf || !scsi_cmd)) { @@ -352,14 +374,13 @@ static int read_cap16(struct scsi_device *sdev, struct llun_info *lli) scsi_cmd[1] = SAI_READ_CAPACITY_16; /* service action */ put_unaligned_be32(CMD_BUFSIZE, &scsi_cmd[10]); - dev_dbg(dev, "%s: %ssending cmd(%02x)\n", __func__, - retry_cnt ? "re" : "", scsi_cmd[0]); + dev_dbg(dev, "%s: sending cmd(%02x)\n", __func__, scsi_cmd[0]); /* Drop the ioctl read semahpore across lengthy call */ up_read(&cfg->ioctl_rwsem); result = scsi_execute(sdev, scsi_cmd, DMA_FROM_DEVICE, cmd_buf, CMD_BUFSIZE, NULL, &sshdr, to, CMD_RETRIES, - 0, 0, NULL, NULL); + 0, 0, NULL, failures); down_read(&cfg->ioctl_rwsem); rc = check_state(cfg); if (rc) { @@ -377,20 +398,6 @@ static int read_cap16(struct scsi_device *sdev, struct llun_info *lli) case NOT_READY: result &= ~SAM_STAT_CHECK_CONDITION; break; - case UNIT_ATTENTION: - switch (sshdr.asc) { - case 0x29: /* Power on Reset or Device Reset */ - fallthrough; - case 0x2A: /* Device capacity changed */ - case 0x3F: /* Report LUNs changed */ - /* Retry the command once more */ - if (retry_cnt++ < 1) { - kfree(cmd_buf); - kfree(scsi_cmd); - goto retry; - } - } - break; default: break; } From patchwork Thu Sep 22 10:06:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 609102 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 8120FC6FA82 for ; Thu, 22 Sep 2022 10:07:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231312AbiIVKHy (ORCPT ); Thu, 22 Sep 2022 06:07:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231279AbiIVKHf (ORCPT ); Thu, 22 Sep 2022 06:07:35 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D4EDD5762 for ; Thu, 22 Sep 2022 03:07:32 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MA3saq006440; Thu, 22 Sep 2022 10:07:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=6aZEL8wZHhLAsrXO68Ck/3k99YVtiwJpLZpgj+Q/qZ8=; b=mgceesFiZoE9tZbCuxGTbzxOGt3TbrpYJ3KED5xXx4uRt7xaZeD6vdYxnNr2bA7RSgPK alhm8nIYWTamFuQaD1WeQ0xPY+y9amuNXM389Jfm13r79ixrFu+yRlAF8AVLI7dr+wzs JehYM6b+HeCMwp+dKCEaPlyNOpNnGzJtBhGNk0/4YzbTxvv83xCYmObNFbrmzMHV52Vw 0MEo/YcjDL82QLkF/fdKZjWl7H2298reKVp9ZFYyHnOlwQgQQzHNLaxhXyqy1lHYkPn0 XDg/pg+N5eyMK95VN3zT8OuJq83hHpeMrPLvLwkEwX7HLSejbEWktXmhNLAn6tRaYrdn OQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn68md27p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:24 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28M8l36X001239; Thu, 22 Sep 2022 10:07:23 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2106.outbound.protection.outlook.com [104.47.70.106]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3jp3cb3frc-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SHJxKJ9dBADUpZO6qD6+Yo4RaFfBxVJzzJogKv8uU9c764XqoOfxZeQog6RIErCzlwpQaZRMd/r8WlRqim/dU8MH9fapUbN3CdSE0QygNKjTWdZ2tkuh8Mg8JK2og0BP5WEmCDmgqBqjYkh5fUBR9i6Q36iyLbWnVF13w4eGhsWsYvIvimkhJqTTVJnXnZ4S1s2mSaLIFM/ShCpy2wo4/f1w9QWw4p35mZNYNCgjKbkzdyZWegQNyy+wUL5L9svbNymT8GSi2V0DQ6XQ0fp+7s5krEIzFuTfoJU3e1Bk2+YWOKkCgrQrt17t0emf8BM0dAcCdBjZMU6ifSXfAygxVA== 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=6aZEL8wZHhLAsrXO68Ck/3k99YVtiwJpLZpgj+Q/qZ8=; b=M9lR8sVi7swLC+03YsZiVB/+Z4dkKvQ5uE86lIwjM9DcAjAPp3u2GXpuemTw2k4b0BcMHzF+lOyauJv0J/h4vhhVQJlWeujRpRw0FAKnOkpfcoc7gOQE1IIZmU/hwhy94e6MT972QfQMaOnm+DY6SDDZoY523g9wrAEbo0cbZ0D084cNd9gUnnCRdgXVfNLCx9A40m9Uyzh+LpMM4kA+cxrBNzBtX2dnfH4f6G2QnRvESECzvv4br4LpLZ+S9KE+WU3GWXS9+dRVqBFMn3/xBhXb6aLZ83xhI9+bkvzZDeoQo1Xz4TCTEI7K9xhg4J0MhhhZQLtq5D3zVX6a/54fKg== 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=6aZEL8wZHhLAsrXO68Ck/3k99YVtiwJpLZpgj+Q/qZ8=; b=kA0zjFMy5sNfuS6a2t2Kqetnvrxg7/Fzuwex7LXiW/GgYhqG1AZr5SueciK6iggpYf/PGJOzU1rL/WMoFaxKYqNX1TurtkNcsa8oI8bX47ZrJZ106rS8VaFwP8OmURLKlaC23gEtxY6mOHNbw7iXW9h4TVT8bRa4gbLZpIPS9g4= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by IA1PR10MB6243.namprd10.prod.outlook.com (2603:10b6:208:3a1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.18; Thu, 22 Sep 2022 10:07:21 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1%9]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 10:07:21 +0000 From: Mike Christie To: mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH RFC 09/22] scsi: hp_sw: Have scsi-ml retry hp_sw_start_stop errors Date: Thu, 22 Sep 2022 05:06:51 -0500 Message-Id: <20220922100704.753666-10-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922100704.753666-1-michael.christie@oracle.com> References: <20220922100704.753666-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR20CA0022.namprd20.prod.outlook.com (2603:10b6:610:58::32) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|IA1PR10MB6243:EE_ X-MS-Office365-Filtering-Correlation-Id: c09c4b15-626d-4ef1-99d1-08da9c823d3b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Qli6miKdVzjjWqjyqP87Bdwqwt0fh8TjVp+BgWIB4u/PMHNC8KCWA8t8j7v4wsWOJ7M7B3GczrT5t1sru3h7T4mvfkoAD5GSzeM/YPLUZLAeu7gdbUCKyu5hpEjvLa6WziH8p6GVM01YTaurbUQi7paVbmbtt2mvEcO2bQuW0E33cU9BZHpDs1Ure9ElUwQllBXmmszmImEOoFVt0I63lHxFHRsGOA44amckehMXdwYNFRJQGnjUDud5pvGk8pbzW4f0R+nLr8F6cp5WtQjxxWEk7R3q6D1TQct0r7LzdvCJapo3CTbWV+hXqQy9pSGYqPz3bW63LdtRDuf5LyzWuYF7oRfOmnie/8Jmj1BDVjbci4AwZPuF9YqoI+luIzO/YtT2gCsnMMdWC6uMJnZ7dCFcqHvVCGZVw43M+JC3XzgydqzyrOcgQwagO1LsRY5YgXereAPs12S5YDFrRKbprvnD9ivDcx5aXAelGhqDDg04xMZ9wCgTpoc3R0mra824RuKdjb9iekL1zqoKCaLVmbew0R7Ef6KaNxpMeuXWWRm1XcyASm9DvjT4Cncokf1v14Ott+ePRbdVJKX/w1MfIHbJlIrq3W8ffNzw+G6j1bK97xYZSUR2O5XAchpLDUfUWOEPXQjD7AJ9XFVsgpeJsJuLdXaKYzxNoGDuwhj7plDxZL2L9sHZyg21XqMMOiMpwhbvGmg1oKFA6u8zN8Pdvw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(346002)(366004)(39860400002)(136003)(376002)(451199015)(107886003)(66476007)(38100700002)(66946007)(4326008)(41300700001)(6666004)(316002)(8676002)(66556008)(186003)(1076003)(83380400001)(8936002)(2616005)(6506007)(36756003)(6512007)(26005)(86362001)(5660300002)(2906002)(6486002)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Vkw+pLS5TFaLETjw0FMZCT9Pki1ke6Eqzq+4t83UfoEqSwQrqCDyb7RIMc4a9/99CmELBIfwUTAGkYU0R2ren6hir5wb6uDXGVHmeqGXOe3LyuQlm48EcmIQ9uwjg8XT5uSYrheyVxlwhCrd33Ie0BOiqVvpk+i/wiNpiQj7izEZNeWPCGagv/LCbzSnBreQqU7eFXsn6tS1xIgBYBYDLU6E8afVbYF8pcGe0osdTWDIN9fqKhf1tklkUau2Ts3uecOJAHK+DrntA2wQtejZP0xP6Bc4D/EMz3k9YBkc69kyvPF6FxotBSOMqLIt2YhjXJnVjTh3/o2tqmshf93BPZT9q6NDwgV19UU8a+oUUAJdxfxt3QRRcQB5RiHLQJGw0Cs15tJ2WKBCT4z7H7QG+xePuP6OEOwWzZyS5T2LaYMU70ieAu1U3+y0ispyR7TojwZgFT6XP63N1LW6/DPVvfRMGP7VG3OT1f8J0kZyZZqDzWnRmsSLO/JSUrVp2j8BOY+nrhKm9JD/B6DDkdT+qFhJ+4gc+NUR+77cU/r7FHcbuvnb/SyZU3lLjk/Ttw8kIOAV7dp/BpjKvq5UHwgCKi0wgV2BBUMCRmShgGRX+2JfatXk/iNo+yEmAseviARqoHHNeCdaMYMLzmrKyKYs80KshSQ4Ypxf64AceABEzc0eaGmLBJivXPS7UcQo2XzHtoBX/6nLAaZ+AMKBMHbAZDAF5XubcKiZBoERqw6J+Gra0QFGIEnu/Eqn3uBmVmIUZGFQGtbVG6qeAmY7/hu7vZtHKWbPsKW0aPX/2A+tCnMmbVwiaka6yPnh0Pt+vLZGHfmX7Ye0Irquna2wxny/h8u+elhEy6vgE8kRNWkzW0azi7UYgTKulxt4dIcv8ZtvevCdeob5vZ4w/oh8nWdufHlGwVdcHTuNmRiWKHDYTTfRy1AzRU22AsQItH8jSBUPk0VMQVH517H5YiIIxP6FKoR3XnrIH4m0ovSG/xctxIQZm0o/DlI787b/hna3q0dVasZD30o8pwxoKMoDJdBV8OM+sl7zAbga0kKXzjTH1K9WZQQCaw8fMe97t4Ml4zWa6HtWh4Ge+XhCNzyuuHJR8pHFJIZQdr5b0wXZ2v9UYL09U2Pw/kenZ4Vp48q2XbtpjjSFDv7kqVetUcUK05dRkeeTjZNbtucl97zLPKFImF1fVeJhje7xE/uj/Yg7Sg7nOqaUi7NJH345CHwrQ4eLsfrAQ87+EcZ2SLi6aniw/bsYdnRzNnpk3lm22wFaRc4K4cEBbvokI3adLNu6B6kVS3uCXDVAnHJQOmOGk5lbJjqEd94y1wGL+92XuQKSneNkjq9t7WWJZZdoPn3yIwV3WJACl5j3Kp4UUXkeHuAWPStgW627vw4+iKN2P8JzNTvzrE9t33t9u2NALMD8m8gzC19UI7sYjZLAvLTacJnA+Yi+UFVdIQj2nJpXPvPc+b+eX59qQ9X3Crug6IQgc+YrTLxGOc4FTt3U0ID0FsWqCws2WK0O7/z/Z6btTjXBh42zN03eWfBtrgfwoCtnM4vRqh0ggsitrQlNI1Smys7XKfARWZGk7jaxmX7RNIqRaprQHr8tzpcb1xe4rWxBYUqfdw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c09c4b15-626d-4ef1-99d1-08da9c823d3b X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 10:07:21.4437 (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: EJNjCyZlZAhlZIFDhD/bodsp3lEeI3ppKbovYXlt+UBneJRXRe5usuV/Epoav05ChrnaS6YQnmWFYHV3nFEMhwfOKjDZZf4mhKQ4rpFdMVk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB6243 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_06,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220067 X-Proofpoint-ORIG-GUID: GheACFuUCJEZ4LpYJPpDTtHshjqmWuiA X-Proofpoint-GUID: GheACFuUCJEZ4LpYJPpDTtHshjqmWuiA Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has hp_sw_start_stop have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie --- drivers/scsi/device_handler/scsi_dh_hp_sw.c | 26 +++++++++++++-------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c b/drivers/scsi/device_handler/scsi_dh_hp_sw.c index 64345f9125ca..07f3129abe4e 100644 --- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c +++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c @@ -121,14 +121,27 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h) struct scsi_sense_hdr sshdr; struct scsi_device *sdev = h->sdev; int res, rc = SCSI_DH_OK; - int retry_cnt = HP_SW_RETRIES; blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + struct scsi_failure failures[] = { + { + /* + * LUN not ready - manual intervention required + * + * Switch-over in progress, retry. + */ + .sense = NOT_READY, + .asc = 0x04, + .ascq = 0x03, + .allowed = HP_SW_RETRIES, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; -retry: res = scsi_execute(sdev, cmd, DMA_NONE, NULL, 0, NULL, &sshdr, HP_SW_TIMEOUT, HP_SW_RETRIES, req_flags, 0, NULL, - NULL); + failures); if (res) { if (!scsi_sense_valid(&sshdr)) { sdev_printk(KERN_WARNING, sdev, @@ -139,13 +152,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 Thu Sep 22 10:06:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 608546 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 E33B3C6FA8B for ; Thu, 22 Sep 2022 10:08:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230329AbiIVKIQ (ORCPT ); Thu, 22 Sep 2022 06:08:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231295AbiIVKHo (ORCPT ); Thu, 22 Sep 2022 06:07:44 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E755D577C for ; Thu, 22 Sep 2022 03:07:43 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MA3sar006440; Thu, 22 Sep 2022 10:07:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=/GU72gtYBEo2FSgdDLRyX1n/d91Ye2t+It+ytmhpQ78=; b=h5j8W62YrdswmNtjVHq397uUsUjxiq7KfIJ9TDdBK/oXApIUcALJaRB0t7eGZ8zA73Xg mrj8S/r/rHc+ViC8Z1tV8biGlcFZjIdzxQbedzQQRS2Z1Dte+bWlQCGeylyWfwepIa/b xvBKUxy/T4o6lX2N78Y0UH7ry+vMPDpapJUel7KxwJ23yIoEtIsFGEnKHQfEIfzIaYeP B4wqz9B9nUG+Qay8WCC8qmN8r3LepHZVQ7FEN2AzPpeOm3vVrTcxJ2nXqeHx9t8rKsFj gR6gRi2tt+Dn7Or5wcI6byIsk8HshUWCN4b49Q/IDpIZ/iDRese6p8LCu384ErL0ql8G 2A== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn68md27r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:25 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28M8l36Y001239; Thu, 22 Sep 2022 10:07:24 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2106.outbound.protection.outlook.com [104.47.70.106]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3jp3cb3frc-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jUOx5Mjdunqq+7Vpae2zZavY6ejkUsHPkRkMHsNeWcXp8G2NEqoJkGjsC2f/Pm/dlMmhEIyq0pk3+4MR89AQb8jDbJU56dT6j38RwwYfk4PIaHR6s81/sIGj1WGWmq4ncqKWnWUq3kphXTOVBFtPOs2Te/Y+rW7d108b4ifPoKU3Q3CpyWVbnlRXtdIXAe6JYeKT2o+XQYCIU92jyJ9mko/f3SeWJFaw6KksH2AOyi+IV0LWLAzzTvzLBQmgONIsrPN0DSVQ5GJkcMg5DtN2+Eu/K+ZOMkKPa9pMA0RBQLeeIH8DX9ymFv2Xi7zATfZnbcbh/wVfpwUGMyU4Gebe+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=/GU72gtYBEo2FSgdDLRyX1n/d91Ye2t+It+ytmhpQ78=; b=TDjMWR9+Kfdk4QlL5iL6vInvMLsb6it4gCtwlCn35mAoeTFIyfd94bVPqE8ihAKQKtwrR+hGQMc0YGU6JIt3El0qV1DUqCyMxn+oSHwV9hhBGlvLYw31bdSEYDSYs+6TUeGQOZ14IbB1TtBzx185N+JigvwNd81aCUwKUqIiywfKI4FaOJflHgnmw2d/2u/nexLPt6Y6dc6B9nPa2UNZo7Irlye6lvdEycp8AiwRsAwEYsHqfr8SykVfVcjvaiZi8U4e557ySSCArs3VapCkJY6VUpPMsOwhDMF/QteawAK+53nSJrYjkUFvLqxUoOi4xVTQ4OQZvjbjNhYX7xpRtQ== 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=/GU72gtYBEo2FSgdDLRyX1n/d91Ye2t+It+ytmhpQ78=; b=CyD4TfoEIIaPi4GpUaCXD+nz/dSr2dawM9tCjsJqe+hdo+tVl/fmLHA/B0IHZzzbwxOTCdsoR0ZzwPzeT9gvQ2yBvrIiCrpSlyGTfwTt+fUX6rdyxt7gkh2T/IlztluUeDW0yyQMdWG8ISpETDZFBFLxEDPS/xmYa8Te9brXXUw= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by IA1PR10MB6243.namprd10.prod.outlook.com (2603:10b6:208:3a1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.18; Thu, 22 Sep 2022 10:07:23 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1%9]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 10:07:23 +0000 From: Mike Christie To: mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH RFC 10/22] scsi: Allow passthrough to request infinite retries Date: Thu, 22 Sep 2022 05:06:52 -0500 Message-Id: <20220922100704.753666-11-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922100704.753666-1-michael.christie@oracle.com> References: <20220922100704.753666-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR03CA0227.namprd03.prod.outlook.com (2603:10b6:610:e7::22) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|IA1PR10MB6243:EE_ X-MS-Office365-Filtering-Correlation-Id: 9cbb46aa-4666-4e7c-6239-08da9c823e2c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yvHAqHDeLh2annE5kiAAc5AqhH3IPz76vrjmWn58VMJ/RKMCLhW9Vy8flu3uJgt3gtpQLrUiZJyo80XhJB944VnOhRsJUWzH5fX4dicJpeVKzT/mwXLaadBcZcke5CZbmeeiVzyJR8+WPKT8XKHn5BXoT40YlijGGpH9p7MDyJ8qNizbHIo//6cSYsxgwjbhdqtyDXE9GkyJWacKmxYQkMfisLTFdC68weEmMdaFiFq7xOAm5iS6yya8M7BpKViSHnvkFnc8X7n5wJiSMDB50i2ZIqh0bHnO8YbdJ8o2kvKHYi5NoWY2l4vZAzr2WyJdZfAW+F7wxO0DnzYqa0kaMhQwFD/zXcDh2O6zMg0Sm1VS4VGB2L3EID38IEBPIlBT0h/LyUC2MwzbXJlFZrTM6uJT2h8JrtrtK5UpaSRmoL5wyHPuJq8vkUDBKa02lV3v1OXUlGiLb+z7GfhJnwVHdf9tuUu9rW5EMX6FhWn9nkN0l7uFTeWofVPGZwTMzsmYlYx8JCmmMvMHk5lkhYDfme8z1G8/UQf5IhOFeKMR/s43L7gi3RTNUz4t47UAeLfQw6EZIK5Gk8C9ZksW7f8Sr2lIN9l9rN1nIFfjsygZIslqtvDgqxV7LwwwsbD2gJsbUUFXm4cGK3YYSnovn1TDVSR/A2HxpNDNLyuGIULDvQoPn9qQWui3RsroXj/0pURyeo0MfZkLtPx1S+c6Moxc/A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(346002)(366004)(39860400002)(136003)(376002)(451199015)(107886003)(66476007)(38100700002)(66946007)(4326008)(41300700001)(6666004)(316002)(8676002)(66556008)(186003)(1076003)(83380400001)(8936002)(2616005)(6506007)(36756003)(6512007)(26005)(86362001)(5660300002)(2906002)(6486002)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dZWlyXgw5Bk7t0wQE3pls3LMACdwP5DMDxuYTkA92wX7SIywXYTJlotkPTmBl5T061jAGyo8WmC6WBxBCxa4YtP+yGuKVuQWQxQYpZd2vN4S8PNPG9L5QmsZvCz7f3jF11iTPD4AB95THE6yd7aGZZeKKgzcvGVp5iuXxtH5wQa/axK+pxqD4314xKWhn0wJJED3sbgrqFlB0CULYv8OE0+PD+Na3smM0UftCmED2paqzgF/FVq8YsT0EaEmuej9/ZjqLbeZlIdz6995KYpTusVDMth8enys7yKlL15iaK/18YjcrLvDnEGozhlaDWk1tgEce1uqh2afcgBvhpQj249BNRLNFYicRhwaOYhob3GQ9GrZJPzuusbXC6m30UFWUdFOHUvU9jUiqI1W/ADhuUAqjlVGX1xI2TY2JkBKTTl1Qaa4OoHxYUT1RVem6N2urE7htFzPdVPSqpuVqx3cNOodR9UOGsG2UOX2iqBJkELFwKrxKyeGZJrZVD5kfuEkYuWhqWXuHRKn4f/ESXFjWggdfK4fW0U2rUetVlyaZgJTLlMSs/DZFS6NJpqSv3wHjCs8MF40aDHXMJG770Vjbf8BDE+ybZ4rLz8KgPwZtcc2Y/Hkc+rNvOHc6w3WyZ3fPduLJSoMAfb00Tk6H1nNCswX/NuQbe2kIN2nH9ERU6LUVVf43TuXyktvkaO5Am8lk4l0FmVI1psPNGuj2pXwjO9UA3CZoj6Yi8wIVExc7EdXGbzO8GK2ShkAKhJ97xxeNq/GVXlXNhYMwAfn2WgOXS1NeipPV2Vscptatz8TMbZkz6pkrum6A4s/NoR7vU58AOV0bJQh/MeHfMqNMW4SlprOy7zLZuiQx8gcfLyhbQ7gaBHdKsXzlkEB8btsu9MoNygWCaGboxPluJHppk85haJFyXnT58uH+aCXk2PfhkZT6RH5tW5Rs2w/6tWo1cHSor1V+SnRW9kgpcA3pT5BoC5VKcJ8xJqNoOzBhRvQ2IX8x56va4EMuHN102NEFyiZ2RVm6+2uGXRYIpSAiw48bSeaXdYhCyEj95FFKy395fp4He5cqRPl67lrvBF8M6AJ/Qiq0QgkUwLGhY/oRYQMyqUCEd8qr/02bFRyffmVYzfsbYNUxd0SPIb/ffzF1cn56cAOuF8jGUoAZsrOKcllNYezFaDB20Kc/Od6+hRaDah9MSquY4fT6Jt5wVFjjNx9lnJNplttuN9JeLiADqkEptcEw16HgGOdi7ok5PqEFdfwAbuFFZydYg5vu8Q4I3j/ibYdYEeIZ3QTw7pdgui8zzxEqjbH0kZa7IfDDadE6NT95RmmQiCYmtY9kk8IKPHhq6ZxT6D9SuuktcVNmmYx4XwwHtjwkwGZYlcPL7+qFLm51UmiSGiQeQtiyZLmCKnMJbkEQgR40vZ0/Y43T6C/HAJOoTR1QvZlaTnR4H5dqiozrthWgOMKCG74q09Rsru4arasGwS1c7rgRhnoCjeL8XLs4yxe6pd0qY33+fF/n/SzDYqFE9gVEelfxE1gZkKDwdAEt6GCCIb6A7JqlQszBqXz8OsIriKp9rR3F+f+qiwg0uqia62VspVhG3P+HG1ThbKch3NMgEUoUtDcVpL7vQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9cbb46aa-4666-4e7c-6239-08da9c823e2c X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 10:07:23.0686 (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: uvIlNT28lJRReKYF9gQ79MdbYgnpdcYlS4b/WGTkprGVNiDKTAxLr4Wnaw6hl9jF2NvL3M1TpxTjTo7xLEVdobGZRcYCuFa/r+gMgChZRjs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB6243 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_06,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220067 X-Proofpoint-ORIG-GUID: l_fz_PYp0g3g0wMJTD0HjbSFp-C6vLQh X-Proofpoint-GUID: l_fz_PYp0g3g0wMJTD0HjbSFp-C6vLQh Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org hp_sw and rdac request unimited retries for their failover commands. This allows them to request this by using a special value. Signed-off-by: Mike Christie --- drivers/scsi/scsi_error.c | 3 ++- include/scsi/scsi_cmnd.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 059c5f40d236..ea79bad4b865 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -1881,7 +1881,8 @@ static enum scsi_disposition scsi_check_passthrough(struct scsi_cmnd *scmd) return SCSI_RETURN_NOT_HANDLED; maybe_retry: - if (++failure->retries <= failure->allowed) + if (failure->allowed == SCMD_FAILURE_NO_LIMIT || + ++failure->retries <= failure->allowed) return NEEDS_RETRY; return SUCCESS; diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index ee3986401f52..cb1191ff698c 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -69,6 +69,7 @@ enum scsi_cmnd_submitter { #define SCMD_FAILURE_ANY 0xffffffff #define SCMD_FAILURE_ASC_ANY 0xff #define SCMD_FAILURE_ASCQ_ANY 0xff +#define SCMD_FAILURE_NO_LIMIT 255 struct scsi_failure { u8 sense; From patchwork Thu Sep 22 10:06:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 609101 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 29B91C6FA86 for ; Thu, 22 Sep 2022 10:08:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231356AbiIVKII (ORCPT ); Thu, 22 Sep 2022 06:08:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231292AbiIVKHo (ORCPT ); Thu, 22 Sep 2022 06:07:44 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 869A6D576C for ; Thu, 22 Sep 2022 03:07:43 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MA403D009741; Thu, 22 Sep 2022 10:07:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=7g+5w5oGb/4K/f+ipQnSNgHg0IKFuGpB0sxh4+zUdaE=; b=FNALoFCigA7LchQCE6ANwK1z/r2DZwYlJnI/uHhJ1ulCCLroEUGfJdXrhQXjB8rdDFHu U9mty71bnIaeq7egjyDeyUv5eMmVt/MJhQbwbTe7DQrZ+RqMeOqmNSNe4nasI8tFzuV1 Ou2hWwKDrLnC2h4N/uqG27a0pAvAFXPRzCtAoDzh5XKlbXOu/NS+o9qdixDW/2U2dpmA UNtVMBU4YIJgTiofX1rGXXssWpeplNfUk0v8ujbkE2DiePxMrP6Pqwt2G0nMzAv1q5+Q FJiBGMO9XRMRrSXPIdsxXJUw/ut9hN7Y8PdyhNVqertcPXgLaVwkd3N8ILdVuYGfRoSE BQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn688mgpa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:27 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28M8l3V4001288; Thu, 22 Sep 2022 10:07:26 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3jp3cb3fss-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=etU4usS2MJFmlo1gVpXHGcyrYEoi2lRfoIGeGLiSVjOJpQWpF9B/YT5Yjr2/TzTxwI43wxdWHNz/JJEcjdsak8dfv40/7GbWjPNOFDgmF2mJRCtPEeThqdrmHwaHNtj63klKpnBVubiuvo3wq3pWfMLU61CQrcdKpSur2IoCHtfbwNGJRwXv2oRhzxzObOGQPY0DquLhrxZTlbpiQScwIUyQG8BjXGKCrNPqUH2bnODrwKq7RtXTnPmjHEhYtbZmTRa5hrRr7rq2rC9BHliyx4dGClRY94051/TqU6/zZyDco+oShJb7hUPezTwvTwHM1P7YaeKVMAgAG8hhR7BuVQ== 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=7g+5w5oGb/4K/f+ipQnSNgHg0IKFuGpB0sxh4+zUdaE=; b=KIxlQ5E5UoURzYD3Qt1bwet52jEWTlsvibfn3mxdg2f9q7btG7hp8zmUcUl6eHHuo6YEoL/6V5dJoYvKTtGATs3jkO/zYuaxqIPI5TzI6aMa7qtJMhUOK92MmJKyvw2VFloYoPyFGD+4XyAOqGsrXGzVJ5TftJahfhhRFhUX6u0TNVo+UHasG1Uu4eZhWPaWxkJCus0qLoTNWZBqH8yTRLqfECcJpSswU9lM+EaouDwaZGsHFn0/41jhNNV2ZHlrtC2bLCDhyQwcUiwk9f3CF176bkywF+V5PppXqqWrwlFWwsrZ5cqWJgrrc2C+z+Tgu+y1H6Bzt3jgSvAEsRP0+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=7g+5w5oGb/4K/f+ipQnSNgHg0IKFuGpB0sxh4+zUdaE=; b=ODXTAnxXzjtGsUmqXGW/BLtEdTuQcKUqTvtFBVGW1TpF3/ATBao6XPqXyboF2dIIJJdqChkF0YAxZHFU7mAWaYMe+fG5peTn0IF/V+Nv1YqXXnFKfEDkWy757FUyVY3t83lSP3vDII1zjNfiRGbFs9BtXkql3dwlLacW/c/g+HI= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by IA1PR10MB6243.namprd10.prod.outlook.com (2603:10b6:208:3a1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.18; Thu, 22 Sep 2022 10:07:24 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1%9]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 10:07:24 +0000 From: Mike Christie To: mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH RFC 11/22] scsi: hp_sw: Have scsi-ml retry hp_sw_tur errors Date: Thu, 22 Sep 2022 05:06:53 -0500 Message-Id: <20220922100704.753666-12-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922100704.753666-1-michael.christie@oracle.com> References: <20220922100704.753666-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR12CA0007.namprd12.prod.outlook.com (2603:10b6:610:57::17) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|IA1PR10MB6243:EE_ X-MS-Office365-Filtering-Correlation-Id: 2b7e1536-e2d4-4dc9-8cf0-08da9c823f1f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x4mFD7aHez2KeLHOLyh45um0Xs+3mJ7pblPL0iMVPrR9nDaZDvO/McQiGFAVLxZhmW/QYZgzAJHeloomcgJ6+mF9vjxq9Z79nmQ5106Pls11dRc69gS+YWM3zzxXAJtZyELVbv/qtNCeVuicUqLOm68Vakgx28rtwwiN2yzQvZ2Fng22iZIsK4atYaLJycUhqus2DMmxPI7O60Ak4ttnW9CqwP4v2VgO+CZ/9T25B8Y7FLzDEtsmV2yL1jThhQKSDmKF/1okDTc253+DA6XSzk90/AbSDqFmGOAglSlQSQgpPJMBge2IrlKD+IW9IfSANaSIZxFP9ZhUIfQMnwrKUKaYYnrzBYDo498WGoqE3EuHalXcAhIqqPaACiK0PpAoT0R7CMcEg/leIzra14AI0yX4lYs3uaTvl9sqQY/OPxHcjkOCRl3yF3skXrb4V3N/6Kx/NQJSQJNcRQJhBrTcBPA6cDi9lMbI9p8Hm5I1pyHR+v5tnTUZAK6qZb4tBZrb8XVUIP3Eayb6XEL+PVR8JDU/RVGuBxxPcnHq/n60Y36ouH0S5ioRv3NZGtsCF4mBWnFDsM5whRdAKMLc/1akgPvHrPt0bND8egAY6+1qivTIyMNK8cFiTn6RIUPLfb/CjaJRkDifUpfRcW9LE0l4/7wJ+ayAmQ+qJMxEPySpUW3hMI1PRQ6f5gI8NYgYAgpCsXpsRh9QMSF9QQtw0wVJ0w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(346002)(366004)(39860400002)(136003)(376002)(451199015)(107886003)(66476007)(38100700002)(66946007)(4326008)(41300700001)(6666004)(316002)(8676002)(66556008)(186003)(1076003)(83380400001)(8936002)(2616005)(6506007)(36756003)(6512007)(26005)(86362001)(5660300002)(2906002)(6486002)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 05EHBFiljK3+0TVmKO6u5Z0d4fzMNHSsF1TMtpxybr6qYdPw/SutIckAqNhDZ03gw7XalPoyn6/y/HM6niuK0kd+UlLiWG+FPKdT2FWW1pF39AfP1sZAgHGmNas9SpJmgX6pqQpIoJxR3ehAPu5srmmF+/SlU78iBDtAXE7Zjb9DrOuWxqAeV1YKe4rV2UbVtlR1HWD/h0lQAkUhEoku11ECG7w0kGMau6lXcplAkUz2fn8lTxv3x0D09FMrrstQXXZk9/UlFd4QOztaSPPoAEhYLfc/geN17t8oeKG3WmDtMl/WJSaleBS0qWgTz55LlgmPCqPFROMyi5XgVWKlT8jU3xQ/hmV3BVSmRd3UkRmI2mMKv4W6JJTEBYbhAGNSawj7ksWHggqpj6Ca4jzrox3qkO2yOT+i24iqpAYdaRUDjK0V0Hur9TJe/aGQr2Ij2G40HbPkOb56a1uMFzFhDtVFgP67kU4lnR3AESQYn6c+H9NIq+4cR/TzVL0I0zgMmoMJomoM9tMisq+5ZEV+pr1UCp33KA1S6b+oEY1a2qNTLV+qofNpjJbTS2Yi0JQhacWndOuCAXilKwaEZk5hUMnOiZc6DQ90nc+Jg4COAuxF5tyZONJ8CuKime9y7FVBOw+dpHiRXWVrM8O4IQHci4oort4jcxh8ze0rc+PuUK0q1LFAC/7OgQibUjivt2RW2NtmzFoNCo411V+tb18v/dUt4k3W3U7XWXnKXmJtpfsWgw3R48L5+kNgIF6wKQ6L2ChGamscA8igAcLJc4ySiBxJkX2xjrZ7LvERKxTTsfAv8B28auj61wBeZ+mBQYAVdM9Fyqs0aqO7uBv9/2zpH+r7rP8/3+J9Mhzi4O3AmrzDJ+M90BMvYjw+bzYpsf20fwSo9jBpo42BxBFqpYsvepxi6pvaZtwkeyznvodk3/OK1eOI0TWX15V2634YaVlP5BICwp9Rg/BhA4C6CCdsF+x2F3qdaq75brI0WWKOSKiqlkbYJQ9LXWOCsKLcMP1zEwOARPsRYpUBO764oq1bcYlbswnTPBG/vSnfkx/Ddkf6Kh75SqRZQpWp3Mlh7kaBp6/FyKDxYth9yPHxsN2r1CgVvGv8zT70NEGndKhOuwgOxKpZUjDOtR3j5+KyRSd8hTezekwGiKPclihvL0glfx0aEBk1MUp5EbDa2Vq/86CC4c+rzRKkO8ydyKSt8C/YLv54zCex8uD4MUR5zwZszo5m1dYElpbeswM8OnFzsaPFmegDcymAVtQh8M3FIhNEkqtcIb/L77WeOcJpsA5xGWqym2yJURRuzCe177YF9MRdPR6yz3fEJT2WXNBBIib/U8KFWyFNsSREqU105jg02gfncVi8/j/GsDxclG17Hx2lhK5AELHIfqyckosu6YTl8trMlKaI9Qn+v3WFqZ1WoGqxXfPvi0LBGA8xS6j/vI9HdDar2GYvAjqnj829THOfTn2ZIEqEAtDzG6ZU7/+Gq2jV0QRDd1UFFzPhURZDcNWfqMulFw7k4mt7ZqI1ZkTSt0br08uRtWNtax22Hwmc5tzoJpNrGrDlq2dZ1eGYXH+CPkp6n6n/RXhDSH58c+6uiIDYOAWp+vmvnXxptLPxpg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2b7e1536-e2d4-4dc9-8cf0-08da9c823f1f X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 10:07:24.6310 (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: j7rJKbDOSHpguN9OeijDCVPMU0pgtvxLsaIVH7WdyRcLfO97wdxuAN0NTxNVMYbc+RDaikAWaVQDcD7zhnxWQ6sEOrrJ27f+zpOJP6XGXNk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB6243 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_06,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220067 X-Proofpoint-GUID: Q36pCjS2sZeAhLyq74wYHVz45xtttYhw X-Proofpoint-ORIG-GUID: Q36pCjS2sZeAhLyq74wYHVz45xtttYhw Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has hp_sw_tur have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie --- drivers/scsi/device_handler/scsi_dh_hp_sw.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c b/drivers/scsi/device_handler/scsi_dh_hp_sw.c index 07f3129abe4e..e4f9d1dc6efb 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,20 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) int ret = SCSI_DH_OK, res; blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = SCMD_FAILURE_NO_LIMIT, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; -retry: res = scsi_execute(sdev, cmd, DMA_NONE, NULL, 0, NULL, &sshdr, HP_SW_TIMEOUT, HP_SW_RETRIES, req_flags, 0, NULL, - NULL); + failures); if (res) { if (scsi_sense_valid(&sshdr)) ret = tur_done(sdev, h, &sshdr); @@ -103,8 +109,6 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) h->path_state = HP_SW_PATH_ACTIVE; ret = SCSI_DH_OK; } - if (ret == SCSI_DH_IMM_RETRY) - goto retry; return ret; } From patchwork Thu Sep 22 10:06:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 609100 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 923E4C6FA86 for ; Thu, 22 Sep 2022 10:08:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231303AbiIVKIO (ORCPT ); Thu, 22 Sep 2022 06:08:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231278AbiIVKHo (ORCPT ); Thu, 22 Sep 2022 06:07:44 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75D30D5763 for ; Thu, 22 Sep 2022 03:07:42 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MA3roV018118; Thu, 22 Sep 2022 10:07:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=wY9R52dM8+MpM/Jd1dWI9HQ4xFm76hjJXQpmNrytkFc=; b=jRprhN6Mv/iVPUtzpROaJvypNoy2yjvbIJJRMY0XHlqdpJkIm6Ll/LWsc2ha0+koxHfL 7gEg0IWu4+2/uXwXiK11YSqXcgOd/tME7QEbOMZPOTyBCaqq0UHrtwYK69MiVMbDZZl2 8iGUstXIemeoqzWVvCWdO1vnFDMM/pGjrQ5485hV3fsYZ9GSVyLYrIN/kd3oBAnI83Ux Cv6huDoO73uHsY+U4z215Ek5RN+CDU15wQoJ7A1hXrGX3lL8QXkwYIamkRpW9pCt7l4z Vx7eY6dLEevChDnf85g6btWMjNKoaBVGLAaO8adevpqY3guejxxzwOQQEwo+2KtsBe9h 2A== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn69kw1ry-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:29 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28M8l3WY007436; Thu, 22 Sep 2022 10:07:28 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2043.outbound.protection.outlook.com [104.47.74.43]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3jp39sm21a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NnVIzMpeiPdqYt4mamCNID5GTp/efgMNPQX7ZOF8fs8hoo4juzF8zDHShvwEmxoXSXlLfGIPuJd1Kr0gJQCxjeesWykx3mJQaeEg3hZcpgw5J2OTS5I13btIfHBaSqI57F6NKl1EigEiw9mjXftMuI5LpJCauu2DmlKDZ6762k6BjZhm0H5rsumUTYuLYPTX7z0j/xkU/pXnHDXl/pWaTRm/+nN89XdndX1O4WPk8fW4KFh36Jf8Or5qz/EeeRmGi4LS34SwmH27DG2M7XcX/KWLb6Gv5Z97NelhHaM4fXY2KA2n94odZg5qsbuVxIKEuOpFKl1XkaS1RML5fdBQLA== 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=wY9R52dM8+MpM/Jd1dWI9HQ4xFm76hjJXQpmNrytkFc=; b=Fxfx0mKU32ZqzHG3A6gQi8+rteEsGZRIP0nMEVtLegzkPPmFa9T7qU37QwPXPvvO1PhDfBzH1GzjPATrA3kQpEQvj+TYiMeVmBuQjYNMwRQVlYlLgUFRZOZRU0noddVLpYk0IbYJw1D5RI+swPdOsUnQ4j0vWB6+42m4H3NDuLfJ2lC3k2oXxlNRxLbEnAlyPLFLv+RZcvTjLYt9BNJdattXYKZ7lH1mevvWUJadVj3HpUUQYgJOJn6CBuGrRx+nd4l+aoDsmTyp677uJL86c9DbzrZLRKwY2+5E1gYD1qSbESRr0lZUV2y5gIbE52YmGjWVXrWaKv34DkSgX0Qa5g== 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=wY9R52dM8+MpM/Jd1dWI9HQ4xFm76hjJXQpmNrytkFc=; b=xnKfRBwWuDom30i4Q4ewoUsB1TBj6N3pZq9oZozvNBLHjHqCL+hQ5Es2eZxKOLqHQHd0bsNlu75rgTYcLXGnU2FTSbSH7KDLHDwXV7gRCmGfWo4z3JoWUhV5gpVInQEA73rqlF0hcOOgKW8a0KJ1eQtbQE73W1ppOnMEvPRpJwc= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by PH8PR10MB6528.namprd10.prod.outlook.com (2603:10b6:510:228::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 10:07:26 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1%9]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 10:07:26 +0000 From: Mike Christie To: mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH RFC 12/22] scsi: rdac: Have scsi-ml retry send_mode_select errors Date: Thu, 22 Sep 2022 05:06:54 -0500 Message-Id: <20220922100704.753666-13-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922100704.753666-1-michael.christie@oracle.com> References: <20220922100704.753666-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR12CA0007.namprd12.prod.outlook.com (2603:10b6:610:57::17) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|PH8PR10MB6528:EE_ X-MS-Office365-Filtering-Correlation-Id: 78bf3425-7fb2-46eb-40f0-08da9c82401c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XzI2uMOufsLQXNVnJFWBiXZ1V+8aHBU+0O3zPtkI+dTWQG04j9y+RYh7HB47oG4HvOmyuAgl5urYwnVQmij9KFsyl4rvL/NNzSmoJy+87CanTMIgvI/CfWBRmCahDUO65nfK9rxOp8nAnsr3D0xqH5JFWVpMR591iVarpKZlJqeXUtEGsEvS9ldd7U+x45Pz1/zbg1LgiTqzqcvsVBflbH2MKLY3wBGHCLH4eMW/VYKITKnZmGQJcB3UHkoTgdT6ih4rq9RNufsbJs9MTjasf0/mUPqwFyLmYAR5xWvWwBeYGpwKFxRM5uucrLjx+fuwo3l97HNBp7gs2cfNGaiMh3SKKD/6t9lYseZ0hZaKseJdKXR3a2Q6nXLSzJq3AtZDhC01nERxIX71Q5oNbfCNz0tFAgXhDVJenNiyUQiN9m/94TB/ApplBtUFLfiFCmXHM4l188VnRiu0k03kX9GiEUpyFLAn+d+n0WsU4e8nrjz5HG9IQ2O5F6FwHO96ahdWowwErstkFlR2YtpgMjvYjOX56tVy98rk+QL238GKcrLYQn3Nu+5ZpeInj9t5i9kObjhSEQ4/LzQ59/q6n1vli/0dz5H8YvVPbbzZRx+N+FzNf2zzigbmEoqb7lxuV8M9czGT4cCRdrBeiivFUX4hN9FqgMVfd/RwZ1uDOgFJyBDRytRUPcReQdISj5wv7pKBDo8RW5sXbLcKXVQtSX+U6w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(39860400002)(136003)(396003)(346002)(376002)(451199015)(38100700002)(2906002)(6486002)(478600001)(8936002)(316002)(5660300002)(4326008)(66946007)(66476007)(66556008)(8676002)(36756003)(26005)(6512007)(6666004)(6506007)(41300700001)(83380400001)(107886003)(186003)(1076003)(2616005)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JW0hHUlOIgjLf8eflmO7jTbGNLlkqLZMgk5UJQzhFuvfVh/iNxVa+UwWExRNoI+AsILKWfGfNp69QbgAIavzoamxyC7JjzJ26dkK+qYXrjFW/kD1Ksg+OGgxrryNG9n+UMqIXyWJA47ANxOqxmT6CEN+uJGG0bR1JaGlnKL3Z+8xYpk2NJoT1YyggdbN4/3ZJgRL6t0cooizQaCuJGUDmsFAdOHKkKzuA7Csdv6/U/7JSxJIQXaGcaHX1FAG60VYUEfgrDaCMMaWga80xgoRkS0Q+mUBdAT5+19KeymUwUb+PdL3dKw7cxnSPO/kHy2lCwXDI5782CjS/dqOCAsleAliQ7U9tQNj+MgKS3+T0tjxRSZAJDCRRAyoBCtsI4anNr7QNcmVOSz69987Ea+fuYrds52XnNJF9lopk/CC9IQ8znnVsfs7DLcAMnb/z6x7viKAuL95RRBKn7g688WVN/MGerpj5FMTA7o04BeIvmFkyTWmwTlywG7WsZWnYnFTDvAUlW/IRCrwFlxKWRalbhwEqZjOR/qhnaw2TZ6bVqLE153B7B+83XLjfrEG2GB+dks2T7AoE6ETGA/FT/qUvOsipcN/VHffT50XbjB1CbT46lZI3Qbv+yFFnu9KFE1uPInRNkoRUcY8Ag1ocfRLtalYcVUOpwGle4y16SIyLr7Fcz/sFk+I7VLOg9mYTMiqY/3JOXmbWOefRz6Ecs43D1LdWbtNwEg0y+7nF6mm7coMY5k68bhomOFGhCHHIf3dgTQNI01Y8Oe88mbjCkCFqSSRVeOve+muOcF4nYcKWJvkmDpqHXUZLHAyZL5J8J+szG8Ny9hY9zbvFO/X2SwZUNDLz+01g5k/OrRPe9EOuXR7HDhZoEEEPBRft+YO1N8m0mgfG3Iq8wGtbNb4WYc2mz36KC/8ZDhRfes2n11lSn7RiLkEHVgR0TYxI1dY52Nq2nffn8GJ5aVIb8bqA3b5qIAvOG3Dqb9ngLHulPBa69/2vW367cG5v4fO1VZ9KWDnmTDEl0zv2DTbSCg+3XKs37DfvPLAC2b6Oe669siLsYYMfs2RDWwSUHNo5PSxCPhh62eH+xWoPupQ8xkr6K/htRjysBSFJUyTCKbH9WA++I/MUDE8BvuCEht+XsOCr0oHFFvZOvAfzH3HYyqvo1Z6bkZjvHX4vsm98wLt6RvOzlAm1/7yLTYuEIh6SfRk5TX8ZeKsr5JIUo33XFjqNwLbqCPJRnpdTat8VdHq0S2jT5TitZFP9arCqVNPnNU9XbtP4OkwFyq6qTIba44d2TUk3clTi2+uirhHrZbAi/M0zeOyOvb/h4hYw1lm3N2/mj8Ifo1wA3SZFv2OgxTgT2Ivq11mhnNMyN6+pAJzHw+LumOmTGIhvMrR4oTXgNAL17vnbhBDQEy+EUg0cyOW+qxJUpQNJaEp49ja87VZVRpzXXqYLDtancIElvHa6T8ClBPIo01pC04IwTuadbwTQ3cX/tz9kGLpmmY1GA0WELfZpnqzNP2K69g3yaqFjetkzON6ToK33nTieo66OdF0xF0aWlmwIlXYiZG+xyA7MFbL7NrtAdrFqtWat9yAQhkbNNqnM2w4PwUN6xeCDdhYN1tWZA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 78bf3425-7fb2-46eb-40f0-08da9c82401c X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 10:07:26.3340 (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: bQc3k7HVr3IGwe0sRtjKCxBqv1Hsr4jy1yHGakv+1uXhN/wVQr+obRAt/Fy0dsNUuRBQxr/6bm9Fnu6CGdpgZz8aoE35uG8R22CQ5olS+h0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR10MB6528 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_06,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220067 X-Proofpoint-ORIG-GUID: 4NLDMiQ1eB3kUIVyL4iLDznaZXH9wJps X-Proofpoint-GUID: 4NLDMiQ1eB3kUIVyL4iLDznaZXH9wJps Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has rdac have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie --- drivers/scsi/device_handler/scsi_dh_rdac.c | 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 fce6886b8319..cedbc13af6ba 100644 --- a/drivers/scsi/device_handler/scsi_dh_rdac.c +++ b/drivers/scsi/device_handler/scsi_dh_rdac.c @@ -485,43 +485,17 @@ static int set_mode_select(struct scsi_device *sdev, struct rdac_dh_data *h) static int mode_select_handle_sense(struct scsi_device *sdev, struct scsi_sense_hdr *sense_hdr) { - int err = SCSI_DH_IO; struct rdac_dh_data *h = sdev->handler_data; if (!scsi_sense_valid(sense_hdr)) - goto done; - - switch (sense_hdr->sense_key) { - case NO_SENSE: - case ABORTED_COMMAND: - case UNIT_ATTENTION: - err = SCSI_DH_RETRY; - break; - case NOT_READY: - if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x01) - /* LUN Not Ready and is in the Process of Becoming - * Ready - */ - err = SCSI_DH_RETRY; - break; - case ILLEGAL_REQUEST: - if (sense_hdr->asc == 0x91 && sense_hdr->ascq == 0x36) - /* - * Command Lock contention - */ - err = SCSI_DH_IMM_RETRY; - break; - default: - break; - } + return SCSI_DH_IO; RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " "MODE_SELECT returned with sense %02x/%02x/%02x", (char *) h->ctlr->array_name, h->ctlr->index, sense_hdr->sense_key, sense_hdr->asc, sense_hdr->ascq); -done: - return err; + return SCSI_DH_IO; } static void send_mode_select(struct work_struct *work) @@ -530,7 +504,7 @@ static void send_mode_select(struct work_struct *work) container_of(work, struct rdac_controller, ms_work); struct scsi_device *sdev = ctlr->ms_sdev; struct rdac_dh_data *h = sdev->handler_data; - int err = SCSI_DH_OK, retry_cnt = RDAC_RETRY_COUNT; + int err = SCSI_DH_OK; struct rdac_queue_data *tmp, *qdata; LIST_HEAD(list); unsigned char cdb[MAX_COMMAND_SIZE]; @@ -538,6 +512,49 @@ static void send_mode_select(struct work_struct *work) unsigned int data_size; blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + struct scsi_failure failures[] = { + { + /* Command Lock contention */ + .sense = ILLEGAL_REQUEST, + .asc = 0x91, + .ascq = 0x36, + .allowed = SCMD_FAILURE_NO_LIMIT, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .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, + }, + {}, + }; spin_lock(&ctlr->ms_lock); list_splice_init(&ctlr->ms_head, &list); @@ -545,24 +562,18 @@ static void send_mode_select(struct work_struct *work) ctlr->ms_sdev = NULL; spin_unlock(&ctlr->ms_lock); - retry: memset(cdb, 0, sizeof(cdb)); data_size = rdac_failover_get(ctlr, &list, cdb); RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " - "%s MODE_SELECT command", - (char *) h->ctlr->array_name, h->ctlr->index, - (retry_cnt == RDAC_RETRY_COUNT) ? "queueing" : "retrying"); + "MODE_SELECT command", + (char *) h->ctlr->array_name, h->ctlr->index); if (scsi_execute(sdev, cdb, DMA_TO_DEVICE, &h->ctlr->mode_select, data_size, NULL, &sshdr, RDAC_TIMEOUT * HZ, - RDAC_RETRIES, req_flags, 0, NULL, NULL)) { + RDAC_RETRIES, req_flags, 0, NULL, failures)) { err = mode_select_handle_sense(sdev, &sshdr); - if (err == SCSI_DH_RETRY && retry_cnt--) - goto retry; - if (err == SCSI_DH_IMM_RETRY) - goto retry; } if (err == SCSI_DH_OK) { h->state = RDAC_STATE_ACTIVE; From patchwork Thu Sep 22 10:06:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 608547 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 CDB45C6FA8B for ; Thu, 22 Sep 2022 10:08:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231371AbiIVKIL (ORCPT ); Thu, 22 Sep 2022 06:08:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231225AbiIVKHm (ORCPT ); Thu, 22 Sep 2022 06:07:42 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE816D5749 for ; Thu, 22 Sep 2022 03:07:41 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MA3roW018118; Thu, 22 Sep 2022 10:07:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=oLmGK2mjGBrrs4g2bkJAZ3cHlkVqWurQsPKIjgFf3TE=; b=P2k/9PCb3SPwSbVpUFhiSZpRFEVCW7RfjpBBDu1wJXBL8SCQ74ajVa64KZIrPFs/gJ/S Ik0iDfyly9Lm3T9EfQPpVwj6mdoYqtCLEzbyHuihzZAP/66KWsqsLFeYx8G2kww8nuTW 8biCiJapUWFP4YRY/IlaTZuDU/zOmStsC795S00AKyDtupdx9EF/F7ibONy+FzeNY6gS kJ260tyybeiApZlA36ePdC208bNLeRKc4kCMrg/EZlko/OLQnQ0uierXdLqA9P2lPW5C jS8PVkKbLFv4YjDBpMRNK8OcTMuET3PBfldmLSFpJ+iqAphYQaJBeCszrUk+YLNejzE0 wg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn69kw1s1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:30 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28M8l3WZ007436; Thu, 22 Sep 2022 10:07:29 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2043.outbound.protection.outlook.com [104.47.74.43]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3jp39sm21a-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EpRR5ezxy5zyxAk+LYixWbo7cTB7Zkl1c42UG21L3FlW6TFZrIWjxC1s6BOjiUVykZkalfXsBcNlO9ONgxADQmQ5CHZ+C3Hh0QrSvFVEG4OQRMJqaGxFsgU7FcISr4JON5G+Z3cgenSZQegdxFm1gc28Kvl2y3qII9UeuGSAwgBqx4J+kBziN/XxecSfBIDuT7jKWPdxVSu7nQSlcgGcGxjR++fk4aGaIvqmIgRS7QSILT17qYqUbuEb5AroAtoulFNfzPm8H6kY/q5BMUB61bWK+jtlySNvIOztb5A0viL3o3NDoeY6sB1g4DlwSffX2ruknIy22V5vYJk/LFMKzg== 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=oLmGK2mjGBrrs4g2bkJAZ3cHlkVqWurQsPKIjgFf3TE=; b=ng5OEdpxwGB1XghTidYnpK53xDh9JOhS21LwHxZY2OXrA1QoXWDBoI9tVn4eJb3SWCe0Ag9NI8QI+8/yziDz9f/17m1FwpEP+uFnF+Hg+98Z+hEVfoLGLKAAV9qG/iKuEPVa7qdoVned/8HArfkvtz8IKTmx60zs8EGCy19ksLAjsLmByPdhsKFjatRZ0F5uz0u/CEJkcyncQwHyr5I1QqaZng7nsaPmn7SRJ6A3LPt9MV2/gHLPMCoIyHAUKivk+RCIr0jPgBZSbA46pmpSXMFks2vGEzBUeat6nrS8pP7NjY/pcSTlem25C6lLF/hlfdydHYpiNqZ5v/oSdR0pZg== 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=oLmGK2mjGBrrs4g2bkJAZ3cHlkVqWurQsPKIjgFf3TE=; b=MeMEDBmZHLUxW74wxUPKN8Bf0TrrFM1IS8y4C+7qyqow3vANggBosnD81iVQL9Hn77rM5Uq1fdJwHIu2uzi1FYczLUZypw5LEarRIN2U/VgaVKIWe5gheAxbAH+PmKMzFF8DuD4afoz3hqZRifhf8ETwwvwwrVfNwxE7+lnUIBI= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by PH8PR10MB6528.namprd10.prod.outlook.com (2603:10b6:510:228::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 10:07:27 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1%9]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 10:07:27 +0000 From: Mike Christie To: mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH RFC 13/22] scsi: spi: Have scsi-ml retry spi_execute errors Date: Thu, 22 Sep 2022 05:06:55 -0500 Message-Id: <20220922100704.753666-14-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922100704.753666-1-michael.christie@oracle.com> References: <20220922100704.753666-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR03CA0229.namprd03.prod.outlook.com (2603:10b6:610:e7::24) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|PH8PR10MB6528:EE_ X-MS-Office365-Filtering-Correlation-Id: 97aecd0f-4a56-4af3-3250-08da9c8240f5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZSId8qRV0e1dVwbU71AKSzk0GOlNbjgUhfJhAXVQ+oFzcyeiQLJT7SwUlCRPJMtY3kIDHfvOOlPHT09qzSX9eNkZR4EA3smXnM7PNCcSHBQjEglg4pyurLVUxrA3kkRh+PDH+QRg1/kpEa+n8RCcPNc9uL9SFdz20vrYxMlj/OPZMXAIwawdwdQJmmwR9HcZ6Qt6w/yNPjeksjfljrA7XfluJQIZcbtu6Q2UeaTjUrgwIRGEMgGdL91T74VCx20xLVkcCyMctCDOoJbd6GW6YXIuxXiA+gj04YbhKcwTPZ8M0tYXrQU2ofb4z0W1ULOadvKMJbGexL5einP+utNc5Bz7hUfm/bw222DQgEx36EnUwDTcUWJp2GPaW2LAwDZ+O9bP/tuu8TxV7czwsg1qYqQCy+Jvt0yZES/4hhaXJEFwpZmAX5YQv2JJi2bHZ51nLi0mcAnUlz/I5rPm9TDUvQLpdTWKB2Z/ENzIHKPmtF3Z5RiPtaxsSMrqzE+lp/6kjgkVsU1eSDzJSF+okbzmPqeb+mPD7t6KCfcjMjmFrUz8+Ltclgz7G3mfIppoTSlzWlt5P5c9ut4K4HXtMylDov3zColNHR7SXsoWw3g7TEuz3NQWv9L7oSO4C5rAs43TuwqvjNiHeyV5EAR50OL20y2S5COsqytRuJQqLMfTh4/U7LzSaXh1/btB/chaQOkief4YLRWDWQumttb5QkYI4Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(39860400002)(136003)(396003)(346002)(376002)(451199015)(38100700002)(2906002)(6486002)(478600001)(8936002)(316002)(5660300002)(4326008)(66946007)(66476007)(66556008)(8676002)(36756003)(26005)(6512007)(6666004)(6506007)(41300700001)(83380400001)(107886003)(186003)(1076003)(2616005)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VQ0rFDbxH6Ce+ERMdSmTOhOSA0aOZHOYwPsWwM888lt7gO+dQDDNecLu3cSYBN/lI4Usl68wgpI/LBYWWBxh/DrsGxKtITf4awLBdPRuSxlAJ0w9zWoQcQ+0vEX62OIQKO3v61wb9/4+HWPfJDuYF8BG5baj/RN596HEL4fkbxCLamGxwBkml1L/sCZ3/0ejtg04OZeCJxVQFnrhGUpUp/CdqYKBSsCeFmNW2hzWjuUxtkgB1s+oll5WXHwNwUsKW3X1T/EBemKcQVZU7+LkcPu+blu3EyCjJB5bt0WnTQr+aGEdr4jmdmSbbgW4Qv+Q8RDIyHgOcrAjZA3hB+Q3kCeKj0EaYopHQH83cDZYntNPDG9IVHUNScGi2fcMdBLR3WsOyk1lOufC6A3Ntgjzebg1C/xu8ld5n7a6w5oZ7du8k9M1muNuBcZcJtNQD7eoRjH0fBy8tdh9JL3aCLTCzRUF7OAW5eRijyLvmiMUqFMQqLWMljdhslZUxYiBWgA2qhuSS/DFCYLV2h0eHbXSmtjfqQK+OaTMza5Tb7XG/9GKflqndrwmKZQsG8Yxt1st3xfACpeJ8iv2ZUPyBKlpSvjMMMNlvrG1vfDFLvWwcPA3zk4hERw9u/zAMvB5KFYwA3Xf9IzeeEJevrroFb0ngtZK1BoV8Yu8ctuVqLgBqibEw28AJ+Gp+0Bw5Kk6Aqk4VaQ4nGqSAhnxtg/J98vUHTxFTcxY0QUbiAUaXhEdrp+ZFeh4ELh+cmY1krJwj8MTGBr61sbhU5vbnRo71kFUHHpAEVbdehlS1lnNzGZFGwXwifDtuqmF0+7jLhMQIJ4Ekeh0TKDpVjrTHonFJqz+29oGem1rqRlt7xF1geArJypwJ8GaxBBbRB342VA24lj5tIu897VPi8IbDXRpOrFDG1FOnrfihIiUAorE4UjS+WCXTTri/1M8wMLkg71Axjx/lsa1xRXGcOHTLrfVw9rLS/1FnvtoHy/+BZDRrLlckVsq5QWZNdwN4HzQiUZgP+crWrI70dJAhO/rPp08i8J5W4h+zJ4vAOLV4jupBZXQ8eKv9ZPFHWV1W464NgeSiqN9A4YDOkAjYql7O573kNffrmV6gG5em8dGQCL/9XtL6pMpdRU5dbufXi1t0EppIhsENSrsTvIjNeQyK//ryDrRclf4jOmD7RAX4aHtvXhtxgnatzfugTVhFdgFzQd7ogGSY3d9lPg9TjzxSsJFAK4Iykym5IX4MXfyzVRTEKI//x0KOAfs4bBHwWyDkdlOtKNwT06OQJxhCwxsN2zpzM2YrKpTZujnfmaRk51zOImHnAHEjUr3MKtczrMv3KxMVtps3t4zM0unhzPcxvzAEhbNx3zU4vhheoG+GofEMVVSaUO8pKQptEZfrhTlSFxaTcOmMTjdP2g+HNlXETjWzZEYFo9WXe0DdcshgSepkt3Daj4IY9lREd8xHGFyfFHkOMp9ffEP+PaWSZQzWYHHpP4CbXC+9NQLU39wwSKSxLXpiMw71wMJRsK70YyVxSE+UZ5Am1aV51Ow17ROaBRuyG8EtlPe1o7JZJtnYugZO2sxUKZmZdskUwjdQjn4EnRgWOFvOUHO6zeR6wKK3wMIZ8gEpg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97aecd0f-4a56-4af3-3250-08da9c8240f5 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 10:07:27.7088 (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: 1/DUN+W3Uq2QowHPfF15ufR5Et5fCy650S+nRsjI52nnLc4KoIrvFGHaOlQI1BCdGV97ghZxgIBhjc8DCERmGsUvT4j4x5g5yLWk7BHeKHU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR10MB6528 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_06,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220067 X-Proofpoint-ORIG-GUID: poZkCJmTjhjrD60yiwwg9hUKaBIDDtcz X-Proofpoint-GUID: poZkCJmTjhjrD60yiwwg9hUKaBIDDtcz 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 --- drivers/scsi/scsi_transport_spi.c | 37 +++++++++++++++++-------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index 4f4c2b155da0..4df56ee4eaac 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -109,29 +109,32 @@ static int spi_execute(struct scsi_device *sdev, const void *cmd, void *buffer, unsigned bufflen, struct scsi_sense_hdr *sshdr) { - int i, result; unsigned char sense[SCSI_SENSE_BUFFERSIZE]; struct scsi_sense_hdr sshdr_tmp; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = DV_RETRIES, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; if (!sshdr) sshdr = &sshdr_tmp; - for(i = 0; i < DV_RETRIES; i++) { - /* - * The purpose of the RQF_PM flag below is to bypass the - * SDEV_QUIESCE state. - */ - result = scsi_execute(sdev, cmd, dir, buffer, bufflen, sense, - sshdr, DV_TIMEOUT, /* retries */ 1, - REQ_FAILFAST_DEV | - REQ_FAILFAST_TRANSPORT | - REQ_FAILFAST_DRIVER, - RQF_PM, NULL, NULL); - if (result < 0 || !scsi_sense_valid(sshdr) || - sshdr->sense_key != UNIT_ATTENTION) - break; - } - return result; + /* + * The purpose of the RQF_PM flag below is to bypass the + * SDEV_QUIESCE state. + */ + return scsi_execute(sdev, cmd, dir, buffer, bufflen, sense, + sshdr, DV_TIMEOUT, /* retries */ 1, + REQ_FAILFAST_DEV | + REQ_FAILFAST_TRANSPORT | + REQ_FAILFAST_DRIVER, + RQF_PM, NULL, failures); } static struct { From patchwork Thu Sep 22 10:06:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 608545 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 C47CFC6FA91 for ; Thu, 22 Sep 2022 10:08:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231251AbiIVKIU (ORCPT ); Thu, 22 Sep 2022 06:08:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231310AbiIVKHx (ORCPT ); Thu, 22 Sep 2022 06:07:53 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 027F1D5889 for ; Thu, 22 Sep 2022 03:07:45 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MA3s3D006442; Thu, 22 Sep 2022 10:07:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=ck2sjqzT6mwA9jXc1gC/l1TR5DXcfU6LS+YL1zMo+9Q=; b=G7wDne38psK4IFy6hpzuNEqdowXMg67Wk7JQEwp20Bd3uYcopgKNc8Zn1+RV7HJypjKW +d03yUYUJw3USY2K9H9j7Nx1cVyh1TaWDjKTVypbgBEslnUsXVPKznTM1N0vCBHHHrDT s8KUD3Jncl6uGOlSu8mZ7Z0GljoXbwpVMiC8CHu8ncUlV5l2XC/fUI8l4+bD/vSDzKwM 4x9XoEPeaJMMNCP7EF36zqiR8oSG+kLj48pIdEefPe65ramNOPqvCY5bc/MwESgx/09h 5DtXBlgxJy2Gk5u1GMWCq5biniCUOdCjqwdHLCkiWH1gYer6S7wo9P/iS1mE65qqK8EC MQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn68md285-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:31 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28M8lW5O033884; Thu, 22 Sep 2022 10:07:31 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2042.outbound.protection.outlook.com [104.47.74.42]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3jp39nedxf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N9S40hiwKrHwCMaUa1WCTRdXc+VvQi2hnREcsORkLCTOj+Yh9wGaYHBsCNjoPDwM92Up+vYry8kiiGkMmFvdvn20WpNyrMXGDgIVi6mtFC/CAwISSnkVEfd35ceJ54qPT1mszjMJztlr5f74SivucZ7DaF4bxY3JXMf3nn10WiJEA/3jL4bzSnG76Fj8kex6fycbp3CpsED4MVSW9WWxgHdLWvV5xp7kEz/xGD0Qb0DIHUcvvjF8VzDvjvOjCiDbNxWOpJEsfYrRbCRc9evMQNuBeDdgVqhLHKQmB1dkODT5gld7M4XudBnupGWw1dZD9X/7IFpAsGoYtyI/GkWu9Q== 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=ck2sjqzT6mwA9jXc1gC/l1TR5DXcfU6LS+YL1zMo+9Q=; b=Tc8n7g8IKCbr1rYy3QaiqrtRf5tClQzLFBDsk8FwzVniPCMXwclwjGyv5B66a11envnwNMBUOjQFQwaFeL/jTAv2l2ONb8MqXCOa1OOSF0mSAkrfcKiPbEJETS4wpsBKzY1BkvS7cVWGJhKfDL7lHLXp7HudOKXZJgr198u+Ne+RsvsfyiJfzyJyPlrwCMNz5SkcuU3LgBCyunsnz1Be0tiMJnZ9fUSJLb8/zNda+ubLW+bHZ0HjuulyY6ie45GxcL741P9RdZIZoJTi5HXccyo2yVS0Kc/MSFfURJI89DH930iJCIJ33nHN4Uxm9yq+DvNKff3c403Jqs3TdLv9rg== 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=ck2sjqzT6mwA9jXc1gC/l1TR5DXcfU6LS+YL1zMo+9Q=; b=D0SKFkZH2wwY6ytRF8YK0PtE3U2zK2y+bJEkrTt+apN32rGJFR9UcMFRHu5A3NdQaejQzDG7qeih1uk8VsGTH1USRiXK6/NGBwCfQUA2Ni90mzdki4MXiKH1QFYWt8liEJYIJe0HTxRk9KnK+4dkSFNn3hUxScqPXA6pKf4aHEo= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by PH8PR10MB6528.namprd10.prod.outlook.com (2603:10b6:510:228::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 10:07:29 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1%9]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 10:07:29 +0000 From: Mike Christie To: mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH RFC 14/22] scsi: sd: Have scsi-ml retry sd_sync_cache errors Date: Thu, 22 Sep 2022 05:06:56 -0500 Message-Id: <20220922100704.753666-15-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922100704.753666-1-michael.christie@oracle.com> References: <20220922100704.753666-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR05CA0010.namprd05.prod.outlook.com (2603:10b6:610::23) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|PH8PR10MB6528:EE_ X-MS-Office365-Filtering-Correlation-Id: e528c7d9-f32e-4822-5af1-08da9c824207 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3HDGLw2b5WXpoXNEVMMGAq4K8vf1dQnrosjTplMHUfxOZOXJ+mJ5S5H3oKV+rPaUVIjMlrl8NQrqWudHfSoPCaliGnLvVwwsbVwnY6zHxGSPCjqm8IIdfxKHD8CPa7wYbCGoBFm31+mDDUNBWneqc9Y27iHgd9eZHtbZEx3QnTshpOWkXZXH0702K6QRtWrdZet3996T1p80kdMlUytM1vXiL8OuC25KsPK2n/QIL9kap4zSNekMe0xi6ySmawOUSTl2aUPgMB2GryYitvjC/IEFYM6TVrW5wVIavtp7JesoIu2dnBk/TYrDpU4YOZmoypOINAoehYD6WFKFHwyKO0RFzhBFkxVYqENtg7tcIIfYhO98LNpvyGf4UUdRzY0gio0eXoSLWALFIQzoNb9vigAVJZoCarQRTSy7mw5I9Z1EPB2oY+3nQcdX0S4zzZketqn97Na4ZdNTeEjfeRpcDXfmabuPsexJ/rpm07KOWD/QxLX5WOeFQFVJD5jNaPsHziOuGwVsiS9RmcThxXoI+YvSTc72svS+c6V4T1Mu+tSYoVwmDzq6vQ0f4midr2+oEqOuARDmZjYTPHJDFKb7oSUcD+I3lto7P3/OGp60gFdBtr9MpGNFdWx4dw7bVmeNUlQkVDHDlazfwPZgeavvdzAembcju0g7LKlbtudK87cHndu8CsSbvYdND08hxQl/Qb2ECydZrVfLbTIEesqXCw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(39860400002)(136003)(396003)(346002)(376002)(451199015)(38100700002)(2906002)(6486002)(478600001)(8936002)(316002)(5660300002)(4326008)(66946007)(66476007)(66556008)(8676002)(36756003)(26005)(6512007)(6666004)(6506007)(41300700001)(83380400001)(107886003)(186003)(1076003)(2616005)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gEHc132+KRSI/uz0eH2OlzzgNx9Z2Nh7spomVemirsU4pypPo9SqYGky6JLRI0iSyIZIOQ8BAJ7Kcd1a1+N0mG1OfwPxYbvwV6/yiwDDctRYJAd++7GRgJqWi04HpJ5vk8HKDV3bgfNyolQSxcLivYpuFEf/jN9v22UMWl4+N9cnIBZdVG7vMrtwmfMXkNvQE7yYH0L7vFm7QrNWrHSpy0ZlNrTKxrEqqH74jm6XbMxdZZFBDBqSb3LFszJ4+iu3nctg2DZybXYa2L6pETOgh5djt0jWNiGcmYd8p7vnsvRlwI8PfCVsvSs6nGDe1CkfQtzVGP0SNKpiBMKufDz2Ap9cb5ex/fjTglFwmuRmdJggehHb4GNu6GoAhhQJuiYiFJObTpytsHQ7hQNQPWZiDmxE8QJDsQpiCIR6vLKtwTCyyz4FnCdHzJOA1QOIcE6SqSB+HwpDd24MkJDPF2U0mdrXl+mfL8NC2Y5txbYT2E/yFpJzKJnyizb9yeEZzYSQwt85iZsrHnGAPWCNuu9O0FeTWrt+cSOt9J3DkysbteReO8w0SNPhge2NCY4Eu9mfQ+TRo4CI3UMAIAot7Z7RpyqKI8pJOAowrbsYLLKPWPL19VsYRmRoVcZmljpR8vBSCMiYTKrMFnYoc2NPl+yRBVqdXnb8CZr+Mz/isGVmJILpPdSec6t3MKUyfXr6BsdtFq+d875xkqtfm2Wh6dQe1vRkdfp9qZ8k04xNjl1ZfHxmjRTem6PNvFLsUi39Nhmm6ogZN7aSM50FZQ7xc8DYtpn5RYWFQXTOs36XjUO0vRuD9WhgLYK66/G3T5HtRQ5njxdTwt/BFGdx/J5+Ah9SxE2x2mOPa3B2mLtlO6hCQn/2qeYN6njHqb8MQV/r2+xyFbLsx1JVqNtB4FMpC+XSdZVBWR3IZOXOOBOwjIXIjb4oaXiAGZq4GB96XNiz2TExbGS+gQ0zhpGANMH5uzq4By10WSVTCC/HT2wm7+VBMbQF36yiR3XqNN3uKMOA8XUNetULqOWWlbIqUhJyZm4CF/mDZs1W53l7bkSjHmXb/fIjYgwA9hmXMHiOEA775tysjq8lAx2mxqDpV/CeyvcZGiTBob8LH2JnZRGyzQ+8YQtp1Y0DRdiwRpH0nEBNgG0HdT9+/JtNfvNoh/QNRS/BNxNVZ9a0IEA5aDCW8EOwRuiJ0CXvLC9oxpLVNcMcGktoeMFRVmZrFCuDghrV8yVMXWdP9OdU23lx1juqmqrYKsY8Q163QZ9paYa6E7JS89EtMh5aZOe6YhkP+0Bwpcrhy9uhDHQ/YfCK2i+0ZOBzytHGA295dMiM79BiOSCoh678UjCmjI0uC66vHgGhHOnvmnKuf9GD/AUdRQN9pSewm6PNlrSmcWgXL5bMGd5jehTOQM8zhIddZVREQHTByOrCLJz/pQn3ValHToMW2eOOI7EnMzCgiblfAbf4OI5MOAoDt+YMtAfo1fP6eLmsI3XHktVDl2IHybCXv0WtGkKLXvo0QlD2PWv72977C26Rn7GgpXPrL5XL1jlGWd61CR8ukqRYx4oFLKP2RwyGe0zTWWJZtrjSZaNtkaCj9nQbw9n/DmxeGEfBw311AMQ1KSZ1BQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e528c7d9-f32e-4822-5af1-08da9c824207 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 10:07:29.5056 (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: yrsNdm1zVcZPMz1Tychh/MQo9qk5mKcFiyC5GgL0/1CpENYBbMpBsuUa0h1/7M1Yel/ZZWDfOtb1N56cLJiihhtDgflUaR99eVUDx+sztRw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR10MB6528 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_06,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220067 X-Proofpoint-ORIG-GUID: jhXalMGiPzWQ9uLAhrESyYCX81WowiJ5 X-Proofpoint-GUID: jhXalMGiPzWQ9uLAhrESyYCX81WowiJ5 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has sd_sync_cache have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie --- drivers/scsi/sd.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index b76e0b1900a0..264c63b10e06 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1573,11 +1573,19 @@ static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing) static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr) { - int retries, res; struct scsi_device *sdp = sdkp->device; const int timeout = sdp->request_queue->rq_timeout * SD_FLUSH_TIMEOUT_MULTIPLIER; struct scsi_sense_hdr my_sshdr; + struct scsi_failure failures[] = { + { + .allowed = 3, + .result = SCMD_FAILURE_ANY, + }, + {}, + }; + unsigned char cmd[10] = { SYNCHRONIZE_CACHE }; + int res; if (!scsi_device_online(sdp)) return -ENODEV; @@ -1586,21 +1594,12 @@ static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr) if (!sshdr) sshdr = &my_sshdr; - for (retries = 3; retries > 0; --retries) { - unsigned char cmd[10] = { 0 }; - - cmd[0] = SYNCHRONIZE_CACHE; - /* - * Leave the rest of the command zero to indicate - * flush everything. - */ - res = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, sshdr, - timeout, sdkp->max_retries, 0, RQF_PM, NULL, - NULL); - if (res == 0) - break; - } - + /* + * Leave the rest of the command zero to indicate flush everything. + */ + res = scsi_execute(sdp, cmd, DMA_NONE, NULL, 0, NULL, sshdr, + timeout, sdkp->max_retries, 0, RQF_PM, NULL, + failures); if (res) { sd_print_result(sdkp, "Synchronize Cache(10) failed", res); From patchwork Thu Sep 22 10:06:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 609099 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 8CEA3C6FA82 for ; Thu, 22 Sep 2022 10:08:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231295AbiIVKIS (ORCPT ); Thu, 22 Sep 2022 06:08:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231308AbiIVKHx (ORCPT ); Thu, 22 Sep 2022 06:07:53 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED7FFD588D for ; Thu, 22 Sep 2022 03:07:46 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MA3qY9017964; Thu, 22 Sep 2022 10:07:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=Qf7nxRVLDhPB41ucZUEAf4m16opmeW1VHb17f7VDH2o=; b=nP1HEi0b1HrXYieIZ5Hiti4OjQLZ//hAapdyQpdnayfdJjchOvO2N4KRYCCf9xtNN3+X jr0q2s/G1kYBI8vG6oYxydFB3cwWmx/b7Wn2KhLl93uVytE7xqDmB21Pj1QaFAb+axH5 in5Hkxlz884ziUvPkZHP7zC8HjQ38CXHdBusM181r4MoFTBhiqyur1C3oU+lFPj0fH68 3L6KTSHUmjXnFd9Ov2Rf//6aRntdpIm/29tCoZg5dc3PpIXxnDo+IUqoGnedjJPkiQ3Q N6nDmmhhXZcH37UxeM9zJ1DWG/Sgv64dLgrsbUUzkXvBHBBeJSEeDeEW7miwMIz6C7AP iw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn69kw1s8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:33 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28M8lVeu033819; Thu, 22 Sep 2022 10:07:32 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2040.outbound.protection.outlook.com [104.47.74.40]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3jp39nedy8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=akJPMsVPkbRQ5ApuEMT9qUFEgnBXvISHpdqWvJyG8Eh5sxB6ep4Ff3FzbfJCW5yhJKmcPu7/y9hCxF0xB2CgoWaBuMAB1xYmRLxtXjVxbs/7X+FzrWL2v5ZZR1ticfsKKq7n5rbdZCaLy6GxaB2lPXQyb8TxGlQhHaKpG3HoTCmR7hNAKHayetQYgRhgJ6RI5H+Ggu0kXseF5RIRgDp4QXcvhGjxU9AcJTOn7IDbe56Yi1N9NHf7OG/ZO0URx3o+GddKYhTz5Mtf3271qwHm/LVAtP3ClzMcQey1CMIzPmSVsRSY7NB6as0o5Ieu9HGIXHaK+WWswja6Xsj+epO1HA== 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=Qf7nxRVLDhPB41ucZUEAf4m16opmeW1VHb17f7VDH2o=; b=GKNErYSgQlhqVU7TNrn9G99WQHsCizUil34NPFibPxZ2oYVkZfVqN9H7vrYUtgzY+JHUIJzDShzWKXsJ4NE/tDIrs9q/B0CzgwvS5h4A4ClYjhGxad9I05FDK3aKj9wMFxsifL64Y+rbs1NiRwd8gC5IpXm4zc0sQOs3OrUjCHUkQKOp8aTo3ZSKfGvszVhCxKvwBYm5HCH/XpWWiOd9wmtUuM0icm89t8M3nyzrH5zUHZMRkYvKVT7xNejwwWC+td7ayY2E+0/jALRzfsybTDVnFEkFTWtDiVnpxPRUFsK69B3DzPiFTFWCL+W2nZoAdUnRPUwZyPZSg3IbevP9yw== 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=Qf7nxRVLDhPB41ucZUEAf4m16opmeW1VHb17f7VDH2o=; b=xSwtHKTflSrdccG9poJPcwvwRXyiTVr/F6mgjmtd0snkHhXiF9PaHdrHETZgED3M5uMpHSjXX0Xjp+0RW/bpQ3LGAkK0viLE1Go3Eci0VI5Rv5oRmyE/7xrelcMn2uZmO5CLFkHOdF8b/50PXfvaA1/fENeEVeSkJ+DA7qfJn4U= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by PH8PR10MB6528.namprd10.prod.outlook.com (2603:10b6:510:228::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 10:07:31 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1%9]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 10:07:31 +0000 From: Mike Christie To: mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH RFC 15/22] scsi: ch: Have scsi-ml retry ch_do_scsi errors Date: Thu, 22 Sep 2022 05:06:57 -0500 Message-Id: <20220922100704.753666-16-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922100704.753666-1-michael.christie@oracle.com> References: <20220922100704.753666-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR12CA0026.namprd12.prod.outlook.com (2603:10b6:610:57::36) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|PH8PR10MB6528:EE_ X-MS-Office365-Filtering-Correlation-Id: 007ec74d-5a12-44aa-fc76-08da9c8242f0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wFtKiqhMsSJu5QsHs+qwWOiqQdfCPYodlDqP6wm6sHRB4FXNQyIt6TFhuzOwwwdi3aaF/R0ezmDsY+tXTizRjUoUE1bjs7RlYwiuvp2m5ulXIvt8WU9vX62qZCyQ24cWIdDLDydB4tEozMkurtDfD1BCFq5fOP6zR+NXt/FZaAqDfdMMYFhuiEziM+ompPsIS2CIu6rITftW2pGFlkRohnt/5W4XNjSuE8FHt8YvQwk74AU+AbF+F4vnhj2Rc+Xcf2GAwXWUB7xxyu5fupSv02gUPYMSOC7immOpSqvfbSxrk267DJqDOgArQPKerGG7ExpIaVQV1zt2R+9n4/By+J63WtSATuHshn1qzoMBoBparqkDudimVXkftz8eh7h9ZeYRjRlZR8zx/S2ZBrvqnRwbbX5GRrCy2IHtWS8F6WlCVJzKKcv/XjpnkWGpG5xWYrCdu+aZZapNbdZ+ZeERnI3MysLdZ1fNh2qhavbofXLNZjQku4XxsCz7hJl2jHLViFNDz8vMRfLwj9PM87ddfu39PcsiPvs953XxcTcwPFNtPhFp0QQEP+ispW0uItScXG2ovckBGNY7RstI3QoCVTtscDw4agOzkp3ZCQE8jbjIKiw68qulbiJpkJPk4Ukql5+FBUCyjkuFEFsqxW3o2j04+CwvUFYXk5cBWQNskrH+Yqa1S5ZOEDIlxFejXheeY4vSBiP+F1VQRv605RJwTQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(39860400002)(136003)(396003)(346002)(376002)(451199015)(38100700002)(2906002)(6486002)(478600001)(8936002)(316002)(5660300002)(4326008)(66946007)(66476007)(66556008)(8676002)(36756003)(26005)(6512007)(6666004)(6506007)(41300700001)(83380400001)(107886003)(186003)(1076003)(2616005)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dE/W8RvzdN1u67h7aXMnaRFNoR+1XlnI292XBKp5aZfg4UpNi0D9zmWWanP3J4ZFmPZAYPRzt/LZpKxraoXTY5wACPnUrPosyVStXDNppiBWD4KYLI8XHaDGiuaERTWFtkidZLt8LcI9jZxt+rVDe0NMbDsxu5aXyqO22sjujLxvHS5X6YjyNGN7NrDnoER64WtVE6mXpNHjwdKZ/PRDgwWoXtnOKhhMeP6snOjVfAQvfAB3f4Ki+qwb7OPlqnbSzYb4E+NilpJKIQZsWPTkDrvySiRILxRm6+aScADG9QLg6TI5k3EM3K4UmhUxhFggqlVfsL2IFs0OW72QTYO28EOiL4StV1oXbeBcGyQ9t7IN4JMoqIS6E78e6FIk1JQYinY2wOHAVKfGxiAyZaHfuit4qJQniT3YP6s9JYEhFDurEmixiu4Nkilqp/uQhIXe1jytlVua3GCtdPgVGHvN9lTQOJhYGE/1t0p1niw+dMmNaCPDBj5SiYv1cEv8XnYiT1mOiuLTTsBdFu/l/RhAvNCbDmNcc5jOUy7zrPcI7LzEvklZIzXEHqewJ6J9jUTAT07uKOOLj36mWzZMWYWYCg0nd49kshPQc9tsd//Y4Vy0GWMwVJgKH8lXzGpGX05+Uk8bGFe5/IiXvPYokGLCSZ+hGTBswnyzv7CKgXb0zy/5FHiksgE9fTMnn4E9mZIcOdEgQPOTdY9YWy8JLWR7pVVrbrwr46euAhyQowmetMCifTGkuJiH1aWGaV6JhLowlZ4JjK5J5CTGtVF+J25MknKTZNmR5YdsCHFKtFMa/6LPQuA10RHkfAw2NXdMA94UUX7MppY3A/Opq9j54MN9tL/vS7dCY8zhLY7626MiEMkotr5cHky3Iz7CwFBQx2pYnNgAm5cGzyzvvfNimuGtepXWx9EkiHD4bViZ9qVbD4zJuZyzTkOBKnBRHJ0X+2fb8QOLUiG/PMcW02DPOX4U/+76tJtWmOb3Fg91RN6ky21zMpHBHcBzX2o7UWxxzuvb3aOKH98tFRvVvrqfZTGSQA0CmAQftO/4DI6ZzDXElBR0mjYsIp0tvS+PaJeQGQ/4oBpaW7Giyk3teD+zEbQP0LPfAHBrhGLbrU/PquXYM7lJKDVDRgm+WcR/XlmZ3X+P2cw/oVDTRtd5WWx+kTN6iEJ0vGqmA/NoFth20OqXRd1AcHw4sI3z68tt1S9QuhFYgn966GsNUnkI8OdhDq23eKT/gS6DjaUb1f3U6ebtZiDQC07tv6n/ta3dddr7gAThpp9TVWepEfDJztiujqP0Z/Qlob8KNIkDVAuYzRF4oG1WN3Q2en9sI0SE6pmUh2FTjM0Wef8Uw22dDjKoFzDprSAmYVqN5g0v9du8358uik8z2bmQhg4Us0ds04pBvKbTjueUjcs7WH0+o//wpQvdxRvwn2fWtqPSmC93w0MU7A1keL0L7Lr/Hbk3NrByiLVTV2ZXHK+1Atupaa1zuCHaD8JL1HyzomEV49l6K2Y2dS7twQ8quK0iJd22BcOj8veQ9zk+NhLP0Fu8eOGYqdNG97mch1BEQy1IpQyrGRMJ9AL+S1hwgtczEjAYRI8M8GSBL//3FwH3z9bjhHtrbWlAVQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 007ec74d-5a12-44aa-fc76-08da9c8242f0 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 10:07:31.0679 (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: dTFiLLd496cca+y7297ZMasX3q/yYebt3b6s5pPLbUUaI/wRh7IBbGNF7ws/POc/uGd6qxpShZ7sabaHqRzFPm6oATc8B0TBD0idNoOzhkQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR10MB6528 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_06,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220067 X-Proofpoint-ORIG-GUID: gpr-Uy0ZJ9kRermuk_WVnUjY42p7SWaj X-Proofpoint-GUID: gpr-Uy0ZJ9kRermuk_WVnUjY42p7SWaj 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 --- drivers/scsi/ch.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index cdef392be5fc..683389acd870 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -113,7 +113,6 @@ typedef struct { struct scsi_device **dt; /* ptrs to data transfer elements */ u_int firsts[CH_TYPES]; u_int counts[CH_TYPES]; - u_int unit_attention; u_int voltags; struct mutex lock; } scsi_changer; @@ -187,31 +186,32 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, void *buffer, unsigned buflength, enum dma_data_direction direction) { - int errno, retries = 0, timeout, result; + int errno, timeout, result; struct scsi_sense_hdr sshdr; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 3, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; timeout = (cmd[0] == INITIALIZE_ELEMENT_STATUS) ? timeout_init : timeout_move; - retry: errno = 0; result = scsi_execute_req(ch->device, cmd, direction, buffer, buflength, &sshdr, timeout * HZ, - MAX_RETRIES, NULL, NULL); + MAX_RETRIES, NULL, failures); if (result < 0) return result; if (scsi_sense_valid(&sshdr)) { if (debug) scsi_print_sense_hdr(ch->device, ch->name, &sshdr); errno = ch_find_errno(&sshdr); - - switch(sshdr.sense_key) { - case UNIT_ATTENTION: - ch->unit_attention = 1; - if (retries++ < 3) - goto retry; - break; - } } return errno; } From patchwork Thu Sep 22 10:06:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 609095 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 C7AB4C6FA8B for ; Thu, 22 Sep 2022 10:09:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231443AbiIVKJM (ORCPT ); Thu, 22 Sep 2022 06:09:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230261AbiIVKII (ORCPT ); Thu, 22 Sep 2022 06:08:08 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25B5CD62C8 for ; Thu, 22 Sep 2022 03:08:00 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MA3sZU006437; Thu, 22 Sep 2022 10:07:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=KerVW7+FQJZBZooJ5aW6BJa3Hw3itlQgKI4HlUWYIDc=; b=UWmZMbkAiPwlVaZ+B/LdVfk4D3SMaILrjLef1stG6NLGpBjvpAE3EqWdAmdXSTpGLcxA 1rakSUp8XnauUNUaX1iJkgpWoyIp7k3JIcKFksr47vXAWNIJNx9ndhnoj91iQ8VJ0p86 tQD2C7+bs+kkFmCmv+ggu+e1Ii+l+7YaL6FWvMbZW0rFb+oVztN2V3r/TL8n0vsZFh0t bfD3zXtXrDQFfBIfIWPR/kxaN7+clW1zYBLan8G9AG3CLermWH5lTHzNvUI/DU4zr2DV RwkoJ/oqnUKK8hYnWIXslpfuLIq011wiKWxFb2rs4Y8Us/xNObxIYm5mnunsHhLwRjtE rw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn68md28e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:35 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28M8l4L3028266; Thu, 22 Sep 2022 10:07:34 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2049.outbound.protection.outlook.com [104.47.74.49]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3jp3cqdxyr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Anua3tkGXo7DIB4vBwXKzRR6h1rXDlEMn8Ttt7CL7ENi8VYPkR3luv2lrFrkvmggMgsdr2NIjo+guhhOhkaxPv9C6ay3T/2CCjoyg7At27Bc+kV795UHf4MRhLfPpDgAv6C3ubIxkMiMhH2WVnf6TP6LPfg4XpbtROBrdK8A74hZUxid0Kixfg/W8njMORQsFTU/nB9aZYLt2NbYR9Sju3V3jGAN/EJRn5s50lee9wvtTAKN7iUqyhmWVRNuUAdj0Mnhkq1zeOc08w/SOMqE7ualkRLCM6L1ueDo2mxISfdArZzuLvL3WtZt+EcygRkLaGcklBA48tiubsp2lhFGzA== 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=KerVW7+FQJZBZooJ5aW6BJa3Hw3itlQgKI4HlUWYIDc=; b=bDQjIV1ir/Dd8XDag4rEJDb2NCtGu0YS82YVKyshtdZxaJr8nYlxhXaBooZRX1wVsgKj2geB4asatZC0Foa7FhsICThTEQ9sWBOzn6lEuAjGA3TUhpGNwMJz1xbscFKVKQ05qcOM2K2qq4RkzV2xeGPej0YawpDwpnLw/MMzfFzHp/W2Aun01aQ7WaV9rfqUpdgsJrZZiuMU3BvZwJHzfP8YyiZn3eByj0THBdDwokAuGs3g0F9NQu7DZ/yVStkjKfQZqls7MWg1XrTmgHihmDyawITrsYo6dkZmKw2k49Xo8V2lp59dZzORMDzeVvHO1xvSzOZzUpfONYOf6pzdEA== 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=KerVW7+FQJZBZooJ5aW6BJa3Hw3itlQgKI4HlUWYIDc=; b=BCYzEmpjvr4Hq1bopQTg+f3SkcjQzi43k3nKmIwDS8vJ4tCACDodL67yDkZIoYv3TxFv7mqGmRfi7STkUKNlcgGQHYntF8715A17oDZy5Qa2gROwhf3A9uf7roPBAm+PcBmgtM4n7DMXejwEZaiovKwUHe5xCmd9KJ4gMewp4yM= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by PH8PR10MB6528.namprd10.prod.outlook.com (2603:10b6:510:228::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 10:07:33 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1%9]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 10:07:33 +0000 From: Mike Christie To: mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH RFC 16/22] scsi: Have scsi-ml retry scsi_mode_sense errors Date: Thu, 22 Sep 2022 05:06:58 -0500 Message-Id: <20220922100704.753666-17-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922100704.753666-1-michael.christie@oracle.com> References: <20220922100704.753666-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0P223CA0019.NAMP223.PROD.OUTLOOK.COM (2603:10b6:610:116::7) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|PH8PR10MB6528:EE_ X-MS-Office365-Filtering-Correlation-Id: 91174a77-bbd7-46a7-c2da-08da9c824400 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fLOpbPElyBdfQdvIlMK01wuklHSzIshLkN3wugkprR5F0/RPYaKN0Uk9qNaq8ztIjpIQo3bwC1uugYXbiNa7qov+pfIrjBQbAtk9T2YoReh1xKpQ4pwy1hE0xehxtfLTvnW06gSu+phcz+3HSi1E9r6FsUxWQiBW0YfrjCekWGZ73o1yMQRp8nXoqFFqvjG9TNKQaQQEKM68IYuXUaGDjO8OLCGmG5CfBmWqUU1KTjjIaeZ1aUeMQBXoOnx/te+bwS+7IB9dmS4L3boPYwKUCk28pQNcI+L2hrF2K7WJSqCqW+0jjsXkEOz7xkBJRY9CrJ9sXN0SnnDrqxhuE0HWBKiBxX606nHRzVgik9mBzmU01U4zFKPvDkhGGs0Gw30KjXYCus3ZjYqDzCTP0lkDRA0/2E2/FyNmBn3ibtecQ6cvLXPFXDhsVQ3ZEEjtzfW9sVn1gcMPTEHFeODSSZb/GVDgq3eit+28ZLM+M65b1FQznnr/L/iQfP0y4UyQVroeIcXvEiREAT+WNw+A04JNQ3saR/7Hggf/njj+NDM+yec1h4HhTd30eVQa8wQOnHsFPcB1DYR72jrM+8ZLFvkG9jtSaYN/XM4BsYkGKrkYjS69zUxP4TiUUZFVoYCeOgJbpYf8AG31UsScGSLUHXRihGqysg8xf2QrrAYubZJQl6eoOIf/BYb8emFoNr9wGwlj9P6P+iHbeRzpSwb4U4VU2g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(39860400002)(136003)(396003)(346002)(376002)(451199015)(38100700002)(2906002)(6486002)(478600001)(8936002)(316002)(5660300002)(4326008)(66946007)(66476007)(66556008)(8676002)(36756003)(26005)(6512007)(6666004)(6506007)(41300700001)(83380400001)(107886003)(186003)(1076003)(2616005)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KYEqXdSVewL1/4jddCrEwjGFbDSq2qw7V5CESBKcMi0JGZT+N0/Jz5z5SU359sjq320/qvCnvcZdAJuBnDjo8BVVtPZSuGv2LsEiWZBLtz3FmSm7GgPKQv+PqEnxi5qZnV+tHo0pfVxJkT8LHY98OmJMsq+rjLyCTseY2rrnOUYJtqkO771T5RCjOh3ivdvtt4AqDJFExC5Iuv2D2R6sS4IqJvu+8hISp9EL7Eaz4n8bZwYQOXEMAF9FpVQ1UcC6mCKY1TIRQXSIZoe9M3Knoykbd4skLMw270OW/Smrr/R1yzhf5PSI8QXm6iIzyhBs0Vxn7j44LjGGuz2DSzNyrXB0y2l7eVAx+BbcaE0OWut9XR3EePmGZFsvdT00OkSoTW2ExjkW+wHR2glIvuxNK1AUlauKOVcAqf4KYH4RzpBfIGiBAGkvG0L46bJ/m2hH+RHB/hy4d1KBVeXRckzFm4jez5ArZDZvmjs34U3AKwACiGrRYCB7THwCzP5F1ClAsuT27PEM5ZIk3GkDg/oxPayMvSH6YoqzX9U3v9volv6ArCQIe1YbuBJ4LdTTUEA8ya4rQxw1Bfunwmy/a1KIiw6p7aZbBhTarZgmJexjYPyId+pnQLRZmJdPyhwR0gGhMtscusayPYfdvfHPTT03etTm5ibSD3F1YqivaJdSd3GaMwk8yy4rtP4fjKDInqy9BGd9VoABLDq8svcqyd1zqFi6Lo1/VrLHqWuoGJLSx9lCLG11N6jGlV4wfP93YcQ/VpEniVGTtSoS77oyApYCcP0lg5FNrkkk3QiFJ3oeYad78A5mBYlalSMruw3ZY5LfCFsM7/YtE4zqjNvrIY8/oNpzolWi/8ux8ZakqJ590kSzEZdnoO28u0x41EyebSAD51cteb3P0NbJHBva+SCq7ujNHxpYZgper1vmzSwgJ9PlhqWyy/fqPXCs5AbInvQf0sZE1T+otffruSthRuA+NWyTt9WuBAQ0U8RgfV3rxwZSmfdvX1b230jW84WdxKgvIosp0b9vB/fvqdJ7U+xccpOUWQciOpZAqjVV5KqRr/dc67IE8aTZUaUJwG4L0cYPKza9vVA5Fe6rtDIFD7CpCecaH4kR1ADjrnzqxIoxCLnk6Wpr0emkVnjdLhdl7E9pDno9iTefGWohgqYcM7b03TMWIIkHzD9Pxon85J+8pgcoewt+Wjn/QXlcPR4q/lU/hw8PLm8i0BQA6kNOcRorQPsjHIEsEGLlolHhs+v4NQZKyZ35NCKDIcnO3ETX6/XUosaxD3r7xdez8O0KOrcoHZdnPklyuaQUNGSsiGO5ssWTZo/jEL1F0Qmo1WpYBHJ9wpmYGtOh0l6c+q24M4thuCZFF0RqULoN4g7sg2v01E9i+fzeVe6/GaQOk7RvwXeTMdTL7vgmS9J2nsnP1Me7JAnnDTyUOi57Z2okzewQMREm+DpSOTH3RCAt2SBkFigm8qC3UpbPWlsH3ZKTAehcf/dHPOjAUiTEm0bQa0bAZsZtbH117We0zlTSZSrWHFXdS5bV8bGlDOI60zfOu+dMkNNopYWBjOD8Zt27h/AB7Ju8UXZmudirE1d7a9uPgBh2O4gc+U5ApbcTKz+nPLFY5A== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 91174a77-bbd7-46a7-c2da-08da9c824400 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 10:07:33.1147 (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: 02Yp0AzqVw4yxIurNTuI6aNIjp7GlMboeMVjzCFwQL4Kabprmgc02JpodIxFSCD2ygvxrORpiFrei4CHsoWstEFAaZI8JqsxkutyXZv2UM0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR10MB6528 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_06,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 spamscore=0 adultscore=0 mlxscore=0 malwarescore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220067 X-Proofpoint-ORIG-GUID: -1NY-tbQ8Fro4ScRFtu06qJ-NN1R1MGV X-Proofpoint-GUID: -1NY-tbQ8Fro4ScRFtu06qJ-NN1R1MGV Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has scsi_mode_sense have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie --- drivers/scsi/scsi_lib.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 7e4cc0b28f61..c708503d574e 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2170,8 +2170,18 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, unsigned char cmd[12]; int use_10_for_ms; int header_length; - int result, retry_count = retries; + int result; struct scsi_sense_hdr my_sshdr; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = retries, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; memset(data, 0, sizeof(*data)); memset(&cmd[0], 0, 12); @@ -2206,7 +2216,7 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, memset(buffer, 0, len); result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, len, - sshdr, timeout, retries, NULL, NULL); + sshdr, timeout, retries, NULL, failures); if (result < 0) return result; @@ -2233,12 +2243,6 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, goto retry; } } - if (scsi_status_is_check_condition(result) && - sshdr->sense_key == UNIT_ATTENTION && - retry_count) { - retry_count--; - goto retry; - } } return -EIO; } From patchwork Thu Sep 22 10:06:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 609096 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 F26A8C6FA92 for ; Thu, 22 Sep 2022 10:08:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231397AbiIVKIv (ORCPT ); Thu, 22 Sep 2022 06:08:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231336AbiIVKIH (ORCPT ); Thu, 22 Sep 2022 06:08:07 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88334D58AE for ; Thu, 22 Sep 2022 03:07:50 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MA3roZ018118; Thu, 22 Sep 2022 10:07:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=plC3WQSRvEDYbqIGNRhGkYdKilU66HlgQNOCltIVdLc=; b=MCGzcZdRF4zapUD8ZWMJjKlLNCb6FUDGtmVb7QdoGXZLehK13X+fUylzarCqMrjaV74G lBKmPEBb2NH3W7Wf2gzS9Nk2Xk+A7T0K8ZoapAH/0XWi9i3n/alVXPMyV/HV4CuKOKOl LgbCy7nCR8XZNmH2EL+K4l7QR8yRLBBX528IaiIpPkNV2e46NC/DEZIPRMVpzWL641a7 UmCix9Df/+IkyCPwSMySKpx2SGEMEYoaWeHudGH/fhCV55HxC09wTV8h7K18F38MFKN6 XPkr1H8Cy2xVQGU8/KucJr9qHQORHUGNcKGq76MhAXqVN1kLsHYzKVRzD4rhES5muOro 1w== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn69kw1se-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:37 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28M8l3ui001237; Thu, 22 Sep 2022 10:07:36 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3jp3cb3fwp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BSU3smeqXIRRW39lDRNo1ffw6MhvhaDfC2NNXUk0LgpKi9ftXa61jpB4K1XU9AD+bHSQWU/z4UG8f5sM+PBcSLLfae0eYo97pKdLZDFMUEoKJmcz/ZwUIC2Oooy/MaYgTfX2X6fKU+TUP9AsSrh5baX0r/qV80AU4/ExlTGITcuLvJDOck+i0dlkF9WQy1Y720CnzfJhKQvtuIkC771Yoa1rxfV6GF2c9XpsmRU5ADxtaC4NUCplHdSOqsf6dGmFt45fGkeYntFNoaCAogKPqsk41tbdhZCycoHV6j1WeEA0Ov0oczv/SJ0v/ttwzAbUsQkBKrAlcikWcOq07DhjqQ== 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=plC3WQSRvEDYbqIGNRhGkYdKilU66HlgQNOCltIVdLc=; b=H76VvwTs5Qj0EMjhrGqJQP3G9VLxrkfpyORMyAl7JRyvoT7/TgCSiljiKOKEBwUYv4m+9LxpSDUfYZSWbUjwe/jSrE0MdfdmzVcFORe2iePGAYSgi18lPMOZik+rAHp7Flv8FWV6BRSTuHcWNbOTIBzrvfxE3uHLbaa7rhIAws3VlqL6m7hMBYAPm52EjwFtQ6Qs1kYY/iXHAxuGnyibUt+/4TcYFrgbqProYCE+WOA1hMmp8vvP8mJjYpOjjTpMZmMeNjAAMawaUjXTkQ8+EFsT/Sgr8UCZ2MekEqYku4ceJ2p9jkVXSx3OeIvUgKGJcHnMpnP+KZE+ajIVPLE5jw== 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=plC3WQSRvEDYbqIGNRhGkYdKilU66HlgQNOCltIVdLc=; b=g83eR2s1PsnKUbFe1/9fmK+U8xNTyj20/MLUIzHDW5jj2hhWM6xrhYDDUOsL5ZvIpaoCBz4KxLiBst4mkehZNjefSCqEsZw4fO8BfIJt0pbEtyigwJ9fCG0h7LnhM91EhtPqIkUlN+eodc9UtgVnK9hBfFnw9NtL/MpxymgfIbo= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by MN2PR10MB4317.namprd10.prod.outlook.com (2603:10b6:208:199::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.19; Thu, 22 Sep 2022 10:07:34 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1%9]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 10:07:34 +0000 From: Mike Christie To: mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH RFC 17/22] scsi: Have scsi-ml retry scsi_report_lun_scan errors Date: Thu, 22 Sep 2022 05:06:59 -0500 Message-Id: <20220922100704.753666-18-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922100704.753666-1-michael.christie@oracle.com> References: <20220922100704.753666-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR07CA0048.namprd07.prod.outlook.com (2603:10b6:610:5b::22) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|MN2PR10MB4317:EE_ X-MS-Office365-Filtering-Correlation-Id: 6af00396-5dd3-494e-1263-08da9c82451a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2TyEubpZSpiuWwVUfh2I9zgi1/3DDem2NGhGeoKMY2tWYk5TiXGu5vT+eYG6QBxXjBJd0mM+HJiWqmugjfoEgZbFQHvt+Cf6xdAUjfYw02XA1yN00iQDsjR+oNtl2bFuoJwWKhmnq/N37VAZlv1FIQzZys4VODp7kSkEVhiLKfi+P10JZO94tDZ6A08rd3vbF9junYBlJK5JU37L1udhEYTd/S/ZLqgadtEL8Rfz2Y/GuIdObKByYl1VQpjaws1HoNrzkRwR8XQKWMJEeUlcTMSkmtQvl8Wr9+LdwYC6EBlZmQu6aa9osADh6g8SismXPlFmjjM4U3TuLVbvxyKKhNenrgTOdGwdiIJGyXkC4G/qpTlAlGFklFX8TSALnTZPSSQe+HlQ5vbFnxWrQJsQRoowclVT5NZmwyr/Zpq80H1iY4cvM7zMkMo8q6LpioqylirSpy7BPi5vcxx3RmlsoiAK+DErI2XcUycXaKmFvfThHew6hPsOT5ZPDdwKmZOTolINyfPpEMLAFabpjfIKhNkYH9+PXnz5zvbSNa+1yYF4f0mSBO4L8xUt4oSFMYx6yPYZ3hiuB1ZwtArm7WMcTxeIy4loehOY0/SUCR7nAyJt+OiyTQ5lK272LcluBr5uQDPWhMjIRY6RjB8T52lvzu+IdHbEr4+bLELW9hrb/IfaTkqV6weRl7/oN11pXCjBPo0ARxfslvq7k5LfTSjuIg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(346002)(39860400002)(376002)(396003)(136003)(451199015)(2906002)(86362001)(38100700002)(8676002)(6506007)(6666004)(107886003)(26005)(6512007)(4326008)(316002)(2616005)(6486002)(478600001)(41300700001)(8936002)(5660300002)(66476007)(186003)(1076003)(66556008)(83380400001)(66946007)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xUM171hW15+rlTrjhTnyFUZyxbHUzGuZPsCyjfXp8p+e2iGAjeHfiQbNoiyMsNRlnlvZ0xnXhqHYYzv2QmlaSgqHnzUQ2xQvKIqxAsrYO5ogq6bJL4rZBxIQS66Tp0zdbwl4oX4OUB+ZhdwaFo8IqbCaibjXAbBVD5kkOApVujcxkctfzuLZhVrVpPtcTS1Aj8/5bZyO7mmOigcjDbBOfF/FiBtkP1J6q2yZVGzCl+V+pIs7LfWjT5+PjehxISXtEu6F1TybRr4Y8Q3J/0t3v1nMFcZkEW0VZ1c8Z1zx7tk7BWQ0xY9EWOAXFDodtVuifcA00us8pok8kURW//HFu5nYJGOpkT+chOT3orZWCsv/sPq8QI4f7wg/Slipmzc411FfuX88k3AlxVI4Ax1JvIjAupuTihVaAEd4sDUao+bsC6XQXSp3GdQjour2hjDgg4EbUqhW9lyxVZkzserSIaChOZuGfxyZtpJasjeTmjO/DdDUOPDp6snnIMc3NRyN9mJ51AiSVOnb8fLjwqm5bPMPAjyZQDDvWeOTzaJULojAnlg3sHdYfVwDMAgIYzbUsy5WoqblPo3qNaBLAqbODf+EIHbIW6HE74Rieq6O3XAjVAKL/WKKKzYizLGFPSVi0RXn9fJEinHLPoWDfentqRYhGBlr+hz5gZf9kGQdQSuPD5a0RZqgIS5e22LjKjDDrB78FNdc5YVofQXX2MPSWRQyUPlkMK65TqFlst4eeGMG2VP8Pbk5UIa+ejVGqOimfasPHja51yL1nGbkzXWBWwaV2ZKNVUcVujRCbelYSab25hon/WAXav2AmgVAtrZFxouYiGffbNPYN5wM/VoQImZWK8W6T6XdjfbgY91d+nRk8ue/OUyhhJ/6sRUqhlhiFspO0B8PowkcmWnszTFX2LKze9iKNB1Oj85Gdz2ywfJzFChPdQaVHA/iW01KqPrlskYst4nI5F+2qpoP8L3Q50cx448z6RYjm/NuaRxN7NkG8/k8UB9xJyvMQd77vmCsCyxUK8M58LDAwzBuGGIMZOwE0nAxxecqzid1hWKa5SG6LHQjpEHpO0cShXEtWHYGhRxDMh5G+3E2EmBUC+tSIG4lYu3X0/MQV09dKpQfSW/qHX0JmsjITXMNlNu+NBqJa4MSe9fHJGuRQY3d1wI45W1P5DihoDNLiYa2dlMd6Cm570xpsKg2QT07oyMuWX+Qk9+Alfk5gNEFV4KiR1MGxUSBPw0d+ae8nL4ZYw8gWHKZYfWcENdYD56hfwf/saIPk0NMmxh/GZCU2nqOmR8y/cfvMH5HOoi62XlrZyxqI+Vo+5dVYlWDP6Gn7/4jhWZhEbj6C8IogiRaRqmzLSCVxbmIGLhukK9Sb/VCKmzNx46oKHkVGV8aI0pE7HtokXZshvRtbpW7BaQnjaA4+PKCsx77pk1ZUmB2jD7FJlWVi5DvBpA00qP4YAkhlXn2Fl+JtQ61oZHl+ClU+bsLNdVzCBVWaX0Tre62mHleckdZXRQH8N8tQJ1/kiSY0WkMXn1k0UaDGFKUV3AhzJlBTO1dLHYLcDKCRa+F4/4i1Y1XxJ5eAsp+PMm2N1vnviHL7kH2Tqj+YhlMc0ZDYr08Gg1ylQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6af00396-5dd3-494e-1263-08da9c82451a X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 10:07:34.6926 (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: 2C4p/kwe6nGVFrzSu2tyhdnNW7nPw/UBxzCz1heKfxXhF/60eVhtbnz30BjwdUOyCve2KcJgPZj5GxMMkyZAFMOmeIVTp8c31y7Z97akyng= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4317 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_06,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220067 X-Proofpoint-ORIG-GUID: 1alUv0gYKAA8tj3oSZOTcbIxBm9zbq_B X-Proofpoint-GUID: 1alUv0gYKAA8tj3oSZOTcbIxBm9zbq_B Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has scsi_report_lun_scan have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie --- drivers/scsi/scsi_scan.c | 42 ++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 744fb8b469db..836e03ca73e8 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -1408,13 +1408,22 @@ static int scsi_report_lun_scan(struct scsi_target *starget, blist_flags_t bflag unsigned int length; u64 lun; unsigned int num_luns; - unsigned int retries; int result; struct scsi_lun *lunp, *lun_data; struct scsi_sense_hdr sshdr; struct scsi_device *sdev; struct Scsi_Host *shost = dev_to_shost(&starget->dev); int ret = 0; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 3, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; /* * Only support SCSI-3 and up devices if BLIST_NOREPORTLUN is not set. @@ -1483,29 +1492,16 @@ 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_req(sdev, scsi_cmd, DMA_FROM_DEVICE, - lun_data, length, &sshdr, - SCSI_REPORT_LUNS_TIMEOUT, 3, NULL, - NULL); - - 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_req(sdev, scsi_cmd, DMA_FROM_DEVICE, lun_data, + length, &sshdr, SCSI_REPORT_LUNS_TIMEOUT, 3, + NULL, failures); + SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev, + "scsi scan: REPORT LUNS %s result 0x%x\n", + result ? "failed" : "successful", result)); if (result) { /* * The device probably does not support a REPORT LUN command From patchwork Thu Sep 22 10:07:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 608544 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 23E24C6FA86 for ; Thu, 22 Sep 2022 10:08:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231433AbiIVKIr (ORCPT ); Thu, 22 Sep 2022 06:08:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231327AbiIVKIH (ORCPT ); Thu, 22 Sep 2022 06:08:07 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24E08D5777 for ; Thu, 22 Sep 2022 03:07:49 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MA41np009748; Thu, 22 Sep 2022 10:07:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=rWibl0AxIVBIAnAVmqUM7IeCdGXz5FJu/4mjS5VQhu8=; b=FdTaT7Gjpo6+WPHbeLjaDvy7VB0VG6kjDOuqBHPOQSHE2x4c4eJGl2pkIko+HbMrqpWr CCNLeE8yo3hl57MNSvSTCjC4qFy+4fJ/kovDuYz7Ty8rjiKH0X4Xj2IldidS66Yk+4tb ycCXVRIu8B9AQw4bK12kYmCpLfqsHtnAT3EbImUo2fSN+IdBug+fxLattQoHNCsatcET meEMtCmS0khAVY3QfUX+stifsf7n89WhezqrX0kBJvA9a1Gi5y76wj4S8EKcsyYvRdeE rXcD7ApffVi33ep0EuUrlAPrTRLzz13UrN6IE+UMSHrb/zq9ynoGMQoyfEYXd6vRvhKd rw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn688mgpx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:39 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28M8l3vx032017; Thu, 22 Sep 2022 10:07:38 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2048.outbound.protection.outlook.com [104.47.74.48]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3jp39fura7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E6acta9RGBlL1IOJ8Fbivp2ljXfKYH3nCk7CtoG332ustASSRVnuYwNS6vyMNchbNw54zM6jPMbheDSPzT+jMU92CNz9eG2OXO20HbSvTEXl5uzhEGVLLR87voRHJSR1VHhKYM+1Evc3fNgPaj6L+XIR4+PxQ9jtA4JtwELhTh8GTExEoIZv11/Mnty+st0gbokHhFLx3C2GrTmPq3Kk2n5h2DAiybF9qCTN6IEzZdc+Je80aCkrszfZIXE0SB1EfWa39fdIzUpgRgsxWx4k0ID+Pl+2Mkh8CwM+HfwmU0AU8thHh2Ry/8FUaSQEGQaBOPELX6XZc2ZaBUH7zvB3oA== 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=rWibl0AxIVBIAnAVmqUM7IeCdGXz5FJu/4mjS5VQhu8=; b=dc9TkZqEZ74ESSUlvoJfSHyhffmfQTvDd3Mtsxvl9BrEYSPpDPGJ8/EREpi7DSTpsG85SCl9jOEESiyVImfX/ObRLcMxbs79BJvYGoeX3HGLZjHb7Egi9tKVFyMnhMyCG6cVm+SnvdxqgPCqvBcMLY8cLX+F2IzdO5akb5b7ft8k0an8KO4MO3yThkqMOPgq27N9Uwkgz0BbRRy5uuB88et+5mvOhRGNPkLL/gXxqf6009LwDAhr9BRnX5rSiK7hY1egFAf+/ozr72kT9hJ87TXJL7MAduys55fyXRoCJm8KXTJYo8Fnd+eAmYHZ+YwpJgn1gzf4uU1hJjEWs8m64A== 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=rWibl0AxIVBIAnAVmqUM7IeCdGXz5FJu/4mjS5VQhu8=; b=wnU07+WrDuvpASPcYf8wx7V6SfDKvOjNrAzeSU8tyZF0/CJnGQVoJUvgo9XKpdCkLUS/Zt4Q3bhvJEK+gbt+ue/EDO4yB+BLw6X28OP10P+FlsXcZ5bzku5YCIvab+QD1luo0p2ReFG99uIlPBFVdWCfGTmc1S0hG+VUbMtCBtA= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by PH8PR10MB6528.namprd10.prod.outlook.com (2603:10b6:510:228::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 10:07:36 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1%9]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 10:07:36 +0000 From: Mike Christie To: mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH RFC 18/22] scsi: sd: Have sd_pr_command retry UAs Date: Thu, 22 Sep 2022 05:07:00 -0500 Message-Id: <20220922100704.753666-19-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922100704.753666-1-michael.christie@oracle.com> References: <20220922100704.753666-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR15CA0029.namprd15.prod.outlook.com (2603:10b6:610:51::39) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|PH8PR10MB6528:EE_ X-MS-Office365-Filtering-Correlation-Id: 83244970-b5a9-4fce-a182-08da9c8245f0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uN5/7LQA0+ztTQNe5fkHYz16/DJNaurKrxlgzxhO0+//u8kev5Af873g7C4d6weTx/zuLsw6Evtrkl8bmq7tC2vXDX7zO7KaPSz8ya3kTOBZi+3RbSA96H+MTgfxFohglxXQep9axfJ11dXlgFhO7pt0ETR93LBb59VcAIeatgbBmQkrfd+FKi9altuM4Olbv5zngi1czx+utmeqvexDS/ayTBO07kW5WRwh/dRjLZ1454sqeT18V1Y8PQWgxzXsTWeMShJOl4kT9e/XYO/eZQ2VA83cHMPsyYB7eeMWKRZjGsaRK1H0JygwCt0t689Y5YCFsbYg3CYn0g8LmFIn0vEVUoqWd0RvT17jIRkEJdwJNbGz8VMEfewfozwklhf3uQ9qle/qQdsetf7hxHb2T0nJ7l7/m//4heQQX404N/M/ig4fX6m50Rdee6oJMLXrS+pA5VbvXoYS6eVm2VIB8xm1amk05IkE84zrKg8pjBx9bPUq8x+HvpJOnPayB2+cgbf23EcGQFsJ57FOBWLcbDUSYJ4Zj3RFPFAHwqz91Ae2KhHP5CBdhb7Qv5kIDz3uYHJ9+zhrLRVE6KRRL7ARwx4am3jU/HXCVVEld27GI8sYRtX6LCuUg3liw/JOSAgQ0Q1+p9STy4sAWRlfVS8iE0pLRs8Wg8+4++8HrPCzd1R2gknY8l730moOkJ0o7N3a1JHRmVyTHg9E/GgIxYPk8w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(39860400002)(136003)(396003)(346002)(376002)(451199015)(38100700002)(2906002)(6486002)(478600001)(8936002)(316002)(5660300002)(4326008)(66946007)(66476007)(66556008)(8676002)(36756003)(26005)(6512007)(6666004)(6506007)(41300700001)(83380400001)(107886003)(186003)(1076003)(2616005)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1rraUC6BIkbfBv9KEoJi2Fv54u6uSXHomv1WMI+Qb3VOSYszTTQICTWwplx5w/8Hva+wwBIrxbOp/1VXLYHqrJRW/3WjagNHDHP0wxChi50lrhvqdY3khzlrY/AIXmAk89SI2zkEvl1lWXIxc+adatpg6w8CIJ4O++2pSNR88xXZsRfDb9YqUUyiXvNi8MB1GEx914alNfOJK5XfH8CwgmA8jTsP/ApZ2B57CNOsJgDk5iAUOUmWH+5D9rQLhBR621mzYRFR0EAFjN/QAWBcCt5FybHwLE2aOzZ1h4Ows9NgJrQQM8BlM/H8TRctGPlZ9g1Fc8FC8lHDdfpad0D8IZRyj8fELgtRgkL830R6uoAwOa2BIUdHvItrf79WHyrMtsEkZRe/KSCgi6KKFQYMvHXY5aNHslHIm81tKT3bouxziQVimbwFWqPz67u0rQX59yJ91DTein1AOrgJhtb0+YVLNs9v9p76Ot4WTFyl10zfC66sIaEB3GtHoFwH9YBA+1YF/oBXZ9tmGyPpOGXHf3V2Us5lTJf26zobC4OBv5NID0+IkaCubbupt1gheODVA+s5Dxb5OCiCWTXj+rJi0tCpvfV6qLM6AFUB4l7gVaQwBu/pPcopUOW7f1wYLWf+Plfng94S9K7K9pDCXg+AKc0wpjS4CORZGwrZMsIDcNoc9uw95irIGoQzOr2IF1/dF50Aywh49ycukJbxNsUvHXY+rHrwFXXkSr853rDaJClfUpCJo3GO6bsWkN3VLAH2vpQbhYp9FsKHidhX5FmpAhLj+wgOp8ZpoYMTEDWRwlaindjgHJYsW36fiUHJJW/uMCIIwrrHeDk0/sWj/Q/dbOxsc2/MVcjP8mKbq6thdeRdpFXrp/0L+RmczqyzOuwLJwAgmc8Nf50BBFIkzguAwSR/9WHgI7MkvvuSGAU1OooeMnZvS5NSeTukm1+P81pve8GBmbZ6lV2dNud89YZEbTWbDORcWctxL6CH9Ws4cWC453fNk+bHdoLjtk59Y0nkqsXe4hrjGNznyKsKHbM7R8Jixhi7ZhdDaL37bfs/dYmPaHj1PTd4P2qTkNsppTr5LrH3baoNJW+s5JvBzac0xOwTu2CrGuty9COsMaoTgysuwRCIUCZhCkMcRVYJXCotNfNZdtczeF0jpyIF1p0uGzorAIAMQB05XNzmWsAhga5+/z7dMJ/BNIFNHWAzh6JazKENE/TjP7h4YQ0zg93YySqb1QoiGrWd+MqYre31faiymMipw6kLdAdiHhLhsduK4Qf3sTdnPxWxOci/YsKktFX5nELqb61n8JjeqD0tyznkDkwylKyH40/t+NktVHA5daHND3uTP3Rn7Xe3Me5sVzYQoMEuEjlS/zD1hIoUV0hOP3KxE9ZM7BCUvUWr5S+a4kVSw0IYWfW4rzRA8sm9kMl52WsTj07vthXpApTI3K+ebLvzQ57oaTWTS/VSHY7zAyiLG9duylpuR2LKKq13Fj1N+TaFFd4XPx6cXILOuc1WnmSUe6Oe53lx1zuf0wF00ouL9+taSNzeFdYRcuzPT7PQJmVjZDtNQPDnhZ/zyNQ1ZCMHSCJiBFbs6xD0x3n4aq6/BlqCB22eAhgm3BYlXg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83244970-b5a9-4fce-a182-08da9c8245f0 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 10:07:36.0988 (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: +qOt3Liya1CHH0A/eRUKb2zYMc4GOQ6AsJBU2PQ9vHK1bhoig7znW4/Ippmm9zFEXcAXCVgB7zT/snZBNf5edzx216sSqh40o8/9ESGsadY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR10MB6528 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_06,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 mlxscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220067 X-Proofpoint-GUID: RPgE_94f3buEIqkvanWIqvVRuFhKUPKk X-Proofpoint-ORIG-GUID: RPgE_94f3buEIqkvanWIqvVRuFhKUPKk Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org It's common to get a UA when doing PR commands. It could be due to a target restarting, transport level relogin or other PR commands like a release causing it. The upper layers don't get the sense and in some cases have no idea if it's a SCSI device, so this has the sd layer retry. Signed-off-by: Mike Christie --- drivers/scsi/sd.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 264c63b10e06..d655549dee94 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1710,6 +1710,16 @@ static int sd_pr_command(struct block_device *bdev, u8 sa, int result; u8 cmd[16] = { 0, }; u8 data[24] = { 0, }; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 5, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; cmd[0] = PERSISTENT_RESERVE_OUT; cmd[1] = sa; @@ -1721,7 +1731,7 @@ static int sd_pr_command(struct block_device *bdev, u8 sa, data[20] = flags; result = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, &data, sizeof(data), - &sshdr, SD_TIMEOUT, sdkp->max_retries, NULL, NULL); + &sshdr, SD_TIMEOUT, sdkp->max_retries, NULL, failures); if (scsi_status_is_check_condition(result) && scsi_sense_valid(&sshdr)) { From patchwork Thu Sep 22 10:07:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 609097 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 0AB7AC6FA91 for ; Thu, 22 Sep 2022 10:08:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231438AbiIVKIs (ORCPT ); Thu, 22 Sep 2022 06:08:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231332AbiIVKIH (ORCPT ); Thu, 22 Sep 2022 06:08:07 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99889D58AB for ; Thu, 22 Sep 2022 03:07:49 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MA3rUc018189; Thu, 22 Sep 2022 10:07:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=7AvuctKnPhKcjN7XEZ88uFBqTFN721zRfXcQUICQ5w8=; b=i7exjhvbUMP0QMYvTnfDz2Pq30+CtaASPDlul+OlnBOTMb063wsSJaQjHX7xguThsZ/F Syes3Ddd3T+fYoWHlpevuMXwupww+WK3ZjV0LiC2p8R01+5K2W+NSipDUFi4bBOVAgKg bAfsnsPmT55QkKKvFsyaHL8n2hYVnh2DFI9y+ldOOoXdCOF6AODjqoFFPNZR1mQIsIKJ hctNRn7sPmwSD2+Hmj8uJ5yxcUR03P6rlTV/64VXt9ei6rjLNcRWpkqBo7NhkQ4sV6uZ kgLOnQo9uTC1PELGxMZyXalyH01DvqwilSi7FXF8rWvlUqXFDdxKrGbnisBB9YY7fI6Z Gg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn69kw1sp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:40 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28M8l3w1032017; Thu, 22 Sep 2022 10:07:39 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2048.outbound.protection.outlook.com [104.47.74.48]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3jp39fura7-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Of1yM7ETblJZSwEsQdnO1eOubGEi2Nl7WJdN7WYA8bxi5rGTdEtG9mP3FDl9Jz9hEq7qLJluIrmOgRaSP9kZh1rX2jU7V+DF8LVpGtMNvVEeT++8p1ZXScv10pluhrX+LnP/iTz1QMzO3Y+HoMNLQG9k5xLDW5VXL0Js1PmVtNN8DdS8WdluE/g+QI1avfiadrW886jWjLbVu5hl3soUyKmUIdU2mp8ZD1ta8QvhDtLYYchr4argI3bDVg275JuoXZxDRMJ2ni96eMddHPrH95qvUixfkaj3vPvxYWlhh932Y/Ws9ZarG9Kmq3qaYGjHO5ZVsQIAmz7m8+xtyo5pTA== 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=7AvuctKnPhKcjN7XEZ88uFBqTFN721zRfXcQUICQ5w8=; b=gUer9DQknvNhm5R7wcQwc4lOUyjim3oWvWQFS4vTOQXapMmdOoqiCD16KmBJDbNrdCqy7pxxd0To0dIz8J3PpKqdEyDuYnBlaXZLw8PVGjxDY+kD4fKxfd2gRu8Q7D7YILq3NLuN+drMH5riXkVGUKavP4Csoexhl4EKqDTxVunPcbDMvGHtY0Fh28z7LQuSplXhdVvmpWeDj/sVunJAMsEaRD5obTFfGcqmeYnXCFYDujqaKWaFLMFSdlHnUJrS8lIColSz5qAC8LKGT2gmtOjaWaZz1vWEAtz6o6N/pfbXmaGQt18Dpa6oZn2iKLHWI3kD2XG8P4TjaRcXW0mI6Q== 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=7AvuctKnPhKcjN7XEZ88uFBqTFN721zRfXcQUICQ5w8=; b=pHEsyGkbXlFJMcY0wZ3ect/yGODjlTKjIyXM4yxq1pz/wL3AR7D2r5EAsaO13km3XkUqdj2rotuJ38/1NsI5/s2w9qVJkoCi6angnbui19MOfqE2Rxk/yBmsxmuMh/PYB2jaHN2rNajfWpn9fSVjlKC5VB/vp4bFqe0YUyqCw7s= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by PH8PR10MB6528.namprd10.prod.outlook.com (2603:10b6:510:228::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 10:07:37 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1%9]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 10:07:37 +0000 From: Mike Christie To: mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH RFC 19/22] scsi: sd: Have scsi-ml retry read_capacity_10 errors Date: Thu, 22 Sep 2022 05:07:01 -0500 Message-Id: <20220922100704.753666-20-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922100704.753666-1-michael.christie@oracle.com> References: <20220922100704.753666-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR05CA0011.namprd05.prod.outlook.com (2603:10b6:610::24) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|PH8PR10MB6528:EE_ X-MS-Office365-Filtering-Correlation-Id: b349735d-ca91-44a2-92f5-08da9c8246c9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XHtta272E/pAPAEHoC24fFuwRbm3eTh7YRzDmkmf8zk7H9sIDMoLMiZpP5dd0liwDU2iYtDb0Sv7Di8OmKNyPYmVqmmbFeLeS6QFsl+HH5x/gYwKwu7LlVAGXwjePYTCswydTN06wGTlyajizWC9BHeBP4hlVZwraBhXi0WKl+gsxVHD3hXj11qjwMoFpPvX4XTquvysr2u30gpQXviWiiamPPGrAS3fYW722MSqN9mHTzrIsaAJrs2JN9ND5UUIdd2BrV6+wnQZbyit5axTTOKGHKmRAuW2xuQ0DwusuO4LDPkIYUJxyHGG3y0LvTYlZRh/7WV9RX57j3Kqujv8rSREgsyjLg4USW0+8+UT+aGk+1M9q3Dk3VkqLVahXktFmWkgiMLK9Ik32I51p1MoO9JVH0o9QDZQrV0MnnfaYfRMhxM6gXxhwlhKTUjLZImCWwlJEWrWH6O+9WYAjJtSCKpDjJsmBuP8haLXBZNPyhorEwYOxCAVYLiTSIP0rlGNTimwvtJPe07KxGol+fQChZn+B9mhYYd5DF1N/ECncyk2UEZTMU+oblHPAnl38qIu2vWwoEYLKu83LqpzB3fSrdpJ/9DHmzGzce+aiP7bk/oLNwnziJXXOaJuiApX1H4SVUco6+0PSx+XliHyb+6PRsGCak7S7tEvBktAezvlM0THnqoTmvu/4AxY2BpIHP5iB5glZjKdIu8QCyp9AAfWaw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(39860400002)(136003)(396003)(346002)(376002)(451199015)(38100700002)(2906002)(6486002)(478600001)(8936002)(316002)(5660300002)(4326008)(66946007)(66476007)(66556008)(8676002)(36756003)(26005)(6512007)(6666004)(6506007)(41300700001)(83380400001)(107886003)(186003)(1076003)(2616005)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: t2AdJXB7yqT/Xo3KcSRYBKclucXtp7vtFaqW8GAK3rCLdcsubWa6HatGA5lGFDmt3cTkP+exkkoLbx29SLV4EyC43EiLUZmwdUYxs80eEBjU8F38SVO1df2i9LowrW6Gt5xkuazc53kAGLdVhrDIbsN8Y99/Kd7Ly8e0SntoFs7RzjRQg3hK04Gf3I4jjrCHp+LLqzwHVAh2TNquMh7KUlkrb7M2G9RZke5zCEcBc6JrTQ88TArOmWvpvGRaxIvAvqGsq0dM73m4ncfDsuVbeiSI9JRuSJnFTpbY8DriZWP96hJAl6cRt/Wrh2cCcP6Kux5nG7h+jwnG/CQFY5xjsiyUOocloq4pyIJ8QMJMsrXiiCCWQXETh9Is49Z7j1FKXkTwXx9u1+Ug3jgC52kvyix7ej+VAwqHblUOJWVSP9YwbL1iN5+twKkK/MLXmqca1kb6JNXHlySvoBQVeldD5kbTa9XWrRAwRYViDt/qIGzRHE2VYARjvcxd8wr6cw9TtmyoC+Rc4JVc4l1bqDMZPa0AThRYIZ7oLxGI0heCSq2yI4mICrP5S4IMcBIhYLslrR0bN9/5ysFhPeIc+DE9071sG0RROkvgL3EuK1cWuXd3sYkITILJX8hPTNVmEgkF5GNobUAJBT/OhzKq8Ts/f1cDILT8It97JZ/vzYS+On8x9e+ehDFU/sw3fGcYDWJkdKxnwb0Qi16G//Jn5zRTqGKsoielQVjdjtfp7zCXyysoY2Zs4OMgsq/CjN4KOb39i5gSsNKuzqW+HzNParleO1bcZphMw0GVmikuZXU4w7RguXmCMDGBLOhkbbYIM9CGbBQOmjM85ddXEtqsPi0IRm/LhMRvMCdWhbos8SobcTmOrLaQuz7TwQ4V8wvgfqbNhEwxtx4VKHk+s4uGCpgjOeF0j2cOg4c54ctOhy2F/aoQvR6cOHBu70B4l/F5G1RaTKJ88Tpe2iJfkThSw4Sz9fGQt62/SCpbKxuYTCC+GuWGPUlytpbu1irbkeL7FVlCwv0gaSPRovEMkED1cRQLyDxwclg6jUpJkVoPSKDkxuIHC4/WZSqQ4kFCqfZDFHIFHZpLDDWQXttgx0R14qFIMkCkKx4JLsnaNhQ1Q4muUPut3LKwlUu6O2N187VYTcMBSf5XE1gIZTAd0oJkKEAf5ONK3FBSFedbidV34Tlgb47DO52oV3SnYOJAxRQNSkQh58aqOzM0nNM6nJ3qR+7PyggkU0xUjkQySWxWvLyZG/85oWn2CV7Qsr/CrMs5+veuvZoj6xUFGPgQE+fMdmFty+5xW4mn7v40LDtoq2vI1LCpBiothZE/90opTrj32sH2e+mM3qIS7fWxownZaWSVL0kUjPIs5/mIqK6f1mZfPF+BW1sweHOUr8CZvgWX+qyYEueeOBRZ8dilYVRIXbcZFdrbc0itjcoP/xyn8dtm7ZmITThoyboNENmT5ia/jkveOUFggFzF8zemwUIYqZfCFQoDITvFEr614VD1zASzNFsE2mv+28kz0De1gUXiYje1+MJE3/tvU1jU2GTb+uJmZ3CXylpC3KPhF2AMkI8J8d3ASRHXCIW2XwcY9j/TvZAPjBXZ3RnmEASYZuPcwsuesg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b349735d-ca91-44a2-92f5-08da9c8246c9 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 10:07:37.5049 (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: r0LZkOlboW9dzlINb7NM5F1O7ftn1JT5QBJhhAwY5Qa+iHHr82xHJWv/zyHDknMDdOjESWwm0RgG58Z9CVYy65Esv97cdF7k33iCUs2a79c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR10MB6528 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_06,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 mlxscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220067 X-Proofpoint-ORIG-GUID: n7ne0hUX0IGoJyrqZDbDkpOPFdep9RZM X-Proofpoint-GUID: n7ne0hUX0IGoJyrqZDbDkpOPFdep9RZM Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has read_capacity_10 have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie --- drivers/scsi/sd.c | 48 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index d655549dee94..f6f7e16d2a71 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2362,36 +2362,34 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp, struct scsi_sense_hdr sshdr; int sense_valid = 0; int the_result; - int retries = 3, reset_retries = READ_CAPACITY_RETRIES_ON_RESET; sector_t lba; unsigned sector_size; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = 0x29, + .ascq = 0, + /* Device reset might occur several times */ + .allowed = READ_CAPACITY_RETRIES_ON_RESET, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .result = SCMD_FAILURE_ANY, + .allowed = 3, + }, + {}, + }; - do { - cmd[0] = READ_CAPACITY; - memset(&cmd[1], 0, 9); - memset(buffer, 0, 8); - - the_result = scsi_execute_req(sdp, cmd, DMA_FROM_DEVICE, - buffer, 8, &sshdr, - SD_TIMEOUT, sdkp->max_retries, NULL, - NULL); - - if (media_not_present(sdkp, &sshdr)) - return -ENODEV; + cmd[0] = READ_CAPACITY; + memset(&cmd[1], 0, 9); + memset(buffer, 0, 8); - if (the_result > 0) { - sense_valid = scsi_sense_valid(&sshdr); - if (sense_valid && - sshdr.sense_key == UNIT_ATTENTION && - sshdr.asc == 0x29 && sshdr.ascq == 0x00) - /* Device reset might occur several times, - * give it one more chance */ - if (--reset_retries > 0) - continue; - } - retries--; + the_result = scsi_execute_req(sdp, cmd, DMA_FROM_DEVICE, buffer, 8, + &sshdr, SD_TIMEOUT, sdkp->max_retries, + NULL, failures); - } while (the_result && retries); + if (media_not_present(sdkp, &sshdr)) + return -ENODEV; if (the_result) { sd_print_result(sdkp, "Read Capacity(10) failed", the_result); From patchwork Thu Sep 22 10:07:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 609098 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 CEBA2C6FA82 for ; Thu, 22 Sep 2022 10:08:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231391AbiIVKIc (ORCPT ); Thu, 22 Sep 2022 06:08:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231284AbiIVKIF (ORCPT ); Thu, 22 Sep 2022 06:08:05 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED963D58A3 for ; Thu, 22 Sep 2022 03:07:47 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MA3s6h006449; Thu, 22 Sep 2022 10:07:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=LgRZ2lxi7F1bHCyRHqexpFAvGwvvm14ZICzktggnYQQ=; b=Q++wXeY9i6CSfNseL80+BG/pCYth7RHWdazLvXiQ2ST0WRKAiDI8QIj2aTMK1tbXId0R S/YTsePvrCvnDaY/wcwKEK842opH6JtZYYmy6zvtb8SYwsH9/rIOy5R5EU1so2rsg+GN vj2XSroRUrpcLq5i7QlC4IpkgE1gunoG0rwqDbjMNdkQuIX+V5qqbfMjuJznO0f2u2kP mOcvPEMpjnu6/EzcCMQYSmltPWh6eoUta61g14wYGiT8aLI+OeDa1YWFjpMY7M9TAgO0 /QPeeQEL9be/iC8cHt2zLXuDGUjWlP8dcQKbRhZ1ZpbrFGEXlTKnF5ZwBnamVPzYbLdl OQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn68md28v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:41 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28M8l2uY031991; Thu, 22 Sep 2022 10:07:41 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3jp39furbr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TWcX/nNq88Nq52GHEvkYUxOzcybZNyed1PQAB4nstjr9pchhO83xKB0W7Mu26UYfM7/z1U0NIpmBBy38KIHeUGIUZ6Yzm+W9l3/C4yF8IoBJ3FR7Obd5gtkUSyRhXCjdJvmbT2jD3psbFXPP8ldhuTgKL21EGWAP3hDgwTRMCRZ/m6jbp3U+SM9CeH1i1ClnJahVVuyvoYuk2ooSJrY6aZGsq1Zu29LelyA/C4nhf69qRs3ygLuWkkAqLIe5G+smbD9jNMvOJO46mlank+mpBN/yk+oKzWxqz7pnqQFTTcBZkezZYkat7TR6uPRkXu++djvhS1LC22RqNY+KbhaaOg== 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=LgRZ2lxi7F1bHCyRHqexpFAvGwvvm14ZICzktggnYQQ=; b=Ds5LUo8MdFdb2RjIk3rJwjyEBNxVBTAqCul10USBbvhJDNGhFsszmYGoPThhG6ed8rIW3MkToe9ec5SOQ+087WGZCZdCHjGvKaE1XrYT7Dmt9fUwRmDVAL3PuDsep3JpVVYbNbIwlDSeCkX0RD9ZZ2MzVqRI4fDDH06OcJV4+SR3VwBo3Zt5iysm1x8sSASBL6/ZQVn+drC8SVZ8C2EIWVe/Zw0fI9KHcv4w3TMkADRc+RT3cH7YfYIUk3+Mb//VJlsm/3zwJ4olqbiPkVFLZ7T6mlev1OV8O5v3sNbw6sSZ9f0Zn20dJ4d4ymY/pZVPg7UuHYNrkHTyUnKUZvqemQ== 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=LgRZ2lxi7F1bHCyRHqexpFAvGwvvm14ZICzktggnYQQ=; b=t/jT1SG8LERXVIJ/7A+HptncqPmIbXR0IrrLWB3MK8auDX4YnphgncatXQY+j4XgJbL58618sfYtAvR5XK57HYsam/ejGvIDxjQ0DeX4IPg5hLbVgiNTyV0KIhfqNoAE1Cax/03qzvyynrjofrL5bXJzWYm3RbEjXHOE9D0Zceo= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by MN2PR10MB4317.namprd10.prod.outlook.com (2603:10b6:208:199::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.19; Thu, 22 Sep 2022 10:07:39 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1%9]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 10:07:38 +0000 From: Mike Christie To: mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH RFC 20/22] scsi: ses: Have scsi-ml retry ses_recv_diag errors Date: Thu, 22 Sep 2022 05:07:02 -0500 Message-Id: <20220922100704.753666-21-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922100704.753666-1-michael.christie@oracle.com> References: <20220922100704.753666-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR05CA0016.namprd05.prod.outlook.com (2603:10b6:610::29) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|MN2PR10MB4317:EE_ X-MS-Office365-Filtering-Correlation-Id: 5ab3fd9f-e334-4a7a-e6a8-08da9c8247a4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WjyzvgqEcy2GjU9at42hC51PGr/XuuioYGvwdUFbH4gXbHQk7XegfAnqbWKOVSf94wNmi5svVZCwshyBYes7LfDCjMYAnvHuPp4eAs06Rqsad/UfHIiKpD41Dcg67WGaXShXR9W62nFofO7qahyDH44F3Jk9fZdT/oHaI2UnpePRtY2bABf0DUlYP9LY11uLQff+5AyX7X3xRDguqkXZfW+IRLmB/iTzolwkn3fEc9GxnRv9hCT/CHZNdWW/4MW/hU2wfJiGRM8rI4Y88hrI/zZpwNgm+0PBhF+gxWkk+mxg77+gTb3dSxRJ8PA2hHhuszuhpNVgoNEI/5DUgRk7OVin844CSxRjUIYZSPsY+ZRre9PfQ5lSbF692GwbP083rq0M0Rf6u7BAuSiU213vLaoZuXnT2SzyHAxrqjsSl+Km+7+ICvSc37o/y2rV4sDum0+zDGLkfZ9+w7JNhZ/pDxLizGEvTfytBuOuLW4bE2oH20JAGR07coOlt22v5ay9Lrw2ugQg3ouF65kqAEEssn+5gbR77YHP+NY2gnDaQxd09xeN1O+d7jN+BB/2boiPY0Sw44y7fKzRxlbDyVZwbOb92H5ZWd2Xn8zxaEh08eHaKorJR5V8OMEcYwDywrSREQBRty2XrePasnbK9ICEoQFf7WNi6TRWqrSKMUpUVZRdadHbxF/HyX/+6hW0LKRy356/SHOitPamreWbCvYoJQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(346002)(39860400002)(376002)(396003)(136003)(451199015)(2906002)(86362001)(38100700002)(8676002)(6506007)(6666004)(107886003)(26005)(6512007)(4326008)(316002)(2616005)(6486002)(478600001)(41300700001)(8936002)(5660300002)(66476007)(186003)(1076003)(66556008)(83380400001)(66946007)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NTHECIPD2EJhPR1QK0Xt9jaQ8SWPaq72tul/kFQuLuGTGBU1GLvPBiilfecQ1BCU4UlXbTgho1Rc25aKXCStLWHBBvt4bLdKFciZ/DM18CpdJ7pItflrCvjROWSze1+F1e3gwzZ32gHNzikMC4FP/F3eCqQH9QqSWanju1tQ+J8Gk6AzX2As/jdlHudrq4Y9K8V9D4yIKDQAKdeFXDZY8eNZn+RVSa5dVPpVvKIUCAepVdcQk749EJFBmogRy1WjZhGIzyP2CJ9B4ZC2l9sd2n/YDJggKI6NXQ4uSY03QG7FnubhF8nxvYXczcXfpYBH+Rv4rOPa2VjBgVpu0y1DcQSb0Vr5egy2Fnahu1ZLkrNUaYJV1SUm0aj+PKZzcd4uVSHpsYFT4mAi2XLSHsCVYaUbRGashU5qS5lECTpiEjGydTrWlv9BZ60yqUGDGENsm/zDQM6BjunelzV3iwu/BcfiX5RHpH6TAMs1PtUWzo+hki1Hi3qd1a5e21WU6vNFtTWiviQzuFw/n/6NHPVtfxO6ucyXkAM6N7/9eXYZl46EuE+oNpCtxDZpUsUKcU/D5niqbJJiy1mWm4AbsnmHM8uzsZeRzjD6S7JdH+ITd3K9urW1YOiDpnEVXXZJsVhndXi6/otOzgrm7xPkAP6UlUS/CAf+4xw7wRtFRse8E+L1bol0MuumwIsVdPNB/pDyy9QhwUpbphO/XhU1TudAMtgUL8NoXeCdLrWDLepHWIe2b000DrtheLAG4hmNWuXq+T5ut2xbClDqe1CAM8I4/i8Hgefdc49sfEsyxaoDR2TJeUqoPd4ykAw4gAzYMFYLNIf40XQtWTspRYqnweH+bA54n/pRzA2dJPFjvPJTJRY5evBqxR4OgXc3TspYA1on2/YYMfdOrq3+EUpPgNhEbBuxXPw4Z6M/VT7JBXbr0vSl7wgveyTsewNcsNsjlXolAbja45GeWzoJKFQzN15FB09+TK4a8IcOCfqNS9Fcjmm2ptdQ5NIMdL1vXLLT0dg8pH5bAs9iTDMFZlRbOhpgvVlQAkDSYm5PxxM3KXiPwsu1MJ3WhGUiMl0WoFJnZZ9B1aUM1ttKLcnZKjVcwGBD5x5TEbdC0jz1ZzVwSReLt0iqadpUdnhBZBJsw056Pm5y2SaT6I5O0q5S0FVpb7CNia7kdGrzFhHBtvNs62BzAMUo/O7ledEw3DnGZvrk3Y+pLf2nwsffkD4lWF2Yo2WsJjto/AD4BlUIxTILtXg67kVzxJh/xuFFMWkYuxwTAlWJsCT7ZkzsUzgh9cMSWwLy5jAmk/otzO3seXC+9JdO4oiewRcnhLLotSPn0M96YVIS8lxdv5plDrKIAQkrmHdnPIAW30TNdgPFLJgctZo44R0fRAK49vatcrwLieJ9hSXs2M48PmaNNZ+Gk07PsCT4O5nTem2BNqqFGtRWcTHGQPxWILZUf1oId2+ozcV3M8ihdrM2YFGo1UzHqc388rVjT9DN84jSDsY1IHARmVZc2WLVEdFeRSe2yXLbZwrDmeEZWGMG98g/NoVXy8g+MYmtu7FEmFR6FeZfhowHQj1r+xv875OOoE0GMVBTkUPQfr3+hf5m20LrNs1iwR4xnx4WmQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ab3fd9f-e334-4a7a-e6a8-08da9c8247a4 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 10:07:38.9267 (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: hdail6tiUTygD76F9sNJOyBBKC0ZquS8Vo9otkrLtZULJ8la3fIL/XjKxrpyIZIft1yUabrDla7A2zfHnA4U3DCSP1EepNeWoSgQfyXxeUM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4317 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_06,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 mlxscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220067 X-Proofpoint-ORIG-GUID: Fd2RpdTsjMXRHzH-CRhO6jqPGQHjHDOx X-Proofpoint-GUID: Fd2RpdTsjMXRHzH-CRhO6jqPGQHjHDOx Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has ses_recv_diag have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie --- drivers/scsi/ses.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index 8f5a6370f334..d5de65dc034b 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -87,16 +87,27 @@ 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, + }, + {}, + }; - do { - ret = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen, - &sshdr, SES_TIMEOUT, 1, NULL, NULL); - } while (ret > 0 && --retries && scsi_sense_valid(&sshdr) && - (sshdr.sense_key == NOT_READY || - (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29))); - + ret = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen, + &sshdr, SES_TIMEOUT, 1, NULL, failures); if (unlikely(ret)) return ret; From patchwork Thu Sep 22 10:07:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 608543 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 D559DC6FA82 for ; Thu, 22 Sep 2022 10:08:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231340AbiIVKIu (ORCPT ); Thu, 22 Sep 2022 06:08:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231335AbiIVKIH (ORCPT ); Thu, 22 Sep 2022 06:08:07 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06853D58AC for ; Thu, 22 Sep 2022 03:07:49 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MA3qlH017925; Thu, 22 Sep 2022 10:07:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=Rl+JJ8mXCi0GCwTF8CGY5ESQ7fy+WClZo6A+7tjXwi8=; b=gCCgz2EfENDjeUJtme/r3EPaD6aDTUvr0dYXg6O5wq/CaVc990FqJ3zNFONmRHQe9YLY 330ADP9R+J38mQKHl8xiLWLKGhyumCuh+0qRClKloym/crkpzIj8i7dTXHK6gW9nDfsq dNi2Np5fUUOCf3YnX3h1loImnkGNEI+IisfE4PtDPKLXZyWkqnqxkbH/aQRmyKSap9X3 O/C/UMV8wBuTPHnBsKXuYZylBT1d/0ahHDpOwV0VOD2w+uWDOS9fO8W5qL3TgGlEDPwT B5fdhNhRB+ByuRxKJ4TGSOfsJ1SXzCuDBSp76UdVfZJG3FFgtmaDLvIVbDAqBi34urgZ Hg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn69kw1st-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:42 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28M8lhls035354; Thu, 22 Sep 2022 10:07:41 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2109.outbound.protection.outlook.com [104.47.70.109]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3jp3d4e078-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CYCGePmfnhD56oimu5OrEmXtuicJG9rCQ+Xrx8Ss/E0XwTxGosBkXwYQiCf2bI+Yx/7ln76a1IJW6tSypTzZRFna6MDghKwG5etRzHbIcymeQq0k5krcZBcq8MnFvYgteF85MoXYjDTBddvM8LmhxjqQe3YDesnypz8iC/bIS+ZEu011KB7aAh2DvmD++Gf37mcMRpWZkdhOlrRjM3ilozvAaW8oGbCN4xafVVbt5xuwPmidLJUAabLNykq5QAbavTXat3iANTkkqXbVMcwLMxY/cOMi2cQ6rBH4MmecMNz2gM56kE4eYWS6nQ4hIC0scBy4/W1p+yvLIqwb0Mcq7w== 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=Rl+JJ8mXCi0GCwTF8CGY5ESQ7fy+WClZo6A+7tjXwi8=; b=nZcVyB/gvS/3/2K3Qu9A3nOrZ2+zrDzFqebpNaceIy9o7aL8MHA0KpcBUKuTOz+MY8lWh3o8XGhJWlrgMSYv51h3FCpDczkVYhF55iEZkvF1mQ87fu6M5KqQ5jQJ2t8MGm2k9+3MoXPbfLEPde0CO5WudXzj1i5bszJE+Jpk+QDXo8pY+jnbajvSdvm+rZDxjLjQa03zS8ahm/oApSGHeHQNEI1+EnlAcxUmIg4QE0IFeU43tvbIIoFn73FPgZjRJOkqY+aDQtb0UaSkb3SQFftkqdzuAOmSJdnzn2PnJ0hULeXZAvG1lUULyIwPEMujIXHA+wOWfANevbxr4xHIBQ== 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=Rl+JJ8mXCi0GCwTF8CGY5ESQ7fy+WClZo6A+7tjXwi8=; b=aAfquA7KbLwqPyNac25iVFBGX4zxOMzJ3ibE3sOuDYk7VPzXD5IH1JewVPq7WwuCAmH7JaEH8xrlUzxM4lHdKKW51x6f8lhuJd23JKxhBIkIN3hyKraH6n8bbnDFXC+LbTDGXfLAHWqtQ77IF7ibM8pi6bQrBPmDKEzWmJewAuw= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by IA1PR10MB6243.namprd10.prod.outlook.com (2603:10b6:208:3a1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.18; Thu, 22 Sep 2022 10:07:40 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1%9]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 10:07:40 +0000 From: Mike Christie To: mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH RFC 21/22] scsi: ses: Have scsi-ml retry ses_send_diag errors Date: Thu, 22 Sep 2022 05:07:03 -0500 Message-Id: <20220922100704.753666-22-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922100704.753666-1-michael.christie@oracle.com> References: <20220922100704.753666-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR03CA0213.namprd03.prod.outlook.com (2603:10b6:610:e7::8) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|IA1PR10MB6243:EE_ X-MS-Office365-Filtering-Correlation-Id: 0751fbe6-6ab5-40fe-8a42-08da9c82486f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wqqjgr3jTDNguh/x5E30uOg+KLpJab2mKEKt75czjP2S8Cf4Zx4L0a1An76vyCH4a8T5UpFty9YJL2Nog787sFjkvg1P1pZOxDOfdMzzTXFKLxbV7xWOwLfSqZLsaz7xa5OO461zNciHbTyGx5uGdNYLoCMYOWlwAQaE6dQtDEuCKUSwa/eMb+gfVyoype0P4eqQkOuD5fK//ei77eiW6sUyjUrjqo5TdU4rByXH2HPfLCLO1zHplYjLGRxXol7bjfeq4oXWNw9BmPBdTtWakrdTmxv1Qgn7tiznj1xauTVMQ8H+Ilcek0qpZXRZ7pHULX6DYXXO5JPCO2SI3oE5j1eLOTozTx8VDFpUU0G1PW+EwVPkn8rgJ+0ls1UBgCBuO7GCjsaMPql5Mb6YeK6/gKhtbYtwfq+levCzRYvRBaFXYimAG4xwspxNtgt64MJNGW4KWD3511Ty9cVhAyUXGBhnQlWI/U76VUns89+gNxRtQVv+Bd4JICfbxKXYahAwjtV2WSdNdIQ1O5U/QMKUb6j8FToLO7UOeOIsqEPTkWqYRyWV5Iq9JOLvtJ+0EXVvShWbAhHHGmmNmS5pcHUpvJKvrUmh17NbXLhjYwiWs3ojxqAM+evzIhDp4fci1Cna4VrJEKxsTuDRkqOdgUKyhZ/qVVsieI1j+g9mv9lkUoJZHDh/Kt0xLSjd7doVW2D8eyJ3CiGsOLsUzTolRuyP8A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(346002)(366004)(39860400002)(136003)(376002)(451199015)(107886003)(66476007)(38100700002)(66946007)(4326008)(41300700001)(6666004)(316002)(8676002)(66556008)(186003)(1076003)(83380400001)(8936002)(2616005)(6506007)(36756003)(6512007)(26005)(86362001)(5660300002)(2906002)(6486002)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: c7bER7iynfGsbSxQiAIn+kOi598Ya5eDBdr8i+eHxm8V/Pgleg6Fw4daIxZC9g0CcYs0tsyvCs2o4k9Adj5YuOEepR1bJBVUaV3RUZ1mkLFAIcJkFMOb91aDmAysbMip9EwGZDP6I3ChVstt8CZUzb378KPfJo+jquCBbsUc/x4MXzwQwBshLgtc6yuQYpQyUc1E7kWt+UMOsNFVIYSKDfh2YYe+m+AW4uGwBUZJyAJBG+uTF5Q9n0h7W108te9XApjheIrcjMiQWVBBBi+LsrTJIAZyP51hrIjI57CtGp/bKuDlPOL7xWWQ9pRlY9MzfFkcLHeXRGg1wg2XOUJDYodgc4aBau0HxrK1cXIl8wDU5LLy0G8iwBA+A3uiEYqpXl5nkwdYS4TMQVAuOAH2XyOhgnhirFbdo2WrXOaRNhbc89yqkd8CNCDuN+3u/wln/c5CxZMOhax/TUHBQgIviBVfyLUgk4x73YG352JO7tlz4SNJU0wS6EXcvrSHfo361bzHryEp6fy9ItEGimbk62+5syKE9rOwOEBSGcBcS7Dc9qs0XAM6/dDL+/ownOg/hbX/qRNr25diuLMgjyyy12m6aROqqu2ig/aa3SdBTffctLI7wLNj7d5m3YPYiJ26qzxZWzANidw4QtgavY2KCk3xbhkMZjt52c0J/spYgNriThbH9dcsU4eTLb9Bum+0c0QpE4zWffaMrc6zlwINPlKRKnnL19cu1T27cxYPq03QoOwjzwioYJDcq9EfyX68Ug6ZT7pgcON5KItwQuGh80+Zf2Gr81SSPv7N6Q/DcmjJqsiLswntCzkzYyTpYMngeFLFXMopkHnaINhi4w8lZGHtPyKL68c7XiazdpEnm4b2EoLkVvn1Z52PZp18+SojCmrk2r9MuZDsjLEaM2v0Muo+uF9Oi3qeSeXrPPV/8eRJqLs8nDz+UvhL41WQF4IJ42D3xRQFRLxqI0m/DSGsoGzABKg8uJ73HLaOhZqXi6CX2NxPmsCMY0mZj1jTZscr1eDWAMGEDn7kckxAKzErjwVM1VAOGL9QTLkPrnhMcNb8XTpM6kHoIMEPJNUy1O7/DTXuzokYwa4FS2jXtf4nsCdMuoe7V6uhewqf9ILHenJuQ8XYjx3IKPx8BDH4p5FCm1IYWuUnHoVKrl8qwkhAD+gA5BDB67F/dIIRpD3TSzno/rXITQs12gVChi9QHNFlPvykeXqy8emLVqOhSPe9YzQEjPFcGJFBvjZXoh4Z3Q/sJfsEiuS7/B9BmYTwyK6XWZQhnLebTLtndei3atplRO2XC/v57DfRks87QD/hXpShxPvEqacAdBPj7uy40ZbuE+hX+pQH5A6Tk31MEK3uo1KiRfxMtlHAvJ7EWPc/30HtaEE75evMH/PheoqYdp0hUsGZw0fW7mfFd30dvhSxtx7lqsfdOroxn+3PmI0OVzkhUWUgfNrNf3iUm338J1LxrGbXKFsorechU5R3N0Q80FFustO9xngAc7tMPtZ/Kn6fiTsJHk+huhjKMs10LLAGhwoz9/TpqGXHbQnGpW8CbDGT410IIb73+dbGkySwlXJAcnRRUw26ilOQ4PzZvBNc0tQXtyGeU7pqBNUyswklHw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0751fbe6-6ab5-40fe-8a42-08da9c82486f X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 10:07:40.2547 (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: 8HjlJSToPDscqX1Shtw5zHeG2ooeBgeNoQ7xPDxyA8pKUCjFH6jkEzO+K9IVWd+7I6irmo0Wr6DtRON9I9/XDAWaG6avUBuxsFK3LSNlOoA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB6243 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_06,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 malwarescore=0 bulkscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220067 X-Proofpoint-ORIG-GUID: CZIon6qvbYLygLViIXlK6mSNVhrP-bLq X-Proofpoint-GUID: CZIon6qvbYLygLViIXlK6mSNVhrP-bLq Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has ses_send_diag have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie --- drivers/scsi/ses.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index d5de65dc034b..6bcc31104486 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -140,15 +140,26 @@ static int ses_send_diag(struct scsi_device *sdev, int page_code, 0 }; struct scsi_sense_hdr sshdr; - unsigned int retries = SES_RETRIES; - - do { - result = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, buf, bufflen, - &sshdr, SES_TIMEOUT, 1, NULL, NULL); - } while (result > 0 && --retries && scsi_sense_valid(&sshdr) && - (sshdr.sense_key == NOT_READY || - (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29))); + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = 0x29, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = SES_RETRIES, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = NOT_READY, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = SES_RETRIES, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; + result = scsi_execute_req(sdev, cmd, DMA_TO_DEVICE, buf, bufflen, + &sshdr, SES_TIMEOUT, 1, NULL, failures); if (result) sdev_printk(KERN_ERR, sdev, "SEND DIAGNOSTIC result: %8x\n", result); From patchwork Thu Sep 22 10:07:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 608542 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 28356C6FA82 for ; Thu, 22 Sep 2022 10:08:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231387AbiIVKIy (ORCPT ); Thu, 22 Sep 2022 06:08:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231271AbiIVKII (ORCPT ); Thu, 22 Sep 2022 06:08:08 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65453D58AF for ; Thu, 22 Sep 2022 03:07:51 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MA3qYG017964; Thu, 22 Sep 2022 10:07:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=urWUAl/QzsAsOi/LkSvKLqSFMiAzbOeQe7iX9npVJgU=; b=Ulz00zaU4Df2P6lvLeEeQiPGXealgfpCF2LH++7dRc1QVFliNOzKuTbunHIOgJa+JGbq 9HPXSCGsP7adj6eQOxVymMdl6RFo+YCKX6MepK7SD++eoB2TNBcCjUKPOzqtFUNaJZL8 JjyYzVhftteeHVUtalI80HYDP1DiOLMDaxgLhb7rUtjh/I7IDcXhwUCjOz8MaELDj4Dm UhV6+QBBsPWGDmH/nnIOH8hgf6TF6iqj/Qlut2wKUH6DimP9k+B1GoY3cbnD3OGJ31H4 h7vajiyEkziHQTynSW9geM+nM/Q5oL8ZBeg3Td7CnlK4QILepwk2sXN+6+eClOJkpp41 cA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn69kw1t2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:45 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28M8l3sR028140; Thu, 22 Sep 2022 10:07:44 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3jp3cqdy43-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 10:07:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WuME4/annVkJNpE+oL1Sd6RllvNWmjGJ6CcmSPYccyz7oJLndTNXAKjebH2CaKrO3+LMeVK+yFVsuKUN/OD0LFEMTuGoBwLLUPc9oK6tPv2gIKri45aUfxe6Y6iLgrn0+YPvyDe1k38A04I5CKT/xqT4piWHuNgjUY0JP3g9AT/5iALggp6ssPbfw0mMdkH0y2NMr0u1C9UDpzWeBYmAJFa1lhUwDf4RYqkafGnxnq8iiAVu33hctSCYRIJ3QLuXgqOwKj9PAOfEBvxZJHarQs9W+wO8mDLytcNBGG+VgbCTezTvHBghWPlFLv/891DfFCr9/1R0wAneu6LlVPVMAQ== 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=urWUAl/QzsAsOi/LkSvKLqSFMiAzbOeQe7iX9npVJgU=; b=mU3Yistl0iQlckEjWUEhvaqmx8TzqPSVvc4jd2B9NRf+lgarOf8l4DN0dXIpObMx4Fc7fUmwcp86HXlNZ76Dihm6n0m2KHsnefQ/tLATqT4c+xK6mCQoXaYrD2Pa1AeZEiNDIrTXJGemwNLv3MZlasWoRQwBMHwMwhd6xJZv9dpvGKmy7A9xWv0vc4mUj0IEsTJs0fRfZq7sZMOBnCxdLx5uwM/9okKm6dhl+fH9LSwJRI62tE9bLadRLy4eDf+6CsB5kz6UeCfq7AKzvABMWxNIYhhwrlePRZbKQ7NCDhn81FOIJSK07MnPVrL+UL5eKoUvYse2lyTnrv1qBU7dQA== 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=urWUAl/QzsAsOi/LkSvKLqSFMiAzbOeQe7iX9npVJgU=; b=odFyLo9ef9rFNp2NF+whX/byD3EcvU2kzSp3NyL0XeBq8ivZZLtueFu1r6tuci98/cvGpeEb0pVSOYgmaR4sNknmVmbhwUY4LlnrbWaicEBvDq58nD8HcyU697Ivk/WReq9c0g4eOkm71sRVfmvvZ05yzYE2Y/L+HlOQ/5hzgVs= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by IA1PR10MB6243.namprd10.prod.outlook.com (2603:10b6:208:3a1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.18; Thu, 22 Sep 2022 10:07:42 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::bd6a:7aaa:ecd6:c7c1%9]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 10:07:42 +0000 From: Mike Christie To: mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH RFC 22/22] scsi: sr: Have scsi-ml retry get_sectorsize errors Date: Thu, 22 Sep 2022 05:07:04 -0500 Message-Id: <20220922100704.753666-23-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922100704.753666-1-michael.christie@oracle.com> References: <20220922100704.753666-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0P223CA0030.NAMP223.PROD.OUTLOOK.COM (2603:10b6:610:116::6) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|IA1PR10MB6243:EE_ X-MS-Office365-Filtering-Correlation-Id: fcfeaabb-d182-47c3-6309-08da9c824992 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0penWBO0mMW3xQ17DG/QjTsp4bcP4X0Ay1brCuySJS1NbZ4VRUGqbLxqpgQ3fxx5GkZv+t1sA3mNtj29At1RanjE6FxjlWF5/W6LoZ7Nh3ZvRHarZL0ghQI2Wd9mk+y16ildOpohUiLwJxF4SzBupWnJwn3A2w7hwI2ixi7nJtZVy81qBUWNDGPmmEZ0GyYj0/mEQKhTV422qWi1dG2YP4g6ppJlhjF2SJ/8N/PoK0078ayn/oLLKZUFiImJsAkiwqO9VPmsDP5rrLYAp+tNTsUm2MEHhhWj18E8/EdQcc/mdWl7uWbfSqEydr8S8bQuq8Rz/rYeuoXbfbp03oZaZ0ii86yFlVDK71E8tatCB3o+vkHTYrV/TljFD3i4MqkvGnRbR1aM7FeRkFMMt8myK/oNVU5KlHn4jrquBNmekPglW/nw7qST8XKcRqeKuW3jY762gMqdzLwo5YTGs8h112FJuqgHoqwKmkgGYPBzkaRiN9enxGxygiEB2UReOlkqffClSvhhpLdKF2/AldNyXxzE6QPe2De6zeaLhyF115OULNUZ/vivmirIBTv/xJKkJwWdrNQzFpuh6BhLq3dh9/9+uKfZspCDe7Y9lui/SCE5Rowx9APo7tCaLXEU+4DcnZ1V40zKa3uhrwX1BLvyG0zfnVFDFlBzry2dkn8vwtS0i2xWIPxDb6+h0L5EF2J3CJWiSDe34HqZFrobfvT45g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB1466.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(346002)(366004)(39860400002)(136003)(376002)(451199015)(107886003)(66476007)(38100700002)(66946007)(4326008)(41300700001)(6666004)(316002)(8676002)(66556008)(186003)(1076003)(83380400001)(8936002)(2616005)(6506007)(36756003)(6512007)(26005)(86362001)(5660300002)(2906002)(6486002)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kxkJdxfmcNTlJjofC+YkE7PPKKyVXrmGIK4wdI0StoGthrIiCZ5CzgiS81+h9G+LBixEYy/z9j2P4vbVJTkUE8WdKSLHkEXn86w0ntRA8CIvFmYB2xrWHPhnCm+ldYmUTC6d+6b4fzyUf6wr65C2LjB2J7tcLMyHEx+CQjlrI8S2cGzXweTZjvDPM2ntrfkz6LPjvtOKZ1t/dz/bgLPSjldAe4YsL5f+UShhjtuAIUTg5zmRetX14EyYgsAT4IBztgnkvqtw3Z77OGRL27G/oRn48ZIn5caKgd3bUloXhMK5y+11/yBV1NAxMHgS50/OHFWQa6nHSnkt5YUHgyS+JLM1T1I6qV/i3baWq70jfpibsg54Cs4aF0RMSdwxGDNATR1bprD+mU3DgPS3cvCPfYiukXkjh1DD2Y3RpwsyplxJ/NqKfylB1LDYz+b3n87hP5LITqRaRS7D992b47dvmun5XhLpeVs1FJ8iQ2vRTkJtGt4uzXnpDlqykAsNYUZ3TG7iRiIfbME2dp3UxAu4/oBD7nqO2lZp4zJGQsaPsKmbBajIsYWtdtBvyJfrvODNAWkNkTqTaaI/ifWs9bM9jXtbK0Gk/D2GC4qVNbWe/FplNBBj6w3FOi0F6XtZugvbOrqafjj6scyp8l8g82jMp4pjTxzUpYr5ZlmyD//lxAVgDbCWVzBz2TNNPEkpbNEj708yBNbWICeVUr2z9FOrdcy+Rh5B5jMFN5hGr3PCRhDbhfYgyo2eq0XH0wPwoCcbNqdB2x9rbNwjTzcX0n8LfTMK9GBcOz4q40b7yVwvEabKoLrKSBNQuKhgsa9W6EvyDQ27qx1I0YJtzvu7TnCOPGD9Qfi8FLJRiAt16G1g1t7zjOyvW0esrD0pKHK1Yx4wqI+TMS+PNd+Uxe5h32o7qjCYi8h0zMzWAbBUrWibSHYEtW7wpNpCSGnZTB4MRYuC4fxpK6ljUDQea44g0XDhMcGmg1KVslRDx/fZornC0oK7PMZ4QKseWC2/CwiSaCuYfc3XklFUfsTQZW5Z4vgn24HUacpO8sWKP2+O5zvXdabMzNuY5OuRDhwPNrRz3fSeMWdVes0namxZgZxFuTKPFrcpI/Qh5u5C9VZ+H/fNUHQh1N/hsEOVZPuaEkALrxOV3oeewJASfR2WIM1t7ATlxk7jSTh42Lp92OvwP0/DDyj/JV6/VKX7EfPgsqZqyutSHMidlI/+c0aYy+eS2A/DvWIZG+bmQAhbNahiPop1FTxXwdaW3JGGToA7XDYtRJ4tcQGeHOfiLCdjE+26WpXqilTbBtIhebIupfuUogb/1AmXSwmZVI8oZMzGcMPoVo4uKdN/VY9Lb3fGgFHfhphiI1qrHylkQzgp1lltUDOMMd2cFndlexldIAGxKR6bhpp8ASEUEENmnL4a87M1K6voDKzA3zefwpjyfsQ+HaKNB/2bRR/1Jqpk/fWmIAHEZ0sSTeT3g7XqC8L+kNnYJ11n8jJytIcv/hn7BULGTPipK8Z/yWMW0vcvaF1n/4Tb0ovRTYMb+vbmCafeL+fyiEQG2rudpDrJI7XcmkG69+YguT7rP+x5HzmFXSF5ktLjprwkd5kANRxKdwK9lLnHH/GwMA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fcfeaabb-d182-47c3-6309-08da9c824992 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 10:07:42.1608 (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: zgf81ksX9zX9IqeHbV1PaghuzfAyYvU+aksHBFqtoplzZ4pee6k0G9GilTi+ayKzm+Uz0Z+DqmwbkwfQaVIqgXIUi6JZwew/UinM6/ZY6Jw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB6243 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_06,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 spamscore=0 adultscore=0 mlxscore=0 malwarescore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220067 X-Proofpoint-ORIG-GUID: -q8SbVzPudPgFdIbrZ7vScBH7rDMqQCb X-Proofpoint-GUID: -q8SbVzPudPgFdIbrZ7vScBH7rDMqQCb Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has get_sectorsize have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie --- drivers/scsi/sr.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 8b28a8a28b45..cf1f498671f0 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -720,26 +720,25 @@ static void get_sectorsize(struct scsi_cd *cd) { unsigned char cmd[10]; unsigned char buffer[8]; - int the_result, retries = 3; + int the_result; int sector_size; struct request_queue *queue; + struct scsi_failure failures[] = { + { + .result = SCMD_FAILURE_ANY, + .allowed = 3, + }, + {}, + }; - do { - cmd[0] = READ_CAPACITY; - memset((void *) &cmd[1], 0, 9); - memset(buffer, 0, sizeof(buffer)); - - /* Do the command and wait.. */ - the_result = scsi_execute_req(cd->device, cmd, DMA_FROM_DEVICE, - buffer, sizeof(buffer), NULL, - SR_TIMEOUT, MAX_RETRIES, NULL, - NULL); - - retries--; - - } while (the_result && retries); - + cmd[0] = READ_CAPACITY; + memset((void *) &cmd[1], 0, 9); + memset(buffer, 0, sizeof(buffer)); + /* Do the command and wait.. */ + the_result = scsi_execute_req(cd->device, cmd, DMA_FROM_DEVICE, + buffer, sizeof(buffer), NULL, + SR_TIMEOUT, MAX_RETRIES, NULL, failures); if (the_result) { cd->capacity = 0x1fffff; sector_size = 2048; /* A guess, just in case */