From patchwork Tue Nov 22 03:26:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13051902 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 E2B53C4332F for ; Tue, 22 Nov 2022 03:29:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231758AbiKVD3B (ORCPT ); Mon, 21 Nov 2022 22:29:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231953AbiKVD2v (ORCPT ); Mon, 21 Nov 2022 22:28:51 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22E7F25EB4; Mon, 21 Nov 2022 19:28:50 -0800 (PST) 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 2AM3Luqk029711; Tue, 22 Nov 2022 03:26: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-2022-7-12; bh=e1srgqIBCIcZpzXwbvj9Kn0jgXlmj5HQO9vrO9gpiRI=; b=y+hoWBbLTVh1nf7M9z+AiZ3yRcZcsCSVbYH1grmnNiI5gAp1vBtxkYZpBQVBN/PSIlPn ZolRF9kRKXxNiNkSsVZDBSgKBcNdBJXNPtx1hg4/DAuR8v2NL4J3SA39pBG9F24TDaER fV4mfEjOub4c/daB5rshNGet6IcjciuVRCC1pb50B7JfQQXZOsJ1YqGpDfZVYKrnWVNQ UKaUZQ2b//Neba5805iL1bcF83lI63oKQRdoJk+9Uy6nZ5cgbdmhAVs578hC7T6TKtZs qbP4fRFUArX1cokjlRbB9yvgujZz2yY1gZBUkF/GgZyubNLN0GLUw9pAS9kLwoyjszi3 Cg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3m0pf2r0e6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Nov 2022 03:26:31 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2AM0tgI9008247; Tue, 22 Nov 2022 03:26:09 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2170.outbound.protection.outlook.com [104.47.59.170]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kxnk46qyx-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Nov 2022 03:26:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LguCX8XQYDr2BX1f0KWKwkqB8/sZD5nahD0dCvcpN9M6V1TXJTRviV7LQvjnKjScTW/W5Wyg93Puc7m3o6SqOVfysC7o8TwFcnjgkJx3pjjYyMiddVNm8zJacFPe19jxdQKPh+LhxH2Q93hZOhXdlsFlCF0SWy4vXuguTh3nKnA/3S0nRuMosbky1DDe8rDloPuQR+HFw7Hou+H0dz3uBgXkObVGAp99/TzGFd1pYHtxr9tS0wxxBfdYr1XZAUrVsuep52EK3u61dMhsLALpdCla9ILAjsNJBqcblRlc0SLYYqR8p2RxeTsyoe+ltHx7NGuaK2OcHhRZTO/j8P8iRQ== 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=e1srgqIBCIcZpzXwbvj9Kn0jgXlmj5HQO9vrO9gpiRI=; b=K5rQgrdM/VUtkrWy31TKiWQCfWXzsU930V+uqSHPTv0Db24eN8hsRx8LpUZEBDh77dU3MGZSwRH7POa8WAPRhiyUDDJ4O6C4VghlruJ4be8kaa0l647eDz94ZeKwWwlfsR1Pagw9vRHaHzNXSpmGz2gQS78XI9lahQtdsySHfZW6GIDhUXWC3aMJaYFv0CGDtaqHPJD1xjMxLlq2VAZoQ08f+OUBla7W/DUOvYAetc1eZQpIATQdS+oIqBU62GnMdIJL1mVmjbJtbCXyaXcBgkA0nZ2YYOOz9dsN2ukdC+twpPQfMCMXGGCpjfouC6aSD0/gGFSnZzdAdFD3Gdkbeg== 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=e1srgqIBCIcZpzXwbvj9Kn0jgXlmj5HQO9vrO9gpiRI=; b=qH7KzwaD/ubdm6QQbIHMOza1ITKbT7xHdvJ2z0zE6qOOE701o+TDocIeSihXijO2VuEAQBtBDurka8Lzt0M9OTG9vd8owO8ylvtdUxN46Zz+M/s4q3Oh+NIgz/Pd8NXkw0s/hCHiXiIYzH35rfFjFQ/eCmgtMd7X/u9iymGmB1A= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by PH7PR10MB6130.namprd10.prod.outlook.com (2603:10b6:510:1f6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.15; Tue, 22 Nov 2022 03:26:07 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5834.015; Tue, 22 Nov 2022 03:26:07 +0000 From: Mike Christie To: chaitanyak@nvidia.com, kbusch@kernel.org, axboe@fb.com, hch@lst.de, sagi@grimberg.me, martin.petersen@oracle.com, jejb@linux.ibm.com, linux-scsi@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org Cc: Mike Christie , Chaitanya Kulkarni Subject: [PATCH v3 1/4] block: Add error codes for common PR failures Date: Mon, 21 Nov 2022 21:26:00 -0600 Message-Id: <20221122032603.32766-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221122032603.32766-1-michael.christie@oracle.com> References: <20221122032603.32766-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR12CA0001.namprd12.prod.outlook.com (2603:10b6:610:57::11) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|PH7PR10MB6130:EE_ X-MS-Office365-Filtering-Correlation-Id: 1ac1a4d9-6239-4fae-a908-08dacc394b51 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RkeXD/C/Lu9ELjXvtuMhlFbkw402clJMAYFV+bQ7TUFBemeoJFZycWfXhhtDM6ZomGueb9PUyGgHcey9PqWRE+wxtb31W7/ErDgDfw5ihLiSSdTs1vx2P+lPXdRZMegtbsOY9YgNclRPcK9UBhzX8JHTZVC+4mwjlBogjb54AYuZNRMpSGoK4GOe5CNDevQlkUn92tyvccBpuWH1AtOHyql4BCQtAdmK880QUBWWLCZJQs3kDlvCPIt0yqSaTFsG2j+3zcHxt4wKCDtLeBwlCE2TmhpNw7vAh+KJiavkJZ1WckLCjMvLDQJhJnD+2t1TeBmT8RUHtMqniVcpgrzRyOHsm8CpAacm7sMEQFmV8KQ+ZNB6MHpwt0TXCcFYFWuJXlg6HLZI7lQL7/E60yDSGSAjID5e2HMSycXXDkfBM0MOyeFWRvrlhKpvu/YTJFwG4h/vif8njnMW2xQbXTMJvYRcPqRthBKzhbNIsPNdP7fEBOekqUXHDynoQ/n9hkGY1X0lTmsf0Qm2SAQ4HTch/B1OHDEOXEgLNL5uvq3GEzJEgNp47kq1aqMbgy+jesN0DC9uJPqMLjQ9NCBI5VxcQtjEb1H8NUbh2EFcAUMOIBfu10l04c2cas+uTJrknAbUq3BCsx35c3cyZ291bykkJknQuJFpz7q1YqK9Qz1ZRkCfgNfo5VOKmE2GmA24Moye X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR10MB1466.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(39860400002)(376002)(346002)(136003)(396003)(451199015)(4326008)(8676002)(36756003)(83380400001)(54906003)(86362001)(66556008)(66946007)(316002)(66476007)(26005)(478600001)(6486002)(6512007)(6506007)(6666004)(1076003)(186003)(2616005)(2906002)(38100700002)(41300700001)(5660300002)(7416002)(921005)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RarNLtAe671TThDSqp/LCHcQhedb2a9z39WcBuL6GaUQRUGsMYjZgUZMf+yfddZQ7R4+KYbYriXYs/Iq2hcMzGWq+6VajWySaSqf5iWRjYebezFcK7OcQoXfw4rIIogw3O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CpVS4IhqENf3muORgIznPwMsd8RYnv2dzYrlcbjHcKTyuFqyB4ZC2StQkKOyfIhL3tbG2Ae7K8mYA02UaMg98N9b/yltdrPB0s0URwvi5ubcy/15NA/9P7wNB5kyNunh1WvQ6CjevRU6BvJlbH75hUTFJQHse68wI0hLpsg7MQDlR1qDpST40SeWtdNzO4osWjRy8LSHo+pdBvfLuPbxdlbZlHXac2Lra91sgDGHpsFID1B8irx6RDg2IPJfbysFzMgBuePxXRmIVoOz7PBzN5xMOToGHQ0yhcngItp+V/B00qTmH1wdaL3gbq8QjpgUJCM9wlG9qSQCBm/9E99Ivyn4quhakaYCx82Uny20eu8XYqh2RUVbZ6GBSefOf3EOPuE5gn78FR9xLQprgLUhdyOGHV63EDOU35Q/IDrS+dw1IOUm1F4ndGdvBMAmZz14gNCt5uTwr9O0RSFIYg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ac1a4d9-6239-4fae-a908-08dacc394b51 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2022 03:26:07.6597 (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: G9V9TmoEh8fr9UAzYnoVLNK5GHdy9WnoknY+LDZnfZNYFySxm39k1Zw/dai7wIrvTCuAiJgDruBw2HRejidvQnCh7EePuBkovEZKWOggkD8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6130 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-21_18,2022-11-18_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 suspectscore=0 bulkscore=0 mlxscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211220022 X-Proofpoint-ORIG-GUID: f10CPIblFqCn8Iz4tgDMOQScKs8AxG_E X-Proofpoint-GUID: f10CPIblFqCn8Iz4tgDMOQScKs8AxG_E Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org If a PR operation fails we can return a device specific error which is impossible to handle in some cases because we could have a mix of devices when DM is used, or future users like lio only know it's interacting with a block device so it doesn't know the type. This patch adds a new pr_status enum so drivers can convert errors to a common type which can be handled by the caller. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni --- include/uapi/linux/pr.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/uapi/linux/pr.h b/include/uapi/linux/pr.h index ccc78cbf1221..d8126415966f 100644 --- a/include/uapi/linux/pr.h +++ b/include/uapi/linux/pr.h @@ -4,6 +4,23 @@ #include +enum pr_status { + PR_STS_SUCCESS = 0x0, + /* + * The following error codes are based on SCSI, because the interface + * was originally created for it and has existing users. + */ + /* Generic device failure. */ + PR_STS_IOERR = 0x2, + PR_STS_RESERVATION_CONFLICT = 0x18, + /* Temporary path failure that can be retried. */ + PR_STS_RETRY_PATH_FAILURE = 0xe0000, + /* The request was failed due to a fast failure timer. */ + PR_STS_PATH_FAST_FAILED = 0xf0000, + /* The path cannot be reached and has been marked as failed. */ + PR_STS_PATH_FAILED = 0x10000, +}; + enum pr_type { PR_WRITE_EXCLUSIVE = 1, PR_EXCLUSIVE_ACCESS = 2, From patchwork Tue Nov 22 03:26:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13051889 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 1F177C433FE for ; Tue, 22 Nov 2022 03:26:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229585AbiKVD0l (ORCPT ); Mon, 21 Nov 2022 22:26:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231905AbiKVD0d (ORCPT ); Mon, 21 Nov 2022 22:26:33 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8258023EA8; Mon, 21 Nov 2022 19:26:32 -0800 (PST) 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 2AM2BNTM015759; Tue, 22 Nov 2022 03:26:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=Xgv8CaTSqC+nYs4Nw7tleveKIFnjNMIOI7ojrZfVNjQ=; b=qakIY423KKfDFc82m+Y2+Q8tItqFOdnmzRBuFKCFHP7ASLyKSzi4KdQvzfDrfAK/luvk qL18rUuNs3zNNrknOY0Hl8p+Nds+QhN9thKCMUnGnz9BrO5UrHw/o54pu6GyAAK67vNB 74wUDqjZbBSpZ8EKhqTMVg0gmkDMM+DGjVEC/lXpEfSM8kobtwb87Vl2ZwiuVa/PqnnG 9E/FNNJBWjTCGAanIhd2MALxeNm56L2PYuSG3lwhUxlhx4kgMP3Sny4Q1koQCEfVXhfS VOpwmf/g0NHvCI5KvPN5ljfOxbfSDspfza2Clb4NerZmQVql5PsyLUPsBHE7KBRfSFLj 5A== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3m0edq1bw1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Nov 2022 03:26:16 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2AM2CqLT038773; Tue, 22 Nov 2022 03:26:11 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2170.outbound.protection.outlook.com [104.47.59.170]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3kxnk4png0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Nov 2022 03:26:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xtrp4WFnWh8I6002InYPStXZ93Hph0qDWx5CpGSqS/fRh4mZzepH4xqX+TYi5Q2HMxpXGTWLbUF/7R903wZfB0209IOeLaHAx/MZj0+rEC5cyW9gw1PDHXp9ClCYOEAc7hH6JkK4Yt4Z+csPonZ4ECZw4a8UrUBiUsREqJ/dr8oXehwd6pl//lN/3S9yI9JJ2GH8QBhXMRhIXiwSaIx074dnyRAa35qPDpIAS/005NYNx0SRjQyKXdhgL81e0jRtAO+CzeM+fGUNhSU4Xi+1rwk0Y+hUZIrpjM403PaC5I6qt1pDxDTwmhvvv9aGhWzYuQ6Jl/Sxc8UgKMHl8ltQ3w== 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=Xgv8CaTSqC+nYs4Nw7tleveKIFnjNMIOI7ojrZfVNjQ=; b=OiQSoKFZssAEmAmoQXXSr9t8VCamDwYdz3wBlmskalcH39nIKvbyl1U81pc4N9z36qbNkJQv5pr5jWz8UcDInr9KIh4mfpSpDkQJNRFl76OFnVRjSCkeIpomBmTv4Eo0UkPjkRbWiipLsX66xgGJgl2gwaW3dPfXw46lXSOt748QM6d/Syy+DNjXN0QNj+NrMeeD42M3sx8Ean5mi8jfeFfOdT3Dh0GKD6f5O0tKrEm0/xWmdY0v1LqDS+HGLB+bRWpA0n78O/auTwhzkJ33jApTV0Tgp1dGxZbXCqbHC34xGZDcFc7gPmn7JjF9ctRfchbUn4f6FmNDOykcvPKTPA== 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=Xgv8CaTSqC+nYs4Nw7tleveKIFnjNMIOI7ojrZfVNjQ=; b=OF8cXMHC+Xot57SNVRLqYbPxMUDSQ51Ioa8mA9Lm3lGJIO1NbhQPrZjSiR14p8Vi9J+Zr01KSJNn4LKovPgn0diddVhL58qnIIGd5/4q84xHqIBAtohSUtfcjcb5alimsubzcP6OmxihzD0JYeesYO2kPnTS55lPFoEztonSZh4= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by PH7PR10MB6130.namprd10.prod.outlook.com (2603:10b6:510:1f6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.15; Tue, 22 Nov 2022 03:26:09 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5834.015; Tue, 22 Nov 2022 03:26:09 +0000 From: Mike Christie To: chaitanyak@nvidia.com, kbusch@kernel.org, axboe@fb.com, hch@lst.de, sagi@grimberg.me, martin.petersen@oracle.com, jejb@linux.ibm.com, linux-scsi@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org Cc: Mike Christie , Chaitanya Kulkarni Subject: [PATCH v3 2/4] scsi: Rename status_byte to sg_status_byte Date: Mon, 21 Nov 2022 21:26:01 -0600 Message-Id: <20221122032603.32766-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221122032603.32766-1-michael.christie@oracle.com> References: <20221122032603.32766-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR12CA0030.namprd12.prod.outlook.com (2603:10b6:610:57::40) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|PH7PR10MB6130:EE_ X-MS-Office365-Filtering-Correlation-Id: f3973db9-4e83-4fa7-d5c3-08dacc394c25 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Zgoq2BOBV0ets+XOKqTmF7cPncdbo8ekRVROcFmyB7YM3PnDaBRY/xpuW5JDSqo8f0X/3DpZrDo1zU+epbNw8w2XKbXOzbstXCXE2HJrJVBuoFag8Ud305TucJLEa01Y9SCAO1K/YpltQHvYLaD/3yO2QRnnB9KvaEJn5BAPaqisEqLabDQFtxQd4tq7AF3Ft/xDB8/5ciabAgWd+kP/6wc/IvrKnl5/Pw6I96Haw376RNI/XHdadyk7SAB/PTRE/0BRgxYJYpLV3GXgw3ijnXCh0hatmebjL7is71PTingc93J3dL7jUsJs64bFIrMB9ciqSawtrzsrEVZqE9cSGpN1gqCnr11pVm84iRAjt5Xp9bIvdSTf9nEEZL2rOn6np9yKSDwmB3UvVAwLW5BEtPssOQM2JZFH98Zdue5+urqxF1wn2b6FXPzfQMwIl0oxFvDltDYlcSVGi9O2dA2Qha2vpLYVYjUQWWD3m0hCN2WBxihs6G63ruYrQQ/0Y1wqFSd4cM0ZHMhwTJ+QVJ1eHzmLXNkWuWdfr2RskrUlzZfjzI3H4hYkhlw66MDEqZX+ZBnAVNWy0SIoVh2idboKqCoEjT6J5nFcNbgOpyfxwFwBzz0xoFXGd8TuGxBBGw1RMGZ0gxIVZcgY/OI5TI0+eNmo5BAusC7I74EXFzlMCHFk9yS5UmtFLV/C1pcZpoBd X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR10MB1466.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(39860400002)(376002)(346002)(136003)(396003)(451199015)(4326008)(8676002)(36756003)(83380400001)(54906003)(86362001)(66556008)(66946007)(316002)(66476007)(26005)(478600001)(6486002)(6512007)(6506007)(6666004)(1076003)(186003)(2616005)(2906002)(38100700002)(41300700001)(5660300002)(7416002)(921005)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oRNs8T3VHulg9H/yGl3xxR5V9oLkXmnWIgZ+wrO5vTmAPHAL5CU1OLsuRnfhRjynF5ppiyX6yMMj94i7/BZmjl6HCO5DGk22HT2NlIq8ze416ycxuDLBE32E9kgqMiAIz8Qn6JqLtAwNjHP7Jz6pJgJ51LgM5BJP2fXWO1WfpnvxCM+oHP93N+93BcNrPxau+f0puEJ6QIA5N7wntvyG32j7B/YbgR/DaGkc5dCH2rdHXLIGMxE8bMM11EnxL+IHK4xfq8uJhKubf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Cgtn3IYsU+Nj2JUyCWBoPYAFR+2I/OPI2kr1Q9Cvn0cEGePZ/ik0M/bxNBbtPzzqAEwn3mZJsNHAUUm1kg8RtkoKiztRmcX4JGJGW9KOjtrH1jRBCIIPuXfB9K9FnxF05QX8fCuzjJrYeF27JXsNJaEafl6oqQ+LqY1ElwCbpyEyt15teje5JJzIaasudYeRXcPGJb81JgynzEbLBAQKhEpM85cYiX4qCWw9SeTZYb4jJ0JpEajHCUDj7W4Mplzw8xa6mY5yIUMPiAjTVI66l9a32taG51wDePwviUPO2+7jLnDNHcuxsD9NpiT/JEDKn351efXnSxB0gVsKBWqg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3973db9-4e83-4fa7-d5c3-08dacc394c25 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2022 03:26:09.0346 (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: UHvhExbrJaRH2c8CriAn4+qwv8gsrk7Kjp3ue1Kxa9Mn+o23TFjjVmtDHqepQkWIsy8t6XmO3B/2BUO80u6yt1MrQ2CXsezVGqc2KuosnFU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6130 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-21_18,2022-11-18_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 bulkscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211220022 X-Proofpoint-GUID: DO-DeotNSB3MpI1YA4fW0YGC_fj0kteD X-Proofpoint-ORIG-GUID: DO-DeotNSB3MpI1YA4fW0YGC_fj0kteD Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The next patch adds a helper status_byte function that works like host_byte, so this patch renames the old status_byte to sg_status_byte since it's only used for SG IO. Signed-off-by: Mike Christie Reviewed-by: Chaitanya Kulkarni Reviewed-by: Christoph Hellwig --- drivers/scsi/scsi_ioctl.c | 2 +- drivers/scsi/sg.c | 2 +- include/scsi/sg.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c index 2d20da55fb64..8baff7edf7c3 100644 --- a/drivers/scsi/scsi_ioctl.c +++ b/drivers/scsi/scsi_ioctl.c @@ -376,7 +376,7 @@ static int scsi_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr, * fill in all the output members */ hdr->status = scmd->result & 0xff; - hdr->masked_status = status_byte(scmd->result); + hdr->masked_status = sg_status_byte(scmd->result); hdr->msg_status = COMMAND_COMPLETE; hdr->host_status = host_byte(scmd->result); hdr->driver_status = 0; diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index ce34a8ad53b4..d61d8d0d1658 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -1349,7 +1349,7 @@ sg_rq_end_io(struct request *rq, blk_status_t status) struct scsi_sense_hdr sshdr; srp->header.status = 0xff & result; - srp->header.masked_status = status_byte(result); + srp->header.masked_status = sg_status_byte(result); srp->header.msg_status = COMMAND_COMPLETE; srp->header.host_status = host_byte(result); srp->header.driver_status = driver_byte(result); diff --git a/include/scsi/sg.h b/include/scsi/sg.h index 068e35d36557..af31cecd9012 100644 --- a/include/scsi/sg.h +++ b/include/scsi/sg.h @@ -159,7 +159,7 @@ struct compat_sg_io_hdr { #define TASK_ABORTED 0x20 /* Obsolete status_byte() declaration */ -#define status_byte(result) (((result) >> 1) & 0x7f) +#define sg_status_byte(result) (((result) >> 1) & 0x7f) typedef struct sg_scsi_id { /* used by SG_GET_SCSI_ID ioctl() */ int host_no; /* as in "scsi" where 'n' is one of 0, 1, 2 etc */ From patchwork Tue Nov 22 03:26:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13051903 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 DA38BC4332F for ; Tue, 22 Nov 2022 03:29:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231368AbiKVD3m (ORCPT ); Mon, 21 Nov 2022 22:29:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229671AbiKVD3l (ORCPT ); Mon, 21 Nov 2022 22:29:41 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5BA325E90; Mon, 21 Nov 2022 19:29:40 -0800 (PST) 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 2AM2BNTP015759; Tue, 22 Nov 2022 03:27:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=DKvIvtmDNZOn23K4StqJhTyUyznuhS/Ar0rF7ABRIBk=; b=ydxxnw32TQOEMVYBr4NvaJXPDNyLQxo8ZPiXSTTSYouaDFBndALMpDKgq0IL8DK/l4Ux Zzcyv1qlOYWBdtIgqfBoOgo9Ebp6Jb7/lltNoIBG+F1L/cJOZbdttXEJ+HTci9ahRWbC S5Jg1O5XoiEjryvXyFANbr3MKMtgOKkhfxa/YkATLxGv3bYSv+PU+vHEO0iP65O25g1K H1V87PrA4crLUU2jBtQ6xqr6Vtj8EV9MqiyblVRMqPhP3BSut1wFukwz+FdEV8qO+DYM DGnM6JauZsr6wllq0VjDFZIEbklQAL/a7FS+gdw0zADKpiRwSmXyXVuVrPt/XvDwZzHK mg== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3m0edq1bw3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Nov 2022 03:27:25 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2AM3B2l0039613; Tue, 22 Nov 2022 03:26:12 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2174.outbound.protection.outlook.com [104.47.59.174]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kxnkb0kxp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Nov 2022 03:26:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SsEa/uK/PlPLv+swEb2bxEkbS7+o7G2dXwF0hOv6lzq0WF1mgRccPzCxVMI6Kt9YQiprkJXZKC89vzS8Oj8ZtaH+5b6DzZCXHjz2IYMOgWfWbilMSlg80MxAOWbg6j9M4BWqFi69tbscDfTxtrQ12NSHz/R1ZkkS3i/o/Vexx0WWY3Vq4IB6dc+iLERDHYw+77Y5UU0Ems0hUkVeHCKdhsyZl55EU7PqKTjuTpGP5Pu2xMKUsuJlywaLTsT0ICrWDpTPw+5XJcE2BzCTAgM7Xm5i1pua906+dce8U43zLf+587r6V1nNvyK5p/0zYE4POyGuRLagEhceu3Pn209qqw== 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=DKvIvtmDNZOn23K4StqJhTyUyznuhS/Ar0rF7ABRIBk=; b=AOjTRTs/Z6Tskgi4Bf+3nLzyxs6eN9u2wkAZRlD6A3YvYcC4G40MkWpMQ2nKpUTTzwOCjxOB/jrmJ6Gzi+pBs5zZjC/+7kyC/w8zMzTg7BxvejktGns/KuJiLqZuWGr/mreC83jPRbt4ZoWXbx4NpdoWP7ClJ5bqSuRzVaKcjyRqlOqq6OuJMOSorrm4wMd2x8H+KmTiqtGmwkuvCVjXEPP8HyQ11kZ4/KYN3xibFgLPyD9FuZzftleu7bSeCYRHbEDXneVjlkizvMo2BFq6yb0SuMVPUi0ka4X+SMpM7sqgMb8vum3QzOTJ/P2XHChOJMdPqX6loL4Qp/tqveaedA== 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=DKvIvtmDNZOn23K4StqJhTyUyznuhS/Ar0rF7ABRIBk=; b=rPxSTgn+doelC0Y05Hw9mtdfhs/laglfBVfo6CUx+PmTLlciq3sWSma5DKkH9ZfAyt1oN1FduxvL/cFW91FN5xVwP8+3TsVdsMBiyd3Vz/FgYOZMwOdbN+xf7InLrJGJtzCx35kvrAZyAy91c1xcWulxb+1qcBd1wVty1fUl5mI= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by PH7PR10MB6130.namprd10.prod.outlook.com (2603:10b6:510:1f6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.15; Tue, 22 Nov 2022 03:26:10 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5834.015; Tue, 22 Nov 2022 03:26:10 +0000 From: Mike Christie To: chaitanyak@nvidia.com, kbusch@kernel.org, axboe@fb.com, hch@lst.de, sagi@grimberg.me, martin.petersen@oracle.com, jejb@linux.ibm.com, linux-scsi@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org Cc: Mike Christie , Chaitanya Kulkarni Subject: [PATCH v3 3/4] scsi: Convert SCSI errors to PR errors Date: Mon, 21 Nov 2022 21:26:02 -0600 Message-Id: <20221122032603.32766-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221122032603.32766-1-michael.christie@oracle.com> References: <20221122032603.32766-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR12CA0019.namprd12.prod.outlook.com (2603:10b6:610:57::29) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|PH7PR10MB6130:EE_ X-MS-Office365-Filtering-Correlation-Id: d7f3150f-b831-4df9-d985-08dacc394d11 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DGThxK9iHbgrkLAzON00NLc5qI/FqW/L8YtlnSc9QPYNLpGy95N/xo/ijcfsNyGQvgPMGWmykCkbG39DFUUlj4/nY1kkRd+fpMWfCKcE9a5bXR7wYdhnV5VnEvWIkNsv8mvvU83DwYLTv+dgYEDgYVj4lkjgCaZuEAmiBzpJxSaw8Ht3Zzl7VGll8iMx9ayuNwTIQL5ss+EYu7Lmt/gUxUPrFVnkf2+8t3jtTxGQhVkWSAHp+HSmN0VLufxgEh7X3maVu0qUaO4N7GUtScVyrm+eUa3PILkvxg7+hrC5ut/9FxKbesPcsFenGiu4zn7HGTGkn7ohPnSZ3VdsQ94eTVVsnx4X+dig1ibnVDQ8pRNb4TUiUwkzklQrSDjBvLTguiK3zdiE38xE5Dc4xOs5YyPVBQ6cloS35coBLQvhLwAiNySDMD/ishIG3cgmtBptmDmlD57hkgi/bXuVSXSjkGIiM/nF1a+41YkMoSldLcPkrNjFaHAukeRomh5n5YkkbOsjEGs1q6n/M92A0uVxfHGBj0h6hQQiAR9ja7z8xKOgVBE2Rk21YYoNwew34j616KoY2KslwjaGyVagZJimkTAcirjGuZM05UAhUZw2KWQILPfJKMXAOcIBlRwNhozkZHgsrfUvninKzr6LGm78jElU0aPs9mcR2ueIYhvgo1X3VouFc4/ExBUKJMe1o547 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR10MB1466.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(39860400002)(376002)(346002)(136003)(396003)(451199015)(4326008)(8676002)(36756003)(83380400001)(54906003)(86362001)(66556008)(66946007)(316002)(66476007)(26005)(478600001)(6486002)(6512007)(6506007)(6666004)(1076003)(186003)(2616005)(2906002)(38100700002)(41300700001)(5660300002)(7416002)(921005)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiS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ySL0i85v17JvywX50vLZATttTb7xGn5bKW6bU0jgcfJukc1UfePQzGEiRJLp8MinC3M5PejbOkz6HCTxY8dse5qe50qX7YoifUUVBvvwnfDNik1rpTxcla/6iX4Fv6Ts2qodajDpINVRIuxnJPYGcepYw8qwTthTrS+6pfs1Tc6oXyhgn9K/jv/EBff6a/OjxyxlgQtLyHTG+s1cSkFUfYJ4v24tHt+LRdDlJGgG0Hug5fLOI545qGMRHVcK2OZmjgrvF1f3VSEU+3LO2GwkzJnRO4s91YzZm17y8cKrNUKMYVor2pugwcIDmDA7vP2ZAsOQSdoW4Wx8PGc4nFTvJXskHFbSWFSmsapXfYV7xrau/KXeJJajs420MJSOxzS5xkJz6bRBpct9E1QbYkliL2xp7txAq0tZuxRpkVM2iGgEpvEWRoOoWEIJM27YNVrtu7k2jddYxnlFNe0oQBkD5bA3ISucAISHFwUjsF9vgpePwAgnEBRBoly4Z4vbpZVZV6sAfgF1N12Y9lUAGhhG36LKLHTeuUrdQdJwWHja+Gr4PRa2nnZMzLecjGIn7+Y5ptKy4lIFf6NHWRsdlsnNxHICEPIQ+MaHE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d7f3150f-b831-4df9-d985-08dacc394d11 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2022 03:26:10.5813 (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: jQMdjR6div3R0KRmTbxBrO6VJIrRv4fw8+iEc7YzFADRDZrEZZSElYbcFey882eTVx0o6lBu2n+ogLepKmrj8B6Ggbhg+MiF1iSNMD0AK+c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6130 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-21_18,2022-11-18_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 phishscore=0 adultscore=0 suspectscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211220022 X-Proofpoint-GUID: cnizTGfbAGTLMRGRxE6HFjNY2V9I1hTG X-Proofpoint-ORIG-GUID: cnizTGfbAGTLMRGRxE6HFjNY2V9I1hTG Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org This converts the SCSI errors we commonly see during PR handling to PR_STS errors or -Exyz errors. pr_ops callers can then handle scsi and nvme errors without knowing the device types. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni --- drivers/scsi/sd.c | 35 ++++++++++++++++++++++++++++++++++- include/scsi/scsi.h | 1 + 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index eb76ba055021..bc60ec91dc8f 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1701,6 +1701,36 @@ static char sd_pr_type(enum pr_type type) } }; +static int sd_scsi_to_pr_err(struct scsi_sense_hdr *sshdr, int result) +{ + switch (host_byte(result)) { + case DID_TRANSPORT_MARGINAL: + case DID_TRANSPORT_DISRUPTED: + case DID_BUS_BUSY: + return PR_STS_RETRY_PATH_FAILURE; + case DID_NO_CONNECT: + return PR_STS_PATH_FAILED; + case DID_TRANSPORT_FAILFAST: + return PR_STS_PATH_FAST_FAILED; + } + + switch (status_byte(result)) { + case SAM_STAT_RESERVATION_CONFLICT: + return PR_STS_RESERVATION_CONFLICT; + case SAM_STAT_CHECK_CONDITION: + if (!scsi_sense_valid(sshdr)) + return PR_STS_IOERR; + + if (sshdr->sense_key == ILLEGAL_REQUEST && + (sshdr->asc == 0x26 || sshdr->asc == 0x24)) + return -EINVAL; + + fallthrough; + default: + return PR_STS_IOERR; + } +} + static int sd_pr_command(struct block_device *bdev, u8 sa, u64 key, u64 sa_key, u8 type, u8 flags) { @@ -1729,7 +1759,10 @@ static int sd_pr_command(struct block_device *bdev, u8 sa, scsi_print_sense_hdr(sdev, NULL, &sshdr); } - return result; + if (result <= 0) + return result; + + return sd_scsi_to_pr_err(&sshdr, result); } static int sd_pr_register(struct block_device *bdev, u64 old_key, u64 new_key, diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index 3e46859774c8..ec093594ba53 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h @@ -121,6 +121,7 @@ enum scsi_disposition { * msg_byte (unused) * host_byte = set by low-level driver to indicate status. */ +#define status_byte(result) (result & 0xff) #define host_byte(result) (((result) >> 16) & 0xff) #define sense_class(sense) (((sense) >> 4) & 0x7) From patchwork Tue Nov 22 03:26:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13051890 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 D87F8C43217 for ; Tue, 22 Nov 2022 03:26:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231395AbiKVD0l (ORCPT ); Mon, 21 Nov 2022 22:26:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231894AbiKVD0d (ORCPT ); Mon, 21 Nov 2022 22:26:33 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A269E24091; Mon, 21 Nov 2022 19:26:32 -0800 (PST) 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 2AM2LVlO003208; Tue, 22 Nov 2022 03:26:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=v0bSNlUQOb7KbDVCCxR9LPYum1cei0IMdrbD5CfPI4w=; b=0DU+kQLZAZKiZPH8UJJLY4eDxE29r6B+o85mpXR/pACdj6kD7n87V24bDzb8b6VXHZHU 6X2abUQZaJq4GN+vPLdf0ZzcJlL07RjgTRsO8UBNSj1xxcNRgUZdkpTy9xe3NYlaFnFG W7xYN3PPgxy9GaLEbAZNH/FEKl+AJk703nk1Q9dInT+o+/QaNCXITn7r6ggInDphbQ9Y rMX7HJcpK8XMTwJWGC7M/hiFA1Ew66t9eCG3suAq7rHrIvGxTygnivXXThcFJsmNtYpT DzRvr5+upKmQZAZUm2xAAGsS9JhvHubXN5AofXpp6PjD/ssmMhYht3aPPzhsxQ/sL367 SA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3m0gas0wyk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Nov 2022 03:26:15 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2AM1Mnjm028985; Tue, 22 Nov 2022 03:26:14 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2177.outbound.protection.outlook.com [104.47.59.177]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kxnkag7mx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Nov 2022 03:26:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dOUJdNUKUYz4KDO+kTHOPi03+RyeNAqP8Ebs2Y6f8QUSxcynr3AM6cQkToWTN9PhKEvova1W/0roAXPIAVRZtxKdS/3TSCqPl2wNgrFP8XCI4VLBiE0o2zm2EKfaWiPTswaL+dk98AZkz/+quvT6u5/YU3/wMUN+O5ZevkIEKwIhIWynBXlhqvWY8GW/M2ZwrG6eFQ68Ntyp03/9ytJaHrRFuYs0O+KljRJhhuMi8EUaaMitV49XCPqERYWr5qdczMh9sUr6ptXsg5GVTwIUJMY2hu14G7+2P+pXs0wT12Xc+G5zZRPlKzvFKlBt1sJnKDo4qG8phYI37LfAsJpxzQ== 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=v0bSNlUQOb7KbDVCCxR9LPYum1cei0IMdrbD5CfPI4w=; b=O1Q2zjyboQT2UqezaoPIZB27C/c8oQhSEjmYCUr+bNREEWjx/yekQCztJhKvUOcQa52OTk/+xoYPxxZtmVvVEnpnXCmQFaZDR63LTvAeL2n7MyiY7J5un9DmScSOLP9MHqYQEVsd5B+h1YR9uRKvrh2iAM1Gyp3J6alj7Z6kztYxPg/Y3zu7PiwMx1EYbrxfgMeDnmftMxnZ+2IKUAhi63IckB0+6eIuG6uB0bmPXz2AMgLGxF7m8m0ZeQwQ2xu04GPdCL9UPrZF72Azfps4opPG5acrk5ONiqV5RkVf4GuFMvMlSq1RetHH+MzxTYKDsCqMCugYP+SZLu1SQtbbeQ== 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=v0bSNlUQOb7KbDVCCxR9LPYum1cei0IMdrbD5CfPI4w=; b=ciGLfgxyzxivaV8jX7M5uqmskhpxGHcDFwhkr86Ldv+6C86L1/Fh9N9LfstAE2zCI8twA2NBuEi68jpf5PtH20DHhnxnUkhqjqE6eBPCHXTKpthSWUSGONmoAweg9eteOUCaykmw+aNGWqhsHjDNJJ7ZgeDQ0Nmi0cc79bz1L2s= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by PH7PR10MB6130.namprd10.prod.outlook.com (2603:10b6:510:1f6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.15; Tue, 22 Nov 2022 03:26:12 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5834.015; Tue, 22 Nov 2022 03:26:12 +0000 From: Mike Christie To: chaitanyak@nvidia.com, kbusch@kernel.org, axboe@fb.com, hch@lst.de, sagi@grimberg.me, martin.petersen@oracle.com, jejb@linux.ibm.com, linux-scsi@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org Cc: Mike Christie , Chaitanya Kulkarni Subject: [PATCH v3 4/4] nvme: Convert NVMe errors to PR errors Date: Mon, 21 Nov 2022 21:26:03 -0600 Message-Id: <20221122032603.32766-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221122032603.32766-1-michael.christie@oracle.com> References: <20221122032603.32766-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR13CA0036.namprd13.prod.outlook.com (2603:10b6:610:b2::11) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|PH7PR10MB6130:EE_ X-MS-Office365-Filtering-Correlation-Id: 3e7cda1c-c8de-401e-f1bf-08dacc394df1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 05F9UfaXF4C54+gVNzhC9iwfB/qH6GY+wtnB2GmlMS8w0Xfk9b5bqYIi3MBC9UZSuz1gV0o/aSPFp2L9q0wtO5qPrBrW4z1Lc0/QOIuF/BpgfZbVcCGiO3dq1PI7kHBvvrpjJeqWZBZ3Am3jfbBX0XQw+YKvI5K/FYmOP37R+GDsmfeWtoOiM3YcSmMdfNxn/rc3KDzklsC1vkMo84IdwVy02ccN4xwtMl08A+vukvlthy/lQ5jqP499a3nLiiTHe6MH6qXkOUq2VwV+49gLVMMeuKalfYIP9oaNgQE23Tt+tSK/FmxV85mvKUiKXkfJS+oKdAVbLdFtbneE23UiXP1pAi/DUgH/T9eK52FIjNiqmbvmb3zfaDONDHty5ySu3goTXg3XUE8+rkhfHg+AhaygdgVn6XRdobktIkyv5ZAwJsBEGnh3rca6t0l2RGoUq2pz61ZgPR3FmEUWwxQ1G+TH9gfGLwPgTn+1Mlig94A2fCfriI89z/oO/m9FBvli7+4lwNuyBGryVTxG3mQ/lzrMRkQ1JSxIYc4wGAz8bVYIsZxLri6V3kPSZgdBh4sX9Yufig3Zwpye4Tsxkh6BGfrZNyM3QI78Qwxxj5V7LCHN20MgsuzHutiYJxiIPk7mz3VDpe630zD3RY/cH843wcYPWObplBBkSOSNrrhIq/GzwRLtn2Gv3Oh+VP8LvXTR X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR10MB1466.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(39860400002)(376002)(346002)(136003)(396003)(451199015)(4326008)(8676002)(36756003)(83380400001)(54906003)(86362001)(66556008)(66946007)(316002)(66476007)(26005)(478600001)(6486002)(6512007)(6506007)(6666004)(1076003)(186003)(2616005)(2906002)(38100700002)(41300700001)(5660300002)(7416002)(921005)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nDkrMiXeEKG9U6Wrtuzl4JsGvSGiOeoDhX/gbK8+ZaAjnaBFu9s2+oHfJPBNrOvpJHs28UoqeC4h7eRtVUTzcMQAEb7A3np+4O1U/aWmmzSr4ldBQkKAQQn065wSGegqOF4z7Wf0FW7TsipndWG8AXaub8wd4W/MRc6WmhhR9zRBlhYe0iMb6yw33Q41SDTWqBrvfv5JKPnCXfndSQGZklAHs8Rz7fqblTHFHrMXYcha8OSbD75LgE+MFZTLTES697Ly/g/8J6YsKmeuqd4VtKD3bt+iyOmQQKrCdVDgQ3yaOvyrBMcYAQ5Vq1b8V/8WUXZ+IEP25X/Neoays+gLxw37SE2pjxX5A5hAKYjE2/9/pk7DeBE6h1lt6SWKlabccP4E7uzthq+/jN+k9v66eQJRPQ+hK/8FTIrxqHFqse56omcgUwS0a58D7zz98lbgs01uvkTxqZevCGXYKcb8NhO0y14Y4v4PpIH8XhUYwM8DRg0MQZM47PU8QvEHAkBWjBglkYX4LrV0BAjMnPUr80GXvKJPzJZcdSOZjQDH2Lxy0uQdbgj3dbIrkvG7ncJDSVC0XMWLUhXgMpBiB7YUcO5CHi/uDSAofdCcUxpqwa1TcKNHT2Ws5PdTehxhxQd400V/ch5vflj8DxKvQ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f1bf-08dacc394df1 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2022 03:26:12.0344 (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: Y7NJWdEZidocBy6/gLIxPDGF7pwrKaQ5aR2x9z68J8h16LcuV+Fpqj5BRj+FXxS3iMMFO1d5a1N4j4fVKjiN/spi1xzhR3keUsUXKHfFk6w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6130 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-21_18,2022-11-18_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 adultscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211220022 X-Proofpoint-GUID: Fz05X6wdUQCWOxwGcujIrEHst823uu-p X-Proofpoint-ORIG-GUID: Fz05X6wdUQCWOxwGcujIrEHst823uu-p Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org This converts the NVMe errors we commonly see during PR handling to PR_STS errors or -Exyz errors. pr_ops callers can then handle scsi and nvme errors without knowing the device types. Signed-off-by: Mike Christie Reviewed-by: Chaitanya Kulkarni Reviewed-by: Christoph Hellwig --- drivers/nvme/host/core.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index da55ce45ac70..6cd66f6d5e9b 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2103,11 +2103,34 @@ static int nvme_send_ns_pr_command(struct nvme_ns *ns, struct nvme_command *c, return nvme_submit_sync_cmd(ns->queue, c, data, 16); } +static int nvme_sc_to_pr_err(int nvme_sc) +{ + if (nvme_is_path_error(nvme_sc)) + return PR_STS_PATH_FAILED; + + switch (nvme_sc) { + case NVME_SC_SUCCESS: + return PR_STS_SUCCESS; + case NVME_SC_RESERVATION_CONFLICT: + return PR_STS_RESERVATION_CONFLICT; + case NVME_SC_ONCS_NOT_SUPPORTED: + return -EOPNOTSUPP; + case NVME_SC_BAD_ATTRIBUTES: + case NVME_SC_INVALID_OPCODE: + case NVME_SC_INVALID_FIELD: + case NVME_SC_INVALID_NS: + return -EINVAL; + default: + return PR_STS_IOERR; + } +} + static int nvme_pr_command(struct block_device *bdev, u32 cdw10, u64 key, u64 sa_key, u8 op) { struct nvme_command c = { }; u8 data[16] = { 0, }; + int ret; put_unaligned_le64(key, &data[0]); put_unaligned_le64(sa_key, &data[8]); @@ -2117,8 +2140,14 @@ static int nvme_pr_command(struct block_device *bdev, u32 cdw10, if (IS_ENABLED(CONFIG_NVME_MULTIPATH) && bdev->bd_disk->fops == &nvme_ns_head_ops) - return nvme_send_ns_head_pr_command(bdev, &c, data); - return nvme_send_ns_pr_command(bdev->bd_disk->private_data, &c, data); + ret = nvme_send_ns_head_pr_command(bdev, &c, data); + else + ret = nvme_send_ns_pr_command(bdev->bd_disk->private_data, &c, + data); + if (ret < 0) + return ret; + + return nvme_sc_to_pr_err(ret); } static int nvme_pr_register(struct block_device *bdev, u64 old,