From patchwork Wed Jun 14 07:16:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13279603 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 F25A2EB64D9 for ; Wed, 14 Jun 2023 07:18:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243340AbjFNHS4 (ORCPT ); Wed, 14 Jun 2023 03:18:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243385AbjFNHSX (ORCPT ); Wed, 14 Jun 2023 03:18:23 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 156E02103 for ; Wed, 14 Jun 2023 00:17:54 -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 35E6kbTk015745; Wed, 14 Jun 2023 07:17:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=82JYNbjhTXGOWZXs8q2uASu8useWzmKPizhDmvXGKHE=; b=FM/DyBtRMmH16wlu0mPqMOQFoGow3bBRqGDlvRXJgu9jJufvTozFiHB7JE3kuf2qo/Xn 6KXyINAtW/DR0EJ5mdmrc9wgJxBJQKtjwhV7J1t00eCjwkf3vZc7zJDKixetMezKbq6p 4mpTUcEHN343zgkatg5D7Bs+FMeXmqvpKTZsv6cjKOSwQtvOpZuuALKaH3lnn4/Onk89 qmhGt5JIR6u6EQfMQXSfGWd+ZLHxY6EwLmHroRORRz8yVd9uQR7d5IXxwIs15haERojf wq50PITT9GAKvfym1ji6oPsvI2YH1kmzk3CHU5Qh8FGvrwqnYrNAQZTmnHmyzkxlexL9 5w== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4h2apust-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:27 +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 35E60Oh5008939; Wed, 14 Jun 2023 07:17:26 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm5es48-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AU4Z3l8NhlZx3EMvfoBWBKzovY4RzjcETyscRyT5Z5nHyuw7rbBE7he6waDOLg/If6Rq+pS1trUM7lsZVuHYLVwNkC8PMHxfxMtFZoDcDIwLvswN+oi0U/uJg1vZUR4HqXgHpisfgWQS+5jzzuEFb3MEmbSGRfI0VuJl6v+zU0oKuLaTnnz24Sg4N9FEgYhaZL0seKlM3cZUMzpO8LWkg8GUV+qn78lHqwTbWojy6UsisTPFID4GOSBfX+lP0WD6iISKG9rreN3kkS8tflfUGTzeEU44R+hHTQ+QmwYnpsIc9uMffQQRr0UKjt1CHvrmqYBm/7x9Ih3WXDxjMeYe7w== 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=82JYNbjhTXGOWZXs8q2uASu8useWzmKPizhDmvXGKHE=; b=ZyAaYNGL0aL/nDGZzTVlPkyrCzedW3TIj/CIz0DPDcn1jrrRvuDmmhMG11HYGoitsdYOmwSxEY+yJN/3QpgaJIqJBh+3mRbbMJawC/aHYAT3a+uZ3npAZu7hcs1B1u6wsxNEL75jx8ryGCLM6FEl2TTMJuzFyIiOm61k3YXrbPcdeSSwLy5Wf7+1YBfBaY1bGZjqO7WVIqLxd8ZgaAUoZF0O5LxnClYgQKKQ5VQXV4Tizv8lNMCQpkg1YsH+B1/B3zCENM7wwm68eDo3STKsR6od3zNWjE306hRAY2+7o+2Pe/edgGWeWX2gSr32NgpjJyrIhpqu4lLcoVR5aiX0IQ== 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=82JYNbjhTXGOWZXs8q2uASu8useWzmKPizhDmvXGKHE=; b=JfUmt0ZhYSdT/Ep1bNH4DmMHuGrZBm1GatMgDiNh2D/eWGkiFmcUORAMTcCvRgA/Oo97fTRINPOrFbVkiVjPIpKva7d6qfh2nEdKLqJkp8YANenalfvDDD5PfnKY8YE6KPVerSwDmzl85giX5Oot0lvi1EdsJiwLqFhqhfHPl4w= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:24 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:24 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 01/33] scsi: Add helper to prep sense during error handling Date: Wed, 14 Jun 2023 02:16:47 -0500 Message-Id: <20230614071719.6372-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0067.namprd02.prod.outlook.com (2603:10b6:5:177::44) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: 5ffe6bdf-7ec1-4ec3-4e9f-08db6ca766dd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kj6qhXNN4Td6iDryb11P9Ri3Eze6e/6pN7Lu1pV+v8frvlsXmcxUxIP+mCEG0xgPTXB0M0qQrrX09qg+Zfl/67QL9rt7klA6K7exog6f4h6z7HkjtpU6ysGdFzpiQnFqK/AeS8GMKSglKVOtuWRc98qAlg0EnHYini+HR0kzRbY0LqDCOnmE2pO7tTvUa2G9lziouC93H3ng4uA6W9A+FiIXIoIbnjvJ535XPOSgY5TFN6FqBpJxV5Hd61wnfUL8pBcyvPl9Xx9xXctnu/hA3XSFbpPSKgdBEW5L/u9qj07sLTslWiWb0WTX8ZIctgrbaf2/VqGxlg05cVxOjX0isOr6ayNqzJPPfsswEANamw+Bn7E5eK5YSdLHkfWpWc0nHYKdVWG5Y+DHjCSuK3LyrITBHjB4WHhBynV8oqyzSjKC/+/mP7KxbIDSD68XrfT5HsC010Bvpn1NyWhgOYVytreZwlfbcJnukNXWHLb89oPm3PO2T3uAIoCi9y7DleQpEEx82NtMJZXRH6IPl382S1VzLso5at9xxMcpx1q2ymjbEq3/P/ecDCzpmeLYWXSh X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(83380400001)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gMTax3PQqCWhLdaUQj0K8MhEv/18qpTH4lk8C2yXIMFNGcztfYbJUkaT02oRVgpaWwIlMbTH/DOscwvGr0m7LAcp+vMpAg5LRx7abCPs84XmcDy2cuhzX3+7XDrdyGI/NcVdsFjDUhpOC1Wxh5xxGWKeN7F4dJFlgjvk67/UMHRn9hRTwZEkD240H+qLtC7hSepKOWAXHLdoPAwV1CHgBwAdFDcGHykYa0jmBRRGezJPYSasiqjdSAt+EmaJFh0bxpwNyHapZyFSs9Ex+r+IjiiBBEdrq7g+uyxBWE40ewDEUowwa7dW42L2p61JyRO/wyJsnMPj9/+yjxz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7s4iGiI6CWwgBOmEd3C8UoIqwEi5Q3IhmzFuN41RY0x52MSthhvwDBBQQ/E097uQZ3IZ4Qw6I4/l+XnIHa4q/MmAFzzNVEUJpcapPd X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ffe6bdf-7ec1-4ec3-4e9f-08db6ca766dd X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:24.5334 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: txM4RwbNoIPXmYBhOtCswlSdm9vxI7YOWkeRqZQroqx6G/rzIxFd1RQgo5TVvOXpxORfFk9+CVjkI/VmkvY2BxpKaWpWXd8Knq89DIkxHl8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: 3hvt_r6ngzipfv0CTRIMciHWSc4391gp X-Proofpoint-GUID: 3hvt_r6ngzipfv0CTRIMciHWSc4391gp 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 Wed Jun 14 07:16: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: 13279605 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 A5D41EB64DB for ; Wed, 14 Jun 2023 07:19:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243212AbjFNHTA (ORCPT ); Wed, 14 Jun 2023 03:19:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243345AbjFNHSY (ORCPT ); Wed, 14 Jun 2023 03:18:24 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3C7C2107 for ; Wed, 14 Jun 2023 00:17:54 -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 35E6kPMJ026804; Wed, 14 Jun 2023 07:17: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=wcYpK/EInLCIcOLs4MNjrjBYaFmp594/YK76NH0V3IE=; b=uanwtwjrijCIisnCVJI1U0jfsrnA7ZrIt+fGxq8UT7h+NlC9/V8Wi/+N5pbMlq+N/9Fb /3om8aA7AiA8YXW9RpnQowyPL1071H9jFRVhzS36Oj+FNcRTJv0mznehHY+iLExPH8Ca I6Tb3r4kZmBgz/62tnXh3TrG6284ipN2Oljb8rbJAR+yAINJ+Z7Ixt/vKUNmKEGgx72e IO5nNnTcqejTiBPaa6optFw9amd8OZmCjoQQJrpWxxx6c4iS9SFYbTjzL3lSxjZGOJvl fTAn5GmB0M+qXFpVTymgvmweov0Zh+R5NuZ9sO2i4iFHHLNaVzLCMwxwih9jsQfkNh2X cA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4g3bpyt5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:29 +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 35E5LQ1F008933; Wed, 14 Jun 2023 07:17:27 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm5es57-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kq1kr4Ip5eNFx7GR8CGKtEvXNmlAWXpirw0bZ7ejw4L0bvdDvo5s/jkpKmMzuKT4OZS117OFmL/flTXAq2QX1IB0KGVTBqZP6UgWCTfYyJ6DymWCOR53WVxeb6N8EpmNJFST6SX8Lyt+Gue7O4/FImIANBl05TupG4S39mDJ4CAzM+/Z+N5OgSGrlyjT6/toOPjHXhkgulDAviiefn46d00jhCRpbi/rqFAbW1hx/lL6L/IgTC9nQTbQMSFivToUFyGrDZXZQkyVmiVgh5j3wSRFralelezQxyXM73gwFJimp0nSpwbgi8aqOO8jI+ZysvcRvQeGj/MxlRY+ue0GKw== 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=wcYpK/EInLCIcOLs4MNjrjBYaFmp594/YK76NH0V3IE=; b=iJ8Rk9H/4pSfxFmBQKQSm+10ZOeh97R386NfwI4Pq+hRQXKzrUr96vQ2sWqwYgskmO9XQzcaFMmz8WDuLIjNdFk+AEN3GaVzbbMJaaEOAr+i/T1zVjjeZU01N7xvf2nbu0wlUfscDbTewyg4ru59a/ZCb6bJyG7bblwl7ano8rzbqgG0Xvm0qcN64LniOHm8jBhM2w9Do5ar4lNwm6hh1Kvw5jdngEVNAM1RAz4MePjHQw+/61nzwRveTzVHPhyTSOu9fLUEdgO5QT+dae4q1UIuqA+i9Y/xwyOSEvo3NcJVGFxWdb1yax9Ia2j6ItCP5PoDoNs+eFv7XmOlvyafqA== 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=wcYpK/EInLCIcOLs4MNjrjBYaFmp594/YK76NH0V3IE=; b=WANXwZJ9OfBP2QrV9FkL8PDDZl6durZeRQGAGmOH5L2vYEohMnQhhBtK1YgogJocPOkhGKiv7TVTF61cveLVUq9P9lEyKMbmhBBys6Twa7ein9tcGBIFHT06+tyRZ7hmKNflx4n+k5UJlIU1UFzfMNiQxrRP+jjR2V425Sh5Thc= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:26 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:26 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 02/33] scsi: Allow passthrough to override what errors to retry Date: Wed, 14 Jun 2023 02:16:48 -0500 Message-Id: <20230614071719.6372-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0062.namprd02.prod.outlook.com (2603:10b6:5:177::39) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: d3867c94-5565-42ed-9aca-08db6ca767e3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XHS9zc3/gghEIQNRvvKPSbZeaYp8D7uPoxJ9IIFVejTOC98p3Bpi+LPb0pIrqH9jdR8TY6ZFrcMqIt9toeueZK9zPn57vsVCJ4gL2sQVvJ3yfstxFaCYvX8jEP7eJOLu5OdaGeCtj1Q98nMoC3ppppZU+gciRlUdOlrgcC24CRSh0QepTp8i2L1nd9p0Tz+DdGBZC1Vxgj1NtLwLf8YNg1UljAat8OYBPJl0VOLOneq42le/3GlA7d0WptoIIIZ5+zKGRFGRysZ/V6ibCTITqL6JdreyMU9EowYKK5rJiy0UYZajxnsTv9ctedWWWwJ41OodvLySEw6J03GnS4uoy/r2cq8kV8U0ixXm2fm1L2KgX2iJ4tN7rY65K+n6VMQcGOZ1Cg3h9xrd3xPKG6L0GdlDEapi54Okmn0uHQCtp29wFoiZIc2lCU6E1W3Xkaxaq5Fz2YtJoXl1Vvhw6jsapvW3R2AObkFnsWmdLrspxGkxrrtyG9ZswWx1uyrhRw4sY6OwX5I3BjE4NtV3G41Gcu6hHIN8mYDSLuqS5fNCIpUHobwVDkedSn2z18sDQjqq X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(83380400001)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8XRtKt8XK9oayOAjSscy62VR2u9WSdIYkLpM6BcWyKaI5xRV8NGEdi86ziWyNkkRNgo/dNwOaEzHIRAmLavo0XTWYR6AhgguEeJ3zn9i/hIKFS53u7fiHl/mTxjgzl7Phy+k53BcB3rryaO+RZ16dckFotnSa9K8ehap5rPVTHkThJLU53symqDZL+Ml8wY+1Vhx8l7AYxt15oQl7irBJ16Vbe6Kj7GbVGeYnATMSaXAOlTc5saCuHVMfbNTvMTai6FnhT0Xebbcr3ur9bJYL5nX8Y//1PMI6zsxN470ztMBnOxMDogTirf1TwlwvrXZC5MvgJmyWTIiB4+eT78Vdewd8cJgZqPqVhDu3+c9ioMlF7MvF0g0AaUz21zroBVrVxAVBRvI6n0/cct0JG0RBSRo2/XbG6T4P589mfEifT4Ev1vV5mREaW7jIoSoIqKpj/7PIJAtd+tfALH7ab8P96SJtzAPYDu16aAqcFg+0jgXQTZRUaX0/h37JRWIiW6C/JM8eb/FA2+cjuDo3brLdrblSNGnrBJqneepJqj/v0aEGbjWshxt/+8uQ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-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: wR0iLz4fvFFdcQFpq7jIl/J+k22C4QNx1q3w2Dd/AAceyzIBK12hILm0eJICOH5uMOaTA/WGo2WrxxZy1aEvuYSHQXxIDvRKq1Ni+Ka3WkwUmTCv9P28hw/WiyWiVmg3CCCwYLprTXuy6c2DrAyEhnL/O4NGKmzvp4YdVomAuwipIHbBW54aRN+X7JHcOrdBBsnWrAPzAaHhJzwsSNRl5LIx03l49Lmg1VPbuYtvB4bfiSa7V6T6mqN1luxaHL8tkQpwVG32BZOBBieN+qS9WBoMcMIjXE+evDeMOzq52dx5zyUNcdaUFFfqaRJ3krOuAtKkEOlA/ETPsfjO11EjhgdZ4PStsApmLSVFLgSxoKnRNT0zsrT7BOldZLRs2hfe5NwGoUUGxki69U+JnkOzPLY3HEKV6zGAUAX0aJeLvigRRUwTKgWYG0RV3zDHWzIKxFcWjIc4GtiSOWypxr4O+l+/EE6Xup2iVErGNJkVoLi5JzzUJm+26FoqadNtPfxyaSdIuAsfoWbt1O5rZroXonomj9TIIL6EqL6B9u08MJOLn7tCgbiDL3BtnTC5/jH2TE/6PD5sU0dXFwTzeQYxhIuvN8uYE9PqlW3+3Y83zKlSvgclnBtahqXe/zHnCt/zmyJnV++ExX/MTiOY9TBVZq8M5eMvQaOjbvE/DT00okfyJ4GXT9kBUv+FNjnvkfyAH7A0Klb1azU65Yl6s0j/HISIR/lUXUrHr/h+d6LmSylTUYXivsWkRecBljWVbeCqEnDJarAU6uq8N73wU4o2EdQS/U+OyFDJ7pMNMZq6Ki8oAEhmcNdlgCaOqxwqr1qsGObMBQp6ln88xMPad70FPoGG2+o/k/mmriDT8mWnjFGWBrhcSZcgs1jew+szg7lU X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d3867c94-5565-42ed-9aca-08db6ca767e3 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:26.2267 (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: tZ6SnXtzPVxiiNvXaDUJ7anmXbU8BuQcgSnNE13wpMrfriune2DrZRNqG652tkbanTW/zyDQW3814YSJ+ITbuVKa0Ba7CnEzVk016XilM6o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: L8IshMHOhd4xp3Qyy4s_rLdFxjSrrzH5 X-Proofpoint-GUID: L8IshMHOhd4xp3Qyy4s_rLdFxjSrrzH5 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 Wed Jun 14 07:16:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13279616 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87FAEEB64D9 for ; Wed, 14 Jun 2023 07:21:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243382AbjFNHVy (ORCPT ); Wed, 14 Jun 2023 03:21:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243376AbjFNHV1 (ORCPT ); Wed, 14 Jun 2023 03:21:27 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7F8D2959 for ; Wed, 14 Jun 2023 00:20:29 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6k2cS026413; Wed, 14 Jun 2023 07:17:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=RZUJPlfKtztXPVD/evtRhkN7c36HQXXfuN/S0ofy9kw=; b=JS9i1Ij1NIQHA/MApkzSGHCKNuEs5bQwDd/IMkOXEuhV9KfAljinLsJSjRegBOj69EvZ wljOn1+wNFclVSX5pbmd1rrneVc8EG1KKahzq72y0p1ht8ixKVeLXRwwDzGWls+kmxVZ V2/FzcwjlXMtBJwVbDBwGKJun/tLsWvNqC0ZNWWRFPlTnXHAWNnpm3dqYCAhSvSwFwA+ K5KfjPVyzLy2mO2TbQIUkvr/eHqHDIgqiqy43oWRSZqES0rrltY0VXMgcz+2wFrhBspT wyCFzd5lEbprL5rutlPrHs36tca25dYjn6SC2fcNvGxmHe3U0KjfvxUgzOKXNVH/kMP6 LA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4g3bpyt6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:30 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E72W75021596; Wed, 14 Jun 2023 07:17:30 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56byv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ek2xHxlbVrMu4hKLFNtzVa0v5iCFN75fqok+YC01DnZws7wOXjfmQqz5MwJT7YVV68hPE0dlY7VFaauNDBEL64Nz+Xd45V9BYcfUzquc5Ah7j8LIYpTadLPcH564WeMgT+wKPh3F53NKzYQ49SFrSjnfo/9nAznIVVwHA+nVyVgnBZVnlQFlRnfe9GAPUAlVYL/PoLybeHJfWprrM2oJWD9yf6YH2V+7BI1onitgYhj8Tvdu0VB38cFbu8X5zC8IWXF9kf890BLQd2hD1iL73HWUtz6G/Pay5zJlOdRQpp60lUMo5SXtPOzhgFBUQtkkE7gbslBtnhWqDqEQGQWv2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RZUJPlfKtztXPVD/evtRhkN7c36HQXXfuN/S0ofy9kw=; b=i7kBVqkpDsudaw06P1//K5OidtvLVWv7pix+N2iznegKKqMW+8jJvxc/0XzxEhsjqyfhczBUY5yQgV0P7MDY91JxeMPSOVayTSnGAEtHeEgWEz9Or9fhpObsqOsg6fhV+uHl7ffyOI8CDu7nO59AvNFonNXrEOTR4z5vzygVed6OaYqHza2EnzQxTT3K97/dvItMVAe95Uw+ClTZTIjlKV7DU2AjIJ1HhDJ3AYEr0xcmPOd4CREVkcWdElicqlo/zwVuetmW4QKx9huOr8UUA2RaZUiM3AInNGpY4EipU+41reFrGw3iUUsyv/eNUBjHPgNW7UgpvlQvAzLtcfLh/w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RZUJPlfKtztXPVD/evtRhkN7c36HQXXfuN/S0ofy9kw=; b=mm7njwuMSi0Nm67h9nbV6JopZhuzfnYFpBpZEyLTg+FIdSdA/W3PtWadri3ym3tx9Ve9h3OEuu6xUIrxvmcU7eHXEdjOTcNwfGlCoy4B/voZBvHq/SDdpRuMSvs3ipsM1h+Etbk0S1rN53zOTjSeg7WpUKdSdRGclR0XDGuUvm4= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:28 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:27 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 03/33] scsi: Add scsi_failure field to scsi_exec_args Date: Wed, 14 Jun 2023 02:16:49 -0500 Message-Id: <20230614071719.6372-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0062.namprd02.prod.outlook.com (2603:10b6:5:177::39) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: e943901f-0f1f-4223-bf9d-08db6ca768e2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hXk7XB3kh+6J7gXfq2d5JRzilmcwrrdFv+bHYXJVmbD7IEh2Nq7J8oVbGoCMRVEvx5jK0cAD+da1Ff5lyDgNn/cUunWdnVA+MkLiAyJAs3jGcy2/nYSk0BXeudYQpIZLQmu5tzoVtKaU+4v7OMlMjjfecBWtogI0oVfwG4hKsLCNr8GL+10p3R1I69znjGR9xkCfBaGDdFNI2f1IJ7LW9fH9tcSlZedcHsrZ61FZTNdw4er1gYLglJAZ62jCsMG8ELa4aEtFCDqDDR3pYZnmzI0kM8OBEpaYsOrolGfmQPqSwtrcHPhteHEI4qInAjegHrJiE7D6TANFEEZZM4aqotGAoIxGab6v0i4dJM4AQ4w45JtAFAnqppyi0GGtKK7Sd2fMAmhkTYYH95LJbwQMyqRY078Szti8iqNeAHQ7I3q+Ye4bkMbMdvQjzW5NAj8CV55j+aNHHtDtqspWEh7Obr7saynSAk7N/6LEFrAykSppvLqoRetOufP7zdGRp5V4DQ7mmN75BvTDUsBBrgB0cjxK6uO7wlDaEhJLbcbYj5sCsm7MV9c9ahQN306zny99 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(83380400001)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-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8rTAmlxf5ikbCliyBjDy7LcQ6HoI4gb4JUmwao4QoElTpYxGBt46tkhDMC2sX6zBBxSLFcYNm7a0i56elxXdZ9otSoH3tg7/f2d2fJNt8djvBvMToUqQ+ZJ4XWAEeLUq5/D+KqshgBcfn+PKoT29pmFtPub/qEQGwR0yx/1eAe3ISlXUSwYwjeELmSoPEX9hpXxO7MWrrNAhXR1CSJQwWyahS3im5VVsVZTuoz15WHN8+H2+EQHWwZTPYItxcLpcIihWCtybtRpBFfaXFEzC2Crc/0WKrGB9w8khHZceQkhoD/Sh2TM6GAnioWVRwJnwibvc93RnmZ43yO8j+JTb977R23biAXiv5riD76vfUthVIzZroQ/gM/rO8UDxUvAsN3+n5VU8aolXyBd+IsyMWZQ6amqzHiQD2vHM1XsJlfzDK7a2PfF1QHBkqT9d8ZbTgP X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e943901f-0f1f-4223-bf9d-08db6ca768e2 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:27.9171 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: I4ueGiNBdwmCq1u1Z/8BtQplAJ32CHKJFe4aPvHpjSq0ZPlr4J/Pb/qN8VyOIlxwvnJ9uqeQis61l6P6TeSAv5fXLb9YgWH3/htWAExINpM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: -ThxQ1zHilVvuRX9hdTyLdM9FFFnFRyp X-Proofpoint-GUID: -ThxQ1zHilVvuRX9hdTyLdM9FFFnFRyp Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Allow SCSI execution callers to pass in a list of failures they want retried. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig --- drivers/scsi/scsi_lib.c | 1 + include/scsi/scsi_device.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 53cb649b2f28..f539fc4b7148 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -237,6 +237,7 @@ int scsi_execute_cmd(struct scsi_device *sdev, const unsigned char *cmd, scmd->cmd_len = COMMAND_SIZE(cmd[0]); memcpy(scmd->cmnd, cmd, scmd->cmd_len); scmd->allowed = retries; + scmd->failures = args->failures; scmd->flags |= args->scmd_flags; req->timeout = timeout; req->rq_flags |= RQF_QUIET; diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index b2cdb078b7bd..381d08220665 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -14,6 +14,7 @@ struct bsg_device; struct device; struct request_queue; struct scsi_cmnd; +struct scsi_failure; struct scsi_lun; struct scsi_sense_hdr; @@ -472,6 +473,7 @@ struct scsi_exec_args { blk_mq_req_flags_t req_flags; /* BLK_MQ_REQ flags */ int scmd_flags; /* SCMD flags */ int *resid; /* residual length */ + struct scsi_failure *failures; /* failures to retry */ }; int scsi_execute_cmd(struct scsi_device *sdev, const unsigned char *cmd, From patchwork Wed Jun 14 07:16: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: 13279613 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 207F6EB64D9 for ; Wed, 14 Jun 2023 07:21:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234206AbjFNHVj (ORCPT ); Wed, 14 Jun 2023 03:21:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243367AbjFNHVZ (ORCPT ); Wed, 14 Jun 2023 03:21:25 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1C77294D for ; Wed, 14 Jun 2023 00:20:26 -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 35E6kNXd015669; Wed, 14 Jun 2023 07:17: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=r3W0+djsfkUxKXbg0Lv0wSGTZTT2l7EgNK3we2NG1ag=; b=xFuBqBAKjyr1tXGnGYUSwukEi98jGAHEOZ5Ho0/wzNCfhGkc/3vpLtuv8gtXPgUuCxFF S/HFRL3In7Bc0OrqC7j/8HjyiLML7LXWLMwEmJxwZFf9Z0Y+q7LdRjlCDzCgrLlNEzUM omOtp6r7g+K0sQnYlnnIb1MUrDwE9UsAjPsBQOeQ1Pgwd+lGCxzvzSFhAr2Pf17T540d zTi8wTyWdY4DBRvBdzqB1RTWdQr+os2FQ8t+Ux6ZGubgeO3IlmGOeF9LOvX5D0m+oA5p A08CeHBXPR5BgxCucxXCFar3Vc06AexIsPe+uobaTU+/NoqcMM8E9ccP9ensCpaOpTu3 hA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4h2apusx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:33 +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 35E63X4i016344; Wed, 14 Jun 2023 07:17:31 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 3r4fm56pag-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jeRT6xg+2JY9d3SZAc+Cnk5x/5qktYezS4VqChMe4JOuJeHAMqbwp8fxMurYdEAdmYBxOptoJc3hIeM+/BScYyQ7XDmTJAbDoWd2LEsfEAi2+iav7gntKAN88aK1+sZi54Q4VT3qklTOp571YV50tsjgOe1tx4xzK0xfOkXRkPUYT3LjkbVNU0fmMV879LKhlgRojgYMaWw/Z4WUqRhj8tPYrquQx4EetuL0m9ZD3tHPL+kOs52CiO31j9+Xl3mLNbe9P/lctY4gv/4JtkTPuTwW1ldZmen7cZ33PlY50Pf3unrk64Vfe/w4RTXBaLp3fs5N5fPZdxFO1683APw1LQ== 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=r3W0+djsfkUxKXbg0Lv0wSGTZTT2l7EgNK3we2NG1ag=; b=VeWbVqp7OLvg1R1cMye9s/LwDtA9rv8uHyxG7yWZlbgLUUEILojW9bKh+OT5qg/pzDC9yVScM0gx8+pjAcUr3j09Rb6aYKJ+H3NFXS+ciapC90ZyN4ohNs7MqgsGU/zwDGUrDCTU4ZVWpd2F7YPRV4QyRlQLC5i7C9OgpAhe9VaB5It8c4vxQkzI+Y1M6PaGHwAEcoSM7yJqgKH7+4el8XB6ISxh4nepyhRXdPnVX+4UYYo/7K0niNUUgMwFP8n2SxP93Ji+QRoBiaYUQK5ij6Hb/VxMmgDhDSVidWZbZBS9/fWUapJY+avifGKbZkHhkAsVnLvu3gc3ToVKGkhF4w== 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=r3W0+djsfkUxKXbg0Lv0wSGTZTT2l7EgNK3we2NG1ag=; b=cxA4B4AwMHrn6nZIf6ENY0ZrHtfzvOhjbHE8wj9uDKB6jhxvE92ypaGXkLoyAfZSDbYhoy/x4IErv3cfZ3dZImTe18vAJ2gncOVMj1Ft7qEijVLeWmOi4bzZ1k6tjp8kZ12/ZkFPTjU/uirpuUSIU9/tjKojopbxrlBI1qScSQw= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:30 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:29 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 04/33] scsi: Have scsi-ml retry scsi_probe_lun errors Date: Wed, 14 Jun 2023 02:16:50 -0500 Message-Id: <20230614071719.6372-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR07CA0001.namprd07.prod.outlook.com (2603:10b6:5:3af::10) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: b4841dd7-c10e-40ca-953f-08db6ca76a11 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QrFcubFt5W7rq+caHGaCEC748uj85JoqE1AXVCg8M4OsmOyK++8UyKhgseUuw0D2GZ7EWoORAy8bC/BmrkqJnT09HDQFTTdR/o1MXnANgXWrzG1HHlfyDotjDS/31GZon9UM+2dctb2Rsc6hMrp39RTn7+lygoaAuFkIbfaTFQXNAgSLlZI7Oc8OeGVWwC8jXU0OG8HK2wGflCDqXMBj+ateHHSoOC8KfYp9WLqvctG9QusGDRC3PKRh0FfpTQfq/c4gEfwfJX8AO9h0Q/G5SalTKQio7Kt8KI2Ze55bJketxOHzWbJ/Gn434uK19yZDN5L4EpRL1X81vG1MPcIq4avSfEgUq/+Ndlu2pxpLChHTdFu8AwGn7gbtsjNUHT5IB7DH6wTLj2Ws6kl/CvT/ZcTpul9SwgYxJDbLEwY0238PfwaF/5SLr8Q0qWk8YeCcn8ewmJhoHuqWkQcQDfVyVCjIKuAuXzhUuJXgLrUtKkM5dICgN5JfaEmnAAgyKDquqeyQEM7Iw55ufIC3yp5Tc9Tf5TQwhNq9xdvRnvmCw8ludb2GBIcetM0jzqtP2td5 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(83380400001)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SxmV+cwP6DWZ3gJEWlxkype1yd1DAYLcazqUbUv4mSioLr+ZvSg3rhnN013kgFSX/ENI6tDqTZ8YkGpcOryQBaZePWPbzg+1XOZzm+rsvKukuuW3RAxi0y8omBaV+xpHmXoQFyqWqu5ithU31URY5RgrpPeOlB4WwEP6+/wvKDVyfpKK5HYzlNjUkb2jZwTQq+zQLAKiCzhBFh5Z1bZ/6wJAacUTgK/+4cjuI6Gzr8Vy+YIDsya3rXRfURMcfIdxXEsES2E8XGBDtLM5avpOY6/6PZKFRQ/VwpnLkhMijO8E4ufPUux9qKHlFxNxx+jgD7eQXw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9ABW2tv5IFQ/hYI6HkXMs53h7kC+ABrjmHrS8Gn63s0N1rcyf96YFN0C4fTJ9YBiIDGiNyBAagHXxfCjR2zjKpIJrpngYh3i3p74kDih/JqM X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b4841dd7-c10e-40ca-953f-08db6ca76a11 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:29.9003 (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: tPi2F1YN/NPkX2f0VaOSm1lsEpLxL5xdyESs++L4nTPocla9PljknJtYX8oXG9ZbgCq8ngRumqyR9QIzUOnjO3qYhY59lj91p5m7bcK2qh8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 mlxscore=0 spamscore=0 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: nbluJhNH4JCpzkmP4_b9QGEiNhG4NqPO X-Proofpoint-GUID: nbluJhNH4JCpzkmP4_b9QGEiNhG4NqPO 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 Wed Jun 14 07:16:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13279614 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 312C1EB64DA for ; Wed, 14 Jun 2023 07:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243374AbjFNHVk (ORCPT ); Wed, 14 Jun 2023 03:21:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243366AbjFNHVZ (ORCPT ); Wed, 14 Jun 2023 03:21:25 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C641E294A for ; Wed, 14 Jun 2023 00:20:25 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6k2cT026413; Wed, 14 Jun 2023 07:17:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=+8h5Q/GBKYXwK5pBMb+sNzt0D6jZHtVd86NT5V7jdAI=; b=zM31qmCj3ccQ0Nb1qlyp8yxwrCpr2NDNWDG55UcqCbuImnH3jfZvu2MednZnR95KhY5L ++8J3aztRjSCHqEbeL7AeoNcP1mzXP3kfyEmtkwHAB+5hhMZ3C9laJ+J5puJKfyWy/ZW XFHhhWmuXzZcR+hNUHl4ClP3W0+J9TboXDgjuWJHG7eXcxfkGV0Kx0Qddopv61rTTO6G QRDvAVFZF7D/x/wUGBrzfQRUBObj2DXh9Pd2PoBERgPWbHgYfapt/aXNq+3tD/JARTav odTYB2n0eqMJKd05gPuWTiFI6tCX78/PATWROLe+rnQhgnj0241caS/YUuFlg/R5/0lO cw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4g3bpyta-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:34 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E5aFRd008455; Wed, 14 Jun 2023 07:17:33 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fmbex98-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=erevcWtfUkgaACeWbpFdtT//GdWqKdI/7ZqL3JThNr2hg4BwiHV3jH/lizdRU6yDF8Fa+Ed1XgdUwdOUKYjVqWkV2bbJW/DTySnNVfXVxSeV1k3tb/0xJgJxJC8p3F8nhsZYIaHPDWbkAuRmjF6qFiUpxsEnVZcuQQPzXaEKrOcoUw+N+ckcsrsq/bJvBDpOcxBlmvQw78qjAkaNSU0Di7P4Kb7saGqmcbUCt77m80IWH08rDNmcdMqVRk37N2KVdiyFvU4FDGmiy1Xe7lvYpohXOdsoQqUD11PLMu9t5c5MiPIeBtA0yZWhU56hFxTCLMkjNGkhesh5prO5EUOaTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+8h5Q/GBKYXwK5pBMb+sNzt0D6jZHtVd86NT5V7jdAI=; b=kVEbM6O0oNWqJDDL2+lOoxcrtw5bv8YVL42BaN4gIibByu4KMV2thvmWT06bYOdVjwvgwop6mCix7BLhdb3yUfA6iP4JXhCuOjFI8cItJp9TdQNBWgGSS8drg2lqC+Wx/GIqPFwd5175pAcWop7bni/ECodCpIef9VIxR7y9s+99sAMTqF7uh4d+ryp2i9pttbULMk7wn4GinGdRvpZkN3pduRQ1e99PFfAFbmuPlgicqnfnWDiBH44AZE3iKP/CdXVQPfMkX9i6AoouKZjSgFz3mD0hrsIKIEiMthWLLW6FghT5YBwZupMsTeGXtdDKfm8P4eo+vxBr4K2wJnpagw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+8h5Q/GBKYXwK5pBMb+sNzt0D6jZHtVd86NT5V7jdAI=; b=bKws4fNhu9CA60P0jPALJhMoqn8N9TO/M+yH3U8Gsp1NVLNmMQL/iZNt6VKG37lOM2EXJnoOQl4CIOsAf6c1NUFRvgRB6M7AHdTqn5+2zZvIXxEvqxFifKhwYNFlxwxmTW9NlDX3oWx3ujMcvHPLUppv53qBFmf9xu94VIRq2zo= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:31 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:31 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 05/33] scsi: retry INQUIRY after timeout Date: Wed, 14 Jun 2023 02:16:51 -0500 Message-Id: <20230614071719.6372-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR11CA0062.namprd11.prod.outlook.com (2603:10b6:5:14c::39) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: abeaa2ae-219c-481a-e180-08db6ca76b17 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k3TZANoGXnB1ZRT2fYcW/rgVPf3LLxnF5k9ZGn57/giyIqQVWsXPUz8Rr93q3ew9Y0bbzS6Y4aY5zCiMuM8JkFXBp599PM4sn00x/Icnw4dQXbEvvwn9yul9bHznuRFlNP8s+4lH9qPTPR6eU6RAWhMckZ1L53oOG0z3I6bbmc3xshScKtvSZ13hRJC2tQEhWiyO/1W950uWhYp6PS4jUhh4HvRMt0rGxR8ocu8IU75WX6ZwuZ0A1IyWg4heRoUP8W+rpqlLhLNWaMkuj4wE90Htf/W20ySexDU0ZUGHdKV0IXoc9Tq9y+ZV8UoCABe+0zZ4RpuD+cJ8Lehev+Uh/3DkxJdv2av7lNZQ9lPhbYKpPqhk2z3Ks+kxp9lidpZz6LzlaRRs8PTEDhDrskYaVk+OS5Z8+cdpq570ox7mzYLl85NGNfAFDOCr+2xJvvel45FnP+OK6yJ12IvAK/gBqWv+Q71gW3VD5Cnb49mEwrT2OUSmhCUoqmue0+ZlODDlYI/AiHHTKbQCoUMdXGnZhsfAPIayd8QsJ482SXY3RDsa0/N7CvUP+hV8N+RiqTWU X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(4744005)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HpkIGL6tw3oUv+8+9WjbKRKEC3jT8eZYQWNg/ZHb4FI/82RfCy9e6Yl9ctp3qivqg7DZIvo+GFGBmjMplTLt6EMMYFV2wEvRT6qtR44Qy43v/Lq+OHTBMW0m0yc8jin9+fQ6lkkZPhgQzdIwpaTKh3BfMSysXW7wFFyA68mGsU9mynJRGqzraCjVHZWiW8wVBZZHgedKqh2aU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E/uNmx5kNG5ZoMgJIFyxdzYInuOnOEtzTRTEAfbG/xRmR98O5c2qfnZ3/Y1NkCUbSsp40pGi+BJmbaMzeT7UPk51BECBZjPoo3N+VVKZ/xlc1zKmgk3ZioOksKm3qJAvCPz6R2FRBKQIyn+CemSRBSel1zZdmtVDojq99eldgwyNTylZv24t9hkHt0LCxDQTjjphHHAu0lLXD/bso/BgWFJ0FLqAx9NMHXuqUB68/CaIo// X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: abeaa2ae-219c-481a-e180-08db6ca76b17 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:31.6457 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ErKn7187AchAwUOjl5yQr9MBgGSRDsX//VG+fN3nXc67jEqgtyixCpRLZn0gS+Krka0VfsNdwel+oQrTOwcBmzKGjLUDBugTwghVoFZDYPY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 malwarescore=0 mlxscore=0 adultscore=0 bulkscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: LIWzSfrzjbt9VtkwZHhXMwPPzsfg1Ror X-Proofpoint-GUID: LIWzSfrzjbt9VtkwZHhXMwPPzsfg1Ror Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Description from: Martin Wilck : The SCSI mid layer doesn't retry commands after DID_TIME_OUT (see scsi_noretry_cmd()). Packet loss in the fabric can cause spurious timeouts during SCSI device probing, causing device probing to fail. This has been observed in FCoE uplink failover tests, for example. This patch fixes the issue by retrying the INQUIRY. Signed-off-by: Mike Christie 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 Wed Jun 14 07:16:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13279606 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC574EB64D9 for ; Wed, 14 Jun 2023 07:19:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243388AbjFNHTQ (ORCPT ); Wed, 14 Jun 2023 03:19:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232697AbjFNHS1 (ORCPT ); Wed, 14 Jun 2023 03:18:27 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E81026AA for ; Wed, 14 Jun 2023 00:18:01 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6jpRN021304; Wed, 14 Jun 2023 07:17:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=3uyodE3R3q3yhZoSXvEGv2FAyi2ghfpYkwumj1XPy7I=; b=CVlyoq4NTrHqsN4Yw1i6Z5L1C3Ci/kMcXm32IaeHpwy+xXLQ8upK8EDTmkH/XptDgsLR mpFLb0/TJMeK281gAdQXxplUydzWXfx14wGHyV/MMy/4BqTo2NbcClRDvWPE4Ncd3ipW 84gSgsmdk1y9OCsHuBpeOUaiQRGRfTsfiBNXik8JaQUTaM4tPCO2tuTpGKZZVHTVDpun 1vHawldJtVesMIRoitrMv+Ql6vj7Iuj4BKHPDDAiIOtjZw+Wpxeq6KUUL+NugbhQshR+ AIIuf22jpveV/KP2KmW6ap0dLxp40xUlQnBNPEK+V7mittmLnmT555Pv/E7mYzspl02J DA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4fy3evq7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:36 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E5fLol021717; Wed, 14 Jun 2023 07:17:35 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56c3d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g4IQEBx84Hm+VYj6u3HHJYAC75BzAO7xzA/gfHmJxXU2NU56yvu9ywgWy4VUQ4ZICNVQt9f4yU+/SiwGnpWV/yZXt0vxfuwplpvbZanFbDcUq2dcWAYfajsc9U8Axb4xubU2K5QdVxvljDzF0U1dU+uDLicbwg/kcXwr59tLf+CoF684e8nLkQDUfSUsCmI3qN5SAkFLALUUyvbMkeeDxgWnUq+JLbWOVGP0/VPL47Mrg2GGRBpoMxFhUmas+wAu50ikmei5w9Saafj9Wf7scGmLDRx1vzLCc6oD31c+XrjtWV1pgX/1lVndlScd2cwoUN3F2o/F7LeVom9+tmAdAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3uyodE3R3q3yhZoSXvEGv2FAyi2ghfpYkwumj1XPy7I=; b=Kec8cMaDh5fPDAxppWPOQfz47ovJCdOUajHB0e/yRs5g+K0q7W9D3HwAnf52SV4l8sckWQHMVCnMVYYpOkviDyghX33YXMtLoUHtxLX/JQ0eilVeWqeJqzgzcJqjicNMvn8u443elQ0cGuXh2p3T0Uss4FK18sOy9bfuIt/9bSkTbYZWDfA5G+xfx4MIWqtOSdlGVtltsF50Y0qvoJ1MxT6v6jlT8pkPvgF2g5kZ+VgFdxtm6RWouvdC4zOBfJ4tfCeNv6T/ZxrOM/3qw4x7hP4XwxrUaTDG2r/UkeI8Mhvs2/vnNX1jwRfeuQoXlrGw2l5nagQmu8X2DYjIz3HeNg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3uyodE3R3q3yhZoSXvEGv2FAyi2ghfpYkwumj1XPy7I=; b=uRPfdEIpsDNfdsVNmzfo6MmqQyX63IC67iq9jzCuT4P607fhh9/FhoTzg9aX+v0giM0BTi2hnnWiX5hkqsn29gNRDLKzbwZfCHY7eEmHmeXrLHTfPK5jI4JcQtWZnXyGS0xexc42JK9DMOgJZQGnFp24PnCsc7mgLiyuHXDXMis= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:33 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:33 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 06/33] scsi: sd: Fix sshdr use in read_capacity_16 Date: Wed, 14 Jun 2023 02:16:52 -0500 Message-Id: <20230614071719.6372-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR11CA0061.namprd11.prod.outlook.com (2603:10b6:5:14c::38) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: 6d9b21ba-ed2c-48e2-4173-08db6ca76c12 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vcjP8VGWw11FCSbyJZzQKJ05yJczQCwziHq/7k31uYjCOiAFy8KY2FhcT8H6zQA7pmyUZ4yfH7Yfh6wDHJNpLZlpRP0cENgg82FR605wSs5Qa8ISpdQjGPZTc2RkJC7iCnsSYMbdImvk52CB6/r3r7WbnWL7DFGtMz29/ruRDGNY/OJ8FREY7U05aug5Y23OO4XHRa+S1LpdGzSyUQLhuj8wV6NGVGLWs1VqoZQ4wdLH55X4KF+RxoRl2dvsulZejgPQ+iA7p47U4MCU4TVk6/H30cDdS20Wv9/il5kb011o0/5n7f+OCHicYaYXZiL+LZFj4Ok+WzJLq77NIL6qt6EhOeCLQp9PeN9d8zS8CKCTbRpUJCFKrVe1Xz6cikjojHPWdPWzN2FxbcMZB+lvYMX+aH3qFMGPMsRv+j5Atvv/3ruWlMzPf+Pfr2kz6iKLPw7WmcKEjSc9hr6/B3IF7FH3QjDAB+aECF6G6V7/JFuSziVLmjCmL9hJDO2T6H/SSrYTIjiiIzDRwdXU5Y71zJb0FMWBXOvY0D2dXajIxK+0dGueFOyFMQaZcLyQLRtl X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(83380400001)(4744005)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WN8fqIiDwbxW++gYBn4jIo2r09Y+qG9/7oWUtUFceRmDSmApUS9pbgzLGh+3AMyP3xrzUHZGw+AOanN+f5nog2kAekphu657KeBVThXvoN/T6YRumLBcLzytzmArsusHi7uidu6lA7iwn04cR1uCn1jVOnLJ8qXbGHQL9HavIc74beNQ/CMSL/E8L3qphYI+RZLEhvvE3AJ4equ/UmYyeHCHfpE48B62NaEfKQB1ziomEB/X2CnKGWyvH2zy7Xo+rOOLhEOz11NYlWlqR2cXK9vXdWDuVsnxuZeO8k6hemgkTRYdxMQPlIuCriv/I4w6wMJP18H3+GIl6561PL2mFjeuAa+2UMYkEkahBy91L2O5lueRIGmR4jf5RIwMP1jWIGj88ulOuNN03X8oMMeRMQmwEv/uJPpUxtURn3Z2IvBKojiuH1Pho8vBNhfxdSXnTHGRBJRhAoW5md5zhp2uDQU7R8MeHt0jqOGV1wt36WZuu6SN/nx67Awt/iLFwa+bzTA2xhr37RAeCALl6pNB1Z2c0phCq78xQeAb1vZjZtltdjhkX3d8j4Dn1CeaM0m+QypomSvn1aQ/t8P9ehgLlAPgSnIlVcBD2AO+KBTOIGGqUWvWYHBWY1tetn3xlfaJMEqldL3E0dIdoX4+raEmdhuMxqzG9Go1HbR98As7wKOowmQgiOwjL8gBdNmx9aoT1KINmkbfU4KNz9mwbtozkPJ059cIIoLReXNUmSMB5YARh3AUoFU1DyAR4XcF1nsoCCsjNL33yinjgowKowJpmK4/Q2X3yurbeQY/GdFgHM6TVM1sBYM98uY87LRW/zr1PuM5N91kugkb0GfZXGD6bCClV/qGsFg9C+wqh1mjqnUnR7Oqr3c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EiUTluDrRdMbFbzdVonEVRMCAr3XK80dpEg7IMFjgNKo8vwC/kcsESwjil218q7gGyrfZ1Lp2eL61TYO73rQuYl50n7O3SHVW9q7l/LAy33t/LlePZNll52rwgEIqnFuMoODCW5zv8pVMvwSaDSvxHUSycz8Xuzik3atKHvLy1av4Y7+jluFN6oFb8nnChl5z32okJ8CGliIK4bxc8BzmVOdYGOoJmEWMcwTLy7hCEHH9q3JNL2whXrYFOcA+Zp+MDk28G7SoEMhFejjyzPrMgcd1vWekqYQ0/ukmvZXdXlYIOmQgHgoDlrapfpKCUgVVhZKyA/VoxN68Rv60igFHFQZ3kXUFhUaGdWE7LUuC3iRgJmAEvdzm2KWkXeMoFL1IKJePK2b3p693ugRihukh+hC04Sd6pjzwtcvuSZ+crXFNfO9PLz6UZ/NEIgAkYhNOVDO42zI8iUGozOuSJD8PM5yvUpmW8qmfRPJ6F/pOvm9GxuDKpS9nWZFM2y2+Ae9894cpRiTq1RuycGGajOtHQre7qCAML1bSQahqPD318sUUY6S84cmug3fXy5zZNIMMrfN9AVfcYJvGxXRFv+oYKWLbEcso8x8FjSuFKoSRX/parptGQIxfbVf1eX X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d9b21ba-ed2c-48e2-4173-08db6ca76c12 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:33.2834 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lb2lSlIKDU558zw1r1P97nTL+wA9K7HsSd6l8RxDBnTlckq/oaqG6PSPrudej8jqiiLDtWPf5bTlgt0S7vkAoMDL0Ysd2ooujsSgRxtEf9Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-GUID: D5GcqrBbDWfws6nqdOyZE4I7sGLuL0Sk X-Proofpoint-ORIG-GUID: D5GcqrBbDWfws6nqdOyZE4I7sGLuL0Sk Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If the_reset is < 0, scsi_execute_cmd will not have set the sshdr, so we can't access it. Signed-off-by: Mike Christie 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 Wed Jun 14 07:16: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: 13279615 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 591A3EB64DB for ; Wed, 14 Jun 2023 07:21:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243384AbjFNHVm (ORCPT ); Wed, 14 Jun 2023 03:21:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243375AbjFNHV0 (ORCPT ); Wed, 14 Jun 2023 03:21:26 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 072682954 for ; Wed, 14 Jun 2023 00:20:29 -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 35E6kNXe015669; Wed, 14 Jun 2023 07:17:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=hRr8wV7tSW9fN/24C29Oe8fLWIXEXjSiXnD6F9fLsGk=; b=TJ/uyw5I7KsZ3/Fu8CnyiyDdq/kprIucIuKJD6Hp6O0IoCWHvcUYZ1jGdTUl0L09Nmvh AJZzhq9bWRVFE3hrqab1fbJhEjI71QQF1W6ZkvhnRfUfGm6QfS/UYvrXhz4prkTym+Kl 2iZyRNkwkphqct61q5RFnXy3LcYTejs0ZB6sk0XzV8fXt3cNkIpLh/l4mQubT8oe2vlD ktBplm0+mHtXFRLGyM6Kt8OOQGN8Fq2c9nIaMqSjHCgX3KEms1cBX2QmVrixxT7N1UuU wEdVTxQKh18L5pijdpAguBCYUf5UGSiiiGNg5VfqOPs4Llpl/ErBppPtndANdUecLvyj IA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4h2aput5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:38 +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 35E6T6Sa016284; Wed, 14 Jun 2023 07:17:36 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56pe2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q2LUUmUemQVN6IffhPsyWEb6TccgJf5IxYJ5EnjEnZKlit01n+EY5UL/7m/7o5ixlJ1ePdntV+yLehG4L7uN4ZoyVtKrbqg96ImajqemXZdNKsuPvTdOWMajMJLfG8YKYdcVP/qJtrZMh1liMGzT80e40hNu5dCGmiHvdinBnL/8CG5SLBcYhAb/h+ubX1udnNCA3yGa+g6Ba0rYCqLQgNMpG7LipLRhkuaYA9b3axNj7dQHDK7KD0kaRUHqRprfBm+iktm+f8cjO588IpXy4G8xT7IT0SPd1lNPvaBxLmZmw7PTT10g421wLSp/K5cHJMSbF1QXFCSpP7+nYRIung== 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=hRr8wV7tSW9fN/24C29Oe8fLWIXEXjSiXnD6F9fLsGk=; b=Gl5DVgHuNtDH42D94tQ1dmhW0F3odhHkmds3RBdSh6QvPzdb9MlyMMZxPRVFszoMGgdHXSnPDghKT56GzTsqREHV16AcC9w0yWgD4q+AiUCF/B5McJcL8uayADIiFO4d732hH0Ru5fTtABvNX77egup42nSOJrGN6nOEFuxGTJBEm/iPjrLafrvtKMQdM4cb1FDc+thtqulDkKVHsJPshx0kCGzYq1T5791kZVu6kzFljosnw5SRrsDHdXBsCUlDOYaL3GIuaPSlzUKxFpeDf8BD4v0yh4dGket8rpkwFw2ulBwbLUXKNqI0BCTnQoV/KkrmQlr5IxqRBJREv67onQ== 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=hRr8wV7tSW9fN/24C29Oe8fLWIXEXjSiXnD6F9fLsGk=; b=CaXYPFDPrzl+McQpvxqZVLpbLq4qoHcSR0MUmw6+J0tsdioUNr0YStsQguSZSrWd0ohrxqSqs1q83Ps47vlnpmBO+OzpdgsFlBcs8OITXxG5uziREd1xd30Xsnc8sh60m5MGk50LNHgSpfTY28nXr3qsuCB7wD263iMv8roPSME= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:35 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:35 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 07/33] scsi: sd: Have scsi-ml retry read_capacity_16 errors Date: Wed, 14 Jun 2023 02:16:53 -0500 Message-Id: <20230614071719.6372-8-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR11CA0051.namprd11.prod.outlook.com (2603:10b6:5:14c::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_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: 4668072e-05c1-42ac-c8ad-08db6ca76d13 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mW2ufaiaY+SHHe/BbcKXdeTID+w3RNEy6KYwnXaXtaktwYmQprQO23+5kp4dSU6X3Ss0qHcWSobuDuTyJ72bGdaWFxQxNu/mYEahus89ae5m4m81Pn+GT1Rbd200XHXj5GA0q4Qdd7StBWdUUrQBXqJg85EHOIwDUyetZOeiTQvyd9PeiyMY20M0cyx7PhdRnQ2vVZvz/0SxPxyJk/50iBMGnuybvYY24OmN4LYDSOTStzbXFAfMmm9w4AcjlD3QATTpPISN04X8ilghaj2s5hOagaseuV+8LInrSMeK9eGAjr+49bfL6BgO056cPeZTrBUJdoTlwG/4/9y8W2YHLfY+AKdR4C0DtLTXgonvHfAEP8MVr18ySuqH7cCFpWJTjea7XO7+RsGtEEJ9S2bsjK0aCZeRWWPcZvVSkqqXXRRnzEQPhHqjcOdSIfai6U23y7vDp3BbRo3vM528/ZE8Iw7MgGYwQ8tFx1H+50gUeewJTOOgpVXvI0N+wvGPyV+cZTzMYRPv5imFLnPbKbYwIpxmZAtLIPyeeSrBQkdoeAJutwA0Aj9gl+MvnWkSe6/S X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(83380400001)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XnwZMWqZTjU3vHHS2qg9Fkmx0IJABi3TYgnzRVAuWidb+0KVguUqNvKlMJEvQS+qq/cMiiS5p3p0YeaPljeZcKy04l/9QQ2N5/N3eN94fl9tohUHetuddqwtf6Vy5Xsc0URJhi0eqlU8eg4fRfKozwhy9JRfMvU1rUkhfZGLnVueJ+xPOEa+oGSv9h6jG3QnldTrmDC/HAjV7CVjgGjl/ArkToE6jmGmSmA0Cc0IGzpP209+hlq5fqzItQTh3yLMTgnND11wWAyZCIr0jT99JlArVBvfvirrE+7onEWI0xIqQoNbRIbj1IfLd45Xu8QmplTwtgc9xaJfJlf/DEcTSbfsUkqEx39XTyDXIjtLZIVy+dvxSOUS5iHKyjKpXydmwS5bLJeGrAQJmF5mEd+XVCVKOhN0rIRESxh2ik1uWy5TuPsd6fWYWJkibKEUJoEuS1KnFmkypgwdAL4JtXanDSfSt7fA2jp999armmtIdZ2mGA3x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NYs3I+AJIyrzusjWY6ZTGfXmx3Hvqpi/x8UKHWKSnkLZJw5Xj1saHxqTvcfO8Fw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: zDJZc7Os+52hs+n2S6Mp14jSPg7JOEiXlDmsaMD/91gfvkYEVPmQQvF6gOahlWtn15ZqTiDVn+744fkPWEwyJL/37wSehN/O8qxNK60OLhM6TR8IQ8BNIQm+KihZLYl+cM2kRN8/9Va8drQiwtTsKtonwFjeACw0+hYFFkM4VNuFtwkP5NKqy1FIlrT0DwAzU1GJS9mmK/xbo+skxiYObND/r32BOliQNxl4AEGwnrYqowg1qjVay9vnC+aLU/QvwkIx6IV4NdCkAp11MG2JwWJGUelm0lhqMkiaCk9CSGVZgWIW1Et4jjI9cqf4kLa7tyZk03g5wot5IN+uzQXDGlXT0QAYZ4B8u3UkLBX8AZVSHfrYgZqIpBevGTCyb/63kwDgrgwAJqnBvM5R8sHN2kyn/IH/8sv0YAnY43qpROk2Qg3D2Vgqo8n8LjBGzV6nCZE13/DXLRqlPQixuJa1vt6yrj5dBQ6EfaatCjlO2ZQLdFvRzNxO4mkNPLJDRGhayy7DpC2KbOWsAKtzXr14M8JDnMvldmF72NTEXu6b7aRl0tlE5oI/TUhlWpcFIgQPJy5JKfyS1Ppul63H+RHx0nbF+OuNGK2u1NjpKfkRHHvHVzAoN6YPaHciO6gZV4m+LED2Q3997Fs5J6CylMyrVhgPnJQtP1mt6COLumXrU+bbfaZPoZPbhl7x0W3DSC8RcTX7U0rhTrkcUn7B65r6cm/N+bg/g9Chqz2fhSSpl0yzeVcpRm2IwABMRtqg4adE1eStF/ypknrDomD+7BFzBCt9P/C+wTS4azfV+OgddknmYVAOXnOawkqlogCtV3ARXkEH4RVyE7orXfPhMlFjYSUKdxIKXKN5AkDyZ9MskkjTGdsdvJVbdjbpvLRLqQTI X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4668072e-05c1-42ac-c8ad-08db6ca76d13 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:34.9452 (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: yLtHPuiBKp8DcAVRvbhC1gEJK4PgjiJfjT1UEgNs8A2A3v1rcuW3TwEH1qPTnZt69kC4L4QHuq2KaTlLTkCzWnnewyCJEH2A3dPqR5T9tN4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 mlxscore=0 spamscore=0 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: AbtN5yWtm5JatmgRQw8hUh_t6PpxFjdf X-Proofpoint-GUID: AbtN5yWtm5JatmgRQw8hUh_t6PpxFjdf 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 Wed Jun 14 07:16: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: 13279617 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 C8D73EB64DB for ; Wed, 14 Jun 2023 07:21:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243417AbjFNHV4 (ORCPT ); Wed, 14 Jun 2023 03:21:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233669AbjFNHV1 (ORCPT ); Wed, 14 Jun 2023 03:21:27 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E19E295E for ; Wed, 14 Jun 2023 00:20:30 -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 35E6k2JI023000; Wed, 14 Jun 2023 07:17: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=iHVSCiGw1YIqdrLU+ga8fFPDGKSv24C6TUD7O4DXpnk=; b=sjUqfJDky9bOU/yjk9jISfhZgF4p2Akxi0fhtPLugt8bnQpmRhtaZ3Il4X++kkP4OAHc sq72lgmFxHpvXMd88FOMS6xn2MnUyPZxvsb+hBPKeDIfJDHpx1B8d/815pkmQP9VaDAN Rw1hqjRw72mKmxRAuxMTvFD2StZ86pnfxqa/djpryURC8jYNRgNf9ekiXuU+VIf2ta0M 4ZCA0Dk1VAqmWRU0ZYXyJ8lF+iE/JgZkmjHmbO32eGh5VdSEHHC3QSCZcYQgGasGAUwz 9l5jZ7Jl+AoeaaULOeQ5imVnpHr6ubq6c7nwQxbiFjtwS4pGQOYB/IXv+SfbRbAoxpot CQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4hqupw7k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:39 +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 35E59VGM021637; Wed, 14 Jun 2023 07:17:39 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56c5s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UMXunc+UJ7zmQSQyqATbBgAwAaN+dp7MUth/zCjuU+bmpy270k/A7JqlAxekX3OJeA5ipRAtpeHoWW92pzw7mvOvY0tq+YFikM/WmBbMe8qNq/uGPKhPOcjWxdBokiOAIG5D4vdiv+7NXofvI2RwteaOYxmj1LpYgRADQG/o/bSHEZmFsZ8x7yRsuGS3TUaP2t0r34gt90z/bxitAR6GvDP59f7xEbFs8Sbf4Q5buNeewv2ihtpSwv/eOk+3OY9P69qIiupsU6JClirZI1Yqy/qt/Hy9ER0QFTE+1BbHLxr/0VRm7DiM3tXS+NPBQIA/2llhStHZcviOjYrgAtj11A== 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=iHVSCiGw1YIqdrLU+ga8fFPDGKSv24C6TUD7O4DXpnk=; b=GnRms+PcGTYxEGE5vtWBOy6adU+E0jKfpnj2YubBF7DlZ0EfbdhFe2tbZ5MS7p47BgRAgqmgO2f+yR56tn0A+qDYH8zCW321iyi909oZkyWxMftRoaAztN1DKUJX7wACQQEAPrAd5sFqfh7co9Fnxl3S2SKPb8yIGP/8d72O16hUvcQBudahnRCQx+b4Pg4UnNULvFWblty7GobRLs0ntBgDns90WAnCdZzyZBcqTsXk51yCetQAt/nQPXYEjoQrU8SKrCiQvPP5eNwFTjuFzLyzvpK8ovZt3DjMV1APrHfmkX8H7uPXGAoP46Qpaap/BRqnH5tXAF6B+39A9ozDbQ== 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=iHVSCiGw1YIqdrLU+ga8fFPDGKSv24C6TUD7O4DXpnk=; b=Egk8Kn24eOZIk81mWBgKMUqN7WDM1Ku0tE7EF+ZAHj2oOU5wjd+6fKu2//UegyYzbeI4z5KSx8yyggrfdI06+Uy5EkNqw4MgFqhgQXLFkPX7BFFvglqCrcEnIS/5KISrBvNkLkDG8w3cF8llzfbZdYjsK2qwcr+uRPjikSHGfpA= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:37 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:36 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 08/33] scsi: Use separate buf for START_STOP in sd_spinup_disk Date: Wed, 14 Jun 2023 02:16:54 -0500 Message-Id: <20230614071719.6372-9-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR11CA0044.namprd11.prod.outlook.com (2603:10b6:5:14c::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_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: 3aa0e6b8-acaa-4cb9-6321-08db6ca76e47 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FFFNO0dac2gG3WgRy+lC9ez+fJSvX4CjtrrEYJSxD9xNn3U7ExRfRicjkjPqUA7te4Bb4VXo2F8Sbr647zEkf1iJa6ZZANYCfYBpDrefWIwusd+VgFTbdVvKGluvqhB9YVur0jQS6cFKLhAveHJn0VA/m9OD7sfvZmf++jdSXWaNHeZ5wt0dy3D+h2lokuj+COJKKMHQs5Zbz7+o+3ifNgcQm7SgrneQol9fVuzt3W+Od7ANBG7AuW4PyZ8M/POAaU/kyxMgAUQMbzdqkWt3AwySBSUa/8Y9xFbezkvIRb5wJ6hcuElpV15wiy6C8n88lgS5YvitvxJ9PpymvPFT+TB3KF8czgdXKLN0RxkxLWOFgQuxKoBNTdGifWyNBRFHSFMyb15IeTTkE2ZzIJ0XI3qXY4KvyyTPV+/wfEa9/lkbYhymiGsM5JO6XiZ7tEL2QFkxYo5KJjkHndwqmZ85om3XnH3KYXUwt2koiNX9gJU6xE4TMEa5DB1utHvvZm8/W1u3wZq5UkR/yS9iUhbsVgVmBzVelYzkIAbU3FfhmB2T4MkM5fvlT/Z8ufOHOtZA X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(83380400001)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 26sw392UXiNwHfSGQCmHzO5pE9VJ+0N1oUsEPDkBvug0tkaE1kQCTQEwbD5apGEMy9S2XbEcbQl2rnUfN5Fjuifc55xhYYKYsN0TxU6c4giVtKZ3mnevbZS9LU2f0fjE18/s7qdDqg3YpaB7mXbnBNYFauyToq2w9d9ya6JdVby+ogCffElN7Ibq5f+Q6DCmCJGCIbYWII1+FfrPmaM24TTxKKpMYYrnrpTeSS5zxcI3Z2WADec9QD682KemuJujaOtirbX0znoTGHPAmyYYjcyWJdItWIShuYJMcIKQpbVXpxurrpHPQE1U5xH+26OrmBSzwItR8rbfynZsAoBc58cSahOjWJbXYvgY2ewm5kvjCn0gYFxY7GAfjzbd5p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OemF1Vns8ObbADlErLakWbDvyCJZgo4gdVvEeMgsdbC2B X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3aa0e6b8-acaa-4cb9-6321-08db6ca76e47 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:36.9639 (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: ZmpWmWHA+UHMiU0/MCI90jCO+wYAh1cJ+mOlZds/r2CyDLUdAiuJa1m2bfPvPpX89OVb2xi0L0slcg4cNWKoDS1XWBj5Z18x8/MLL4MUaLQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: Ag_fWOVbZDLEveqpJYMBMsIZvbVH4eBl X-Proofpoint-GUID: Ag_fWOVbZDLEveqpJYMBMsIZvbVH4eBl 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 Wed Jun 14 07:16:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13279618 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E577EB64DA for ; Wed, 14 Jun 2023 07:21:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243212AbjFNHV6 (ORCPT ); Wed, 14 Jun 2023 03:21:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233310AbjFNHV1 (ORCPT ); Wed, 14 Jun 2023 03:21:27 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE120295F for ; Wed, 14 Jun 2023 00:20:30 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6k6u1015552; Wed, 14 Jun 2023 07:17:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=q3Lgco7wqD18t6/6i4FAJLYtfYYJ7t//4yJltDwkcaQ=; b=c1js+58eKgDY+cRrgGDzgOodfmbFzrDa2PBd3cQNQ7mKpn3lXoyaiUzQNZ/Lq9JO9eal TIszCiIZJTBeBe4TVBeQqrh+crpq0UHOe5pDA1CB2tEF1kN7mRB/53dA6tGgQ5YoqGjR DaGMji5r+F6bsdpCuuPQDKPJO4hc06U4J8krtarc7ZB8aJCjQR+MnmD0YAobJiFZaH9I uYzwDLldr7CebLEgT9+QTwFMQ8khTCSvVtYFU0Mu99aY7/jhxIx876gy94h5XyLFzWl8 6dUBPu4MjJJGPrk0H13JYUX6JLJJcuH+zjyQVbOXouF6h+EuGAR0PDEgWVMKusKIuoyQ kQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4h2aputa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:41 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E51DTH008450; Wed, 14 Jun 2023 07:17:40 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fmbexd3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iscN6WW1PNFpa6cb8nVIV9kmpMg2sfiV7xDRHEgbajDerADjoWoyJfx4+19dwL7Q/xZ0h5dBQ4LhOXo6nKlkiOiFHhuJJamfYAt/1zn3r4kcuo6HFDnVH12DMPk9XLD2NVYFS5456ByWSGg6NTVwFz9eIiJpK7uHt7nnVqqdeHJW8u3AYcrpfvRObj1xFyrc9HHbatgd41Yzum9NSbpGycImnff0tdZ3oVt1mz0DhU+4QuHU5SSiOdWGtvrTJKgq+dOV1HN0c9FrW4xkCjMyJqRzx8Mb0tp6H8IB2UfloBpwIAyk4pEXpMqmGrt19xVG/uNp+EWh8X5SW8+US2wQzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=q3Lgco7wqD18t6/6i4FAJLYtfYYJ7t//4yJltDwkcaQ=; b=cJ5i1VYvEoTQJ65e51ZLXFZHesrqM5TmtC2kI0vDEPNn+NXKivK9JwvisYSKIoUpLTgR0hsz4f4dDg3EnPrGs1tbk5wP8F5wO+xmLuthFuSbvwS37oAZM5RS6UfSrVDbczWwaWqbXgaLfU+ssr2ubWq4h0W1X8V20HMxi0jIEvHMLp++hqK7bhjYjjpbA4ZWERGe5j9uZ2lYXinzrzDt+KiHOS7xWx6snfDUx6AIhYXy6cebYuTkE5QaDLsr3YQ7Wcms2/prPxsk0yLO6JPLcJJGhP8xrpQemMKvHWWhk9djHv33SADKz5lXVubxBFC/cesAR3Wps/OfUfQj+7V0AQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=q3Lgco7wqD18t6/6i4FAJLYtfYYJ7t//4yJltDwkcaQ=; b=oIItIjOqwli6uyzn+iJY1EkxVa0LzVNKz5YIGDbv6MnEmyOSu1ElnzjVZdVNpzwLY+4At7mD/MR+TqzdjnaXfFSSMAD89wIWNBbu2/IzVKi6Bmxz3VmbYBLsw7NKdndXT/eUdX+nk1JpvZUL6DLr1E9wjA7GaD/GG5Ujq7Xg2Yc= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:38 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:38 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 09/33] scsi: sd: Fix sshdr use in sd_spinup_disk Date: Wed, 14 Jun 2023 02:16:55 -0500 Message-Id: <20230614071719.6372-10-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR17CA0020.namprd17.prod.outlook.com (2603:10b6:5:1b3::33) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: 259d41c1-0316-4635-11c3-08db6ca76f50 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jFW5/7xX3i6lDbSar2UqcacXXYvIIzKz5bDL+97jThGR5V5N0hssWVjk36s+uULh0zYdxxxTg/yr3MZ8GinxqNnw6gSsofUDubDRYvYYcgtglaGMzKAJR3OAWG5WlF0lFukFAKjI0VLs9+8y/EZ7SF4XxReMQVFF0VnqqLmV73sGjYYpzx8HP2S8VsGWVNbx19vaIQHh4uOMsAz6WzNWVVO30NTg3qs/CHYSxei4sn2P4nBJIj4z6NgergEJVh5TzpjhGNjNl1/PYd1xXCGosQloOGfAMKjumqCr8rp7daXOgxjCe+xISvOuQPz3UDH9uevIQHVLuGLIt/a2Zsz+l3pkm6b7OQPkQaVA8+jxKHRP8zqBqcMGrjQEXx80PHGIAeetdZqXs8ya97AkJFTZMbZRXXYacJhTGacMe4Tq49eECuu2mt6ObBgcQgJwqcsEPnhZWXizrw93EZ/Y4YKlVN5Y8o1J1Cta2694Ayt4ZXklOUFiJ7c+NxTXq/ERjKYQLX75rshoS54GBYzZe/8VEujLTEvnFNTrHEbvYeqkTMXTSyj5ILV5/ux6cVJd37No X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(83380400001)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FttiJn2JvQTqpeMk8hniljz6qqKOxOd6v0Vd5Z19PJA5FMqzgHhicMwH4lQtDMI0e4sNTqH2DtEj6k82nISElOpRbCqet5mj/y4iSMqZxdvtHgqUYUBRKF9H9kkyUE92RiXb+HmsvuzxmV5mOY0kbqNKejH3owDKRoX9CR/EokufYoL6hMF6O0ySktde+jp5AV+HIo8Z85ScLpuKBqyVTwHHbSt5G6HWl6qmxgh5tssunTIZ5eUeQ9L97g8gn5h62FosIYW1y16yBQMJzPODTrXsYlZseSZZ4q9YkRldJ1u6VZUrE0VL+CrrFVahiCPvf4ZuxmBYGVnmfkFo3qKXdd1nSwf42WR4fSGDmWBjI7UASghiOuen9aysjcgHyvZUmthDXFu5Pp2oTa/LFibp22ViWxlaGj/1snezHwW/ernnrgFpKUYuVbih3q10BV1U5goG7qWatzOM0EvdW0g9QjgiWI9hkNNLH9mcNzYCJZ4kCYoHpbgcnT5K+9TyQk/N76s+mY4I0bDRFvl1HHI2EPeu07cB6hR/sl8bM4eHOAVjNx0eM3XgjUemueyxuIU3TmC52Zz21nR8h6RDHexhP++3EsJy8GwU+GYK9ql8LXIL6XhNAb/p6mOXfWfXTLryIxnvmOFMID7pB0pdwM0CCHip+WoAIsTwpXMyRyO2GWDmVG4KVUYZGOpBH6DbP/jONV7bMUJFM4iemgKQHQDmpY4K4SmrTWlMUpDpwHnBfanEiMACTuwUu67/Hr/TbwpMmrc6pkN2QevYfRvIQFBWhFZnN/iOE3m97ta3jZIxEzt4jFzUP5J4EGouu6yfelZZ5Gwo+rMMvesmZ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PgZnud1+tAqyi9XNRS/OmKi5h0mXq8i4/M68TGjS2iJrWrUnyyjdD7ADjdJtvmzgcL/h+Cc2e1kM3Dtl8LtQSg+ouTnnVicQYyxfgFNPPZZAs5/UYJApA+YkULZ/CNiRfjazBIFIosywKctnLG9CbHFZceAIZ1N4aX20/6wAyUTwltAXn8I9oPWd1CRAPG4bALEwBK8q0FOzUi4yP2XE53Pu9KoLMXrJk9qgeCr7N8pekYnTpj8ADvC7HSIJgRY6c3t/fHIVBb11JUHccD9y5OUVR+bVrzQEsovLKhNUWiZuQBl3pt07UI7CfaCoc4N5J6La46hivk74MYir3TFQPm9OKO37FzjWkXWXWGO7Lug78nJBDzU34q9BnK/JphLoo2Ur54wHwJVLjljyvZa4J6wcxEH6qIjaolJ7j+TePOIHskaILYsUBYnkWxGDk4u3/tYWt7ONtvSXFuhTk5ouUJzAFKZtg+iznCFsJernhwBUmXz2AN0tbwO72BYZ6M6OfKk32JIwkvFUgIfHlEeZIA1XdkoUelXxVEUndC4UDITyEqQroIw39bdgxXoRGjZ0YTzv0KxPlO0iuFG1ub1sxT3F+9YEolKTa/IbRrYKyAodrb8s46Aah8UxX7/QG76QM8WLqQlhEIJjI66wVeNyvAH+BEBuAq X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 259d41c1-0316-4635-11c3-08db6ca76f50 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:38.6998 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2hZkUqqPd8B3lkEY5cVUoOPz0iOtJ/U9JSWvKdabecXxt7UxfQgMLX9qMQX2jHAKvgDUyVwJ7/PI8dRKbfl5JlC5b5JRg7sv+FuQoMUNREM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 malwarescore=0 mlxscore=0 adultscore=0 bulkscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: 5_OLZtBtoCNmVQUEjvxlJByzAFtCKhBF X-Proofpoint-GUID: 5_OLZtBtoCNmVQUEjvxlJByzAFtCKhBF Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If the_reset is < 0, scsi_execute_cmd will not have set the sshdr, so we can't access it. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: John Garry --- drivers/scsi/sd.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 1a1011a8ae53..e34cc9daddce 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2220,19 +2220,21 @@ sd_spinup_disk(struct scsi_disk *sdkp) sdkp->max_retries, &exec_args); - /* - * If the drive has indicated to us that it - * doesn't have any media in it, don't bother - * with any more polling. - */ - if (media_not_present(sdkp, &sshdr)) { - if (media_was_present) - sd_printk(KERN_NOTICE, sdkp, "Media removed, stopped polling\n"); - return; - } + if (the_result > 0) { + /* + * If the drive has indicated to us that it + * doesn't have any media in it, don't bother + * with any more polling. + */ + if (media_not_present(sdkp, &sshdr)) { + if (media_was_present) + sd_printk(KERN_NOTICE, sdkp, + "Media removed, stopped polling\n"); + return; + } - if (the_result) sense_valid = scsi_sense_valid(&sshdr); + } retries++; } while (retries < 3 && (!scsi_status_is_good(the_result) || From patchwork Wed Jun 14 07:16: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: 13279607 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 96093EB64D9 for ; Wed, 14 Jun 2023 07:19:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243368AbjFNHTX (ORCPT ); Wed, 14 Jun 2023 03:19:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243366AbjFNHSk (ORCPT ); Wed, 14 Jun 2023 03:18:40 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75A33270B for ; Wed, 14 Jun 2023 00:18:11 -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 35E6jvG7029013; Wed, 14 Jun 2023 07:17: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=2CB8hum7t3sTubQzZkQU76j7vLJLjfe5nmS5Gq42ugM=; b=hJAfqIX3nroHtdIh0TppQ7D+tzSfLpcQunJNIqdnsQwsgaeMN7j7nN1LZ6jeB2KBarJz nMQ3ituwCwWf1zXhwhhb+UmRx9/gHzkKzd7PDzQ3D0yGZQs59YJV1ens5MUAZnPj4Ub7 zFBDMHk6BFGgnRcNlvypS/dvqb+QeD5oxFUDhHKfSC9tqE6cn2kJ2To1Vz/MoH3hV+w1 Nz/0eFi//GJdFNFh8tzA5ZYn9bs27a1WljsK8Bgmpo40XTeErAnNFm7PAmUdqaPJkzwX 7V7L127fVd97aWlK98146T9vallYuaYV0d82sU0a8Nf78tYAXjotk21+KhWQRMKgnFoR UQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4gstxt8a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:43 +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 35E5Oogi017727; Wed, 14 Jun 2023 07:17:42 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm4ws8x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XpAplxnUoFI7eor+VXxuymEWrClLJ1Lvi5HkTLXTYFCVRy2SoXQUWFIvbxZktNBuDT+YCgZy0A5nNu8OqcC5HJPHfP3F823G1jzdahjsf6HoofCufU8R+6VGaXRHz21JuVW/rEpliW7IUUtqp+5tINyK5qscw6oUJk/Me4lekHkT+vxmDii+soxlmg7f8aGmVTAo9QL6fwgvLhAk+RL6OVHCo259/Q2M/ldASt1QTBrsbwFioQmvcx9ddqcwi1tCpFXUsxU08+Z0y4LFJGQgB1AtVohVdvIkiFHbqmalW6EQ7zh4CB0ZLPeJS/PadARU5sIikDyvXssRWyETjxsO/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2CB8hum7t3sTubQzZkQU76j7vLJLjfe5nmS5Gq42ugM=; b=JU9OEXvtBim43zMsGV2bBMnNmIww7NRF89JKaKV65tApctI6xSlthwrAoz5+GM53DW2sFlJg6AkdTtjUduKjXr4U1Eoq5SvW6VQEQ6mudXnhYW+fSVuJLTDzC3CbkyZMDzsd1IJxjfJ+alyuJZ68rpFL8fyj+UZxQ4xYXTLfwsY6Y+4HPgHUUNjzsLAnDVXEjCkFwC1CbQQp2zjAIEp2w1iDYLYeD0n4vfEW0wge1c2PbmRiudVEYCezUOXyc61VgAaRNKxjNxB5cJvGT86pRBTohBwiSxBmjVcRIyC5wGGXVki0yw9A7d9m5ELlST/JwplQIgo0v1iLomzkWkpirg== 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=2CB8hum7t3sTubQzZkQU76j7vLJLjfe5nmS5Gq42ugM=; b=PqGpEPBSuejLDUAGiMVa9E1v+EGDTz2cTzlHc7ZmfPezCSSc48wprXyKElL8ducJh7cAJVEGRpA4ymgH5sgawG0qkBt2CurD0LcxaLJjSz1Ea2eMq347BQ7N0wUcvjl+7m1fSnKVWsEQK9wrV90HIAVcIPHLxZLR4lFdNAgb5D4= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:40 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:40 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 10/33] scsi: Have scsi-ml retry sd_spinup_disk errors Date: Wed, 14 Jun 2023 02:16:56 -0500 Message-Id: <20230614071719.6372-11-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS0PR17CA0009.namprd17.prod.outlook.com (2603:10b6:8:191::9) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: 806ebdc1-81be-4a2a-98c5-08db6ca77051 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5mcjnciKhIWQc6UQB0rBO9Smb+NLikrH7ITweHSYnd/UFvCABuergRDKQA6Oj5d9yivcbzJ/D04XymXbzS1q/A2peAVbzi0Zx8h1pKGpZVLqZkY/6AIQ2pw/EiXxjsTVIuIK6jr+INjlH5oCYSeaE3x9+wv+I8iLO/cs4lcx1/liDibddBPbz1wn62CmZXJBsMs8dy9nRsxh55+RXlss5Ave5iWvYzM9hRBLpnl7/Y2IKk/E87SbyTDpsjdq1ocjyvJlv2lJx/ssF7goTHorfdpVOzkCWyJgjoDWz8fRjaMgrGqNTI6Lxm6WDpHy9hhaWQ/mBYOmAfZYb1qMlr3Cekjb9VuDUTwwD+tQVn6PoST53Z8fw44EiYxR4Sq9SkBB4ygH5b7Myk/9Dzp90bdfLzfE6ify72Qdk30PT+9U+tST5/t11eQ32nXxnEvhcF8kIk2EP/8sx4fJK54OhBOqc1J6T0jCvLvrpTaZ9grI/kcEjDYX7ul/pzBTCJMvPTpNQH7FHn7stmWE5OZSae+7oGXEUXJ7z7W9lgpfshJwvHmma59Y+JA0Zq9JGzDQwu6w X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(83380400001)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0VIszC+WUa8uWgc8uzjxpnZU+6cwPz38u6TANi/JZPL0aJDZD76/fvQeWQ+ZEAfiQxZJ5ywNYuXl18FpdGGhvaNXo61y3j4dc8yvEwy2atkhbeo7SXSjSmOqObEruzzy8ckvKC+bX+Rbj94uEgp7vXjaVtln4BfxQV1glpCaDGnxFuKfCpOUiZLVc2z1b3ZDzXDw/wFUANZf2CT84s1IndEi1hSXGXw/VwEwTUKZwla+wd3TWxn2uYiFdsZxEJrV1RoXj6ewn3FmrcjCbVoCuWoG7o0swk05aqlDbWiCey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lwBqbYatH3L4MFqYye22VmVsq3QWM/DklL0KxoAvFXVWhrtzg3ScKPWFTfnQjTijX9iEOtCE3lQJ/Uu+6vT2oYYA/OUqLYXX0wt/+sD+QZO8KKQIinUJSzevbsdc2stIG0bveU+2etH49qxvmsEMdxGV X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 806ebdc1-81be-4a2a-98c5-08db6ca77051 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:40.3855 (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: tvUwvxA1UGUaB3VwnSGSglG31Vj8WBB0kO4q0l43njDbyh7wPKfZrczPOvFQaWYnbQoj+QHpp1La9wAqwl5+8TONmrZPcOoqV1SvvrCJTj4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-GUID: 5k3R6Vsp5HCVEaqy_Wg2qYfxFJEwMtnN X-Proofpoint-ORIG-GUID: 5k3R6Vsp5HCVEaqy_Wg2qYfxFJEwMtnN 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 Wed Jun 14 07:16: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: 13279619 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 81D01EB64D9 for ; Wed, 14 Jun 2023 07:22:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243388AbjFNHWD (ORCPT ); Wed, 14 Jun 2023 03:22:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243386AbjFNHV2 (ORCPT ); Wed, 14 Jun 2023 03:21:28 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F01302100 for ; Wed, 14 Jun 2023 00:20:32 -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 35E6k2Fv023003; Wed, 14 Jun 2023 07:17: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=s03+KYerlsdWFWk+h9Dhiv1cQPsviHr48/by5s/54Sc=; b=kEDrfqsP3f+/fPdmThEJSYuLKoluzE52zHDYZ6Jj+XgphK7J1Eyx6mru/mm5asTe2hUl bJjaTaeWxzBd8f0ktR6c1Oj/KUEFRw4STxAG+BVXabzuqgUi7sO8jqukMe4opieg4hV7 xUZZ1Xw4Ld8xNFVjtuqfZon2afZMAHGLg3Tbir0X3PNLLsaLy1QD1avZSnXu4+frLR1O SubvYppR1J0vrFQXPFykZH53CnYPF7x3cgVRJqTwO4udYwOdRw+/J+rLY/+Rgf2jG5Ma OWzcbew3N0SS/og+ZOS6WZ4UYgr4bFUBpJZMJuuE2Lld2fKPJREY2Ba0KPfg8l4gLBR+ 9Q== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4hqupw7q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:43 +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 35E5Oogj017727; Wed, 14 Jun 2023 07:17:43 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2169.outbound.protection.outlook.com [104.47.58.169]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm4ws8x-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jUQkY2mK9UiLNPjZmdheoqo/DrOAW535zi/AO3RJb+x5IN4GZB0moWB+kLPakz9I4d8IgLUn/Gbmrmp19ybA5DaeOMHkBFaSB6DZqgkKzVfmMmg5zi/TGjzb+rJaiCl2LHL6r+gIflK0VQzIW12aLe4lZjwH32sjrK7EDJZ+A/65FeP+9cbpm3dmPqR+5hNtmLlmF6bRWn4TWnPNqsIKt7NyQLdmDzpsVSSPuOTY0OzYoOblQ6WXKJrq4fQpsu/17Bt2vC85oIvCiHmV9TW8XoHYCkIqDSq9R3lIMCCkFK8uKSI1cQ6AL4vM6YlAB8O1SggttLmeciks99i3/C3QMg== 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=s03+KYerlsdWFWk+h9Dhiv1cQPsviHr48/by5s/54Sc=; b=oUl6Ck6Zsa0olKWQ7j/L0FVqC8Eyk2mJBT63PwNMafGK2z0by6ajQ167g3w/76s/6GtZU7Iy9w+odeL0wgiZztPY7qhZiiRJe3R5pA1iDVx7twXnKdKXvIL9KaijRhtBkAMBk1yeY5DnhmnidRDEuRabPpU/IEN9Y0tD9azcXsz/tu5S8i4HLdRtEstLahYpLyJ7eldlXSyceWQCMtMsBdGlvigdBhabuFDZeWMzwWL8OGwE5g53c6vTiGkWIgkw+JFpMDWn6zET8Fc2gN2eY78pJoOV+wMQmgmQHST6k/jpX8HRqTTyRYk/ZRB+XhrZh2sbcyyA+pIMgNPwbh+Ldw== 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=s03+KYerlsdWFWk+h9Dhiv1cQPsviHr48/by5s/54Sc=; b=fpgJtmGoLBu5znXME3hxFPFyWxYZPOXDX6AnOtcwQNS3tk6LRi8yuBvJpXuRQUACJ4oi6709mhj6f1ISRO+CL90huVeZ976zBetWF6MIHONliBrj1TaXtB7yTWGFnvP0+hOW3hM3iXorG9vAptpdsmDYyw7YU2a7zq10OHF77qA= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:42 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:41 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 11/33] scsi: hp_sw: Only access sshdr if res > 0 Date: Wed, 14 Jun 2023 02:16:57 -0500 Message-Id: <20230614071719.6372-12-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS0PR17CA0019.namprd17.prod.outlook.com (2603:10b6:8:191::8) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: e9ce2fd7-81e2-49b6-2045-08db6ca77134 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n76pnn2GDWBdJ14NxMjkx3VvKdL2PV3+Lto+/uyMHJeq5mAqi4wyFMhfvpRg6sz9+FKwg/sAiqXZPdTnVWxiwu6dlvj8KxWGV/WV9mb1NhUU1IFvAJguwfUj1gYHkJ3r3AZpcSAhcqNv/UZx0AMBzhtTKYsX9u2n72rP19Fzte3deQtcoDApHgkxIQ1DAPbDPdMhMdp3/myFcOih4gZU7i+EvF346mif1OoKQxErV2KX3mqWeKrACBpqgoaajp/iwCnAS27UxwUb7Irc/a2m4kiSPgZ1em7XVtAHsd9d+WdE4JUd8ecsTBLriLfRWyan84LTd+XDkopJtNVCp2iEt4leS7XCLVAvyhUEpDLNzGCD7qS8EPWnEkXY8vPlR6GocF3AZ25eah9XHDjm+pK+LPAtGU5EWQRxtNzxV+QsnuZnqcTpUJrtAlqZ8uNpbwjm2IQkuVbpzSown2UEuWtvn44+XLg/pTHgpBWzs+6X+3bt+x1LpmC7uKyLyGj08kF2VDVGXHunoaRhyFzNZk2BnMtObRM1ajUsUZFgyyPY7UdEJClcuQz2t60qioqyNoQO X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(83380400001)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lbtrMj7bMxeq6AOpoVX9gxwkrTOt6yUGa8vJDpP+A5v4ivY1cRV+TEiWPAOtT3Q7ILA7lUGfglXdGtxE9ffQ5X58d4kv/cAl0vxfQ9DME/zqpfsSsRMYfQmqEJ9bjJFPwTxcgVyKS2m+VtHm0URqnE4MkP/70XMoqHwrCZsQggZvM3E+6F20AZ/iuX6Ten8B2qmjcGVZ0wf97v2UW+zVZoMkA586UbgmVtmbDP3mYlKlghBiPNM4FfnHWYQz1pA+utlR3BQdDM+wX+iqmsbv9GQ40XlBmUgcRBEUX79dzVCZns0yRVBSHCwnMxkt8XA3pwGIF77R2Z0qV1IgnlN78n27Uvmsyoj0GjJu3T6CyTnnwy669HiUp+fKWQuMq73iu0kXr8SN0xsg2+oKf1CJI3thcUgldvjqH1o91+mhv0fBudN35Yw0DkfSnDrEfURxm9wXz6PGrZgErVjHwHf+L3zR6fC78kA+98+6r5jHiAy2jig+8kEXQ3y2hbu8Yz/wxc0k19qLlwGWJaJLRkzECJDZGs72NVKz/SRN5aa6OylUGLOEb/Ys7l2sblwkHfucnllEsFI2sZ7fPrx7m+t/le648TBd07+1/V7eyunU3Fqde0dDg5uVhk7xQOzeEyykvYQRa+dPsmaW2D6r6gXKn5LILfrc+pjmvnil0bERW0NBMNFqK2bDlJRd8/Yz0nTID1bCxSh3U1/8zYHUb3tgk1oivjn5BlmE0h+8CGXnQNDEg61nd0V52mFM8htTj7hrU4dJ3vKCtdI2Fin8dD87iWawtVtc2HY/yFUZba790r1p71QnSO3DcyX1+0G3gJ8r5E3lyvjiquU5rGv7PwAd3jMqYe6NAQDhAQvChCZQOJKQoizf52Nz8iaMIYvHBD+K3ZKALKaehJvnLnCImF1OILZ9jNGZ98R3hPWTabfn6J28ed1dw67rWwMDLzljPS3QhLtatMyncACh/824RG0Xvnmy/LliQzew5Fk4UXS9NEYcl90vIz+xUNmplux4y8Acv43c5zRKqUKWjRzAU30R8fao5glh9aUNodc20q6Z1BuFVcOjAK6Xc8YIJvoUanSdmrGWvpyoVi/A6Wd3dGwepnR7axVicVBCD5cSDidvwAP5sLKrNS7KDq5JCJ6kuxtIYefuAhxXBwNFg53Meib7XnM6wKxi32jnDI2TNe0Lxw0ENWe0psHQ02iYq2MPuyaE25gRpL+ofyeeKxRVop6m6L66TamW95I44BzOMb29ZdggY38jLQAecLIbz37POTCjquIYjxaW9PlWUbjYdxQ2DMB59PleAAsNwlKsACN8xGbVnGEE0EEYM+LvEArdfOVdo3b7shqNJDj8yWWiPJiUAzsssi1CWlDA4n7frcd4pdB97VB/3gl5bSKvcOe8vK2iG021oOgWcONn7WvmHFu+is8nLn6EAOUtIx8jvotd4T+y3hS+DzCtwn69X2TXsVUY3a8LkN4N5/mHfB0LObTV6Mp3onRcQm03wKJv8CNiPqmlCc1XJS6Duk9kGGx5OVolr+ij5A1wzvz02/416d/4ZzU6qyoGKl1eOBkLmjq5+Ul2aqJlkpMCmN80gYG5SRK9JJDphzHJ10GaYG+4xetSEg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: QYIOoLDSCJf3gHiHz2q3wWKq5ZUijgS+jcL4c+xMq5w2cepui1CiD4qDLil+xeJAfberNWOOSL4LbJV3S5ccF4AHL0J+iUcuxUXExmiteLExfE+ctMQvCgKpUb3YrrSDYGQ3BDV+lM7bxjoaYlu0alVHhRB+mQBj7XSR7nETeOa3RFDGEDHINbaqJeXzTBeSsLT+CMV/fpbfKJabH07ACZhAt6DWzYGNsBcUydNCjFA0ElmwqyULsMOIzotQiFRHICVtywaBuH5y7sceext+P+1M3kvRa8h4b6snHBOWl36RYmAfX1eUXeRPqhfSRFHBK3R99glakNlZYL9iSQ/3nxo9VFlNbzsl7MbVAAdQkf6SAcykhm/tZaGJ5QGvDQ8/v5Hc73qw34ZKdcyq0PEciwM3OGQUzqsL9gCBdQIMnuNqFVMa+qdqicKsEZVbjPkcilv7GJZZmdzgkM3jlk/PYDEHTLMAlpvAFHkPUkk4IYtoTRbtp5QCWWSgDdwj1W0iuUkxt0OSe8xtZeajAZGkcB6lCc6vgL3ZZ69x1zQGntKcvblgNJGVj9/oR5xKQozEDToNe/Gn5DSSluc1rNsn/QUpQW3ZRHywvHJpJ8fugEIWwIIFvf815eJgzDiDR6K9nSWwEG8gvnLPYl72kQsFUetStpfXmAuSF1a8luFGgiHQGK8tBVI1rWHyubcUNGzPnPVx+vwP4xWIJnilDrqAOAqraaRK5haq2NnqlCgGYZF5q9cI8aSlGkslSmQCyqVc21oq37KtfQ9XPKc+vVUdsrPsINWCEZiMphENHeumvugXENeta2xmY55+YuDZLoYs6Ge6DlGMpHT2EjP1b0/1o6YHIBIR68uL+7y0mlI3Fas2yfcZiK9zo8CFCmuYNwJV X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e9ce2fd7-81e2-49b6-2045-08db6ca77134 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:41.8861 (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: cr2ljh6ybISsyEuXXcuUTP+BXhHapyVJ9cC1Kk/IfiRsQ5Sl4yqvgdzfzt6RN/kk4vz1xu0mhLJZEU8zxMRk+TlPugm6HvEdP47KPyATiGQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: i5d6Bi52BkiPvMD37FOKmq7A8vFVsGA0 X-Proofpoint-GUID: i5d6Bi52BkiPvMD37FOKmq7A8vFVsGA0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If res < 0, scsi_execute_cmd will not have set the sshdr, so we can't access it. 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 Wed Jun 14 07:16:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13279608 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22423EB64D9 for ; Wed, 14 Jun 2023 07:19:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243368AbjFNHTa (ORCPT ); Wed, 14 Jun 2023 03:19:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234403AbjFNHSm (ORCPT ); Wed, 14 Jun 2023 03:18:42 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0A601BD3 for ; Wed, 14 Jun 2023 00:18:17 -0700 (PDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6jsO9025325; Wed, 14 Jun 2023 07:17:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=w/c3h+o+2hEC1e8B/KzTC8Xi9FEmVKbs9/jf+qpkx4Y=; b=jVMWCsJKKMacvjtZEm1hRE9dK3FD7OkXUSZY6DJUKAPT/2HmIU+JEJynMQtLrEAimAOq rTmpA40NYJYUS1Omc26QKbwQWu71IOOpbuanVqKp/iy+4T9cSoR0g0PVsbECEtZgLeg0 ECTW5SyddeSbLuslsNaLfr7Q/3srLnL1I807Ocp/YiMNv+v9xJGP5XLL6VHnLgfQnvfq eIL4jx3OWCG1P5/cvPYeyaIWFB82NF3EJkRCztlIekhnlwXnvvdHXLIIb3TGQARtgHPX DC0hXBr/gRBXhcMYFwcQtaYB/ASmHUG3S6KCLExUeTKE0KHMbrRC0ahXR9GDxs3YAL10 KA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4h7d6vph-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:45 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E5JmbC009030; Wed, 14 Jun 2023 07:17:44 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm5ese4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JDF3q3aC4/ATTzvKxImdbIbqgLHQqKxYaR8lYNAzgCAPkb8oH0h0DtjbDkLsR06p/9EKT1e5f/tzmjk8bAFn5J5MDLtEtlddTjo/TiZ1tOiv0OqHNJOXyLjpmg+X+vJU7ikCmm7zXJBa1mdUQiuoUXsgjlcf8IdEngNRvkGjZ4cQOqkNqFZn8ZCaWRz6i/15uC9fTaFtNLZ7AiK0GXJCZ/YVxtbyJWzTdSxvLXyifGYq4L6QRERFEA/qzu1ThqEt8OCimY/AvB0SbCnmTHMD6H0M2nT+M3o2VAd1jDhbXSz+lXmVVOVnelFCN+OePu92djyrAe9hCrDW9598dz0LgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=w/c3h+o+2hEC1e8B/KzTC8Xi9FEmVKbs9/jf+qpkx4Y=; b=iICnBGdnegfY7ufWFGGA58kh0GHxHl0d0K2HPUO4Y6gphv8+/fNKAITI8wlBRJBTj/xo+Opjd2BwyzAIwn7cZdCaGH8wys0OS8w6POPaYJv/dvGm8hC0myO1Rv9eQsvkYJ+7v0dZMhAg6Tf23uapkD+u+CT9EkG0uKo8R8XFGRWBNTiZU194LSh5fHhypB96oGL6r5lhwhB9qRwWXAywbJAXNo0wF9uqAwLSumITa6opvcPu8ecLVrD2rXTc7XSsTH2znc9bc4EiZbjVVzi6jyr1/kbmELIXXaU7NEIFlpMHabUfaFhoIBf889PdPDkZDBsC+duw4e5gLUPHKWIerQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w/c3h+o+2hEC1e8B/KzTC8Xi9FEmVKbs9/jf+qpkx4Y=; b=qpjgVdyFTDJrE/om1YgN+gdHf5sDswRkItoIQs8InNuEcuYWN4OUXBCo0Y8Wue9TW1uIVRz452rKD1/LJ53gBxgR+Lwi59jrOmN2nf0ujqbrr6gyEZFmkTC0c8EZmlOaIa6FLcX7aD5LmG+H8gROsUsl7gUZMMd8UbUgM3n8Xbw= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:43 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:43 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 12/33] scsi: hp_sw: Have scsi-ml retry scsi_exec_req errors Date: Wed, 14 Jun 2023 02:16:58 -0500 Message-Id: <20230614071719.6372-13-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS0PR17CA0003.namprd17.prod.outlook.com (2603:10b6:8:191::17) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: cc91bee1-a652-4cb5-8084-08db6ca7720f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kAE7gvPpqJffLSyjZ3XQfpbPjVycbXy6H0/Bxolt2yACOQ/BSpsz//d05Cy5m9vaSrJDA/UV3LbY4YcZaul/XEvCmWImIAPU7PHVDj2+6TOiC/6itMamrtEP+MBy1hkAD+/gqWi6dt9PCK4KzLnSw/GYhHguvTtKdqdVqFbf3dkB4VJ/xDNmoKrfv7zT+DRINTUNyF8YnV5PMBi/8/XTd/hleK80eneuoEnYSTwuOnoUc0uGwEhdk9mK3pPiFEHOha3nm5ylGsVVAn4/KzwuGZ7N9K2HCAs5yeTsgaMYfUtbzta+1Lso0bXOlnkXYIN5sQsz3AYMwi5kgtyH6P1uQrCs3jwTqixLJ/uO1iAPNt1acoDt+8UtEub6xcoxNXmU6OxCBiKr9M723GXNA6yrvhAnjSXeTpytzlY19wmE1wiimYea3HMyoD8VP5vmrgVCM1gbcYsRij2vJSiPEi6VIfmmqO0XWzPyAyB2cN89xrf1j3k0m1sCBO4LeXjumcmn84vVE1v6h1sB6Nos2zRU2LKtEENX+jJOozmmQAcW6rb7BLVVVjdwD65xCgike10D X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(83380400001)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LuDRH3KKDWE5i7h4BbjAEVUXyEGyEH0e7u5N3M9OY+cSFqR/StkN1W0f8GR+KRueGSwCYQSvdmbzhEUbfTgr/Wm8D65+dRWNAE1bPpy59v3WsNA5qx8w26mgV5t5Rx/971KzQ2oFO6OVZpCKlm/NCc8Z/2cETgAIfNgWBB2kZp/i8BZ2dPWx8pp5gqPIwDj7v9Ph0a28xIJjDHOGDOHKbpoLRSXY2CAHr404CU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xrU82HhEo2Cr3zYbgRjQv11HQzvWFen2KZatlF1uJKvJ0jN34taZ15yssCB1axSXDxmWu3MXLfL8Q3cBKSuqjZkZr+8w/CcCO6Z6hx3bKEW4KVEzZqo3iTdn1t9qMphMtDS1aV+C/w3NFnKgmTjys3pmlcXl4peGJkegLir2Y3NfirCV+z/Et15ADnNPS1V+mKOhoRBaiJ9I1bu9lWA6QiEMSTssM/yMvovYtz8ulIl3UWrpjzlW3WY5B4eW0T+og0V07eroJUcGzlnB/LkLzErhfbM59H/SMVGsQGzzJth1gkgQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: F04PuBjbtRS5pmjHAdWl+q6mF/MeokmIBHatA09t4wxxydxpmFLBtndI2nJpiUgUrmfbWwiufqkgxJe8tKvjWCibyOV5Ft0v4UxdCwZdPCrW5hGNBekc98whoInvAY65m+PmX9uGAK/x5V5qR3j86CTvUZWPeeY7JfeVWagz3vMjd0h49wK/AVUTuHZH82Y5hIvgzr0LmZKexgRgZ9iBkMx57Q36w1azgWxpSlKBEugMPqABobiSc/ueUiq7A6m9oxfQ81t4m+KrR9OeNbwof/4/ucmzrgp20r/7kChcfPaQX8Xt2IE4sCi+vcB5CE55DAKWTPNItnjlLWMRvc7tIM+50G60lNC+kSjjee/NBnO0cp21hwBIVWt/1210NIzRdFyS93jyJ6SmWwCo21f2aJWZ3kr+gdcXKQPEbNOR6cAaXzxjSKUvXvzQB3qq8Bern5KgI33X0nxGYKoKqhRM1WSLf/p2Z3ouc/2nc6p47Tgcn1nmdLYWob07PpfFc5rTH6GPe2dzx0pz49ZPJP776++gnA96VpkMxy7akmN6FCe2cZOJqt27Rdkq1lwR64UFWq4qwzB10RGYEcu5Y2YMZHx4lsQgnT780s6sUj+52FeuaHopTXT1jYFTOSM7eQO0ohJhx3VNWjJ8eCzyM0f8azisinayZk0s3cOQqmmRADjlVJVISlCnKokg3CHg3KruTBRJ99XxcMG9mIPCrPZnoWLe+Qk/vAkM5COr0F8T4VTbH7+v4CZoSZMJ8Epe8Ff8yJwAHxlbaXYwKE1F8P3gixdegFlxwQHLoRiZWXEUBFdlH4b761hyyNCdXV90mcEe2uYrsSLuJQ7s616jdjCfY0uoxpinStAJG+z7yDgnvCj3IWs1q7NqsOGZ4OSeFUYA X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc91bee1-a652-4cb5-8084-08db6ca7720f X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:43.3249 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ouv9OxUbfXY9/8f/jdvnG8XtE49bgpF+Oaf5UNt3o/DtRzepWk86kAm5g4Kmc3Ek721V5g6rX3ZeVjzmBTM3mKE6W2R4pw8Zdxyn0CWiY8o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: PLcdpIu3RZ1RLV-auNq8QCSO4rshfbf1 X-Proofpoint-GUID: PLcdpIu3RZ1RLV-auNq8QCSO4rshfbf1 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has hp_sw have scsi-ml retry scsi_exec_req errors instead of driving them itself. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/device_handler/scsi_dh_hp_sw.c | 42 +++++++++++++-------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c b/drivers/scsi/device_handler/scsi_dh_hp_sw.c index 785ab2c5391f..63d146f933d7 100644 --- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c +++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c @@ -46,9 +46,6 @@ static int tur_done(struct scsi_device *sdev, struct hp_sw_dh_data *h, int ret = SCSI_DH_IO; switch (sshdr->sense_key) { - case UNIT_ATTENTION: - ret = SCSI_DH_IMM_RETRY; - break; case NOT_READY: if (sshdr->asc == 0x04 && sshdr->ascq == 2) { /* @@ -85,11 +82,21 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) int ret = SCSI_DH_OK, res; blk_opf_t opf = REQ_OP_DRV_IN | REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = SCMD_FAILURE_NO_LIMIT, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = failures, }; -retry: res = scsi_execute_cmd(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT, HP_SW_RETRIES, &exec_args); if (res) { @@ -105,8 +112,6 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) h->path_state = HP_SW_PATH_ACTIVE; ret = SCSI_DH_OK; } - if (ret == SCSI_DH_IMM_RETRY) - goto retry; return ret; } @@ -123,14 +128,28 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h) struct scsi_sense_hdr sshdr; struct scsi_device *sdev = h->sdev; int res, rc = SCSI_DH_OK; - int retry_cnt = HP_SW_RETRIES; blk_opf_t opf = REQ_OP_DRV_IN | REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + struct scsi_failure failures[] = { + { + /* + * LUN not ready - manual intervention required + * + * Switch-over in progress, retry. + */ + .sense = NOT_READY, + .asc = 0x04, + .ascq = 0x03, + .allowed = HP_SW_RETRIES, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = failures, }; -retry: res = scsi_execute_cmd(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT, HP_SW_RETRIES, &exec_args); if (res) { @@ -143,13 +162,6 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h) switch (sshdr.sense_key) { case NOT_READY: if (sshdr.asc == 0x04 && sshdr.ascq == 3) { - /* - * LUN not ready - manual intervention required - * - * Switch-over in progress, retry. - */ - if (--retry_cnt) - goto retry; rc = SCSI_DH_RETRY; break; } From patchwork Wed Jun 14 07:16:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13279620 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76748EB64D9 for ; Wed, 14 Jun 2023 07:22:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243428AbjFNHWM (ORCPT ); Wed, 14 Jun 2023 03:22:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231720AbjFNHV3 (ORCPT ); Wed, 14 Jun 2023 03:21:29 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51D312965 for ; Wed, 14 Jun 2023 00:20:33 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6jrND021335; Wed, 14 Jun 2023 07:17:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=a5C0CYeBLfticU0+IYIu3CyY2cvtbRlGSH4pbzdNGtU=; b=tnsk/O0nDGDwe/4evU0MnJkL/8mWswtOzSDnbku8xjAEEslFIJG/+joT8ruOWheCYc1m ytAWcIYtQX0BaPsYhcg14dnvlxR4PR74mGN+2zum2URVke/HlYc6Mxt/dl6fALMo268M d8LAAd2+lr7G3U9x0ygJZJVL1jVcWECuqlV2I21ey3MHb9Il+w9NMNXDoq46MUnlMEEj Nu0X79YqLB1lPeJB1SIJoADDiTP0GLQ+P6jKIbd30wfkHGNkbD2fLYP5KJx+NZcUy5NC eCyxXDfg/pNebERFQkX881F6n9MM3wRdIpKgLD6qAJREMWJUZOSiS8NASRQxr6gS1vAR Tw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4fy3evqe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:48 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E617xO021715; Wed, 14 Jun 2023 07:17:47 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56caf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NTbfMjEy5EephpUPLq+4u9diCD03LFfumuyksochIEy0IzsOIdJRyoL4PpIwrVvMgfpzfcfXx2Rp9Dp0tTiqZaPuWhnCU6dfP0i6jCFibwXB30j/4/V23bshIxs+z9rfWELT2Qt6v2++70/XbIKlIw1obGv5ftdv0goJKzElNDvAFjkochg/Csek6tUcLJxDv1dRnqwMm1Tn5WxZoD/kyYyHxkOzutfjbAKwTp7ZukvX324lsBw7gN9Vwde36wl500LGIKxZHo+DI8u8U7d5S9W04JDTomUR5WIdlc2lGy7Q7HJjKMikv174xTNFBL610kIOXGsjfv5RjCFrhYcD2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=a5C0CYeBLfticU0+IYIu3CyY2cvtbRlGSH4pbzdNGtU=; b=FSGdUVJFTVcO/YOBzIMdoNjWnoaGg+bdWKJMX5zoA32aF4hptWwuVfcXB1qTqZsFqtgrh7dXpzLiTX555P75McRPQfCbnZ7t39AUnUPrPLPY5XpeAUYpruTDxH6A0Cj4EkiCcTssDF9Nyb2sZubGba/o2mgavHgq9NSFDjPdFvT9LAP/QCDskBghx+Zw6z2J+EBtOxh4aABnZRTyVOtP9AufhMUsxNrcN8Emhbz9m4GHX4KBm9+aDyhCRhiH3t94eyakvKffunuzN/aE1x6C1kYnoJNw9FwfmovEA5yzWXGTGq9XSD/SWIat2r5qhtVqXagBW0VlnVpYxqQjlO8X4Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a5C0CYeBLfticU0+IYIu3CyY2cvtbRlGSH4pbzdNGtU=; b=W4tOkK0VgjQKPZKEs//SpP6fU9jE+Kq76ZUYjTlRgbRTL7G8hccKjVjNfdPy7AJouX9hvLVkL3RiI1tXi7qonZUdUk/e1iKfdT22Kjg1DNn9XIOPRLbV0yojofpcQrTWIX247c/6Hg61txWEISH0H2QxASlgEbRLa+9PjUqatkw= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:45 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:45 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 13/33] scsi: rdac: Fix sshdr use Date: Wed, 14 Jun 2023 02:16:59 -0500 Message-Id: <20230614071719.6372-14-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS0PR17CA0014.namprd17.prod.outlook.com (2603:10b6:8:191::10) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: 1821f5b0-c3a8-4ad7-916a-08db6ca7731a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n8t6mwSaTQNfRu8KewlUg/PXlCpJTEzVkbnRIRngIbrEAaUXm4DkptyYItU+gBi6glTs5nivk1kHTj8v2td9AyplrZTnuNvUzsaE5LC7tKAjdgOtHCINz1aaS7LofEro54RF5Je+m4dN3G7aEd84aM5n9XEZokx2ah+DSfygMMy72a1YIcFS/vn2J3wW0L8P6OebUxLr4+67EBeXVs5CIlcYB14gDr/Qw4YMbcaTKoQQvI/LfvIYi2RFY59hhMHdGAL6zkt+A2ZU4W8ULRPK78GR2CoDec399VfGuEIsvgIDcuyxnxtpolZl1XCaMhodvFSCiLZk1C0zR3FP8uaMrCRGOsT+1WFCmXjkfIwnhAZCaBFMDNZlFoGR+jqS94pAo+e5jBgmGrTK1VgtRw2y6MDh8Sy2lAJVIHTJfx5EKhC7435RbMHfPsIMh3WnD3+TNzKphjteDfb3oR8R7R8vJA6XwxXseThfKkM7XjFmFRGdir7GCHTy6LFFc14JZUph9Gre7Zs80n8X/mL41+ySj1H4l2AW1q10sxKolGM1MDls9nas62FRa2Cy0h6apRK3 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(83380400001)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nHBF2ZyKjk5BZ/Al6GC+3Bipj+y4iqtsHbN7mVbUIf41DKmoSlT+KGPIQwYkgmiaCvS5GMVoR558ZMkBPBEdYN9Posx/gtlOGzo0vH4SShm85yGgMXIOB1pjnGVpQ2nYVkRNvt/uFbpK2kS6RCcjhFj70QVa4Q5hBODmDVlGbRcuOIAm1Se3XwBsv9wQpbBLuHK0OhPsgJsGvHBAz6MnI3Ct5U98N4NPvYsZcw/h8guOUtsFzHF7bgK/2v+YLfFVE4hBMddDOMtbmXmQ+kOQeKejy0VN0IC2C3sZqZjcVdRZJaiWxWka7STq7qb0yNl1oQDIvf4/pGVkhBbOdywHrWj8edG+JzbyiRmAy/78PUH7xEakSqz5Qbgc65wQQPhoaqzH2LIibXkTL2bykVdNRaaZWI3zilIwE0an2ylKCsfNXJjSRbYA5+wQ87H1z4yN0C1Vo8lYvFeGOarWj4T3RfwX6lrjDrWWbkVOlPNuu4c5o7vVnu9D7j/HpSIpdvjmQiBXEMlE4jf1HROcTu38k52urBWJshTNQ7X1TT5j2iHyXvvO6ZTNK0OcyFeH3+FsNkQJPLGz2QnZOFihNSB5+1d5sS75KuPtwUx5CcROWarL92HeaBHnUMVwjnn30xDk8H4WF3kYmz9K0YHX9PABnYiEWVP4YXA4ulgP5DeIy1fSo2r3/R2WZJryFbwpxVwcB5gg+sXutLDWex4qd4znU1lO/V7lo6Vrz3+7LqXYrCE/kXGPwmeszAlN8n8FTQmPOWK6AB7nM4Q8t8QvqzxxzWIT/GXgVz6F32VKu6aKoUcHagw/6lGisk1wDSV7hHr7HNfQHl46E0LYRT0gb9rM6Ms128S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2JrFJQPfwLGWlkZdcCCxjOkRL7tkS8YRYQyJsdWtwdYg4ZpQnHeGEb+T+4DgKhtjXT8e96itscRNWlGtZnKG+HUCIWiIntwqncKfvW27NDRyqjXNjqnuLq78VM+Y4momIvUZ8H7tgk9gMzs1BaZcXBzEvtQAs1RSAbuQ4I5OJfCYiKHKSststouBVxyvTE+aHAhX+d368jOYcx0bqEugqQvYyWj63JcyIRwRVlounKeDLz2lqtSWHcd99+Qf7sMZZdZclQPdzcYPD2R1BKesXiv5VtygIyj9z3yaQmObKYLvyefQTovjWJQ8cJ4uHw4JP+GhX9XhWFndFD90qJD+IUR433V6hNSkiEXnbaolfEL5LbXwcogNe0kiYAFfEwQkKSYvA2N0l9uBQ0JFGCYnUy0pyVObb/zASEHWZ+YR9UBqeX1rWvT5pjpSwC/zFx4swmiybKoS13e+nQdpHmi22ElejBweMNxr7fuOFZ1q8dX4P2vvam3LqhLVA2akbUYcJlKSKNsEAXs3f2U9DL3fT5hDPDMDd3/+xUkSAUCFsBb7nULY0pmBxCHHFYp4lUi26p0p/wZ+DH/zQ4eAkAAw8FIkl1+xadcfKW2hzdnB+D/IZWkbR8Pon/HKfZ1oxGjdJv7H+Pql3m520eogigoo X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1821f5b0-c3a8-4ad7-916a-08db6ca7731a X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:45.0582 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Yj+axT6QOhz2wsO95CCEjMYCJDmHxyJ8sEjoWPlQd6tyN9YLRHlDgQPWOTx19CogNQnEuIs5lleRtRkerBkds5cotjDt+/Ko2ww0Qy+247M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-GUID: 32YbnMk4rlUYreOZYIwwfVf1weobomhZ X-Proofpoint-ORIG-GUID: 32YbnMk4rlUYreOZYIwwfVf1weobomhZ Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0 it will not have set the sshdr, so we can't access it. Signed-off-by: Mike Christie 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 Wed Jun 14 07:17:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13279622 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57D6CEB64DA for ; Wed, 14 Jun 2023 07:22:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243404AbjFNHWV (ORCPT ); Wed, 14 Jun 2023 03:22:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243395AbjFNHVb (ORCPT ); Wed, 14 Jun 2023 03:21:31 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92BD22102 for ; Wed, 14 Jun 2023 00:20:34 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6kNXf015669; Wed, 14 Jun 2023 07:17:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=xwBsut8nJxCe9OU7H1Ote3aksv63jRE0lqFzmAOJN28=; b=XMp1lAePxLhl4dllfukikLoo3Bdq21POKuGVvsepioWqZNCuVyVRgF9zu3DcKbCtM2kA AHWe2ZDgv9OIA3KwoW5dlIEG6as+xZoWyEipX0Hzug5fgZe4yXnrGb/HeJZ0c2nS59Hr scbw3boXXryRwuFM4tSwopOKwzmY5RXDorixbfUAbTfZSClQpx/cBqadvFIGFyMGLXVM PmH+PbXS/oMJC7HTJrZe+100mLr/pSq0rM0MziYnm6du2WPbTPyTmq7f5/UgLQb2/oIm o+OlIPb//mV5rb6jjkfrBCCndSHygI2bECy6GVvOi3E+SiDo28mL1rBJ7LErS6yjaaDM 8g== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4h2aputm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:50 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E5ZBp7008322; Wed, 14 Jun 2023 07:17:49 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2046.outbound.protection.outlook.com [104.47.73.46]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fmbexh2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RQKLfom+srkW4T+lY/dU2goAHx04bs18YkM6gZU9LPiYkBnZFfBxJoq8QIWPOFmZFes/oUeho0maHTIbeAIo8F62oHZ03u+WScq2SwYk5WUw9k0Hw+S0a9kHRJIHjxKlx35Gp1Kxw6iVGmjdqrqy8PZhIwyOL4t2j6Us+5cU3nPO6tjc1ZKpiCMbU3tepxVHLgP3wKC5ZV1NpSkNgqw5oN59+obpj7WgqMUoJTXvuf2zwPfIrDmncHdLRg55i5P8/onqX1LH0Rg/YEdw1Kfvgb3aaMFITvuUScrV98aTUok7mDqG0Hf0ZfF/5pxNV4IIv65q7VW1PxDS9IwUS7vPdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xwBsut8nJxCe9OU7H1Ote3aksv63jRE0lqFzmAOJN28=; b=W6aIATmKDHKIAA59I1Ce4BQlmAIGPdc3JuscsOHdVd7W5KHiX/qNQzKL+4WKnuEk9IBkDXt7b4geKkI4BaLLrLSVZC209nStFt1Y+FF8Yk/3EseSmsYn3eQd/5XUjQLSMu4DldhTjs/1sPbuCAJWDFOzYldXGqiwLPctzOC7q9Px7wt+XydPzbKsHxmqgSevsytIOnLCvnB47+fjhcK2X6nWrV0wPWm9xuzJg4jroakSHqwzyp3IWCHWwxuiWFVmNk36zN3kEzwtf9k77pKvale0wbWYD8BoDA7GqE2itwA+LPCPIGNi94J8YNErQnhRnDUB5DFg2J7Vcu0f9YcHAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xwBsut8nJxCe9OU7H1Ote3aksv63jRE0lqFzmAOJN28=; b=Ntb7/9CShqgi/UP2rfio2VIx01rXsBd6o+SXfa3HpObB8PwDy5v8j/SYUb+j+IxqB97krqtQvWBxT7/TWPBsJSs2SMsgm6Z9sePO0XwoM6rQpyvo9cm1VV+xTTnq1F2zes9F0jowh7k5u7SErm30MCT5AlI0BpfDrVxPaDo/D88= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:46 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:46 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 14/33] scsi: rdac: Have scsi-ml retry send_mode_select errors Date: Wed, 14 Jun 2023 02:17:00 -0500 Message-Id: <20230614071719.6372-15-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0278.namprd03.prod.outlook.com (2603:10b6:5:3ad::13) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: 11871bcb-961b-4351-f0de-08db6ca77433 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kLjjDCGs8jmrq/oDqwJ7T/TPH/H9HAlaNmouosQzGu7kGKMGeVASFrvrm1u+6iMnLbpRIzRNgyO4PlwTDg+hk5E+clfX0k0PSLkfKJ8UUl1LXwjysz4S3gwPgpaxjhHKF5hrcf0h2B6oH+2Fk95kY9giHAFrhV94HNVBmU00NONsnk2MRJ3TC6g30hinOWjw0yLhkS728+RAzZGbbtaDXNZCcspGjKXidWnhz5Nv4KoQkgGin6mJGkxBj5sWvfeSew+e7i4GsJn/KeYHb6fd0G9wV0tEipLaiZIWgfFNILXxIog159/J5ceDFcJr+7/M+PKLISssXCTSTIDzTFo5DEjHogyGR07FhEyIGzQaIvBn+c/hmsy0N8OlkSSy4TK4NEBYHZ6Qa/DeVuKbbtao8MqVcAVMP12BudyN1pA/l0iw9a1UExyrPnzoymvOcgQ8v78EO1bHB7L4AC0wyWr9ndH8v2WiXxUyQMKHfV/2aNzIpoLEVlPG38B1PfTc2RPZYiCHv6729iNnVId9BuBgqbdtVMpmWrhOsPTKz3a5MvtFNLFUlumFknjLUiBkayxM X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(83380400001)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IBMbZJlzq5VM7InBMms4JzstQxAf74Rq5kTpol+fKbJzNWrHdEW7ALgiCnKZ+tJNb1OZwh1M89Okozc/CLP3tWSdH8Wma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5Pb0qZ1i1bZIzt4sZXQHs2c0iER2F5MKSjJUzqzzu3HJMu/vX4pFVSGHr1VHLaW1xeS2ssKoPPJlrpgANydI7qAWXAqUkbrBXlrNYa0RZFk4i5HuPI06vYz8LKyZEd37Hu5b56lPcrJaV4aQvoOX2xzDKmPMCo+mANbfNTXAkQJkJqd34+HFVQFlOj2zz7QeLewlxvsRlnMkeNnvzsquxRTVSv4xYPQPv5v7Quxwj9a6cJ9wPi6wZFpUqo94pnGR8JSdbyif7iw3HAc9mHjFwGCgDwDk/eH7q4M0nYNPq5PTJDMAVfup0HvFqBeDetllgyMLd3kxZfsi4/Zw74i X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11871bcb-961b-4351-f0de-08db6ca77433 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:46.8853 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BF7ZG8XONGwkcFGr5PbwlPoT/RMB1wXxXzBn1W7+5LyHp/rvS7b4svAkeMHPPjwL5k3ePa0Cu7QI8G3ij/kDnMPzGvTqptChvqNtLM9a4vo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 malwarescore=0 mlxscore=0 adultscore=0 bulkscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: 76CQkn6luX-jHBq2NX_9DFUTKBGBNJoR X-Proofpoint-GUID: 76CQkn6luX-jHBq2NX_9DFUTKBGBNJoR Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has rdac have scsi-ml retry errors instead of driving them itself. There is one behavior change with this patch. We used to get a total of 5 retries for errors mode_select_handle_sense returned SCSI_DH_RETRY. We now get 5 retries for each failure. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/device_handler/scsi_dh_rdac.c | 92 ++++++++++++---------- 1 file changed, 51 insertions(+), 41 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index cdefaa9f614e..9811f9788432 100644 --- a/drivers/scsi/device_handler/scsi_dh_rdac.c +++ b/drivers/scsi/device_handler/scsi_dh_rdac.c @@ -485,43 +485,17 @@ static int set_mode_select(struct scsi_device *sdev, struct rdac_dh_data *h) static int mode_select_handle_sense(struct scsi_device *sdev, struct scsi_sense_hdr *sense_hdr) { - int err = SCSI_DH_IO; struct rdac_dh_data *h = sdev->handler_data; if (!scsi_sense_valid(sense_hdr)) - goto done; - - switch (sense_hdr->sense_key) { - case NO_SENSE: - case ABORTED_COMMAND: - case UNIT_ATTENTION: - err = SCSI_DH_RETRY; - break; - case NOT_READY: - if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x01) - /* LUN Not Ready and is in the Process of Becoming - * Ready - */ - err = SCSI_DH_RETRY; - break; - case ILLEGAL_REQUEST: - if (sense_hdr->asc == 0x91 && sense_hdr->ascq == 0x36) - /* - * Command Lock contention - */ - err = SCSI_DH_IMM_RETRY; - break; - default: - break; - } + return SCSI_DH_IO; RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " "MODE_SELECT returned with sense %02x/%02x/%02x", (char *) h->ctlr->array_name, h->ctlr->index, sense_hdr->sense_key, sense_hdr->asc, sense_hdr->ascq); -done: - return err; + return SCSI_DH_IO; } static void send_mode_select(struct work_struct *work) @@ -530,7 +504,7 @@ static void send_mode_select(struct work_struct *work) container_of(work, struct rdac_controller, ms_work); struct scsi_device *sdev = ctlr->ms_sdev; struct rdac_dh_data *h = sdev->handler_data; - int err = SCSI_DH_OK, retry_cnt = RDAC_RETRY_COUNT; + int err = SCSI_DH_OK; struct rdac_queue_data *tmp, *qdata; LIST_HEAD(list); unsigned char cdb[MAX_COMMAND_SIZE]; @@ -538,8 +512,52 @@ static void send_mode_select(struct work_struct *work) unsigned int data_size; blk_opf_t opf = REQ_OP_DRV_OUT | REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER; + struct scsi_failure failures[] = { + { + .sense = NO_SENSE, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = RDAC_RETRY_COUNT, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = ABORTED_COMMAND, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = RDAC_RETRY_COUNT, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = RDAC_RETRY_COUNT, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + /* + * LUN Not Ready and is in the Process of Becoming + * Ready + */ + .sense = NOT_READY, + .asc = 0x04, + .ascq = 0x01, + .allowed = RDAC_RETRY_COUNT, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + /* Command Lock contention */ + .sense = ILLEGAL_REQUEST, + .asc = 0x91, + .ascq = 0x36, + .allowed = SCMD_FAILURE_NO_LIMIT, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = failures, }; int rc; @@ -549,27 +567,19 @@ static void send_mode_select(struct work_struct *work) ctlr->ms_sdev = NULL; spin_unlock(&ctlr->ms_lock); - retry: memset(cdb, 0, sizeof(cdb)); data_size = rdac_failover_get(ctlr, &list, cdb); - RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " - "%s MODE_SELECT command", - (char *) h->ctlr->array_name, h->ctlr->index, - (retry_cnt == RDAC_RETRY_COUNT) ? "queueing" : "retrying"); + RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, MODE_SELECT command", + (char *)h->ctlr->array_name, h->ctlr->index); rc = scsi_execute_cmd(sdev, cdb, opf, &h->ctlr->mode_select, data_size, RDAC_TIMEOUT * HZ, RDAC_RETRIES, &exec_args); - if (rc < 0) { + if (rc < 0) err = SCSI_DH_IO; - } else if (rc > 0) { + else if (rc > 0) err = mode_select_handle_sense(sdev, &sshdr); - if (err == SCSI_DH_RETRY && retry_cnt--) - goto retry; - if (err == SCSI_DH_IMM_RETRY) - goto retry; - } if (err == SCSI_DH_OK) { h->state = RDAC_STATE_ACTIVE; From patchwork Wed Jun 14 07:17: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: 13279621 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 C735FEB64DB for ; Wed, 14 Jun 2023 07:22:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234403AbjFNHWO (ORCPT ); Wed, 14 Jun 2023 03:22:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234394AbjFNHVa (ORCPT ); Wed, 14 Jun 2023 03:21:30 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7C6F2101 for ; Wed, 14 Jun 2023 00:20:33 -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 35E6k02v012014; Wed, 14 Jun 2023 07:17:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=pQ5x4e5F0/nfYtGXX5LiHsm1alVkiIUxO6MyqQE11gA=; b=dceZebATFM+oyGeYwjxmIJfdym/LvTZWmGHe9/8HQtyzR4/K1SY7VE4BXAbCvkqVboqQ +PiY4IJyjkuCFvjq8zdKfZhUt3TVpQ8ExIPD2TrdkN6OQ258BOJ7NIaBBtt8v8x3W2/i vjNqUb4N9F96AXkWa/UOZyljzdpyekgviPQUz0ofeQpwG/4tankHZCytKE24vYa4uG4u q2TlT11ctdKCIv/EJ8T77dPlCzuIJ92Oni4QmMkZyFQXVnbG6MpRnJo51aQl9FMRNH0l AhugPyb3i4vR02JjJG7anUxun7e/x1J7Q2QRA7LeUeW4v5L121SYKivc9xseK2RX3lyP 9Q== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4fs1xxwc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:51 +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 35E5NeEW017722; Wed, 14 Jun 2023 07:17:50 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2041.outbound.protection.outlook.com [104.47.73.41]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm4wsc9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eznJWfq4hxrUfGWY8wvTrmhZX8+7XoQX3NRwWvwMCvktlWDQWPqcQ8ze5l3n4otBp9bVyQxImxHfcInFSA9giVZHMlffh2iDj/sw2FBVdBK2O021Gkoe088DU4Spb/9A28fKnfIkUGf9aO0Eaz9V1LM/vmpfsbGmDCN7orSolIaurD3TCJQDP2tz0Oqs6gf5vMr9cnuk8jgzaV/+KGhp/zx2n0LTGrYRtvzbCwiVquRHiU0+yNVQvrOad7PJWIuXUr5xlVxk2wxBn8LBIHM5abYnqWLruT++h3T6cOOrjz3dGuv/k8X6Xx9SGKY6s0ZvVANiDG4C+xBLklUhb1n15Q== 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=pQ5x4e5F0/nfYtGXX5LiHsm1alVkiIUxO6MyqQE11gA=; b=DzdWb+4TKQcxi9jhMsXF/6xCFQ/e+mc/WcokaxdmPhNVFMK/olQeYxZkHMkpIBWnHg4wjRrBfcCWHP2cW6fYwFC3E1DQuiKTyPa1zjnYq50VHlNXxZGrqM9lSDvNBGfkkUQikMypcgDP5p2QGHlgJ5p79fGC8DSksFW37Wc3PsSt75/myAQzsMbmnK97eTJesUp17QPqdi7TdcaE+z1xe3Fb/F0O1kPh3G+HyobzkA5Uw302TbTXPmtuORCEbLC7Nmb3t7W1J+8EWsE//GL2YjxsemewB9EezSCO3vlW0IBUDQlh4vM2qYHHLc1Qzr/OXVwQRsTJDF5++1mBbDEbhg== 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=pQ5x4e5F0/nfYtGXX5LiHsm1alVkiIUxO6MyqQE11gA=; b=YRyFBynG/3zLbU1k67QUTVdRfbTCtD1OOmgr68Kud5hkBC0k+dG31ekokg6SmazWNMLT9TPz3hXY6yRJOWTXrsvj/7/yE4K23/vHj5AQDYaV+Cs81wLYwRD9JJevZ1P4PMlAKVlVCKfgtE2e6JOTjATyusFti1PUBbdP1bukoro= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:48 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:48 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 15/33] scsi: spi: Fix sshdr use Date: Wed, 14 Jun 2023 02:17:01 -0500 Message-Id: <20230614071719.6372-16-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7P222CA0022.NAMP222.PROD.OUTLOOK.COM (2603:10b6:8:2e::25) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: 7b74a2e3-1d15-4b67-2903-08db6ca77546 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bt6veXCO/1e/hRHmN7eW3rRdm/IynwcbA3HlqMDhtZIhk01D67FoID6Bf0HqrX0WogKG4KgZiZ/O+8OQF/BA435lMu6NyU7p9vhTdlIEAPHBfIb2BXOnswXBVJrJQ0toEah3IvVl1waQv+2EisPDJ7lkSzULAqL2eLI0HKFrSGsfk90S6xSN6kNAWzi2BhgwG0xgpeVdZqgiCKcgvG9OSdLbOKNX+v6uh/MCK78+sxJ+6TdAW3fRpCaVmZJcEAZfo68tOt8gp8oxgBGutK/yD41fmBBEu02Pxe3iGLnQ5FqYBVc88TF5Wr8fVmEu9THoxEZIKRl6ff5wEKHU0+VtgDKrE7/O99LS9lJ2X14GUYx8MW1rZHOjG4wVdYEAlONHHDVgVV6ljl+H/xz6Gby6LdjQXC8c6GQXdtIWRum8bkkytT3CtuW1i2awGhdbQDyQrdBOU9QlrFVEd5yMZmA+jkbdaGRh/l4Qobfaei0RVsivx52or/ZGQs4KozuGf4quzDS53KWn90WvooFDO75l7le68D28Qtp9cX3zGPOZhrOHgC9JNv6Of2Ee1lkpgTVV X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(83380400001)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: a+0mCJAV80dDgIo77VB79fRHFDCVhEbLpzZ2mFTBHBcRBWMHrKVE5Ov+xwmmFfhawCqN/7wMQ3ug7sfZW7wdrTP3R3f9u95x+uVJQNqCUBGeLGDlXRDh7b5hscR+jEoIlRc8teHz28GvNfZQbGe5iAVRFfoyMicyO6zVTw1H3FjKXs8tpkNQJt7DS82RwrwMwhXaYIIIgD3/FI9mzcEY0mUuMsEJrtQZfzBhdmrax/eKyZo5MWbQMjUeA/N0z2aJ6bwENgZQwff6rxmFx60p+7kk3M6rBjacik/hmIbD21JqzjVwDwss/mFkn1csA4dHdGKLoIFj5MWQD6lGI09vHhwAny7MYSurqDgEuvxDezgqL50fvX/Xza+vVRW/kPEiCJ/zfuKRRncrO8nlnLSa3OVkbEmqHTfilTGVQBwoH6BcASbvY01amwDat1784bqr5JoyMABKxTyyxpTb4KF1a33PWB23oiz0216QNI2d6Egos9DXpqIL8y/42BBfcVW343uPXbqB/uvKKwr/G8avwgznD50Kf3XEg4nSOhHJ2AVL/pziPRTlxpz6jHeu/pJo7q2MLHMUJhD49htuBv+2FaKR53xCV7Bi/rWbYLv5NCsJ29iZrgez+L8GLJj5bH2EvvWw7r+Cwx/Rg8ZbvgPtU2bpfGKE24mB+pb5Phe2r8T+gaF8oIvZ9/B5Ugzop8Oqx4UNedwdmkT+GHAxdyF2dzr7BUcd1L7fS+nalmZY2g4D7Fk0WouogzJWOftvZq1JSbYw/lqNB1J4PU0NJ76gFJuoQWKUiBdYj1vDNUa2GF5qVsw/darY/4qSdcE45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kr12OfSM1N/pL/LJvmGJicxpfrmoAfQZu+3R2W2iyq3z7Jj9M6zitGESjk2cIfwCqGtbDR1UeOuHcCE+E8ThK53ZRy6f7OHCiwC+iXBgOOs1ndGBdjvdrNwuK6oqxfuIEg0zO8eiqQ6LJteDgUI3mNkt0QbdBQNyAuIzj982wOB4kzkg/cCiv++1uUbX+wt5QMTEfbb1v57KlljSUXTaLosoIHt+RjBpiMEZeB39nSB/TWtDxa8PISSDcWX1ae4ofsCcTquqqSjH+WW/9CZi7t8RUA0tEDmWPEBFNFF/uY1H54X7p2FXrCpxzWopWhL9kQmKA27N/QyQdIPAN4BY83fYuVX13icY/SicQOnUS/j4SJ5ie3cMgxzHE9vKzSaJ9baBbSeZHYSe/Fx2/WnqiGxDJT3wcHBNHMntubGJyny2l/VoQhzbzlA8U1oeihhUPjXiSS4domVjV9bySPK6IZpfhTqkrdkyz5mJaYWkctS6twjYofCwYUie1wqSBlvNE5HSL92j5QBzKQEj5j4qYAzV1E4y/Gu5xTFoCdVsqEovGxdZZmTZudOd9L3klfrY2Qc9AMlJhakPny25qk3YRIoORzKgNXxK65zy8p1V/Ky3R9APGIhjnKX6MjUorbPztqDm8h/TcfhCcXCnAihbOiGY3najmhtFqEq5QyNZHSA X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7b74a2e3-1d15-4b67-2903-08db6ca77546 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:48.7085 (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: YkgCEoG3T/3Dl/3RW1xvBz5l3Hqa8hTpOPe0EZaVG/AVMYdRT/ahUWQ25oR4s60TtyQxBSMLgk66jbKvIAVoEcoSxlAJduMzUN7i+M5hbcA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-GUID: lD40UBDaeGrEopfBPwtoDZjv-Zda43yl X-Proofpoint-ORIG-GUID: lD40UBDaeGrEopfBPwtoDZjv-Zda43yl Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0 it will not have set the sshdr, so we can't access it. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/scsi_transport_spi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index 2442d4d2e3f3..2100c3adb456 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -126,7 +126,7 @@ static int spi_execute(struct scsi_device *sdev, const void *cmd, */ result = scsi_execute_cmd(sdev, cmd, opf, buffer, bufflen, DV_TIMEOUT, 1, &exec_args); - if (result < 0 || !scsi_sense_valid(sshdr) || + if (result <= 0 || !scsi_sense_valid(sshdr) || sshdr->sense_key != UNIT_ATTENTION) break; } @@ -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 Wed Jun 14 07:17: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: 13279623 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 C977FEB64D9 for ; Wed, 14 Jun 2023 07:22:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243017AbjFNHWW (ORCPT ); Wed, 14 Jun 2023 03:22:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243403AbjFNHVb (ORCPT ); Wed, 14 Jun 2023 03:21:31 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5FC6296C for ; Wed, 14 Jun 2023 00:20:34 -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 35E6jtqP025337; Wed, 14 Jun 2023 07:17: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=HjHtE3y4vchkhka5T8ZdL7UBs6JBayCce+w7/TDIYS4=; b=cnLXWZbT17eS4mrssi50Xrp275xJmnHRim604ChhivrfCABZyGZkcgiHxAva3JKAl371 a1rh7oTB2GUWlyDZXLQfQOeLLQx5fm+cxxDXCd7+IhwPhy93BDVB7DgRVDMCdcU17EyK 3YGkBCmneZQHxSmtM+D+gLjaGFnL9+bSITx6aIvmYR2pFqBTKFUqYvZFzBj81lhKH2dv zGt9kHNRGYKBKARQabEIFaDNDBvOlETsnKIRUKqg6lm5WT1uNFCbFDasTSjJBdwljc9e oZRdmqtSR5quYH5JvfgcpYLPIrVsYmlJCAJwRWU0jlBYZmpPUtFit0sbeBNApuoRrndp 9Q== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4h7d6vpr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:52 +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 35E6QHLu016326; Wed, 14 Jun 2023 07:17:52 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2043.outbound.protection.outlook.com [104.47.73.43]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56pmv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CE/wlPe3VmfRrZMMJMdZgnI9gKw5H9YtzCk0fGkwxV3DHz4KHvT/091soui8EvAD5EJSF2WwNcSJhwoTdy08GdFc/Ugw6etKcfzKHw0VaurLYLxDAn7688gPBPFnvhaZ6GnCNALMQ1qhhdR0Y7aM8D1dWzEvr4OWISVWhZry2gjYftEa1li61Tc+oVr2YB+Q82gwMkI1sE/hWqGC1uAiXBCiLt1WxdPABLyoqdvCfrJy5pUuCD9BcBmdtNpovguqFZR+tj48y070eJEMz+b8LOwYPMPq6RXwm4W31UOXISWI6lyEWG4TinG55n+/prG2w9ZEA6N67XP/h+ZRp3ohjg== 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=HjHtE3y4vchkhka5T8ZdL7UBs6JBayCce+w7/TDIYS4=; b=Dq/xamZRh1JBMY/Ere3u6rA2nURr7N9Dy0rXahYMwyUrV8O/oVUtga/YYMR4IBL2AxJ5eXgt3os0mgubP21U0zO4Z8bEvc1CoUy9WVG3eMcoU8ra+yKFdbFx3SJmAN836qOLmcKxB4yF3x49sqrNMH+PG/4xKksUodbnGPguu1l4fYROBxYvcbOgZNkwj1P/OTyDm0IJ9eQ3hTLFZhlB0C8fGO4jfcTzYR7DFLqFCNmxqRYktbx5M6I/uUqe/pCE3KbEu8Ih+rS3scUb56kyXti7fIl+WHqrmXpCnLsn4szdkfupjS4s+2HuGzd1EiRBto4b1+JaFmsFsTWk8uSVRQ== 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=HjHtE3y4vchkhka5T8ZdL7UBs6JBayCce+w7/TDIYS4=; b=fvW+bKf83GRwTDTjV54q71lu/xUDXmJVY6LoZYiT8I1gkPV0Uat+9nSBnWF3c493uFxuzxxtnMmNsmh5rm1TraeTEUh/pInSs2PYYpCtURYUxanm6CJWdjQ6W5cDVGjfVWu0BpXwH/vvw6jPJ0cqxLlTKaDDw6fuV0lM+9yKGcM= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:50 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:50 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 16/33] scsi: spi: Have scsi-ml retry spi_execute errors Date: Wed, 14 Jun 2023 02:17:02 -0500 Message-Id: <20230614071719.6372-17-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7P222CA0022.NAMP222.PROD.OUTLOOK.COM (2603:10b6:8:2e::25) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: 231a909c-dd22-4230-b0da-08db6ca77609 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FGjF3hNYN/P1yf1t/ri30xKfE4XhrIx3PoDBwy0a9PstdwAdZPXK/NrfVGfmJ9V/8682hBB6sCjMHJvyucUfkwKxLqnRCxxNVH/FZ2itP6qAsMxIE0lgQOjLxpcTGBjXjwKu06B+5dGaSHwxnqWi9KZvHkVwb6QEJfELTsk4eR4bkFBSUpBeWPZobnNFP0FCA+JORHDOb11UclUj8vbc5pWW8lHJRQ+g1Fj1o7TCjG0HpD1MtJkHZ1lpOlFRjDdyhh5df8lEhkoDSSz7az6vLdWBetrMS6xyxR2hJmQeJHMlChFC0mLhoAQEwg/BOGhUlTeMa7SWQAHtKh60IdBHHWB6BBzX9se7sh6s/heqaB/FG7TS+5UCqQ50IToXULOO5UZn9EDTorpw4R9ntGEGrXtZr3P61X3+KyYIp/iTWKbAusp1FkIvJ5lWPv80o1AmAHgwHu/9r2F+MEsIFF6UMnrs4LErxWNiNCMwGvmBvYvw0lzFh4l2Xco6RZc4UdqAHEZjVT8YEnbKqhU7QvnSL/o29R0JIMkPsTYZvmQNkU+rmV8y07LaZ3N5+ynq3fWI X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(83380400001)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uVeD8kN3CHcoISFng6ATLfj0RPF2v8xWlhWSndCxG1CtLntO8FOA6jYOLJ8VKAvQYWiaocsr8A+sHZ7Lb+YPJ/LQw9wANGIy6la9yNWk5drrDl/ayA2j0uwQo60yA8cywILzxPhdBtz5vvFSh79UBWDdIX5q224M1EgF11Edci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2udzm79iqBpRP3NNW3TP7mcJ0sEvvPA3jMGyv5OJFP7JZxtOYafziJ3GaMOeMj9M33E95mi6/x9kHKLa0ElNKloGmubZZNmJNTcWHK4hyT6eWqTWgBgLts7JEXm/9XefK7E+XSJi3e6rQhpLOkklCfh99kqWsGadG408XhVNdphApP2giZRgICv35BBoZK06+L6mf2LmKecSAj/SfZuWhVup0Yt4J8Bl6DhO914o382LHUttIQ9RCLwXdbcGeXapp0UYZQvNlSsQcA6NqxQYMRb1EzPEomm/Nj/ZACuYreH/XE+OBRu9e8t87mUqirELJbjiOZ8QBnkjcOyub9AmZ+6iyypiCwTn64cvzIY7vC7SLOURH/w== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: tMKeEUYwDiYbjw+M6BzFdTFIJE26gWgMe1XBVcpYrNJDvY75ZghDyCVk6WjIsFDQvQbSSBXaWinUhIpMWWrgtegBZKGlY8N5BrSZGNCAaVbSzPdojzbZLf+P+8xf94TQTsdS1SOH0ggEWYceF4tc+NubHiwc38oRW/vpcjkdcAjl6OolAEJnt7hUey+boAp3gfKtKuQo0OhofV3N5MRMDe5C9JLSgBpzn7bHrHwupRV4/pxKpDsU6+hh5K4/b7Rdjo6ZL8cYr7XQqFf/LjcFqxVgD2Hy9t5yECo68wjY3rO1HiRTozqAguvrTqCliWC2SBcR7sN+01eJcNXv/+XX7IPwS+TzJApCgiGgAKI995i6dvBQva2qdwR9HtpCkVVLZOU+cAfrgxDakBTdJYOih0I4ldP/jd/sgLxp/fLwL+WzgTQ7seFTYypdyINq1ozuWXY0vigpYt9QB72HZPoHXmuBcMWBQRi4zjB96bkG0rF4TpBD9YtuaAe4AI+RUUNFEnBYk8sJ/PDsh7aLtf/m0S7m/llZjh+rR6uCQcSdOWuykTRIytvBC5zhxPwdgtCr/V7pD+ClwnSOYEOM5Yid2dEx3XvnfEX3HIxJGo8S95C3vgULHLauGgAA6cTwkv5gch9eRYdPYTSyz2o5qrNvcaC5lSTEzC8sVknA31nerlw8wbsx09b5nV/I7NHGNGG4eDjJJJ7QPwLJYO/qgckOVONc6JR8wyrMcxA6kbedpz403XLvxLYOFhsQ0Zy0INkr3tsSsgmVclWzY3PeZht2af8HCbnN8V6cEmb9npP2wL/0uQo6plsnfhtuVYgUqostKc+TQ57WTgSwpTwCElkFrldO1qP/rI3WlE9zWXvlPiZx1Ga/jfSMy3Cj0QEv1aFO X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 231a909c-dd22-4230-b0da-08db6ca77609 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:49.9956 (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: OkgpQQmBWNammvUaTCoYReGuycv4LV9pBHN7ok/UQ5jijUrOsWvidvo85YyLtl+PvJiu5A8AtlJrGfEwxUsaRTJh/tdsOW9Iuqd8lFV4ixY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 mlxscore=0 spamscore=0 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: 8ujJYqOSn35NOk_gmt9XeDHe7DBzFl9Q X-Proofpoint-GUID: 8ujJYqOSn35NOk_gmt9XeDHe7DBzFl9Q 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 2100c3adb456..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 Wed Jun 14 07:17: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: 13279629 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 8EF14EB64D9 for ; Wed, 14 Jun 2023 07:22:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243316AbjFNHWl (ORCPT ); Wed, 14 Jun 2023 03:22:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243322AbjFNHVf (ORCPT ); Wed, 14 Jun 2023 03:21:35 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 173082972 for ; Wed, 14 Jun 2023 00:20:42 -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 35E6kCOE026738; Wed, 14 Jun 2023 07:17: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=OGqtYj0pWb8SJuBXnMNMM+yuNru++g3o4t4beGdcyNQ=; b=XhYvannnxsUsUokgP+v1Yg75EsDIHE3+Hu8bWpX/7oQXmgByElqeD8MnJwjYT1yVvf6g bUrz9B0KGf0G6I0y5K7mWyrwSfIbukXxnqwCqAqiLSB56yYyKOt4Yg7OmE+ztZqovxWN qL9eQnWxPicIzFAISxbh0ROmRRK2yJ2DVpVbC0eyMD1b21mrRvAFa8iQiTQWtR/+iZyX MnqBlu1vF7H0lwTMtaQOln7NnJ2/MRez+uLcpH+7K5MvG2aAZw7cKDjA6CdoMe5baXou LXOgAmB4yRtYxF+3yXEnYrbGJdqoPFGgsG1fA/a8hDBZMtXIz8gc8F9hdi7Nh8gKV+RK jw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4g3bpyu6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:54 +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 35E6rjNs014164; Wed, 14 Jun 2023 07:17:54 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2041.outbound.protection.outlook.com [104.47.73.41]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm4x1dc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iHJ42zqfgIHBIaBwUHuqAf0QhndJAzJSGOAijPpWpyEEc8lGB9yPElNy4sHx2XY00zILxbOlUs6OLZ0iDv1uGw15FxmmjI7nmsgkeTWk2GWnOZqWg/MykCRM696iuCnihXhdCTIqu0egVUlCCAA/bQnqHSZmqbtq5BOwzTjMW83tzZAHf+kagqijLmotVA6seQO6cqGVEMVAtHC6UH4cmgDivANXi+VAUpjhRLw25LMJWbDfudkFwempi/ThGcgwopLmPYYh6XIx75vP/1mjWBqHJx03iV6C/SUC7KbRxgflTKdyggZZL+RZInIXqpavcNaBgLKfy2SvUBH9VY5FcA== 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=OGqtYj0pWb8SJuBXnMNMM+yuNru++g3o4t4beGdcyNQ=; b=ZWcPhFDG+2APV843v+VdwZRdUdBsgfzygVtN1OxErjYCaBNaSgGlYshxBCh5J0J+09q5y5tQ/fuLIXLE4LnwupppoYDSw/9i80a4xqGd4gRZNzoIh9xisTpmOs6/CJJPBMSbcRUz+DeFlOSYinCWr2XcS7z6dZ8of7JCCMvRdnf9b2Nn+yELfStbgGE04GrZScpVw2t/ve2tlg2q9SHmpmpC0kEf6KRVjvDWk4Ca+WCt3NlEVPcwkSZUD44JEBAtIJJfjpM3UAl+NxfZvMLT9dBgaVzAsTwyAMSgAabLJ4eSq/jnCJh8VSbWQ4D+9ZTptGKtcr4IT03EgCPyG9E+sA== 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=OGqtYj0pWb8SJuBXnMNMM+yuNru++g3o4t4beGdcyNQ=; b=PhJPlrKn9CdypMRs6bOcsAyPjitZS4j1zigI+PF3YuQxfv887H8sARFa2uhDHyR9dYaiuEU6v5lCnmNkv7SBz6M5aWzW/W270ZpvUy/8Cjq4LQqUooB99yYvOlXYIVLF5U9FNK0sL3d44yfMv9y7+Zb1ixXUK6fD9qvdJA2roMY= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by SN7PR10MB7030.namprd10.prod.outlook.com (2603:10b6:806:349::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:51 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:51 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 17/33] scsi: sd: Fix sshdr use in sd_sync_cache Date: Wed, 14 Jun 2023 02:17:03 -0500 Message-Id: <20230614071719.6372-18-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7P222CA0030.NAMP222.PROD.OUTLOOK.COM (2603:10b6:8:2e::10) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|SN7PR10MB7030:EE_ X-MS-Office365-Filtering-Correlation-Id: fd337c6f-a678-43c0-240f-08db6ca77717 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jwCdgAzA0AqDNhyTKQLCdqZcFO8FmmQTTztr0vQ2Gul5ztoRQadzVDjHdiIqO7VdgVcCl0AhkUaHp4cWrkB7QmkD28P5WyndFB0FlIgfAqn+5ve+nGEOniHnFxUuWpBewpG2jn4gj37VNHSRFbdjChh14qG0rezxUclz4TZIA6s1gVS6IMxUOBDU1MzwHMhjGtcYgnYX1YwhJuZyUVwcXZb9J1RQRChcbhZlL63lhsWtMXbxaVP8zYlLCFtJYvwpV+wArmGFccnUTy38hXyEWgDyTseR5ZXN+Plb+W7zq9VHuBpub0NYqOv7QDKd4D9uWuhX/nChyGPNGkGDKgNS0a4Qq0sRMgyrBsOoi76zB8DW1GCePBBWXIbx2LEu/6XzX7ZlN2IVns9TRu7GaCH66CN/WurMZwn2cDmW+EvHiBc3nFoJIx/LH+7/D/LfM2jXKbPjbA52sH/HLzaumn1B22xtpcV7r1d1BKD39Rqq2kEkW93sr3TELA1a+e1q6A6RogI6j+Lk2FE461LurG04VMZVJGxGxMZEMcUpL7atKn6L+e1IpANphzdAZ/Hnsz1D X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(136003)(39860400002)(366004)(376002)(396003)(346002)(451199021)(66946007)(66476007)(66556008)(478600001)(5660300002)(8936002)(6666004)(4326008)(8676002)(36756003)(41300700001)(6486002)(316002)(38100700002)(107886003)(26005)(186003)(6512007)(1076003)(6506007)(2616005)(2906002)(83380400001)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FyRPhVHdK+0jE2wn7FAAckysglG83KAGlyykxJabJrADJdYfAVGgPLoQMUprdIcY2Qw4BXlcoNmophKAZENKILnyT8iClThbbKhjgkkTs8hWPPPdkqzxCGbdekihdGAwDa30RVplEeaapFeMZFs+q/WtQFnq4D/ON63MHxm0C5167w0VP+fB40ItSsqDjtVNV98RPrvWpImnu25/Owc+le+SAI55LxYUoi2Ga/arP9cqTwTB/wZSg3NCrdjMXhAJ1T2bi1RFt0mjFSvA50oErw6JYR3TrquRz5fCtZ8d9EVSeV8832tM17GRkCAW/dQwPFIbMkW7Lm0CLEOwch+2gZptWQ0tdsTmMH4AArO3g3t7d6XDjKQKCoidQ0e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yBv+Htp8cGBOLeScCWJkwWDTqqJg9L/WplKFXzbhQ59WVpncG2bIo1MeWfzdGM/ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd337c6f-a678-43c0-240f-08db6ca77717 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:51.7367 (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: DrOEet1ukyblExe3LZox53MIgGcSkPt9PKyWXD3YMM8SMcU6Y3cgCaQACkBAgun46J5gVjnY1tY8k1D0jXWbXHPlGpGTgwaEA69rvOsRrPw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB7030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 mlxscore=0 adultscore=0 spamscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: vmt4zxBFWy7BfhZTq5u21crurZK5vGRI X-Proofpoint-GUID: vmt4zxBFWy7BfhZTq5u21crurZK5vGRI Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0 it will not have set the sshdr, so callers of sd_sync_cache passing in a sshdr cannot access it at that time. The problem is sd_suspend_common doesn't know what scsi_execute_cmd returned due to sd_sync_cache converting errors to -EXYZ errors. The only error it cares about is ILLEGAL_REQUEST so this has sd_sync_cache convert that to a -EOPNOTSUPP which it can then check for. 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 Wed Jun 14 07:17:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13279624 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F046EB64DA for ; Wed, 14 Jun 2023 07:22:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243403AbjFNHWY (ORCPT ); Wed, 14 Jun 2023 03:22:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242938AbjFNHVc (ORCPT ); Wed, 14 Jun 2023 03:21:32 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36E8F2106 for ; Wed, 14 Jun 2023 00:20:38 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6jvRo021369; Wed, 14 Jun 2023 07:17:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=N4iNcKsJQ4wXczqmN7bmTl8ctNuRtMBaznVs/liy3b4=; b=aHW4wuIbIlJcj4ooGOSHnDCFgBxovqQUnG70TdYns3gBhtdKLgGiD/ObeUoC2qP/5g+D 9WNc3/y6tblfDlqU0EgQkDg4reaD9hYAu36sE7wXKzJ8NNa1gp3Q4DdNTvUW9fRaQ7VJ h8UrFpo+vpls7Ayr3Tklg54DtRDjUQVenDs7vDaUuaXX0TGbjXtCXB1sY7+0x/PkLPZJ wyvFE/2tnmWkpnleVsNjpD8DKaAdeiuwhLQM8VQmytXbmJ4HeBlaPNWhDHPg0pi5nGOO 9dMC9nFKOtEmLZ2mf0pZvqz2Ei4A6Sj81QBS8KbDQ1bj8wtJd1Ass8jClkboh6XsbRRh OQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4fy3evqt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:56 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E5pJOm009118; Wed, 14 Jun 2023 07:17:55 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2040.outbound.protection.outlook.com [104.47.56.40]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm5esjh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ccjg1ozGMYYwUqp/j7CxmkvK+KxtfbUg9jtzJm/m16/v/ahNyyVAK4+9RRnHjypfgPXB9w7C9wEE3EAHRGtHlJn41WzUn6MJuZN28oSjoGc5nAw9eUzOD5RS4MUcWQKqt3y8I2y7rpgWb/3IIYseA9EkmcmLNkMVExjt74pRhY8TtSrS3euds6SEYyP5HB3+ENJmc9/Iu3dJvh9av1bWe9py0j68x3Ju8Oz10dh6NEY3fZ5cxhVKgnKVN+yjSPeHQvotrGyCIeq1iksuPciZqP1oiT/gKlXt2zmI5IdsKFKP0Nld/0Kq7onm4xeD4lTALKQ7iwySDk78FrHj/tCNIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=N4iNcKsJQ4wXczqmN7bmTl8ctNuRtMBaznVs/liy3b4=; b=e60sy8y/It6lFj2H61bOZ6Ke74U7b3bZRFIPbcNUohlhV7pN1TqMw445q/yg7DnwP1PW2jxufcSaQ4N+pWb4CF7x8cMaPdEnMI/F3y2Q7aWNjEyDM0X2BBpgS71UlcQVu+xaSSXatOAb01+YOn0pE5xuPw5Z+mJTGaj6LQVk66k2SNmkf4JbrJyJDOBgVo6EcoUBhXzkg0WPsZnLNwI5XivsoCkwCOBVa7ETw5m4nT/f6AIE2UjpqdUnJt7ZDPGnpKh7fdh0482ifnLp+q8sealrMLuAkHjmheG+K/Q2a2LMRvFSfJD//wBvXeb1tP9130CYxQNJobIVX5ju0LBokQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N4iNcKsJQ4wXczqmN7bmTl8ctNuRtMBaznVs/liy3b4=; b=kHJ0FNf4rtXsGOQyja8dEgiGcsaeG6A0dne6mJvTfDFeINuh2ja5n2wbSo2kJW3clnxd6EMphr/kKR/F6QAL6wQoeGh7dvF5TFvBVZ6kaCSbfZX/fXgsdeL6tn3L7JtnXI9EEGxBMozgzt7TkrnaAGd0d8BzWGWnsxjL3F6LqSg= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:53 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:53 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 18/33] scsi: sd: Have scsi-ml retry sd_sync_cache errors Date: Wed, 14 Jun 2023 02:17:04 -0500 Message-Id: <20230614071719.6372-19-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7P222CA0007.NAMP222.PROD.OUTLOOK.COM (2603:10b6:8:2e::24) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: 112c157b-1257-45ef-3523-08db6ca77803 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WcqfgORV53newbc/c4z4190BP+tE/J5/Jg1Ba1L5icFHhFM36D7uZBIDfqXSWtH+/M3N8ZvetZzAvS9lwCReR+CRyaqoZsGnYPdQlrogtmPDb+7bLc7zbt7J4KqinpdnV8G4cco5JC2jTPT7EkD+pCoRjxoA1hka+Uhk9Cmn+5HDZapHd53zdW20MqBkHIlMhJcVxE8IFTpy/HiJgRwXcN9hCqs8Sq9CS5xetHLOm9NMlXuHQlAln7PxBCXA6CGbXSQRz6LTGAgiWRnttjg24y/17LFXu3bCyGAs7dSojZ0NX0LNkUzwBinR9Es/Ypy5+pAecM8XNRYGkTiKwBIs24PJ1zq4hromE7NBKGIMeB3fTUXxly1ndrLNjWdlSQvmHdwXcaXGs4a7CmIGAKv0lqt76iyqoH+tD9rSHROl/NTBdD/fCp5THRv8JuUK25gxhdoTnryQF+HeB2IdI7iqiyhzy1NdTDOkg9n/901IchOsrn6MndQkydq4/8Fl+4i8/4RpAN02bkqfQpzpXA4T4sgpoc7UT+uaBN4/DfoBBxczK8Z4G6Z5aB7b0SXJyfC/ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(6666004)(8936002)(8676002)(2906002)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aFWHSImn/Is0Kdmf0dhxuFpw3N/W400hUPjeH/1ouYbA0jxvVYO+Sp4XnK+90C6QedH+8ne/RQewd2MNgd03kPzr4ImG7BalLkB9y//1kpTPfXpQVqR555snqBHlT7cEwht6ZgYFXvXZayjS+oNLB/ITvoP6lYKQSMbD7jTeDz6uXLzMzg6iDbOahcBAehTg6aEyzDF7FUg2dZHd/zTZwZLJNmRZg8LujT7nxeBbKAUBqRK63n5kIoygKGfkKb+D2FkoPNy0kMJSPzATBtgpe2NRyeyONCfGRe2jVzEOzF8ZiWdsDYPpwRiMX7wKhFZshxOkzuKYMXbnKWxfpoXGMYgZXnx+my2aHGc1BYeBC5H3ONc4gaZpaFbz++fqXEMqOuFTrV46JWg4K33aexcwGujFEKbAsF70As459fNM5+AX7Hs4z1vKgkICRGDavzGC5xbcB2qtaFjXx4Qx4gGFhLRgjzvsCQ/lA/42U0epkePNFaUDBLa87ZQiAP6C9Gpk9n56DmNOXj7BffrKej5Pu29aBHr2yhhJk0ZZk7Y4b18C1WgNPTWjfJZ5EiwWg8L37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kCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: d+c0fNxV5A+aSLy/YD0pz1cCwGnB9y7vrnhcXIOc6xOl2VhVwApa1ZqgFSHeWq2h288GU8+dS2VfAcDkKdeRdqmvgoKQNLP6xyVyJlep5EHvJXQ2ourxnud5DiYB8yToS1lOx3KiuY6g6ywR0FCDqhC82FjcfpFaKf+foKJZIcJ8IGwvCyPUvplG+zbEd7p+Wx2vd06x+1xM5vUAP1QhCjTxsEVQQa09YlHKwKjauANZ02SUFJQ08sxPm37slwSsgix5KevaFi+89W72MmGJWHpICkxt2IkYaIZdXr7UkBvGrxBxgpXOeSG47/1k2g8KgKpqiJ6+yNxAYF+/Yn9a9dZ/FaXvZS9J9CX79vNXu5J2iQitZMyVvPOsod569ffp8AqRPjeKs9IDg7Pmwv3Sqn1udulY70kSulySZogNN6WN4fJmW1ZLmPpyr/JYXowFinsH05I/GQ2AM64Hyq6Tf7MgPLdvHBc4m8eEhV7rmZ6AMI3spfblYLo+timNDEwyzg5BfnNKDWw2Soh6HbUvKba+s6dPnm665wkYYRY03l/L4LzIrrT5BpkbpsUYXTg5s/hRSdYayF+hirZvMxK3ktpOEDQDNdGS4Ub06bUPD/srG3ySpN+ahC2kj/VCmCsk42Ibj/I4BqTPXPcyW5jIVElhYOg8tBgSHOv2aXm+e1OAW8VBRM70zAt8SrbTy9KKfg8YdGlZWjJttHvff6AE0KHdAyfsWDb+ECgbIqXSMI+rZrouCfbOqHxgCv2oUxVWwG7PzeKqgSv1aBsylJRW1bVPdRWgoEu5Z2C4PMSDwEB+Y7OxJ8FmGY7NKbkNdZ/oMqfiPc5iS43B3gMpSb/sQs57Z0zT9ZVQwVdhLV4q95zLZnl9Qh/hTXKczMdXe+LO X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 112c157b-1257-45ef-3523-08db6ca77803 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:53.2873 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +wLhihmFNr9Ly1eBybE9cTmsNu6eQF06p0t7AhQ9rvGBot8t4A1zyM53FZcqawfI2Kr08gHU6jmH2sMALXzS4ObYvfII1L3gTkbCGBxF7MU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-GUID: fFm_THzcTEOxL9vGmg26FvSVgeEckYAi X-Proofpoint-ORIG-GUID: fFm_THzcTEOxL9vGmg26FvSVgeEckYAi Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has sd_sync_cache have scsi-ml retry errors instead of driving them itself. There is one behavior change where we no longer retry when scsi_execute_cmd returns < 0, but we should be ok. We don't need to retry for failures like the queue being removed, and for the case where there are no tags/reqs the block layer waits/retries for us. For possible memory allocation failures from blk_rq_map_kern we use GFP_NOIO, so retrying will probably not help. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index bb2e5885e41b..ab0d6b1835be 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1606,36 +1606,32 @@ static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing) static int sd_sync_cache(struct scsi_disk *sdkp) { - int retries, res; + int res; struct scsi_device *sdp = sdkp->device; const int timeout = sdp->request_queue->rq_timeout * SD_FLUSH_TIMEOUT_MULTIPLIER; + /* Leave the rest of the command zero to indicate flush everything. */ + const unsigned char cmd[16] = { sdp->use_16_for_sync ? + SYNCHRONIZE_CACHE_16 : SYNCHRONIZE_CACHE }; struct scsi_sense_hdr sshdr; + struct scsi_failure failures[] = { + { + .allowed = 3, + .result = SCMD_FAILURE_RESULT_ANY, + }, + {}, + }; const struct scsi_exec_args exec_args = { .req_flags = BLK_MQ_REQ_PM, .sshdr = &sshdr, + .failures = failures, }; if (!scsi_device_online(sdp)) return -ENODEV; - for (retries = 3; retries > 0; --retries) { - unsigned char cmd[16] = { 0 }; - - if (sdp->use_16_for_sync) - cmd[0] = SYNCHRONIZE_CACHE_16; - else - cmd[0] = SYNCHRONIZE_CACHE; - /* - * Leave the rest of the command zero to indicate - * flush everything. - */ - res = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, NULL, 0, - timeout, sdkp->max_retries, &exec_args); - if (res == 0) - break; - } - + res = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, NULL, 0, timeout, + sdkp->max_retries, &exec_args); if (res) { sd_print_result(sdkp, "Synchronize Cache(10) failed", res); From patchwork Wed Jun 14 07:17: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: 13279625 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 D53AFEB64D9 for ; Wed, 14 Jun 2023 07:22:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243172AbjFNHWf (ORCPT ); Wed, 14 Jun 2023 03:22:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235025AbjFNHVd (ORCPT ); Wed, 14 Jun 2023 03:21:33 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 569532684 for ; Wed, 14 Jun 2023 00:20:40 -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 35E6k8sa021635; Wed, 14 Jun 2023 07:17: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=l+LAZLw2B146/70d4zJpiJ6GsKQLGaWNOGvccXc64js=; b=UVWx2xl2Tfd5XUrYzF+ruGwkZsqRgreZOsss/JFTiTBibLsCAHiW+rvfYwrxp+yU8Kmv TBvjO3H5OCH6aeQam/hpKIRMiQx6UeL8A/GBTZdHRsU8uE1txFDecFZO+FXpmogTE1aV /r8FextW2ogvkLw6upT/z54Xj8v2ImNk4rt2QHCOClypW1HqRPMqM8PSGMwWifaJN6v9 JUqwekTunYmgOWOkGwJpjN0rsahL5rN0JWL5sLsIpccWVrCyuYaoW2ev2y0IxH1nrW8Z rh8yuZC0a8d/247Rk4INnALBOCVTqMeGKBP/P3Q52sHmdl7Grptx/X7UhuaGIoMQi5Lm eQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4fy3evqw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:57 +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 35E5sv8b016309; Wed, 14 Jun 2023 07:17:57 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2045.outbound.protection.outlook.com [104.47.56.45]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56pph-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jWI59ULi2yNfoqJ1Q6l6uFsenkE7rrwDdAJ4dT59Lvm48nODeBxsYrGlHFEx2JbgEtLBWnjVZW3zpx+e+GZn3fXGp6IjKGTtB6hgWWH+3UtBCZ9qN9o13nDzUXRq0fOD7U5a9DfpyuHOK03atak2D5RBvCayKm5J0PkHR1NBjY238t4BkxD+QVcV3iwMiDrxJhozT3Fiy+2kf4t3zDcE+cTJp3AtJZzjXkSjAxBcX/KdL3aw1EHzJo4L/gaQvcGQqFDmABN1oPdIPwGUQ+WiGS084iE93u+FBe58xuKBouAlwLn6oyZky7T6BZyBuuDsz/8P5MiBfR5BzPu4WY5Gpg== 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=l+LAZLw2B146/70d4zJpiJ6GsKQLGaWNOGvccXc64js=; b=JOfwTznSHCRhMKfn7MByaJir5+hdIhd+VyGHNEh1bIESl5Pbz0mgofWDslIcSqQr92EcXlqS/HxDM7tgoylczlPLs1sMYZJT8wL7wZXKXC71Hkt98PO5QCJviyFT1t6FjuVSUgkNcC6K6GAa6KCdEZxkfVmP0W7GFs+oqKVdJ/UiwkvzgGnndGHYnASMLHJrQ52CdtxOw/W7vWMtxyT7EjAwuDFV5lueSwAAYs2gKJPjFf914mVSLB7/BWkvNHtGpXdQhD3Hno0QJ7O4yiR0bXgM3QbHhycYY3vE8zWCnvfSZ7yPP4W++FPuXEoud8848golIcXsVjEg1bSK73EvdQ== 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=l+LAZLw2B146/70d4zJpiJ6GsKQLGaWNOGvccXc64js=; b=hdCjPcRP/hhLQae9nehfvdeBbzH4hW6baQBzT6WLgUZCA1g4QmKoig/AjXuvTYqvkuBU8Zi746cGcoMvYFYIDalRSdZogyO0xETNrU4gUouFGgAfSjKltdDB0Df/Wc8ZAuqoedhkkJjOEbnptBFZYIsC5XZzCQ+ldDEaeCVzkAM= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:55 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:55 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 19/33] scsi: ch: Remove unit_attention Date: Wed, 14 Jun 2023 02:17:05 -0500 Message-Id: <20230614071719.6372-20-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7P222CA0006.NAMP222.PROD.OUTLOOK.COM (2603:10b6:8:2e::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_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: 0245ed95-fd2f-4c26-a862-08db6ca77910 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2GmHFjnmDkovca2YtY28dzv4fZKrq8e39MKJ4BRPGOVm3MP97apo4+l70fmAJFhxMu1+3q7iYJh0V+KrOe9JiIB4hrXpR8ixLBJpMvYFQKlONAHgpfeyq0/gHHkUCIlkPGgyEGOLeDtwCNzfvYaq145JZ32lU7893iTt3DhswDUaBGKQUGuy0aR4o8Qae1mvfbsd1JmkS89QSSasML2sccChhZVY6k+5xiIpK4ZYfSdtvF0EcThGwBa2zBtuexcyrz/KhFdDgYSvR8FZ6kzh9Cry6wxVvI99Zb+uSagHZ3AAPbI/AZwH+O2RzNT8QJ0aRSkGWrwHhx830rq9Buxq6L0MPYHe6c3Y0ameuNrpZPm4PsM5N0TIz8CI8P3x39tQJu9Z1YoyXTcloLANdLuVpSAwNaC7gaCMmUj/gln7e8eb+p2YALiuBtKRinnFbNAHehah/8QGCX8vl/8tolOZ9z04VYxifiiVkpHXBWcX2wl1DvuF43lWjevptFbH+I0oMNH+bKmXg6bZCR9z8kWfd5hQO+P3ZderAY/7COzccreq4QalD5vWdjFeYOGupLJ3 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(6666004)(8936002)(8676002)(2906002)(4744005)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IuvJF8MdpRiQ8sfrIX7+vmQw28cu5wFmfQXAYzekrliCY99CGxZEtxN/15/0Qi8w/ns5rich6X5tf9vkJPMZghXS8firRMDdxae03AlZX+Mk0x+iHTxOadSRP2KYaUbYMIyxjo86vMvfUd+t4S+adE6Tj0dyY32tpt702XsKg35ag3UwEvPgqhbLnq+fdBaMFEvok1xN1cnbwolCnB9eliO9lj2YkP3p0fXPLZx02mBFKh7NNKOXYrpJGK4HtwVJOa0LSLV/cp4kR2bcfmxDCnKCEH2dOp8Bxk4f6JInbOoGDNCBMMOwiseihMMdC131Qb4O77daDVFGxca9PHpb4EGEppQCyoe+XAIl/Dy7/teG/+1YTfSdWTaZvtAg706pWBNMD9g+cq+GzAuJa/k3npzw2JPBKd2w6AKsGwbqRLT+FeHLuBbqSFN8WOrBhO4AbzluP+0PwJV0DdQ/xwcBEptzYPKkHn+w/VLAKD/o/UkuqfVNfxmYQ+frkJYXRoXi9qPpSNuf2ErxMqOwXKHslT8vg8KogytMCh44NGx6lXCNFs6tCKQSro8b2+lwPyVjraMJTnBi+D3Im9JdvxlGq2ZQiVdpnI3uZJFcJW5I18XZSUOljd0k4pACv0IDemkFQKqbSuWg5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yI02xXHDNDBV02scRXurY/JXd0R+ecH7adiYL/Sth2Z6jiM+STRds0oRSQrWVm6n++8rODjmCEaEx0c/IrhOdZgSWfkWyzCjtB3HkS21jGx8FjXmFDTNFULYSPknXxmtpktOoUou2d8JfFczgvjlHr+Q40Xg45qNV18AmhX2ynHx9V3euU/LAMIamU4eMwPRM/RnokGndq2ODNMNmKnfnUzPxrfrMrNeq/oaesiRyrKs6qP17SLZRz9QkElOZZ226qmRpso1A077z31O5pa6p1nbbO+vbKkrOMtcXmrbsuMPIsqoC7ZiMZo5ZNvipFkkLkBOo3GrY7DIf3Yy1bGZ6msiQQdeZEaytn44B+KBlU4KemGmO/VQ3qEfJt7KYoNbLqzlvTBsDLjlGZ9FGBLDnsLHN2gc8dLko8ejs8ZkvavmhnM9qikiuBnuDEqV95O8PSvE6i3AwYhy4GGhPofyTgV2xpCM1PesfZsji7tuDcjc3wsL8ExCWsBMAXs8UwNe+EAtuHrmrDVtWQg7vyMCmobaKdKxjZJv+Y6FwcmMDWR24VU8jHMXQRFeF00R6aUtu9y9ThY0+fAB0O6hrSIzk4eiF2ydfGkTb25moyBwxQSMson/dYXCUISbD+cvDYYFZJz1vXA353Rw29YrXV197WCltx4Fvd737GGtOhwUHeD4zOJhYLYvgkpyBvi25yRgo0DrbDdwcnH6QGh5FrqPnvZK377EN13C8Oroft4IrU8nMoCfCXqqQ+4XuFkxzDYNYLw0UsdHae4edTUMdDJbkfW6QUtCOv/sjE5N8e0bMuwhsNyTKYs6je5gv7dA4jx48j4RQ6YUI4kZufpRD88/Zh5t8b6ZMXS6efK0hxAM6yHW X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0245ed95-fd2f-4c26-a862-08db6ca77910 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:55.0584 (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: FLX98Hz92vE7yKs2QQVFIXAd86hTOGLYE8yPi6cQaTH8FHTiwcBpSPaqQcWWoDZmDFCTMYkuoK0RJJFNBEO1vDK3Isq9gqhDyCXdc3aBnTA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 mlxscore=0 spamscore=0 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-GUID: PZgMn3xvKhxRmSP-S-zodCyIkWkRaFwW X-Proofpoint-ORIG-GUID: PZgMn3xvKhxRmSP-S-zodCyIkWkRaFwW 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 Wed Jun 14 07:17:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13279626 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4355BEB64DB for ; Wed, 14 Jun 2023 07:22:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243315AbjFNHWh (ORCPT ); Wed, 14 Jun 2023 03:22:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243241AbjFNHVe (ORCPT ); Wed, 14 Jun 2023 03:21:34 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00AF5269F for ; Wed, 14 Jun 2023 00:20:40 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6jlGV012646; Wed, 14 Jun 2023 07:17:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=WhbQ+TsdeGVECXzngggvbLiEZ6YKyvCRlmU26+Rta2Y=; b=T6bd3uOVmH+f5XI1QpCbk4T0r3TSr9z2xoyE4Um68KhA69BsBdSByqTI7BvJtPbonGsM KIU5PQuNWb/Vr6eCQnNMEke6esQEYLSItZ4fRUdp5m8ySikIcw0Pqa4uAzFrjM+1Bo2F iqfoE+TSF/l9FczfjLYA0F9hfG8BW1itEdBR/FdWek6whK7eJFO5WQPvpwmGiOo6M8xJ DzJSQYwZl9oOZof1en17n7IhMo8onWkxnfbs5tHBH6D0vDBsC9QC/dn8mRaHevPSSZ4J yQE9CvM2NgPEVncyu/znSREN47/4wpGchq5qyTlMEaAxk9rtFZKpGiRgifYaTJdLLez0 Gw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4fkdpsu1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:59 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6k5Ap017793; Wed, 14 Jun 2023 07:17:58 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2048.outbound.protection.outlook.com [104.47.56.48]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm4wsfk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:17:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c30mk7ROvLyqq3PihK3Odz7+lRjQmJrzGRyRcGI6HQoG7nBkuinrPH54e8mlCH1kEhbFe413qK+wrN8J+9Wn8y/2+8xUwf4U/qTLG9v8o3+ayh5opQC4F4QkuB/1yxEcHZYP4V3YjZ57BDZT1rST4mRJi9q/23GSFZ6jhDODs2EuOo5rOKIiG413JN0/TO4wXvHmmQDMifItqTF5BGBZA4CIitmGg22HmxkNEjZaHjYpPHNQcmNzsghbDjZzCsvyw9WLljDwEo2l3ShfRNVuA1qilH7M2zlHOl/421vnzlHeC8Mr6SS10OxNI4vA4isdN8zaYQCxUrwvleIyLksjlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WhbQ+TsdeGVECXzngggvbLiEZ6YKyvCRlmU26+Rta2Y=; b=WMPs0Tp9MzzEqs3EpYbAlWT8wi8piJOBv4yVRkmshC3OrE0oU0ujwKnrHz9hhNaT5DkGstNbWtcc9mFz1K4gxt7BtyPkgWGckzEQaRRaFZrbL9wPmReCqogCoMAGEAHdLfggSRJCdztKEfPCO8uxIjfffA6OmhXG8H2cj6gpL2JnvARZ/ndbJGvAK9P48I4IADCrWWvoaqYuBRYWSTvPvG06Q+jOq/W/8AceWmSLMkjrzwrdtoGWmfTtCvjTqsnqNHOMkRpU8d5losfI4smxv+oOBi5SOfEFUBu+EPPTqps4O1P+8W7iOcMszpy8o/muc/KTElA+8pqxij6N181lrQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WhbQ+TsdeGVECXzngggvbLiEZ6YKyvCRlmU26+Rta2Y=; b=pXFn23P7Ib4rveNhNZciweDffDewgK/bDBEzWrgvrKryToaP1VPkPWE4y7Z7NgWhNAOBZheZYBXGNw8L1nffZm2gYsp9PYigLBPYIJEJhBB0+OcNd85bqaHYYyGPKIDi4gSthhyvv+dNiZNNr6txAmJXHUcCCPc3ywBIJxAlKmc= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:56 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:56 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 20/33] scsi: ch: Have scsi-ml retry ch_do_scsi errors Date: Wed, 14 Jun 2023 02:17:06 -0500 Message-Id: <20230614071719.6372-21-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR11CA0036.namprd11.prod.outlook.com (2603:10b6:5:190::49) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: 5a6a9f85-a968-4542-2f65-08db6ca77a12 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nEAj1+HsfVjwpKmoYLxqEyrQHpueoAF7uLc/9/Q8MK2i69AoNCKFZPoDeAl4ey/+Qu7OzVsYqu/D7nY4UjoA2Spm1DEZlI/0V0A9XbxT3GCY66Ik5+VrJFsUn2Sr0EWBmhvwKC40YTKEwtoXqg5w3E50FtnBFSfhpWztEWYUQPbTUr89qw7y1Z0xYsEUfmY2zyVs6TjHI/a3fGp//ec2f9lKH5/RZ5wohh4Bzq+vlPf1aSlHZwpgC+/f76e+4rlf5dRmSDkwlC81XrIdN12SJXwzd8J/ulADsW7FfgTt+voMmcAiG4wXlF34kQbxtHAvZ8n2iL63aHotk8IT5EG+tEJ5yGJXjjYw2Ttqo1FG9JuHiltdYx5h+WgfyHJf3gtgt8DV2CEewSZbZpMoLu3vm/oqZ5Dd/gvyn0Ykn3j8rA1z3cja8CwnOcU09WDXnTKwBbVfE3hSqvpuYjCCv5ExI+7EEeEYlAGZKqo/G5R4rt9zgLsGLyFBKkxZr3U8B6pGlGZv7tCrlkJkceYPIthW882o+Uq/IeQS/KP8ZE/xcZv4QBsu4I8pnrXBXiyOY5ot X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(6666004)(8936002)(8676002)(2906002)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tM68HifQPwmpvaY9zDnuYeWn8ndzDvaM7UliFPwO59HBdoEmiv/LWZyQo9HDkLqbZu5TnijAxiYVgRRnYKt1FdcUJgbmTZb57sVZgBXWkuQGRVqbIxwVT9NXYAFbLzn+c4Ay7kmK+rMkhNXrekdVGE3XZ6SVMcuTFkc5MWAIftqWBLHNk3NhIm4Fk6cnfUlXi9PCNdO9RV/lmqVUsthACo7hhjB1PxBomkBgLTvEy5hnZQVon99I/IUF6eyqT/vLq1nTkzL9Qe8GsDWWcKT5bBkBRswNr0BsV0+H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dw6qMSqpkZnXGvUaxGVprO7RhUNjDAiZVmWd2/FMi5s3d/hx0ki1yfxa59nIYgHml7FyJlgY3Pubz3+TzTX4gizCJ3avttgUi89lIo6UC4YWBL7R2sfKuFquoyJDBiVS9M1RMRt3LMcRJSXUul4T8cDaWM25XLDT3uU6IQoEs7aoi9hhExvn1aoL35nJAP00tu4a42z3+vuxk3szWEy59KNrumi1SCWUdP8ikJH+iscbknQ4P96JkCvAbC9UrBqx8zSQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Xg8I6NN5slIhBAsTDW1sPxBYwVXeg7C95qkMfmoCXo7102nIqyYeblvaK8xV6y54ZIrUkx70XxxJDal+TjKWEhuzWqD85Ci/rWTUJ5REd5sM6pd94jJCBLqMnXR1USvgT3+s/sGiADwslBdupEOMmrGtAqc4hnpuU01a8hCc4jDy+h+ke4ID2ymzoUJT8qd9mAsBbicR43HhgSbSSS37bOwVqIDRTgdN326GaNMrbzdlg2uL57gU8hBCE8q1BwM0hlbkHLVjQLFbAlObTGjogcI6fU7FppQlwYK4FR+GmIxuN9FGMohvA35m0UfI31EdOnZCUBvxwszr6iFDFljcHwFtgB/pU2D6v5Lp35IMUh4eOXWhfHnU8OWmGblHUpMkSuzyb0OiqB4zqZRBokoFNdOVAD5xH3M9W19dZL6IY1FjqgJpzWPRQYNu+FkOFimtw3gRiaEn+QWQOvy99sAAQAlrXJJCJsJTAGQ9fAkZfJtEFBuZDmbqElnW54Pc9a29hSjFMCf7wvNll9DoZQDswNhB4XGakk9jRx1DBiDOWnFeG7Kucg9KRxtT135uN/xvNC038mM7k+c0NtTgMAC0E+vE/rxbg65tDKNY4/Fge8JArsir4UkRnEtQrG0KCPCMeWc3eHztiH23927abO8q8wdWE7WsTZmfhHU2IG7bjKY7l7ryDH5S7TjMsljJlMQnEkVE3mBNkrcMad7F1mub+xKP8cqSPDr5mCB4Durjgyq7dS7nTV3EtWy/FRUdLG54XHrJDtwXPkaDRWBRtnIX0mLWdG9l0IkoI5u+X1cZ0h5U2GnN9KJGE8JFeotn3OvwamAVrorZwOEIYm628/V3MnXsQXtWeho+QdkUMEGiCeokCpPVY7394sXrHjaeb+Mm X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5a6a9f85-a968-4542-2f65-08db6ca77a12 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:56.7414 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qMjdxz12fuOYYkgkeDYBI9Yw27Rr/QQ2g6+8V5nvJ3ykq5PINd0LdgUV1Vg5lKvG8tF/22ewAJ5pqY9kkDVwoMRk0G6wypllS5vXOirHbUk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: wtkv4zZr39XHqTREvH3uQ6ugQOfCvaSb X-Proofpoint-GUID: wtkv4zZr39XHqTREvH3uQ6ugQOfCvaSb Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has ch_do_scsi have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/ch.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index ff4a81a1b056..f2c0778afd50 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c @@ -185,16 +185,26 @@ static int ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, void *buffer, unsigned int buflength, enum req_op op) { - int errno, retries = 0, timeout, result; + int errno, timeout, result; struct scsi_sense_hdr sshdr; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 3, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = failures, }; timeout = (cmd[0] == INITIALIZE_ELEMENT_STATUS) ? timeout_init : timeout_move; - retry: errno = 0; result = scsi_execute_cmd(ch->device, cmd, op, buffer, buflength, timeout * HZ, MAX_RETRIES, &exec_args); @@ -204,13 +214,6 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, if (debug) scsi_print_sense_hdr(ch->device, ch->name, &sshdr); errno = ch_find_errno(&sshdr); - - switch(sshdr.sense_key) { - case UNIT_ATTENTION: - if (retries++ < 3) - goto retry; - break; - } } return errno; } From patchwork Wed Jun 14 07:17:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13279630 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21947EB64DA for ; Wed, 14 Jun 2023 07:22:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243448AbjFNHWm (ORCPT ); Wed, 14 Jun 2023 03:22:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243412AbjFNHVf (ORCPT ); Wed, 14 Jun 2023 03:21:35 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CE322974 for ; Wed, 14 Jun 2023 00:20:42 -0700 (PDT) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6k3aR023008; Wed, 14 Jun 2023 07:18:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=R06SqSAgZhjpz3iV682hTJ2K0P66WyKn05n7M6BD4lw=; b=xJHq/3usc6ClUWfSUgi7IZoJupyRZ6gBzrEENE83rV6FYE0zmyiGL2TG6Rv5pLWagup6 usELyzrmnR5WKlAWI/G/KwynjfHOkwbJVnquawdG2AO02Q+VHCBy1FGs86ScFm41KPq8 gYkuCd0XVFSVhaiWoZpJyNM/2nAc1K5DlWXkSwR6yA+PhiglY3OQ5XCEyZJlYSq6rCqq gCldiS2MavAToKd5sWDuu1AW1yAixNbMgARqB2N2kpUxLfZqvuOyVIJGH0Cn+f4z1b16 xjjIHnURS/BUgYguZKpNoXB637yAmEzNKPuT67iM3QVdWFAZknKF8CaEeLMFP1vwVgYV OQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4hqupw86-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:01 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E5n4ve017775; Wed, 14 Jun 2023 07:18:00 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2046.outbound.protection.outlook.com [104.47.56.46]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm4wsgm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XYcO1y57QnQZ51yv+KGQ8tDrgPOcKVJKN3rKsRkKRc6A5ObDp3mB+RQUzUUB9Id5ELf504nm/L2s2aek8RA5wtuQKYKH6B2BHN1y/NiX2hsmPOGFryVB85hxfCpSB/k0aeQWDYAAaxrSmbbfgZY/SQGOzuwNMm2GcFvg0kI504aBTFD69s25qN4gFEzr+z4wxxIzjrYzFOvN/EbVvkpU4IL6qjwGHfAetlUL/9zkrNtkVlVrWwzk1avqTZx1woykungxdOR5nnqveKww5fMSKlTANAy8EWM6uZ3mmeUjh0z1HRo2r/2vDulxo8TrvMa3K6FClBOO5vGEvFUyfDte6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=R06SqSAgZhjpz3iV682hTJ2K0P66WyKn05n7M6BD4lw=; b=Hs3hrml3R89PMG/qyqCTKvmFq6yHEgTsYoZgh3ULRQVE3N6KNVohVDYK4Rk3eeBnZFIJTzWtu5qOiI2P0xWBWoLeehUat9X+G0NAN7ypibmnbxv/DJevkWxQXCJau/ySteedTYyCUd94SKzlmWG/x/UEH6ZAJmAoZgO17FWBCmNuWwU7pYRXqxigy6TU/Ple8BYedTvozv6SIo59+/RubHVwetTc2SxuNHWkBJBmbztMirOHMzlOxvx+5rPJ6M4iVME2DzXGeQ8ruLVybtRFOy1o6BhTkUMxsIno9z+RsezkG4s0Dp5axWSspusx+KhpRWa+HZF2CFryLNnFB2/MGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R06SqSAgZhjpz3iV682hTJ2K0P66WyKn05n7M6BD4lw=; b=VmIKoYRsDFEvTg5FpWuoQEzwSZi0dUanAHkuYJ5GV4PLhaQPNL+TW+IZO3ods3UI7ZNN0tDFd0HMlrVOWY/eSEP9pFBPqea8aAT/r7AKiu4GdWn5621xT8GbPv1CwB+vqX9am1yzYHCLV32Fz/w32f0GHaYXxvhm5YuVrLnzjNk= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:17:58 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:17:58 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 21/33] scsi: Have scsi-ml retry scsi_mode_sense UAs Date: Wed, 14 Jun 2023 02:17:07 -0500 Message-Id: <20230614071719.6372-22-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0194.namprd03.prod.outlook.com (2603:10b6:5:3b6::19) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: b4abb300-aebf-49f3-0503-08db6ca77b22 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P5RY37rd1PP18TvU1jbMNgZTR9hAjLSsAmlohpqenrR5K+bF/9TSLPlry6j2QvMN9RrapHR/0m+cLvCANTeg/TyCfKDPt09/RSkbiZs39XvmjkSGVq49xAAIE4sTAbTLwu7HxrPkOms6JBA7hMa+JMxwgNGmEYk6FIHBkDZ26x+vH91V3OUDmpghQLPmz/Br/W7ayWRu51Ppcyfx0y6VtxOwoZ5WZqsPXnMpJJUnzUvzX8aCRu39nCmnS2Y3AEzP/YSY7yZd3xInPnKJQk8pn3iqKndjMo0r+cZquHGdHXb65mH5Iy7YIewcGMj9jZcpOJyoM1Ut7kbmc0DsUd1soWsgtrakqbO9U4I/hbqj0TQ1EVYYHH4sST+Twv+eEwAKM940GWUDNL36oZVcre0Ydq5r7lSMwsxwfs2zCdUHa1/0T6Mn0b5zMX13sm/BjYzCXSW9UbrRvrUnZPT6BPdea1p0U4t2Iz5HCx0m3U1b8A2XVhPgGNFprGUxS1LLwxjOOUOBFTvEwfaic52dJs19RozLviCIsNVYcJYjPGBMVOhf2O+yY03OpCKeWCYGxiPT X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(6666004)(8936002)(8676002)(2906002)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: klckiu1eLACjTSqaUP4xMyETh4IRsmtdmNG+bKxqMWuLW8Lcw/4a6s7bjhrBgVkpYjze1fh41i30fJQdnuyb031hQ24pS/1v4/MCvCTk8xRekVrdq73I4Y65LH+VOsCZXSeJUyAI2fD9L4tEhiPVS+o12A/qDsp8LKvfy9/2oECjZLq9GLmon2iN0gonrqfv217QG3lQr9LRIsjyfw/j0iN8fdpptcLKPElWtVRXftwDOEk2lcRcPHG5AGhobOR+mtLlviFjqo4lbBNOPRKWLuUZcEKH7pLr0u0BxWgcEjcksh2aQkfTRNqPfBWRW9CaVCjwUUMvcXyzRk29NkbFsQ6ZkUKPAW8XSYY7YTjEefFPAKJWrAKyrTu6hhRPI+UlKe9XzBGdqtk6hO3XfFrOnXBtlavTT5lj9JPjGiK0ae4OylNPCZQZ5wscQxOAe0Qf8VouGJ2ZR17QzVItkCDxmSwQV3+n8NyzQ/iVzpuMSPBD/naS5gVygTKBeCPbAcAxU/3WY4dwzqpZx86dhA8NKs5Spqlict+lNhHPjjl4nvRwcg2XbNMz+KpUls/YVyL48IlwWulfbHWHVfZY2mugihATYPH9qy0hmIQcItIK6oBb1zAT/NoJPY37MPiIQ6PiTJDThHIhXfvWs7sggu+WuMq+1g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Yh5STmaY81lLVI8sU1b/uDvx9lrZgy7gkEJY8lFqDVjh12UOkaM4sg8UMykMEuPg/RLSy7EXPamQDtNHt+WQDIALoMMqzpfd6a3EQN6X6a/PkUXqg1iIeTZlzkJh7HDZgPL+jO4DTKjOJiULF9Fh2nd6LSNwR8fDW3wk2Uhcjzk/APd4v84NK33n8j1TWJdKKTt+SMfxoeb8enUacl2CZEoUGSg9xj7CHMQN5910H7E1+TZYEWbXAmIRLqzhwjmpC9exlKmClcpfm+JMjzcyDxalEcNOf2tQlZxqG9Rb/ZcUXNSmgw/5Sdc96VJXb+rjUAFHTQcX+3IVYHNfrzuSMGYogDROK3D5BohsjGGwSXVJW8H2snI0I9ASUKIfz0wntdDS720hjveu1qcX3QqwD4lJrGUGM7DaSACnfilWWib0jvC3NAyFvy0cU82qK1RJbJciStNQgmyaAsNXlGzQFHzYi5dnBOasiV09R/HLM8DJG9/qVmozCgo5ySDFnkigR9a6Sv4iHnSNmSCk1sJ4RA8k99vVR8dFVScXpU7s+9NYeLSD02Fqy19GdoN4ygmN/OnbLglgTqoXB/uFxjc0WKwXjZnjqNE9l3S03g3ARgMBkZfq/vUiaQHy8WHY4zalICo6redN5W6E960aMJvfVh8KHjnH3xBdFhvpWkdT+oRkZ1b5PzTpzIKaIkjdwzzJHsc7TigDCRhGTCaAXsf2fCcE6PPAGtQaHOOAvfwY+KlKliExXNUa9LopZZEoudtajnEyUbfAJ9Bk+6MIz/cHAN2EY4KdmMrl4RlsHLLMYg3ImXrmpcXPEp7i9ymMGOfBD57PFJT8feIn5zy98XUskwVuzgm X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b4abb300-aebf-49f3-0503-08db6ca77b22 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:17:58.5334 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WXK4pxIWY8gHG8jMd92qrkV8sTRYra3j162o7kN/cOWx+8ypytAWkWcJJict3cD/tCTBqtxT7fe198Y+kYp4mfxTcb1k9f0ca1UdxXqNrBM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: tdBHvF8GDAx5FSR2NCu4bSWBK5ZxOLnF X-Proofpoint-GUID: tdBHvF8GDAx5FSR2NCu4bSWBK5ZxOLnF Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has scsi_mode_sense have scsi-ml retry UAs instead of driving them itself. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/scsi_lib.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index f539fc4b7148..0d28920d088c 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2186,11 +2186,22 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, int subpage, unsigned char cmd[12]; int use_10_for_ms; int header_length; - int result, retry_count = retries; + int result; struct scsi_sense_hdr my_sshdr; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = retries, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; const struct scsi_exec_args exec_args = { /* caller might not be interested in sense, but we need it */ .sshdr = sshdr ? : &my_sshdr, + .failures = failures, }; memset(data, 0, sizeof(*data)); @@ -2252,12 +2263,6 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, int subpage, goto retry; } } - if (scsi_status_is_check_condition(result) && - sshdr->sense_key == UNIT_ATTENTION && - retry_count) { - retry_count--; - goto retry; - } } return -EIO; } From patchwork Wed Jun 14 07:17:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13279628 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75585EB64DB for ; Wed, 14 Jun 2023 07:22:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243320AbjFNHWk (ORCPT ); Wed, 14 Jun 2023 03:22:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243316AbjFNHVf (ORCPT ); Wed, 14 Jun 2023 03:21:35 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CE6E2683 for ; Wed, 14 Jun 2023 00:20:43 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6jpRR021304; Wed, 14 Jun 2023 07:18:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=wMvrcw9irRTIb//WU9tPFA+BMczXZIa5kiEo4MY/48k=; b=THhZNOYqnAzIHllMu+d15RE4xkACwAMZeAABaW7iCJAGUjUNXoZhvEGxEDCCrXLUJrSc mHnOBagDkWBYV9RcNn62Mgk/WKmyV4COe5cLhWUrGrAkhsjgAysRkCXAPuxsqoV6GlJF TMWBhbPJBvMIWqzicmOo74Kf63DLVxqfjzMgOcij+TEz7mlH/zQ7fty1/zJGH6umB+u2 C6NOMfwJcPSVGXL9ThW7VPv2n5g1UHviWJ4G431hxpSfSdwK4J171ryLUGG3hYfZ1i59 2jwZeyXkeThsRYQHEmRnPecrJMHhUorX6bpx1NmHSXEYVvP9PoAhwv4Ov1/WM0+SS2Wv KA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4fy3evra-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:03 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E72JBu021666; Wed, 14 Jun 2023 07:18:02 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2046.outbound.protection.outlook.com [104.47.56.46]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56ch7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KljvfNyxuZiCzsxqrtFUQkQ9uPhrhTVZUym0ofzMCnJkUvDpf1lBDxj8P0X70vqtlbiU6x5aX7Dv2MC1Dq8QfQSyVxD+/nhIrnCyOMOnl+/Idd3i0vXMhI2wmAlNiP3jqKGj+kVms/27/W0f2SS2dZTeCpQSCf8Ls0ScksD9Eh/HGRwFkU5vZDSCfTHz6GuFI/AqOX0rV4tz/9pnlCXSFqsyAY2pr/jxzBCnImOplfc8QW/meHSaaccxDfWJCtEsEOo+NAvt7LfsNKtBGEyqJt0r9wo9PtR2DEjVwm1MUaBi7qc8Zi3Xp48Cxof1iZOZslLH9QIMO5ObbZ8Uz81xWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wMvrcw9irRTIb//WU9tPFA+BMczXZIa5kiEo4MY/48k=; b=RO9XC0Fts5wlbB3Ot7rmZtm11xItBFB+DWIuKKBjN9tQZ+DbGrhTEFQwxIvH436KzsP1ZZh+iBuuBkcIm1NzU3vZsAMED/epH7cMgEk9WLHSjmk3HmB1MSI1aYd5D+y+fEBs95ijEZH0400rugS1zVuxvvm2+M0xem0hTiYGqJPIw0B/Zrv5q3xQBDKJxM4/mD+Z3+J1VT5krxeg2K5w/gXUIHtBsQkWP3xnaDuNg/H8sG8SuT2IoyK43t5x4gLWkcSGFPp4ByzFArQP/h1k1zJGd3K7hFxQ6SMbT04741wm6zFw1L1aCeof+y2mnNNXu6l7SmS8OpIQyG0pAJHfZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wMvrcw9irRTIb//WU9tPFA+BMczXZIa5kiEo4MY/48k=; b=TXPitkBdO62Om4ZT/U9FFt8l48+NStJ3gGbkwPduAmhYLFyi/qikEvKbb3p72E7ERAt1NKvyqC3/uwkLii1vrchU06RHVYpkYjtXFUOTRljUbyd8zdJ6RNhLZeo83v9bLwtg2edMR8ONX4p3NCpOi/20GntmXXn2zeJjQjYOmyo= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:18:00 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:18:00 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 22/33] scsi: sd: Fix scsi_mode_sense caller's sshdr use Date: Wed, 14 Jun 2023 02:17:08 -0500 Message-Id: <20230614071719.6372-23-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0201.namprd03.prod.outlook.com (2603:10b6:5:3b6::26) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: 9537c47e-93c3-48f5-7839-08db6ca77c2f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /ME+M+hrLV2OBulBvL0xsIzjr13FWdp2/UnxUhDqRyCh/9+fmqzlNx1TEzBhp7q+O6exLYclt1P/32VIVybKeeE5mRixm0dxo8XB4/Q8Jsdf4RsMTVv41Y3b1P3naY5DgJWTalPnEN0dswMa5oCyif7UWPxKv3bf5+8H1Er12A4in3Kalr+b5qJWslWrZV+injgPkw/v5Hd6f8nJyWteOPAV031gmgYumZiZ6hdeDS863Z1e7l55lpk0CEpQbRl7e2RYQo7IzQqEdJagE6krjDDmuUb3+D5zYbeE0PhRsHuX1CPMZZeqiHG+btZvnlM1SGu6bionPnLEYhX1TUVQMjqNQEcZdIzXJss1Xm75bLphuxAWTtsRN4Djorri7BFiKJkhSJ9NHjpTUu/XJ0xueIEquM1GcScgMuoorwj6C+X+Vrb6XDB8ZASDSGTQbdhh1uOSgq6uZu6AUe3jKwoMBy9i06eAU207i+QmwIfKOb5IdWxlfasgjZT0nnrmHHhEXpmqSfd2LQ4XQ750AEOE8XLIyak/1PtP8ibKWJKp7x7Cu0SVj3Av2pOb81umVXP1 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(8936002)(8676002)(2906002)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: beHh7wCLWoqv2FOid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0nifYT8ebaSIjdEHQuvIfNLcSBSupWe+4L0y2JCnFmTKH2gd9gY5hyYOhFsrVQOv0zjZLLH0LYIfYMd3QQ77RKdZLBps2BaZ9Px4GJuztay+KUKIDcHYZYgDCRnmUiKSDTFoBjfwBgz2+zXwNg2QlApaFM1PYoz9SoViQMmlD71mvwqQ3MweJ0MEWuFnQZ7spJes9XFw484/i5IQ0UtRD5oO2H/1Tez9S0WGPJtREt64MC+mis1C0VjxmMORCR1iwjglpG5O1xpY54IJJg39VZghOQnSC5COOWuuweXDRF59bUkKPqZXQGOajNvEoeY6t83JpKx7RdNWKQjhigxbp01UkzSwHWPTQXs3baXTb8B7lVMMrscFOb5XoBnlSWxCwyJ76+r85tcXeviaful8is6gy19rZwZRZDXgyn4jRYunnyzRqvhgxHGwuudVTc0FB5Sr X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9537c47e-93c3-48f5-7839-08db6ca77c2f X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:18:00.3124 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LzeRf9gRgUGhR3V0k1y+Yc7REBjA6iFVtWswkNXdW5A2VVn0Dz0fnEjySEKPWEOeiaN1C3nVPeFZ0ov8PXvyMiqFN+4W8rDY3cyA+JYjWoU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-GUID: QUUdMt0EWpEu9b_gQaVkFzoPbFsI5IZb X-Proofpoint-ORIG-GUID: QUUdMt0EWpEu9b_gQaVkFzoPbFsI5IZb Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The sshdr passed into scsi_execute_cmd is only valid if scsi_execute_cmd returns > 0. scsi_mode_sense converts non good status to -EIO, so this has scsi_mode_sense callers check for -EIO before accessing the sshdr. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index ab0d6b1835be..48b727b2bf1d 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2967,7 +2967,7 @@ sd_read_cache_type(struct scsi_disk *sdkp, unsigned char *buffer) } bad_sense: - if (scsi_sense_valid(&sshdr) && + if (res == -EIO && scsi_sense_valid(&sshdr) && sshdr.sense_key == ILLEGAL_REQUEST && sshdr.asc == 0x24 && sshdr.ascq == 0x0) /* Invalid field in CDB */ @@ -3015,7 +3015,7 @@ static void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer) sd_first_printk(KERN_WARNING, sdkp, "getting Control mode page failed, assume no ATO\n"); - if (scsi_sense_valid(&sshdr)) + if (res == -EIO && scsi_sense_valid(&sshdr)) sd_print_sense_hdr(sdkp, &sshdr); return; From patchwork Wed Jun 14 07:17: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: 13279627 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 95759EB64DA for ; Wed, 14 Jun 2023 07:22:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243319AbjFNHWj (ORCPT ); Wed, 14 Jun 2023 03:22:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243076AbjFNHVf (ORCPT ); Wed, 14 Jun 2023 03:21:35 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 526E0269D for ; Wed, 14 Jun 2023 00:20:43 -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 35E6kCOF026738; Wed, 14 Jun 2023 07:18:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=1x5ZJ3aJQDL9NPjtm8d3z46zCcqnQfjROS/AeXBX9/w=; b=Ke8XJtD3Zc5qYrN3Q0sAmw08RthwR8bu+0VPCAFu/xVHJCpSYUNbVMHNfVmUbZhc19iX b6QvvxPO9FikCyiK34kgr3N5IEe+ipdOuV2ykimJrLO8s7D646ifvsLiPwXITjGNYaH7 3T0x1lVyXvfX9z0gXXWs3W+J8PNcahm8gHvltP+nzmdF0vJBJerJWX1cY17G9oHscNss hcMIscLIcrx+0D19DWCFExpAe4sYvDwSCGp6hCE02Ol8zNHlnoS6mmV29Vcf03CgPQ7B KBgjLgP9835E+vNs0VQrcajmtulhXkKwuMeGMML1sIk5aXP2TYkpZSU+FTXTCsyMdxX4 Dw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4g3bpyud-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:05 +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 35E6UG34017744; Wed, 14 Jun 2023 07:18:04 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2045.outbound.protection.outlook.com [104.47.56.45]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm4wsk1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZtkUCAjcZg8dTidKgdJTqE3vVRnftmGP/qzR/8K5daUbu1/fwkqeC/ofXC5gvHB3COVTanG9D55hf2aCyvGOL1qJX0nIMYW4LObWQY46pCF+t6Ol2sp45hewNrMcQR380qzWTuurz6Ofe527tCC3Rt3JPPCjPC2g1RwUWPwVwVZAPSlQGY35EXnPaM/6yixhaklOlvKWIXlo5tFKhRKEC5TOOXu778Wcbl28qILQ2qp+Pg9nMlZkfntzHhUU+Q713Yt7tJZqRgQelK2ce3lo+Oh7eHjow3E0xuAyyWRw1Vot+o9I1dtBXwgjiAu25Ixu2tWLrjC0ua8ltY2IeWABIg== 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=1x5ZJ3aJQDL9NPjtm8d3z46zCcqnQfjROS/AeXBX9/w=; b=encFfhwci/615tzTe1Hrnthjd8chXqbsP9QwEkxSUMwSHPQ4bGdF9jDo3l+Gi0cEtuqGc+oOOAUSL730zkp8cV6v7OP5kXcYMFYSdKVtYCPVBOWodC/M8NonvtNBJbOP8P6FaP78tpJfaaY6Q+D0FBbEeplCfWGZGgWacrZMy1RRahbZyQDiE1b9R9Nras4uijFG4HoOJS+tEH7cE0rK9pf15ALzllmlW/Nk2bUhkfQVVbThACDfX+RaEiYPBTev6peXbBDTKenkiGz04FmDkeR4QIy4vjRDtBqOMx6go4MggCW+u6MylH4B1mSlGgoyqX7yN/lF2ySu2PXi+vSTgQ== 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=1x5ZJ3aJQDL9NPjtm8d3z46zCcqnQfjROS/AeXBX9/w=; b=nJcgLDW62YoqPzKdkNZAKsjMWPZyRkQd+WokXiqtKeEGZtFR2ANiFK0AyenjvLtakqFf4ktccxvqt6AQ4faaVZkIRCyrDJHAYrH3TRLoNA1Qop3zcmc4aGoxdVHmmssIJEq0p/sMaTT3eZc/lFFUpbcEuLBio2wehD7N2oJyzJ4= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:18:02 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:18:02 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 23/33] scsi: Have scsi-ml retry scsi_report_lun_scan errors Date: Wed, 14 Jun 2023 02:17:09 -0500 Message-Id: <20230614071719.6372-24-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0192.namprd03.prod.outlook.com (2603:10b6:5:3b6::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_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: 55447752-2aa9-43f7-d6d1-08db6ca77d86 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P94MrlE1vxmC6sU8kSRzWg5X//WO4wG/XiYp5Hp7Bv4dqBkg1RuKZ1aqZAV39NZ3qA96EGajpIbQOyMqxntcQf02skm/OXgjYj8/E2aING+7U0qPXhmqXul5lUYTkqfCKGTgorIXNOiWcYatH72I6QuFde4d4ervde7DOMFP4aC+hYwrnj2QUSWY/ymPAgLGjQzKfhxSW1qvdlUQHzSeaFpqnj8D+zmYHiYagBwWwuzMlxZ8qfVXdlJRUB7Ssl10J1q5GPBI7BLl7ZOqu4Yno9ayorOJqYwklTIobrjqrrke4FQjdSLS0y5nC2sHeH4d5jD0e+2mCYMPAaxx0ll2eMD7oa9mBapinHkBT+yrbO+IwFj2MPeRFenuCtS1g9glKODKTFj0vQt/+n7+3p50Cj7dmkwXTU1ufYlk1ET82pwts7vbPnjTiTovqHaHddiQ8UBLGXz1ZyTKRxHr3cLULTgRnPcB/hghA146q/+tJI8uqu7egOaBNSNbuqKX7UvREbcuEDNp+0xZ6Q1n08g4XHZVvqg35EIbtF7ZVWVtuQ4UayCeSTmt/calyab+t95k X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(8936002)(8676002)(2906002)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0Q81aKVIGsGpYi1h5JM9gkgXi4UYAxmq0aUrUp76MVpho6xYZhzaA+joJ+8Sbmu0SI4Jt3P2hWWliIVU6NqCGxyDv0Aizm1b7aWwO1V260iYKDakkiBJY9XznWkhyg3VI6zicyudswK55HqLDaqXEfehXmLqSg0ePizzO27AWckZPZST2i/ORSwlOnQx5zxuBozCS3jqKDJylANK0aGipACWfbFforx5zR/8XuUx1NzPnP+IbmwFW99tFNNHPZpVXw/E7ih5ccKuDq8ihz93snKkRNvYwAsV5m1YXK9PL6ILB/P9tVQ3pfbgPZETKVARFYH425posEAwWKuKLgeAEsghjtLudsLQhpYihq3oEcMIVeVu5T/GIX69J2dkmkrjnwvCKW4mFf7j0l6OE05dbN32Dw8KLzve1tH9ipCkLaH3uKswBsnrymuD5t4y/9oiKMCUF46ToR8Y6FtzEsajxISQvCIlVMvNFCj0qSq3nBwNpL5nkU41ZdG/HkcEeQZF1RZVllnv7pe7oy9kxSGlekc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iGIrDOOhSOjlUyy+YAAcw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 3OUmT7F4uRG9TCULCFh/0QTxJqgCAHPyW09WzqB0Zl3RMeFplG+zPtlJtunXfLzMEPPynAIffUYPAw068ILjgv+ZTOfDEeOvyR60gVJ84QbG66YPr8c/8znUQNyHnJ7ZOfF6pZQFr1cqzLWVgAh7ZyVDU6HAGUAQGS0l6cJcXNf5QWefJ0hF3UO8S/RPtB3r9DJ6ZAN6UMODHl6BK4H55w9vaz4REvdmo6IdsylNHTN39d4GOEejrNrvfbZW1hPLQYliLIJrsuMX9joS1F1fvCH/Nsb5DZY+0ELeYEkZtPh8M83H91rSG+brJjlR5dh/+W1tI3rTIybRo+sbp/GnhoSC1Ot1yYK/snB8JjnbTcyvVPyvkio7JnfTwKu6d96SeE6Pr+xSq2Ny6W1VI4CUa63ZE/k1Zhyz5lKJuleRcVfUkHkNZS/31r3fF8ppAWSjUo0I6uz0LrTLzX4WBKs6EkmNizuvYEqgPvG5HLfEnZE5oED5wvt2CP14OMh3Tw/qXNEq1ek+DzsXlp7i67vWR4TAQryhvUYklAsTnQYYOYO41OjEeVZl0WLYNm+yw33gLgu9oioqx8sZacsJTgjADnBuGmre5SWJu7gqWHbmfGU8knflS5cf1mUBparz8auK5VGopSK2ua2LbARIL9DGwExWY58wlvTqOEQTH1U+WJmj2cR50OACoz1fueBPxnfUrdwB27SqLp8KI9Vd5NFIg5NuLAIP4fZDLU8nozSDEk0V1DQXRXFEtU45L9Zu/UoH4eSwWv0a2hPh/E+xHsR9OZNPcabmVSEXAoYRDDshaVzjTKD69sdXBdHhjKitGRmq7Jy68lDcJ1G0u9AG5ldw984Aqe8WdWukjHvnlqyvi4+TmDNkX6wAd0m/sPomnkGM X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 55447752-2aa9-43f7-d6d1-08db6ca77d86 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:18:02.5474 (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: ZEnRGXcnEyvRkSYtJYLw5dlRT5owCquMSOC4O5ezwLH0DPw3+yeG5S54KGwhONIhEtEIfQ8LgnPQqPZf9VpHCrvlnvoJe36EGS0hZ1OoP5k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: WyLXvnep5c9oyKsUsii8wUm32JsPtpav X-Proofpoint-GUID: WyLXvnep5c9oyKsUsii8wUm32JsPtpav 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 Wed Jun 14 07:17: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: 13279631 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 66202EB64D9 for ; Wed, 14 Jun 2023 07:22:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243329AbjFNHWo (ORCPT ); Wed, 14 Jun 2023 03:22:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243328AbjFNHVh (ORCPT ); Wed, 14 Jun 2023 03:21:37 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB83B2977 for ; Wed, 14 Jun 2023 00:20:46 -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 35E6k4Cb025459; Wed, 14 Jun 2023 07:18:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=yUvGxWjar6knFmBgty4E7PijHuv9qjsAlwq5V5gjAHA=; b=TSKIjIubwUStnKhD26OJtlvR1LHE+r5OM55UBSm44jyj52YWq4ePWZElibmsFQraLHmb AtAMLSEyvnRfJ+yXfxRFTZ1ccdDgMtDNXmAsayc0sOioPXFkgDuI9wrt14v8VC7Ggldg Gz47v7kBzTVuYDEsaTr+Q29GEAK/5rZEc4+EiLosbWy7RIp+MecyaxfxtU5E1Ifh9Vp/ B/j3DMiPDGrD7XeHw56yK68u3VDQMx2KE1hKuao62HIDx1ki9ddunLQLpkMy1YcKBiiK mKiUY4p8v0mkP3hZDDEafFBdAV+NurIXWfygBuLLRF+ZMDy9QfS+jotTv4I9Hgt3hOd6 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 3r4h7d6vqv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:06 +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 35E6D2Kl014002; Wed, 14 Jun 2023 07:18:06 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2041.outbound.protection.outlook.com [104.47.56.41]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm4x1kh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FzoKYs+iEULsptaNHEd5yG63Sgtq38SrXME79HTQ4MZudvBRGDjbp+WQfXVnKJh34jkRq1hV5brEgAKZkJ4MQdkBllHtvGq8cA2Z2joJ5XqXQvvigksFBXNnxhydSYjU26TkInZkXrEcShWiq23yIKzW0Arx50hQLAsI7DPdrXxWD+n5wtSeiMELoYJ1dmlsqKyoESi7lEkNeZz13MVTAIRqjgCgIICKRlfKX2q9Rl+Cp1C/Cncl6EfADmXd75AzaIfZf3we78gjuliBFE4uepv1mqtPLSAEfQ0OY12FE1nRodW4pSIWWzTPTZK9XQzXwxULL1dzrkvm0RsEV8BNpQ== 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=yUvGxWjar6knFmBgty4E7PijHuv9qjsAlwq5V5gjAHA=; b=NFtxWxVpJ6Q9PWBb9GfdNqpZ7InZ17CG2zZZf3s41+WGWLUMRHRazebq51Vc9oyBJwhhqwGitawpllYGkbdG93C78Bbo1QTvEI5+CZBADONkx/jtT96LMrEr6S/V781k1nspOBQFSwBrHalH+SEgscLMC8S+DfZ+wujJd2AJjgCckQ/WVnupeX7Aaicr1xhnmOw7LCW46LR0Uwti8MxTb68/DRpNgcFiyeR+2OH5VnGe4IcFegQuskjDJXPyAAi9hfV+67EmtPXi6N7ee3U0orv+wJwT25Y2DF9RXxKeVjapIeEX3Z5mCJ4y72XrG2/VrvVIAQ3bouUSRU78+qDpoQ== 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=yUvGxWjar6knFmBgty4E7PijHuv9qjsAlwq5V5gjAHA=; b=XyDNaESo0VIGHMmlbqUOWK+zDU376w/WcRO7B0WE6G5UdtMg26tlD+ICzYzifG4rE4sBdWdhIzpUu4ZNz2zRuZDkDTs7KZlNJj3m6UL0tdg59ltmZLOWyiaAwk1M1zfw969KqGn8BilCQzF+0mQHpgcIxzfidwjFrr3DdcTue7Q= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:18:04 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:18:04 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 24/33] scsi: sd: Have pr commands retry UAs Date: Wed, 14 Jun 2023 02:17:10 -0500 Message-Id: <20230614071719.6372-25-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0196.namprd03.prod.outlook.com (2603:10b6:5:3b6::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_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: 1c5e963d-804c-4902-71c9-08db6ca77e7c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8eUvLAG7jkn15zJXy75tR8TDLtITyf5+vNrUe2W0+1Ww7/Sum+co99wdyL4BhQxygH8gQB/9eU5Dmu8e0sapkTPBWEbs38/aeCGnNbBVZomG0/c/pw2QK2nfS8eTUDSvb3qBDNetA5Xz+FxSa5+pHEb6mL8AxqFLTk9T+8L5Z1i5+OzuTksRvbq/+6uPec28rWeJXoAWd1JQ2ylOmSRdYgsSIJ4p/ZOZxypybYzFu30h16SmlWId25dZOVciXPUnh5GpPrBBT86rMwKTYAp21FxCn7kwRHrB2PDlqo4az28tdB57ewvF+cs+praQCxAkJCeBCYwNxc/8GO7tKVXmdvmACQEUEQeop9RslmYmARWJvqATMrZCnOs2xbk0/Y+Yt1JYBgCV3y5WueGi4LJz3ZHcCmuW/yPjSfOXLkZpRdreMosqvdFvVWN/eCLWq/U4NBmpTCZTNUr03CtldBW8fPhYtv+DRSDMHjHoZM8SWJv/+iZMOUhWVopNTI2OHAOIeijHE1YxIecK5CX5fAm6tlNiRWwbYwiJMCGkqrl0zw1+1mYHtu2QTbEd15bff4Ho X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(6666004)(8936002)(8676002)(2906002)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SpLsdsXoJApKDnFwjMpJ2Ja4qteXsWVZ/Evk5GWXDBUc/PceuAMBE/pZxFVk2AnsRuJ4/YyhwKN/13Gov6LmZCw07LHcPaY6oQemcAmnDfYgfB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h0FPV6NFORu/EH9hFg6Cw2kLz/yzhELuP/jdeaWKglDPC5vKqUDkoKb3R5T0JC9G9g1OEQUncxrlLlpkRncodpdgCf+Bq2m8/NFOmfJI7yTd9936eVEnzNjDuV2UMWBt47GUs0Ifb3AixSulHF4kNNcNl10EU+F5HISBrFZjyyAK/aD5toKWRkxQeytYOhbUg4ccBGtKtKuCt1RubS5U0n3xLP5smsJ/P6Ok6EiAQrL+MeaJaOHqhTP46WBDvmKM00nitpQXjhLykXmadRJrMOCpaF54hOSneEx4foH/TQqPCyza6v48H22P2mmnPrQtB8155 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1c5e963d-804c-4902-71c9-08db6ca77e7c X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:18:04.1486 (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: BdcKJhioO2oFVCLm68OrQgKG0RN28nLJ4wNXEd7FDOutB+b/e7mhEPhKBoudIOAf/f1NBp8iJe5+JNA3pl5nPP6uy1UBccId9cgB833w3wI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 mlxscore=0 adultscore=0 spamscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140062 X-Proofpoint-ORIG-GUID: ItFyUUpiRQRTY97Bn0teMUXVm-Yj6ZNs X-Proofpoint-GUID: ItFyUUpiRQRTY97Bn0teMUXVm-Yj6ZNs 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, }; From patchwork Wed Jun 14 07:17:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13279632 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC9A4EB64D9 for ; Wed, 14 Jun 2023 07:23:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243438AbjFNHXR (ORCPT ); Wed, 14 Jun 2023 03:23:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243202AbjFNHWe (ORCPT ); Wed, 14 Jun 2023 03:22:34 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83E512704 for ; Wed, 14 Jun 2023 00:21:01 -0700 (PDT) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6k8mG015557; Wed, 14 Jun 2023 07:18:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=OjS1bduE9UagQhlQyF/qwLnnO4QqggpSFnKAzNm+lMQ=; b=k/LeQ3PunsTJdiR5LSBeJ0DJx/H5Tcb8iOuqZe0T+E3pVlO6UpyY1gCgdhlNnSqd+7/3 6czFIWmEUNXvugFAlRbDCdBPtGOA6y6Eduodpzgry4RJA4zL3huJccz33FBcOvXM/S27 hiVMk/XeAvbFJ68R/gLIdItSFvf45XZ6IGJM8HRmcr/AZ3K1xOwv19DqAZ5QAReiJlHc 1JywsadsNVmmBJ5aWdkIiqLfKOAprw+OR2ynCW1w7tGy0aJeiq0UqNHryX1NSs3LG+mx Is6DK/7iHbYGp7w56v/wRULWFM271eRa/bNkSaO9XOdyFxezAjK5zduJ6zL6K0SFkdSF uA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4h2apuu2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:32 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E5bIXP021593; Wed, 14 Jun 2023 07:18:31 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2045.outbound.protection.outlook.com [104.47.56.45]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56cnn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cstAWDYRwmmPud8Mdy2ZKIWYXkc7FyHYTpXBrhTbqE1CfQ5aCSbyWXG8jlN4EeelP5UCVTDr5yVyhcHTlxm/M5+JjzYmKFOKx3sjIe3JXueOTWgRiko+GprN4mwQCNWLAJX4NV0FZHAUPRY7oRyu3WqugOzW+C3xEqAlADiuHyQ0CNfBF4peKLKBNZF7LNJybnvC2IWaD9DDP8okABTx9InzANojojt9Zl8CGRAvJ8k3AL4azijEveCBrq+HjInxb+t5bl+AQC5S6hMIpZbO7O5GGX4DVB/zb6wFjLJMeLOGzawqe20DX5qukMHuw8I7CHEN7UqMGviwlagkRTX+pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OjS1bduE9UagQhlQyF/qwLnnO4QqggpSFnKAzNm+lMQ=; b=UosvgUnenUOarUCBtXP3Y8h1czCnxAW/l8zfpoNTB3QuC1mJ9/3c0op39wtg/G5pXwUdAVry7O9178t69CG3Yv2NB6b5G5i1V5QsRZkYoH+Gjt6aHUNJ7PKYUW7WDwhcqg012tEUplk9LdYrFX9lT3344PFC9HvA6J1FCc/rhwDDOHTGQyH5rwUEUpP+ayXjR6pkAoX6buvniUxr10AqVVTJRQXATCebSwLxBJthvNvY/nXXXwRIxAF2Q4nwKCxTcSQC0vmz9DLLlgqWmlTxFr8ndAC6Ng+ZMbSjR5K9ADo7d52jkpC/oF/KIhEvnS2ag0Vfp3WPMnLAg9xX0fT7XA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OjS1bduE9UagQhlQyF/qwLnnO4QqggpSFnKAzNm+lMQ=; b=EvX+DShMDpI9b+z8wblbwIiwxNqcqeGCEAm2LQQ0s0LPPOywNR4iTB3MNG5pMyZp7Zz7Td3WHjwMfkb2d6IWHjKGvKVgw+G6PTAh+EP6EF5hK3YFHGaW8PpK1zp1kpTOYwE0lYAODf721wppj+JDQhss8EkCerxSJaZqEoqlTAE= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:18:05 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:18:05 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 25/33] scsi: sd: Have scsi-ml retry read_capacity_10 errors Date: Wed, 14 Jun 2023 02:17:11 -0500 Message-Id: <20230614071719.6372-26-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR07CA0039.namprd07.prod.outlook.com (2603:10b6:5:74::16) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: a55f25f4-3aff-4df2-6eca-08db6ca77f74 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z7VfJDmhmaphlgC2LljXmqNp+PlJZA9vMBsXNbaloLcSqJuXCcQo8wbJymnD7og7L/T+DLnsjf33fkELVnbhqC174S3RVu53NekXEclAUZ/XE8zKZWYyEcVUZXU68NeuEJcbt3tUmH7AhZcrlvd3SvWzlQzLR225ohmCPU2PTb0414/ULtdc4b61L4Blgwolx/hlOBObh0kQL0v1xpaBqWRInnOMNZuFaGNzT6vvFH5ZkSM+6fTJYMbb03UJwtaKbF94+rbK7kLi5a/QaFvArvooWayOv1S+TnMi/ep1WXXsvObFQcHxnYcP32O7XqZx2WehfU11tqrBvGgjhPlGZcU9AIRsaJhZdl5z5Ipi2zY3OufSIut27XmyeDLpb3PCKyRiyigKc6VbTGMXJnzZLELF7aJZNzsB3SfLoBFfR8Ir7qp4bkBxAYO9avKHH57GWOMg57GTvhzGl/mpYYIHcUKP1dVimyUVJ+j86YQB5wxTm9Z2KbhtpqosIv7De+5jTMCwVg/8r/QGtOSmeO2bjkRz9bLC7+xLPZbBa+hYsc5MFjFRSZO4tYEqsxNlyig1 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(6666004)(8936002)(8676002)(2906002)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Vs+ZaE55FaqlCBU3nIq0hv6pPncg6vpZkICiynTaVltE7ryypne5qmbdSMOpP6+ztxmQwOtA0TjSc00QuiDpst/sLPuGdw8QtsRz6xX0R0iJzs9WT68qM7aBx8vfZNGreWU2WZYA+HnNvhA7D994lP92sBv+ZaMD1JLiPD4dRiI2JAgFOrPWltGL1WRJJ9U0OFUX1gXpzDE7UPBN/HSYyt8JIFxcg2e34w92ogGqOeXjYn4QVcHdUV4lmWRqaMlzGJmgERaqoYYQCL+nJPu35tj2byD0/8PyBaO4Ygea2hg63KjLNhx171pbwvsZQv0PnOevwNXtIQ63aabp7GBHYy2s71W1dAvA7ZFqkBRWyPv7ZFf6J31XANLWQxsK6jE3jSkCT65eG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rgJ2T2kV0MKdweUSU0UY9j9GtEiKYTp X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a55f25f4-3aff-4df2-6eca-08db6ca77f74 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:18:05.8086 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: EQ87irjvxK1+s2zHEtaw1kv09QEZfkGLXrdFct5uDb5rw+tkBuyIfHqlAFbMnVZfLnn3Xy9liN7pX1Ws13IqdNVlxSVnPmTWu+cr8BgWsKA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140063 X-Proofpoint-ORIG-GUID: QBF6LthnTXXoOE0ramjZW0X4rG8NLpwm X-Proofpoint-GUID: QBF6LthnTXXoOE0ramjZW0X4rG8NLpwm Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has read_capacity_10 have scsi-ml retry errors instead of driving them itself. There are two behavior changes: 1. We no longer retry when scsi_execute_cmd returns < 0, but we should be ok. We don't need to retry for failures like the queue being removed, and for the case where there are no tags/reqs the block layer waits/retries for us. For possible memory allocation failures from blk_rq_map_kern we use GFP_NOIO, so retrying will probably not help. 2. For device reset UAs, we would retry READ_CAPACITY_RETRIES_ON_RESET times, then once those are used up we would hit the main do loops retry counter and get 3 more retries. We now only get READ_CAPACITY_RETRIES_ON_RESET retries. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 64 ++++++++++++++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 23 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 87450e14c419..f6f0e483cb13 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2557,42 +2557,60 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp, static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp, unsigned char *buffer) { - unsigned char cmd[16]; + static const u8 cmd[10] = { READ_CAPACITY }; struct scsi_sense_hdr sshdr; + struct scsi_failure failures[] = { + /* Fail immediately for Medium Not Present */ + { + .sense = UNIT_ATTENTION, + .asc = 0x3A, + .ascq = 0x0, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = NOT_READY, + .asc = 0x3A, + .ascq = 0x0, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = UNIT_ATTENTION, + .asc = 0x29, + .ascq = 0, + /* Device reset might occur several times */ + .allowed = READ_CAPACITY_RETRIES_ON_RESET, + .result = SAM_STAT_CHECK_CONDITION, + }, + /* Any other error not listed above retry */ + { + .result = SCMD_FAILURE_RESULT_ANY, + .allowed = 3, + }, + {}, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = failures, }; int sense_valid = 0; int the_result; - int retries = 3, reset_retries = READ_CAPACITY_RETRIES_ON_RESET; sector_t lba; unsigned sector_size; - do { - cmd[0] = READ_CAPACITY; - memset(&cmd[1], 0, 9); - memset(buffer, 0, 8); + memset(buffer, 0, 8); - the_result = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, buffer, - 8, SD_TIMEOUT, sdkp->max_retries, - &exec_args); + the_result = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, buffer, + 8, SD_TIMEOUT, sdkp->max_retries, + &exec_args); + + if (the_result > 0) { + sense_valid = scsi_sense_valid(&sshdr); if (media_not_present(sdkp, &sshdr)) return -ENODEV; - - if (the_result > 0) { - sense_valid = scsi_sense_valid(&sshdr); - if (sense_valid && - sshdr.sense_key == UNIT_ATTENTION && - sshdr.asc == 0x29 && sshdr.ascq == 0x00) - /* Device reset might occur several times, - * give it one more chance */ - if (--reset_retries > 0) - continue; - } - retries--; - - } while (the_result && retries); + } if (the_result) { sd_print_result(sdkp, "Read Capacity(10) failed", the_result); From patchwork Wed Jun 14 07:17:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13279634 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 019BFEB64D9 for ; Wed, 14 Jun 2023 07:23:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243442AbjFNHXU (ORCPT ); Wed, 14 Jun 2023 03:23:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243251AbjFNHWg (ORCPT ); Wed, 14 Jun 2023 03:22:36 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58C341BE9 for ; Wed, 14 Jun 2023 00:21:03 -0700 (PDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6jxrH025387; Wed, 14 Jun 2023 07:18:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=Z4l0y0WyOcdKSv80swwNM3UbRKwigIdTdoj7ieGgWLY=; b=Mp8RVF+jOS5QMlfvMFNIW4BVkIg0Bgz8rZ4OO7NSqRaGyAzWE9foQRCQrD45amNSG+/L BeH6aGDSMQpOcmrTji3rSqz33oe/7gooCfT9QJZazSYeO3ZoS43R2G7AxLJQEDOxHdNq /NmT50K3MPVu531xSmkWRGnyntHbesWxXgFLA7lcwcPqh2BSwGPu0bJwAXBtQ1pE9s4C TfqDBWF85vBlzEsTMIdnCuX+zPSR7sWKwEBYyxH2jo2S4TPP6Hdc6dyTvJDcmKqW6dkx jh5ahPCk8R1GF+nTotsGz0J65kG0oRAu9OLc+91cxDyhj2cR8O3TcAfRnpL7LJC37+qO mw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4h7d6vre-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:37 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E61KOF016307; Wed, 14 Jun 2023 07:18:36 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2177.outbound.protection.outlook.com [104.47.57.177]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56q0d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KsNWfvwYaRxdDF15j3ujEquCi/sTURfiWezchdm9MtovZWl1lHQdx4G7iCsS9iOlaEOjy+6Hc2hrbHvsANp9ZIOzGN5puTZyDu6fg5A4vGsaEMCqpWShEw6uRnaosDvMeHe587rQ8pfpDONcZjtNRqg9MkjjQwBtEeGsKGuEb1omT1BOXc4GHOjfr0z5h2tvhJG16tIE5cOKI0339+lnBp9CL24cmd5dXIbRyXMAYfZUxUI/PjuPNnQ/VpFezf9S0slgWzSX7V0HUrzPbs2/FhJ9xrp//YU4fTg7AIp2ZbgQcaRhkgXoxeFa+sg+5y0afUZSjbSg6aKIILvhLYRjug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Z4l0y0WyOcdKSv80swwNM3UbRKwigIdTdoj7ieGgWLY=; b=Lhr2AWHMIBwEpno6WqoSpKv5KhFuJ6ReTwMeD40Kx9LNp5Jp3aw25G8F05hjCdmP0j5aC/cv3/3dR5gT62e34eNFRakIs+Dwkzy7c/c+rGN2M31Q0n3ngsKCRv2Egvr0fPUk7AMBmbGOui2EjyOOyIYgaOMPB+vBkIZhd9ZQQ+D3rTZQR0oK7atbwmkLTqFFTSvTkDGASeeud7g/zEc4y985V3CmXj7mUtQYzLNgF1VRA5+hDwYrDBH/BSAIqe0AATSP2PTXEsj7YO+/lRyFyHe7Y+6BOL4uu3DqcEsd9y9JhMFjjzLnUyBTWWe77mdef75/9kMv0Sb8Xr04JHJRlA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z4l0y0WyOcdKSv80swwNM3UbRKwigIdTdoj7ieGgWLY=; b=HdjCJNAn2Z7/2YwcFHHv2KQLbBH2IpiKXphMWBOV70K8P+QVMIVZOc/iey02htHSHDWEwmVyIcTYymFa0kPBOJHkjfYbBA1+oInLa73gow+EkV/tbdYAfB9g1hUFkgeUK7gwVhYQ6Gq/A5WbakWdFjxDrXbiQ15DgeOMITWFKpc= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:18:07 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:18:07 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 26/33] scsi: ses: Have scsi-ml retry scsi_exec_req errors Date: Wed, 14 Jun 2023 02:17:12 -0500 Message-Id: <20230614071719.6372-27-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR08CA0042.namprd08.prod.outlook.com (2603:10b6:4:60::31) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: 7342d7a7-c6f5-419d-5834-08db6ca78078 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Otz0aqo3Hdu1p7SVWo6u+GaLOfW+Qc5QSGdmLRwc0WYS5Z5Gd7a6VmCJZO2V4lu8m66C6Ugd9Uecmwtfk43aIaAdsK7RRrVitVCLsonJcGWWIgckMGXG6s1cnidFz2EC53k7o5F5YlFWsfq4WvzXEihJACusaiLWLVEPHLxrJaPYlBXoe1ifTHxXlLwDXonASwlouAt+79VIWJWujwQR2K6R7I96SSYw1W1Q4+8Rt1T862mxFriUlPSGSN8js+SiuooDw6hF0rwJP8cCWiyXPEDB+3htF2kd+jXhTrWqrSX7M5qodPdAhayhDNt6Yzl1mYweEPnSGsz2vbfEiqKBFY45xforJCS0PGIL3SZmB9jgzZe6FfueCYxkT2QuZq7vZxqJr/+gXPZoiHGrAgjJX4M44f+JlXf9DZ2p8TCJefNXSqJnldTE1FLG70KKf7LWQQzcm3+C1L1xCC9mw8tzpK5sVSnzHGKpcji6ZfjcKTsNM7ilZ7JWT2PobYDgdQPIP973mytxED7SisLhQF6q58oSwLeJsEC23VyBi54z82bGkZAb/lTXeI1GlqZTYnn3 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(6666004)(8936002)(8676002)(2906002)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-A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UR3I+0e0g/bDVcCCI9Uo+fKHE8Y8emQBX32sgU64ZLjxCwF40pbqRYMyKPeA5lBrsRTBOT56uOrJ54g939+H1saiNqYQE2YRaS9dXsINj7RmTsdv+Xujl4Extr6X/h0zX26fmPGc/pknKDH71AfGsP9vPu667tnP7m73Xx7SZUyRWla5VlcZ9u6I9n/xZCJVuHzra2H6HezCLhePHx9Fbq0RdmaTTNDdfoSnuOSnNhJTVYhO96Ewa3FMm3hCZy+otSXPxI9wXvCzV3+fedtPrYgQt7L32ccpO+LlOo0s8Lz3TDChTScHk1q+akLp45EXQG0BfBUC00nLSPZBjY0zmV3qFRI0frr0UgIHreXiY4w1KTSrsPW9KMWCTeNeRj+lzOeg4s7cfWJi/zkZsw94+xzWg4rgJjTCt195E4cqDVv4r60RNOGVPanF6o6cIXxXRaw5xhXhn/p5Nf2+2ro6g3rFkZx28/ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7342d7a7-c6f5-419d-5834-08db6ca78078 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:18:07.4870 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XEmZ7qY8zAVfF+HN+oGdEZsPLWOUfQM5PwHSuI9e6IuztcmWXab8CcaUGY2iXI6f9b/NefRzhYSupQxSKc6Ce5oCmSAkatN7X9Aj55LAa7o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 mlxscore=0 spamscore=0 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140063 X-Proofpoint-ORIG-GUID: S6sRwKjXogHQ-o_gc3wgC6KtA5oxS4I0 X-Proofpoint-GUID: S6sRwKjXogHQ-o_gc3wgC6KtA5oxS4I0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has ses have scsi-ml retry scsi_exec_req errors instead of driving them itself. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/ses.c | 60 ++++++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index d7d0c35c58b8..678666ed9cce 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -87,19 +87,29 @@ static int ses_recv_diag(struct scsi_device *sdev, int page_code, 0 }; unsigned char recv_page_code; - unsigned int retries = SES_RETRIES; - struct scsi_sense_hdr sshdr; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = 0x29, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = SES_RETRIES, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = NOT_READY, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = SES_RETRIES, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; const struct scsi_exec_args exec_args = { - .sshdr = &sshdr, + .failures = failures, }; - do { - ret = scsi_execute_cmd(sdev, cmd, REQ_OP_DRV_IN, buf, bufflen, - SES_TIMEOUT, 1, &exec_args); - } while (ret > 0 && --retries && scsi_sense_valid(&sshdr) && - (sshdr.sense_key == NOT_READY || - (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29))); - + ret = scsi_execute_cmd(sdev, cmd, REQ_OP_DRV_IN, buf, bufflen, + SES_TIMEOUT, 1, &exec_args); if (unlikely(ret)) return ret; @@ -131,19 +141,29 @@ static int ses_send_diag(struct scsi_device *sdev, int page_code, bufflen & 0xff, 0 }; - struct scsi_sense_hdr sshdr; - unsigned int retries = SES_RETRIES; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = 0x29, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = SES_RETRIES, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = NOT_READY, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = SES_RETRIES, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; const struct scsi_exec_args exec_args = { - .sshdr = &sshdr, + .failures = failures, }; - do { - result = scsi_execute_cmd(sdev, cmd, REQ_OP_DRV_OUT, buf, - bufflen, SES_TIMEOUT, 1, &exec_args); - } while (result > 0 && --retries && scsi_sense_valid(&sshdr) && - (sshdr.sense_key == NOT_READY || - (sshdr.sense_key == UNIT_ATTENTION && sshdr.asc == 0x29))); - + result = scsi_execute_cmd(sdev, cmd, REQ_OP_DRV_OUT, buf, bufflen, + SES_TIMEOUT, 1, &exec_args); if (result) sdev_printk(KERN_ERR, sdev, "SEND DIAGNOSTIC result: %8x\n", result); From patchwork Wed Jun 14 07:17:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13279635 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 9239EEB64DB for ; Wed, 14 Jun 2023 07:23:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234327AbjFNHXW (ORCPT ); Wed, 14 Jun 2023 03:23:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243254AbjFNHWh (ORCPT ); Wed, 14 Jun 2023 03:22:37 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 897771BF0 for ; Wed, 14 Jun 2023 00:21:03 -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 35E6jtwc012000; Wed, 14 Jun 2023 07:18:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=9kxRL/3L5818INNUukGlChZwr4J2ylT0aO7E7lH0wDY=; b=EALrADZazRIC4WhgxD367+8d9JHvQeTS2EyZqvYkz3u2LOZawN1bRLzWXXgbjfhN0XId 2r5XF0yefs/hGVCuEH7O0n3TZwNpcjPa0JTC/WcXPKWjDa/jswQe/vIlVhjs8ZAMZcPD Qdxz/fUIbTyHpqc/r7p4OJD8PGuojJGsVy4gqY79rHlBsF5DD2734Ta2C/ereLjzdLFF NMb136qybynqPSpgEVtJg241KBTAYd6mDcUnDGnCmFBgGlE9eU3UXIcPNO+wr+nIVZ8Z tkcWBQm8AgPNNhf3YQWRFat9lW26iGMjt9L4EAiiAc14uJ2HmeIZEO9U16AulSNQusvI 1Q== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4fs1xxww-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:34 +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 35E5bIXS021593; Wed, 14 Jun 2023 07:18:33 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2045.outbound.protection.outlook.com [104.47.56.45]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56cnn-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gKa2r9OTU1Gaf4LM/agA4xtrgYDKcR43RC+pP9dtpi9tlRudOVFgJNeJ2xZ0SQYwoe99NPN2AdugeZeOOfppyj41zk6j3BAw50TgaUBaqw+LHdhUYAT4O3cM+/j6LQ8esdrXdr14A36gTwWfgfKXnGvFZasUEsRNYR84Bwmgu5zqSmdLAJt6qI3tsv/JLzKyDU6fUVc++8cjE/eTKYPJ06LHkuknpPCsABg0/BBlM5CsW2ce/uOMNPNCagTrybyQHZ33ep+KP470Xv2bLO/z8Gw/p4KJhk+cOBGTsSAhOISDiclooK2htedAQR2nvtnapMWremcO3keYDFVBVUQy0Q== 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=9kxRL/3L5818INNUukGlChZwr4J2ylT0aO7E7lH0wDY=; b=TWF1TLjSk8j58AeN89K755Hrt6Zc6/8hna97Xwp3GdtGMtrgWCNEhGfenZK+/lnopFulSMMwNMq6Ws7IJDdiyisXFiBm6G1Ew/iFAFYdy2pDzI7J4qSSasSB2JNUFZUyOpE9on4CUS6mUEALLO8jj8jJEPxWfkosecCOoqQSToJpbeuO+qHYEPb0gVrap5JWKRIpVO2S88G1rVTAS4PrsQ4ARvEOIzFs7DGnI1xhTZHsJzscFIetXUmhuL8S6h8FvI50DmlDrtIo1A2DThRDcycKA3tCV5LrpoRxlPhP8hVYXuJfbNRNs0D3ylV5jHTUPVuNG9rvpXVi3bMTAwLwzQ== 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=9kxRL/3L5818INNUukGlChZwr4J2ylT0aO7E7lH0wDY=; b=CdsP8RExJMRaYGhaCly3PwVHHBCwASzVj4tjEmkcBYcz8EcujZBKdRtSSdkV7231FzbeXnLPfq9kBR+5pyJ2SBZdvPuvP4DcVcmc9iaVkoE18Pt2lxfi/Tda9si1J6t5CitH+S+f8/09cPcvIhlGkRFmYd3LmkIrpTH/8j6+A7s= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:18:09 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:18:09 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 27/33] scsi: sr: Have scsi-ml retry get_sectorsize errors Date: Wed, 14 Jun 2023 02:17:13 -0500 Message-Id: <20230614071719.6372-28-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR08CA0027.namprd08.prod.outlook.com (2603:10b6:4:60::16) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: e2891bbc-92c0-46e1-4186-08db6ca7817c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z4BEsudXAe5GbP93uyonLNkThIsKNFhu5p2EeC1afHxEVpbSZzUPH9vr1P56eQnxOnnUXmPYZVaXHd96Z3n7dElMjzN6yJ87RQWNr/BUJ7t7uH+Yk4899IHmmFUN51oU7nXMW5CwdUQJi2B7fu1FApIy8cV0KZ7W4HMzwp2Qq/p119o9CpEzlKfxrey519AYqXoPvXdjR1RKgzh4Ri5dWi9vhrxrBnp6qZ/tL+pQzYJJDqQQY5KW2/EJBZtFZjXDMcxxdUHSOaWXENTs5aXbdcPkWYolQoywfxyXgMUvoY2CU04ix3MAKlQM0sVo3MIMLQ9Z4snxKZZu7ryidnrGTZCnFaX2m2wTkCR6RKD35TIBkQvzXsx048vvlQwtdeXC/d5MeQ+XuZH9bywTi0aGzwNzjRImqJdQ6CojtReCQVR2prKxVGZ+JLCTuXA0ZwT6H+hSIyCsRha5/JTygeGj8UzfDYqgbHpGwHuutQAmwDfVwZhj7un1kr06ZmFknO4gdY3dRKRnHMrPs/nWVeZxey3uSAUd2lDZ4dBAQJbN/tjlWwQ+h0SJ7nktuY0GrFwk X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(6666004)(8936002)(8676002)(2906002)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HkpwIIi8Khml1NOOWEpv2sYuCgrh238mMShoAu6huD4J1qzGqYMsdGwK9/sx8kSnx9tP8soWqg4Bfirh5ENsRA4YMw3f+cDXmZ3/QD5VxH5mtoKh+97JZOGZywvRWhSIViFRf6Kmulr1morgRb/yuhU5I0CPOYaRcCTbnRlL+lplgyvqWAL4fKmp7+ag8t05SSbSBEdPGeVwKarwyXXhuQGblY8c61FqqNV95CKC0kfB8Q+g1fUTXrf6IdsZc6YzJN6aMqUte4mjlEqSpjPTuG+x8274XAgUcn2QqiK8sCymeEFY4EvHtFcEHcG2Pb94YQ1l4+g8++eHdfKsItrf3k2qnypk8lhyDg23YfELwYnGTaiVJj0p5R4S2wzIs6Ka6IVT+00IiaVMdEck/Hjr+/3zcd+W5WjRUXjk+s14TV3WTk04aRbW4aXoXnyazTcSrKsGswT5AVOCtelfeVF1mjnEu/7a1rI9KeFZlWeyx156tH1LaXvNybll0aI8Xioyq4pRQKRrB4K4aSne5DpcZaL2tKPFlaXZRt0SQNeb5sw5Kls+uKlrUJZQZQ//2dPHgM6qdrFilWYWPs4oBPgl4UEPyGviDCCevEq9qbROoT/GdoxP1knztn0oZXrSYg0DHpnpeFropZ4pcahfkj9eBlGO3+Fzg18OlrFzCR/Yv0jyX++apJh7B1v9ClCMixLK/s7u/QqG7RosIVZ1X3ZGlpjQDEgv7CnAUnKDMCOy6EvMNP7IWeuT19eAtyiM0sMJooeQMxd93li2CGU5ma44ivVkJAatrPPnssshdFhEEJQgJja32z5Uzcd+O/7uwfQQLqALN2ZyoXJgivIxnAtiysAXZBU3iXH1tQr4SJykn3iJbWZm/fPl4yINcQvrDdL2Rhg0twKSAmM28mh0Z/HTNRdXkws2FaR++6ps4SqJxgGj2piatz2bpfyFZBAKJnI54ZcfXpY2lPumxlix//+JqmXVXR0LImlURrRyc2Dflzww/mIa9Ea1B/8fS/Hx3VDShSEnp5wiL1fY09djHXW1SXSjj33IT87CTVJHEo2wlFmGtW/6cbYwxuZefmuCPLRnMCFMXIJVXgB0TjHEZvaQVYb3Sr4vmUrhv6CNCdPMsnEHMVhatSvFu0rzPbJ61UDogs9UYijNYn0zEz6qet45fNKzh+qaNZUCj3WqH+qxF+SPsgblCWRIAyGqyZlzN/S4RZjWvPMZQzWvmHaKzhsU0IvMg0iXj2t8yp0Teq3mJ1LbdGl0Kq+SGTybuqL/swzu/ZzEvfJF42teDW0YpUVJq+xk4fr7uhEajuACpt3KJAUAcSk3eUgjqJrBebNTGnDTL6lXx4ijFS0m/0vUiZeiJwP48xp3TQ2Qbyd0EpsvlfxzQG8Ev+80qf7jgDDCVe4Qcfsmhbvw5c11taBaSPopEjNzAAIiyHyanPeYPB5jZ3XFfUnq83GsrbDUX39jFdhiqPTyXW0xW3SuTl200qgD4jkCjHU5xAefyDylAuEOqsVdQA8XLL9eY1y5xED+tyBqbllEx4232qdcfW+snn7kSLSolTBlQqC26cPyO6LSCvl+ecCKthnQsN5q3Gruu/HIF5Q+ghN4buUPK4t/N1eS2Q== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: gpPHUbREFl29upJT166rK+25n6xt9zvECLcGHH1j6eMANlLVuNC1v6U2oXmzKdwV39FRvz6Q21wPVexKzb4Py+ejjK0Gn2iK20/LtYPNg9XcRoYPHnFcWOEux5kLSnC24Sde/d0pjLssSAl9b6bjLLas1Z57EQk1VzkRNB0YaJfqeUhmXqCyoMvRZDDx4LMWtqyypdT6V98wdf1867EO76NR/kZrccjLiZgOs41mWBoIRv7IxW8xXAkYr3Edz80igSyygELM27C6seWlpI1BPvNjgwb7EZe3Z28gGN/I0ULqnMRaCFxW4zOuMPzge7yhbSCqjN861WCDH15n+orlnTj+3GTnRY3xQ/Lzt5+BxuSaRgMiOWtc7NFWSVLpCUsoheg50q4wg2DUBQLLCc/RlWL0rx6LsNqpKwEbyTfgksXT490xyZ2i8sRKdvU/B59iFn54Xa2W8Y2+tD4UeyyWdBS8njiOlr9etRE9YwfhVVRelVJeoMSqonL7f0cVr9+DoFYkU1mlBxq2OsaPyjpuQdWu5CT7osdE+0sTzQOb5t1CEpS3PCYtQOZVXXRdKWQ/qZM2Fb4zWimTNoPGBAsXogSrIZn8y6QUrlSw+w3WJSR01HDzHRWFfbcBTw7efcMlFmOf5XMqegQ+ADRCjUwfzWmjMhRaGcaijZTrFvnS2oaP/B0Zvp/xNWdU4vw2aI1PiVQzdRtbHvqJi0Pkv2skNThjCoCNFgCOl72plw21lLW7WHb1L7PCk0Y4+JTHxSRyWEvccaCFVRgkmKRoDgzjNgxfRVLqh5CDpRwaALLHFtvy2Mlnu+WQCYgKc+6lLTi+hi9OTDYXv26C0nMg9HxkmXMcqpEK0/SY7FJN/+hzA+9ffgWs3TBKnU13lyeURMCl X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e2891bbc-92c0-46e1-4186-08db6ca7817c X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:18:09.1734 (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: Qo6PhXv74AueTAWhSjd1wv8bwSakNUIITwdqPZwccZMqMrLk8WMnjORFIV617TLEwCJZzFzj/eFSjnuthqMWLf/WVcd3MMOLHCB/7EtTkm4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140063 X-Proofpoint-GUID: yi9DdDRI_QxHJtN3aAXWuPtzd8-Lvg8H X-Proofpoint-ORIG-GUID: yi9DdDRI_QxHJtN3aAXWuPtzd8-Lvg8H Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has get_sectorsize have scsi-ml retry errors instead of driving them itself. There is one behavior change where we no longer retry when scsi_execute_cmd returns < 0, but we should be ok. We don't need to retry for failures like the queue being removed, and for the case where there are no tags/reqs the block layer waits/retries for us. For possible memory allocation failures from blk_rq_map_kern we use GFP_NOIO, so retrying will probably not help. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/sr.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index cd5b08689c1a..e572700e8338 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -716,27 +716,26 @@ static int sr_probe(struct device *dev) static void get_sectorsize(struct scsi_cd *cd) { - unsigned char cmd[10]; - unsigned char buffer[8]; - int the_result, retries = 3; + static const u8 cmd[10] = { READ_CAPACITY }; + unsigned char buffer[8] = { }; + int the_result; int sector_size; struct request_queue *queue; + struct scsi_failure failures[] = { + { + .result = SCMD_FAILURE_RESULT_ANY, + .allowed = 3, + }, + {}, + }; + const struct scsi_exec_args exec_args = { + .failures = failures, + }; - do { - cmd[0] = READ_CAPACITY; - memset((void *) &cmd[1], 0, 9); - memset(buffer, 0, sizeof(buffer)); - - /* Do the command and wait.. */ - the_result = scsi_execute_cmd(cd->device, cmd, REQ_OP_DRV_IN, - buffer, sizeof(buffer), - SR_TIMEOUT, MAX_RETRIES, NULL); - - retries--; - - } while (the_result && retries); - - + /* Do the command and wait.. */ + the_result = scsi_execute_cmd(cd->device, cmd, REQ_OP_DRV_IN, buffer, + sizeof(buffer), SR_TIMEOUT, MAX_RETRIES, + &exec_args); if (the_result) { cd->capacity = 0x1fffff; sector_size = 2048; /* A guess, just in case */ From patchwork Wed Jun 14 07:17:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13279636 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC9ECEB64D9 for ; Wed, 14 Jun 2023 07:23:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243254AbjFNHXY (ORCPT ); Wed, 14 Jun 2023 03:23:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243325AbjFNHWm (ORCPT ); Wed, 14 Jun 2023 03:22:42 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46E852707 for ; Wed, 14 Jun 2023 00:21:04 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6jlbm025270; Wed, 14 Jun 2023 07:18:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=4/Ia5W0WVQq4f4aV5B5uZgO45zDkb5N17gJb7mkbDlE=; b=0IyQIXGOCREAd11qtGMx+lXW7bRUECOu1gz/LFVBBrHy8BTAEjy55rUdxK8otn2R1UTu UEr0h1b+6zdLhOlimKSFxoFKa3AgnleN25tGP9iZ+GljLv7YWgNWkoWuwo9LnFdpHw/m 0YvvLVnV6B8/89lERlWTXQTqU1cgYtHYGNk3dgwr4rlKUehpspj1HQ4cvmjg+3SSP8KU 8vFx95pn5JYlNlbgIlgN20c8zRznQErj51llyoKQWVWiuHnC8tT3EAhk5LSjHHRXJSe2 6zZ/nAX3blbJTA2AzfDLWYoYCscQ32mN5MufUJcbGP6zQxUfn/UnYaNJFgyfBjfk3gAa Sw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4g3bpyut-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:35 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E5bIXX021593; Wed, 14 Jun 2023 07:18:35 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2045.outbound.protection.outlook.com [104.47.56.45]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56cnn-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lOiuz23TDr/bxp22hw1FlYbpM6efFSA3E+GXo6O/15nI+eNbS9xk5NuroHLnSvkC6YV3agwZza1eJAvbmdUsNilnQYFi7BvOxrNNwaxewnHpmCAYKOsZuj3Uh6YGfyEu/iIwBV/xRoQTlKkGC809b9Av88Wja3Fhnmz6bBE6blExxnrOLo/ruoiD+H7df+JxqFjAyzY7fLuaZqIZBDyukdtrCDCJYPZUd/Ov6TK76wWhXpDPFq24v7wH3UScZtWeTF5c65Zu0v+9FSSR+6VrF49gNrSyfJiCk0kBzLLDyNMI8Ls5+g3hsVu7S5Ur3anpJEwhGButcrt4jEJ7fu+WSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4/Ia5W0WVQq4f4aV5B5uZgO45zDkb5N17gJb7mkbDlE=; b=WieqloxqK3kCJHZ0Mt7UW9aR12nEhbKxvGgSwhjnwXgfe15Oll8BoNR1gnCI4AIcZ4AoFftQUqbe7ESc1LpNYK09UKCGKe6b1TPTl5+oEM/FhBCKBXcat1WAgd+aopYe3QH3puf6moxUX6H/SjT0GXN1QpvmSGtXoLFCIP+RJeVWI5RVOAjLq1s/Egj8S95qJ2XVwVbQe2nhRLpBEZ88rkXqym2HBdLgOqunnVjYJmgdQd5JlsaaI2lFTV4XHuX2m4TjJVF56D7kJb12CCZKLwDQMRuzBCxMWuZ2cbFX0IehfRDwCKs93YDYTsZxR7sTZ+NZ3JK+7l0cZenv+/7eXA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4/Ia5W0WVQq4f4aV5B5uZgO45zDkb5N17gJb7mkbDlE=; b=z7mpSQy4ZY1kpw3Xiwgh252+7FkiuY8gdjbmIDHO0CBU4PmoIZaUqC7mFjpByY+eKUfI7+pLHukS1nSYWzXO7W1pX7mzC42N0q4zNFhzo9BPo90yVPMYVhyCKdEvJcYTuUWPWaI9sciTGExVU9wiWKOy8EO3fzhoDiiu4OJ6Zy8= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:18:10 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:18:10 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 28/33] scsi: ufs: Have scsi-ml retry start stop errors Date: Wed, 14 Jun 2023 02:17:14 -0500 Message-Id: <20230614071719.6372-29-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR08CA0033.namprd08.prod.outlook.com (2603:10b6:4:60::22) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: b48e7c7f-5b6a-45c5-dca4-08db6ca78252 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qjv10ULQ5D3xQ8Tgy3f+tRsMClUhqa5GwN/nNLWTEwKi08VjCuaZujexFRBcxzxbg25AS2ocMCOB5amIpqyLY+YciaNv5XtBSOMWvBKzk1mLh6gyr8HeNzW4o3Cy2aWixeYsEv6IIW1Co5ub2jKu2McSfhzZMMH7uD7QHKqna7kPNvYG3o4pa2iQG5ihAJIB6B26hRQoIKixBgMSiDAgvV0t4jsU73vihDng4JzwtwDD69oj2LfIofbBOwbLqSByw4T6PlEeS9bkMv8H4JH36v6Nv/k02rglUZ4oHJQotMVxGNAAIt6KvS1h3MepOzOfg5vjvddfqPfTYBCR+Gf1ejvmaDt99qWK72bON6Lk7YrehKXWv86qDxjQ7YmuOfca2Pdzk0snVc2RvejHUJrvpqPlRHBNH0vDaUYl+mqS1BSUJL59pA+moQECr7RHHdDGAkOG3Lpg8DlrRwXALv+5b3yBmb7aDli6UoEVkn6bm9OxHCdP6zFkwp6s+XA88Vx+RI04dAMFmCXcLzhg4mMi/7oJj5uYvY4S2b4jI0xlbpJda21C4yl4fs9zrAavE1F5 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(8936002)(8676002)(2906002)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qgaIeiR4GTr8JQWPiNlMujkE8bt7OufMG574O3luADV1jx8PNJHyPQu38bMtaV0dgY7A4Vp9EaZA6JJcIiaTKjoPhFSeTIE6njR7PcWZgtZmELbhrjIhnfPQxWAwu5rUWfF4+xV7tUQUdF6fO2Hg64HfVYECdQYeYqxUapw1egwdhqOawsBm0v7nzPAsHNGNv39ICpzOVrt43XSAkezdTWqrKcKgIVe+R2jYFG0PqGYfhOfvoS9AmtMkHaiNyVioEToF0L5NqguvE8sn1AHvVkWQ7tUg4CEN24AlzwLQtB4sPlZoLcEk3i6CZ3VP+QDfleLMZUfqg9Gymdr/ImxJcbTULCT8GV6urP3ehX84B0LTczuRkE2UXvP8jK1L5X1fqFhbx9Dho5pnHFPx9a91hkQgyWu51x1O5jUvMZaYUx+Y4lMlHXU1lfSkHmf2hKN1ND+Y6eEbs6j7JaQSVOrmh+j7A5K+RiBwdErRH/epcIW+Ltc/DepdVdv36fke3u/Umc2atb1/FR3oV29x5WKLcPFB2bRUs54b5pb2gLgxSCbDbhZyJ9KywVvR+aE5OhEFtrrxyOWsRbYeY3w0fpU07QzEMhsjGisZQ9IJFRbWJMHKB1PpmcvCoTQ6Hr/D2sdPxwJHAsx9YgwlVs9EriHJ4kmMZgyGhMYMI86a/opXgx6BB5zcnYFjvxHeIYGuYuOHjcPBL/JgmHTtfEJGlieLeuuqnVYS12bW33l/9nKWuvurhDrf5/Rl3L5/PiycM4oj78DALzy6tLKFNSNbH7AL4qATK8ByMkaCzOFvO9/gxKBYPDzsTFgqoq5JH/6GJhG7WWTiO2Kdn1BvNlvzgJUzDQ47nj2acjQDtnVhi/kVn5C87zEYdl+hu3lmMw7RZICELp7uQGC17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7ex+4nQXTT90ZLGOSXyp+BdyqmtFQ7ArSG72wtLgL3PdXs/4jkx2jkqOtzkLr1aehSltnF4hTLZzBVNyiwBoZojNCEtE8397H1FrBPaOJpoTaJKrU9l9qlG6hjZrD6QCqkQzv5Yvjr1U7+TqGX8DeK+PTeHa6SUYLvQG50kxDg06JEwqSh0tU8x9g+louMs62UZSzvwFc1opOfPMre8s1/bwa2wykfPOy7StapT7AggAsFTbQuSCm2kf3rMuijkTGLxbQ637ZtbEvgk24Q8gG8Oc499MAy6Q4niWbynJVulfH9IHFz0hr02zYh35dVuxFjGm3BhdwtIqRyMsjPGJGWGEWmROYwoE90Ljj9RYtnFF3+4oRkMDWypmnZr5WXvapF0BmONtH7Gmcv4ab5nNmi0TzItvui3T1f/Fb0Mj/jnP9FKk9ib4wY+J92mu7kiO2cYtMhMMV45jmCNrz+wPjsNs/IBkr/J6EpmHT/tcU29gHEee41xkvZZtnXZncmtrkpyQ7kuvtKkkys/owTnC9QZh0aCjHDBZcTkCzWQqutHOmGHGyk2b642HVcjVIFJ+VGo5rus7HI3vMm81rJEpzDaqY X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b48e7c7f-5b6a-45c5-dca4-08db6ca78252 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:18:10.5974 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eGC+cx+avaAQJ+QHTpx+XsqG87FHHLE32pnlDmwuDxa+CRNrpyUBhrxTU1s1sMBGn+/FpAWdcOZTItLwiT/5KaAwd4EcYGIxn4T7EFozCJk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140063 X-Proofpoint-ORIG-GUID: b0JrBQ9igFRo4cBxonAbn5qeNBkeD-hX X-Proofpoint-GUID: b0JrBQ9igFRo4cBxonAbn5qeNBkeD-hX Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/ufs/core/ufshcd.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index f2b3abafcffe..66ea125f5e7c 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -9284,7 +9284,14 @@ static int ufshcd_execute_start_stop(struct scsi_device *sdev, struct scsi_sense_hdr *sshdr) { const unsigned char cdb[6] = { START_STOP, 0, 0, 0, pwr_mode << 4, 0 }; + struct scsi_failure failures[] = { + { + .allowed = 2, + .result = SCMD_FAILURE_RESULT_ANY, + }, + }; const struct scsi_exec_args args = { + .failures = failures, .sshdr = sshdr, .req_flags = BLK_MQ_REQ_PM, .scmd_flags = SCMD_FAIL_IF_RECOVERING, @@ -9310,7 +9317,7 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, struct scsi_sense_hdr sshdr; struct scsi_device *sdp; unsigned long flags; - int ret, retries; + int ret; spin_lock_irqsave(hba->host->host_lock, flags); sdp = hba->ufs_device_wlun; @@ -9336,15 +9343,7 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, * callbacks hence set the RQF_PM flag so that it doesn't resume the * already suspended childs. */ - for (retries = 3; retries > 0; --retries) { - ret = ufshcd_execute_start_stop(sdp, pwr_mode, &sshdr); - /* - * scsi_execute() only returns a negative value if the request - * queue is dying. - */ - if (ret <= 0) - break; - } + ret = ufshcd_execute_start_stop(sdp, pwr_mode, &sshdr); if (ret) { sdev_printk(KERN_WARNING, sdp, "START_STOP failed for power mode: %d, result %x\n", From patchwork Wed Jun 14 07:17:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13279633 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 A3D0FEB64DB for ; Wed, 14 Jun 2023 07:23:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234661AbjFNHXT (ORCPT ); Wed, 14 Jun 2023 03:23:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243442AbjFNHWf (ORCPT ); Wed, 14 Jun 2023 03:22:35 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5899019B7 for ; Wed, 14 Jun 2023 00:21:02 -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 35E6kNZE023133; Wed, 14 Jun 2023 07:18:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=JLU7rFNEtQKsVCDOco7IV3BGt6wtju/2xRcZHuehrcA=; b=WxjnX275QLgoxUb0XZOnw6PcYWNJltb8T6yM3sKASIEsOkQhiGrHQKhqoWSqlz1W65DD wkZTEFKSnybIVDw41BvWfku6hNhpCJDW3RPrRfkEOIe9Ls1PsQzdlnU0mvMtY8VzvYMS /Pvfq5vjax1mgrIM3DP/Az82a2x2yS9Dw3zO1mFUcH6MZX0D//HSBqUtQzQKMS75BIRx aTnYOPeSsCzMArMaeqxiLKnv54agokb6c4v2SYLHzZmnQRfq0y0avNCg47Mo+lKxuxV8 aCjl8vBEDSoGK88Nd0ThomXhuJ0V8REeUhzTWI4HWHz2Bj3DFdOJRLH1ZTTn1kg5j/ai pA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4hqupw8p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:36 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E5bIXc021593; Wed, 14 Jun 2023 07:18:36 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2045.outbound.protection.outlook.com [104.47.56.45]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56cnn-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JyZksM+rLTKmD4g3gfmm0bilVbaodOr7QxiMKdwH2SXUaftLKlTFaaC+TKcbltMDfqw9gpoC1fbyeK4h2IsMgVLVMiYUz75GtLe/qWCXxA1Os8iBnco7ZnFVOVcLCJGSe/7RVABeL4Rdr4QbzkXJTFteVCQgK88sLza8vd9I+pcpCATMgFlahcNohRhRANyWuarr//E/sIJVymKowBQMjyHy+zRQde066vGNaAw90ZHsMv7kzmXYZGfFq3VuHfh0z7zkO86PGT9GfrIMmAUgitPVfJdRP2RwARHpB0fcVpRnDIL3+pz1MEjJAQETnLC3kLVAqMFmxKVZlsrkhXaekw== 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=JLU7rFNEtQKsVCDOco7IV3BGt6wtju/2xRcZHuehrcA=; b=QIesYgZKzu9t4G4wdj0OaygSwirkemw+Ze8QUEoW6JdQeUsS02GJ+fWptXyFJGXLCRTgNg7DcjLyxFyTZyH7rLLN/THNMtFCZrz2+9wAwNDqNHL7LPjHOmswv/VTKR9ogSzXOOwdnjn/tLTgRyOgJ4by9bbZFFNj9MX/+mFaDm354L/dQLEtPPEkMA/nTX3w66m6l8lp3JNMAhH9JErVx79gAyPsa6FU0S1labZZQQ51++2CqVKzZM1/G2yPs0lVIVJTflVy377mf6vvLESYOdmOp2gRTmY3k4o+HB37UvPE0JdG8iHku4aTruofnN4N2V9OJwtQkP6n4ksuVIfaUQ== 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=JLU7rFNEtQKsVCDOco7IV3BGt6wtju/2xRcZHuehrcA=; b=WJ6dOddfRa6neyrQja4y8GBhm2LO1pbqCXJCi35bM3WNj0T6+sb/+gmEStP9z6pEXwhpNPE9TbCR928kQc9P/6eqXt3jrhBgnj6LCG1Fm/tZ3EuVWQApw0ZUe52L4ap+m+4n9GQqzX6yspPc4b9ujqOY4D4o3hsBvdIhqS4ekBg= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:18:12 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:18:12 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 29/33] scsi: Fix sshdr use in scsi_test_unit_ready Date: Wed, 14 Jun 2023 02:17:15 -0500 Message-Id: <20230614071719.6372-30-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DM5PR08CA0033.namprd08.prod.outlook.com (2603:10b6:4:60::22) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: bb81f597-6955-45fe-28a2-08db6ca7833a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oxq4ukao7eLKGva5HqsecKf+TFs+5l75u+I5n27PzziZjIWySLFtS83F2qeX19ePQMXLZAgrahkI7fvonyTDAh2mwOqjdwH+HP8ncdW4/OAqxsv1TDPmCZs2rQ2Svaa8WiyL76LNYDoz7FoxWd+42xE5UukqlhLoB2VVOoTuZV+stVE48Vdq1qEUEj8uliYLKutc0kONXPdESK3hKBjkx4pFb1iPG3KmpAEu3WLOEu8uO8tbiVftOJij35wnxaGiqjzbui/osYUTFxvBpuFpnTPQKizwI28vmGElXiTIB7Keb171COCFH1hz4JPzqDh4tYHTSyxo8HBXEnW/llhyvOZhc8DERQ9ePNAh0De5hT2mbRUduGM4/NN9FpkpnfIiHUBtAgt9Cuw3Mk7dCjkTcnLi3hgwgwOEnOMdW4JxiOnzJ7l8Y7EwDJ3N6zU9qAsQ2kRqVrHMg4barOInpYsV2OvvDzlvIIzywUDlyrQzTWuUlTunujUKgDg9Or0dEyaTcbv6WvQxSIrOQ4zuEvTUV5Vek8791HrK+xaucxBzwo83D9utWDbXYs1LcapNtJFb X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(8936002)(8676002)(2906002)(4744005)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FZJPuYDpPKpg58/Pn9tyDwH12iF9kHArFpzjibSPyHo1eSOZqD8XiAr1Vi/qr2OUHVlbUbJh1/JQRlZ8Sh64+3gh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kAgmDZd9b/aIvVCNokd8BlRtVCu4DctqgL9Fy8R8HOUoDTjoBalmTqo+pXzKbBiGDK4tOaaQBKi5VAMvYWclE/ISflHNvNHNfAk0ixjnUJf2igPcRnNioUXFrSNjR8JaP3fV4HVai442a6vuNAebBknt+zibzJ9vA7bJeFdTpFvgqN0HJAhjfArwUWIqAW/VnFa3qQ+cm5Ypn3//rYjM27yJfQOuXt5cBmzlMFZVybF4u2gfmUk9AWcLb8dIsZrHZzqj3Q52Nv1Gn2RnU45Aj2P2EZTWrr/oixbeJhs1LHYprMdhO0mzeJezdWKd15y6g0uabJb7DljJRjakABkWeG6utuX+RiOTdQZznuFs918s9t5qJj3Yo0AonIta5ug7WaBAotDYlKZXGiy7BLX9ZX5aQikD31cptNHklFERuayySGV2vEtIipzF26LWq6Qa+oL+w== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 1DvF8Bq316obTClkvCfgL00861wWAJJSVOWk+AwHfRrvg75UzbDxgZOL1aPcuyk8kGvrWtDwi3c0rD08PDmbNIq94bf1CqOjrHKRXbZjrhPSLixhxfaggauRGwlu9+1QMGtqb59TrKTDIzIgDxvAuZoMMdLN82zrcIHVhkWpKuzu7lvqH3iSnRe9CrpdOe8JwVrPWnzOuIeANrXetvXsHp6lhBLCuflHzhdjHAFaRFcNBAvknBr8sXea2wJpfxlgWFzT+pHniuNOYr+EAobWi4ddK6bYk8v55VXoyRln+lLG9Qx9e51huHMzjW6Ybcbz2s3x19kRTn8n/yKU0+N+doHqNOQQvEslcw1vDXHJSzjin3RUXVQi45HxWSNoxVQlBKGeigsbhjd+2fUE7HiXgXtEGRlrJZbLzGpyG/OyDK4Hxhu2ietsQwUMz/HPkrZ4Zy2h/pJo1GyeQBkdFlhD+n1XzYg3cXgRa5LyeIIjex20+Gw6+d6t94m2V20+PQj5i85cHjCssDIbWEctPCsQebDn17PDB9r7+DhrX9hSAJbzNnLv1+DEcBr4fsD2xxSxxouLbVehd2y3/Ptwkhh9AdklimPPyvG2aeiFyDOTWSi/lkC6GQSL8t18pXjubHgon5+/SPiUyNFlPUMblnJhh4YBk4ioS171UTWO+DJKiRp6NgTCYp+Vvy1FXZbkX4oxxKlBQdb8pasM20Z4Q2piBhW0OrhrDiVVWUyNZgWRnoKFPy9pFKcE5qPXLJkkUgE0FFltGOJlME4iXh5v8gqP3r4yiqpKzinM6X43b8fi2VT6Hd2PhIDW003osfBZPp0zaTvdgQfqvXxfKs6MojF10QKb8I8Zpivx9V+1EgiphK5H/rSi/wjwwN7DsL9qxmHh X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb81f597-6955-45fe-28a2-08db6ca7833a X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:18:12.1272 (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: /XCV1QnIRR/EIjrqvM8z3zWL6TBLWFgkou7vxA/ZeBwUd3RdHYwzZpyxBi0UnZ39jJoSIZmpeyTEI4hRaqeSKedaVxXWPdgaXPnqXQXFxYA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140063 X-Proofpoint-ORIG-GUID: V2f1glBAfi9KsE8FIGUZMQ2lBqw9ovqC X-Proofpoint-GUID: V2f1glBAfi9KsE8FIGUZMQ2lBqw9ovqC Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0 it will not have set the sshdr, so we can't access it. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/scsi_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 0d28920d088c..f57f928f267f 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2319,10 +2319,10 @@ scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries, do { result = scsi_execute_cmd(sdev, cmd, REQ_OP_DRV_IN, NULL, 0, timeout, 1, &exec_args); - if (sdev->removable && scsi_sense_valid(sshdr) && + if (sdev->removable && result > 0 && scsi_sense_valid(sshdr) && sshdr->sense_key == UNIT_ATTENTION) sdev->changed = 1; - } while (scsi_sense_valid(sshdr) && + } while (result > 0 && scsi_sense_valid(sshdr) && sshdr->sense_key == UNIT_ATTENTION && --retries); return result; From patchwork Wed Jun 14 07:17:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13279637 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 1F5A2EB64DA for ; Wed, 14 Jun 2023 07:23:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241271AbjFNHX0 (ORCPT ); Wed, 14 Jun 2023 03:23:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243451AbjFNHWm (ORCPT ); Wed, 14 Jun 2023 03:22:42 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B58B2117 for ; Wed, 14 Jun 2023 00:21:06 -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 35E6k6D0023018; Wed, 14 Jun 2023 07:18:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=Y4k0njxw1hdTy52GV5HCgvJiyjKOUrWe93X82nTIIaU=; b=fj/h+U6bF12gpHJeb+nT3v8MGyXRPunDE30NHOveahr+Zu8XGu3CBZ88nnpRuoMMHxGn qJ5cF8Se2PJRhX3ptlP/rK+415FOehmkBow5UnQYE3stKG3OQtuEqg76zVm8avKsU9Z5 SZZwA4idaFOBRKaWJx9Rx5mJrADo8tBh/64NT1IAH/6ha/TQqMPffiqqgFMkRTe59Scu /WzJT3g1gXg4/QtszT1zwCPdptQi1zuBoNpwHfIQKcH6hYUQ17MnzV62ntBbrG0/iWtW 5bKghWWLxldAKoRLbwuHX952L7wcmMyrkCkpgWmZEyeuFL0JbiLDsDVO1FbLbaLv9D9F SQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4hqupw8r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:37 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E5bIXd021593; Wed, 14 Jun 2023 07:18:36 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2045.outbound.protection.outlook.com [104.47.56.45]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56cnn-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P1g7kCx2Biztm0WFAoXBHzBLZR5IHaRDDm78OmjY+zo3uGh+NDt+DznNxyuinx81n7wUzlJjGte9uJ/i7JWczJ0ACJOYL5HKjbeUaxLeAn+0mI1nBKyfx9PkNS+/ELBA2xZpWDVk24OMB3ZwYkRcT5gMlAEkvySX8yXuaLLkmHy9C3hp1Lt2a0CJ9/+4kkI9shGKBemWW6rl5LGQdBZkJCuJQyD3acenm/rXPtb1XrVU3snMh1K0REjQ8y2jyD9odmUWvL9xMzGT4/b4p0bt2TryYdXVzrU2TSpLLHwyOShXmdsrV9rIbZ8LhrmEkqy8x5sawWOLHxvslieo7aEfTg== 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=Y4k0njxw1hdTy52GV5HCgvJiyjKOUrWe93X82nTIIaU=; b=O+dmyXJf2TuYVJQh/0l5DnRzisUBI1Mx58PP/L7K0CDSoHtHqWo37BA90B4kjvHyE8rkIwMWf0IUGXH7hQOfvYnNTVId7mfkbLJDMTAhy00o6PBfYDKe9vpGNrX4Tj/6mp4BqD1D9pznpxZP48Q+LHIl3iWIgk2UAzIV2GwExLiTSNOKQDeiAPZqLVpyQzw13/DOqA/3ouLJ5BfVVv7Hho4D1ovEYBeFlfsHvQ+RlFp7yZzwlmrrCYdneCZKko0wuck8G626DqS/wJUWfR55pySik8jkOBrhZHMziYCDQSujh/dQynxt1ZT5q+iejQDq8GCoEoTYBaycwglTVO1Ihw== 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=Y4k0njxw1hdTy52GV5HCgvJiyjKOUrWe93X82nTIIaU=; b=zvXWfn0AUXLvkI9r+FqyGJtTZyt9qpmuk/Jgx+ed0hTtzTN5SNINDZEGsYvZvc6e8ql2rhflK4AZc3MZp9DNpxD2sPc5e7mzxfo+O2XyJijSV9rYlzSXZvKIlxR2+w2B+W6nqSdvOdKmV5cL+nkcsR0Ds7DrkpcXzRgEKjor5Bk= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:18:14 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:18:14 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 30/33] scsi: Fix sshdr use in scsi_cdl_enable Date: Wed, 14 Jun 2023 02:17:16 -0500 Message-Id: <20230614071719.6372-31-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR05CA0098.namprd05.prod.outlook.com (2603:10b6:8:56::8) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: 34684e26-6f86-4272-fdbd-08db6ca78468 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0caJWhulXBW1kSTi7i2c1CV0bnWO4Ep4jBd/q/+7U8WkAbBYvPByBMMEeLmXCoSSakIPE3ppZM/iXTXsmEfvG53J+ZvxpC0XahpuxIsEaeumZzwHNKmF761NgIcioLtec+zw7ZfxM6eBWhoPhiE81nLcyNL4HAZERrmZYf45pzaAh2axEZOdSpY0Hb5SxU8KAMf4jjW8faCpcXP4hdubmy9T1RE78T2ykHT+dSjsW/QYOwMBeijCu+7ovG2VaIEAmq35noJ8hZE3kW+RVOR/5QgV73z46jgix/8dgRBusp/n0H4/My5mW7frfpB02SRmvwxzIoejR8fttvEnwTv+KfsPaPRVluIYVewZD8LsGv4eRt0PZvFVCfZeNwYwMwbQAyzZyPxocpobzBSXjMaK4fdQ57VCDIcbaq5O1kf2QVVXtqmlxulMAQsx2fNQFf3iALaIdH0wObNNpyN/yd7OlVELoXm8VNQGqg0kDNnvCk/lkwAJXchT4eym2L69JTgguvt9W0+TAPv4LgQdyFzAJ5jjOT9vAmitgSQZtnhTvi9t6Ehv5QbxS/m/54KHXXsJ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(8936002)(8676002)(2906002)(4744005)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hx0im/60F9XaJKzPIilajGO37SwLCko91LZ8HEraMMJ+IZcM1KJwWiPHwHfLEzrxBWu+nX6zAhJggr1xrAUEYMZsWSOZuX6N1Z3ZDtx3QeLflCnrAwvWMVR2P+yVLT1PUuz8sOIY5k8L4puo5gscPEDs3C9ZHRcfvk4aS2GrgJoAwfXNkvljxfUURX2lYjU4RUl+q3qEZI0zVB7HYfLFPeZifFdcOYPCiebiBow6bA1JrEZJgpIwf7ndjb7xopbYWohmcuakBO531B0cvYqrECiurRN1rOrWGu2pZd9U5O4q8R+9TdYOuUEiTXTDH0T4ewRmxUAG1TZLAL/14huvVhIEeVwJdJRvXMsa8I18Fw1XIumcIhaUvPdE7SgOs3LdbN09eIT+tCJz200e9zL49t6lytpqmheNqNa1wARY7UwPIVyQF/rqYNXIlCX4/dHBY4gNw0d6HWUAULC1mSR8pkEBRvOyo3jsPAp2d8sAv5VJDPm+eiisw3AORyJeBU/dZfixz8ydpdusqoSZ3v5ixTAsVbeGkNl1Us2sVXkyS4ghy9LT7B/5itP+GXGZLfhbiXBnRMHOIGtJfi77jZQQQTYnjRFXtjMQMvyuhpO1TdUpsW+sdFOzjLXLt/Di63OyuB1f+ukwse/iXS7F16SPFPhf1AqdU9MbjPNhx+Z54aX9YsZWYBaykQit2hacDkLyh0N01UJAYK6sIBKP+fhMDhPi3Hp6/lI9XEuWYE+lazhz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ainVVumH4cIo+7Qa8UFHg5qj8iJc6kcvMrYoE7nI2dZBYf69E37FVfMIRlk3/f/iVeXu2tgcvmRfZ3SlisHpsIsdc5cxMeZVehNZ1a02Vu883/aLSUGEfmhtU/VDQ1W6Vq5UKBvl+66TTi9g8HNMKzApXb/YooquMHoK7/10D8QAxrk4Z9CF8Hf4SQQNv+zQXBvRXqlgO9kicUAkcDAjjkiqsmjb7rpmA0R/n0HJqiVDBPxM50uBBkuVj/gZOMq7E4mAI1xPwAi+u1vYNiMhst7+wIdtQYMow+3YRqJUmz1zSzu2BKTO5PP3u/qqkvMSuswV7e+3AAQw5aPuP9NNRyADtemw4WSrSQ2Dmfhn/9XIJ/InJ6Fa0guwy+MACjZqk1/FCmFlsfuwlciYTYz3jFfG+Kcf1zrinCx6z8S53rKXFdD29uCVhB+eLkd/pdzoBVsMD9kWIPkZDED3PaIn2liuO8vwHmwxY0g5ONDzs3Se1o2TEgSuXIG8rDcTFzbiUJ+5WczJTHGyPtiaamhlqu0n/GIcZ7OdJUwuHkMOWlvOT+8teNmrBRV41sgBkefHiSB5Qk+zblX6nkMeGA1zpKWJNWN9mmBLAcztvl0gUQ3vC3v3XWpvCICMsRAPjV5k8Oy2mj3ekj39ZQoZIjWDPVkUsVCud9EZ2b/CtuIsQtCJQnTJWl3QeIN6Z7yv6fKs/IGFPK5bPpJwhGzxsFoTGVpTmXpT5duYYfegGrctZBxd0s+5En1dV5HIPAHecbxd+A X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 34684e26-6f86-4272-fdbd-08db6ca78468 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:18:14.1038 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +U/qQees191DCP9WdJ6rq83HGTFRCLNf/rPiqvrvl1VSdzEtasO93N8YCnzQDr4VYpF43cNqY3hcO4mJ5UPwDo99bcWeyXuZRLjqaWc7KaY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140063 X-Proofpoint-ORIG-GUID: 2tfaSGHVDrk9HXS6RL7dJHS2xwXapsir X-Proofpoint-GUID: 2tfaSGHVDrk9HXS6RL7dJHS2xwXapsir Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0 it will not have set the sshdr, so we can't access it. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index c4bf99a842f3..92bc026364c0 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -701,7 +701,7 @@ int scsi_cdl_enable(struct scsi_device *sdev, bool enable) ret = scsi_mode_select(sdev, 1, 0, buf_data, len, 5 * HZ, 3, &data, &sshdr); if (ret) { - if (scsi_sense_valid(&sshdr)) + if (ret > 0 && scsi_sense_valid(&sshdr)) scsi_print_sense_hdr(sdev, dev_name(&sdev->sdev_gendev), &sshdr); return ret; From patchwork Wed Jun 14 07:17:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13279638 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86538EB64D9 for ; Wed, 14 Jun 2023 07:23:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243462AbjFNHXe (ORCPT ); Wed, 14 Jun 2023 03:23:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243328AbjFNHWp (ORCPT ); Wed, 14 Jun 2023 03:22:45 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90734211D for ; Wed, 14 Jun 2023 00:21:06 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6kCOH026738; Wed, 14 Jun 2023 07:18:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=qGzPE80A/pbly1s2+Z3bS/c7JyAzYtwjTGARwD/R/zU=; b=WKNn3NKbj8g90jsVtKz6HgXDS93r2zy1EUv7qAcKQgjGxLaepXMFLgWCg1zV/KrUolRB xA3dVjLB78p35X8qVQlQrmzhgottsbPaciPK28l7x2Hp8goV1k3ZEjhjpH13M76ppnlW INiFz+jpna1s7YC4LdbAZgJ1oVavh4cuIzUUbUdAWYl2hCdzbBkpBMpOC+pC3em7aHw9 VfZ9ttTxpsPywNW29Q5m21ZqWmyvDjra54GcgLG6RbxPuJFjP1GRCouSyMTipvbWsIDd HsCtxyZJfPTj10wk8SPslTCRCXpyfW7Z+JH4X7zt3ufD7JS0cT3FaOlYde/uS2EdsXCf jQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4g3bpyv1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:37 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E5bIXe021593; Wed, 14 Jun 2023 07:18:37 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2045.outbound.protection.outlook.com [104.47.56.45]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56cnn-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dPSxOftvSGE5tsoFv1YNUvIig2d2O/TZTyTDDD+KNY7wC9rXfrSB+BIFmnGtyrsZTm+J7s1sowIMb6uMXRZxNhXPPbOWol8cILasfoyxYYpY1QW+oaJDS2fgcU+sIWNmTwtsGSVO3xxsUB0X/Z7RL+GYF6bv6SeE3TXCP6ayWhk/X6ZZqFbhO14eVrOqY9X5Y7Xr4BbthVFn7S7rV76GjP7snvz74KAp/cvp/FErY72/LVPyYy/opQcr04Mg6v8B3Q1M4Y/RIwM488DzsOXok3eLOmjmiCMcp6kjJBF+YSeawIXB/n/syLJg86dQXVl1JaiXWRyaf3Wtfji3Ix2ltA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qGzPE80A/pbly1s2+Z3bS/c7JyAzYtwjTGARwD/R/zU=; b=Vjp2iDnFztwhAwtVnVBCg0BoFrz0L0/6qq0pVBL/Q4vT9nfgSNn9i9xcS+f4LFhlc+BJb/+a0/gvE1VVccV3mHCU96cV0zN9HqAjvnETEvw/ZrXJ0nhZYBecZlpG0G5Ad2T50kS02mFOFf5DHDRN5DzHYun1xNAuRlkshtw0CRCvQ0U/586vSY5+WRfhNreSMX2cLknvkEHbCtrkiaN3CZQI2hRrv3S/rKnuqYhF+6AIEXS3QXKHtT0HdfTcteXbF/aS9Dvc5iol7yFbSU64F5ZsBvjs4xAmq3HCIzrF+0qrpDZG8ppbiLb39dNWkndrMwb2z5BygMANBg0LGYFqAQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qGzPE80A/pbly1s2+Z3bS/c7JyAzYtwjTGARwD/R/zU=; b=pT/ayDyxoKzsNTLuldpL4+Y0mpuRwEr03oVb+BGGGGTOSC0wak+ABD/pUASMNpufUI4HEH/UueIUIihanseoWzq3qLHJGxcX1Lkp+eR5FC+/K+ActC9Vdl5c0sLWwx/xugtt6tBYC4Pxd79ydru5+RrXV/j8CH+w/hjMVfjYA9U= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:18:15 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:18:15 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 31/33] scsi: sd: Fix sshdr use in cache_type_store Date: Wed, 14 Jun 2023 02:17:17 -0500 Message-Id: <20230614071719.6372-32-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0152.namprd03.prod.outlook.com (2603:10b6:5:3b2::7) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: 9ebedb45-2355-4346-e779-08db6ca7854d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KEICzqpln3f8V9T61MFO5ONbrwQSJDYSSBFpb8EtAFRswaeEYFALyPLcfIeSH/4FMVDcife/lsvVSy/ziYdL8OpTDXGykpeonKyiEfSET+JUPOrCQqyvHby/qxHs+Vr3NizyUdOAPrsHKW9HEgCyT1ocz2nLoPbKRK+BnHLgQ8jgnwDtqRSmhdqzcZNuRH4DK8rduJ7FihKPyDvjx1qngpCks/zA/awZJz04dMSHsUMOyvTp+A0B7S0lXf3MhaFffbDuv9RJEdE0pKowe9oUuYViXXVioiErUBVMLyV3dMnyJcwHzCAsQomNMSi6vWc2Sc8CF2DwcjaMqqzwI+AkH14/CGRvJq9te0AogKTfncH+Kw9jzS3zvAsKgG9GM1uL20oguQHdMozcPydCe9aR5OShwfPmLa8hYfqw4uayjydcwxYta36BYorAEqBSO1a7JoEdYjN1/0+uvNF/jEhPDHLmDQFLKyGD5IXO3kPgmsNZ6Lf2Gdk8J043pkARMFaCX6UAhLdnhTULl7y67Rzbb7+s7SGujPgG61AJgHQ4aH4BD8o/A5W1R9IJv1R7T35m X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(8936002)(8676002)(2906002)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MidZS0sdYnn+G1+zkyM+teL3b8Oq91GKFaMUP6Dc2jsiXwsa9k7/2ctYoZK4HVocRMatU5I15UnatV7mwlC7lZs1GSHTGlesrYjE+0pePb7OUNwA5e1M/dDxkLIziphvB8lXFBn++LN0DPDLj1/l5djjgYPI/JtZ3NjLj5p+0Jaxj6/KFyORBDinoj3WuNz0OhmCk+X4Yfl+YCC4wd64LXhSbShKF9B8+RM91Kn75Y8cFCIaGUb3X1Xwi/k5Conm4Ag8pCCNTJl6AcE6a8Gb96YOcV+Ngv9ALD5FFckZ/7U4aU/0s6/J5y1fqJgxT7ufQQu5NpiPTTuEWMVqbOmMyXXmdRiQA3kGg0EOsNGjIYPbVbNRK6TJcpSX8/yv31Ynm7ByD43TQ3tS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hwxsbih7bYr4SqaD3MRhdqdwEWK7oDGM4qGkHU5uy2x7CehCyE8T8MTwptblg X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ebedb45-2355-4346-e779-08db6ca7854d X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:18:15.6111 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hLMiax/+/qPQ6sp1//ovuR3158YJH4VqTfYYZtUxHIxRKrkrFO0TAqbq04HWjNfZ3svZ0qAOFuQr0mytWX6HedpdDtGL2hDMNrg0rQjeS1w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140063 X-Proofpoint-ORIG-GUID: ec6vd4kLVG7HnrCgL9gQI59i-kvPwaVy X-Proofpoint-GUID: ec6vd4kLVG7HnrCgL9gQI59i-kvPwaVy Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0 it will not have set the sshdr, so we can't access it. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index f6f0e483cb13..3f3b7dc818fc 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -155,7 +155,7 @@ cache_type_store(struct device *dev, struct device_attribute *attr, struct scsi_mode_data data; struct scsi_sense_hdr sshdr; static const char temp[] = "temporary "; - int len; + int len, ret; if (sdp->type != TYPE_DISK && sdp->type != TYPE_ZBC) /* no cache control on RBC devices; theoretically they @@ -202,9 +202,10 @@ cache_type_store(struct device *dev, struct device_attribute *attr, */ data.device_specific = 0; - if (scsi_mode_select(sdp, 1, sp, buffer_data, len, SD_TIMEOUT, - sdkp->max_retries, &data, &sshdr)) { - if (scsi_sense_valid(&sshdr)) + ret = scsi_mode_select(sdp, 1, sp, buffer_data, len, SD_TIMEOUT, + sdkp->max_retries, &data, &sshdr); + if (ret) { + if (ret > 0 && scsi_sense_valid(&sshdr)) sd_print_sense_hdr(sdkp, &sshdr); return -EINVAL; } From patchwork Wed Jun 14 07:17:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13279639 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 D1D17EB64DB for ; Wed, 14 Jun 2023 07:23:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243344AbjFNHXg (ORCPT ); Wed, 14 Jun 2023 03:23:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243343AbjFNHWq (ORCPT ); Wed, 14 Jun 2023 03:22:46 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70FDD270C for ; Wed, 14 Jun 2023 00:21:07 -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 35E6jrip021343; Wed, 14 Jun 2023 07:18: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=7UfUmSlaq3YZ87JquXlhlTelvNGCUYkhgITvv2FC6IU=; b=kEx6cLEWRa74iZMi7xQ3msH2GFNcf2plI8PxLC3Jxh/uE+V8d+aQpI1egntvOQrH4dau PaDHezyhGhNkuYuhbmtWwHUDnJxZn9Nm/BDjE0vo1pbcFJX+u0z3iGX71pxVLUIAl52+ lE6btxisBHxTSuYyjM8sP5fF47gQ+wMXqdBmI3pz7DGBH5xq4ZHgjimUI48KU6mH3H0z /rwhqtXWDYpfzKHTnoWlfCeDLTe9BSFcIoLkU5LmOFdSlA/f8Nn0gwoWzxNkDjfwD5EA J7RjKgomLGjhISzdL1UUjuQw2ZYgVJoxV3Co+X2KnMjKYoPYUBcyNQVfqVdzwdpfxhai NQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4fy3evsd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18: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 35E61KON016307; Wed, 14 Jun 2023 07:18:39 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2177.outbound.protection.outlook.com [104.47.57.177]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56q0d-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gEOalJ6wJb/+zolrk2Srv7H3lR6GwoSp76bcVyjmYJyK3PpB0EL1dCFQT1WPVCfcwH263xzYVO6P1pAk9gSbc4/PC0nuw9TOtEPGSf2Ofr3G3/Q2FOQ6pm4FFLswqYRn95/tXJ2TXGL0+tBHaO7Y4lbUqgHs7yea6Tqtxd1VPkDWdXV/xqMFmjn0zINU15YatYfNpxJi1c5ayX1Dvs+RdQrnE61jqLkdSOYOJrL7kxRETKs93acLNtZLn4TXUr8D/NRNKap/kzBJxMG3C4FaqAl4sz7Mdlo7BbBoLHE7p0aEQG8QtgU93q/ttXuufZg+PCozJLxMTUwieQ7EhEEFjQ== 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=7UfUmSlaq3YZ87JquXlhlTelvNGCUYkhgITvv2FC6IU=; b=OJ4gvMGj6hW5jWr4L0lxKS9hF3iURPJoxFeyWLLG2Nv9vt3CTHpWbm+S5FgPI52uCveXxGwwFA3ob7CphIv7M9b8EZICXmbbRi2VPydueBICkzSoFRSPKQxkH2mm0UE6YnZE8wjBOkJ1aY62L+BBkAgrZarFNPjoyEKkqmGTAKZHAPiJzG0SGaqwRI/mKYmPUCRB8CKlCeEww0mGpmG6pw6wK4HYLB2uBRM9RRJSEugnq5n8Xb2xy1UTpmNDR7ZX9sm2CrTCgelo3Xw1v2jXrt53RMynNIkAOVAD7MHtlemRLgxll2ayz+5Cr1jbWG0SOGL6appTA3YThQt42RHhvw== 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=7UfUmSlaq3YZ87JquXlhlTelvNGCUYkhgITvv2FC6IU=; b=kGka5apgeKoJ2/f5xByHRCD9uymZQzXJh2FFQiufeKmmvXqas/B4btdWSJmQKxFNB2msmcoW5bmSYR9qydwUn1x5yBmDUtduW6uU2+qbCN+5o3LcAfhOovKW1m8RucGG83niqlN3DubijceO1mFA1oUYg18e1Dc5yXZKzYY7Dmg= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:18:17 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:18:17 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 32/33] scsi: sr: Fix sshdr use in sr_get_events Date: Wed, 14 Jun 2023 02:17:18 -0500 Message-Id: <20230614071719.6372-33-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0167.namprd03.prod.outlook.com (2603:10b6:5:3b2::22) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: c678e915-13d3-4d58-336c-08db6ca78635 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7NjR+whon6d3GggMiMG8ZxSPyGZEYJ6FiwGl9rBizyFBTsU9Qti6tIaYmG8Rt18WDGQr948uuHEpK9ZAivvaxlWoyuZn1JCTTrs/M72KFoIB0QJmtKZMQ/wUkMM+oY46wag0mFl/hvmhieckr5a4EZSF9+6pqBDigCL6X55Cinln75ovVKppjojJ6ZKXlrl2Zi8+bJugHQVXQPCl0PKbd8QhDuYiD3IJzLDjVyXxKglnJ4WyuDWb1W2SagpqvGfahaSb7vK/XZP5wv58/8ao8QxWIU1Qz7o7z1E6StnMFbpcAnhfnbmuWZPGE0FjSE0E6AV7S80H+hM9U76C2icinmXKrR41rHBxXwCNmvHWD/qT2TM/TYkLpr3qg2VzABITCFqFaQOWhfHZ3+vFZM977eY5X+U1xgbwnhoWdGDOuYrAYduWzZLvaGKi23pF+5uZa26YK72ma1CCAnmg8qZBgOsVugaJWmhZQEToM6slepx7duTl0aamb7XWyH6X/LOHTMivAaruzhVIecjk6uTJX5UskD1k8R9Xgw/4NQEvIYKcstjpERN4VZ4/BCtd/677 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(8936002)(8676002)(2906002)(4744005)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dQCpbUGsJWpFTFpY2vVNYiWsX/vfOF3xyAuDKpGhXM3XQBxvRz/1KEj6xcAe2CNEyo2i23h5zgf3HenWorWMt3gl4RuSzmvyeVLS3+keZCwPQ5PgmfgNhAPMdu5BXZZELCbYxBkwNAAcpnxpraxFUjSZCaBs5kZ4Vj+kc7VgpvTtNxDduMv6XOQRLI7o94oqbJMo5GuNg9RTk6tMLZVmzWaLjNRSankdcsd/S0CExXuGigDMtEk/dDPb09JIMu5yvIL86siYnyiMBEmwgmc+mUvsO+1P0qub5cM7m296g2NoSMn0bLAVnl46HwpV3ttc791mGCDFkug6iZIT7xcIIHehdmKzNm/xS173tp/c9bpIUzoC1df5ACmgKHUqHoAyH+athxQJJuLiWw0Z0fcSenFiy0yooXeFXnvFfMgv/aze6hw8T94WaIWBA8WTHvpRApMy2Gg9iz0wTZ8wou80FpbWL1jknuTldiYQJPD1bycTngEmlap0EIfmXYlqQCAuMK41d+yl9iITWwIj6srlQUOpbbYCnqElLm2rqDQrrkr8NfG7MtKBamuN14UDpVxUsXxzO1hX7xihPoi3V9Ycdv98fHWonfyuhUSVntjXeiBpsDWnNmosoDY6bMS8MoVN0QQT1flUhgEjMKDD2b5cK1Z2fL93rAmkXwvSErNVuFg/xIcDjaSfntKeo0WrdnR4JwpwS4G4cGS2DZlsfcZNDBouTG0L0rGSck8GMGoK54Xjw3k0Z347YrkI2p1OJAdlubrwKcIjOMNYmoqiQRlq3BdIyR3Dnhhcbc0UxUenT1HtEL9yS//p1fOWxsS3FUVUqocXKzQNnSDtcTfbhLreaPr2nSlbKwqXNGBDhkjSPc05Z7NsW4SN7qqdV9KpKoB1OQgZ3BJGa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NmD7ZD4oHhWCV0rIyFQMu7r0/RGMoth/XgVVjBgyb3/PtPFFnzZ1NCzmVBHlRLk7KlxaP57WBGoM9DFVpu9ALIBbxVzBEVdgAvx46LWKqZdbYE8ywuXR+TsZwGUmA87I93hG9zoiGgqFPOLHxfrqIiqxmDLeZjjX/q63cGtjxY4gY5YKXDC2o8qAt/1HpbyKq3drro07uXEToOxge+HivXZJs2H+XKgyYxkTCFGlS/4XrxC1A5l0e0DvuTAtKqhQw17YOieyDNggY1p1pTJyYfv3VdCVGOC3Q3yNWgGIPQvWYecW5jRpRfQ7w9kxKWE53M6fvWdDJ75ObAK5nsEkydGeqwKvoqr34bOMgqHALE1VypITuXe5y2xM1PfCABTX3g9fDuXICSIeDBDoyy/SNc7s2SjYryh442l/AVA2lagAmk4YTVnxlIDlh3O6CUCKwI6UM5dCvSeoq10wNIs0Q99KV6Uoqcvvq0k49pWMuIAjfmOaqskKkC9A0A1E2k8ml1ItCQTuQn4y8bio4yTmkfrQ7jq9Ti36xlT/DzInkQujeFfQ7idR1Z2kaDcc3kBpawXBInn6oeQR31z8l3D1HbAzJ8scwaSOayMe X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c678e915-13d3-4d58-336c-08db6ca78635 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:18:17.1116 (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: LRt2le+1hlNLMr2mK5y16gZBBV13IaOBq+myOf1wzmXrjHFzVbjjNy6BcGQgqsRQ4QfdO7I0Q30i/+ii8pDuFBdLM3ydAuf4xX3ux9oDkco= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 mlxscore=0 spamscore=0 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140063 X-Proofpoint-GUID: AhomA05xi3QY3UeLfBtWZ3-iR51ZrI3y X-Proofpoint-ORIG-GUID: AhomA05xi3QY3UeLfBtWZ3-iR51ZrI3y Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If scsi_execute_cmd returns < 0 it will not have set the sshdr, so we can't access it. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/sr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index e572700e8338..e77eeda89156 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -177,7 +177,8 @@ static unsigned int sr_get_events(struct scsi_device *sdev) result = scsi_execute_cmd(sdev, cmd, REQ_OP_DRV_IN, buf, sizeof(buf), SR_TIMEOUT, MAX_RETRIES, &exec_args); - if (scsi_sense_valid(&sshdr) && sshdr.sense_key == UNIT_ATTENTION) + if (result > 0 && scsi_sense_valid(&sshdr) && + sshdr.sense_key == UNIT_ATTENTION) return DISK_EVENT_MEDIA_CHANGE; if (result || be16_to_cpu(eh->data_len) < sizeof(*med)) From patchwork Wed Jun 14 07:17:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13279640 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F4FDEB64D9 for ; Wed, 14 Jun 2023 07:23:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243349AbjFNHXi (ORCPT ); Wed, 14 Jun 2023 03:23:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243337AbjFNHWq (ORCPT ); Wed, 14 Jun 2023 03:22:46 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AEEE2708 for ; Wed, 14 Jun 2023 00:21:07 -0700 (PDT) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E6kCkU012076; Wed, 14 Jun 2023 07:18:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=WaqqMVzCBGxC+EJtedsgsFpRmiuDCvfonBqDWNise4c=; b=Jrqm38ee8BBCqB/Juxc2l2tpnryXiEmkQsomxVvB4ZjPszj85QTCsAh29P2bKcYDf4dS mFqm+jFDahBAHLiJVhw8xQ1RYDLsJgF1SfyKaG/YfLU/BdnDv2lTwC/8c5BlF66SQ+q6 lviXwKv5Nf/cCL6zLxer9rw+rSbdEOk//mAIJNopwznpWdd2rBLUpMF7+an3qdGdxNIB P80yd0YOyx6Fnr3e5hEoeXvx9XPOqAUHAnbqiBjjkfXjCx1Iw14rftecZhToqBNXsg7L Jlp/YJk8CRulqwjW5srKvnVxzwFCukeecd9jMrrisbH4aXxjLAW/dmxsddYOaAGiK18y Yw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r4fs1xxx8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:38 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35E5bIXh021593; Wed, 14 Jun 2023 07:18:38 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2045.outbound.protection.outlook.com [104.47.56.45]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r4fm56cnn-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 14 Jun 2023 07:18:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J04Kmfm0FrLo8x+mfN79080LeEtne2gpfzMz3HhBMr7BRG5z+1UI+HLQVE1BZjd4zrhymLi/oKFsNPETZKeM8yA2b+a6JEb8nA8n2ImLKz7FgRHXvjsJEuvrePv4pY4xFcCj46joYX3dGQZKFo8/ziSPub0sNF3TbiKwG/ZsVkOsI+2ch73SJcsQ2HNPFbRQ7fWTbMJ++xYJj3JNTOtPP3F1PcHIXpdcUd4NjU2DcZmsA+pyVP+b854PIMLD0uUwjY3DBR8HrzqrC0Am05hQDAhylMJMO9CoeI1znYSdQGzst1YL+jTyXdCz9A3L15HCvgrHxE7kVdJl5nHLSIsb8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WaqqMVzCBGxC+EJtedsgsFpRmiuDCvfonBqDWNise4c=; b=QL7hyEOYHp4jhgd7l7KQEcV8zgcwrxEKzairGy34/Bwd/WeCzxZ6NR43fkoMwsmXY3YUjcqEOYKuHl1eiYJaDfT0tXvcK5gGzf5S8YhCQFurKBsjfxRPm0VOsIrerAohJ1f5P63OvXDGrxwyuFq9ra8gNLbALwZRgBorLQX8r9l50LuoW9E2xo15mrL5rt+qBi1j9LxBzKenYg2ENV9HYRoAagtiVkkh68bf2JWzugdhcWNRAdDQpnXN5Bx9KfCr04mRNL5vvAx0cFZNyups8jcuPuAcCp8braUE/XIZfeoAry3zn5mFEz796cetEAXp8+QWaW9btAG9/ryrke436g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WaqqMVzCBGxC+EJtedsgsFpRmiuDCvfonBqDWNise4c=; b=xPD4I4JVGhqG6nTLwUkbO3zQVb/bzGrQq4kvO1N09v1ZOShpC4uEYEBDbH2O08iJVOzBft/dgfcjj0SK34TnA/+cbZPk70FakrKj/hzDAfME39LJ0nBJJUpgeVV8TKV4+mRFq/QUTc77rnagkLbSeLBdHjXp/lVtLEYGm+yrfxQ= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by DM6PR10MB4188.namprd10.prod.outlook.com (2603:10b6:5:21b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Wed, 14 Jun 2023 07:18:18 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::13d6:c3f3:2447:6559%5]) with mapi id 15.20.6455.045; Wed, 14 Jun 2023 07:18:18 +0000 From: Mike Christie To: bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v8 33/33] scsi: Add kunit tests for scsi_check_passthrough Date: Wed, 14 Jun 2023 02:17:19 -0500 Message-Id: <20230614071719.6372-34-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230614071719.6372-1-michael.christie@oracle.com> References: <20230614071719.6372-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0180.namprd03.prod.outlook.com (2603:10b6:5:3b2::35) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|DM6PR10MB4188:EE_ X-MS-Office365-Filtering-Correlation-Id: 87874479-fc64-45be-6bbe-08db6ca78728 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3Y9M01olw/dX6mWIHhfuncyECuac1zFWVWAjRGC09LP27iC5xyoFihKsRM6Bx6bXfqtsOlGJJzkrJSZhwxRd1NemW1Zv2/prNq5zOpio1MUW0m2IITnMJqyGu5JkR4+QYRzdHr76K0gUDcTglJYdBYneXIAvYql93B/nhsiorkME1Ad7K59XT22N1BR/7rP1PxANmo6ZZO3IADcPouRk7KMzM/XRar8U5HKvq2GidhSwNu15CMghoS9yr19nbmMcdXmhLhmhEORfR8zJyU8PYPAJGXeFjN50zLQFNugBlTV45Z9LELFBK8zl/LinTUJeI9yf1kMURFMWya/N8Kq4o873qak4VNFJupHMQKVXF+YCmV3ScEqE7P/sLy9lrG3wdSwGYkg17lO7KGJ2LwzzwN30thysMsQFa0ZXt3tkwq1g2Q5sMhVJ3u6mdXsIMVzmWVaWkFnIJaJ4UW2oS39dg+QJsgl2ZW7mMhoZjujsOSUwNwf8B/gCxY3AJQZv9flnKXHso8P/rxJoHOW0mAd8K5HCLsRPqr8eKE4Ovma6+1uEsE1Ci+kxlKjYmPDU38P3 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(2616005)(83380400001)(86362001)(36756003)(38100700002)(478600001)(6486002)(8936002)(8676002)(2906002)(4326008)(5660300002)(66946007)(66476007)(66556008)(316002)(186003)(41300700001)(107886003)(6512007)(26005)(1076003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XsD3cPxsXg0F1vU8/ItOz9QD7QDqrF+njUMvxeFfSt8EeD/zmx2ghdKDJemGfHdpqG0OCdLDMPIdCQZjDdc0G3D5x+vm08xHc469b4DTCTAJUamZ2vAHLaV6u9FzfUcHB1Rsff6Om+alc6Bug6nHw+xP76ECJhevTK3HeS39w/QS6RAWce3RN2FQXaHgzgSepqxkeMQVEu5Vf083OlFnSAs3FXYG4rc4hYLbxBCunoz4ZUZaHztnfLqJxR8EriJB+0xPmW3qJCxLlyzVIFDBLoUDp03/mRsN0fzQYxdrAlv4hMLuAECnMR9q3A7ez8e8W/szvbpsGALNbceM166JvJuk9RLqgqG8e5CgmVsamq3Llneyl7/2j1I0HzswCDve3c7C9M6fUMF7aFrVpt/9k1LOCS54O04wd0fCaipgOwJUIh0uJ7qhikKJ41MusG/3wtlm/mREApgbTdJUr4g0EngBoV7s1APbsYspIn0F/V77gCQCw0LQZh25SgajV/CazsFiESrPv97CqF/ND3S5Y2Uy28lT9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-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: yH+dXuhJd8Oao1KUGzxcKXrTwgfciT0wrItPqLdP8/BTm5BYoLz/qmDF14t3P9VrzSt6+uU9fF1KG38kHCD2T8pxlyMOFDLuXSDv0+Rpz0Y50sDbJvQYAnNS8AhntgO8mldojSjm7TcuVQsuc1LyC/RpPpWs7RnaswiqFT+diyYMqlpPXw5vYPlU0lZE00VWToAt0ddB5AxUx8LO+pWrMMDseuK5QaBxRuyMYEWEB/N/kmjJp4PIUvSq5T1znMXhaZIwkbkEdiRrBnYUNMm5rNElO9IxnBGqjmGYqSZo7LfOzpo5kCE8tDzLhHJmacI8YM2tL7IeDiGm+4eYfeA2sQIxC+dOKgxnXbhPNk4PALqIXiQk5yvJR1MXmLDsroerH8FW4UmfIAUua5YUp9n2AM7n3uulekMfeRtn8g2xEOitZnm1YzWhfPSkfK9lxVEncmnDL+tYvP3ueW7MF1a1jicMqh0uBz//SqgSwZAqHLxELJPIeVaORCYTomT+xLSvwNySd8XlZe/RpWsGEUPkG1R4azv+Elo8olx4W6hcedRNw0nBfEgzJc6W2DWuJNI749IhkRVT8cYRr1JSWKQMb81nAJ4iEAVXEOpU7iZPJ5XjCX+8Lkz8T1G1j8V46nuubgevrzZBS4T5tk4K6tP3gXK7cOEZyNgW/1/ItpXOM1NI26+4DHQW3J9bCeB6pPdNFJa+v5187Lfif+5OGXxLQ45vafEjmWToGDoWwTggyc/0eUTnXKiL1FDnodhx8HqnM3igQYsDY7Incl4sibp1yi3s8TExz51xk6fCDYWo6RQBwv74NxztuP0I6F6jZWY8i9EZny8OQGoDNfjn1+2yzEwAaLziED8DDoB/m+sViZFvmAEl8rYCB5NYaffHMGgu X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87874479-fc64-45be-6bbe-08db6ca78728 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2023 07:18:18.6918 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FXvby/UKrZlswkcStb1rAcO+ys08vQl1JksnG1we2uPgGYVKJwCiH9cSi+IXpUgxfbSI3mW6yrBQoRd7/1fvBYoA08vWcgK0W63vLYKzRS8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4188 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_04,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140063 X-Proofpoint-GUID: 1dbxEkjstF_uI8piF_sf6nf5hmLAKVmM X-Proofpoint-ORIG-GUID: 1dbxEkjstF_uI8piF_sf6nf5hmLAKVmM Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Add some kunit tests for scsi_check_passthrough so we can easily make sure we are hitting the cases it's difficult to replicate in hardware or even scsi_debug. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/Kconfig | 9 ++ drivers/scsi/scsi_error.c | 4 + drivers/scsi/scsi_error_test.c | 170 +++++++++++++++++++++++++++++++++ 3 files changed, 183 insertions(+) create mode 100644 drivers/scsi/scsi_error_test.c diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 4962ce989113..be9b6eb2fba2 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -67,6 +67,15 @@ config SCSI_PROC_FS If unsure say Y. +config SCSI_KUNIT_TEST + tristate "KUnit tests for SCSI Mid Layer" if !KUNIT_ALL_TESTS + depends on KUNIT + default KUNIT_ALL_TESTS + help + Run SCSI Mid Layer's KUnit tests. + + If unsure say N. + comment "SCSI support type (disk, tape, CD-ROM)" depends on SCSI diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index d2fb28212880..82111cdeea16 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -2663,3 +2663,7 @@ bool scsi_get_sense_info_fld(const u8 *sense_buffer, int sb_len, } } EXPORT_SYMBOL(scsi_get_sense_info_fld); + +#if defined(CONFIG_SCSI_KUNIT_TEST) +#include "scsi_error_test.c" +#endif diff --git a/drivers/scsi/scsi_error_test.c b/drivers/scsi/scsi_error_test.c new file mode 100644 index 000000000000..951fec0fdeb8 --- /dev/null +++ b/drivers/scsi/scsi_error_test.c @@ -0,0 +1,170 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * KUnit tests for scsi_error.c. + * + * Copyright (C) 2022, Oracle Corporation + */ +#include + +#include +#include + +#define SCSI_TEST_ERROR_MAX_ALLOWED 3 + +static void scsi_test_error_check_passthough(struct kunit *test) +{ + struct scsi_failure multiple_sense_failures[] = { + { + .sense = DATA_PROTECT, + .asc = 0x1, + .ascq = 0x1, + .allowed = 0, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = UNIT_ATTENTION, + .asc = 0x11, + .ascq = 0x0, + .allowed = SCSI_TEST_ERROR_MAX_ALLOWED, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = NOT_READY, + .asc = 0x11, + .ascq = 0x22, + .allowed = SCSI_TEST_ERROR_MAX_ALLOWED, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = ABORTED_COMMAND, + .asc = 0x11, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = SCSI_TEST_ERROR_MAX_ALLOWED, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = HARDWARE_ERROR, + .asc = SCMD_FAILURE_ASC_ANY, + .allowed = SCSI_TEST_ERROR_MAX_ALLOWED, + .result = SAM_STAT_CHECK_CONDITION, + }, + { + .sense = ILLEGAL_REQUEST, + .asc = 0x91, + .ascq = 0x36, + .allowed = SCSI_TEST_ERROR_MAX_ALLOWED, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; + struct scsi_failure retryable_host_failures[] = { + { + .result = DID_TRANSPORT_DISRUPTED << 16, + .allowed = SCSI_TEST_ERROR_MAX_ALLOWED, + }, + { + .result = DID_TIME_OUT << 16, + .allowed = SCSI_TEST_ERROR_MAX_ALLOWED, + }, + {}, + }; + struct scsi_failure any_status_failures[] = { + { + .result = SCMD_FAILURE_STAT_ANY, + .allowed = SCSI_TEST_ERROR_MAX_ALLOWED, + }, + {}, + }; + struct scsi_failure any_sense_failures[] = { + { + .result = SCMD_FAILURE_SENSE_ANY, + .allowed = SCSI_TEST_ERROR_MAX_ALLOWED, + }, + {}, + }; + struct scsi_failure any_failures[] = { + { + .result = SCMD_FAILURE_RESULT_ANY, + .allowed = SCSI_TEST_ERROR_MAX_ALLOWED, + }, + {}, + }; + u8 sense[SCSI_SENSE_BUFFERSIZE] = {}; + struct scsi_cmnd sc = { + .sense_buffer = sense, + .failures = multiple_sense_failures, + }; + int i; + + /* Match end of array */ + scsi_build_sense(&sc, 0, ILLEGAL_REQUEST, 0x91, 0x36); + KUNIT_EXPECT_EQ(test, NEEDS_RETRY, scsi_check_passthrough(&sc)); + /* Basic match in array */ + scsi_build_sense(&sc, 0, UNIT_ATTENTION, 0x11, 0x0); + KUNIT_EXPECT_EQ(test, NEEDS_RETRY, scsi_check_passthrough(&sc)); + /* No matching sense entry */ + scsi_build_sense(&sc, 0, MISCOMPARE, 0x11, 0x11); + KUNIT_EXPECT_EQ(test, SCSI_RETURN_NOT_HANDLED, + scsi_check_passthrough(&sc)); + /* Match using SCMD_FAILURE_ASCQ_ANY */ + scsi_build_sense(&sc, 0, ABORTED_COMMAND, 0x22, 0x22); + KUNIT_EXPECT_EQ(test, SCSI_RETURN_NOT_HANDLED, + scsi_check_passthrough(&sc)); + /* Match using SCMD_FAILURE_ASC_ANY */ + scsi_build_sense(&sc, 0, HARDWARE_ERROR, 0x11, 0x22); + KUNIT_EXPECT_EQ(test, NEEDS_RETRY, scsi_check_passthrough(&sc)); + /* No matching status entry */ + sc.result = SAM_STAT_RESERVATION_CONFLICT; + KUNIT_EXPECT_EQ(test, SCSI_RETURN_NOT_HANDLED, + scsi_check_passthrough(&sc)); + + /* Test hitting allowed limit */ + scsi_build_sense(&sc, 0, NOT_READY, 0x11, 0x22); + for (i = 0; i < SCSI_TEST_ERROR_MAX_ALLOWED; i++) + KUNIT_EXPECT_EQ(test, NEEDS_RETRY, scsi_check_passthrough(&sc)); + KUNIT_EXPECT_EQ(test, SUCCESS, scsi_check_passthrough(&sc)); + + /* Match using SCMD_FAILURE_SENSE_ANY */ + sc.failures = any_sense_failures; + scsi_build_sense(&sc, 0, MEDIUM_ERROR, 0x11, 0x22); + KUNIT_EXPECT_EQ(test, NEEDS_RETRY, scsi_check_passthrough(&sc)); + + /* reset retries so we can retest */ + scsi_reset_failures(multiple_sense_failures); + + /* Test no retries allowed */ + sc.failures = multiple_sense_failures; + scsi_build_sense(&sc, 0, DATA_PROTECT, 0x1, 0x1); + KUNIT_EXPECT_EQ(test, SUCCESS, scsi_check_passthrough(&sc)); + + /* No matching host byte entry */ + sc.failures = retryable_host_failures; + sc.result = DID_NO_CONNECT << 16; + KUNIT_EXPECT_EQ(test, SCSI_RETURN_NOT_HANDLED, + scsi_check_passthrough(&sc)); + /* Matching host byte entry */ + sc.result = DID_TIME_OUT << 16; + KUNIT_EXPECT_EQ(test, NEEDS_RETRY, scsi_check_passthrough(&sc)); + + /* Match SCMD_FAILURE_RESULT_ANY */ + sc.failures = any_failures; + sc.result = DID_TRANSPORT_FAILFAST << 16; + KUNIT_EXPECT_EQ(test, NEEDS_RETRY, scsi_check_passthrough(&sc)); + + /* Test any status handling */ + sc.failures = any_status_failures; + sc.result = SAM_STAT_RESERVATION_CONFLICT; + KUNIT_EXPECT_EQ(test, NEEDS_RETRY, scsi_check_passthrough(&sc)); +} + +static struct kunit_case scsi_test_error_cases[] = { + KUNIT_CASE(scsi_test_error_check_passthough), + {}, +}; + +static struct kunit_suite scsi_test_error_suite = { + .name = "scsi_error", + .test_cases = scsi_test_error_cases, +}; + +kunit_test_suite(scsi_test_error_suite);