From patchwork Tue Jan 23 00:22:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 13526601 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58676154441 for ; Tue, 23 Jan 2024 00:22:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969378; cv=fail; b=BjH+CkFZBGlwg3XgjVHjMwFr8diJLGUieLIWvlRt8DJ3jUnoUhBBi6hGdmFwObqZdoWl0Yiz+5OvSSKMGybwB6o9pZ+w3BTlSS5Ecl/rWhSTmFtygtHgH39kHrLeDyWMfNc0QDxTuUJ54iEOJO0E8ijaRiyYN0EztBlAEqat7SE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705969378; c=relaxed/simple; bh=C2rMchSa0F8kh0qbDkQ0IVuujvrXYcsMbZBXKpAybM0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=VypnBLPUvsaLJSRt3+bf15Kn/LGCJQ7mzpvC72iVoNjV8YzmoRKaxEWsjq4fWn7o4N6VADqCFng2JNdalsEt3uMO9ItMFmZYnOWJXhtePmD3umYsemmWCfdAZWroHgtPKz0qAK/pbFmi+saOLCBj742TzMEvUHRQJEijPvu8DRc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=TlW7hRSP; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=Hs7pqaXK; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="TlW7hRSP"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="Hs7pqaXK" 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 40MMouEL018359; Tue, 23 Jan 2024 00:22:47 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-11-20; bh=a/YDkR01uVqhHG1CYEPnlKsrqq3IfWOLOyvoqiW44D4=; b=TlW7hRSPLpAOng9ZBHpyS3wN5khqSoybpFDOT1GbJMz89N28eRrTjK0kuCe921lZm5Wh 1WOtVfyh51/mKE88f8Qdms/NXxApJWKnU0zC7yZHGHZ9iOVrKLgYHRRO94FYmz7aMkpF qYa3klv2wjwCQO15fq4IyQms5Bb6neG1KMEi24dJJyJhVOlC98QS+oY/iIp4z3xUS9Xz Jf6r0WNlEb1JtQZ8qrGHqD++GOKM2CJvgfPjJRQ6MDGahamC94c5hKagvMPeMoRBg73w xVq3rpG3NrPuYWSvWK086VZNDUrCr2avMh6JQUDdGLeaUbQ/2W02fgyPVdOMHyPEKjMi qw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3vr7abw1s7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:47 +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 40MMeBWM018804; Tue, 23 Jan 2024 00:22:46 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3vs314g7gt-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jan 2024 00:22:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cUAZVwBq7PQjTEEeuzYB61+qU3p27+ExWATVtQJdLAt+nlxTaGfyxflbiC+eg6IpoxS+2h2o0BM8SNcWIYO/qJ/LC33RlJ6kNvdtaUtpde05Us6AasgDoVCL1vTmXJGAjsdjfeUBczX2DHjPIVWFd8FL3xOOQ0iocaFNFEPz5C0HKqpSgLshtxM7e1jxZnfGWp+F2omAAXFg1UmXvtLSvG5zP4q4mtnACPu6TlfH6o8sypPLiaA6EwgQbJ4g9A20n1CU64wYX8sL+GsiN53cTB3awGzcxPdjO6NDuWj1T9fyoU1I+h+lR7UogfU7qiyi6WAcFS/Rxy0bIiKsnSiujw== 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=a/YDkR01uVqhHG1CYEPnlKsrqq3IfWOLOyvoqiW44D4=; b=GNG9PImQiaK7n2q9nuVZAiuonFjQnkACUs3ZbbCBgysAdF5vJmr2jE+EJdUbiiqv65LVIW0HCPtoHbdK7bfiPVVbflL5dxNR13CsXaRo6Wm1Ly/wxN32wWoKtxCnUafA85MLTXD7+aJD/gpuCssVgy4+2gLlsZO5LTyjgCWfP/dW9uAeVBUhvSdc/na3pMwbDzgjpL9GoaaytNMKagkY0aLIOpCAROi/fkOpEVHvFAmB1jGxCEb1N/p0bGUF9/mHifrUch1qYo9ICtwBNW0NJftX3bMUuDPQYBkvkYIudGjDvDaku+yIH7ovgqo7WARGgJUBQzdqIH+643bmQslerQ== 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=a/YDkR01uVqhHG1CYEPnlKsrqq3IfWOLOyvoqiW44D4=; b=Hs7pqaXKmTLY3V26Zu1NOgZgowOo93/1Ic5NaFRm3mf2c9Cd/a9fAFbIlD5Z2vfPP8wB8WLWDy4pj4uz95HGKf2Ex2nH4quHTutSXIYSMV63nRObP2JI9o3kHqtHBElTrSubOIPZI+zLVrgoskmFsKeoZh0EnHNmI+CmjpE8HCA= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH0PR10MB5340.namprd10.prod.outlook.com (2603:10b6:610:c1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.34; Tue, 23 Jan 2024 00:22:43 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::45f0:7588:e47c:a1ac%7]) with mapi id 15.20.7202.024; Tue, 23 Jan 2024 00:22:43 +0000 From: Mike Christie To: john.g.garry@oracle.com, bvanassche@acm.org, mwilck@suse.com, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v13 14/19] scsi: sd: Have pr commands retry UAs Date: Mon, 22 Jan 2024 18:22:15 -0600 Message-Id: <20240123002220.129141-15-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123002220.129141-1-michael.christie@oracle.com> References: <20240123002220.129141-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR03CA0011.namprd03.prod.outlook.com (2603:10b6:5:3b8::16) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH0PR10MB5340:EE_ X-MS-Office365-Filtering-Correlation-Id: c1c37a9f-8425-4992-03a5-08dc1ba96aa3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kHKeb2ewm36bMoVVa9R13u7Yq5ZX5tElFc8IZvkXoB5eewaZNMRkKQV14ihNLPadtoFH6MF6A3QHq7zB0MZu7QYyDLzMkeOZu/MXooIQHENvaF3D4hV9Pz56ejEXuaO1QCLU4JNbFYZzps3R/s5A9VEQVndMPsRPckI08wqLvfS6I4Za44UX8Jf109LezrVsncqcFAwEEGv7ouoeQ/6qFX0YeHy5KqHAb4SvWXrgvvXpHqVO/Flu0A1WrUPiCWyDd/xubKTJhWAmtjRZzJ4tcxmPcp6uefrrjFBgl1FKaOJ7kaAG/At4ItlsgI7W9qWrpVasgeX6/tkCTZF+ZxcJBz8GnNo6W1KiHaY4Fu50Aw2FYAQx4N38Os8Pxp4pohvsv3qVdFvboFJB62RbWBiBbODFnxuFRACschMPLfmncxxRYtk0G11Y0uCzSejnC8y8bKR9WPI5T5edmUxuMRJyze0mNmsSD+efOVurXhdaSN6By/J5CY4Hz2R7x85j0gxMAykp2yLXx6G8HBlmjbQ/SEeqQGS/vld/t82B5lYsgCp+gYAv6t4H4OYvzePmURV0 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR10MB7243.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(136003)(366004)(39860400002)(346002)(376002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(2616005)(38100700002)(6512007)(5660300002)(6506007)(6666004)(83380400001)(1076003)(107886003)(26005)(478600001)(6486002)(66476007)(316002)(66946007)(66556008)(86362001)(8936002)(8676002)(4326008)(36756003)(2906002)(41300700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2b/e0C/lTI0YmFmewP0XvLxqJDw1Sr3mIc5I7YEwz2oSD3QJJ182kx/vj8JD1evsJLMUHdnKWYGClrTzzKCViakfx1+n0ej4rzyPNoqq29QQmYSPZqI/fvMT/MQ3MBIrUcnalRDXNWFC9fD5FBTDahe43cwugMjTFyyfo9YqfqXaBMuB2ZFRZhPcmKzo/p+XHfRoIi+j4kLGUwC8zBMqjObfkdTonSuVn/PiPFpAurG1NXsprZf+vRvsT4/CIKfuob1H3PuwWu+lSAhEqC4hcs+Y3Pf1wpm0NrRyfi2JRkVfY16k+BbsChdNNH/cqJ9eSPL2mCLzPwn4nBDltsYeLJrAPBcdBTiOSDbYfxpno0jBdfYcXsBTHIBunAHd4XMZL6lnVG0gnTGbrxJGxPu/zQ/moz4dU4ufOwLfE8SYsSPgtYr/LUk9IWDf5l7ziAleEb+IK8zID5W2OJRuxN0L3gMM1HYVLx24xAXGA9//5kA07GMSsHwaw+8WCl0PkKW0UKjLAnMYkzD7qxS4YlJJLun86M640YJ1U17RH9t7vEbT/HoOtQVdkAcJE0iBNPTE8ka7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ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Cg22hGIEIqmEXR7YU6E7R9QHWL1DpLbGlwK7EGWfMoznPw4dE/tFUVjzMzqEpZy3oPkgSxT1zizEaE3X2xCvzXmSuW3n7JjXhis4GxyUV8CtcBqkYQXeKpTrIbGrPPcXvbpSmbGWd1fORQ5g2KzLuFX4GP9oqTRYbaErKJQ5wPt763fo4Itn26/3htjIRtKpH/Q69IBmlkH70Z5NAEWxeWC5vxnq/dKZLkOgZ62ft4va0RDFb39Kkzl9rPWG7arjLkfsk+TsAsaceWqlgo+DPTVNcT9SEf+FxYtj/hLlosxEeR5tl+HMaBeLWqWeZ1BSZtE+C7JDneILsVsDySCgHgj426TAZ9XHgvgLr/NSWkeiRoisR+ZPb6m24mkJFZkMmsPke83GT5fyr00AO9TzeBc4KfnC6zzapY6tM5uUuylVcYwjNuYsePNcx4u28PAoP07hNCLnWyNQrjYlZDTogv3jsCkwpqDJ9k3GpA16iGbQAvX9b1d0iiecpL02vzHYXDEtPfbG6swfbCkbuE2hDrwRFPhI8hLp+2BzAnQ19F4HwiS+kGhjIzcwGDn61m+gqlj7x/B3zkzRbZYYp9OaMgeNRvYJgNyCZWA9vVZo7WU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1c37a9f-8425-4992-03a5-08dc1ba96aa3 X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 00:22:43.3482 (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: b1hRljiCbrzBUccajmE9BJXEv6Ib0XEJskbcV9iyW5x20KWlDZWRZLT4SXrwSghhTUmEUtclnSCM7RSOWsdJNjk+Y/n2iwjw79JutJY+wgo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5340 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-22_12,2024-01-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 suspectscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401230001 X-Proofpoint-GUID: jbeh9t-BYdfWiF7ujn_b8Q5clA8956oQ X-Proofpoint-ORIG-GUID: jbeh9t-BYdfWiF7ujn_b8Q5clA8956oQ It's common to get a UA when doing PR commands. It could be due to a target restarting, transport level relogin or other PR commands like a release causing it. The upper layers don't get the sense and in some cases have no idea if it's a SCSI device, so this has the sd layer retry. Signed-off-by: Mike Christie --- drivers/scsi/sd.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index c2068d83c812..4196f722c3f6 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1800,8 +1800,22 @@ 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 failure_defs[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 5, + .result = SAM_STAT_CHECK_CONDITION, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = failure_defs, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = &failures, }; int result; @@ -1888,8 +1902,22 @@ 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 failure_defs[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 5, + .result = SAM_STAT_CHECK_CONDITION, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = failure_defs, + }; const struct scsi_exec_args exec_args = { .sshdr = &sshdr, + .failures = &failures, }; int result; u8 cmd[16] = { 0, };