From patchwork Tue Jul 11 21:45:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 702180 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 34229EB64DC for ; Tue, 11 Jul 2023 21:46:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231395AbjGKVqk (ORCPT ); Tue, 11 Jul 2023 17:46:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229766AbjGKVqi (ORCPT ); Tue, 11 Jul 2023 17:46:38 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 252FF10C7 for ; Tue, 11 Jul 2023 14:46:37 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BICxp7019634; Tue, 11 Jul 2023 21:46:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=+Xk6AFBtZb4v86xDSnKHhUr3SXxNU59+woQv9SSypJ0=; b=ZCwDR5X+L6CQcOCoVNSYiVhh4cuvofd8Wou0WHcwQhSmPUHfbtlJLiPTO3x7btxdBGJi en6iiwY2Vm0frb0WYD8t3w+M1iuzN7jVRg68qifFqQW9Jrwvc5iCJZYkD/GSWxwrXn11 XNMQ5XaXRdRPAeIqAzi38ZmH9Aox/8DiDCPAX053YQp83sCe9qKrq76n0ozRn/AhLwPn ZoPDFX8C7Ps+8kCDDOvBXKYj6qDapu/26Al5vVox95afulz29qSJNciM/X6zLtX6AKeo XeY6uT0753Gp5u5w7brrl0KnLnI3UeYk4Od/k2a6WMzD1IGcpMxHpjUgOrIrGl4Ch/sQ NA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rrgn7usmr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:28 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BJvGQN007159; Tue, 11 Jul 2023 21:46:27 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rpx85h0pm-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=enuYYisVNW/Kz5bVBziskIlj3lNHOU7Zqdg3Tuw3M+dz0vcowwxs+npNhToGFIx0sRmd1NEs+qHS48s2mQ+tx7NDk8tAlgJnPngJMTTvcM+x/paiRXVGmahv2O87UEDB1sO260eW2XkkYm+2gAp8swJdCkGJ5/87/CVOeBTDY6XJl22MTAcrvaQROs7pWnCgB06JWCAE2GkryB0H8bMZlCVnl6pYveKb++vPZQnDeA92cEDb0ldFIIPo5Hu9ikSFgODv8tAV9laCB0Blp5vds7A0T2zkjiE9zS4tVFU2YQe+4BwjNbqzVELL4Ng1zaIht8ESnIS4oFVnDZVucfqzSg== 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=+Xk6AFBtZb4v86xDSnKHhUr3SXxNU59+woQv9SSypJ0=; b=PVDa5AT5VvlfxdtdbZbluEZMbcGeSBI72mRGt7H+tO4BN9Crndmf1PrvOgxmuY5gunvqFrBEQDIhj7I0+IdqAuZGYg336nBfoe99n1embqzwWUoiL7T0Vi793Yqv3O/eQf5WI34pfWPl+4mDt3suAIFuOMK8ttdaEKq9IwOziun8w2wROKRbLQpqYQuCC8PPllV0qvjppoobBjYnte9cHS3NUof15twFSUQOPgRv4t2Zg6RKlTcVhLdfQksLMurlI28DlSlykt7HbtQ2P3KTG0S7TbmVBsjMYSladjYQuxM3u2zEjyICo68ZFQznMgSzuGdrsTY5udtNKqBZ6xwOrA== 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=+Xk6AFBtZb4v86xDSnKHhUr3SXxNU59+woQv9SSypJ0=; b=MywjKwjLpu84x73V3/ZOc+rAgatvmNw4dvRspos5FcfYa273PXvMsof28Tm2iZk7gBTG91Q7Xd6U3Syy80KLeCuZ7TEr4gpgVIuQ+n6JBRYCgVljqKmaOjq2eV59CIQ3jDU8UqUx7RcHlr+5571055Tel4DQaG99tbQ2K+8T9Co= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CO1PR10MB4450.namprd10.prod.outlook.com (2603:10b6:303:93::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.20; Tue, 11 Jul 2023 21:46:26 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:46:25 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 01/33] scsi: Add helper to prep sense during error handling Date: Tue, 11 Jul 2023 16:45:48 -0500 Message-Id: <20230711214620.87232-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR13CA0027.namprd13.prod.outlook.com (2603:10b6:5:bc::40) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CO1PR10MB4450:EE_ X-MS-Office365-Filtering-Correlation-Id: 54d9895a-9f73-4e3f-ee5d-08db8258469b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TjvYEwTzDYredrH4a8OZ4sJJq1CcedukkuiTy85mimD+85YAa5DtpY4MnoXQoa60Qgz0XVvFAtTeEv7wZctroDEI7SQdwK0Wt7uFtyBLrWo5MlxvuEVVcMnAEB71o4ZI1uOV7yaOI6BWCJAZ89XCjIwgKXQPahTMfTdlBdSU8sJaML50Pqoa1g/C/FzRh38LSyM6XxQaxcYGOjKRUEraJtfkKprq0M17PS62TmXcKemu4FCjzTR7ima7KlLm6jf4xQniWPRhQuYQ9dl3fBz9E0u0OgHjQvouXeFs9YFN5PS3G21d0Q6ynvtnHJjSywc/qprUpwfe4srCcHTOCpFuMkTuazGDsVY+tH57JQZoSZdg+qBunsd7F6bROMNNiOQDBRNKdCx4PyEES2gBg9Pv7WjZ0NF0uJWnZOmB1+Iq3zd3MAaePhS1+d+m2NPyq6tUcM+rIlrIkERrZrKla3GWUtZcD273ZX5NNcVKh/YztSP7srQGzx3LV3/Ez2dzUsQAHW3RoOooJY93JvWjpsoRPVMuzLxLfDPUx5uhJg4Y42RHglA7p3hev9/kVFavFO1P X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(376002)(346002)(396003)(136003)(39860400002)(451199021)(83380400001)(2616005)(38100700002)(36756003)(86362001)(478600001)(186003)(26005)(1076003)(6512007)(6486002)(6666004)(5660300002)(8936002)(66946007)(66556008)(66476007)(8676002)(2906002)(41300700001)(4326008)(316002)(107886003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6DlESjEd9DYPjMkztSjPnYNXjXYM9XygzIiJ+2qGZwmqSK4sSwyADY0lNwt1g9Hk7Vkp1t1xlouNlDqrZOwuOynJBGhwgLzl08RyWUzFJ4E7yqRSGx1KfacqniZyBU0hchHetCXbMm6+hId86m9UVkO8XwYJ0vnz/x9KXO91Vw1fCi0RabAHiszVTMnoQa2cbI8RyJ9HK7RPDEWH6Lf0JMnVK+qO719eX5CAJQOej6Ojq1xF6ZjEkufPYzi2BalNRtov6FGxqmDsNZHQYp9yn4hw3QVCpz7MhcSlI+FrK1Ot8a3qdyhgm6hZE/DV50EiQLqQOuqZFk/hFCJVZv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BXkvmRNn2EMsWpsqxiiEu2iaps2AEsXpIZS9Dv7yJZaL6ryn9wuBZFhgcnSi9qMFSvZA2gL6y4eOdzc2+pz6paPzyujeBnOpuju X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54d9895a-9f73-4e3f-ee5d-08db8258469b X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:46:25.8238 (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: 9GkKw3puE955Y1mLEzQX3Ow2lf/kcpgUDSiF9YFKbHddP9eiarj2/wQ/bhvVtj4j1jm0G2tPVvSk608Nt9raOeDaUZETqlFI2Rv28+k32Ww= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4450 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 spamscore=0 phishscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-ORIG-GUID: s7FutIZZb0Qo1gpZS37rmcSpYWbr_UZ9 X-Proofpoint-GUID: s7FutIZZb0Qo1gpZS37rmcSpYWbr_UZ9 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This breaks out the sense prep so it can be used in helper that will be added in this patchset for passthrough commands. Signed-off-by: Mike Christie Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Reviewed-by: Martin Wilck --- drivers/scsi/scsi_error.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index c67cdcdc3ba8..7c3eccbdd39f 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -523,6 +523,23 @@ static inline void set_scsi_ml_byte(struct scsi_cmnd *cmd, u8 status) cmd->result = (cmd->result & 0xffff00ff) | (status << 8); } +static enum scsi_disposition +scsi_start_sense_processing(struct scsi_cmnd *scmd, + struct scsi_sense_hdr *sshdr) +{ + struct scsi_device *sdev = scmd->device; + + if (!scsi_command_normalize_sense(scmd, sshdr)) + return FAILED; /* no valid sense data */ + + scsi_report_sense(sdev, sshdr); + + if (scsi_sense_is_deferred(sshdr)) + return NEEDS_RETRY; + + return SUCCESS; +} + /** * scsi_check_sense - Examine scsi cmd sense * @scmd: Cmd to have sense checked. @@ -539,14 +556,11 @@ enum scsi_disposition scsi_check_sense(struct scsi_cmnd *scmd) struct request *req = scsi_cmd_to_rq(scmd); struct scsi_device *sdev = scmd->device; struct scsi_sense_hdr sshdr; + enum scsi_disposition ret; - if (! scsi_command_normalize_sense(scmd, &sshdr)) - return FAILED; /* no valid sense data */ - - scsi_report_sense(sdev, &sshdr); - - if (scsi_sense_is_deferred(&sshdr)) - return NEEDS_RETRY; + ret = scsi_start_sense_processing(scmd, &sshdr); + if (ret != SUCCESS) + return ret; if (sdev->handler && sdev->handler->check_sense) { enum scsi_disposition rc; From patchwork Tue Jul 11 21:45:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 701789 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 7DCA6EB64DC for ; Tue, 11 Jul 2023 21:46:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231550AbjGKVqs (ORCPT ); Tue, 11 Jul 2023 17:46:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231488AbjGKVqp (ORCPT ); Tue, 11 Jul 2023 17:46:45 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A5C91731 for ; Tue, 11 Jul 2023 14:46:42 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BIDIgJ015176; Tue, 11 Jul 2023 21:46: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-2023-03-30; bh=9PSKnlPtkOKH3NW94cepcvcYF4BkegtoT1TjWo7QSmU=; b=C997ESqpo3K3TMXsSJWE3Gd4rIfNkMlM1W3kM7n+RT+PIHGlBJ00dlEW1Fscs9HJihRm HP44+H2zemnBgOAg1cNzuzw0H7RQ+Be0psBOHeqHPmG17QsMdh2+24JuGFcsWcVsVL92 sJ5ceqK7YW/0/D0s8xXLr0D1pD08hvw3BIIyylUeK3xYGHZr9IGuWrYk1uv+lMN05FbC YgwL1PDpxoc2Edcj/k1jgDdzAPIjabhow/8C1+OY4gFcDmjTLmxMOkcvKLf3IQOOur0M AWeLLvIzDqXL++ehb/yEyO24BLaxJXE2izN70DKiW6lH6nkTXQMxFwZOJF+e/Bf3UabG 3Q== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rr5h14kp7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:33 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BJtCRn008317; Tue, 11 Jul 2023 21:46:31 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rpx8bsgs3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gMhnbpltLbUGDwNp0NX3THav7opkJjBc01+jf0hlT8fjJZ+wGl2UY93/rtG7L4JSSy6XQLMaWgVYd+PYPhWbJMrRS9Crv8r42JFyZSFxGNbm8uoU4YwvsWiq7b7zLNUlIZy/66AFvGfq3wZWmO9xSmHA2VidtoJGoh3WZrFqPFMdVR27O84Fz9tCSmfAZsrbXSCM/Q/JW4psuUX15PXhE1fLkhIQBhyrNhn/+wmniXs3doC4Twfe7/XZcZl7htQMUsTECf9AlMvBpzu/Ycur1ldjhAy8z2+0Mt5AvckGtGAIH561ANoUXyldrTUH9YNWtuGslqT3bT/B21M+/d/7hQ== 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=9PSKnlPtkOKH3NW94cepcvcYF4BkegtoT1TjWo7QSmU=; b=Tw0448czgjDG2Q2Ja3qJMgmyma4jeGMRzlDGfzelINn10IbI1khfXBn5sjPjrHGdfnf2GNP8MVxyybVj65yp1vFqT3pZQkez2cBFb2iuEYZuPsczvprob71QRxHSLs7RsrDUmgWX5DefkR3PhbnPcjwbgg9uNp54BrMKWs28LFeFcmUuQdwZ7AfYuVtazLoiWcTSXukZtxZNaUQnGn8eI/rW00+u01fNsICIWIgKWQb/tm0XBm58dH36iR9BLEIjqbgLdROYSXQbdUO+kHZRHSgWGOFU830Ey/jZ7Tc6qb8utEffqPkY/KxA8fBurX6XZ5OR/zl0DWXmcFL2+nrwlg== 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=9PSKnlPtkOKH3NW94cepcvcYF4BkegtoT1TjWo7QSmU=; b=iztOiYjgxUrXiRPO1lFIHsl91aagoWgiUAUp7raI/rkjiweUYCb4bDV/Qf31qc3fz03oQz3ob/HGUT9stKLj+ojxgRwv2SXs75mSB3UKr2rufpzXVh+1xklMeA+TC00w5vEJUCqlwPK/UYDWdfc0De038KH3gIXQj+PM2Arbt2U= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CO1PR10MB4450.namprd10.prod.outlook.com (2603:10b6:303:93::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.20; Tue, 11 Jul 2023 21:46:30 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:46:29 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 02/33] scsi: Allow passthrough to override what errors to retry Date: Tue, 11 Jul 2023 16:45:49 -0500 Message-Id: <20230711214620.87232-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0058.namprd02.prod.outlook.com (2603:10b6:5:177::35) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CO1PR10MB4450:EE_ X-MS-Office365-Filtering-Correlation-Id: 4dda0f8b-cd94-454e-60a8-08db825847a9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W5AyHjcrShKQMHfepPJ0xQH6hr3KnU4dDej8FT128YscGEsNuKKl04aA9iTtJB/vhB8t3JpErl4glQaWzwMBFU1ThjfyAufWEbc0xQGRUeHhvvZyg5rE4eR/tPtFOhC6cV+lrhpdOKwYFDYpbUvtbqTqLHoXWP9YmjLVUCiOZaux7+Zqx1n6akzaApAeJzco6+D8tG1sNLmXNKvxhKR6mrslIjebL23CDGj5b+JzCQhju1aibL+gz6sQd0FUr19EjGV4SbUsHfVZ8bSfyr8P3z2wyH56rE5XmlTeBk816q34I6DMSJCuWJCbObHNyoZ43T5LqjyB/EShaYlWtRwjy0rLmxVq6APo6QoOOy0m5MJeqrIoG0vCsZd2GJCaC9QSkdDs4QRXzxqYFgWUAiszv2kMxwZULZPaLY6TldYsTn5lrSqwmNzbxFJXUuDSjKh8u0rv+Al3m3i89nFDpFH49nVMI5/gwy7TQu9D7sVrDiI0LfM4PcDj6Ah6KbnQyaECD9tDZQkc0do5y2Zuae6xCOe8dRCgsAwbes7QAh36EjnfHt92Y6BpivU9ioXXKQiS X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(376002)(346002)(396003)(136003)(39860400002)(451199021)(83380400001)(2616005)(38100700002)(36756003)(86362001)(478600001)(186003)(26005)(1076003)(6512007)(6486002)(6666004)(5660300002)(8936002)(66946007)(66556008)(66476007)(8676002)(2906002)(41300700001)(4326008)(316002)(107886003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XRU1MPghZNuIAMqCk5Ujp9ix5fRiEZckwHKm/sr1599HxUv3JlBF92WsqRGdh5JFMbHC/5CC0+jY54fdnJ0DDXYQRHRzgg278LVnXiF6v30xqe6971qpjXp0j6webOquuEY+q0k2YmjKGFfo6s4p5SrF6iefDiEmnfmQsSBtxA3MKTWNnWk7cZlK4CMnp5tnMs7ZfkbMaa+K6NDz7+WmPMnP/SFPLJSSktHgwGXOF7INxckICSsnOxtBUiqbkIfqZ4N1camHVfYvlVWW4DubQZ9jqXyADtKB6qLL4xo8maAopYqaRB6aOUYxOchJxD4NG0FJxu8+Ly1YMBbyMt+rZ5iAhrEcR+vF8CPHPTUnPcqllilcDvr9RHrFoTTolwJKBhTb2tUPGth8Infv8N0inlL2yXfjWliksJ598qZfqlDxhgpcqouH7zSi9mrLUCKAYDk5Z1v7t5o3+k+oANbWLr3E8lJzhq/n5Z3un+MYT9tHzs+/u983nIWp1+92UFmSEtEMogEEGuek0YuY6pg1nypBV/vIn045COBMEkftMnx0URhgTQRMq+TviSotQmVjVPTn4QdRKv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Count: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: d+poRB2x60cKV2J6DaXtOwlfnwOxUKCHttgRtpra6kQcbjrrVYxLnxjl41Qh1B/j7/Lvvp4AJN0oCskTYHVGC91LrZOdYEdE8NRuDnOMzD/VXJwdVBnpE6JkKdbPRqxWtkdMfq8vRlE7kqPATGQrlXd9fcuYD8dzsj5or++ZSrhyholQvk1fVh7SQSgiIqbTiRHihE2MJ8Y/axNCF5TeR0Qkn7f66Uw6J5ZOQM+nzp9OHtOLAHNM+dCrrSJnnSAT/IP99/zGTElANj5lwoOdPtYUhS4zFbODzzwjzA1PhjA75p8WV9HhRsB5axOdo4RPBc6oXc3XY41Wcs1VQltSsfyFkrCA7ypdIN0EkKpUc3EbyMayrOVK9zfB6ikJqbRe6c3m1W2f2/FkymzibGe6IJCWNf1DWkBr+s2uKyC3HZlwn2FNJbKfHbNSZXfJSLEioGpE3DfPxxNNkm1pUjqS3p0v5i1IfqTBPWdeHz7XtWnpcw1W+tU7GItptpB28TvxqfJYfqZIiko42/AOXIDspPTrQna+H3Q+O7ozEY8sc/FuQEAw4esvpALI6z2WUygegs1KxLx+0EyddUUpuMUmHQRMUJ3CzZRVtUiOq0eRMxF/c6y50qmkt/Y+WSzcmlMt2zakmkw7RXXIQZhivin+m5H6SoDYXEQFwkV62LAgrrsz71qc1gBUY03/8aVgdAql3VN/wH9WAkfAGciehKW3Z8EOHiWqyat+0+efU4opg8DZ3J7huRmOEgJlQr0vfon0jcfKFTPO+bmfs7E8gDhyMw+d0XuzXxgtMhUwR65z+JXPRwsNnQt1p9KifWtY43L7UcmFvubhw5aV33HrUWSsB5etTnQaLquNc9uD1j8eyMzUxQCZ1hroXJQg51piEW9w X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4dda0f8b-cd94-454e-60a8-08db825847a9 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:46:29.8194 (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: EI7SvEsLbYuBDpaCRotI7jXR+BHbxooDp8MTDleKvgSjhZwVzlHsPO6B/Qvt7b0bXcTaMNNisZDoHojtNqMojbnLoP8DEXwPGQIE0tD54so= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4450 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 mlxlogscore=999 adultscore=0 suspectscore=0 mlxscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-ORIG-GUID: I2vWxNPnPwGdoJyLC3NiZ0qPES0QZiqt X-Proofpoint-GUID: I2vWxNPnPwGdoJyLC3NiZ0qPES0QZiqt Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org For passthrough, we don't retry any error we get a check condition for. This results in a lot of callers driving their own retries for those types of errors and retrying all errors, and there has been a request to retry specific host byte errors. This adds the core code to allow passthrough users to specify what errors they want scsi-ml to retry for them. We can then convert users to drop their sense parsing and retry handling. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Bart Van Assche --- drivers/scsi/scsi_error.c | 80 +++++++++++++++++++++++++++++++++++++++ drivers/scsi/scsi_lib.c | 10 +++++ include/scsi/scsi_cmnd.h | 20 ++++++++++ 3 files changed, 110 insertions(+) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 7c3eccbdd39f..d2fb28212880 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -1872,6 +1872,80 @@ bool scsi_noretry_cmd(struct scsi_cmnd *scmd) return false; } +/** + * scsi_check_passthrough - Determine if passthrough scsi_cmnd needs a retry. + * @scmd: scsi_cmnd to check. + * + * Return value: + * SCSI_RETURN_NOT_HANDLED - if the caller should examine the command + * status because the passthrough user wanted the default error processing. + * SUCCESS, FAILED or NEEDS_RETRY - if this function has determined the + * command should be completed, go through the error handler due to + * missing sense or should be retried. + */ +static enum scsi_disposition scsi_check_passthrough(struct scsi_cmnd *scmd) +{ + struct scsi_failure *failure; + struct scsi_sense_hdr sshdr; + enum scsi_disposition ret; + enum sam_status status; + + if (!scmd->failures) + return SCSI_RETURN_NOT_HANDLED; + + for (failure = scmd->failures; failure->result; failure++) { + if (failure->result == SCMD_FAILURE_RESULT_ANY) + goto maybe_retry; + + if (host_byte(scmd->result) && + host_byte(scmd->result) == host_byte(failure->result)) + goto maybe_retry; + + status = status_byte(scmd->result); + if (!status) + continue; + + if (failure->result == SCMD_FAILURE_STAT_ANY && + !scsi_status_is_good(scmd->result)) + goto maybe_retry; + + if (status != status_byte(failure->result)) + continue; + + if (status_byte(failure->result) != SAM_STAT_CHECK_CONDITION || + failure->sense == SCMD_FAILURE_SENSE_ANY) + goto maybe_retry; + + ret = scsi_start_sense_processing(scmd, &sshdr); + if (ret == NEEDS_RETRY) + goto maybe_retry; + else if (ret != SUCCESS) + return ret; + + if (failure->sense != sshdr.sense_key) + continue; + + if (failure->asc == SCMD_FAILURE_ASC_ANY) + goto maybe_retry; + + if (failure->asc != sshdr.asc) + continue; + + if (failure->ascq == SCMD_FAILURE_ASCQ_ANY || + failure->ascq == sshdr.ascq) + goto maybe_retry; + } + + return SCSI_RETURN_NOT_HANDLED; + +maybe_retry: + if (failure->allowed == SCMD_FAILURE_NO_LIMIT || + ++failure->retries <= failure->allowed) + return NEEDS_RETRY; + + return SUCCESS; +} + /** * scsi_decide_disposition - Disposition a cmd on return from LLD. * @scmd: SCSI cmd to examine. @@ -1900,6 +1974,12 @@ enum scsi_disposition scsi_decide_disposition(struct scsi_cmnd *scmd) return SUCCESS; } + if (scmd->result && blk_rq_is_passthrough(scsi_cmd_to_rq(scmd))) { + rtn = scsi_check_passthrough(scmd); + if (rtn != SCSI_RETURN_NOT_HANDLED) + return rtn; + } + /* * first check the host byte, to see if there is anything in there * that would indicate what we need to do. diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index d32f1014465f..53cb649b2f28 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -184,6 +184,15 @@ void scsi_queue_insert(struct scsi_cmnd *cmd, int reason) __scsi_queue_insert(cmd, reason, true); } +void scsi_reset_failures(struct scsi_failure *failures) +{ + struct scsi_failure *failure; + + for (failure = failures; failure->result; failure++) + failure->retries = 0; +} +EXPORT_SYMBOL_GPL(scsi_reset_failures); + /** * scsi_execute_cmd - insert request and wait for the result * @sdev: scsi_device @@ -1129,6 +1138,7 @@ static void scsi_initialize_rq(struct request *rq) init_rcu_head(&cmd->rcu); cmd->jiffies_at_alloc = jiffies; cmd->retries = 0; + cmd->failures = NULL; } struct request *scsi_alloc_request(struct request_queue *q, blk_opf_t opf, diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 526def14e7fb..9a3908614dc9 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -71,6 +71,23 @@ enum scsi_cmnd_submitter { SUBMITTED_BY_SCSI_RESET_IOCTL = 2, } __packed; +#define SCMD_FAILURE_RESULT_ANY 0x7fffffff +#define SCMD_FAILURE_STAT_ANY 0xff +#define SCMD_FAILURE_SENSE_ANY 0xff +#define SCMD_FAILURE_ASC_ANY 0xff +#define SCMD_FAILURE_ASCQ_ANY 0xff +#define SCMD_FAILURE_NO_LIMIT -1 + +struct scsi_failure { + int result; + u8 sense; + u8 asc; + u8 ascq; + + s8 allowed; + s8 retries; +}; + struct scsi_cmnd { struct scsi_device *device; struct list_head eh_entry; /* entry for the host eh_abort_list/eh_cmd_q */ @@ -91,6 +108,8 @@ struct scsi_cmnd { int retries; int allowed; + /* optional array of failures that passthrough users want retried */ + struct scsi_failure *failures; unsigned char prot_op; unsigned char prot_type; @@ -394,5 +413,6 @@ extern void scsi_build_sense(struct scsi_cmnd *scmd, int desc, struct request *scsi_alloc_request(struct request_queue *q, blk_opf_t opf, blk_mq_req_flags_t flags); +void scsi_reset_failures(struct scsi_failure *failures); #endif /* _SCSI_SCSI_CMND_H */ From patchwork Tue Jul 11 21:45:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 702179 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 32E6DC0015E for ; Tue, 11 Jul 2023 21:46:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231497AbjGKVqu (ORCPT ); Tue, 11 Jul 2023 17:46:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231534AbjGKVqr (ORCPT ); Tue, 11 Jul 2023 17:46:47 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 222BF1704 for ; Tue, 11 Jul 2023 14:46:45 -0700 (PDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BIDCQi003228; Tue, 11 Jul 2023 21:46:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=I0z+1LUB0S36t00ZKL+XxjMuxLQDU/YxeXIaUXER8v0=; b=MoVPSY2Ya2N/rhB7466+G31UqYKW44MXsH0Bnx5RGdNQi823/aG1s4eN/f4dwHtvOJ8A k+gZN7Jf9ryYGAqi3rOBXi4WbHaIF8bKf3xMpD2d7FgIRyMHe8GweVSuCHvU37AUcsrK M5wl258jnU5Q27Q5obgrv5Vf9u+cLaqF3o2NwhlnIouVgs9JcBmXE9tgh1NmIBVRRa6j ZIAFTvX6N4VzO8jB5q/64FbiM98QBCfWs1bIpm/jgwSG2o7SKup2FFGq7ohsA9EQuFUj Bj0cxvXNHgW/R54F98QiEntqROUiNDrtJeKmu8zviSN7mFicGjuJw5aATxhIgGtAdqBp 8g== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rpyud647d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:35 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BJtAUB026913; Tue, 11 Jul 2023 21:46:35 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2041.outbound.protection.outlook.com [104.47.66.41]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rpx85h5q8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fr7ghn+moNli0RcntR+ajFjRtaH1RGkI/1nAhcpI3n5h90EJjY+bTjWXDG73cU/HK5aFSFNrUf+p8Pqq4BxmFHHRtvntmRTTYLnJzTWZnrQoj0hUQntWXjNV10Ep0rEhU1FomiqzhUlEJQ9tQ0nCvWnWSYODn4FbrLmK6R04jbnifrBeRIYF+Gjfd0INSZPcYCxkr+SE8ev+BLI/MYU1fhyfI5v5i7vT7dcGogKF1IsPjMnmv/rs05frK+DwGAiTzzP4dgk4v11beyqD5ZcHtrFilwL2b9cxw9dwbjfjVlnNGwJONlxiGm0CY17FGREIwE009S9ldt75TDYvDwKoAQ== 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=I0z+1LUB0S36t00ZKL+XxjMuxLQDU/YxeXIaUXER8v0=; b=nGvzQZNhNYaMJxlu6zTMJ+WVBVUIMMZ/baHwkg2oZMe+t7LRaa8OCYgCf19qud4HbIW/yXjDLsiqhyZ81oQBVB+AtAnRwatq+6P0CuNvIs8DbC1mglcUl+c8LCmheKK0BUHTupeby7JLv5NKGHdAYzBt58tV1/Cw4Hoi/utgajzwJzlkNY9goUamsqutmwTXBqNEC5xHzNxkTUx0VmQiNYsNOmJKqmZYMIZ/j2Pa4vx6pT3xQGouYvtfHJ1guxVMpGjaGd2d5BzRJ0WCfI776Tj/8diChfzOvc+CPHHnh2XtYaOnqgA3fM9Du+oRqzXF6Wzfp0exm43YZrQIjJRqwg== 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=I0z+1LUB0S36t00ZKL+XxjMuxLQDU/YxeXIaUXER8v0=; b=kibQdZ9bnCqRuRHJAqnbl/aN5tSUSuMWoxmR1AVVku2CbC3+H9KIiEe/CozhlOoKeVWg5+pBg6t7w1Q7Icjp9WbJbbvRGruJENvijuuQuea1wuMkBnnJKHPDCqdbkCBVDnDoWEYUlgOE/DgzCXSXEVQPCKHy5itKg3UNBMDcwO0= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SA3PR10MB6950.namprd10.prod.outlook.com (2603:10b6:806:31d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Tue, 11 Jul 2023 21:46:32 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:46:32 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 03/33] scsi: Add scsi_failure field to scsi_exec_args Date: Tue, 11 Jul 2023 16:45:50 -0500 Message-Id: <20230711214620.87232-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR05CA0069.namprd05.prod.outlook.com (2603:10b6:8:57::21) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SA3PR10MB6950:EE_ X-MS-Office365-Filtering-Correlation-Id: cceda902-638f-449a-babe-08db825849f8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z/XbBX3hvYw7GnqnPoKrYdEToVrHE6scwCs2gPqffbWgTlsmaaOuEsmHYhYLXsCzXVvkdHcjRZo+JXsBZ7hhWR+Zs2th39n1G54gfs+oR20HXem1rwW0KOIEqTKf4m5BRh0yvX4MDwFtk43cgOPZq9bc3N8js013HCx88TlQSxkBHdriwAMiroOy8CcPKJm6dTetPqEVXr6pK2MrhJy9gxrhdvzE3ub/yg+Qk+7NEof9gkXwcy7egPZI1TU2Z0+dlvyhjrFyU3cewT9CJgWWngVlJdOP4JOOCDoRIMpS/IN+IYTkEgi9/jEJ+qShDAxF3eA+12SSHsfjR7OtS+pv1AmEI8VipQt6uidKo0ux9Jhq8Z5jcMV/PaS4KiLFk92d/+OcTiVzCk1pNvbd2BCEoAYKF4jEXwI5yv3wQ4UCG3LJungwH5xllCZtOEcgyr/qz1MyLup7vboVhca1ef62OXT6A3hcHcbDy/6c5ZxA79k+Sk5FduWSbJ19aWMA1ukWpzop82C58XbkqYDkLM+q+5QGEGetPGw4rhO6w5Y78lIIrarqHKh2TaZ0kEXBw1Yc X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(39860400002)(136003)(396003)(346002)(366004)(376002)(451199021)(186003)(6506007)(2616005)(6512007)(478600001)(26005)(1076003)(107886003)(83380400001)(41300700001)(4326008)(5660300002)(66556008)(2906002)(316002)(8676002)(8936002)(66946007)(66476007)(6486002)(6666004)(36756003)(38100700002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-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AsgLyCXfu0q3KtcdwiJNzmNnhHlbwNhk+tEcZMirBSugM7M1RH5Ie3+IiKNNI7bYSgTHRddVitMh5DGxyY8XnUPosTVGOSwNd6mu+Nv0EChsGUloMNazE827Q1wPypX+iAwh2gjZVRymzqDquI2Yj9YqlZK1JLrw/y8FlogbOMcdSRyLgHRSaMDXwApVcg6HlkDFBcjcS/4FaSun4vyJdkgZliA6dqJ13MjKUVa+RFHUrEl7Q6VqCj21I2WJVbCfdLFRLOfJd8bim4x3j6QYCGNN09H3LvGuFtJMjqZ39KPEn4l3BplAdaB8KDhVapJjA8BRUWU9ZnGb/9VKsH/dfSGOu5489pjlzG1Y5vyBHJOBTrQtWjuOuFwHFtPx9oMsgY82ILjqOnvmFhXAWeD+kmvXxu1LBk7pkPk6EF8ibn++a0SYKO/kq45QaM+8qy4H/e2NFfYKA0VZFvheLN1jhkOX3iPEMo76ogehEAJL/+W/2xSQUeiGcIqK6inCif5PvewgFFA7EUhKE8crczjFjFL/RCIJryjrnR8c4DzD4A== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: erYz2SO1R82o+/ooxK7kJA0NXy9R59aU22EIKEsZ2xnfepsRbJAbk+QWHDyob9/SUJa56TnNLbg4Parwe9py72+4D5lx83NiEzl+ShmtXbYiub+Yyah3jdsjTAzW0HWQL3IF8/tgJfv4qBOqNvge2E/AUFkt05Lm+EiawOa5DzdUgw5o46JppIAllaM885P3yQhnmLdflexHIYm70zDU5nCQyrTK2jpnjwIAPAm8m5rDuaF7g0p5wYgfI4kxUpx7YD2ZfxUXpavLE6ailRfJtHO49+S4puIHvH5YWrxdXEDeW41PHe7jd0hRpI85RfspSBy2iB+s7D0WWeiPXGy/oFzGBiSHIXh7A6uBsIw5bm0WEspOLQ4S+tIccTVAq8i9cUL/J87vAvLsT8psPJMK/I2qY/k6R80ZJ3uiUNX4as3ngLJC0ldnXDbgcYzPL24HuqjLdV6UXL2jiiXz2LQo/LIXhpKpMQu+1gezZQpLhGTR5BHzT7ZR1ehwIZZSeC0eYE3OeP0jIYgtqDgsSgzhF41InWEwb4J9hlgjp9zME8KQ8w4ZwgcnZGIAFl82E+Cb0Kc9dQ3wzZbjDGWhsMRL1OtrxK9Yi1paLSPi7noygIfkhMpKmD5P4IYqtBpEbxPO8M7FzIJpRAuq3UZqKXRHTQEkS/738dhvjC8FlTOZkYOMPmS40BP1JqrncIXwOg1a25OYWApmpqRdLLDc3pxm05XWCzh+w+lk5vlEOnEROowtFz04wFLe4Yu+eVCdtHK+DvMP52MbNcCyjsjUIORlyutHopNR1dbKAZW7bfBm8zeNDZeAZZFDB5U8vMR6TCYKdlfN7MrqOmcKHOii1nrkrMh8BXAavQ357uuLOMXYXZ4EObXysDQcAwmTB3Va3Zf3 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cceda902-638f-449a-babe-08db825849f8 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:46:31.9967 (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: pL2rJKbJYhZdczCc6cb5WTBOnf95SUPEXqlz5MVuIQGJQl9XmWKLJ4w3uMMWFH9XBMwRMmj7RiSZMu7qALow2YdWd6daCK6BHX3dNER0kMw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR10MB6950 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 spamscore=0 phishscore=0 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-ORIG-GUID: KxdQyDBSuIj_nml-BY5hvhXxynHuGKbD X-Proofpoint-GUID: KxdQyDBSuIj_nml-BY5hvhXxynHuGKbD Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Allow SCSI execution callers to pass in a list of failures they want retried. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig Reviewed-by: John Garry --- drivers/scsi/scsi_lib.c | 1 + include/scsi/scsi_device.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 53cb649b2f28..f539fc4b7148 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -237,6 +237,7 @@ int scsi_execute_cmd(struct scsi_device *sdev, const unsigned char *cmd, scmd->cmd_len = COMMAND_SIZE(cmd[0]); memcpy(scmd->cmnd, cmd, scmd->cmd_len); scmd->allowed = retries; + scmd->failures = args->failures; scmd->flags |= args->scmd_flags; req->timeout = timeout; req->rq_flags |= RQF_QUIET; diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index b2cdb078b7bd..381d08220665 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -14,6 +14,7 @@ struct bsg_device; struct device; struct request_queue; struct scsi_cmnd; +struct scsi_failure; struct scsi_lun; struct scsi_sense_hdr; @@ -472,6 +473,7 @@ struct scsi_exec_args { blk_mq_req_flags_t req_flags; /* BLK_MQ_REQ flags */ int scmd_flags; /* SCMD flags */ int *resid; /* residual length */ + struct scsi_failure *failures; /* failures to retry */ }; int scsi_execute_cmd(struct scsi_device *sdev, const unsigned char *cmd, From patchwork Tue Jul 11 21:45:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 702170 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 EC1F8EB64DC for ; Tue, 11 Jul 2023 21:48:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231727AbjGKVst (ORCPT ); Tue, 11 Jul 2023 17:48:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231678AbjGKVss (ORCPT ); Tue, 11 Jul 2023 17:48:48 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A1001704 for ; Tue, 11 Jul 2023 14:48:46 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BIDEr8025054; Tue, 11 Jul 2023 21:46:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=qhwHVQ20eGYLKhZewPfxIlKCGsiziiLeIvvRVaXWH+s=; b=gUKhVG8Un774fSlQhsOvdkEUEb8Yoyy+hp9MA2QUNweLYDaOn4nmMKnxy4VjDhg678Ih L5gyt7lNg1aJvZzimI8dj3m82/YnCwFeXKzmFmylBGTfNqkzn4Wpvo/5lJcnPwJ+nbuG zyx+PVu1/o00xKqAqlpPz5ecRINfa23M2JAQsJV7CAhG0uKOgsNCHKnfFfy6wUNE66Ye gXvxDj6plp8+NtZoa+5SKpWQLZSJFCIiZ5CYFpegzr7kNKWoz29vTPX6NFSs/e5K+qoH p/3Kb03S1r/sbfo+KlAb1zqv5saDh5ixGY8dnKoYdx9D3TdrIr4WbL2UsK2AEz7+me76 Lw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rrjmhbhbj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:37 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BK7N0m007107; Tue, 11 Jul 2023 21:46:36 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2170.outbound.protection.outlook.com [104.47.57.170]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rpx85h0w8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OU5juQ5RDHe1VwqN7hzJJF/r3Wk87FEFXVIgHPt5XZf44M+1WiE2HnTMXMUk2Yiebk/93u5SFcfy4bEgE0yQi7D4ebMOMogd6La17yIuRgPmx4m8ZpIK7ACKKIgV0EA+cKMdaEnEeu8v89l6nj8p8o2BmKPAJposfDthQBqiG47SdZFzrGTXyeDr+g4Z8Skdzr3oe0zT+Rc6FCfWsv1ZFfBQw2nKvY1LdnucnqoYkFaojDMPASXQPzyQN+sN1qIgIx5q+0taoDzBEy9NppI8n4ysLFtN3TIvpbZOCxtY01seAVnE7bSdRhIhI0dBtgtsykFRCqyWt8yAeFq4lVQDHA== 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=qhwHVQ20eGYLKhZewPfxIlKCGsiziiLeIvvRVaXWH+s=; b=Bklyu95/veeNjx9upIs4GAoS4WUXllouP8ozjMZ5RfeXSv85aWXLPNrEkHIloRQH7Ok0wuDBt0epmPqgJ4ElPwwOnaQ6grwaoV5a4XO7C4Somp1WbpoBHQy8+CCmEaxwDttBlORt6LPgwNysQ5XdwvxvlmZ7PTQUBEJG3hREH/7mmIMpSqT8jk9OgVsr6N/4TwpA6aSl3MVmzrUm7YjJ2DKQ+gndgsOA+GnE6hqPukij67fy/icINvt0mX/ew5Dzvn9FAWXY3xlb3LEPFi7iTKg0A05c1f/1bOBjWHqS4BIbjKApJokzCw80P0A960kz9sd+d+fEzpUbwHyZb46/9g== 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=qhwHVQ20eGYLKhZewPfxIlKCGsiziiLeIvvRVaXWH+s=; b=naPSekpfCHQt2SftQyElQjX8qjgcE93E8ERxCJd1JQJA+6NIM5S54TD8xhSm6+XWo416Oa/rCq5BgkAjBcDO78iPHqAt9XK70op2x4tCTgNEYlMbQMHmXgG7f3iX/SECW97qahYjsIA1Yw92Y69mUAxpB7V0wszC1fyZ5C2mglw= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CO1PR10MB4450.namprd10.prod.outlook.com (2603:10b6:303:93::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.20; Tue, 11 Jul 2023 21:46:34 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:46:34 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 04/33] scsi: Have scsi-ml retry scsi_probe_lun errors Date: Tue, 11 Jul 2023 16:45:51 -0500 Message-Id: <20230711214620.87232-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR06CA0029.namprd06.prod.outlook.com (2603:10b6:8:54::29) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CO1PR10MB4450:EE_ X-MS-Office365-Filtering-Correlation-Id: 6b3eebec-402c-49ce-b634-08db82584b2e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VX4mJi4pxlOMPH0JsM53KkvtnybtBeRc6E3V/aD1q7RTqJQSGR5IHCFU4DtCXte4KDcNFD28fdA5DKrM/E0C1+gg43aR1/tiu7bYa+nloSAHB99YkgI56kRj6qXlb7lgfnSGrIE17kuuFPR0Ty3iC2Dtf0WWhzJejRcFl/MDL95++FrW1NDjjPSKncN8cmEISbYw0ARZBap6R/OiFMinZ6dSieDva5vMphD55P3QewpAxCYUj8Kb09wPCYIKWRGStj4MFWczOGe2yR/FFu+0jSJawcF4nZaxABXscWJd8PFal/6zV+UPk7J994UUqUa2oSTpHyj+vhZkntWUyeD9zkQpBITHij2jSZsw0l7ou8FEq5tIsf+5uGYaICgmF0s1dx4CCFQ+I2+kSM+Q4CO4MZI/R7xqFuOUN1/bb7esGFLdKcCr3rf4KdmcwqRXmV/o1CZTyNjsjU1WB7K2taooiYwPWPr3yTXUHH9zKBtOw0xSwEVLJ/qmDbChk1Py9lssma+paT+AsBLDUMeIhVp36KdOul5TpkvchPIzu8yHQdK4mLKSey8xqVDEo4EYuF8K X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(376002)(346002)(396003)(136003)(39860400002)(451199021)(83380400001)(2616005)(38100700002)(36756003)(86362001)(478600001)(186003)(26005)(1076003)(6512007)(6486002)(6666004)(5660300002)(8936002)(66946007)(66556008)(66476007)(8676002)(2906002)(41300700001)(4326008)(316002)(107886003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oG2J0YB05U7b3NMLk+mDkQwmm+mXXVuqh9EqwKzPgd8oPTvf4VTeFBD8wfSmnc2TJSZCiDN3QEYc5l4YPMmRaZ5VTxTBV2ZWkQU+KS0qSALH73sWP2Aw0g/JzL+XovtrmzmJLYWwSV2HV1Dz+eyfvSZxLzPPQqzy1+QK+rbbgYWYhMgjxgFQ1tpngINwgh5IhDK5lyvyLICydyXWyx8ibVZQMPzgldz1mxDK7KE4sW7gOqCQy3ziF++EQmgwnssIp5LigcTETPrOn/UUm7p3yAgH3bfNfYK1/TN/qFLHtsYb3mIPieZ9JDLPZr99Lt01A289TvHESB0EmM3HULtz+zFAQcsc2AAtkjSWw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YheWCyxZKwOralZjrfU9g72SSiiG11UStSqyi2OJiZEI5lGqmmsOji616/XNO1iXCDLUlfMYRqcFMVBNB5YZPzrsq6ekUwMklYuInamDHFNzH0E0uS2sURbN3WjAsfS8+lQb38JH5Jh/nAXmWSLeM+pgNvEH0EIfCccUUEmGWj5eUdUjXb7jIVdowD2O5PnId24A== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 9gsEb0L8beEQX556bXQJSNUAghtQoGCHMZ5Ynvlt2qCebzcgzALblJCDkjArBAyqlnQCIatAFTzytkHojZMlj/YmZO32jjgTXIU5P/YmkWPuPgC02zLIvctGNlbYhMFmTzZxly+GDioSLoeRPRjyd5tOgQ0ZHsXMm76nZv327H0/kmhUClAotvXClgAs9zP0RGJGz0SrM85kk64q/7Vtp3lf+N4wXxMGGMOZu7uZJ/QfBOS2eQvxdsqXNGaYauUztw9zDAIkEP2xtvG3Pn7vvjfEG8YYCQ9MDrMCogbB3l+m9Ka8u5bNDzWfy0KJDdzYR6Nu3FDOhHVUDz2d04ZL3kZs+6NZIr2YVlSJBua4ODcwv84/SYjAADSTnd0wY3tptsn88fCmFjDFCgeI6IDn1M2Qg4YopSl5gYW/27jitMNHo306jJc/6KoYLWcnlUk76mE9X91syzgVufTXK6V30imCkZ8bhdNkegC9qUrJLpdce++6nCtES2xPw/W5S04AYLSLUrZVT03EVPvtPaXye0KMIOZr8Fe0V7EGNatbzhQJBzg2LVHwbGNl0ZbfCJMMshH41UgEiWuwdcuXUDqhtseSVdEkzqGrKIOSbXa2lKYdNQpwnlzgL9AMQYt3rnxqwqCb/wgRDJM5yN+tB5GPIjGK0GDv4+FLiuaR8V+GrCf4bhKUbshbVhfokzJA7wi48Swc6ghr/MEOxM2Jh3mm+YV0vgBaPMLRzivYhiO42Jgz+yvXDpaEub6CeGK4ropoPo3jedWYAPDO+8paUYRQ6P1+RDVDn6Q++srDQYJTFTzo2TwAjPwyBUsCcre/NzvBhCVu/5CEAIdL2hlKfj8PiTOsDrlOLsAmTwKD4OXNmCp5GJP72AIBGO7yGTKkIFRG X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6b3eebec-402c-49ce-b634-08db82584b2e X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:46:34.0851 (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: WGmAyBUNkGErDoDzgHH+SK6tI4OtcaujQBYVQceMfrzRTX0UUMRs8QfiXAapuTmyTMzsWJ1wEU4R4X2uajBXWR57IofdJMoIuBiVvMX5SnM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4450 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 spamscore=0 phishscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-ORIG-GUID: X5BELW86DQGJjNeL4FHCFqrRImy82KDu X-Proofpoint-GUID: X5BELW86DQGJjNeL4FHCFqrRImy82KDu Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has scsi_probe_lun ask scsi-ml to retry UAs instead of driving them itself. There is one behavior change with this patch. We used to get a total of 3 retries for both UAs we were checking for. We now get 3 retries for each. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/scsi_scan.c | 42 +++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index aa13feb17c62..519755952254 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -647,10 +647,29 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, int first_inquiry_len, try_inquiry_len, next_inquiry_len; int response_len = 0; int pass, count, result, resid; - struct scsi_sense_hdr sshdr; + /* + * not-ready to ready transition [asc/ascq=0x28/0x0] or power-on, + * reset [asc/ascq=0x29/0x0], continue. INQUIRY should not yield + * UNIT_ATTENTION but many buggy devices do so anyway. + */ + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = 0x28, + .allowed = 3, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = UNIT_ATTENTION, + .asc = 0x29, + .allowed = 3, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; const struct scsi_exec_args exec_args = { - .sshdr = &sshdr, .resid = &resid, + .failures = failures, }; *bflags = 0; @@ -668,6 +687,8 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, pass, try_inquiry_len)); /* Each pass gets up to three chances to ignore Unit Attention */ + scsi_reset_failures(failures); + for (count = 0; count < 3; ++count) { memset(scsi_cmd, 0, 6); scsi_cmd[0] = INQUIRY; @@ -684,22 +705,7 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, "scsi scan: INQUIRY %s with code 0x%x\n", result ? "failed" : "successful", result)); - if (result > 0) { - /* - * not-ready to ready transition [asc/ascq=0x28/0x0] - * or power-on, reset [asc/ascq=0x29/0x0], continue. - * INQUIRY should not yield UNIT_ATTENTION - * but many buggy devices do so anyway. - */ - if (scsi_status_is_check_condition(result) && - scsi_sense_valid(&sshdr)) { - if ((sshdr.sense_key == UNIT_ATTENTION) && - ((sshdr.asc == 0x28) || - (sshdr.asc == 0x29)) && - (sshdr.ascq == 0)) - continue; - } - } else if (result == 0) { + if (result == 0) { /* * if nothing was transferred, we try * again. It's a workaround for some USB From patchwork Tue Jul 11 21:45:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 701779 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 0BC78EB64DC for ; Tue, 11 Jul 2023 21:48:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231678AbjGKVsu (ORCPT ); Tue, 11 Jul 2023 17:48:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231628AbjGKVss (ORCPT ); Tue, 11 Jul 2023 17:48:48 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78E681705 for ; Tue, 11 Jul 2023 14:48:47 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BIDAEi010902; Tue, 11 Jul 2023 21:46:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=JBRYXZ7ZnYTj859yK3Vybweua6OchUmFVXt2i15PApE=; b=T4pfRtAWCKArfK3ciW78CKyxVIAShzjJLwuzoSjkuoirpkbnjp2du3DWb8M/pkhA+HGi Sb9PIRdio5NqrbcS7M6Vr54xTb3S6shYGr91vo+bwrfqfydH6ydWV7iueHyFrEwxhTb+ 2opkqGM8Cb3lgHpsoOMFyb/gbXi7uUEH8Q+xgOyH8MO9QqdY30xH7qORKepJ+G6zakwg g5GxQmIjfv6yvgAnsvekuarUQjwFZf80Hb0DFgOp+IPfpPXHyPEm2nJ7TvBslMHws2nh yfgChwyEj9qIKHY2TLjx2lfN6ZLa4aX2y21O3OIJNTsQ+sZ4tIR76wZHzlk28VHo5l9p tw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rrfj63wtb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:39 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BJv6Fu004189; Tue, 11 Jul 2023 21:46:38 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2173.outbound.protection.outlook.com [104.47.57.173]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rpx8bt21h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C7jd8iClOJJZObKruo4KdGBQbZm02W258yWLBbH3VMrQSX056OgKD0nVbLAJmv5tN0aKMJY6KSnmhxKyNAP2dLgCexbfg9XmqqJ1KEZXG7tQhkBg/+BSUJ1dAUKZGdR+MsqRELrQkJO78p5BYrt23rR0SU9zzTIkXeQjAsfDSmCzeh1JRnLPltBDaKyUlUnVBzB2B7HfxFLRguUADaobWTuSuAdksB+Zrs2AwpCy1SPmRtepEtzxpGPzGmyNcBLVzpc95pz+6XXeka64N+47t1Q109mZbmsvypOhxkRgTiJxz/5E1rvZnqaiZllL8xlIHX1gQy95NtpGF2C2DcDJJw== 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=JBRYXZ7ZnYTj859yK3Vybweua6OchUmFVXt2i15PApE=; b=EOyOM+XKQ/GgHpGiiE5vPV2ZFOEyBh1zD4Ys6IeIULl0GQ6KPslMv7ONqXZb6QLL0N8jt6IWm198xlFnVplYMVpwWqXRKv8N3sM7v7+iNV5l6Aj78pk/T9ovX9w7nECMqPOEjgV6soORmOq5t94abKyNoNMvHBIdAB4FV1ZHlfFkMRNJumFRLw/d4UMXobcnYXasktVbGj06PTmWn9Lk4AOGYH4oLz1sEjGqrCpJ2Nq+Qe48h80AytzlannzbINZyDAZVzH5B8VOjOL9CWS3bOfwZoYwrfI9g+4P6td7FBCsifEVqmCjv3mZ13V9YthnvE8kwmAPsyX4UJfzk6JU9g== 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=JBRYXZ7ZnYTj859yK3Vybweua6OchUmFVXt2i15PApE=; b=rRg3/cJqh2+WzXyQBP6JuaZgCTaGCPdmnszrEWyrRuKJDxXWsX9x7HqLM41/WnnFRuCJL6VwLY+nELuwsS1IDeim2sdQ0v5kVC9r0uwlp5aGvjmCtFd4v/jmhNoE03FI1a2RFOxh+V0OQvB0Rmqp7CHID+Ria9s/QQWn/9BEo6s= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CO1PR10MB4450.namprd10.prod.outlook.com (2603:10b6:303:93::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.20; Tue, 11 Jul 2023 21:46:36 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:46:35 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 05/33] scsi: retry INQUIRY after timeout Date: Tue, 11 Jul 2023 16:45:52 -0500 Message-Id: <20230711214620.87232-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0104.namprd03.prod.outlook.com (2603:10b6:5:3b7::19) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CO1PR10MB4450:EE_ X-MS-Office365-Filtering-Correlation-Id: 3785a02e-4bea-45b4-624b-08db82584c94 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: p9lnC6Eyv4JkTo7NwdApouTN+TW/VCi/x2VkQo6xkqwSnh+OtctcztWmjdpiyr4hammQz/sGcyepgsnkOespG/qjY5HxfnbTkKdH3uCPnf1xaVi2NiZNLPfu2Fyi0qpp7z61ofLZeKzTNVfervT4uuSRqulYa8rcwYYoma8OOyHGogwyGpGApDkbv4QnohShjZthmQTTaQvs6FxXukwJUMk7nNtmmANcNVJ8moVkYr0UgMkFELjDDJt5vkHw/mYTkQznhrQwnwbDULo3cIpR8NEYYo0ac4Sm01wWUxAZesaIoSjgvwH9Wkbn/OIJA4Dja6lthn2c2EUq0smH2DQxTBVbCtJH9VUAYuqyOiRn3OU/S2AU9AiFQLByItKYtbDjH8G4yE6HiuK3eHEZuwuZLwUV010Ii4yA0dEseFjF/YWYoVCTIh/FjRm8uWW2nV4jCNgmv30LFXcVAp+vtfo3x0fFW/lM27b9UkWe6fv7FT9JaIYo3ZNa27Oof94A7EYqliw+46InrjCaJxz9GQMKytGu9cGOhrGTKf8nigLlxVD+VSKScZOHVNMM8FX6l8ZG X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(376002)(346002)(396003)(136003)(39860400002)(451199021)(2616005)(38100700002)(36756003)(86362001)(478600001)(186003)(26005)(1076003)(6512007)(6486002)(6666004)(5660300002)(8936002)(66946007)(66556008)(66476007)(8676002)(4744005)(2906002)(41300700001)(4326008)(316002)(107886003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Hli7sUxbXiRe9m326NR9gtxNCA/f16NvNffVdC8lSohSjRUsmFiLsvLvoC7LePgh0Hysj6wvKUW+Jluz1ReprxrAKs0Bit5gxswWWdN1+6/6debmzEHpTGNqmgpsiXKdGX74eJH1qlICkvuNDz8fdKkQ/L8hPs7q4OaHNHPPmeEt6uNNc0oTq5XlC/MtnBfOvtv7eG4WhGw/0wiPzF8t7zeJEXfePHOKPXrTh99sCN55bzE8m6d0UckYPIliq/d9WMD+pXUG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ohrWKIqPPSuwLI7boVTnk2S8JblV6zx9TZ2HzFkRd+Q/r0WzdRXhd8haXiFtPKDqQWlk7qAIvOQWy9ZRI8lDHUMEIyL7CCdocNa91sG3or0mYEDG4i7ZsxsA7ercD6+hY5SwyokjG3+gtz0DPsuF+Sc5TersKDegULIVzKb4yooZe/t8N9EHBwvI/lNvQ/NKM X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3785a02e-4bea-45b4-624b-08db82584c94 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:46:35.8662 (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: KeSz7J4cenHp8Is/RTl+7xToTo0P0CQoikANxC9bOQuihgB5J25yHEIoH+hLfroxGDFH1/mXtY50EiBrSMR7esZg0scNfJRZbgA7OomItE8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4450 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 phishscore=0 spamscore=0 mlxlogscore=999 suspectscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-GUID: gCerNUWYQtZ9pyDRvcOc9ZY5OBGOuj_t X-Proofpoint-ORIG-GUID: gCerNUWYQtZ9pyDRvcOc9ZY5OBGOuj_t Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Description from: Martin Wilck : The SCSI mid layer doesn't retry commands after DID_TIME_OUT (see scsi_noretry_cmd()). Packet loss in the fabric can cause spurious timeouts during SCSI device probing, causing device probing to fail. This has been observed in FCoE uplink failover tests, for example. This patch fixes the issue by retrying the INQUIRY. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/scsi_scan.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 519755952254..eeaefba6c9a9 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -665,6 +665,10 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, .allowed = 3, .result = SAM_STAT_CHECK_CONDITION, }, + { + .allowed = 1, + .result = DID_TIME_OUT << 16, + }, {}, }; const struct scsi_exec_args exec_args = { From patchwork Tue Jul 11 21:45:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 701788 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 EA2F7EB64DC for ; Tue, 11 Jul 2023 21:47:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230289AbjGKVrC (ORCPT ); Tue, 11 Jul 2023 17:47:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231534AbjGKVq6 (ORCPT ); Tue, 11 Jul 2023 17:46:58 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B8CC1711 for ; Tue, 11 Jul 2023 14:46:47 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BIDGv8018412; Tue, 11 Jul 2023 21:46: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-2023-03-30; bh=HvWRYAMYxA9H5i0Fbn3/YEudh91viyA8ScGquI1LWRc=; b=ujiDyc7lqpD9qx78Or9b+EQnjM3kSU5/gqh9tXQcj6M86SD+2HzOiImlZ09OtrT7BSuq +9PKpPkqx7JqogUqQq/7PaJvjJJuiVjxgK2UBn8LibVz6scYrzWMnor454GCWEanph/u 9Ff2C1fge2Pq4rpFOhf21ZgdEG0exTaUpwOEqH/f1Vhy5cKxiIWy41q64uceCibD2xz1 7S9YT6uzIH9zRh8dWrfVQcEOu4AMpcAUATuzMngj0Lc2RALoOQT5lD6QrmX84JbSJfiL xAkTpf6+KU8JTjdbKaHL/ZqmRY9egE08fW01OFj9Z6DMk195T/BvTYnyO+YROeDPsQgu cw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rpydtwxyd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:40 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BK1hBB000797; Tue, 11 Jul 2023 21:46:39 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2173.outbound.protection.outlook.com [104.47.57.173]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rqd29sh23-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J9tyrsWQghqrn7DDt2FK0FPGzRzzibBlrvG/PrHQMrNooOkmcc6NdK5hie1V/bF6fjJ9OAc3oyNbLOjGl0lWokM/oxRlx9ZtSk2vrkJi+QfhvosMMls9f3HCzdiHN/ijDMG+TB6p5QwxrDOrnGPMNMtamgMoJSUtCg+SPOThsLtHysfKS3fBvM8/lng0LibXLkx1z0dfntN8F6uZKGPwuus9i+4BfauIj8pp2kZpb5ljrm56MExot2BI3GfqyfRay0oJNzELViWkuWugdXO+Glxc82g9vuYbkK86ISvdV+D/ooYljC9CJBDgxjzsYJlmzO2dy9JI+iTl9xq2lLOJbA== 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=HvWRYAMYxA9H5i0Fbn3/YEudh91viyA8ScGquI1LWRc=; b=eiKMCxnhG9azUfCcmDsn1AhouO79kD4301W9kyyKFWU3hrH0JF48BL+LE/msHh0VKJKAh5Efgc8KajCTerWlpGDjWQS3ttwC/2I63oCjl/wKu1Hfkt3MHCgMhh7cYwa/t5KWlOAOCHNsOvPffE129CAnKH0BhXTRBSZg8LxgNTiH9kuIal3Yjol9Kt60a6eTlziybXN36UbcA3j62jsOvFC9O/Ki61CCXFvTlnf6loqY+P7gTcB9lAH30umY04MsRT2kAyobCJLB6IC5JKXtXKURQXqw1QqJ487bR6TTyGKPBYHF/8jGNKsKQSXo5WxHbsAdXVt70R+0yoRoXJfM3g== 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=HvWRYAMYxA9H5i0Fbn3/YEudh91viyA8ScGquI1LWRc=; b=xxPv7Ifm7d8VvctkzrPHrPbeT1OWagAbqRvHzPBdM5ErgO3Bn6e1RakowsXFjbh0I1+n1spEVvF+USUHTsLW3uL5U0vyGcWQiePBzh8CU7t0GDxZ9084hyf9x+Zhn1HqIMvvYH0Xxbocam+D0Z6013dQwflAGYFAcEDln4jiIZI= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CO1PR10MB4450.namprd10.prod.outlook.com (2603:10b6:303:93::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.20; Tue, 11 Jul 2023 21:46:37 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:46:37 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 06/33] scsi: sd: Fix sshdr use in read_capacity_16 Date: Tue, 11 Jul 2023 16:45:53 -0500 Message-Id: <20230711214620.87232-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR08CA0059.namprd08.prod.outlook.com (2603:10b6:5:1e0::33) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CO1PR10MB4450:EE_ X-MS-Office365-Filtering-Correlation-Id: 9c857e6e-58c2-43fe-4ac9-08db82584d98 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: l4Wz4eo1kTWjnMGkdeJ0tqNEzGQV4yx7UWxIlpCJT+j+Qizc9NCTruOT3bzrkRYGXPx1na3+M/GTDfb3nNR2QiJQg+ldUDvsqpOkghCtyYMsclzRlhyNhbdySseeUVBnuEVPpPXerb/CWNjPLORhOtWnb3bUOW27IRWvNKrV/bq0bOoNnVN0K59cU3Tx37zhiSqu120GU1CtATBCLjT2j97gTxP4W8ZYVZ0i1fz+iTdN/1HZEgun8twBb17p/E+qflhmR8Fm7kmHdwOSnhBi/cCPGqU49BDkO74EORDjaiCacldXVt6SznL19dtgILBDTCjwqbEn4MJPtzeYOX09ZH4fBxSbCJqp1Sz/lIWSUnNWzFsqkFWMmYWz8vraDEb+LdyLUReH5VuGWbLXsloHmGaaKqBzA51K54UqMWYrghVYfOi39FkqviGY933UfW10iKKG3S7VneFQmibc+qjc+4fxoQRIzY3dW7TBKfVzLW9NTzVcfuz5F1UBxdM/w2YkDRpAB9AIKM8Jhpgm4qsde0NJSlXDYVaeJl4Lg62ORNk= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(376002)(346002)(396003)(136003)(39860400002)(451199021)(83380400001)(2616005)(38100700002)(36756003)(86362001)(478600001)(186003)(26005)(1076003)(6512007)(6486002)(6666004)(5660300002)(8936002)(66946007)(66556008)(66476007)(8676002)(2906002)(41300700001)(4326008)(316002)(107886003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +79tpuBP6APidu1hoV59/TaHychizmYaoQK3EJQrQsnYsyVH3ewdkc7r/49YzY3oqWg4SHaFd40KoxjZYyIe6XbBXobqyBB8ke9kt2QPOid6f29nuiUEMYwbBCWUVaXpXjl30z4H4NvIy7WUQOi1tCn14KKPyt/D5FDWFxukWVr7S5uCkpegD7fuZS1cIN/TVxerv54GP4/l41hvL7jMNz3OCCS/8vfve6Ia2w0YcH6q1jnojG0r+CqVqE+30n+ohx+HO06F7zywlkHKlsKcMnAOqt5DLR4P7u7Y91TAfD0yMFwpWquOEe4n2konHQQss4cQZtGyoXb+ZBs438SwuOaMIfuH5uFZI1vYoT3J9dSeXJ60yZGdj675Ax+ACSqoZf3ZjZQavvdYZw+hh8U5TTdDyPuIcpIPXgZeqr5cNvYSzpkouXH71jUo0K4i24PCeW8la1Pmb7Hvfb0DUMHkxmqfwsDN77w3RKrRLzVHJayzb6qSv5SCl/bvI2aLAQkb7aVNojkrhi/fd+kZNF03wSBs4d7yzXrXSxdyiIF3cH17XDrgKyfHbiwetvfCdVJoA+a47v/WukCQfbR2F7A3KbJoVJDL+b+Knf95kwhC1muE7qWuhylOFx1wN/gue8h4dRULaqu6/ogpJ8EuTU3oSbCp7rKFrms3LR3RWppgaMdV8Pl22PRB2Rs2FbKzNrQSiTaOYnJURB5az9+AwByyrBLcdYVY9Ibprkvd3Sdv0/SrSJSRjESP9rgUN5AD6vmthTuwWsNGRVDXR5pWlsXVwGgNs7YUIUlFq+5Yn9DjyXY35Cv6Hr+hYKuNOMt+uQsHkpQz6fn32czcBoifNGRntKF6W2HVk8MYS3b7/rDTMfoYMJgtnHxe74JqcDC36BJ04lyaLQhsMu8eZrWQvYFA++st0MY1/P0bf4O+9ZiKXch1c9cg7kZ3AYJ3Nkcr0eHzI4CegdChXk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fGXIfAJur6kIvWYz3BMXPt2Rxksc8DkDweHIF0Hvo9SSgpENGdkpxOTR43jR9lcwWXROBpH+Z6VRZU7tTmE+SSajGVQPH9iPtiCH26SAat8DTGVO5Ra8N+l3VjmyZiZxTLlhw17UzF7WMvGDZvywc2rNl7Bln9k3upF95Cxq6PfSk4ELc4fqsAz3lXdxFhij3hUZcfZ5nVb9Xe8lgSvWZNIdoXFSRy0Yym8PJJU/2BeaO+AzhX4EW+lGPask2U4nO5s34s3DQ9rb2wl/5gytIu2Xprqe+ZrFAa07vByc7jTpA9mX/MO0UTGT7I/2s+Hoa4l9NB0W9B4r5W1Gbbpoz2/4o3oSDyHGE6OMXQuvQTqoaHrxxLCtUVQvkCGAammcN6FKlZxE/UKna8lPLWAeu9/XYSeZ/e+7HcP3dPO5UQ1NMemScs0bICeUy+3r8y/q5bcB1czc4q+CHKsPaRDoN4/5vUcSw7MYfqHVJBV43U0u6kXGGIMu+1AJOQFfZgusg6UhqtdOrck1kU8vIJCB1n00mxFaQb+PQ4gas X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c857e6e-58c2-43fe-4ac9-08db82584d98 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:46:37.6009 (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: cJnWhLwWt3s+ybaUx6QvbBqIHRmbxAf9qYEjPVM4JyRtiehGMnT/XLAk2Y7PsWk+EbJ2KruVp/q1zgW4RAUBs5zhgG70kBdICu+qYIg0KXs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4450 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-GUID: 86XQs_1uT3BSrzfT8Fmb-2B1lIrKq6kQ X-Proofpoint-ORIG-GUID: 86XQs_1uT3BSrzfT8Fmb-2B1lIrKq6kQ Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0, it doesn't initialize the sshdr, so we shouldn't access the sshdr. If it returns 0, then the cmd executed successfully, so there is no need to check the sshdr. This has us access the sshdr when get a return value > 0. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 84edbc0a5747..a2daa96e5c87 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2428,11 +2428,10 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, the_result = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, buffer, RC16_LEN, SD_TIMEOUT, sdkp->max_retries, &exec_args); - - if (media_not_present(sdkp, &sshdr)) - return -ENODEV; - if (the_result > 0) { + if (media_not_present(sdkp, &sshdr)) + return -ENODEV; + sense_valid = scsi_sense_valid(&sshdr); if (sense_valid && sshdr.sense_key == ILLEGAL_REQUEST && From patchwork Tue Jul 11 21:45:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 702169 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 CDCC2EB64DD for ; Tue, 11 Jul 2023 21:49:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231724AbjGKVtC (ORCPT ); Tue, 11 Jul 2023 17:49:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231742AbjGKVs7 (ORCPT ); Tue, 11 Jul 2023 17:48:59 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B02E171F for ; Tue, 11 Jul 2023 14:48:52 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BIDDq7011193; Tue, 11 Jul 2023 21:46:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=blffAoYw9bIk0s3cUGSKzzokOmjGO0qntVdHSZAYeqY=; b=hN6XFC1UihHqdFDcU/q94aLl68iSUID+gxk3N/C+8dtFgghecvKBfnoVELdDGf9verGj QbYJ+9GWmqxhoTh2+77hFkb7JAxDqACX9gPV7W7+Q6mcO9Ez3AkcXdfHT1b8ZDki4Gbi GDoO5a8uuDAk1ivPSuT/zI1Sr9xFSAjrSDehCEFSwqB3IPi8BgbWhQIW/ykReqQPWyB4 xiIajCodrQeXh73MiN0llPxjtjPFkehcy0DizRzpn+JrTfT/krLGpzD6JulXesyGhpwa k9rBB72buPWW54Gp5QW7YQVVr3wZ0u6dO+eltVbfSh1AfZaWjVU4gdvoO6rfooBlaAQS uw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rrfj63wtc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:44 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BJsAUM004364; Tue, 11 Jul 2023 21:46:42 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2173.outbound.protection.outlook.com [104.47.57.173]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rpx8bt24h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WDO6OSIu773GAvpaZjGd/CY36D8jSPgVyO3SdoN3ovoeYGQPO7lwrTj8U97epHGX+iAm4VXBrMk5M4E6h3NP8BBfSS2ysz5Lt+/OZsr6YmazUuL/5Fl4ZNk027P4WXpWqz/pgoYZqAbd3UW5zMRC/U3/Q4f+o9G6142NFOx4FYqxLvKUojinZpHww4MQ/Ma5Lkzfxu6QMN0bu2tNjWWshKvrmARqq0DI32g5Tv9+kU5buAXBtt09E71y+nWCS6NAYluMnhCThgY0Vyk4tzjvwTAFqi/dajn4r00SewCPW3mkbs//FHW3efSU+0M2PHkOsxELnCV2NCiO5oyzxwZXKQ== 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=blffAoYw9bIk0s3cUGSKzzokOmjGO0qntVdHSZAYeqY=; b=er8lT7etEjf9g+qZQI2Bh6MVFCI7e13Jt8oo9Ui18VYSRCdDDtuNOpV5FWaH6TS979ZnB/tf454wTUbzsiTJcjbvuoT89Qxu0yjgX1cvniuIA3T9drf6hhLGC45TsMr1IG1d/yPVP5PKY/sIHPPAYK2nF+jjL8qSsMcbZQYLiPX9+evBitmT7nQ/nylQyBtDitTz14Z2GEbZTenZDhjQ0rg0F6PzfkjztwpEjdlDvyVMpEYiWsjyoOVeaxJvPi4Q9vYEAo8fXaaIK3IbSdBshmyCn/KlkGcq1G4UIVR/sDcAXoEgkDHPqo9C382bjkRke6776YEMzbmRnetSIO+reA== 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=blffAoYw9bIk0s3cUGSKzzokOmjGO0qntVdHSZAYeqY=; b=IplP1tDGUt/8fxaipcfGsdMa3NhOUzoCwxtFY1VtGEYpVQNrh+i0OlyffcAlH/W8FDgBKWa4VnAjmnIAAgU0Kt2t8uqsazPLuuu2u4t4Ln6BhuhIiENxS7/w2uIWIBqfXlWK8iDmR5OvX1N5Gw3dAsT4JKQ1ucLJRkTLTOqwsdk= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CO1PR10MB4450.namprd10.prod.outlook.com (2603:10b6:303:93::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.20; Tue, 11 Jul 2023 21:46:40 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:46:40 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 07/33] scsi: sd: Have scsi-ml retry read_capacity_16 errors Date: Tue, 11 Jul 2023 16:45:54 -0500 Message-Id: <20230711214620.87232-8-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR21CA0010.namprd21.prod.outlook.com (2603:10b6:5:174::20) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CO1PR10MB4450:EE_ X-MS-Office365-Filtering-Correlation-Id: 05b0f014-46b7-4ce0-6ca1-08db82584f13 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: S0gN1oPDTz75fvUIo0B/w3/luKUNkt1JUv/ClzNiaovYJ5o/XVLC7jJ6U3LXicbimmrRbB8e7xgSQJV+cXLmDSNSXdqv+U+WFLDXTJlJqfJ+TfxXhy5/HI7brVBU+QcX3Cx7mF4Is5cWlNMELaqAoKGVE/elvQf+pVC7cvR0REz1tgrTbwaEQdvNylk7dJuCZkpOremJM+u40EaAi/L6+KGQdw8D+kwBMlE8E/UUuR7I2OQmITWTj4QpDk4FJC1naOjiNczfRtwA3jXP3M9vFDVMXpTHhyaSHYZpYgYrqr1/sgvrm8WxtEmWpn9AS6AIhz592T9s5bCOIEcOiyJgjwNyjeO6dxCUaS61hyaLBPBi6RMVtK7T3JqWwio5JukqzYWFWD5g97KBOPCncefGtNYDUSkx0jZDdClHtzwrR6KD9jl90nIvsMpWuqO0Z41Ox12Saxl9NagUUvmWP2QDkSro0jaSjohsV7/0GkxBUyccsINEel9y/JQrF9O9PiUNSITHtghs4VLNya6s911imbz1wZ1l+kWuhRybj1JW6ZhEvH0ROQWiw6y1agBnUMhN X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(376002)(346002)(396003)(136003)(39860400002)(451199021)(83380400001)(2616005)(38100700002)(36756003)(86362001)(478600001)(186003)(26005)(1076003)(6512007)(6486002)(6666004)(5660300002)(8936002)(66946007)(66556008)(66476007)(8676002)(2906002)(41300700001)(4326008)(316002)(107886003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: T6LvV0d6XIX5Dp2VzXTHgbclawtozY701fREcxGi9WeAMFz6p8sug62+vbdSMAVvG5Ghy05VBZtciYn4gLOfevON5TP2vKrV0ZMNmf3Bo8JeZlrSvnhA0f9CtENF4MJnCpOXeTvKNeQGibvRT8HycXFfPFe7XBew62h5EcCqa6I5nwM66ZWD33AKLXGUokTZLFKA6sBE0vxB/InXhYlka67Oc/Yqve6aHu97DUqthN5mnC6+JVrVXjADzldX8w+6H5GEjqC7mdszSoSygd6wappoqkr2Rdusnqvn6utIxpgCWisJQdpyLdnaCyj/ZgWeZH7Pjk1L7ajXIQ5lXSqneYcJC0tQL9R8dovLbvbU/D3cE8LIdsTePeyJw6du0yd4ioMbY09LKP6Su91xZJlRV6QSGJB/1AgjvYddg+F1GzXrgFEk5gUmQ12sVUT5F+P0GrZAklAmtl+8mExo5GLM1bDoe/0vmW9IP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SrSHWs9ssHSCss0csnyOPe9oyIBm7aw5asnr6STJ8/Dlw9BdM3urKaRlKTS2Daep8maNdcW9a7Pg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: C0sBZtDfCyMrGMDVOTCTIJrcCw3vw857hOYqvYD9OiBUaDMsla3Sj6e61YzBndSKOD9KSgU8WXLLWD//0rJFOaWL5frSdqMfO39kELSbBtfZKporFEzXoYX6XUDa5hfbhHaICHn2j/8MvuVSms6MkTcksOgAe8C1neNj20zFxcilgid1PQ6UTsjSF/fX87AsBTunwqC/rc22+LAYvOUngxitZXrv5V7p9bwF8Cf+/R3qtVdIqmZT8K2oyDkPLOyjOyeFOXaSBECRpRSlBo7eSaVW7w92/WmhZlkcgzlAybv2hChogeO62S/bwWYUvbwEPkyU35GpQMEKYVw/q/4G6+IKgQN9K3V2FFAs0i61UERZZoSyPYa0qMzbCCNs776Mto6gGRp3xsJTfhJnR09vgC1keI6SCy7aV5605hCI2P1GdQvVYYxZtuMy8lqSphRwsJD6AtlMocqOld9lilnkVWR+efsD4h1jc8uC9ZyzsMDSwGNV9MK71bYVwqy2cb/pzqedn6yNmzJuD6yDkan50R7D0AWMygY77piGCElY0JMZbApYuglyDrOQwdcEFYntiEEvwzkSusCgQXTSoLE2tuk/sfZa9TQtMRZrQqXyZCi5kRGjqPTsejuPYHzeY0mCFn2jdW0f1NYoUCLnyEBk22kHnNyzdZh4lfq4wsJ0GaUE0W++frm9aYhvkxIcEOpKCv40YPT6k3Cdf1fB6VMV8058em1RwikZxzaJLsS44xeW+HigHYOk2UED9Vnsz8VlefvLXlj2XZ+35bUQ1LLyGluCidQMwRc1s31ILmyawu6T2pGVRhaTgUPH5NxGAhA8bUFXCkGbgALZuROFRMz2TXrtnf6Nf0oamgWOjzlDGuavbvI03w45oO6933xszuve X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 05b0f014-46b7-4ce0-6ca1-08db82584f13 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:46:40.5871 (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: CfXWB4rc6LSAaG78fZliLgeBQMJTT9dYutbUO7gMEdowFIYk49DtSejEqteKozx6Pm6LeDgSwKwtnye/l4usc4JeSQacr6kJRbJXIPD2X+8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4450 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 phishscore=0 spamscore=0 mlxlogscore=999 suspectscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-GUID: 7wOP16_gFuNj6Fg2WS6zGe5URSboYYYj X-Proofpoint-ORIG-GUID: 7wOP16_gFuNj6Fg2WS6zGe5URSboYYYj Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has read_capacity_16 have scsi-ml retry errors instead of driving them itself. There are 2 behavior changes with this patch: 1. There is one behavior change where we no longer retry when scsi_execute_cmd returns < 0, but we should be ok. We don't need to retry for failures like the queue being removed, and for the case where there are no tags/reqs since the block layer waits/retries for us. For possible memory allocation failures from blk_rq_map_kern we use GFP_NOIO, so retrying will probably not help. 2. For the specific UAs we checked for and retried, we would get READ_CAPACITY_RETRIES_ON_RESET retries plus whatever retries were left from the loop's retries. Each UA now gets READ_CAPACITY_RETRIES_ON_RESET reties, and the other errors (not including medium not present) get up to 3 retries. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 106 ++++++++++++++++++++++++++++++---------------- 1 file changed, 69 insertions(+), 37 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index a2daa96e5c87..f2edf1d79cc2 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2403,55 +2403,87 @@ static void read_capacity_error(struct scsi_disk *sdkp, struct scsi_device *sdp, static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, unsigned char *buffer) { - unsigned char cmd[16]; + static const u8 cmd[16] = { SERVICE_ACTION_IN_16, SAI_READ_CAPACITY_16, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, RC16_LEN }; struct scsi_sense_hdr sshdr; - const struct scsi_exec_args exec_args = { - .sshdr = &sshdr, - }; int sense_valid = 0; int the_result; - int retries = 3, reset_retries = READ_CAPACITY_RETRIES_ON_RESET; unsigned int alignment; unsigned long long lba; unsigned sector_size; + struct scsi_failure failures[] = { + /* + * Fail immediately for Invalid Command Operation Code or + * Invalid Field in CDB. + */ + { + .sense = ILLEGAL_REQUEST, + .asc = 0x20, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = ILLEGAL_REQUEST, + .asc = 0x24, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Fail immediately for Medium Not Present */ + { + .sense = UNIT_ATTENTION, + .asc = 0x3A, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = NOT_READY, + .asc = 0x3A, + .ascq = 0x0, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = UNIT_ATTENTION, + .asc = 0x29, + /* Device reset might occur several times */ + .allowed = READ_CAPACITY_RETRIES_ON_RESET, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Any other error not listed above retry */ + { + .result = SCMD_FAILURE_RESULT_ANY, + .allowed = 3, + }, + {}, + }; + const struct scsi_exec_args exec_args = { + .sshdr = &sshdr, + .failures = failures, + }; if (sdp->no_read_capacity_16) return -EINVAL; - do { - memset(cmd, 0, 16); - cmd[0] = SERVICE_ACTION_IN_16; - cmd[1] = SAI_READ_CAPACITY_16; - cmd[13] = RC16_LEN; - memset(buffer, 0, RC16_LEN); - - the_result = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, - buffer, RC16_LEN, SD_TIMEOUT, - sdkp->max_retries, &exec_args); - if (the_result > 0) { - if (media_not_present(sdkp, &sshdr)) - return -ENODEV; + memset(buffer, 0, RC16_LEN); - sense_valid = scsi_sense_valid(&sshdr); - if (sense_valid && - sshdr.sense_key == ILLEGAL_REQUEST && - (sshdr.asc == 0x20 || sshdr.asc == 0x24) && - sshdr.ascq == 0x00) - /* Invalid Command Operation Code or - * Invalid Field in CDB, just retry - * silently with RC10 */ - return -EINVAL; - if (sense_valid && - sshdr.sense_key == UNIT_ATTENTION && - sshdr.asc == 0x29 && sshdr.ascq == 0x00) - /* Device reset might occur several times, - * give it one more chance */ - if (--reset_retries > 0) - continue; - } - retries--; + the_result = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, buffer, + RC16_LEN, SD_TIMEOUT, sdkp->max_retries, + &exec_args); - } while (the_result && retries); + if (the_result > 0) { + if (media_not_present(sdkp, &sshdr)) + return -ENODEV; + + sense_valid = scsi_sense_valid(&sshdr); + if (sense_valid && sshdr.sense_key == ILLEGAL_REQUEST && + (sshdr.asc == 0x20 || sshdr.asc == 0x24) && + sshdr.ascq == 0x00) + /* + * Invalid Command Operation Code or Invalid Field in + * CDB, just retry silently with RC10 + */ + return -EINVAL; + } if (the_result) { sd_print_result(sdkp, "Read Capacity(16) failed", the_result); From patchwork Tue Jul 11 21:45:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 702178 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 EDFE5C0015E for ; Tue, 11 Jul 2023 21:47:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230006AbjGKVrD (ORCPT ); Tue, 11 Jul 2023 17:47:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231588AbjGKVq7 (ORCPT ); Tue, 11 Jul 2023 17:46:59 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3D6E1733 for ; Tue, 11 Jul 2023 14:46:52 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BID3wU015528; Tue, 11 Jul 2023 21:46:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=kiDbFCBfMyn5lvqMtdeTI/9rdbsKcHLUw80X2oOpnBw=; b=BrCNXhr2HQPQuhv8GexN9CyJ5LwaAHVN4AiO+RHRLX4xB4LnSsrdZAOVqHq3UOnmZ3tl gv/OqyH1JsFg96p0J1R+7oSYVPOQnA8DWT+EIoiQ8aDib2kwefB6vaF5b3QsJx36Hq1r D5b2Hsrbg5ZexGoDtyReMzSINASg6Pdylm6iMC9unsW9L8xdPK5+a3YS+EWBCLfstn8/ IwBSNexwLzqdg+bMATAAtYXmpE+9+4YrHgQUkDgYy8ydLeBEX0vMe459Iz3310C9Jxzh aSK4d+vyjFVWLaVATwKDP1iQ+JTtV0aSp7/mmhu9Lk1ZPCIRjelizdFyC+uHnTHfOJTI vA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rr8xumf12-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:45 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BJuKA1033178; Tue, 11 Jul 2023 21:46:44 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2176.outbound.protection.outlook.com [104.47.57.176]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rpx860yuy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PWgeRnCu/KE/wu7w5+CDBR0lA/gNxHwNV65vitBIWR89msXJkTkuls3WEdkH3Cq3w0tHhbmtaSUkxtqDNjkW/1cFrXnHS6sPNjIxcqEt/NPB6awX8/hL5PKXPZMoIv8+oZXObDIIvtWqZ7PtXnL9zpwHUNG72FjnqSgLUl/iEpnXKOapFx0Hk6P0QyL+XoWDUwPrn2PZmiItcSuiECDpDdsxPUYLRvokKd5GZPkyaIviKiDskMfdBznnPy5UVmkYyAUyoiv3+EMeZK1mm0de9mNuAauMUwlpEopsWYX937kQHsTHEpiNcPP9ahbsY++pF0cOVAmGf6nwAc+j8MiCiQ== 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=kiDbFCBfMyn5lvqMtdeTI/9rdbsKcHLUw80X2oOpnBw=; b=ntnOBXDDRFJV8+PYgFyi4jcpuCzJXAL+mgodckEMnaqxwCHKe4FPrDkZdv6BTBa+ENYOv0PLAOWSTKZxXog27ubq0r3nYojkHgXTqMFQnv7ordpRA0xDm32W02XSm6qD1ZlcQRcrwrc/Yd4TnWTxt4qBxa6E4yGM7la+N4OPNHh9lQ6hi85Vb/maUvfnhsFcCJqNy7pIUCZ6qcWLUF4Nmq1JDTf7SH1pm7mN1nExwnHV6U8EjWAa7FvA8D2Q5HMdAXydyvRFY4FxQK6wxixM13h7j2Ovh52Jdk8qgVXMzePJumNc/KRW3fbECNfgW650Ie2st9n4IsGj3V7PDZzM3g== 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=kiDbFCBfMyn5lvqMtdeTI/9rdbsKcHLUw80X2oOpnBw=; b=k8T2RQAoki/cXhn0lleNOCDjhHEcrbwsfnuLKDCFhLNgVqs47hZsy/2DuuWdHqD2tAakolrP3ZdKhGniaWWpoGJo0uL4uy/PtTq9NXHihGsJySpWqV8XMfzD2D7sEQpkUeTy002h9d7WNrxrIv5nZKp+0b4RqBhWO3RExz+T7TQ= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CO1PR10MB4450.namprd10.prod.outlook.com (2603:10b6:303:93::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.20; Tue, 11 Jul 2023 21:46:42 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:46:42 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 08/33] scsi: Use separate buf for START_STOP in sd_spinup_disk Date: Tue, 11 Jul 2023 16:45:55 -0500 Message-Id: <20230711214620.87232-9-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0143.namprd03.prod.outlook.com (2603:10b6:5:3b4::28) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CO1PR10MB4450:EE_ X-MS-Office365-Filtering-Correlation-Id: 9a0988f3-f663-4af3-dddc-08db8258505e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6TUI9NkDTfY2daK0kkU+njNwhGPijyb6zDpCofF9GDqBlaK/O+Oa/kHhJISDgXHc8r6WEVoT8CFUGhGpFMyf2Hj9jTLsVcRgue1yWU94vgA8z89XcYwZXh829Y3e4f0uPL0H067RYkpeoOoc9aYuO/C6WCs6XXVZt/+rcfna4y+ysXJ1XyY0t0/J0TND1bxUKjGXZscKlooC/i6kaOipAEsxbHwRHTAECtBvRhnrMIBVqxkC3/g+UufK6dpRn1EEoEu3gLdijzP/VpuPwpE4hxjs9NrfSC9xL8iOhyhDXebFfKkPFLzjwO+EfS3LcGWBT2u7ZxNdl3QWXK8EMuABqwdysj9SiR3flutRjO66tfrc55B915JxJ0kDGrxb0UIiul9pIkQX33kFFGVkHSKG/KYrHkG3QIPVozWpknuBUADQIn2aUBMT063swxUKB308THSRQSHyjBslvRwqoxHr50TK3a/Mjx3RnBK0NKQnA3glmkmXT44Aa3v0MQ1T0w0fkdDRLIpT8Sg4jJYoIylHDm6MdBkLCeUIg9oVadf++Gv2eZRodA9Q3b2Pk8YYL5+Z X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(376002)(346002)(396003)(136003)(39860400002)(451199021)(83380400001)(2616005)(38100700002)(36756003)(86362001)(478600001)(186003)(26005)(1076003)(6512007)(6486002)(6666004)(5660300002)(8936002)(66946007)(66556008)(66476007)(8676002)(2906002)(41300700001)(4326008)(316002)(107886003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8v/j4WwAnN+mTaQzm6ywxNomXN2met3jl2MDy6H8tjVBAq/OIm5Lsxw1dwusdfLBJDEh3y74ULLO94UWvTLYDSLAyfYT80bqbQcO1QS7gENcBVA1uxxHvEkIKeBTvIDa+WINTug8a84lObxBO3WGjul1Q+KdTs1BXbmC0kcAHpP5HxXCCaMI0HTqFOxK8Ys907eKOhmRHoXzXP8vthTyXZfepRIMqrKm9BqUAABw8bTCWlg/XsboC3x1oUYoZW9jeCCj084CouteCwOre7Dsr1VcBSBcsKZpQsFygozTIEil3BmzqxH3d6Kx5lVgitwfR+UjSxgyn6nNfL2nqNlsY8ybeYr2Y+j7U7Xa9shuKMZAYKgFvPR6AU0cbsGqfNHQyDB1fNU5LuPIhlYMqErui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IeAXoIsjHXUx1Vb6qIeEfxdjHhNx1vTJJd4 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a0988f3-f663-4af3-dddc-08db8258505e X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:46:42.7503 (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: a2Wtf/hJ11TX34khXZxceW0PtFk4cKV/+3boyHesIQZZSegY4Jrn41r/PdRb6UHx9K8NmOAT8I6E8O0Pm/JoGpYKKay6BRVg0JAmv9IP3CA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4450 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-GUID: BsC7JffHACI956JypsnX6qHzzNlhrjpx X-Proofpoint-ORIG-GUID: BsC7JffHACI956JypsnX6qHzzNlhrjpx Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org We currently re-use the cmd buffer for the TUR and START_STOP commands which requires us to reset the buffer when retrying. This has us use separate buffers for the 2 commands so we can make them const and I think it makes it easier to handle for retries but does not add too much extra to the stack use. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index f2edf1d79cc2..1a1011a8ae53 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2268,14 +2268,13 @@ sd_spinup_disk(struct scsi_disk *sdkp) * Issue command to spin up drive when not ready */ if (!spintime) { + /* Return immediately and start spin cycle */ + const u8 start_cmd[10] = { START_STOP, 1, 0, 0, + sdkp->device->start_stop_pwr_cond ? + 0x11 : 1 }; + sd_printk(KERN_NOTICE, sdkp, "Spinning up disk..."); - cmd[0] = START_STOP; - cmd[1] = 1; /* Return immediately */ - memset((void *) &cmd[2], 0, 8); - cmd[4] = 1; /* Start spin cycle */ - if (sdkp->device->start_stop_pwr_cond) - cmd[4] |= 1 << 4; - scsi_execute_cmd(sdkp->device, cmd, + scsi_execute_cmd(sdkp->device, start_cmd, REQ_OP_DRV_IN, NULL, 0, SD_TIMEOUT, sdkp->max_retries, &exec_args); From patchwork Tue Jul 11 21:45:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 701778 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 A598FEB64DD for ; Tue, 11 Jul 2023 21:49:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231774AbjGKVtJ (ORCPT ); Tue, 11 Jul 2023 17:49:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231769AbjGKVtB (ORCPT ); Tue, 11 Jul 2023 17:49:01 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FF38173B for ; Tue, 11 Jul 2023 14:48:57 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BIDBtv010943; Tue, 11 Jul 2023 21:46:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=F2r98ak+WJfCtcwHYGYZNcTTPE5SmYoJyLL5rjtPLso=; b=TL6HBbvqgUQy3RSGglhr2sP5eiGA+g7058VS0EEpWAk0gex+/OE8Okl16LjK6k+WVZv8 LCoMYzso0Jo/RtHDmvY76y+9ttQMNxtmImlh0BmuE09Tp5pZjANv+/ZfWB/hd/pPEKdG NC40+L7jkdD/rkS/NA3fMGQTFqFGzfJG+Jlg/J6B2kQOyOu8v5v5aYpFa0ASOlY61L/K /9pW/P2+/iCrwIdOWNTSOrehTy607z0X2dsM4HR8WoLEnCc4wDV03n8zJapF57RKeefk uW9cYtHmVTmOeS2vzrtXeNpWGDchMnhjtp+NoUQ0RhoopWtPHCVQ+QH8K3G2bYXKHF3R 2Q== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rrfj63wth-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:48 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BK14uH007175; Tue, 11 Jul 2023 21:46:47 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2177.outbound.protection.outlook.com [104.47.57.177]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rpx85h13t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f+4jmgpWEWkLmHYs53Ue67skXAvQ2bqv5MPjuIap5ieRjwE8J5WNW+YqTJob8PzGRBLkxSN6PBUF0QfSnflgdMEBFZZdHAYmJRCxfLFSM9AFixYpPalBC2bj+ARYPS2mIC7esSTSDSq2GgyFU9Lz6l019QmhBc4vT7+6Ep2o3LC53ennzo4gmWlkndDkkeFi84XqGdafgx05Z9pHcd6/n+Uzyc0/eRjlcYnrbqrNPD4kj7bHSyS8+0Y//8+hsN7KQAlrDnZhWdPIazp8VzowXm+fp2CLx3CRIeP1+ahmi8CyMN0W6Z28XfF/fxIDj86wmgjKZ9KjLZy3P0aoouxtbw== 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=F2r98ak+WJfCtcwHYGYZNcTTPE5SmYoJyLL5rjtPLso=; b=Im04FKQZq5/24FZkzCrDf/B7KhoSZnIfPsEJpwrFgkCSxi24OTdjAYY1mA1m2VHw7WiamRPrwxhIT5aoNfyNET99NLziB/XVGqTeTcze0pqbmdJ2Ip6xBsOkxrWMhWzUnISuQGWhN+t3kzzz0hUtlTS9x/+vB+P8gXugEnCZzKv7pUOUP8KPf4VP++ZAQj/qtHlIp3SUq19eTxLfk2L2+To5N5GMoyy45YGifUjfhq6Z7+6AY7y++7uLh0z2EArZIw7AG7ii1U2NHL6gGYI7fUzj1XYWD5TBwnmYQgizAiU5ltQQ+O39OBwSFDPSeCdVO87yNoJyfi9vsT2WL1q2BQ== 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=F2r98ak+WJfCtcwHYGYZNcTTPE5SmYoJyLL5rjtPLso=; b=zXGwkFVZfTpcXRaaJwTr4Q3k5l0LDM50/9lOXpccPRJk7zR4AdSbIrzlDGEVK+2sUwOkaWMZFhHx3fNqnHol3v4VO/ubfuhSnYds7c1pvml/psW+Nk90DosFNxmWcef0NfZ8VTmp/8C1HmU0NKr525//k/23ayV3Plwm3chpBY0= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CO1PR10MB4450.namprd10.prod.outlook.com (2603:10b6:303:93::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.20; Tue, 11 Jul 2023 21:46:44 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:46:44 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 09/33] scsi: sd: Fix sshdr use in sd_spinup_disk Date: Tue, 11 Jul 2023 16:45:56 -0500 Message-Id: <20230711214620.87232-10-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0231.namprd03.prod.outlook.com (2603:10b6:5:3ba::26) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CO1PR10MB4450:EE_ X-MS-Office365-Filtering-Correlation-Id: a43d33eb-3f0c-4ad5-62fb-08db8258519e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZGLCQxZ+ZpvYJH3rNm9/AUmtjTLbo4PmlfrzxPpYpq5oGsv4Xl8HIbHRbbGfvW4AKrDkLWlrBF/Twn/SRzIWf2meMUGaeBm10VVg/ujPfzbuzTJA1uYK/orta1YefymliIDZGDSodzMrAo0LtA+YXKv/o75oGPcxlOhSCPH1WzXMJ6Ake9h+ObpTI/Z6xIVnFcb+Jnd0rxYgSATjvOOkZzbMTy99VrORAZFbNcLo/GVHUgwkfzpM/+k/c+JgX0PfvKkzVxURnfkzi1WUPklCMdvhQWiqZPsRXkR8oMcWfv/w1dE3kuOyGOxEPb3rL732E6MlNx872gs8uIcENNYqlTe1BqR4KWqYMeyo4MUGTkg3QDCAr0so1RMM8OC6XGOuEgmHPtHVExKmijY9DHmCTNlPYlUA3VaI/lrulfJaiAbWqpHhqRViN2E8nVrJm8dhW2V7eTj7DEoMXG7PnTguA9ayXdaxDaWC1fA9CjLp4xpmdu8IRro5sqZPCDAmeK3x61ekDOwySEPNmV9uj0t/wp33QRkaHG4NvIHP8VtBEXpnRvxHwhdKLOMoMVVUVkJH X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(376002)(346002)(396003)(136003)(39860400002)(451199021)(83380400001)(2616005)(38100700002)(36756003)(86362001)(478600001)(186003)(26005)(1076003)(6512007)(6486002)(6666004)(5660300002)(8936002)(66946007)(66556008)(66476007)(8676002)(2906002)(41300700001)(4326008)(316002)(107886003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CIvnWfA6tzUGSsyhQehLqJgrkLKoanrxEQf0ssN9VHkuzFlqyyUDOSy4Rh6l0i/RL3fpif8W7P4ONNVCCoIvDq0yd5WdyWHqLwcba0a2B8eZDLgGpwDJq+0/E3qmU2sYqIX4uahXDHRzWVm9JIHWAdLrUW9e+7TNXS5MHGBEJ9562jqZHsLpOu66x9dPL29bENheiV/oU5WI0zH9eXwmjLtzhKaSoJQm4cNBk3pGvARXeeV+6XsFkWO7w19qIpxSc+KRCtZJNOcZe8jdfKj+L7iLvlrmEwHRrsUtNliZAjG2P+gFNjZFASP0L0vWj0/jEUPiuRAjzQF2pShVxGRynIBojSbAwMGAU9EVQJQsctgE6ZrIo9+uQuObIJCHi0SIG0qGs6y7XGEfzzDZcYIbySmeir7knKbuczZz4P7JQH3bmiwpVsBDkZDRue+NvqP7YEEmPA5oDoXaQhlMebeLLSPjh+/LwxW0tGYduPsoCqG6PfjbT26GlrmddoSpt5cpQA6d+qKzmkQKceSP3ndR2S0QRGXJkTKEE/UKQdezX40i7AK2Cl0+FXW2tWgcrEpBD5a/wIwirrry0Qkj6kI+7W4vvHDPhqPRTqtcbBoPaV7NFACxM59V3nspjp1Re56PT8sny1ks8uvfBXm+eOiSC0LAc7izghau1jRx5rum01XtGxgrIwHSnuXte6MptAJ6xtqXs+TE8iqsBdzcACurYCurPfFDmU9NqlFQUEkAruNsPFkktpqur4PK4ZHh1KhvdwkKugV5cIOS38tbxNyIpMPP45ZtO4hrYq5SjHZmg3eio33begAMHoOyfadfeayF36UqHx8jUPbNyZddpBuTsZtHLn+Vw3KCO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Rz/D4rIexr5NqfcVpiMeT+cXR2+9/v7SmIvbrw/R7A3R/1InXToiGPjdPQXzoRRmjwrbiG4uyHjeL8ukNfcZoNarjsedl3nSoqqiHLGJ/BQY/IU16F7wJMySyO9aSTAsCMzuBCUY3QacuGS80ahpp3C55LWwyBbq4Fd+cqLAV+yju6Rh0Lz5ea0KwqOFDjlyXFg7EMj0SF4HIJ+hyGIGMun2XeIyrSz8+TUf9O2+oQsoGHeZJhyy7/5Em7McFMAjYCwVHOz1OJ6nlLdViyiIK1ekSBrEGLC+ugiVxkSjVbCxCzY8rEEplGJCTqz40mmqVy9sDt0L7rYHYdOUdL3pql7JpURT3uyRM27rahBJWkcjC9z1QlGSD7uRQtmfuL6zicstUNA6ZaxdOBUx/z+C73EnBhmdFc6sAihVH3cIPhOvFVY5o2/bXd6ItVA+J9EO6cRpmQ2AL1926aMKjoSYOaPxq729OkbFwueVYMxfWG3SN+ycBC8BwYkaRKQ1/nAucnOtUhQiFKosqSNjFKwl7hEtTrcqnsS1qlCHPMpkF9L2im3diynaPbP0sDX3cR90j2DyfLTtaU8gYsNAxyFuM+qtp4Um0hD2y8ekbGUF7VaPoXYoO+o9Z4Ipxc4J5tn6HGpxJDXDndHZ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a43d33eb-3f0c-4ad5-62fb-08db8258519e X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:46:44.7919 (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: RLKz5CAhzWtRFcgossTvm8F/BZO4vmeFKTZwwkIjGv/toekwNhY5RdkMskewgPZg1ABR30yZCMpKI1h2nIw85s722jQcD8IPgcFtQwP+0So= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4450 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 spamscore=0 phishscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-GUID: vKRzhqC8ZV26WiRfJ10w24SqeeE4Cgdl X-Proofpoint-ORIG-GUID: vKRzhqC8ZV26WiRfJ10w24SqeeE4Cgdl Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0, it doesn't initialize the sshdr, so we shouldn't access the sshdr. If it returns 0, then the cmd executed successfully, so there is no need to check the sshdr. This has us access the sshdr when get a return value > 0. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 1a1011a8ae53..e34cc9daddce 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2220,19 +2220,21 @@ sd_spinup_disk(struct scsi_disk *sdkp) sdkp->max_retries, &exec_args); - /* - * If the drive has indicated to us that it - * doesn't have any media in it, don't bother - * with any more polling. - */ - if (media_not_present(sdkp, &sshdr)) { - if (media_was_present) - sd_printk(KERN_NOTICE, sdkp, "Media removed, stopped polling\n"); - return; - } + if (the_result > 0) { + /* + * If the drive has indicated to us that it + * doesn't have any media in it, don't bother + * with any more polling. + */ + if (media_not_present(sdkp, &sshdr)) { + if (media_was_present) + sd_printk(KERN_NOTICE, sdkp, + "Media removed, stopped polling\n"); + return; + } - if (the_result) sense_valid = scsi_sense_valid(&sshdr); + } retries++; } while (retries < 3 && (!scsi_status_is_good(the_result) || From patchwork Tue Jul 11 21:45:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 701787 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 D5B6BEB64DD for ; Tue, 11 Jul 2023 21:47:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231575AbjGKVrF (ORCPT ); Tue, 11 Jul 2023 17:47:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231454AbjGKVrA (ORCPT ); Tue, 11 Jul 2023 17:47:00 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB2851739 for ; Tue, 11 Jul 2023 14:46:56 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BID1qj015477; Tue, 11 Jul 2023 21:46:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=iB/M8qlFyCR1AgmN73Ve3GvZdF2veJjNkysZ6Xeh9Fg=; b=XNtAacoO2Hu5IDpT1yDqXnlzmBTtGkPedwTrKG0dUnftRbk97Gs1RXDYCMShOqpo/omQ siQwE31oyMICtt3mF/TVDiq6H6DUshDi0n5A57ft8eq9VcYyQg2PZ7c6QnEWkx1OjY9T BsqrBIgC/5UzDyFFMEBuYYy3wzdU7xcZPho+dlo6A7nFtt1zp1dbkbi0d1E1qkFuzOJR q4pocoFkhkhOqB9Jlnjj1PdJW+cGuLRYYSUv0Dm+LbyzukdklHubU3amuKpn1sozsMoj kCIMmwo4nubKS/1DNUdDs43GYKeFFeZG94XJHVR4khMP/miDcAYg0CLPPA/BBhnZHgSD YQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rr8xumf15-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:49 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BK0PiH000588; Tue, 11 Jul 2023 21:46:48 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2103.outbound.protection.outlook.com [104.47.70.103]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rqd29sh78-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j7SQIpVBrZ0dxIReYRkBMrtQ+vXV7q3/XB/1My946CchYt9bh0YhxrucRLN/IPVQjK+dyD1W6RN4XNl2jjERH6OH84S792W51YcM8BsZZPJCa2mUmfAFz7v25v1W+mIw1hdqB6E93UzWZbwYm6JoON6zoHsLsIzucVlH72AlwupDoQlhwu+2Y16/8bRqz/LnXtRmf0g5F1O+29jPavXiUqwzgxP9kEVZuKSoZwhKh3RiKe5PhXHybpYLwU2OmxzIwtowqjbGPMe3cookvYhcKjOPe39k3vV10rpN1PLl0C41a2IDtjD7/U8jeQlaFE4OZy7MuDko8w9Ay2H6NYccIA== 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=iB/M8qlFyCR1AgmN73Ve3GvZdF2veJjNkysZ6Xeh9Fg=; b=ktRGny1Y4Q2VPm0oIaHsonQrucmq/+AwIlmx/aw2dx2ocApcQdKs2V96PFdSGJDCMJ7srb5aEFtodD/eOvgEU96FrGFoQLkwgoWPA60+1ZR2sHUCh7Ry3osxPM+Ro+5mY29ZFdNZ9qoE015VSeCe+BeDGOYUrt1gYxHs4KkXAY4qvrMi4vXtiIize/yydK5Br/VPo12ainb4yncmevKYaxtEsSl6s0kQMlZBXe6YBK6TncShdpxjsKOu/Z+yDiLGagkKcEEsCL80oM7+AyvHXCuHzgWeLY7jaEaXKx8UvxnNMwuBtOZbqACI0s4/kdcm6Lerbmh9tsbE2X5CbTqSxQ== 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=iB/M8qlFyCR1AgmN73Ve3GvZdF2veJjNkysZ6Xeh9Fg=; b=nyInw+KE8RxULiZ0wIAv+roSyJkDtom2FkAzLruSIVRK59snNzSSKxmww5EiYGSAcSEDk504863/THaQYpwZzzRbAzZEN6rxXcxTB1ZIQ9kfAbDFTUaiJWsk680om8u1Pgx7mMSFVo9p5n1GfobHMX2QDOwGQb0BtCoISYtTAcE= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CO1PR10MB4450.namprd10.prod.outlook.com (2603:10b6:303:93::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.20; Tue, 11 Jul 2023 21:46:46 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:46:46 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 10/33] scsi: Have scsi-ml retry sd_spinup_disk errors Date: Tue, 11 Jul 2023 16:45:57 -0500 Message-Id: <20230711214620.87232-11-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0138.namprd03.prod.outlook.com (2603:10b6:5:3b4::23) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CO1PR10MB4450:EE_ X-MS-Office365-Filtering-Correlation-Id: 1463dedd-b777-4bc0-e785-08db825852fc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BxIP8yFhhkv9cLGfGM27NYauBZnP/j6l4zbW1qteRpOKZcCYuESKGC2Yrzisb7PlMnZjgajpYyrOmT9DIBpofGePwQPWdhkONh8aP7U2WrLlNon6UMsbkHiYzMBhrpvLQYcqEaMLSRuPDUlCpQNUxoK4A8ayUyheioyv5bCFq5mWmyJpbmqoMrJi7KvZxv2BgLmx2Dtzd6d9RkBpo/KfyNvNbwpKcPypW23UJNXbwHZcBig8NwP4fj0YYiYAzKQX1Q0NNzUQr2i7PjszrG6cdffnUL2904fKAHZsSBpS8Jszcg0gMeZN8bqVpxcfTo/8bY7wg5NWK/tMW0mbeIZgJRag1Ejh8FmAo5E08yk8/QC5+/W2ZuL8eXObq6FjIG3qwUP/6rdS/N6PW61AjlFuS/E+CL6zSUHOjYX9JGAve17LQRdZcx2zDl84DEZ2MNM46TKhmwSyITCBWbnsfhY9e4GZp/06GvXgmHRbH8KaCa+rEA7xM1p7gf7zto32LLboX22fe0V0TUtBQjSXyfbsoMTInyp75cVJpfRK03+Bimr9Z0hmXehZhhX2RScFkaI1 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(376002)(346002)(396003)(136003)(39860400002)(451199021)(83380400001)(2616005)(38100700002)(36756003)(86362001)(478600001)(186003)(26005)(1076003)(6512007)(6486002)(6666004)(5660300002)(8936002)(66946007)(66556008)(66476007)(8676002)(2906002)(41300700001)(4326008)(316002)(107886003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GTuz4lL2HnyReysQzWxwVCRTCkqyC0n+ZivboPIQIuJMqQNVlCUoIQEmRqsk2DrONCcQHG6EuO7Or7JgYDvZqAeCP6AIWBVPLbrF0hSmp6QABwjzJ0v51oGAPaEKraJ2pOpez+k81lLrTYiyuqKeSLT3hVPubcX/XbZmLnW+SBxYRT7igLv1Pb2Gt6pWpIjkcw5bCgiDYCWhOKi/dcaeSDRn2ZRx9Ocf4wLQX7CbY5PqxfyaMpmxAZlgrhvXDQCRZeB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7NwKKbFEczmgIqJ3JcNyBKb4+1Oeo04n+Xobpe2DHHXEjvqu5Nzw8/BLEPErZQe6ieqhM1qOO4yC0GTvfhHg6BHK5UhYAyx+NQ5WGq1bMrDrPWzPWpIVz23RfcTewitr/VmsHkpK4QUwaJ5GkURAiAz7z8ALfm6ho9AU9xArjCLZHPOR X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1463dedd-b777-4bc0-e785-08db825852fc X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:46:46.6343 (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: NSZsm1Pxyuvhd2Wy1yWY/w9XXY9ckSPplRocRv3O9B3kdvTZA/gtzof3Ztu34NwCUuFcBDi+43FEw9n4Y9xk/M+S/E1dompj7LsI1EOurpI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4450 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-GUID: JF0dYaad9CkIh7EQSC0oR4r_QV5hbbyI X-Proofpoint-ORIG-GUID: JF0dYaad9CkIh7EQSC0oR4r_QV5hbbyI Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This simplifies sd_spinup_disk so scsi-ml retries errors for it. Note that we retried specifically on a UA and also if scsi_status_is_good returned failed which would happen for all check conditions. In this patch we use SCMD_FAILURE_STAT_ANY which will trigger for the same conditions as when scsi_status_is_good returns false. This will cover all CCs including UAs so there is no explicit failures arrary entry for UAs. We do not handle the outside loop's retries because we want to sleep between tries and we don't support that yet. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 73 ++++++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index e34cc9daddce..e67a3d163b24 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2191,55 +2191,64 @@ static int sd_done(struct scsi_cmnd *SCpnt) static void sd_spinup_disk(struct scsi_disk *sdkp) { - unsigned char cmd[10]; + static const u8 cmd[10] = { TEST_UNIT_READY }; unsigned long spintime_expire = 0; - int retries, spintime; + int spintime, sense_valid = 0; unsigned int the_result; struct scsi_sense_hdr sshdr; + struct scsi_failure failures[] = { + /* Fail immediately for Medium Not Present */ + { + .sense = UNIT_ATTENTION, + .asc = 0x3A, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = NOT_READY, + .asc = 0x3A, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .result = SCMD_FAILURE_STAT_ANY, + .allowed = 3, + }, + {}, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = failures, }; - int sense_valid = 0; spintime = 0; /* Spin up drives, as required. Only do this at boot time */ /* Spinup needs to be done for module loads too. */ do { - retries = 0; - - do { - bool media_was_present = sdkp->media_present; + bool media_was_present = sdkp->media_present; - cmd[0] = TEST_UNIT_READY; - memset((void *) &cmd[1], 0, 9); + scsi_reset_failures(failures); - the_result = scsi_execute_cmd(sdkp->device, cmd, - REQ_OP_DRV_IN, NULL, 0, - SD_TIMEOUT, - sdkp->max_retries, - &exec_args); + the_result = scsi_execute_cmd(sdkp->device, cmd, REQ_OP_DRV_IN, + NULL, 0, SD_TIMEOUT, + sdkp->max_retries, &exec_args); - if (the_result > 0) { - /* - * If the drive has indicated to us that it - * doesn't have any media in it, don't bother - * with any more polling. - */ - if (media_not_present(sdkp, &sshdr)) { - if (media_was_present) - sd_printk(KERN_NOTICE, sdkp, - "Media removed, stopped polling\n"); - return; - } - sense_valid = scsi_sense_valid(&sshdr); + if (the_result > 0) { + /* + * If the drive has indicated to us that it doesn't + * have any media in it, don't bother with any more + * polling. + */ + if (media_not_present(sdkp, &sshdr)) { + if (media_was_present) + sd_printk(KERN_NOTICE, sdkp, + "Media removed, stopped polling\n"); + return; } - retries++; - } while (retries < 3 && - (!scsi_status_is_good(the_result) || - (scsi_status_is_check_condition(the_result) && - sense_valid && sshdr.sense_key == UNIT_ATTENTION))); + sense_valid = scsi_sense_valid(&sshdr); + } if (!scsi_status_is_check_condition(the_result)) { /* no sense, TUR either succeeded or failed From patchwork Tue Jul 11 21:45:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 702176 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 2ACE8EB64DC for ; Tue, 11 Jul 2023 21:47:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231689AbjGKVrV (ORCPT ); Tue, 11 Jul 2023 17:47:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231588AbjGKVrH (ORCPT ); Tue, 11 Jul 2023 17:47:07 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76F1A1716 for ; Tue, 11 Jul 2023 14:47:06 -0700 (PDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BICvOx032137; Tue, 11 Jul 2023 21:46:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=i74eLM0gYYLfBKQ58eUwPhldoNfeqtnqzPMiKTZMjK4=; b=Ppw1HYgNrXHuBDZeTdywTH1knluNZWxzwP827eUsksFWs4Alkujq3KOJIhD9VdAqEg6+ KB3WDQBsjo56PjmDpfa5Ke+ob0EjG7RCjEGKFhv+7psdyFGxpGALmgqgCuOsVGk6Oa5e w59Q40S7UxKpRI/MQbzNQQSYAysIHgMYSg40kAPS1DD4BUmUjh12iowMKrC/FuGDxFQy rZq593VK17/icpUQma++W8DMlHRmMLoIbCT41IAjozhMge9+/jGRSI2vzJX6wZjpQyVi xSsYg54wqSReUVjmWbwFygv826hobxKmvVzNuplvAuvpJ/dURnUrWkAIAn+3OZ4SvWi5 9w== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rpyud647t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:52 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BJwMMl033310; Tue, 11 Jul 2023 21:46:51 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2105.outbound.protection.outlook.com [104.47.70.105]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rpx860yxx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CK0lpeEY+JYI3i/5jGl7OLwEsWygzBt6Q/OqZfaR9ockclm489xhar+o44kFbxuhCycNmNntDYBjjzQYJ5wSpU3eUEmHuwBDobdQXuKD0T34eEDYb82JgR1G4o+FlWlTVvdUlcGX9XjEDd5xDJU50rcJztGj5B7Ixz6QRyjrvTF4unpHCiw/rX1J/WSMhL1+mHLUEm43UV2o3PzjZ5zZWDvQRPhk73EzEda+pBRM9Mxfv2Hiy2u3YXD7fXsQmBdt89YpzT70Smo+4YSoWKnIH9wgrRn4i+4e8B5GWasCc/zRmsTzqZY+cb48H2nZ79yP5gG5mqDbn1JMGhXGvWYxCg== 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=i74eLM0gYYLfBKQ58eUwPhldoNfeqtnqzPMiKTZMjK4=; b=QuNANUk7Ey77jNBQKuOsd63UI5CImvFj5hv0SVlBop3srzTkyJ6uNF48PW4U8dPQ9qFgoK4a4ndO8mjPIfAKEPm6UOi6ydmcWK+0L9vNh4d8diCxVVT10x5UBpApLuTlFwz4v9AHgsCZm3EzT+lVLnckvP4UxRfOvSJQEcDS4jNuUo+jVWWKeFfXFB7/8Zg9DmlaTY50sWMkjUkiUPwng3BhGEoLdNjXEgswKyHEPKCooNCRiff8hftcyEYRLkXmyJyiJG1mqbqme6jU00C6y3OfZCmXMFCZF2hRMlzvcMUZbEM0VHnNMrwXsxwaGkhKPJlyiqfTA95tBDqIydmCrA== 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=i74eLM0gYYLfBKQ58eUwPhldoNfeqtnqzPMiKTZMjK4=; b=lEKipLjH4VFe5EARhIe0TjtEfjvtvBDfHtehkyOxDhIRvWTPAFEQducHkB8xkiAD8Jryb/w6d7b7dn9vXdtcAy+S7PkwZFloeQxi/0LNlFpI9f+D5TnT9f0O+zHFp2IaYKB3OJG4hlFmzgbNDnknaZQEUzneZZvnRTf/ndFAU/E= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CO1PR10MB4450.namprd10.prod.outlook.com (2603:10b6:303:93::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.20; Tue, 11 Jul 2023 21:46:48 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:46:48 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 11/33] scsi: hp_sw: Only access sshdr if res > 0 Date: Tue, 11 Jul 2023 16:45:58 -0500 Message-Id: <20230711214620.87232-12-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0060.namprd02.prod.outlook.com (2603:10b6:5:177::37) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CO1PR10MB4450:EE_ X-MS-Office365-Filtering-Correlation-Id: 86851303-a1c1-4c06-1eed-08db825853f0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cLBSvyDtxvcI/pTcpaCxPisS9jlytYedO5kVgMhSUxdlOMVVlsSpdpE6UQQmfxAxNqQzRYk/5pAvUjBu+0KmOJ/+adRWnXJcxviCFZjcAo2VI8+RTltJ87whnGc3DEw3imJnDaSI3WM6f7aUFE9mytqL3/v2UeBl0Rs3qepOoRSAfweSb+2TBdvULwSbjb7KvzN3GJarxDvNyk5BaMYtlLv1LyeE3Az3q5m9KYAmngWYMH6YmsLT8OrKv3kXJxvkI2tK5cJbpuh5dzC6GOexOvihvf5KrdlvXgBe9IURH+EDK7wiBEjN9pV+sXnpBpPQ2+piFiQuMCKtkRMiGvpvPcbxVzEybbGTWn8OEL6SlcPYHTZAwfsYgZAeXaGAZPoCUXn3jyEObkGew2tJITnQ+qSO/3VPBMyPFaFYs3t8cSA43GG+6cbe6PvY8U12N+TO0Dg2xjYEubgB3j9QwYM4cJE9jbZj0O8hBoYW378X0G45+d1wRFGngXtNj49boPtbrVnVvjdMlNHv4ugHWX47kb5fRT/MR4y+giOueOpVIjoJtpfYn1X0+gxUDIgbiPlH X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(376002)(346002)(396003)(136003)(39860400002)(451199021)(83380400001)(2616005)(38100700002)(36756003)(86362001)(478600001)(186003)(26005)(1076003)(6512007)(6486002)(6666004)(5660300002)(8936002)(66946007)(66556008)(66476007)(8676002)(2906002)(41300700001)(4326008)(316002)(107886003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XREaHYDz2MDpJSrdP3SmhWx59xmxr8APxNh4RT8PzyAuB5QWVdjOlTY7xtNCdzxG2t8rdg3wK07qaE++cSZc2o8xjFIk57bCsz9hrrQoOBOaweQfRdgU9/4G6/0f5Joy/mxTg/aTDQFA+XzH1DfJcwoUgt3+yInp+APUsKNz9kVfBzCSexsms4HzSVIjfc3/DJY9mOT+UFXtE1pg4mgdWnIfZFIJPd5u7RlAGcVKhzkFvVu6i9idShwd5MuoPEYmVseduUDDYZkbHHYuVIzltxLWHV2O401u93NI5AAHzBaVzqQyZqDpVN0dYrFMbOeWyPqrqj2L+Xc5TWMEh6X2ESWT8VJwYqAGaYRHjsNrJIOV6ISOeCpDTt8cqsEdyZSMUs1btOICjEYguyEGnRt8Ck+DMCMcnqUt0v7ub5Ys4HD8k0vQsyLNynCYbx/ve45QDkbxnD1ZCAVvQa0y3EP9DNAJNmLgXsCqGGD+Cs2r95gFVKMKoU89DJgmY/kZ/TIWnbZvhjrGnXmwK/M5aA6uYCLlQhmBiXkKM4pMODiOZORArKirTRc5ecECmNU//MA55tZthVfIqw7qAqDGb81A6kLThvluFWJcEbzRBnuV7N4Ck8TwZAecU6Qjf/t2oQVWY3flKSIzu8k71nvzzsLCTLfYl1tPhgCoXaTq/nevkXtmcOCoYEA6ObMcSw+2pRscQB/tGGQaCjZsEOwj32wQnv/chDE12lS1xakbN8lce8b9+bFSlp4hCW4i9JKC+5kmttEcDTWRd2up+RgYbZDvEkp9oIizHng26xeO0vx6TRkXRKpmWhQDxfNXUqTka0Pn3gN+ELvDZX6NYzUN5j+gwPLx22ccRFdXfbr0xmQKe7Am9M3B25lMrKdwNon8l+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p301m5MSXgmLzX7o404TR4YcxtmJ3zZbTq7Rxe5Y1z+DhgpvgmB0kgKRBBAzzG+mQOJC36VsiTD6bfZ+X7IYuBTdiKW8Ycjv5Vlb3AzdeV+hVrKXZccDAtlIo7XyYRAyE2Bqt34pxW04coawxLL89HTbyU9eZa1g5vLd75J44lfvpVrL+ocLt6la8E5nCZPvTBXaE66a31S2SKULrNNL/WYInpYpQ1bigMvqnXBcym8s5dFgvjjrggpcGLRbaYHudJu/AE7aKoP17SC1doCAp9+D/PZ7/VhF38wbxM90tBCBCVkBxlmhfUIllRZvXCHFMQ93oT+iSErafeLfg+jsnSI9yBajG0NeAGyyc2bgzd0Nz9xxJPp0cV2XkEl/w+QLh3Uz/3g92x7bygmJ2Siy+gUExsz6bWRRXMh0ccxXOCuQxd0jTxii0VHTDKHC6EsxIm2wJaA7UAKlTxSHtJnFz/3iwggPuV2GrtT18nLBmcGJzm6q5e33E3h2hvxN67ZFq/QX3IgmhrW70ldYjLzmBqGgv2UBoVc3y5krjHcetbOFdywHBdgSwVe10CJgJFi73NCID5JQ675V7vjtihrInDhZ8DRSgvtzu6l/b1OFoDic X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 86851303-a1c1-4c06-1eed-08db825853f0 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:46:48.1729 (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: KsFgSmaEi82sVdxYwdJT/sz8/3lqlI1UItTBoXNlhsUWmBAhgsrJyLELM+yIKSELWXPlX7YMn3w78SnOPVMwCMwvpPuvkhTt+wXLWt6QtS8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4450 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-ORIG-GUID: GvZgskLgeya3SDaxeDMGX-IkCEXMnpGG X-Proofpoint-GUID: GvZgskLgeya3SDaxeDMGX-IkCEXMnpGG Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0, it doesn't initialize the sshdr, so we shouldn't access the sshdr. If it returns 0, then the cmd executed successfully, so there is no need to check the sshdr. This has us access the sshdr when get a return value > 0. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/device_handler/scsi_dh_hp_sw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c b/drivers/scsi/device_handler/scsi_dh_hp_sw.c index 5f2f943d926c..785ab2c5391f 100644 --- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c +++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c @@ -93,7 +93,7 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) res = scsi_execute_cmd(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT, HP_SW_RETRIES, &exec_args); if (res) { - if (scsi_sense_valid(&sshdr)) + if (res > 0 && scsi_sense_valid(&sshdr)) ret = tur_done(sdev, h, &sshdr); else { sdev_printk(KERN_WARNING, sdev, @@ -134,7 +134,7 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h) res = scsi_execute_cmd(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT, HP_SW_RETRIES, &exec_args); if (res) { - if (!scsi_sense_valid(&sshdr)) { + if (res < 0 || !scsi_sense_valid(&sshdr)) { sdev_printk(KERN_WARNING, sdev, "%s: sending start_stop_unit failed, " "no sense available\n", HP_SW_NAME); From patchwork Tue Jul 11 21:45:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 702177 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 51FCEEB64DC for ; Tue, 11 Jul 2023 21:47:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231454AbjGKVrK (ORCPT ); Tue, 11 Jul 2023 17:47:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231579AbjGKVrF (ORCPT ); Tue, 11 Jul 2023 17:47:05 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1A90170E for ; Tue, 11 Jul 2023 14:47:04 -0700 (PDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BID2G2000841; Tue, 11 Jul 2023 21:46:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=il/UorR2+lH80Gk9VhFvTQj5XNB5FlEuuo3w9PXrNHA=; b=jO/aJs2Qej7KMWzJCb8VruHtvHTNMH+yFrDqZqwLPbcQmOZllLLkjX3ZVgQPb5F1F2Y4 CzggbOFmxT+CJPinaeTIaFZ5yhpI6GZruCZT15LuprQVfz/greEhrtgqDtdQVAO2nQ9l oyPh95D7IfmBMWqKbOvymdooh26ESHmZJN1zRr42LCwBVKLR1TcZSAcfK7lNQenHJ8IA p0InA/je/zwfqTnz3FVL3erhhIzyjeeRuaHovFJ2dov6gMTny0LB8AYXaLbMgldJMzBy 1hD938rpooLFcrUyY9CaaOCiUj9woyvZwtdUc7Ek5/W4A8QinVd3pgtVbO8ouumMjMGL aA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rpyud647y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:54 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BLjb59004275; Tue, 11 Jul 2023 21:46:53 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2105.outbound.protection.outlook.com [104.47.70.105]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rpx8bt2ad-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EmtjHoalOoZZLdavws88yqM+4fSQAIDhyXDBPG/WFEhQluPjFz1TQuB6a73RS4EdttF4DW1MSAIXCn2DuOYi5eT44JjGbp1K6P6GWPCUTgbDv7yrBn3cLG1M7kOB2liosAsKpTC++OcUEjeaCCsuQato9PQpOOBN4srvytFO1il4Ggn8VRiA5s42zZwDkqNLTPR9rHxV+J1ssLVPuMNajuj+MyAPc95vrDGK6qD3DfswTofsuTBICsW/VVXUdjvTcVHLB2gqYgGPSIxb1ip0SUxTSVL1ijGdO4518irsXbnGfu+UAnt6EmmlWBahqSMDKykjZK7BEEW9aMIIULks4Q== 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=il/UorR2+lH80Gk9VhFvTQj5XNB5FlEuuo3w9PXrNHA=; b=ctVUza+5SElTDiVsdjPtfv96Ah7hCMUKDHrwKLRsz0ANHWwOuenHg/qRurDAUae7ZN2X9VWYNVMAE28olP52dj/1loNNMcYhgaBalWBmO9Urj1FbWZ4HkIeBijXS58///9anAIEs3NkY5UFzuuKbvoMfTj1R5+Egt7fR3YZuZrNtJGJ69DOv2cUaPxqJJcTk3cjwEGmz2r5eOe8eGdlcug03yrd3z7mQePxsq1GMGcpFRCQbboQA0io/YmZeLa+mfRUX+fAQqOk9CCg3PzhL8SBWGIV6O1Ko5odCsTTCKWaMVxiHfDQB38uOXU/l9cl+CESmIBj53Kcc+N2sblBlwA== 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=il/UorR2+lH80Gk9VhFvTQj5XNB5FlEuuo3w9PXrNHA=; b=PwicKC520Yk6MF0wYbO8jc3nwKPMNUSDLPU4khq/8p7rB8WG5lF6Pp2YpsbtdN6AbOZdWUZ7+KUgIrRsz/U31PImrkwsO5wEJnVWAaEGyuyGOpmR44sZo/J+8sjO6ACMT/wGFeAA4e8i2DGtVSml4+KVp6qqCFa0Br/nL22PUQ4= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CO1PR10MB4450.namprd10.prod.outlook.com (2603:10b6:303:93::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.20; Tue, 11 Jul 2023 21:46:50 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:46:50 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 12/33] scsi: hp_sw: Have scsi-ml retry scsi_exec_req errors Date: Tue, 11 Jul 2023 16:45:59 -0500 Message-Id: <20230711214620.87232-13-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR07CA0014.namprd07.prod.outlook.com (2603:10b6:5:3af::17) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CO1PR10MB4450:EE_ X-MS-Office365-Filtering-Correlation-Id: 238dccbd-5c5a-4d8a-6941-08db82585515 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EcUbu4RAa6ZUEsr9CHie4ORIE5KvP3pgPIVdlrJOGdGwbngw5jprtdIWVQGfYCWuumLK1zu9BjTaX5PkpRQ8OdTeT5ZnzlZgsHVjJic2BrikigfblpBJE5KPEXtAPjKCyiDoB4kkRp3EgdchV1YCG63OMrs/4dkoYDcn7DcC30PSJ17YLVJwrSXWCTeO1XFlPdzg/ZlBZ9maG5JCOZhjmAog80Yfn9IJxaLC6iQ9qLDQfc8n6B7fi7S6wwQHSvhLOpgbNiyvZSG/K3klAjO08jjqBqUP4o8fUGlXr8Y/TlaZx9TjjaczlU4sAAb+4wg2ET/SQ8uScAlOi13YxkSvapiNb6FNQGfTp7p/QIYe0UiRsiqjuE2hNiRHAF7C2S+InPXY5AhldTRZfCz32PIrx5ynGCwD0F5LTqOuan73awzCdhp73YTKJADnCahiwGgAb/nXnwILx6+1PpZ/4+ns6GR7hKyk66rewdLFax67CkWHtqq+lsWBiwO3WpBm4We4eUy5mJPKQyR0VFgl0AkJApeH1WF2rXzmMkUwHryk5bcNAYFNTqugjl7RvtpMC6HN X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(376002)(346002)(396003)(136003)(39860400002)(451199021)(83380400001)(2616005)(38100700002)(36756003)(86362001)(478600001)(186003)(26005)(1076003)(6512007)(6486002)(5660300002)(8936002)(66946007)(66556008)(66476007)(8676002)(2906002)(41300700001)(4326008)(316002)(107886003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FitrirLlYJho5QqVhHJNJB+OMM/1hB74XXjkppSY8SmmFupvx0hP6W5hlRXP2JYOaJo16aK5+g+omPHphqnIHkbWjavE+c/sAr7m5lRlfo/KwGYh+PuPmg+P4DcjJqKy1O3QV5HHTHkpsZy3Tcwnq5iIiy228jRSXRG4fgxlILrDQ7JxEQa6onB9Hk6v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rbIDLWj6nTm6fm0sUnmqS2X8M/bvmFf/6avHg7gChkGDiFDOO5I/OJ+jAE7bIXhk0bHQa/joy+nrK/8iC4hYmy3ejYEjTZlQY5Fra1ri6ivEvy7vGvDpBjoHnXqkQCJovLn4UDGPSCDPADCSuz3bux9p/Paqsq+62GbQ2o3w8/Ekt5bOVyLmwzo6YtjBSTwk68QxNX2Dxb534FVJ0KVeOVrGX+MVyBS2zvekKma04f0Z X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 238dccbd-5c5a-4d8a-6941-08db82585515 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:46:50.1666 (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: bcLSI+LZpMmMJEUOeWTQXh27zP1r/afYf6C2PBQkm5nAlMCh+h+3JH4kFIxxKLo2Acx4CQC42uMxnElhqW/vdq+NWMR+qi9qtvaLB//4c6w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4450 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 phishscore=0 spamscore=0 mlxlogscore=999 suspectscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-ORIG-GUID: XyRU-1HUS_1qtVdMqXiuEiDyVUgq0DwV X-Proofpoint-GUID: XyRU-1HUS_1qtVdMqXiuEiDyVUgq0DwV Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has hp_sw have scsi-ml retry scsi_exec_req errors instead of driving them itself. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/device_handler/scsi_dh_hp_sw.c | 42 +++++++++++++-------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c b/drivers/scsi/device_handler/scsi_dh_hp_sw.c index 785ab2c5391f..63d146f933d7 100644 --- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c +++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c @@ -46,9 +46,6 @@ static int tur_done(struct scsi_device *sdev, struct hp_sw_dh_data *h, int ret = SCSI_DH_IO; switch (sshdr->sense_key) { - case UNIT_ATTENTION: - ret = SCSI_DH_IMM_RETRY; - break; case NOT_READY: if (sshdr->asc == 0x04 && sshdr->ascq == 2) { /* @@ -85,11 +82,21 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) int ret = SCSI_DH_OK, res; blk_opf_t opf = REQ_OP_DRV_IN | REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = SCMD_FAILURE_NO_LIMIT, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = failures, }; -retry: res = scsi_execute_cmd(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT, HP_SW_RETRIES, &exec_args); if (res) { @@ -105,8 +112,6 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) h->path_state = HP_SW_PATH_ACTIVE; ret = SCSI_DH_OK; } - if (ret == SCSI_DH_IMM_RETRY) - goto retry; return ret; } @@ -123,14 +128,28 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h) struct scsi_sense_hdr sshdr; struct scsi_device *sdev = h->sdev; int res, rc = SCSI_DH_OK; - int retry_cnt = HP_SW_RETRIES; blk_opf_t opf = REQ_OP_DRV_IN | REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + struct scsi_failure failures[] = { + { + /* + * LUN not ready - manual intervention required + * + * Switch-over in progress, retry. + */ + .sense = NOT_READY, + .asc = 0x04, + .ascq = 0x03, + .allowed = HP_SW_RETRIES, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = failures, }; -retry: res = scsi_execute_cmd(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT, HP_SW_RETRIES, &exec_args); if (res) { @@ -143,13 +162,6 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h) switch (sshdr.sense_key) { case NOT_READY: if (sshdr.asc == 0x04 && sshdr.ascq == 3) { - /* - * LUN not ready - manual intervention required - * - * Switch-over in progress, retry. - */ - if (--retry_cnt) - goto retry; rc = SCSI_DH_RETRY; break; } From patchwork Tue Jul 11 21:46:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 701786 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 B1AC5EB64DD for ; Tue, 11 Jul 2023 21:47:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231625AbjGKVrL (ORCPT ); Tue, 11 Jul 2023 17:47:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231573AbjGKVrE (ORCPT ); Tue, 11 Jul 2023 17:47:04 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5B2A170C for ; Tue, 11 Jul 2023 14:47:03 -0700 (PDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BID2G4000841; Tue, 11 Jul 2023 21:46:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=OGDOzxotRQrQtlmfpOl5xsft5tbEQR0IyjIeqYnTkzg=; b=R621jomz/xLjjJexBIDcQSJaZ/RxUB2ulb4xv4tXpRVg8qca8zqzLIYYT+jU+8Y7jjEz b+FIbnHQy3/gUlKaEzGi+OGuxf6oQhp1NzDjgwpG4byaYozns2WYs78KDIvXIsbLp9U0 Y/AZJm1kpaRrHncgEoKmQgYGVkh2vbmptaBExKJLJ2d1wjE5f4yiyqHTfxfeyotuxHYx BYI8LmZwvB+31WXdQEmpDWudsSaq786bVoW8n8G5IIfb5jBF43V8FsfQ+Ge51DxKaAha tte7dIuDkmHq5fP98h3YNfkYRwBwOngIkic1uyD1dAziwIN035wDwl4sK/5kDoxK0xwN uA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rpyud6480-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:55 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BLjb5A004275; Tue, 11 Jul 2023 21:46:54 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2105.outbound.protection.outlook.com [104.47.70.105]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rpx8bt2ad-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mumla4CMNixL6R2qjN/ylXy0grG7AkPP1u4KjtRZgwk9/+mNJPy/2fVla5TCkgACwpncOedtWjT1yj27qeaYtHdG9SYHp3eSfq63od2/m1sg69+KJnlqxO1mEXGqBNrzhwBAXVeQHuKo0bDLLr+CNk9Vf9efSlzxF8APUPZJbv4s/MMoqepR39L14u/48qc8hBA6CcEAbVNZR1uIECUEZdz9DReIU1gZxP+gez80mRJrrsYBU9NmDrxXSR7x0yo9y8hFCzuOJO6K+mBdieSifBnZW9MNw+jwiignDBRtsS8NwfYXtwyFGPQ6iRB67e4/fFm5lOd88ziwbCazIBF/2Q== 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=OGDOzxotRQrQtlmfpOl5xsft5tbEQR0IyjIeqYnTkzg=; b=UqUBa14VMxcQ4LNT7Md6mr4E5Hv8ODfyyq4qylBMqy4tlhvFZJHgHgnvIquwuWV651c8RUo0Gy1rF3mU9JPeZU+jkdtG018l0n6IyQ6WZe6K4MIT+wGA616ZVtIAHnKEi/gt+rE2yyGF3fiCrOl7D7rQbJ/Rnf0yb+OxsvZ4iS0CG4UINQlv54WjLy4Zb5ntJ2/9pUl8+Hpx1pfMn3NCRtR5i5pV/N8kl9aW3sTTMZLa8c/zPpdK4t/9ogEg/lgpJIRia7dryGFFn/wDgy9u2fUW6sKiiagXj8H5MPiyK4uyUZY2q+igBr030kgQjzdGwARcTxXW+I280GShEghbfA== 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=OGDOzxotRQrQtlmfpOl5xsft5tbEQR0IyjIeqYnTkzg=; b=alkGjj1Xzsx/2aFDrgrDBagbBobn5c8/uVEFkU24L9jxxYv+N7FMZH2adSF6Qx5IkykbEF206ZurxkUSyWnEU+pLhak7dOZblI9qHSQqig5JScc/xb5kW4QoPytNJny+HvJhzwSBoE6zMxyu+DWbhYnIx1+mG2LewuE+CkgQ8S4= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CO1PR10MB4450.namprd10.prod.outlook.com (2603:10b6:303:93::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.20; Tue, 11 Jul 2023 21:46:52 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:46:52 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 13/33] scsi: rdac: Fix sshdr use Date: Tue, 11 Jul 2023 16:46:00 -0500 Message-Id: <20230711214620.87232-14-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR06CA0054.namprd06.prod.outlook.com (2603:10b6:5:54::31) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CO1PR10MB4450:EE_ X-MS-Office365-Filtering-Correlation-Id: c82aff2e-32fd-44f4-eebc-08db82585635 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ah8oObpP+3byt1ipy/PioEFOu6+t2hGqB8983Wge6P8nqVlxdSvK5ewSXv1x252jwh2tdKnLLje8SDbpqpozrgVuwl3qXf6HFj01oYU2r3Mlk0S19lC5/gcSL4toXG3tFkR+QNfl/LePqSOkho3/rrAtZgJgL8R3p0duMjkLuZhNqM0FIHOlOF3OLeTW0eJfOOapWu5Xmrf/gl/sFzDmXQzqxU8huVNnGa24QVfYM6tD2BdIVynjI9q0b4PBYnEPMAiDaO25eaO/3ip2LMmWcRBJfpaTDZ7N/TwuZjYcUobAKyshSluEFNXpHCYrGfZFhdp9op0I8gdAcz9GnonFkehp5jja1eILHHkWMeWOY8SgDIhDAV1Vc9Fll2MnpcmMJ5JCfmeSdElghFZT8o1Hym7x5wAPHANnKj1QsoIfBKBDx41fIJ4/wiUepdZBZLRU7xn6VIDSsX3YCTORz3OqxRQsxPebYIC8dynN0SbajwnY6LMXhAxJXuijYpISsZUc7X1DcB3Sk+AcE87sVmUOOjVcyx9HP0utmBozac3Y38q/pXGHmg5byxuBmTIzmZ+f X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(376002)(346002)(396003)(136003)(39860400002)(451199021)(83380400001)(2616005)(38100700002)(36756003)(86362001)(478600001)(186003)(26005)(1076003)(6512007)(6486002)(6666004)(5660300002)(8936002)(66946007)(66556008)(66476007)(8676002)(2906002)(41300700001)(4326008)(316002)(107886003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: omVOMkVw+ubGphqwpm5juoWgLRKaWk8qYjqCnUJfcyHxwxS4I2TzKumeb1tjUcNewaviY7qSDXDJlNUGjkTsV3YDglYsZ4M8QZL02VJIHbmnH2Y54OUuZiuLS4Y+LOFIcbgjNoluP5hPYoAi55QDRESneYD4fPxg+g9wHZ7OoF9z08x8r/5lROsdTQw0Rjp8lnEhNzhwGexchHMWrjItM2pvm9ZsoaNPv41QiE9JwhBwPCZ/It+nMied4szqSJIeh/CW2v86/nj937s/rVAwJxjztvpP8SpCF8rcZWud2oq3Ogr8grBfX999Z0irBzkPiZ9ref9TiuknUtiGhlyguj3J72IbvsXmU1anUdQkYkWdYUW76/318LaFXTqGBdTpJEu9vR6b/g20Tp3H1dbxLk2A/viRO2IUYH7PS1tGTxUOPerUjYLbthOYtonkWkidHKwpu7vHdxCk+2n/WGu2fX2jr0FkiILR55bOMc1+unD00BM+IKnf5EST5cer/OTQIYTa7Jq60yHvDEFKlYTZmHWaXsf/k9lS9w0b/ehYnWZlF53rs9JDzZqYqDHLlJSkQICvS8rVHGEeN8vz6+07Ho4mmcyl7l61D/oQpe2Seqr8SGwUagstnfgUGsH8DwyLexeaduohcyXQRAPL0oqs7QJ4YmwkH20YdgxK+7reSiwGpGwdXGvWY+LQ4r6rw7WCGyjIioaCJVyXZiX8xWuYc80IdI1lE6H6aiOO16oRk+XIR3RwSVoGj6Xwd7tXE2ET4yqnPX+XoLnRi17jCqqt86bvKW8cqe7iYbmbBlb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TwoRn+zb2ZkpLb5HJe8weYL/RCvFYRuvddPM7ihV3SrKxISyCfekjfP1EgVvxtPuEqrUaHne7LVHMbQJkpq+EywZj9lnbvqf3rc6A+RsYWvRHlvqn3Vzd7pIJBr//0wzREUbami0/u0zR+oJVatR+9VPJr9b/7g7+SKQSbVu3RygJafmwr1VvwA09vrWCOQfdci2bUZQrjH1QmtnxZPXEz5HpgRvFZJemvQV+DzwuBpMUumOtpDl912emOlQ3upmJsknVpi8afRcazTmYF78dxc7lfhhLBRVx6WBQRVv/J8kZCxYE56j0IBBeqFUFuf77E3szjfNiBoQ95+VWmC0UkiWPZEXKPPHajjJxH1pQVPmKAEboXvbg6aedDwNvg3aOnnDkferWJd6oC/kDVyJyYHKQPbJJS7d5jq3jlFn/AJrUSu1RLch4UAjtjJX6RC3gp3Xg2sOC4uVan5Xbiul5f+sGEu+a78OGFv5cbT+aHwD+ruqiGrvasbddXGuBl5J/QDyJPPaWthjfsssJq1tme59au2z/sJz7pDMPZu/bvf3GF1sBQMKkyS2daE2CUhV6/vjROK3FkWof+yYMbij4eMGb55/VTgJMonWTyDofBwJSIsJQPLYGGpIcIELoEyUDT7/cGbhM5rN9INsLngLzvVwlYyZ1lGDdtxMtMChTF4Ih67bOeTV56o9tInYF8sYeU X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c82aff2e-32fd-44f4-eebc-08db82585635 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:46:52.0826 (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: btx/WB6AKsuFQG/YFvqEYKIltYOx50aYbxgkvW6QBf+NPIEiJ4YdcbNI1udWgUlKCgYNw3Bp13Cz4VuA6tKtuGe3D0q61fGxrDHV16/uJTU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4450 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 phishscore=0 spamscore=0 mlxlogscore=999 suspectscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-ORIG-GUID: wCdWJqieixjn596n_4-ClyfUYR2CLVRF X-Proofpoint-GUID: wCdWJqieixjn596n_4-ClyfUYR2CLVRF Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0, it doesn't initialize the sshdr, so we shouldn't access the sshdr. If it returns 0, then the cmd executed successfully, so there is no need to check the sshdr. This has us access the sshdr when get a return value > 0. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/device_handler/scsi_dh_rdac.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index c5538645057a..cdefaa9f614e 100644 --- a/drivers/scsi/device_handler/scsi_dh_rdac.c +++ b/drivers/scsi/device_handler/scsi_dh_rdac.c @@ -541,6 +541,7 @@ static void send_mode_select(struct work_struct *work) const struct scsi_exec_args exec_args = { .sshdr = &sshdr, }; + int rc; spin_lock(&ctlr->ms_lock); list_splice_init(&ctlr->ms_head, &list); @@ -558,14 +559,18 @@ static void send_mode_select(struct work_struct *work) (char *) h->ctlr->array_name, h->ctlr->index, (retry_cnt == RDAC_RETRY_COUNT) ? "queueing" : "retrying"); - if (scsi_execute_cmd(sdev, cdb, opf, &h->ctlr->mode_select, data_size, - RDAC_TIMEOUT * HZ, RDAC_RETRIES, &exec_args)) { + rc = scsi_execute_cmd(sdev, cdb, opf, &h->ctlr->mode_select, data_size, + RDAC_TIMEOUT * HZ, RDAC_RETRIES, &exec_args); + if (rc < 0) { + err = SCSI_DH_IO; + } else if (rc > 0) { err = mode_select_handle_sense(sdev, &sshdr); if (err == SCSI_DH_RETRY && retry_cnt--) goto retry; if (err == SCSI_DH_IMM_RETRY) goto retry; } + if (err == SCSI_DH_OK) { h->state = RDAC_STATE_ACTIVE; RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " From patchwork Tue Jul 11 21:46:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 701785 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 869C9C0015E for ; Tue, 11 Jul 2023 21:47:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231488AbjGKVrW (ORCPT ); Tue, 11 Jul 2023 17:47:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231613AbjGKVrH (ORCPT ); Tue, 11 Jul 2023 17:47:07 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C31731718 for ; Tue, 11 Jul 2023 14:47:06 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BIDHOE018447; Tue, 11 Jul 2023 21:46:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=vP/T17ynun4gnAWJrgXRRUHLwegVzHhPtNFL2/Tazns=; b=cUHVL7UjkzceWwKYzjQAZbMaIXE992D8XGiTZ8G13diykaoYsoN7NPfuAqONnwZNVnds 9Q3oHBzPxInZ2Z3WNFNavNFRK9CUYtL7Z440YxItT3f26y93DHeiEOuCSVcOI5iMiG8B ynEgJtlv7Iy3q3S8pccdvS9I/6Jhf0Nv6anMJVdO0sHc2aCWhLXuSLddECr9n2FcsvXr C7Ku4x4JgSJaWN/bntj+MJ+VOK+hx6dpHtyl/FDu+8/0y+3tcmHDI/0ZZlEJmhXwmo6h xPmLbw8R1v9jjM18/8PJufs0gUvbASq7L1GFV5txv29Vl/f+uEarI4jkl9h5NT/khDX4 PQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rpydtwxyy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:57 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BK1ae0000502; Tue, 11 Jul 2023 21:46:56 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2175.outbound.protection.outlook.com [104.47.57.175]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rqd29shak-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:46:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U/WTJr/Q+OmVVTWVvXw6TU4csuwn7lI/86UCpmgNmC/IhEcHmbA1WSmlYyG+zpUBRtuveKy2S4ScyYtta3HARXbAdz6NcXoZNJQyUMQw057HZuLVfkpSMYv44RF5Rx9emD1xC7NebXMSsVcs2J9iXaVhuUKi3nMR6h2rJpq8KpR2jTWYVWeZyIe04qq2pqcQrjXjq+ZyuFkS0gSgf8JjqeXYBi8Zb7GzlS6jkf+3wNAu6ZDD1bEX578t84dLTHffev98aqZDt4NI/BacXdmnkdV/o3kEGHQMKl6UdSGdLx+uGOoU4fQZobQPhKnwEw2dYqWwVqYLpOas6KCs2kW0lA== 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=vP/T17ynun4gnAWJrgXRRUHLwegVzHhPtNFL2/Tazns=; b=l0q02iHJxULfwTMS4vQTSoFIWCEWIwyIcBHJ79tdL2vW5dm81v/T6aNWlZeQs3yHYvuOgEykwK7BmLuLHJ5v8UUwfGhAPayUObHuCYMFDYAarlA9v1ldh3t5OYPY56tRO0QfQGavazItGmTbfh+5sBb4xZOB7XZy6Ai4QfKBzMVXpfl5um6bSdIVf0mu0sHwkfssRt4+DEEXGeXmS+rg4loSaItzHsEHd1xZSe3wG45VgnLVFw/YNkg1k35vCoapGD1CoDet/ED1pKJfyzU/gdLRXX+p+VGlde88iyKF6/NfNP4S1VbeWhMCbIfh36DylRZykUcKtKQSj0L8qzP2SQ== 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=vP/T17ynun4gnAWJrgXRRUHLwegVzHhPtNFL2/Tazns=; b=kbYJM8NuVl3MUyG+ntV18i+n6I1hHsES3boCvLKtlbbeweL7KdpCIFTZjKeRJTaf80XFPAE8bAPp0bsN+exL4cBUMhO/8hfGOnaE4ZHb8v7nf4FmJjw09rUdJ47522uOwi4voXHCXMD2V/zUUlYJBnnDRkMXJqiI5qD/Ntlu5m4= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CO1PR10MB4450.namprd10.prod.outlook.com (2603:10b6:303:93::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.20; Tue, 11 Jul 2023 21:46:54 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:46:53 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 14/33] scsi: rdac: Have scsi-ml retry send_mode_select errors Date: Tue, 11 Jul 2023 16:46:01 -0500 Message-Id: <20230711214620.87232-15-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0031.namprd03.prod.outlook.com (2603:10b6:5:3b5::6) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CO1PR10MB4450:EE_ X-MS-Office365-Filtering-Correlation-Id: 9cba81ec-6812-43ec-3982-08db8258573c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XVr/SUglTMxxKFp5nxxDlofu1nljZJdwWRKd0rLaHj4zCyYVJ7jMYekNJutv43CWez81NQyRZGYn5sTOsGCdBC4J0M6I/X6MXz/jVtxZwB+Qpuz7nQoEerUlMYr0iP6P8ObX2DRBFJcHU58JstrH6hWLJZih3jnt3R2yzQTA/tz9Y3o0Yuo+ZHIIMMlTrZF9UIjrx/aKloeQRAp4SIivIbOpVvjtw7AGfxpQFo8omwLgJBuU466kGqLIj5QlurDiKk4pOA7UayutI8WSbWw8oGTaNi4UQKgCUQNMgSsalV0tBYGxAVdjY4BKYFgcT2f1goKea0G54UQCY9C+JakiP+GLoEgQhXov8f4CV6ZHWAM51g4K3ex3mtMVh+zW18yVUtEXYqYp0C5Gsb1sAy+LHahIfUsnqRflUnWjQFl1xAkwPbknvLg5q8rgQOBjLQfy4T45gDNiQrz+t1jJdQliTwOUpUosg1DN9TJitVfvu4noACKe8+PD+fBXRGUKbOPEuN1SClkOj7D7RCWUdxTswikqjDV6mboh5RdpMKJofOIv7WUNBKSe5M50dZJULEcS X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(376002)(346002)(396003)(136003)(39860400002)(451199021)(83380400001)(2616005)(38100700002)(36756003)(86362001)(478600001)(186003)(26005)(1076003)(6512007)(6486002)(6666004)(5660300002)(8936002)(66946007)(66556008)(66476007)(8676002)(2906002)(41300700001)(4326008)(316002)(107886003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam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wmusUo57ckLfDcx5g4jBolS0xkQa/CPBFg2klewpBjczHXBlandJ/mMbUW7FCdbf4UxR9odLTrnPHLl1IE0jThYq0TN1znN1Ey1kIy8MldQ/odWr7zbWfJVmaysfMldJJxkjhGxwF87rHgC1eV1CH1PxQGZqlwhpvQP8s86xgCSe/zZ0xK6IWXrO9BvJDaM1AJfm2yBWxuSsae4Q/j4uzUVFhIhjYAUYNVu1ZGaikKdDNeOVX7FUhzrhcDHR/lDcfyDw8+uCF4vTnRXG3YQrfsRQ04jl5eBdtZqnGApTuZzPfVwgFbTXBIrKlFCgxveN4tWZI7IhfL9OKZtYyvykK0DaBWlNyw+trsKYFGacdSOxihRgLj0sKWkWG4dATDzyIvryJQcVY72AY3D7uFv1iZnjdzNc9RdjryBub7DzfmwX/fym3dkGEPcQz0G0Ri5vGWQf7/xwmrL5dr8UALWb X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9cba81ec-6812-43ec-3982-08db8258573c X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:46:53.7669 (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: d1mcSFQhpj37PId+BhEG6Xcxs0nBcR6Bm3gBM1kSFlNHhhsIuCPy8yZQSsIK34mhrH/0VBhZ1O0N6AtGB7cXRTCZjHyHCHRmIDEw7P5f9hk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4450 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-GUID: -UW6D3pkJN8MVGYn5h40XsIl_0aWu3cu X-Proofpoint-ORIG-GUID: -UW6D3pkJN8MVGYn5h40XsIl_0aWu3cu Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has rdac have scsi-ml retry errors instead of driving them itself. There is one behavior change with this patch. We used to get a total of 5 retries for errors mode_select_handle_sense returned SCSI_DH_RETRY. We now get 5 retries for each failure. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/device_handler/scsi_dh_rdac.c | 92 ++++++++++++---------- 1 file changed, 51 insertions(+), 41 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index cdefaa9f614e..9811f9788432 100644 --- a/drivers/scsi/device_handler/scsi_dh_rdac.c +++ b/drivers/scsi/device_handler/scsi_dh_rdac.c @@ -485,43 +485,17 @@ static int set_mode_select(struct scsi_device *sdev, struct rdac_dh_data *h) static int mode_select_handle_sense(struct scsi_device *sdev, struct scsi_sense_hdr *sense_hdr) { - int err = SCSI_DH_IO; struct rdac_dh_data *h = sdev->handler_data; if (!scsi_sense_valid(sense_hdr)) - goto done; - - switch (sense_hdr->sense_key) { - case NO_SENSE: - case ABORTED_COMMAND: - case UNIT_ATTENTION: - err = SCSI_DH_RETRY; - break; - case NOT_READY: - if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x01) - /* LUN Not Ready and is in the Process of Becoming - * Ready - */ - err = SCSI_DH_RETRY; - break; - case ILLEGAL_REQUEST: - if (sense_hdr->asc == 0x91 && sense_hdr->ascq == 0x36) - /* - * Command Lock contention - */ - err = SCSI_DH_IMM_RETRY; - break; - default: - break; - } + return SCSI_DH_IO; RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " "MODE_SELECT returned with sense %02x/%02x/%02x", (char *) h->ctlr->array_name, h->ctlr->index, sense_hdr->sense_key, sense_hdr->asc, sense_hdr->ascq); -done: - return err; + return SCSI_DH_IO; } static void send_mode_select(struct work_struct *work) @@ -530,7 +504,7 @@ static void send_mode_select(struct work_struct *work) container_of(work, struct rdac_controller, ms_work); struct scsi_device *sdev = ctlr->ms_sdev; struct rdac_dh_data *h = sdev->handler_data; - int err = SCSI_DH_OK, retry_cnt = RDAC_RETRY_COUNT; + int err = SCSI_DH_OK; struct rdac_queue_data *tmp, *qdata; LIST_HEAD(list); unsigned char cdb[MAX_COMMAND_SIZE]; @@ -538,8 +512,52 @@ static void send_mode_select(struct work_struct *work) unsigned int data_size; blk_opf_t opf = REQ_OP_DRV_OUT | REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + struct scsi_failure failures[] = { + { + .sense = NO_SENSE, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = RDAC_RETRY_COUNT, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = ABORTED_COMMAND, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = RDAC_RETRY_COUNT, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = RDAC_RETRY_COUNT, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + /* + * LUN Not Ready and is in the Process of Becoming + * Ready + */ + .sense = NOT_READY, + .asc = 0x04, + .ascq = 0x01, + .allowed = RDAC_RETRY_COUNT, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + /* Command Lock contention */ + .sense = ILLEGAL_REQUEST, + .asc = 0x91, + .ascq = 0x36, + .allowed = SCMD_FAILURE_NO_LIMIT, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = failures, }; int rc; @@ -549,27 +567,19 @@ static void send_mode_select(struct work_struct *work) ctlr->ms_sdev = NULL; spin_unlock(&ctlr->ms_lock); - retry: memset(cdb, 0, sizeof(cdb)); data_size = rdac_failover_get(ctlr, &list, cdb); - RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " - "%s MODE_SELECT command", - (char *) h->ctlr->array_name, h->ctlr->index, - (retry_cnt == RDAC_RETRY_COUNT) ? "queueing" : "retrying"); + RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, MODE_SELECT command", + (char *)h->ctlr->array_name, h->ctlr->index); rc = scsi_execute_cmd(sdev, cdb, opf, &h->ctlr->mode_select, data_size, RDAC_TIMEOUT * HZ, RDAC_RETRIES, &exec_args); - if (rc < 0) { + if (rc < 0) err = SCSI_DH_IO; - } else if (rc > 0) { + else if (rc > 0) err = mode_select_handle_sense(sdev, &sshdr); - if (err == SCSI_DH_RETRY && retry_cnt--) - goto retry; - if (err == SCSI_DH_IMM_RETRY) - goto retry; - } if (err == SCSI_DH_OK) { h->state = RDAC_STATE_ACTIVE; From patchwork Tue Jul 11 21:46:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 702175 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 5EA34C001DE for ; Tue, 11 Jul 2023 21:47:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231620AbjGKVrY (ORCPT ); Tue, 11 Jul 2023 17:47:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231628AbjGKVrN (ORCPT ); Tue, 11 Jul 2023 17:47:13 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAB8D1735 for ; Tue, 11 Jul 2023 14:47:11 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BIDCbP015529; Tue, 11 Jul 2023 21:47:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=fbUZGGzHLP/Gms+L5XHc/EadHFm53cAHpcjH7HxQ0f4=; b=QSFCrjD15k4W+hJnBRYdEJXeQX9Coz+lDyH/PWZJ9hV77FPQUc7iS7wH7CIKroevhlXX 6XOlGJFGWRRJu4kQgTPjSP0Net4O61KW5bvk4e6nz8qGXvmPSKut3wgU7NWMKm0OzpK2 E9zgvD8wTy8WG8x2mkHIAXH9pt623XwXft+962fQsGMd2sLffWOqFWTSbv0pZJ1r97Kj h5CN1zRSHe4Dl9s5ZVZcTdVnyFhVPM4vujSPVYHyDFi1ph/9++1Goej0WWY5MQzAr2uI fU3nj63C9RZB4s7ngDsvZaZ1rrPY0GZHayVek/vzF6MyHi2xR4NtcrBiXJr0QOi4pMZr Jg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rrea2v0k8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:47:03 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BJwJW6000496; Tue, 11 Jul 2023 21:47:02 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2172.outbound.protection.outlook.com [104.47.57.172]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rqd29shbj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:47:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oGlQhmYYKW2QDtox7uGOsjTn3m/ijV0gnz3OnV55+Wybc69pjmnjpfppcPLH9hCvUHfKjjkSgN4NK4ofTDObXv4VeqPbTRpUiHd3rz1d7Y2HWRluuoGjbUHBCfXU6WqOkVpdg4sRX3FfRU9tSlLxif7jV31uh8N9Wey6m+U+Sc8JKWMFZ0bQ/gEl+GfISKUaCTZHMeAzUXScgxP3Tp3+TB7QhlNY3UwEf1+w3Enb+h3WHYBHnTaletlIxXh7sn348pnfqSp2wPoBnYLs7xVqkAVfnP0+wNxkwhjpKP6EmZQfjQdHDF+fTBDWgjwG81baTRMeAD6bSwMqaBoq0SLOjA== 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=fbUZGGzHLP/Gms+L5XHc/EadHFm53cAHpcjH7HxQ0f4=; b=Ps2KR9a3nycLUzXNRBo2wk+lID8BBzYKgcHuZbP3XNhyXkneiZG1rest2aAACkrc0fUcj0+5TIug2cUpTN5e8+HtCd2NcfzIVFd57DeStgNKRFoZECSkokNypMZzR3laIt220p2W6ltsZZ9VaR3bZLTDe96dnomSu60NTI0b5zLckDVcUWVNZO/f3BJGxbVhZdFCjwG/dg0IE6qMrBTRgk1TG5GToL02JypJqoL0JHRwIcEuHhJKyT/2KnHJX80Kgip9R53EccKtUZ5j06+8smUVY2O/Us0bNWL8deuJ6sydibobPzf78WrGhycqLPiZijK7kVBkTmMTxAe6IZG9/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=fbUZGGzHLP/Gms+L5XHc/EadHFm53cAHpcjH7HxQ0f4=; b=awWxhPsrw3fdFy9sgnO9aj+B4RXoA8ofx8a1PYH6MfULMDEUWQlTwamZHnIL26ebEGmqcCOOsB3dNTSOZMPiHEKkURaPFpeW37EZf/O8uistNXEcvJ6Q6841xv+TSwWIsPfY3mps2GnJWYHm9MaqZR3zoD+pixc+mGDkQLV7O/w= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CO1PR10MB4450.namprd10.prod.outlook.com (2603:10b6:303:93::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.20; Tue, 11 Jul 2023 21:46:55 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:46:55 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 15/33] scsi: spi: Fix sshdr use Date: Tue, 11 Jul 2023 16:46:02 -0500 Message-Id: <20230711214620.87232-16-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0091.namprd02.prod.outlook.com (2603:10b6:5:1f4::32) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CO1PR10MB4450:EE_ X-MS-Office365-Filtering-Correlation-Id: 751c283e-c3d5-49e5-34cc-08db82585872 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x8KynbZWwmZFFNtRFdgIonU72tWMhOm/DCltyMSfHkFRsZ+ZMGRCaoxAtySPQn3f6P4ZQQ3PC2bBnu7QVdpliVaoXIcEQdZfO0RaBRSOZP8OGd+vik7fxnaRuAYis/eg/rUviO0dCZhxu2mWdiluBqDO+skoSz/OXItfUUEM04AMzLCi+AVQMxgP6psQqFiWFekfFJBF1wb5eTEM3bjxCC4UviSzOAZ1fMf00r3AXCRs2JET1sOYMN5hiL88XUk+M5WyEK1eNhh1biC8sT31/Br4BRd3Y/nYrStdA6yhLnNdbtIO4Y8EI9D2qxNpis4Gv+TeqL7WwKGx2jzr7f7ELQFK2iSj0nA/58VfBh28ZlzSUNHz2QF5TyLd026HeLDHZ5JoBclfPblGwZUmSOXRYCvf28hkFUToepn2eydrrCXbNsBsBGfL2xxwbPWAbCCsoXmxkQj6NcEpyfy21AqjIN8AE1sH4wkZYXFArmuXZBXhKaFF5Wil82VInK5Hv8a/LuggpQFUqx820LSyWm5qCmqXc2OZgJIrSDFNpgkfpRvLAIA2wG5j8dtE20cV0Qvy X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(376002)(346002)(396003)(136003)(39860400002)(451199021)(83380400001)(2616005)(38100700002)(36756003)(86362001)(478600001)(186003)(26005)(1076003)(6512007)(6486002)(6666004)(5660300002)(8936002)(66946007)(66556008)(66476007)(8676002)(2906002)(41300700001)(4326008)(316002)(107886003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IFKAzdlK3xE/Sd8iwGpO7T9SQo2+d6BaNg8Nz4988qOSS1TrvSuzaMH0ckEIFIPFxV7vZCeVatZuj/v3v8Fv9jww3PoAMaiELcgZVnL+mc6hscRFLASRPQYqZFMMOp+uQ8W6sRP93xyGVmPS/2mSi5KK7dWqOrzJVjKAmH2KzrPgGbl29N0V/jXeI86r1v5NAvbXTPvXSkmFEH2BwuQB26PH4kUJGQGrjeF9SPBbico3EmmmmNvZkRWI4xGdFxUH8mqp5GkcaH8p3ovYO6QCZqo23IU4p+o4tjmNt99kqIS4F2GOO9CwKjW1skvMMaxSe2IdlyBc0Dpqj9MUxDIh9HJCRg9wdRPO01Nv8fCcmbtTmXDtKNGBLpcedcM2OAq4TqEdVJ+RoWZVNeHx+hLymmpz01NA9XHbNCid5Tr0JpjiAht5gidtguGsutpNsEbLehHHiLs1Ucjxs3EdiDBsyROev93uCMCSbuWdqj180OKsodlzG+D3UNEo3u0OF5GQs/TN0nuXNVZREwsYCTmWu0NP17QZvaT+45bpmjnHiRdKtayaTzwg4RLK5aaK6t6pwMNuyI38IcrnzD43qUWfjIyw2O6ePDtNqb/4BkWB36SvbW9z8gpuapwvFOvyXzQ6f4rMMjMpz0Bh3MxOSrsbdlwAqFBiZgrRUliGCecFUBbdW3ZGb3E74Aa2c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ycfuKzTbFBThuXZlvTatwGjYJIeOSSV8YebjRvdrrsKVxRIXq82qlWs0YdFppdAJKjvY3gvP+1Aw2m0iP10MJ8Xlgmuf6dm5m06XHo2GAtsxj13/fjDsmx9b3K1DRmeHuzyScycO9g5A3Y3GnhSxW4uJqCqEqkOHpd/eTc/P8utPnJhS2OQslUnmEhcZm/R9sWFPCin/uCfBDaId+QB/rTOd/w6DL74zZ3a5E+jhpj7lpLesxug9KFWop4LMjbu2hzQZramuQnNjhzHclTaT+KVh0TQZP1wrZsb37LfRAXqS6OTXXCexDzWSO5/TCpFcuQQVmodp7qVdlUjJDpIeAuyPMaQobH9YB2FUmQ0XUVmXQMgGW/Ujh0BkQItCb5c5LxW5KYRvkrHPL0E/JIVEdbH+J7BBzfSEswm7+rYt6/KxwbcTBOxQmlV4ZGvfsYTcTboHiU/ZkteKbAnh6wcuS3hZjetXhtDc8OzeJuudto0ob7nnUW3tDPtC+pwQ96+OgtJf1dZvdSKNmZWnsLpjig/8KFPwYUkD46sCThrTZdty4XBsVmd4C7qhWLaff7fGfL/fA56xDMKlWGnPwgIzX+bQNObak3qaPc6NC4TYXRppIEp9fdrxEWOC9QRwWJUsF+VjAXrxZd7qTjkXyT2GWR7XjsGXPfnk5vQZ3dwYSUE9b3yf6Qgu+kB2rmeCYLoM6TAy7e4KYRaQsRLi9QjiArfp63lZA7NVzRMRN9tdmBFE+doi3qzxAqHRV0AzoLLbHsJF3ElKVcS4JhfscZ6POiml9ssNlhJo1umiZWFptPRIzmMFyB4YegbWu1F67tIj3V X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 751c283e-c3d5-49e5-34cc-08db82585872 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:46:55.7351 (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: E5hmgcOzD6Dun1ce4J+54VsG5ihyDKsSCw07AgdE9OcbudUtjtIdiUMJ/WyaiJGrvmZirv6XOgRHF8plMPc/AhZhHfHqncfFGaIC9wzl6ng= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4450 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-GUID: e_mOQD7SUBcsZurUaetu6XO23fA834Kq X-Proofpoint-ORIG-GUID: e_mOQD7SUBcsZurUaetu6XO23fA834Kq Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0, it doesn't initialize the sshdr, so we shouldn't access the sshdr. If it returns 0, then the cmd executed successfully, so there is no need to check the sshdr. This has us access the sshdr when get a return value > 0. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/scsi_transport_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index 2442d4d2e3f3..f668c1c0a98f 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -676,10 +676,10 @@ spi_dv_device_echo_buffer(struct scsi_device *sdev, u8 *buffer, for (r = 0; r < retries; r++) { result = spi_execute(sdev, spi_write_buffer, REQ_OP_DRV_OUT, buffer, len, &sshdr); - if(result || !scsi_device_online(sdev)) { + if (result || !scsi_device_online(sdev)) { scsi_device_set_state(sdev, SDEV_QUIESCE); - if (scsi_sense_valid(&sshdr) + if (result > 0 && scsi_sense_valid(&sshdr) && sshdr.sense_key == ILLEGAL_REQUEST /* INVALID FIELD IN CDB */ && sshdr.asc == 0x24 && sshdr.ascq == 0x00) From patchwork Tue Jul 11 21:46:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 702174 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 80F02EB64DC for ; Tue, 11 Jul 2023 21:47:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231651AbjGKVrc (ORCPT ); Tue, 11 Jul 2023 17:47:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231648AbjGKVrP (ORCPT ); Tue, 11 Jul 2023 17:47:15 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AF7E1736 for ; Tue, 11 Jul 2023 14:47:12 -0700 (PDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BID95W002987; Tue, 11 Jul 2023 21:47:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=SlU/HzdxNrSha8hXwsmTHRBZVn6ykT090zItMDaTKiI=; b=1lGb7kFIXMz6RSr8Yd3peo3dkZXqsx7xDi6xJ5uaKqhx4gbDVB818Hdc5INKwN6NnveF ISiPzriJ6iaMOVv1NgTsMPQpxGrm6MM6wYPgFD8IFkSKTVn9Wq4+aTbghdS/dWchjd51 vq1lP2cZoI0nRnkEdqyHE9beafE5dSEoM7r+rINOihHZecTew1aLYc/dg5b0zm9cy2I7 k2ZXf8GMSqud7gW6sl4BFZcPuxNx8uib5k6Kqr3wL5CVyZQ5ZcGo/fqWSrjc/q9vo6/0 Pl73VkU9oVQWkHQAOijKSK5MzHeobRFxqX5ahOuIyFswgw3uI+V/WDYYpXC+92d/igNG YA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rpyud648d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:47:03 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BJwJW7000496; Tue, 11 Jul 2023 21:47:03 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2172.outbound.protection.outlook.com [104.47.57.172]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rqd29shbj-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:47:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CpvprQ+/OgDL9T1PuBRZ4O9t2A/dkg6X6MxUzTOk7ol8P9QbHGPjyfV+Kq/LxfEotmgtM17OAzsKdmoS4UfUHNOTn1geLgIUvVARr0AIvUSyGT0GZOc+j5UlRQWrKWJiT+fq4Qy8yCx3vZ8bx3oP5Aun+EVwCPCE0XjKfVVwKi8cbUmPlxw1HnLvrDyx+6E3rtBDVt64MwgUem3CxXD45p9TmLDV2cQPooHv3JWYGvbgnIPJgtBPpQhV8BweGZMkb+SHeY66Us5L1i88DIJJgbtQ49ayoc+8k3nFxIgGEHa9wVDsAcqubccaSy4vLldA+jRY+43tjXBvb+v8AXet+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=SlU/HzdxNrSha8hXwsmTHRBZVn6ykT090zItMDaTKiI=; b=hQosYSYPrJN9BCTPor2P5jvt29mA9qmI9/wHPTKidxHTpvEKLctXecZioIAGKviGpxuR4oJYx0mqh+i+zYc0tMNUJwV8hA9RBxJb47eYQOL4S9NsCUz60nMA8mpiRsGhJxwcY6xC1WsPyVJUgzX3tedNE/gLCZB0b1Rf19qTTgxaryaB2UwHbV+/IP/PigFMHFFRY9CTQ+DVyO/nRXHmx3Nz2l+FQRvNoBo2n7CIY8qTA7rvZ0ns8fnew0DDsdwr24xuMaIMNwB6aiH4oqIztrS9gVrV9eFJHwHDDP3AZmNWb7eBKJi2BVmxNttfmrXdrwFTibJ6PZJt1qUlygD8ZA== 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=SlU/HzdxNrSha8hXwsmTHRBZVn6ykT090zItMDaTKiI=; b=bqGStRprePhyx6kwUKJzcpw4ZANyXMCyQaLZWpkO1FhC6uekzO7Nnpy1SuaZ6fbs1fPMpxob9O7zfIyBsesW1XTLjYrRfaGVpHfUIGkGyYCSfiSEUb+clZF7Aci20xEUYPSTzPL0/RxCzKvV0PaNNmRIOnpLe5z9Usr3UM+Bzwc= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CO1PR10MB4450.namprd10.prod.outlook.com (2603:10b6:303:93::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.20; Tue, 11 Jul 2023 21:46:58 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:46:57 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 16/33] scsi: spi: Have scsi-ml retry spi_execute errors Date: Tue, 11 Jul 2023 16:46:03 -0500 Message-Id: <20230711214620.87232-17-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0106.namprd03.prod.outlook.com (2603:10b6:5:3b7::21) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CO1PR10MB4450:EE_ X-MS-Office365-Filtering-Correlation-Id: 80a2e332-07fa-46b1-44ee-08db8258595e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8Hem1vtepuIo100crHjzNNT+8fw8buQjl6mDIiBQlC3o8VJvZ2VDjEQBc2CGc2CSFFX4Vw9mBKdWNXqqSKsR2QL6Cy81IthUQejAj1QNqQwD0q4ANqeKvc1bXCF2pLMOAVvIXEov21NtoxBbnAHW+GwHhQdKeEHJ/kcMXD7mtsY3vFsBNam6x6jzQwQ5BiC0Ey0QlU0QIIzncOcVIEnGrFVtrabA4IedCXsdOWR85higRlh0U+PqCfYRXeEUMEUcZ5+rFwuKYmKiUmXr/kcQ+kYiuKbAvjuPrsmaUQIncs1T+1OWlJwwZgQl1Dcrc3W9iuoe0oouKvgPDvBmnVJZY/1av1SHRyjrwAbcJ4AfYZeqBykRTfwULJv7oFoKZ0uPwY14qvUaS7BUtnki4xwQbmW49BvG29F1v8qN/oEQqCh648HgJsPCOpyt8wSUhibr9shpUgGkb81c4UAM57PTwnvqatvjMSt6ox7j1JCQwK8h8O0B+YnyVU6wKX5o7uiv7VpFcy6ymowGMTQ/lmlVYE1scbZZv+ZYqhogIVEJpcAh+pGML3nQPMLdT7fyOIrN X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(366004)(376002)(346002)(396003)(136003)(39860400002)(451199021)(83380400001)(2616005)(38100700002)(36756003)(86362001)(478600001)(186003)(26005)(1076003)(6512007)(6486002)(6666004)(5660300002)(8936002)(66946007)(66556008)(66476007)(8676002)(2906002)(41300700001)(4326008)(316002)(107886003)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1kkWPonDRtubjXyMuqVE5JcFsA8n91Q6tHuN2rcraH+NKHMs+mtJMKH99K9Zr4onOGQkRlcC1xKjr6hHSBx/6KCEQSLLqtJeijLJisa4IHOxk0IOBfmH8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cSKUyWFXB11R1dmNvHeIYeHT2WJh0GDx8B284++shNM2ZK62jdqY4znKGa2SWPUhRUFsNkGxdyeSEVSbJqPW/FaQhi3FYfIkKoxSSP+2Hk3vXNb+lMx/VkcQA6StY0/7HKLTzfP3ePCJK1VNRo4qf9FMTpEMaMmEsp0xVSXXnsTo/OjzfMCR6P5JhNxzp95MohTY6sp6kmmuAQYgwnRRV7HRI5tBq31znI5YiiFKTOntZY2rNYSPzHmtW0h4JCvcFhRMDB4wnHw6+S4qeS4SlaY1Up5C32tH0ktHlk50pqnxjfnHJfVqNTpKzBORmHZDAaXPoHKv X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 80a2e332-07fa-46b1-44ee-08db8258595e X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:46:57.8258 (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: zDgV5At9hwUxyQ+hdr1sf9Szks6b7ZGA9kATBQiziCKGjxZM+QQf+h4fkjfn3/b0MYYWIIKHNxTm9nvDxIvjitIdC4V73IY9ucie4unmC9I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4450 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-ORIG-GUID: MT4b6uyFV54jWGzA9IkPgLXALupDlu8T X-Proofpoint-GUID: MT4b6uyFV54jWGzA9IkPgLXALupDlu8T Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has spi_execute have scsi-ml retry errors instead of driving them. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/scsi_transport_spi.c | 35 ++++++++++++++++--------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index f668c1c0a98f..3a7a61d47910 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -108,29 +108,30 @@ static int spi_execute(struct scsi_device *sdev, const void *cmd, enum req_op op, void *buffer, unsigned int bufflen, struct scsi_sense_hdr *sshdr) { - int i, result; - struct scsi_sense_hdr sshdr_tmp; blk_opf_t opf = op | REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = DV_RETRIES, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; const struct scsi_exec_args exec_args = { .req_flags = BLK_MQ_REQ_PM, - .sshdr = sshdr ? : &sshdr_tmp, + .sshdr = sshdr, + .failures = failures, }; - sshdr = exec_args.sshdr; - - for(i = 0; i < DV_RETRIES; i++) { - /* - * The purpose of the RQF_PM flag below is to bypass the - * SDEV_QUIESCE state. - */ - result = scsi_execute_cmd(sdev, cmd, opf, buffer, bufflen, - DV_TIMEOUT, 1, &exec_args); - if (result < 0 || !scsi_sense_valid(sshdr) || - sshdr->sense_key != UNIT_ATTENTION) - break; - } - return result; + /* + * The purpose of the RQF_PM flag below is to bypass the + * SDEV_QUIESCE state. + */ + return scsi_execute_cmd(sdev, cmd, opf, buffer, bufflen, DV_TIMEOUT, 1, + &exec_args); } static struct { From patchwork Tue Jul 11 21:46:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 701784 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 E3F9DC001DC for ; Tue, 11 Jul 2023 21:47:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231555AbjGKVrX (ORCPT ); Tue, 11 Jul 2023 17:47:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231562AbjGKVrL (ORCPT ); Tue, 11 Jul 2023 17:47:11 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03A611704 for ; Tue, 11 Jul 2023 14:47:09 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BIDARE015910; Tue, 11 Jul 2023 21:47:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=VYnOIhUVj1V/50kIYvrfGmYDduLxEuZesuEoU++ELp4=; b=Lz6OcJoQnKKRP2Wjmex4urYqq0D2Nj3F7JVTwsMsIBt5OmnkoaNcvl0uBeYaAVILA1us 62FJGmyOoyd5/ubS6O8kmSSeTC+XUXXzIX8otN7NcOGHu1x7ILTMyFZinbx988hMQ5T6 vcbEy9+Rk9mccee7btwU5PuJXoWmZ3OH0comx2xK/dANqf9ae+f6KG3yAlIk3Dps3lQD Dt0KqQh3gyLmeVX6yqxN42Cbp7+5memb9LKAiO540uT1pL+nP48KqCLQj45coQ1yvsZV SxEu5+Aw2P+biAZvmA48YyZA9Pn9QtoQKcP/NxkASG02W0IruqZ/fgLZTq8imYh6M+JW YA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rr8xumf1u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:47:03 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BLaeG0004195; Tue, 11 Jul 2023 21:47:02 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2045.outbound.protection.outlook.com [104.47.66.45]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rpx8bt2ef-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:47:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KoNpeNSfTT3si0hfPZTJ29yKLZmlFhcdb36VbKMPbyF/Q8pMGrzPFz+Id+fvyJzEmtGTJwpHOACtrq7NYzFT5U1AceiiKz641/1m48s8+k5QThCGetgdslrqWNDgF6sew+6GJKE15oqJ1EbZ2mCCee28EQ05wVlh8gJQYlK6udOBQN7hYz57bThGCp1oY9IEJHL2f4ksKBZ7HKMvs3M5CGRW1+e1XCwbev0P3tDPBq8h6g660aOLDpTiisX9KPCSt7dA4moy33ALcVBP0UF7XFvJMRVTOJ2yrJIHafsns+gCgMd0MvfkirC5JBBH4ILy+549JBzdOjUjxWYPrrMmmA== 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=VYnOIhUVj1V/50kIYvrfGmYDduLxEuZesuEoU++ELp4=; b=bpqTHkiMwLMiAv0/D3C5KtoK4FyYDehjUNU6/DaHYcFQsbe2PVJTVgKq3kibolMxbKYTWzJ95Ntvkh8hujCyeB5+C1RiZ9I8QfPus8AR/M6VoLgVnMgQimF5TdZw8i+FkViu7vjWRlugrAHPHLF0nrVHIoJ74VeRVYiejpSF9aAv9W+9voDtcCH2C1oGsAV5SHvKYpMD/cVvB67W6U6VG8kV67bQq096IKjtla67Y52gUx4AToeGBbXY3Lfi4J38nIl6CH9tGJ++CdDMOxcgkv4ZNusXiL+zwTmn8h/JwoVGn+LKv1YM59biDkgkgrSfeyMwrPDpJ0pnkrVJYSXRTg== 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=VYnOIhUVj1V/50kIYvrfGmYDduLxEuZesuEoU++ELp4=; b=NGmk3oKMGU4O2/qtUlUQAx+kSnqoohA/YhaqPlWRqndFI2acnTNw5q/5paSkSk1jXgvr8GhkW+K+0mIrCtcgdO+nGp5CFDkdOp9neoLPLj0o77wsVuac0LbdW+C5zxmKa++Bdo/elfbxx0yhlC77yAtj00qE2DmOcGBRb5aYgl0= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SA3PR10MB6950.namprd10.prod.outlook.com (2603:10b6:806:31d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Tue, 11 Jul 2023 21:47:00 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:46:59 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 17/33] scsi: sd: Fix sshdr use in sd_suspend_common Date: Tue, 11 Jul 2023 16:46:04 -0500 Message-Id: <20230711214620.87232-18-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0202.namprd03.prod.outlook.com (2603:10b6:5:3b6::27) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SA3PR10MB6950:EE_ X-MS-Office365-Filtering-Correlation-Id: c962d6ad-eee7-4e52-7b46-08db82585a8f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7fGoqwWsHykCj71KAWYu+7asG/na3MosTD/pVaUtelOa7zOVh2e+9ki7tmk/MoJhgSk8xRxFbEzqx1oWIxAp9f8DiVsk9376y90IBZnQ8WASaGkzMW+3CZIhuolZEEfbwlPzJvfIEv0JXV3HJAchI+Um/J+PolJyi9BpoOaEw6M5cKe/9zHjx2Pe49F8nx9Ax0FOTc+2aGNO7Aoo/BO4Xa69R0kSpTOUQ8d9zXbi5knrsmo3dNkySq6iQz0KqrbvCDdwDBX4+pjhHCriWKUW+Nb2xEc1iYcWaSsCuITpZAkRnuscl1wMAuYENbdiMcqDSQCvFE4PTqOBo2TLO4zcydp6wEgZ9bj9LN9sUx9BUckjsFQGT1/CowHUa30h79agOQWostj6RkrTutrbBgs4YZpz2qKv5uNtDbb07xrEnmsKFgsy9rXTrn2e+o0hj5yyf7zWV6bS1/d++w2WY/Tj4JDdZj1yufFOWkPW8NFYpQK6icXSEhYjBY1Qc+wCHW9oNcvVQqdYyH363FRUiHR84EAj86kH4QM6cluzy9cB8wcGa3bpR+5+8Q0eq3Cl/Zcr X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(39860400002)(136003)(396003)(346002)(366004)(376002)(451199021)(186003)(6506007)(2616005)(6512007)(478600001)(26005)(1076003)(107886003)(83380400001)(41300700001)(4326008)(5660300002)(66556008)(2906002)(316002)(8676002)(8936002)(66946007)(66476007)(6486002)(6666004)(36756003)(38100700002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jWZMK+fEYbzSdQ5hB6G/r77734QZF6VsQl3bv55r1TwJyezHjL7ssJb2d1XkHjdfu+XicdwXjtu2+5vx85fhWwJzGk33uiJtfEbiG6pUrajsKt6Y8/j2drf3r9cKu0uTtBmZeZahgJrOwGbZSF25EhiAEcqqogEf3H8CxrhSFvjUI6mWl2JMA1VYSMDpztCQy4yzkdV9NUIbYpy0njG5JbPtyssLQNvAQZ4BYCuyDDrUHbWZpqPNzVvAKM746dwhTd5cX3wA71NLPBtViBxIU/9ic9KczRKnXZxrJN19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/MQQX6tWc+uBrgqab1Dq3CIu2wYh2wRf6v8GFMM12VB+6l+X5iUQlXMNkn9KDOaUn6kvsFCpXErHP0VOoSrnhWDE3q7Ezx4Ce0ZYXI0TH8ybmrlxRt1WlM5t4rNebcWVZvcHcjDr5Z X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c962d6ad-eee7-4e52-7b46-08db82585a8f X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:46:59.8653 (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: krKyVmx7yGj4nfBTAppy6z7QJZfvp2sXRvcaVK8ue1Stx/piTg5c9XOt5uiHRdGupIIZxxAPKaqcctpWfRPrMnI6qdg8G67bbQuUWZ1WnJc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR10MB6950 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 phishscore=0 spamscore=0 mlxlogscore=999 suspectscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-GUID: zgzKJnj8zFj49ExPIre1rgmpR-_0VDxs X-Proofpoint-ORIG-GUID: zgzKJnj8zFj49ExPIre1rgmpR-_0VDxs Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0, it doesn't initialize the sshdr, so we shouldn't access the sshdr. If it returns 0, then the cmd executed successfully, so there is no need to check the sshdr. To avoid where sd_suspend_common will access the sshdr but scsi_execute_cmd has not initialized it and to allow sd_sync_cache to convert device/host/status errors to -EXYZ values, this has sd_sync_cache convert ILLEGAL_REQUEST to -EOPNOTSUPP. sd_suspend_common can then check for that error instead of using a sshdr. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index e67a3d163b24..bb2e5885e41b 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1604,24 +1604,21 @@ static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing) return disk_changed ? DISK_EVENT_MEDIA_CHANGE : 0; } -static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr) +static int sd_sync_cache(struct scsi_disk *sdkp) { int retries, res; struct scsi_device *sdp = sdkp->device; const int timeout = sdp->request_queue->rq_timeout * SD_FLUSH_TIMEOUT_MULTIPLIER; - struct scsi_sense_hdr my_sshdr; + struct scsi_sense_hdr sshdr; const struct scsi_exec_args exec_args = { .req_flags = BLK_MQ_REQ_PM, - /* caller might not be interested in sense, but we need it */ - .sshdr = sshdr ? : &my_sshdr, + .sshdr = &sshdr, }; if (!scsi_device_online(sdp)) return -ENODEV; - sshdr = exec_args.sshdr; - for (retries = 3; retries > 0; --retries) { unsigned char cmd[16] = { 0 }; @@ -1646,15 +1643,19 @@ static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr) return res; if (scsi_status_is_check_condition(res) && - scsi_sense_valid(sshdr)) { - sd_print_sense_hdr(sdkp, sshdr); + scsi_sense_valid(&sshdr)) { + sd_print_sense_hdr(sdkp, &sshdr); /* we need to evaluate the error return */ - if (sshdr->asc == 0x3a || /* medium not present */ - sshdr->asc == 0x20 || /* invalid command */ - (sshdr->asc == 0x74 && sshdr->ascq == 0x71)) /* drive is password locked */ + if (sshdr.asc == 0x3a || /* medium not present */ + sshdr.asc == 0x20 || /* invalid command */ + (sshdr.asc == 0x74 && sshdr.ascq == 0x71)) /* drive is password locked */ /* this is no error here */ return 0; + + /* This drive doesn't support sync. */ + if (sshdr.sense_key == ILLEGAL_REQUEST) + return -EOPNOTSUPP; } switch (host_byte(res)) { @@ -3849,7 +3850,7 @@ static void sd_shutdown(struct device *dev) if (sdkp->WCE && sdkp->media_present) { sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n"); - sd_sync_cache(sdkp, NULL); + sd_sync_cache(sdkp); } if (system_state != SYSTEM_RESTART && sdkp->device->manage_start_stop) { @@ -3861,7 +3862,6 @@ static void sd_shutdown(struct device *dev) static int sd_suspend_common(struct device *dev, bool ignore_stop_errors) { struct scsi_disk *sdkp = dev_get_drvdata(dev); - struct scsi_sense_hdr sshdr; int ret = 0; if (!sdkp) /* E.g.: runtime suspend following sd_remove() */ @@ -3870,21 +3870,18 @@ static int sd_suspend_common(struct device *dev, bool ignore_stop_errors) if (sdkp->WCE && sdkp->media_present) { if (!sdkp->device->silence_suspend) sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n"); - ret = sd_sync_cache(sdkp, &sshdr); + ret = sd_sync_cache(sdkp); if (ret) { /* ignore OFFLINE device */ if (ret == -ENODEV) return 0; - if (!scsi_sense_valid(&sshdr) || - sshdr.sense_key != ILLEGAL_REQUEST) + if (ret != -EOPNOTSUPP) return ret; - /* - * sshdr.sense_key == ILLEGAL_REQUEST means this drive - * doesn't support sync. There's not much to do and - * suspend shouldn't fail. + * The drive doesn't support sync. There's not much to + * do and suspend shouldn't fail. */ ret = 0; } From patchwork Tue Jul 11 21:46:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 701782 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 BEAECC0015E for ; Tue, 11 Jul 2023 21:47:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231615AbjGKVrm (ORCPT ); Tue, 11 Jul 2023 17:47:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231601AbjGKVrU (ORCPT ); Tue, 11 Jul 2023 17:47:20 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19E2D1981 for ; Tue, 11 Jul 2023 14:47:19 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BID1Mv015322; Tue, 11 Jul 2023 21:47:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=pHKNtgIUFHVEtc/4QuNyz0PNa7BvaEIkSWnhqHDsyRg=; b=mtHqHvw8Rtrrv/ecEBngnVXgixLmuQ4XSfUsHla/qw3C0rXOuEpqZpMrawhSSCVHDn/Y hEo+kLTLFMTcOHWMtX/LFPhbRAGXd0PQg6LjfW3CB1Eq3Iu1PVuiTPzwDZnyxzWIVqbC 0Y5Visi4Xbr9qv+f/uJ/BdCqgIErJOeCxWah0YgkFLuBpU3Qq4r3lvhXNUi9sJmASfct wC4ypHs3b5RbGDXwUBeHrJATNmOpthzopSxfP29+JnPf5cqNMJtddjKFkWdrFbOh/weY 9+XghlCqVpD6n7vIffdrIXUhR6f9K5Wthq2Gj34MXJ08DiCuVExEIo3canr/DaM/25Sn 2g== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rr8xumf22-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:47:10 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BJxGbF007247; Tue, 11 Jul 2023 21:47:09 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2044.outbound.protection.outlook.com [104.47.66.44]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rpx85h1d7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:47:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=khJrHT/h559GjB+jBwOkwJdYrYfgT08WlyVxLQaQvu4kMw/qkO+O94iY0EnD6D/x5SJGyol479u/PP7qRVL9Q66fLYUVq8fqhcwbuOp9jaQBZqY+w06FtYusfL55kcebQMg6riCkmKVWCjIYAxgFXoXzR1uD4rG9l69yEYrcGlYLWK5nAWXK7lKOBwuIJliAxQCGlLcWjt3W/sUiKZQczeNzeOR5lesqTdPNqtDcYYmbCJUBE0MFQF+hsDHJaeBXzI7q9+ZnAQBZCvqdB2fYeJ+ocnP971nMRhO1uDgGnS0MxKKYPgORjkFgtObJ72dOiqnYJcstGoD2BglwHUEREA== 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=pHKNtgIUFHVEtc/4QuNyz0PNa7BvaEIkSWnhqHDsyRg=; b=Wpfk4gM8esWEmR4Be2sRKO0xv3wI2BMFD28JEJyMmGWoiLcq5oqenjfnULsSuGtOpkpf4fpEDw/Zescb3pyOJlYkC5zECMi3a35HCLnG7PqOoUfuMWStpZQ2IUtTs1G9dGSp9DUCf/h0Iw2M007XZlLDpXVLbGIcNsiUx0oJtMVUZpLO7kmNG8ih9NbaQBDxK3qZZs9iEYdARtJHWtQE4PndQqWtsu2n3+kIU/FFRq3B6FgF16GkLwKmW8RFnDuKqBKrmoicoNvdsxdl6rSqMDJlwJ1zv0sxBQQQg8KZTveQS3azN5tDOl5aIbM8Fu+0M6rbuHxyyDyaPQ/MT+1FsA== 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=pHKNtgIUFHVEtc/4QuNyz0PNa7BvaEIkSWnhqHDsyRg=; b=cTtnpHy+eXtckG7xI+IiHmhegpCku3wR/xXm8CRDYeoFPjlKn34rCS9LcmKSRPwz3Eu8o3ceKRY0bPesj3+z7QtssK5f7R+IyvzZBpm/Tvivz3mLzKQyxpzZJYN5NPotu2bFGMqD4a77dBS1AG2Jm+I3bMe0ui0juaEuJt1M5qk= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SA3PR10MB6950.namprd10.prod.outlook.com (2603:10b6:806:31d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Tue, 11 Jul 2023 21:47:02 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:47:02 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 18/33] scsi: sd: Have scsi-ml retry sd_sync_cache errors Date: Tue, 11 Jul 2023 16:46:05 -0500 Message-Id: <20230711214620.87232-19-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0005.namprd03.prod.outlook.com (2603:10b6:5:3b8::10) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SA3PR10MB6950:EE_ X-MS-Office365-Filtering-Correlation-Id: e60c40f8-cef8-4283-ebc5-08db82585bf9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: b9kJVlYjb69uqTfghsUvcBQHYWWMHRHLWOVmsApt8xMVREUp4NOEbp8/4rJZL/MTj9qBO6RWV8Eba7CeYHqxsPbMBMTbakq+3NMA8NCyjVvteeekWEEs+i3uV1njdmDd4eqKM1X86i4MY0yriSK854xBRdAXDOKOP//jEr1a+YfUyGTi1IeDsiOg5pYTE2t+jlFkY79gns7Z0arMVPpYQ50DneRrXICwolBAmvR74lWcr9t0g6DZtyG4zcBeolnFmTxq7wGjOllH+FriD9+TjmKyJgevWwR/o+yoJdl53/Ht4762RXG/rwdDPGhxpcVkA92dYFaoBPsGMXbaydKZCP0hRG0j47ygIti3VGGFGc1JYBTjjUzMuy+ve/EBNsBbZAkUD8VmC3WAwSWh25bZ/6dGLgoFOQ2Dn0oA6VIAZwaSmcA94YzEZcgalnzl24pjw2Th+5oqYURjns+oF8D+l2aVNLks7Qjxjz/vNZ2TgBF5uKPjDNePjQj67hwqAyr4+4r+WoTnHh0mg8q+zfpnOV8NI6/HQdvMQPJOyh9Mc28TVQqwYA6NjZitadD+2MXu X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(39860400002)(136003)(396003)(346002)(366004)(376002)(451199021)(186003)(6506007)(2616005)(6512007)(478600001)(26005)(1076003)(107886003)(83380400001)(41300700001)(4326008)(5660300002)(66556008)(2906002)(316002)(8676002)(8936002)(66946007)(66476007)(6486002)(36756003)(38100700002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kMDynyxkbGbvYDw+Y0JSrMN+lYjds+nnheY+i3/JOUBMUnqKZR1EQj3R8DkdFCe2r54GWv7xy0ePahpXsqOqIs3OdyRr2WMknGD0zGSvOX8C7tEoft+65kooa2xH9XcqkqikvJH5QuODT+4dDE4ew/jwvFjBYWwUPg5y4DLxz/8KrRPMbL7242xOiigxHllsUNuFkdb0xsOnhnQaLyxoixjRORq4zwQm7o8NlryrUpb+euSVhAO6pV9dxii0mRL9rUfEyebLVte+J608OfFkQ+/gXYVq+Dw1woyhvqatVSGfXiBwWD0EzrkdxzUstQ3X0hu9oo++eJ08szDVWFkjMleo1ntXjUxoKNCW2jTQtTHVsUHYEQRor/V3hG2MTFF69Nth7+L4P+jCbr0t1W+lyEZkpiVTNqWn6Lk2cD2qa3JNv8/giwu0aeoFzK2TS31His95y1gh+YIN7lUuL67r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-Exchange-CrossTenant-Network-Message-Id: e60c40f8-cef8-4283-ebc5-08db82585bf9 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:47:02.2089 (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: zKhf4D0HVO66K2wpD2p7FsHpBy0yNlxR6kDjtWDnM0P6GFtA2+Kz5t2JFR6gXJuVyG1maV8OQozMN0JbaWHgr9SE5ZDY/ingnl44L8/r+lU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR10MB6950 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 spamscore=0 phishscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-GUID: RVmV5a_h4axNhS_4_9JomeOy3lEFuwCr X-Proofpoint-ORIG-GUID: RVmV5a_h4axNhS_4_9JomeOy3lEFuwCr Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has sd_sync_cache have scsi-ml retry errors instead of driving them itself. There is one behavior change where we no longer retry when scsi_execute_cmd returns < 0, but we should be ok. We don't need to retry for failures like the queue being removed, and for the case where there are no tags/reqs the block layer waits/retries for us. For possible memory allocation failures from blk_rq_map_kern we use GFP_NOIO, so retrying will probably not help. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index bb2e5885e41b..ab0d6b1835be 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1606,36 +1606,32 @@ static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing) static int sd_sync_cache(struct scsi_disk *sdkp) { - int retries, res; + int res; struct scsi_device *sdp = sdkp->device; const int timeout = sdp->request_queue->rq_timeout * SD_FLUSH_TIMEOUT_MULTIPLIER; + /* Leave the rest of the command zero to indicate flush everything. */ + const unsigned char cmd[16] = { sdp->use_16_for_sync ? + SYNCHRONIZE_CACHE_16 : SYNCHRONIZE_CACHE }; struct scsi_sense_hdr sshdr; + struct scsi_failure failures[] = { + { + .allowed = 3, + .result = SCMD_FAILURE_RESULT_ANY, + }, + {}, + }; const struct scsi_exec_args exec_args = { .req_flags = BLK_MQ_REQ_PM, .sshdr = &sshdr, + .failures = failures, }; if (!scsi_device_online(sdp)) return -ENODEV; - for (retries = 3; retries > 0; --retries) { - unsigned char cmd[16] = { 0 }; - - if (sdp->use_16_for_sync) - cmd[0] = SYNCHRONIZE_CACHE_16; - else - cmd[0] = SYNCHRONIZE_CACHE; - /* - * Leave the rest of the command zero to indicate - * flush everything. - */ - res = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, NULL, 0, - timeout, sdkp->max_retries, &exec_args); - if (res == 0) - break; - } - + res = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, NULL, 0, timeout, + sdkp->max_retries, &exec_args); if (res) { sd_print_result(sdkp, "Synchronize Cache(10) failed", res); From patchwork Tue Jul 11 21:46:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 701783 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 D5B81EB64DC for ; Tue, 11 Jul 2023 21:47:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231669AbjGKVrj (ORCPT ); Tue, 11 Jul 2023 17:47:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231582AbjGKVrU (ORCPT ); Tue, 11 Jul 2023 17:47:20 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FF78173C for ; Tue, 11 Jul 2023 14:47:17 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BICu0T015121; Tue, 11 Jul 2023 21:47:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=Ds52T6Jbh8rYeYhx4qBoVeLXGAn9pSepUMo3yJrjZR4=; b=neM4R/20vVlmPHT5WFYFpGASMkP3G5CBbUJYTQPkj4450eSVQ4sxK6HDFFkqWH+w9Pvu j6S4U4NsH+7fPdxb9fPCLXXzg3WVj9TAWkxePsD19OBpcudj0pdICh5YEgf4Oh1JwOVX AF9cs26sl5/uxQBh7X6gU9dJ2drO32kyvfnKszlRIaykfgqyvQ11SxPlF8WUSC5TizDR M0wYscQDL+IBRPbrRVjkTD3vRENgvrffA9wtD/49pVNfXuv9/+rr9bl2RWCWIrD3wnxy yfQ9O4SmxccdbbWUyQNobYqLonqFtNpY8823dUnwGtoJGhQTAlnbwrjo0e4UJvrJqmo3 bg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rrea2v0kj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:47:10 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BJxGbG007247; Tue, 11 Jul 2023 21:47:10 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2044.outbound.protection.outlook.com [104.47.66.44]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rpx85h1d7-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:47:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mQROv/6ztkiu3FKjMbKV7UPTGO6YPuTS4I9pKLpaMfXutmMdlrganI1/TfiNDoBc1T94NjRdcfp5zRVKI82/nJbtfPYwM32E/Z1hjYCo0QwGTxki6dC60LicRlbSBTmH9cuRNu7z5dvl9VEUAfF2RGklqEk/q3rHE8K+B5nfdlsT8t3owhHhVzrfq6NIDzaUlgaCU0ZSFC2z1LWrpLwpIwOrR3sTzFp+sjCMqgD4IKRi4fZ96ajOh4t8DC6QU+7h4tArw4dTH3qyZBHOE1SiTIEbnLfaQkXDvkn7i0Wx/EvV307mswR4FPsewghanCaVwDZga98ZXpA0NTuA0qk6Wg== 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=Ds52T6Jbh8rYeYhx4qBoVeLXGAn9pSepUMo3yJrjZR4=; b=InRYr6JNBCkFkZmdf8bYl+QFPeIHuejrFAoJTli7uLMIvGhTvYuFXtelbxM5F6jgf+ur+43ttGtdI1K2wH4GX1N201845/u+Gj9SFrnWRaqWAiAOT+7duQUeIb2ziLMhCZwsdPVp1G3wGrC4/MfD/x1gy/Ab4qE9jtnzhdjcONUZ38RvzG4/1SxoL0Yxh5k0v5eTG6CQcprE6UbcnzWbNjK5xzPnRuoRotlRJRprkZ5hEsM4n+hnL0gruxBUHoA4wM+gsHdVQiWx+VDjLun4WQ7ZwRiK4I8cjZRPl8ncT6jbVrrgvhywFxfBN2cuxiNsKeCHw9RT/66/7UQEVjNhDQ== 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=Ds52T6Jbh8rYeYhx4qBoVeLXGAn9pSepUMo3yJrjZR4=; b=MYzD7AhWewyqc8IIwAchgaWUwcHBQFYgoRQMfSByWejiLyJJNnG3qt0s29avcnS4gVA99jr6d9cDJQgbRMfiVk6MuSMQJ/g0wH1cqiz+57iKBS30iU5bkcT2V7vxwShAo7/3dCGczPGqIwtjPWvgCXau5EZukJi5ofn8tKA2P2I= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SA3PR10MB6950.namprd10.prod.outlook.com (2603:10b6:806:31d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.30; Tue, 11 Jul 2023 21:47:04 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:47:03 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 19/33] scsi: ch: Remove unit_attention Date: Tue, 11 Jul 2023 16:46:06 -0500 Message-Id: <20230711214620.87232-20-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR07CA0093.namprd07.prod.outlook.com (2603:10b6:5:337::26) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SA3PR10MB6950:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f14f69c-64de-405f-8419-08db82585d4c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M09tSuET4ftukoQRAq4cAwZ+DDCSvlQxjC3N4ADx6A3N60RJzkr3cq3Fi0h0hOerv9hTncSGIFL+YnHEQGscuhM+IoJURDJZtvLyB8Vp7wp+QEgfdUng7srvCQgc3UlVta+g/j6Uzj6aQf7vqLTDF5D8p/afhyrZYLXhA01riMpxh6AR8x6ez2Om8EM10JWy7Nh/5qNF2RVVeT6pSK6JaD0UUwsbc85VSmK5LX3yPZEiRIwjQD0hNmIJ9lReNXbxcUefs+b/e2wBweJxbhLhnhIghvXSp4d7zHM0KmfCAGtFJ7sG+m0Znf7MVwYGnT6QUbSZ57PQ5Q33iuYzF5Zid53LMpREb1bhtqF/lC7TZh0ImRJNS3VIcAVKjAGTsjhiDa1O6Qjt8BneYDp/7Nvy8BzUylQfGX3HWJhgl8Z0Gg6pzXOypfuHElRTzNeHS3G7BBQdrAllaY6x6/AY3RwUQX97NswXSBrnSZHN6Du7gxu4wl3dDbMC3hq/e/jlB+4ZWW2jVyUlXvaLVTsg8GSUMPMM/z4xQK2j3zEah4Q6p7QLBqD0/MsR/BNBXJzyIdl6 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(39860400002)(136003)(396003)(346002)(366004)(376002)(451199021)(186003)(6506007)(2616005)(6512007)(478600001)(26005)(1076003)(107886003)(83380400001)(4744005)(41300700001)(4326008)(5660300002)(66556008)(2906002)(316002)(8676002)(8936002)(66946007)(66476007)(6486002)(36756003)(38100700002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qU/r8bx06+T6CPKJimc05zHg5/OYW3LtQIVIY+qnGHfmqVR3Xpsaawkz7Cg5cmv3QFqaxNY9Gnbd/1RK8sstEF2yafQWCCYo6JJTeL15yYRfkXvjym8/zHKDSJjOXbpMGoM1Hi0KGybz3kQpSefGC7cxGtO+sl+yDGw16RNKR8+Uas00D22fivp8atXS+UtAF/exnn9+AzZvoPpn0v2yZyey4o3I4CZ8jcg1JuNdgGrs2gNGkIMIDIst+Dr6Otrl+rdb9MXs4CJ/Rexh0Uo3LAgmYPpaFjn0Ibd0jZ+exKgH9SXKUoEOLCwV4B/aw1xbtgTL7o/ldc/JuvxvdQQXduyRjGn2HqwN1JAJEwwiqhu8B9FH8uc3+P1XgDpmtbDsV+kyzd07ggRI6QzCj+MyL5EqvYMqzR+sChvDbTJc6WkNi02mw1kbm3Y2ozxkBG07F/J4K8T0JxpeviMB/K5b4RTm8xA3YhnLp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JAhCJZc1cSl69uUKVvpQWMhF7e90JZdYWybOWk/ypcW5nzkwpmQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: rbn4+yZlzRpwuuxlxxApxK0YTYtt1hH7FOiL4VEXLfL2n9jikworuYPGD07bHtHd8R4GDupA9cvCDYddbb95Nbt9kWeX2vut6D5LHTHrxEYLEeObQxpqFwaLWwEbj0Bpq8nsAxDe1Twl2p3HdKLYyUn0d5XeKlLloMYDj0gf+e72YfwcerOd7I+C7lJ6GIEwYcPpXfggnq7fzQB9MhxVs632l9vdC2yyj223UpqH5vycTdYFif75+bO1oDJHL7NM9AzsXDMWG/9OAufAzuMJ+g+vYnzJsufUhzr33LIyzzJfx4T9DRaagvHgldN4Jt3tbvhf/YNY8MyaSM2oKUwEY0MG5Plhw5aN43OrtIrUMh7H2tpwgWMBtYXpgl0FxtfPwIjO7LQpfDDQDwyQExOoXRuvOyE/PLQDsMFqVJNBdm9MRBMbOdVIcMbm5AQhoIZ3Yl9DR5Wt2qzMEqoTjiaa0LZaD/FL8NGpUjuqDzIA/9Kyx/yYxPw3IB2Q5ZOnXEvI6MiQcFsQIm2OAy6D3481tq/ROxkiHSOGGK6Q4atcNMP7ZXnhCJz4ZvwYsUkoVzoTCNihkS/DfFTwjvYgX6jz7fNZJ2PkfgfKgLq7oLKV2CQQbcPjnLXyTlDwaOdmAWPa4xCe4acLQL+3bKT5jXY9Z6hDZyO6Q6wZDeOK0p7wfGCRZPcvC/MJmNqw09XwmTs3xfrokZpJMD235quYAc9sjMfvYn3L55e/oXGf1ZCoSpcCYu3biPZYvE4Bcyef81A4tzyhbOjKDDnUGxrn8VMFPg3GSkCxPrbTDZEozy+GRdP47o4sE72B0H6K/vGbDStxPizY3e0jw9RS93ZhaEKpt8+T9vMrb0F4cBOd78cEhfp+TD6SrUSIrtKrb/AGn33u X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f14f69c-64de-405f-8419-08db82585d4c X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:47:03.8865 (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: dpQuxIu+7VVTKdyYRl3MMkKgOmX1xdLN9akJij0iOyzNcXnidnx+xPaoTV5n9vXIAt4/CBKUXQdZna1/78UuWgmcjdKEr//+4aRThEtbs2s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR10MB6950 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 spamscore=0 phishscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-GUID: lGw8Yb-UGU_S1ocCe4VMPW3msbsH06f_ X-Proofpoint-ORIG-GUID: lGw8Yb-UGU_S1ocCe4VMPW3msbsH06f_ Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org unit_attention is not used so remove it. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/ch.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index ac648bb8f7e7..ff4a81a1b056 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -113,7 +113,6 @@ typedef struct { struct scsi_device **dt; /* ptrs to data transfer elements */ u_int firsts[CH_TYPES]; u_int counts[CH_TYPES]; - u_int unit_attention; u_int voltags; struct mutex lock; } scsi_changer; @@ -208,7 +207,6 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, switch(sshdr.sense_key) { case UNIT_ATTENTION: - ch->unit_attention = 1; if (retries++ < 3) goto retry; break; From patchwork Tue Jul 11 21:46:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 702171 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 2A6C5C0015E for ; Tue, 11 Jul 2023 21:48:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231648AbjGKVsT (ORCPT ); Tue, 11 Jul 2023 17:48:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231562AbjGKVsS (ORCPT ); Tue, 11 Jul 2023 17:48:18 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C9C110C7 for ; Tue, 11 Jul 2023 14:48:17 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BID4TU015542; Tue, 11 Jul 2023 21:47:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=Li1zk6JkiIkpaa7zgxQZGl5c7wtKiXpkb7E1T8VyQuM=; b=ecsJZnB4BM/D6g8aZZ0NfMyj3Gxeep1aJu2nSmhVXIRSz52K854E6vyasQVvvDX3T2Kp eYabyv+/0izpft+sS8fWrM5xbZ8vQ5U3D3icPM2LiNdyed8sUvRRUpbULsgF3z61uHHs yIKWkC9iAleLiz+PFSk1L7iC3U6A6YwthYaCxfZtY5I6LpwDQppOYz0sCJuT6ltBOule KUAUPY6O/y4C9JCG/70vu1VFhFu09i+zwagxNn/lK6BN0TZD2vJD8Nma6oPXrts0JnhL 0fF6dYdS5EnGHX5qY3EShCvRHE+qGxKQD8DlKtavJ1ky2SVFv6Gr//MOwmPm6fZQPX+I Wg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rr8xumf20-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:47:08 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BJv9Im000601; Tue, 11 Jul 2023 21:47:07 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rqd29shh8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:47:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e1OByOUtFWARjoKGF2eyrWBIIw4+bdqBmiYJpLAw4DJkWkcfoMGPPPthCM4HMJPpUP3ndRTw+KEJ+pvPfuOFdPq/RbKJDZUesxwcDJhCIS8aQJVw2yym4hmmap2w7BdIQewtxp0qAxYmbxQgQw/rJCRWLphciAuot6+4dOHR2PrdJL5Snkk/56pQDd/0hYeU+tk8WFuu/5JZUxi1GBYnuwZHFoa/kG5Gga0Cmt6WKsgST/JOomTlqD6u6xszjymIUIHKR9QeeUqGFYE7JaVZgiC7zJEPJYzQ13Gb5SmOsi0fEFWDCDzh0glHCQEYEO1u9u3TCQjNUVK0ZCyLac15tg== 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=Li1zk6JkiIkpaa7zgxQZGl5c7wtKiXpkb7E1T8VyQuM=; b=gIKTs+7ktLRbxYRYwToupxh1J/pcZdZ5RZxH1MLe1Gib/emsyDznJTghr48FA/oFleEmOvNEPIi8/jIIvPb1EXXfZPGR8dNBcGbJ/HNz1UStsXWyoePXmxfDr0IDIsu3/Qph2VkO1HFSumfDG6N3E3UfEj6+NjI3IvVOVlX7wyHQPMyZDi1XquBErklzX7foWR+gFDZalObIxXjhF4aVF51tXIcHsYDlgtJy5PKP1IbZ1e7qv9S/osLi/m4yI9dmbfL0wTjRnkJJ30pI94I1wwNNqfG2HHxuuRnlsy2XUgFDpqUiyr4w6Ah7aP7SLxfPDHwmDD4r3cfqiLOJMzupNA== 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=Li1zk6JkiIkpaa7zgxQZGl5c7wtKiXpkb7E1T8VyQuM=; b=DpwhH6ukxyOz6vnaWGtZePDWBLSUK56WW7G6suJX9mR9dgmLVKym0M9l3gVOCF7YJt/+F/7Ya24+GUj2opg0QE4XhpxH+Xs4WKMSEZBYtY7aNaMMHtaVfXWI8uYhS5MHZsbHm1rk+9K1FOmR/tvAzYlYb6ao0xPhKQq0IoJssx4= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH3PR10MB7436.namprd10.prod.outlook.com (2603:10b6:610:158::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.32; Tue, 11 Jul 2023 21:47:05 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:47:05 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 20/33] scsi: ch: Have scsi-ml retry ch_do_scsi errors Date: Tue, 11 Jul 2023 16:46:07 -0500 Message-Id: <20230711214620.87232-21-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR04CA0025.namprd04.prod.outlook.com (2603:10b6:5:334::30) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH3PR10MB7436:EE_ X-MS-Office365-Filtering-Correlation-Id: 51fe3826-df51-4937-589b-08db82585e5c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vo3qeWegKAQ2+f+rH9TrRzfuUNgeT0AN2sPLcNnrCaS0CAEg/9YKF6TzOW+CzXafTDPop0tHIyYIqS7/4nU4JfpMHLOO2EjrqLSZSJ6+d7dlBrRqkhDXnXt9pH0SwvFx4bDGMIp1A6gxSrto1N555GFnAw2TQHrWlsSSuShRGyzmrj3d1KvgJrpJsofchLmVj0DRLOAvk+HPbXEQ5b0Tn3K8EsL5Lh9gTSFjLNhSAaVwR4DXSPIHifH0Omn6d2zkOhxc545IaO/eEeoNtQNvSgnpj76C95t0zdwBnMHTQpfWir5E1zZFV/uP7EGBYx0n8YEm/yhpXIDcU/js/lMZ7u+Gw/tTXkIxY5rMpMFj29kWl348ZpgzhA51fdBG3Re41sOfx9SoqaP1JJC43zpCDIUPDo77UOi5pfTtp61Wo8HiPOWHMgT7wvBN8gNaltZMsbt08zyLs87AWRcU1AP4wzXqw+QqAJLRHI7dIJt31RMDyknP4LYrQnkjvGsPSRwHEXVeQLK37xIX3wfoZLhIOMskjGLy4R0jO66Ty7OgWg2c3GcjsK8XNo9Ztnkh9B5F X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(39860400002)(396003)(376002)(366004)(136003)(346002)(451199021)(83380400001)(41300700001)(2616005)(8936002)(107886003)(4326008)(5660300002)(66476007)(66556008)(8676002)(316002)(1076003)(6506007)(38100700002)(26005)(6512007)(478600001)(6486002)(66946007)(86362001)(186003)(36756003)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BLwM24Ty1k5qj16Erib49DJGRxSJa/n0fNskYgLzkrlqBeVkeABkaMGOEYkxFtlbTgiuEUo8e8IPQzyD1ZrzBcfN50HCNXLIyoEqVBFSIm/M/b23ePHqTA74K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zMKul0wiZjuOSoD7gltv1FpBhfnc8V+XCLXFGi01OYPGCXZqvFXB1ODh6wj7jMHDoBmNnbKPP0Ml+YtnrEE/7paui+BZE1hZBkfttgUwyeTA5fEuFcLym6ZNgrBLNCJ1gIeZWetwVm59K2Homp3NHDk2YR9IvXH/Ttt/2OsOjNVgBls9rAI3d/KSpP02IQt67iApfSmCZmCCwT7FrXu/iCKSLwrJQf0vN5zNg3kotVxFxbUhLtAbmTH0Qmz9mNQAVYJlSEcZFB18nggRrNiblAZs5F56IJgH7euiA/JyLBzxFj1n4lbvApYUvK5tsV6HCW X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 51fe3826-df51-4937-589b-08db82585e5c X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:47:05.7792 (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: Aj0NdPD0KoKpZ6ACCtf7BhGIFuEjkV17xYHl7b3+zBzfXkFRHhdS5+PXsJu35AT2wub4+9a91j1P4eteiSJeSiT8rlhfmqX8q0DXDFp5tkc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR10MB7436 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-GUID: 7dgG_McvSAYCcxYKemYS7jAp1ZuNzZpF X-Proofpoint-ORIG-GUID: 7dgG_McvSAYCcxYKemYS7jAp1ZuNzZpF Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has ch_do_scsi have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/ch.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index ff4a81a1b056..f2c0778afd50 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -185,16 +185,26 @@ static int ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, void *buffer, unsigned int buflength, enum req_op op) { - int errno, retries = 0, timeout, result; + int errno, timeout, result; struct scsi_sense_hdr sshdr; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 3, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = failures, }; timeout = (cmd[0] == INITIALIZE_ELEMENT_STATUS) ? timeout_init : timeout_move; - retry: errno = 0; result = scsi_execute_cmd(ch->device, cmd, op, buffer, buflength, timeout * HZ, MAX_RETRIES, &exec_args); @@ -204,13 +214,6 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, if (debug) scsi_print_sense_hdr(ch->device, ch->name, &sshdr); errno = ch_find_errno(&sshdr); - - switch(sshdr.sense_key) { - case UNIT_ATTENTION: - if (retries++ < 3) - goto retry; - break; - } } return errno; } From patchwork Tue Jul 11 21:46:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 702173 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 F1170EB64DD for ; Tue, 11 Jul 2023 21:47:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231600AbjGKVrk (ORCPT ); Tue, 11 Jul 2023 17:47:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231674AbjGKVrU (ORCPT ); Tue, 11 Jul 2023 17:47:20 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C8251980 for ; Tue, 11 Jul 2023 14:47:17 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BIDGEE018425; Tue, 11 Jul 2023 21:47:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=CMWn8qmeqXrBQ9aIOu9+nUZLMY7grlTbOE6X/i6RNZc=; b=hifLdUHrp/Yje9kBEPxl9WLUQ+6LGq42Mu65e6bQtyLiJPlfkAtqeeYyZp6gG0Jzncuf 32mqwl4oH05UuZ1OU4yXKbp+SaLDGiQyzCz/3D2BXMpzuCpoinDxKqYUwZFK1h65jo+f JiZELjAN/6T0SwMO5p1LqsCNH67HtW9hjr2r3QiLwbqZbF2wadaWmR/ZMLLp2m+JoLhY zswBTou7cUgKtkWLauW2SSlJgWq8ayh0AmNCZyd5a8UkThtPFG02TlpuJIQIdL+HIi11 JeIXEB/LzKUzSEJ2hylbuGcjUyAgfpGHqRNjy3nnhN4P6jzSMojlPK2+UDQroCZNXjA7 jA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rpydtwy0h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:47:09 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BJvjZA000554; Tue, 11 Jul 2023 21:47:09 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rqd29shjb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:47:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vh7BSKSjjcuGON/+aeX7RwYjccOWYZ2N8ulEZUTQO95VCBTox7iF403J6w2ft0JQ8ckdcWOBNcTL9OImnIrQBOw9++vUWOoW8vpgbGk1dn0gMozGC/2RWwoAEHsYYGzMqdySf+lX9U1oPWWZjzRCDZoFDJe9BuwPxLNZb4ZgDbRxHbsv7yyimp7QWgTj63m9QXyrbeAFhW+cMcPuXKU2uTjsv8YpfZVn0DFw1CJ5aqBGcPAYV23do4ziAnB7af7RJdbAADWR0eR17QPqAF6OzO5gslrGbjjo3ZunEnPoGvoCvs1vkV3oCWfhcZKy6yLLGK8e2z1JSvJfSYC8uYoTbg== 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=CMWn8qmeqXrBQ9aIOu9+nUZLMY7grlTbOE6X/i6RNZc=; b=CZVc9CvTrqtgzykcoRP6xbVKyXmkK3xZXQ0ToNteUQXQgQgJtcNJMpmFFiA8Qfp16RCNSQF+r+WF81OV19n5TD+bNaJjRlUrsiDn4YLkLLWdXtFeevCPVh4uj/8XFtfJIRnfgeMljD616YxsATObLSRPNog8knV0jZv43gZOGGSQm4fJIwBRIpgsg76MZaKZcAfRh0lAPeiV7DgAksxYuECgoQKilrIuPFGqz1Lw5TPJevro37yjA7mmNzmwYM/fihCy/rQuCRWDyMN6Hh+k3cuBz68cDlaSAs7hxP91bFITAf1LYw3l7mKbANUm3aAKizh7IU4+9ZBQotGN7W3SKw== 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=CMWn8qmeqXrBQ9aIOu9+nUZLMY7grlTbOE6X/i6RNZc=; b=grjlrmLEGt1OQ4ookBie1BzQxrYnJ9A5f3AQSNXokyzRZ6F2CraIEUXzVVMiON0THQtUetes824LHpydbhPSLaO37ke3GN9JjwPya5+l8iksJroO+/ZluebpJEeO+0waysOfH/znewDeZiVt2MYA4V9FXS3puKueeER3wBmfVlM= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH3PR10MB7436.namprd10.prod.outlook.com (2603:10b6:610:158::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.32; Tue, 11 Jul 2023 21:47:07 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:47:07 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 21/33] scsi: Have scsi-ml retry scsi_mode_sense UAs Date: Tue, 11 Jul 2023 16:46:08 -0500 Message-Id: <20230711214620.87232-22-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR12CA0019.namprd12.prod.outlook.com (2603:10b6:5:1c0::32) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH3PR10MB7436:EE_ X-MS-Office365-Filtering-Correlation-Id: 823df285-117b-418e-5492-08db82585f54 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GhXod6YkWMl6TVg3U83PMs3VODE3mGC/QSqh7kzJb3hfSaFxyhNrizR1ohAhTYjCgmxG9NKa+a0WipgDZ3Zact+Ttaw00LtqEhljXVZrveLtyxmBp6MeENAwsdD0EE3kGHUhKjmvmK32xbGfIIFoqCjsGcYNt/g7EVv4DNqXe/b/t1fAq0VJxPHWpDQDEbCfPLWEtfuvTBqDZzEcJKQCVA7k7HV+WF1QO5dWhtUBH0ldPFGHswTZKwzBufQoZWcq8t5KQKm0zzGa2yKr+CarWhv5v0w/Rx8CmCm1P5f3jigxZ/vaUVtr4sRtTe4W0ZmZJm5wlPeXe+xRNm6+NcglI9wE9Do8JRzCL4A5+0zV+kqMFPhxtxosoizpmWohWXSWdw1bci4q8taazRKRQSN0coFuI8EzKwVblYO92JNlin5sD5WcoEmzNLTGrWFWD8kDvaF+TJCYD0QBUHtf/LpEJACu26+Kk6++jWMktKzlDShrT9OyY4Rp7y54yNzkSTOnGKc6xkzqW7OD03WbCQvHnmLmFxkaBGiKN7Wb9HNlprCWe7zAITwcODPnWKjzQx8R X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(39860400002)(396003)(376002)(366004)(136003)(346002)(451199021)(83380400001)(41300700001)(2616005)(8936002)(107886003)(4326008)(5660300002)(66476007)(66556008)(8676002)(316002)(1076003)(6506007)(38100700002)(26005)(6512007)(478600001)(6486002)(66946007)(86362001)(186003)(36756003)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gdpmcl6fR0dvySpjFFji3b5hneNnUSlOvHwPGOLpddCsVwuwdGd5xnH2FquuPnW6AI/cccERV7KROSuEp3JZi4d8d4w4uK9Lwsyl6mf/Jgu2xS23zsBWI271c+KGzpr8wDH6aDK4TuSNflAF9COnutHQCpIy2BFVEdYrUSOEFAc5q39i82DAQSeRKNE38Zf2pvv2GoTfsVDpIAH8XqqE0BpRGdtGvrTV9E/2WnnogK0yX+zijj+ONDtj2lX14OeOKxn23ZWWMl8Du/+eLfn8SkmBo8EeB8KUCx0SrVeBgzwG7DgsbiFk6Ldfy1JEVZetIVZPivOEJT6vHqXT/n7EYg3wltxh+KFkx3jiZ6awzS07iepHKgXBkBDcNhRnYg+1pt8PR5kyYrTrX2fJveP6iufK7sZxj3jk+yWArP4dDOsNsalPaM5ilUWw5bIChAbrUDwULqq4PdZXzZJbpiu2G6xLZ5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Fzy9i5A2q/5MFLH6Jox5yPav+f755tACRccaMFb9zG3fmsuPyPcg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: +/dvPkPOx3W9cAjDdlrbb2oFnk6YsP+yaEB/mg9OTeXDk9Opm/nO/Ug/rXyQht16jKBTXGTbm14Y238EpsNp3StPjenYtQ8F1Ej9lMmkW7kSGncUesuQ1ctDfJQexERhRBqDAoKwjJMZXawGLCabd9pF/geLJPpDSl85P45L9ov/q2sxipOPf+l1AZC1SprANHuwB/y6GWJgHQBtzGj2+r2kT2TWfVleZXVG6qOyB8moRWnd0nShZtFD0RGKOvts3f2xrfvXyS/py6spki/TsmX+UBibR3mvyVqPEG8l7OoQVVYXkpnLz4LGtyF4ONISH92Yjt/P18VCTiN1k9ubacxdL9VN7b9u2miTkD/hVDuNdU+lDtEZLIPLh/mNmqSalEIPCXh0hwFaLPa1mOn4tnALoWLlQYQp4M9sAc9BY30QNQQ1ZrnfckydBnc4XCyCGRoYahrhkOeiUz4gI2hvk4+CSO3RKmX7zqxBRxOI3PjMo55LIHwwep1kok/ByGBEUVT5f0xk+uunQFwYBl8SX9Bjc+mBXQMxYfa6hJh6ELJkwVPpTDqKoejHdoPu+0E7ktGyMSwR84htLv5mlyeYIWTC/LPqvxsmM0hhZtVm+ieR6ruPFVZ+rzMAy2DGvuCmXyeQ6J8P0seY3y/LJbI6/TwunIt85uQmCZshmyC/50m/QPcu0a3DdYGNCpUTvZSK7UXnOQm4OCzsrDe2jqsJ1qbkDkyB2PX7tJhhuEFVVLJVE2eB5IvH4WydBM8UC08FpDEqZphN6wxuYw+urGMiLqgGhq4D1xhcp2X3hpKKaRC85N84mXPgPx6ZQ/L2LVjP+HQOGAueU7fvOCoJ1T+kORepiSWgE5RS7hf5rkSQkC8vVV2p7EYQTlPreTbmN8v5 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 823df285-117b-418e-5492-08db82585f54 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:47:07.3030 (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: QpPMGS+bAM4Ke6Y2suy4aw6Z3E6jaHO/UAsau8feViGWz78lD0GboyZHAZJX3ZJOJV9F/94sS5ugd7OreeIqc/P1e+oPjm8yoCyhHQzrLBM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR10MB7436 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-GUID: BxNz_JwVC3eBtv6Tcub3wgtMdh3g6rf9 X-Proofpoint-ORIG-GUID: BxNz_JwVC3eBtv6Tcub3wgtMdh3g6rf9 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has scsi_mode_sense have scsi-ml retry UAs instead of driving them itself. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/scsi_lib.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index f539fc4b7148..0d28920d088c 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2186,11 +2186,22 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, int subpage, unsigned char cmd[12]; int use_10_for_ms; int header_length; - int result, retry_count = retries; + int result; struct scsi_sense_hdr my_sshdr; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = retries, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; const struct scsi_exec_args exec_args = { /* caller might not be interested in sense, but we need it */ .sshdr = sshdr ? : &my_sshdr, + .failures = failures, }; memset(data, 0, sizeof(*data)); @@ -2252,12 +2263,6 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, int subpage, goto retry; } } - if (scsi_status_is_check_condition(result) && - sshdr->sense_key == UNIT_ATTENTION && - retry_count) { - retry_count--; - goto retry; - } } return -EIO; } From patchwork Tue Jul 11 21:46:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 701781 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 8772CEB64DC for ; Tue, 11 Jul 2023 21:47:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231582AbjGKVro (ORCPT ); Tue, 11 Jul 2023 17:47:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231696AbjGKVr2 (ORCPT ); Tue, 11 Jul 2023 17:47:28 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96EE41718 for ; Tue, 11 Jul 2023 14:47:27 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BID3wW015528; Tue, 11 Jul 2023 21:47:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=1wTSjMfIy8QXCpDXFE2/96aYobB9wTXcbqpkkz2w1BM=; b=aBofaUXc+RaQqVR8mX+AXYV2QXLNLoB+H5NfKgf24PylqRb0q/IVJ6xZt+2wby+TPADo wrMVcZg/sfsZ8OqMsQms0wHFI2MHwWIutwqPz5SanG7+kaBMMPeAdqo0dkCCNXSOJWlF cX4NXPvf7zkIAGAxGWVf6HhjZtf1sxe+lcdQ8sQylGcrqS285mHgrWhwtWTF7S4NCy3p AltiH2WZnEyyEY4+JbOI9ztmzS7ftOWvNTVo71Tw8GVUgj2nmW58ZGX1PzhqRNG9wCjg cbpdDmrx9VSu9E+SFzzWtJrNl2/kMAKvmowkFEGAxCWgm5851SSVaVry0F0hWdSDAKfk +A== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rr8xumf27-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:47:13 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BLQOu4007166; Tue, 11 Jul 2023 21:47:13 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2168.outbound.protection.outlook.com [104.47.55.168]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rpx85h1jw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:47:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OzT8aaJUHqROrP5HRyxRi9HWSc7oQ+XZEzMgTWbgHJrk0OJk7PX/oJAGYq2psWkXQj++i3w+WnTupEXoTklb8WZuUnxH9kV5ezHkDC+CgAwhHJV0yqpe3gQClaFfsqAri5rB/sujvpr19Rbj17SDznyrPEpjZD8v8Pean2KP54tVhgo6qYWgGHzLF7ZOvgWAGGFh6+JilXHI3fIkSTr/M02PWHZdOT4rg9h5u4MX5vey2IwqTfo28X/+2Fer5M9Mcf4nmUA2QDU9zfcqo1jcTmzoxkGCWbRHjxMlUwZkLAJPWJpaca03K0UUOZWXNcFt1Qymb5z2637MulKY7X9pyg== 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=1wTSjMfIy8QXCpDXFE2/96aYobB9wTXcbqpkkz2w1BM=; b=dGeEoYiVMUxDuv3ZVDLArQAJC7C/gCaGv5dqIBqlwkRnzDLGH7XKknbbe/bCTl9Ljo2MRTGz27JCiyu8aO9QpX1ZH056a3WpWhHdINGWc0mr6hv9iNbIZOwWsnqqd5eWvleEMYOzOMtumeUzIWcjMbR+/ErYm+5mAM+TunM5oojQaxIsw0saWNbt9thhcqQSHAFbvYnNl3lSnVByBDux/LNM7ra1+50GOfiRsuC40o6LfxNYYEI+BzM8RWXsTbosSCvM8fE5t4/5a6NDgBunft3HplxqW9lCOiDL4KMk8lXovplRY+10EX8NdA91Qgu5ehRvc25v2Yc3//cZXUFwCA== 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=1wTSjMfIy8QXCpDXFE2/96aYobB9wTXcbqpkkz2w1BM=; b=JPa4qxayEoLDthq8dcvsd3s+fjLPwfAR7YSagOJ0yXWmgz1hqs/BB0V1iR8P8T1SrMEejl1jtazOm2iWABWEpYqv4Uy8NuIUgkpVi00Mrv8kGFQ4UkjsZlETvrVuFVIoI8A4foA+PL59a1pTMuKeM0WIMS9RKv8k3OyrZBWRLCw= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH3PR10MB7436.namprd10.prod.outlook.com (2603:10b6:610:158::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.32; Tue, 11 Jul 2023 21:47:10 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:47:10 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 22/33] scsi: sd: Fix scsi_mode_sense caller's sshdr use Date: Tue, 11 Jul 2023 16:46:09 -0500 Message-Id: <20230711214620.87232-23-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0087.namprd02.prod.outlook.com (2603:10b6:5:1f4::28) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH3PR10MB7436:EE_ X-MS-Office365-Filtering-Correlation-Id: 398c2840-f50d-4b89-c6a0-08db82586061 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k9D515+OBOuTw/1YXwE34E+Bw7G6itmsSYWpSKPOyV3nbgQLMn2Dsamj6ghjwwderCd78a568mKh8GOwiMHDWq/QnGUpDLXU8EW3KSeiyxkI5fBQ24lrnVNCMbRXqyitKHO0/Yju01yQ93+ejxrTwx4ZT/Ydt3BSrIrK/SHJGFKZdKW43r9Cqxy79RXJhu7OhpDDivMxy4BXPq1xr/C1/uHse4eI0hK/4RBANmwfzULWj+GnnAmuM/0fYQFVQBQnjiYVgiVUYBUjeBWaI25bU0wVPHJhHiq/JhvAWjKga/EvihsHlqdLpZK2dNG9obEwU6OPxDoM+raqTTODTjVEFH88fi2VpPOFxhTUNsTcsfA1ioaTXf4aQpHG3tVBjeNfmAzrVq8C2c+oikKfWlQgosOHLZiOC0vBrUhIivNIVWkpvsQY8tdoXOTh1qNcF+2WDn3miOI+cM9GX5S9WjdNZ5bp2614uwystfiY/9jEtEv7IaPNV2dH/7Z3gjGB0kul5vXg/QylNrZEXjv9Z/HWNjsJqc6Gkg15176Ge0mnsAW9ZGWGwTcJPJPN/MZVTQTv X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(39860400002)(396003)(376002)(366004)(136003)(346002)(451199021)(83380400001)(41300700001)(2616005)(8936002)(107886003)(4326008)(5660300002)(66476007)(66556008)(8676002)(316002)(1076003)(6506007)(38100700002)(26005)(6512007)(478600001)(6486002)(66946007)(86362001)(186003)(36756003)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4zY/K4GEmDt1NXA+yL233bAMvAJsnPBbOvtY2k06i7R79hjcTQ5DSKxFEWbIO8tgpNmaGhrDg6AnTyEfWIX1OWJbxx0ef0Vioh955FnU6OdNZyA6wNWNkJqzjX8xcgIIk6/kA2QIvpA2GRqkZ68dsYX/G98+au2S9eX0e3hZVDxEf/R84t9oHhJmtwDbQrf+snbzam/NU0UyW6+TjgmwzyYhDe7SeWM0gYQ/cuhIP09tuJmuhC9cOaxTbnhFwE7/qFzYj47TWHkffy3BbOrBtFwduKUGgkoqFbMQFChjIGVVDxDU73nEbbJmxSeEnzzFIzg63v4QJjx9A7vb2cUwRkAuR97sdZlspWU8ZUXxmf2w2OcXpMPgdfzTnISeasWRMgNyf9UahmTBdTzyvFraRIoIlNWIBUYTNembYnW1zlWGYQklMQBWO0UisCrksE9ljoc3OWliNmlfMX+9FBWxyBA3CfUa5NmB9U3/v6k4z6+Ew57yQMDPY2piibFPbrKRHI7NTwW1VsQjJSs1NG3Ox25Mz3MWX0ZuFMu52rEy+p2CKmo5rcu5tnA73YmQGRhOOfuSF6fjyWNQywZq5sSqkkdoInsQe+7XgU2UZ3Zj/jb5e2mrEsgjvjlHsBSf25bsyus+Nh3MnfLdc5XEgCBSEsJvjNBxgua1nM4yuneMDW/oCdYStseWqHwEmY/LlnKMzbM31aLdMYc39H0xkXkvtLB5inPQ2nznp6s4k9tJYVC7mH+KwaojZ6kgT4ITrn/t3/wd6KQrrYi9KtscWJwvnee+A3UA//mwRuWOHvPd4uBzroSKwAALsh9XhZpm1z7QrSJjuNpjI0TOIsx2jc+sjVlyZwvep301Q1UAhkGdGDgRVw3h7LKvSfUR80o6F4wVIciR9tYcGUgChKtMpgWJKaA3oqbrS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Ws5Qegv9Oko0iujQ/6zfNqVGlOVapfjp+ALQA/D7nRZkfBEZdctitGZunTpqH1f3YLaluddcDNQFmPlX35dJoTbKVQelgrQZgSd5Bj1WjDk+q97rp9ZByyQalHfODBZYBuxe39U2vwzi1FDG0AjC+yOTUOZokf6n8RY+iw2pfhJWMeyuPHTq+qxplhnGmUN3CWLxa7SFrPlZ1LSjfXL4w3kB80F3HxdYZ7fgb6SKoCEPirzn79296Eg0DswzznYqczuc7V6CZCPJIWkABR6n6IpZdpBpsDOPcAGX95Ju+umLoYJvFipwoPcMhTGMpEsOeBJq7ahTtMD7v66RZ/F/YgEHLDfCDTQ0nFTgrSF3kqX1HJrZycmswUEompp0tDsnEcS1bf3+lNz3L6qYuDfHVynGGvYnVHfzPzj/zgcH6muFGHaay/yzaCH1uEBRhqpGp28P/1zNE/JMpsXgAW/Rvp3+gHwiRJUXqEQKXFe9ZhvzwVvZLbot/FOcNTaLgBug53hAAQcV8iycMJy1VoOiJ+GwOCQMARsb/1P0zi9v4dbXyQwYPRrCZPNSF0hC9d0KQ+3m0C7dPNSEmmiAssROY7BMlFT3DF3 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 398c2840-f50d-4b89-c6a0-08db82586061 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:47:10.0729 (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: usJw6cBV6+X1Q2CkCIFKgPDleWfKgR+vGv0iByFQpOy95S6xQAqMMVbWR0gyhM29JgMHyWrjno2Zo4YeEYMyrY3Fxy/1K2N01tNC6JTtAIQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR10MB7436 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 spamscore=0 phishscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-GUID: j0Fm_F_Ko7QPMpyZmk5kut_54FNU5rlI X-Proofpoint-ORIG-GUID: j0Fm_F_Ko7QPMpyZmk5kut_54FNU5rlI Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The sshdr passed into scsi_execute_cmd is only initialized if scsi_execute_cmd returns >= 0, and scsi_mode_sense will convert all non good statuses like check conditions to -EIO. This has scsi_mode_sense callers that were possibly accessing an uninitialized sshdrs to only access it if we got -EIO. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index ab0d6b1835be..48b727b2bf1d 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2967,7 +2967,7 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) } bad_sense: - if (scsi_sense_valid(&sshdr) && + if (res == -EIO && scsi_sense_valid(&sshdr) && sshdr.sense_key == ILLEGAL_REQUEST && sshdr.asc == 0x24 && sshdr.ascq == 0x0) /* Invalid field in CDB */ @@ -3015,7 +3015,7 @@ static void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer) sd_first_printk(KERN_WARNING, sdkp, "getting Control mode page failed, assume no ATO\n"); - if (scsi_sense_valid(&sshdr)) + if (res == -EIO && scsi_sense_valid(&sshdr)) sd_print_sense_hdr(sdkp, &sshdr); return; From patchwork Tue Jul 11 21:46:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 701780 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 915D6EB64DC for ; Tue, 11 Jul 2023 21:48:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231653AbjGKVsY (ORCPT ); Tue, 11 Jul 2023 17:48:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231628AbjGKVsW (ORCPT ); Tue, 11 Jul 2023 17:48:22 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEC93170A for ; Tue, 11 Jul 2023 14:48:21 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BIDHDv018444; Tue, 11 Jul 2023 21:47:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=gu1OqkvXhVtYJ7EGUuBrIhv+sMJBqzM7P9ziMt3eC9s=; b=nZArM3D3/wZPbr0YGrbRRhHyJIPJxb+jwSmB42eEDVmrhX+diGCSgsp7rGgIUfWG9H0z 1btAkBLGLnpUHEPEg3YEH+xy2vLryTo10NI5JkF9QsqDggCEPHbjWWMMb6k0dsvA+MHZ mWr0NzTXsotuibhKMEUoLmxRUIKXSWfCBBxhDoSkDUUryS3n9MlxIiTbmYqVGCDhP3ui JfRBnMdPby0x5/k+yFry2fl7W6RQxllPOBujZI47xMRWObUfaZNT+paU7GaoLrRfqB2/ /1ZwlPu9daF7vtHYdtONt5pp/NMfQ67KH6oKw66hD7qP869YuoHPYAZs58UVHriIjKge Wg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rpydtwy0u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:47:14 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BJt6AC004286; Tue, 11 Jul 2023 21:47:14 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3rpx8bt2rc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:47:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WQRxzQuT2FmBLkYI/thTTf06ihqP5mnPXfr6Zyjiq7/5uvrbM2aLXLQKJCWZoQ3O0RDdlZC1LaLUh74gBGdT7Uah5HEV2AwSJgk33rOhUlPpsqzBlx7tHO3rPYsZruSAFF4q3Xh06edYHAr3cG65lmOhdUGTFNNUPHfxbMwaLeo0zOwpfzYg8vRzeTEv8smkC6kaN/5uSXs1YPgXuIScWdLc3flLU8pX5URq91sFnm5fXdj7ExT6znm97qqSWw2E04KipMOeDamUJo/FN5794bpzVML6b5kdpoMWnRCyv3wjM8qZ5mt0+zuMces2O3FPGQSduymJBwrdry3y8GY+fg== 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=gu1OqkvXhVtYJ7EGUuBrIhv+sMJBqzM7P9ziMt3eC9s=; b=cLZ1DfNBqwyN7E4xqhz7dxlAwTXeqnXVbKymO9dIjKJuZ2i3Z4iksqgfoWHTwLm/8BqRmuE21dx6KUFlUvXGFB4F1ihVrQpmRNBgDHJ9YYyioJwlzccvXxfVcRiN3YaPbNbtQ0t3qqa+e8TrODi7qExqGPHHbL2sRJMgMf3otY35waTkm6hG4HZUxb+YOzJMM/fjIzedZibiFlCZ398uffCazqd1yToWg1o+dtzqv6baQjjF8lsIJQWRwzNJGv6MApCuV9ImgrAxVWLjCkzGEF7+XpZuxH9sqelVHkupT0bFpYjbxaIxhxQ3BXo5GKhb/7RVpWEE8ohWcp3zf6CadA== 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=gu1OqkvXhVtYJ7EGUuBrIhv+sMJBqzM7P9ziMt3eC9s=; b=r+6TpJAgTQpdvpp54/VTLM9xcCBg256EEtD3IlMpc9cIaaZvZwJ4v1vf57VycdfoRSgwYSEl8KOLk/GGwF+r4FCb9HD7xdyL7lB64mb3fi4MMgDE01J9nUYpGnLIscM3vLFuUG3Cv38eSHZiEC61SBatmRmbJTDXyUua+Ir4wUk= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH3PR10MB7436.namprd10.prod.outlook.com (2603:10b6:610:158::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.32; Tue, 11 Jul 2023 21:47:12 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:47:12 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 23/33] scsi: Have scsi-ml retry scsi_report_lun_scan errors Date: Tue, 11 Jul 2023 16:46:10 -0500 Message-Id: <20230711214620.87232-24-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR08CA0008.namprd08.prod.outlook.com (2603:10b6:5:80::21) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH3PR10MB7436:EE_ X-MS-Office365-Filtering-Correlation-Id: 4c3ce755-4f56-4d2d-8382-08db82586256 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 71zDvA3IscsaPfu4IVfEwjzsinbhOqUbkD0IFrozabxOaf8YcPvLdQvmZZT8AFA8QhCnxJyo4eMlILKby5VvEXdcFsBMgTOmcWwKQP9M8fex7XqlH5cYij6Xdkm/TN0Ej2wuBY+ErrUEt+yEdm+OwZ3nIJZQFkubOMVFbCgvth9+MvhNZyXu0anzQjaGRArKLLBSXhM9fEPgl1w/hcfJ6Zvu4a0F013PPT8tyhPYF2xsoOww8r/xEN4FsnfyR5jOtUU175Dmo5ERWyoohVv7x4hqs++nW16ENa1xkSbBjr+gmgrj0tvTiILy2zusgnjGT503+MPexeqxJJsUGGtVozJga9TpXm2A1o5lImAPSWzqXWGql2i0FtNA+XY3SfNesm1m+ac3LKWDd0f+fa89pSLq6wbSrJRk6R28Jc775N7Z3X9tpyqd+91MTWzbYS+PVTP38TiFOWmccQjEYMWx76iFAQ/uES04wYZIHhLs+rxpSJRd47nNJ2Qt5yQIy6F6p8UPKYKEZdoGs4lVF7FbpAAqAkdJ7tRuLr+F7EL5rkeYk8obVqtdvQXLV+QUqV7E X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(39860400002)(396003)(376002)(366004)(136003)(346002)(451199021)(83380400001)(41300700001)(2616005)(8936002)(107886003)(4326008)(5660300002)(66476007)(66556008)(8676002)(316002)(1076003)(6506007)(38100700002)(26005)(6512007)(478600001)(6486002)(66946007)(86362001)(186003)(36756003)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kLGmk5QyVjST+p3kM96rmnCG0eygBCLwJtFD+Ok2dl3EVktXNPmTqHU03ee8PcQpPg4j/JADxj3L9LvZqvdPTJ8SJmvmeZ2xkATn5Ef3n+uM3Hd2NH3a34yW0CjW4dnFXwkPqtZ/lWn2ImSbeoZeua7QE5YzOJjA9uu2M6yfUuxB3WtOE/u01dlAplHVrEq+bCGyhsJ+mGA/YQMSH2ZhjpqpMWIef60owh9XuDBMLkzImol82mRyTvPx+2xGRdH6XjbVGysXpF7DCQAIhL4lG0v0mzbCzvTLSwDbo0FkNWnQFnbX2CY5adI96qfM7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CcFP0HbJmnoC+eHhvafDj0ZEhh5Iw7ChEPKcXY+9Z7rpvNh5sBa6RyJCflXrqZ/qAldJHrjdp6gnOAKFjQWBdSD4nGym X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c3ce755-4f56-4d2d-8382-08db82586256 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:47:12.3458 (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: WUnH7udeetLmqxkts5oaTSnCI0ZS3TR7yQEVJhWe9kmymCT1I79588DpQv0OXZu8DFEC+6a7XxzZOh0zMfDnmHQ+wHc45EHWgF0FcNp0omE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR10MB7436 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 phishscore=0 spamscore=0 mlxlogscore=999 suspectscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-GUID: HRdJAuEJ9pxZzCQZ76m4QuoWuD_l9Vt6 X-Proofpoint-ORIG-GUID: HRdJAuEJ9pxZzCQZ76m4QuoWuD_l9Vt6 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has scsi_report_lun_scan have scsi-ml retry errors instead of driving them itself. There is one behavior change where we no longer retry when scsi_execute_cmd returns < 0, but we should be ok. We don't need to retry for failures like the queue being removed, and for the case where there are no tags/reqs the block layer waits/retries for us. For possible memory allocation failures from blk_rq_map_kern we use GFP_NOIO, so retrying will probably not help. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/scsi_scan.c | 56 +++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index eeaefba6c9a9..9646f90878f0 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -1412,14 +1412,33 @@ static int scsi_report_lun_scan(struct scsi_target *starget, blist_flags_t bflag unsigned int length; u64 lun; unsigned int num_luns; - unsigned int retries; int result; struct scsi_lun *lunp, *lun_data; - struct scsi_sense_hdr sshdr; struct scsi_device *sdev; struct Scsi_Host *shost = dev_to_shost(&starget->dev); + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 3, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Fail all CCs except the UA above */ + { + .sense = SCMD_FAILURE_SENSE_ANY, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Retry any oher errors not listed above */ + { + .result = SCMD_FAILURE_RESULT_ANY, + .allowed = 3, + }, + {}, + }; const struct scsi_exec_args exec_args = { - .sshdr = &sshdr, + .failures = failures, }; int ret = 0; @@ -1490,29 +1509,18 @@ static int scsi_report_lun_scan(struct scsi_target *starget, blist_flags_t bflag * should come through as a check condition, and will not generate * a retry. */ - for (retries = 0; retries < 3; retries++) { - SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev, - "scsi scan: Sending REPORT LUNS to (try %d)\n", - retries)); - - result = scsi_execute_cmd(sdev, scsi_cmd, REQ_OP_DRV_IN, - lun_data, length, - SCSI_REPORT_LUNS_TIMEOUT, 3, - &exec_args); + scsi_reset_failures(failures); - SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev, - "scsi scan: REPORT LUNS" - " %s (try %d) result 0x%x\n", - result ? "failed" : "successful", - retries, result)); - if (result == 0) - break; - else if (scsi_sense_valid(&sshdr)) { - if (sshdr.sense_key != UNIT_ATTENTION) - break; - } - } + SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev, + "scsi scan: Sending REPORT LUNS\n")); + + result = scsi_execute_cmd(sdev, scsi_cmd, REQ_OP_DRV_IN, lun_data, + length, SCSI_REPORT_LUNS_TIMEOUT, 3, + &exec_args); + SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev, + "scsi scan: REPORT LUNS %s result 0x%x\n", + result ? "failed" : "successful", result)); if (result) { /* * The device probably does not support a REPORT LUN command From patchwork Tue Jul 11 21:46:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 702172 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 A2926C001DE for ; Tue, 11 Jul 2023 21:47:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231601AbjGKVrn (ORCPT ); Tue, 11 Jul 2023 17:47:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231694AbjGKVr1 (ORCPT ); Tue, 11 Jul 2023 17:47:27 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00588170C for ; Tue, 11 Jul 2023 14:47:25 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36BIDFpu018370; Tue, 11 Jul 2023 21:47:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=Mc3mpXbd3FOfQX+lGEaxBFNMeOgSSKNOXTfT7Hcgj9Q=; b=juPysZe5YiSc7a9PYVjmwDY6vCR2ndaG/zDLl46sDffPd0Y6qh1Tnn32v4BAxJ+cqREL Iihb4NIKk4RjpylGDfHANh4NjYNfWXdVm/KWVvFsdSpMs2/Jj/a0pHf+mnfToN9Xkot4 65PID1k+6KHRstm+v+m63xMvnJktwGdeG8hTNtfr0HQGa5+Hdnpd4LEz/D4nWgl6A3of 4UgVkJuTXOioeDHLUoVV/PL06fdDis0pdgow0PdlHRTTQoxBOIuiWB5TOoiAf4GUjhYi svVyH1ejhlK4BYxvv8Fdqc1CTJljfK0HFNYri70PLbD64NP0Tf4kjpy2wP9p8DkJy6dN IA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rpydtwy0x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:47:19 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36BLl3ht026865; Tue, 11 Jul 2023 21:47:18 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2168.outbound.protection.outlook.com [104.47.55.168]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rpx85h6hs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Jul 2023 21:47:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i1lIBN0flUnAqh1zt9WN625eVVpjHFtCQ2QISrywhRb27ugGhjV2du6fjyBgQBfW3Sa6WOP5jZz8tV9Z7FhPwG3okzXI4Q7k8M+CEk3YbmPCuPSVLE8kSKNet0FgUCkg3QiAbH2WpBhTNAkO91wr9LHGKScU78ZLVELa7AzuDt6hGxELVKQkfM/PaZOaK2dSkDXrItP/L09P5aMaPmJ+izZJy17CThGBxmkH6rOEL2ETrQq2qHByk17jFAsXzPHYCl19BdxCjRekZxZZ6MTx0uUNcXWqVS8HiheN041oKQ4bm3k8D1r/llKojl+thL0o/JJz261u6GZycE4VqzH1qg== 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=Mc3mpXbd3FOfQX+lGEaxBFNMeOgSSKNOXTfT7Hcgj9Q=; b=Rl13RR2CJcdXjHy2Atr1ZQnON0mn+tJGkFN0bi2EvwJ2NCBPzZL9KZGuFZBAeWT/pkR7RUFbqCY8BzA5DuK5KOO5qETH031vR9axFJyvRNGlzHy+TJ9rMCFDDrrRPRa7VzltSHZAnvBbNBThoRSJbGMyIHYh0E2kLxYtE3K8373HdS+t+WACgw3SeL59eKhDbAqE9TW/VYWmZ4Ub9Je8AZmB7aHtM0s6v9B6OJoyBKxHi36QgicEqSW4QyLDI9Nk+jRkHTRZSjpB4W9FcBlQVFBc8GSqpSS32vo/qM10S8rL5vC3OeavmXkQse8Eq6AsA5JyM3jUHlx/rNwZ6sW+UA== 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=Mc3mpXbd3FOfQX+lGEaxBFNMeOgSSKNOXTfT7Hcgj9Q=; b=PPY91n2VAZHeK/a1cMuy2Xy3Qw3y6CUiSGBu0eK/g/jADuiDVvVYaA97Dct3LUqhR6g+ru33SXY45uDC3qyNZq4vDhWKgf5qS2CHB+R494rHMPYQxty5PdvH3WDnvQK1fwyzzrgr9Vxocu0A1ip7qvC9oyfdK4LUvChhYFUSeEY= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH3PR10MB7436.namprd10.prod.outlook.com (2603:10b6:610:158::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.32; Tue, 11 Jul 2023 21:47:16 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::f5ac:d576:d989:34fa%4]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 21:47:14 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v9 24/33] scsi: sd: Have pr commands retry UAs Date: Tue, 11 Jul 2023 16:46:11 -0500 Message-Id: <20230711214620.87232-25-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711214620.87232-1-michael.christie@oracle.com> References: <20230711214620.87232-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR07CA0053.namprd07.prod.outlook.com (2603:10b6:4:ad::18) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH3PR10MB7436:EE_ X-MS-Office365-Filtering-Correlation-Id: 1c52f15d-391a-43b7-1bab-08db825863a9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xp+82OD0Tpmo3KE6Cy+HxWMSzEajhSua/v64Di0tW/+3XO6L5w6dnEUSisTQuP7qaETqb7VrkyEIAwJrcdakrv2gxB1ahv1jn9NbBM8O2rCtTbd0338a5yKlVsenrMhettnKNU0ur+7h7REPdUXMgJVtEZ3i3anXV9bAdU24IZJdYYk0o9X6rRwqkTeFafWgVy0iRLl7ALdFQ0rptUYR8gBkksFlnFOip4aEKWLpvks9A/SJCYJssSNXPuJgAQ3ndwNQE7OHUvIFFmpezOfxe8QLDpViklUsQr6PfaYqtuEbMhhKIG5y4APy1+DegbNC5xDUM/B+SRkEv8nPHHica40OQWM8D+b43KBkM9OgYe0hUFfhU4ZdHr9gnRW7HOjV0ZEF8CXDxekMyCU0DQuDo8peJm0Fbc+7K07xU57i0tC+uLeKlzgrgGl3zoL1ldSvDclFCSJ1EL31fe9/A3SCwGGFLfUeelovaWqL4FPX+y1eXxhyAtS29K4C8jmg9p5Y/rtNJ8nhHaAz6wzQG3tiyk/TSz0TzhWXHphLaKOwhvTr2Gh/CdkV0KVnIdlgpg2W X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(39860400002)(396003)(376002)(366004)(136003)(346002)(451199021)(83380400001)(41300700001)(2616005)(8936002)(107886003)(4326008)(5660300002)(66476007)(66556008)(8676002)(316002)(1076003)(6506007)(38100700002)(26005)(6512007)(478600001)(6486002)(6666004)(66946007)(86362001)(186003)(36756003)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EQDHeejsOyk0uZHhJrU8FA/HvwwtUVYZP3tCV0SkR7NGeSpAx8PDEgQNLQnsKcPu+HEQMh7UKVMH5tH0g1C7YtoEdr8nA91uPmlsAVshqYSkGObyrI1Doz4vJQloEMAIICYUplPAAGAHboNWG2CW7jaSMf6+4aFGW7dYHZTYmixzsH3G9xuYn++cGCy4w10RieYfdvtuqyTHnz2b18v9GFh+8FVpO4bcgoDEZnOtTwm3kORMNHxkXWIntheTUrYU+CmMzyHyAfWQPKJmcX8ODuFvEv/qx0ZE6InwPpVMgP1+jEFFYY/GsU5yoVIw0i/fviCyj1IsWJqlHMNSY3moJtqCweecgAso6v/YTeMFznTqTpE5bPOgMHaMFlksBbUb4x84H45UHLBqPrdAky1kKInFnKzOBI4nQ0XWSGOMwGnKPmN/yjOBeHnIAvt19D86+fUx24FjUWYS9LaiuQSw2GVVHjLCBx/tDpltJgLAP5+40opE/Tz2zl9l7FtqHaKiMv/uQCY8GQFZuKV9PDAcbyBT3KxOOQhsxv7kP3DkyC7c/YH657iQPXEl36Hq0oO2DclY2Aq2S2P3oqKXeK+s6NxBgHk1Mlbs7PLRBNfdlrZIZJUJm8fnRb7E1ol1yUG27oswvKK6LpqjZiRd3p8VUt0RGRgf06TSe+vVY9CknrhqN6NO4O9DHnDpQvn1MOoy4w273TNWXhCnwSWEsUjbv9vVAfGC2yfKim5gxGE6WbXNLRXxhskePo9GNmTWFaU8aguyo4SASb5gBKU8JQ6zZvot7+hbMfsZ38UWpxRFVtvrxYUKfK+XZdaeEYcDjodB2Oh6Ku7VJ7Aaq0JO4rQ+Mm5OzNbtUBVXodTLiGWVsy+3LDDdQW6d4CK0aXIKs5FRrWuhCmFjYRXehfEsoJtBHUnNX8JBL4p62G4Ti95do+Xou7qfLVuKM2PvSyNzO2aDoBnod069IEbibNeG3Yk/iR9DBkaHAU0/BBnaOF0UlizKw0pdc9HsyETsPJlt4+3BtGCmG3wA7uw6V76nUZgs/+FAj4ZT7wzhvIkZM05ZzvFQhK45/PlCDGqKNpZmOzNq31EY2Dc8/wizGP0QYser8hggaSCcCiy2VFQ0UxapFPppPjz+qLBQkw5IUp9XJDSqXn5MMe/lTiKpBfpGv3YUL+rxWUUa0Z7pB0dj4io7PnMSkW7LQl+YnnqWIiBOqbvmfl25s0oahW1tNYWSDGfEpRA3a6CJKzGGZ9H30G+ddtxorhB0C8WPIN0ggojVnC0h5UEIysTtZs/73vlokgjhSSQI6VtNzI3A6P//GHw0+fR55mOFmnHuW+iPX/vIZ54Gur8/j0EdVr7V7rDs7hHLXRfcQw9i0EZMH3oRJfCIcLGgQZE+NnqQeEvZ6rPlnAMJirkVomnNKkd00dcjrOz5fW2Tm8juYUY+4me9yeXEATX7HlnRZykyC6DNNbD91/TsL3RLcvX3qsQyopbbWdCO+OMdH+wttIAqMOKhbLYLNLOV11f/qUfS1EX+KApcVG6zEbK7Q201BDeezeXxk7awBKpogv3C0i0AhElDmgR62DvQdlnM131YsPBRt1X59trzBS6xQAQrGerV4z6pN2NHvA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: tFEHpl9cgiQDwvDD+AOALHM0+wv/vmGce845RbjBGYRHL8y1i6MQANR+1fL0vv2N91bVuKCGFlN6xCzdYJSyYS/1RV9EaYwptHy4yJRcmK1SWvVU4tjtSVU+VDwTdy6PoocA1qKB9Gyz4/lkDM8kY3TDD0OjgR07laMIUdj1lxA0VnoiqWusQmCpHl8UXBjibTIY2W7IQZyXpZzjNAQGBy7GUY7VFr8I3WRj+KnotjaLlB7MXK0p52vEKNA8NV+yRQyyR8BGUPYjiXnvscxachdJXXW/MvwaI1MeP7Hoot+ZbBaQXxPe0Se3wdop4JfIQsahI39C9oULcwNtKOGT+ch52UqJs0zhaETuecCOPNTFY4PB/hDN4g1eWAsEEbTTghLbSyNJEZdBxB/0pZbuvhX4icgWJV+fOmdNbp/GEyy97CeDZwPxhnrmX/US3vBRVsHclUKHfY0yNTP0Dra2rAgIet+UKI5CzjSkgw6ZQzcqs+dB2c9BOdx6u6HMZTBOQN6Mt+FMg4nhutnaiicmE6TzYHmayhNvlrF27Qw1xlUn5YELuZFHA6yjpuD8j1NiOn2V7cyzmfDzKWGxNHd+gG93Hr0O8ttHCv7Uj87nmF5LQRgf+ESSG/AOVa2bs5tfoVBCpciSxDDZPp362f2CjXp+PZ4mCO015iePWfZ4eh/PpYNDgs5xO0EoGmWBiHyui00xZUBb8gF8CgjkXdWrvIHGfJqdMPw/D9t3or9cuqYNaOSHAuBPV6hFhfQuz8OIYWpLYDyFl/VfNjZlF3Tsp1X6kvfHXQUTVHGn4Kk8bYpXtDjQ9+rKqVLCeol8TbPS5gVxxIEnog37NVKne2Cmf1ICTlllXKmh4XvaVHPc/ros9N7Akt5jR1JOrFszue6m X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1c52f15d-391a-43b7-1bab-08db825863a9 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2023 21:47:14.5644 (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: q8QiWwxN8rfNBTe87SfMU8iU5D4MBDx9nAPDtNi096IkpMZwXM/fKW+lkiJzO1Xl77/kTddQuljX0Bp1KFKGT186XtIWfSZg/mNKkmqqlCE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR10MB7436 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-11_12,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 spamscore=0 phishscore=0 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307110198 X-Proofpoint-GUID: SIhv6NCAEPyRRqyBi-AKOvUXziJ9H8nx X-Proofpoint-ORIG-GUID: SIhv6NCAEPyRRqyBi-AKOvUXziJ9H8nx Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org It's common to get a UA when doing PR commands. It could be due to a target restarting, transport level relogin or other PR commands like a release causing it. The upper layers don't get the sense and in some cases have no idea if it's a SCSI device, so this has the sd layer retry. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 48b727b2bf1d..87450e14c419 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1754,8 +1754,19 @@ static int sd_pr_in_command(struct block_device *bdev, u8 sa, struct scsi_device *sdev = sdkp->device; struct scsi_sense_hdr sshdr; u8 cmd[10] = { PERSISTENT_RESERVE_IN, sa }; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 5, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = failures, }; int result; @@ -1842,8 +1853,19 @@ static int sd_pr_out_command(struct block_device *bdev, u8 sa, u64 key, struct scsi_disk *sdkp = scsi_disk(bdev->bd_disk); struct scsi_device *sdev = sdkp->device; struct scsi_sense_hdr sshdr; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 5, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = failures, }; int result; u8 cmd[16] = { 0, };