From patchwork Mon Jan 23 22:10:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 646501 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 DCB47C54EAA for ; Mon, 23 Jan 2023 22:11:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233024AbjAWWLo (ORCPT ); Mon, 23 Jan 2023 17:11:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232964AbjAWWLj (ORCPT ); Mon, 23 Jan 2023 17:11:39 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CDD639292 for ; Mon, 23 Jan 2023 14:11:16 -0800 (PST) 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 30NLhrB7029649; Mon, 23 Jan 2023 22:10:53 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=tMeDb2D5oHWe1IEASheYyeeKmhnKU7pcjAALiQckKnw=; b=dqXxLdtSxNOk+qDbhdg0g1Xn+kf08tifecqTrZnRf/ErcmRenvTdc5V0iSI/EceA7Ald NAwQcbgTYMNlpU/KDaQQt3Pz4nudHY35zraPfNnxf8yoRBSZ6QgjrC4n2In3mMZg73pw AbdeePwUnd160Dh2OntbcTFUyFWDlOo7ZvlVbHmNaBU4wD0jocqAxbpFcUBqH9OOtcEB F5h7N/LKna5/ImLmr/XpJFfdIPWwwJ+X3LgSkuWHzBjKoGzXPwdOJs+G1+0e88lk18um Uf4Mneou4TPdYkOf3ArpsthYs5/i7sLgBkW+2BcLRUgObyOKEDCDXQI+Ijb3sNNxw5Xp Rg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n883c41nh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:10:53 +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 30NLXig0040193; Mon, 23 Jan 2023 22:10:52 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g450sy-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:10:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SIIL8hnwFk/CTnwp8Yh27XTj30dZNgSAmzE/rf4CUxqrejPa0ASXS9edDjm3AaLv47opi+yIyTnxAx9RluyfqpTcX9OqkSBoYuYvrCiLjLRyRNw+fWlvXlONRuIjlFMd8smMakEbR/rtC4Uyku4XE5EE17ftwNbp0ASyXvYMMKzdwhQqd2OTYCDjxtKJaL748FNtXuESKqy4q2z91EjaA1SR4U7cQ24wXtzEY4Wceu+N1Yne3gmaz0Fet2DJVtEUYp9GpHe0+vtZLWvRsaMCPqQ4QlcYaZuRwBzcCI4+/qh3I2Ew4UQ46DzMEvN0PZ4K4o+wIGtH8eYf5scpqHkaNQ== 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=tMeDb2D5oHWe1IEASheYyeeKmhnKU7pcjAALiQckKnw=; b=awab1DoRFgWT9i2BevwIyqiorTHztxnNflottT0jRjumI08AN+/+1/YKoTPVBz6+Pwn+WQd7MEdneJ1tYNnbR9HCU9h8+jkBcwo6ZEw6vBUmAMGw8PTBBbFSO2sWrR+x3Aq0243aIvUDkAxG0iUHVlX2gRn1C0HZSDgAxxK0EeCYqLEVJL74dwl4WPlTDCdxn8FB98T2E5SDWFBptRoKJlR0Ghm6seQE78gNNDrBFCv7PMAEbbwacHK071N8ejVIZMN9GZe/FQz/OQI/+wmqaE9F/WqQnTOYTlYb7RRx/4lwfyOGGTaNHlAoDCBZ8Oc5JD0AO2Lle2cQNqP/6OnzMQ== 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=tMeDb2D5oHWe1IEASheYyeeKmhnKU7pcjAALiQckKnw=; b=dIdkuaLPPHMOhq5WrmlqowaKWi0KnJPHW+7brBHu1vUOArsv17XbZm9G4TdWeb16P3aMCPmV5V8opilAkLcaScdcnXLiCMRkrsLK7fMG05C+N0ootHkmhvRYaPE67eXFHo5niW2nax9Zx8YlbPtWuvFRhizPwNiSJKnZZq2P66k= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CY5PR10MB6167.namprd10.prod.outlook.com (2603:10b6:930:31::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.9; Mon, 23 Jan 2023 22:10:51 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f%5]) with mapi id 15.20.6043.016; Mon, 23 Jan 2023 22:10: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 v7 01/22] scsi: Add helper to prep sense during error handling Date: Mon, 23 Jan 2023 16:10:25 -0600 Message-Id: <20230123221046.125483-2-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123221046.125483-1-michael.christie@oracle.com> References: <20230123221046.125483-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR11CA0009.namprd11.prod.outlook.com (2603:10b6:610:54::19) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CY5PR10MB6167:EE_ X-MS-Office365-Filtering-Correlation-Id: 81cd3778-30bb-46af-10e6-08dafd8eb016 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KG2Oq3TKBm2OwIDrCEE3Sili+nQIW/fTLHSb4t13ewWUtkC9q+JvMEj7s3Bmk3YLgV8/3OUChbA3B/WUDeYWDUfURHMX3AW9pg4el/0WLr9XSfi/zwFXTJl3LNOYaAoW/Okr8UnfRZAmeh4cdeYSOqJU/OUmrB7OnDdeJ7mjgx5FxinYKX4ZgwdaeDbCKVCyD95//Znr6mWnp1CyVgncqcGYXCxBnP5OI3V9YYeRrYpzZZh0sHUp+h0KnettZTccZhxeeHGWixdVUrZU79pjUriLGGyE2B9rEy6VQcudWGkJc9Ww4c3ovfbQRqiMjzChcDpjdJY+XQQDLjf2oz5Nw1rFujOtycN7GWi+9Ye3ZZXoByQv/VGkIhJD3iOgjCs10FBcXRXa2n048h3dHBnVHraYBmGrkWUmAmZ4+tEKQV7uTOMBdTOEHdVjwWBLYAybrXxivGKHq5hD8q6T1iMLdjJMCgVi36Z8fSbaLAYGOQdOdswOTjJ4bHfhWPKkdfzUW+4S1q4MI7DKQPxaKM0as/Zh4bd4aLkmtuoiMyEZfwjAO8bGRiXNeTaVOyNQyLxAepjYsWvPlRJdyLdRizWoiPjwxR9qBmb+9fb0cIATj9qCF0hmuasd/tcUGX/kFHexBQuetTMMQvMPiVaVf00CfQ== 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)(39860400002)(346002)(376002)(136003)(396003)(366004)(451199015)(86362001)(2906002)(8676002)(66946007)(26005)(6512007)(66476007)(186003)(41300700001)(4326008)(2616005)(478600001)(66556008)(1076003)(6486002)(6506007)(107886003)(316002)(6666004)(38100700002)(5660300002)(8936002)(83380400001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: L1LJphzaOT3cwCv+XXSsnTCWxMBXflz+n7HiuoI89A/i4mVxEt128Q7N6/Svg/RtEQd24HK3HgLndzxcwshD0HLYceFagr0Zx1bBMRU7Xo53rtBkUx9/QZvPLEYC7JBINV79j2h0mUdG8SU9d3U7AkxFRQwcJFIwLD4GiFJQCLJnGA1SWo1X8+UuKW0IaDRwktM3YDhaYRLQx1wYXGLKuhJvUTde/nfo5h7VOq+6BN6PpgtWgA5UY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yH208W1Uhk7EAG0W1f54HEJRPEBH7nbJAHksG1pFRpqd3Qy6nXhe1hLkT+UZA3MMRrR7gZOmpV75An788a2aBCyKIIhpMD3xtY5LTfuqyqfonqSD0u4hzv2pe6qa0YkAtht+kHZtO9quiGCfY5HjhWksowxkex6e0OFDt50KePyFJkvV7myVnHrkUsDcjKlvXVafRbTah0UDW5m/yeRW2TJs5zPYNmP/oDx46Nlh5MueXCQxKTNNi8cqVByjLRTgdmKlpTebjuumOt5WhbcgH7s28Bd64I3gKA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ZSDuRrjnhYPMPvDpIxr04pO40qFVYtXK26pLQ27rOwYCxlclC03GmcrMQhm8bQoYj1RuJWlcqJ7rmt6LaSCvz7RWWJWd2gUP9Sq5Ie5XpXVeCx14igfvBwHjOcyjleEmOsd6KDpAccW6RH6DNUb7oWfhnfHmxq1dYJXwJQDZ03utOjHKX2KvKveFm0yrdL+R7SIVNC1OldACFnRYbdeHRnyVJzVlW76Wx64KsqrHMav6xgEckp3VlRsKcWPk7ocgsMyONe3WrcohDz8LVdxJxohCIqA/g+YJCZ3q2FYbUmpzU+CTB+e35uTn1KCSbUfjdn7zAEfbDTfMVPSpL2dFaVisEhsLaTGzanhZtrZsMAsdhXWfRe5f/IryWZtK4PF3KHRs5gOMkjtcRb+4xzOXPmIBEZxE1OyYdgJfJEIEOVbQyIggQdQs/gL51K7JHFHjYvJKfXB/8n2Ogllw7BrN52zRcwTtPpwu1SDqBWxxDnor7CzuGTl4NeLI84jhMq/feOOqdRhJkTYY88DzP+oa1we3bM0OoTltJBLvZr2jEYTzSERp1lHvjMXB9fi+1VqM0kuolbgXqbfyWNU1TNg55LEKCO9k4WsqB7Pq+d8wZ2GplRQoVGJgfGLcx4pXPZKE82ItNsMCBqRtxzX+iJ2HFKmhOch7gOtEZd5VljICcai4UiscnriNiO0VxdkXV7684m5uIakUbTBHPF0MoqHJLxRlnDx4noZ4BmldEkA9nBk0u+PU4EpPJ2d1BojjVQHrz33eF1KTUKIHU8hOj5AUUI9YxJN6qyUryjQySqC314o1PU2xDnGSoYRRDxKh8+uQrLuK2gH4PRYbK/tpkV28Y8fP61wrBtHW8hYl75drUlcHdEG0fCsDKD10NqAvZiAr X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81cd3778-30bb-46af-10e6-08dafd8eb016 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 22:10:50.9328 (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: WbgkgdGA5/TVnErEPRpM8gG2q39auWyjEIwk9qQe1uADDiBjZf0dZHZci4R0t5Iwt2EsKbdZcX0LJKmUUFDMMonsrbkYqqgydsPKYboB8lg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR10MB6167 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301230210 X-Proofpoint-ORIG-GUID: 41-YzJ19UHXuFy2SKiALtNjzCefTHNJY X-Proofpoint-GUID: 41-YzJ19UHXuFy2SKiALtNjzCefTHNJY 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 a7960ad2d386..c68db2c39016 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -518,6 +518,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. @@ -533,14 +550,11 @@ enum scsi_disposition scsi_check_sense(struct scsi_cmnd *scmd) { struct scsi_device *sdev = scmd->device; struct scsi_sense_hdr sshdr; + enum scsi_disposition ret; - if (! scsi_command_normalize_sense(scmd, &sshdr)) - return FAILED; /* no valid sense data */ - - scsi_report_sense(sdev, &sshdr); - - if (scsi_sense_is_deferred(&sshdr)) - return NEEDS_RETRY; + ret = scsi_start_sense_processing(scmd, &sshdr); + if (ret != SUCCESS) + return ret; if (sdev->handler && sdev->handler->check_sense) { enum scsi_disposition rc; From patchwork Mon Jan 23 22:10:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 646500 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 1E071C54EAA for ; Mon, 23 Jan 2023 22:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233039AbjAWWLt (ORCPT ); Mon, 23 Jan 2023 17:11:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233013AbjAWWLo (ORCPT ); Mon, 23 Jan 2023 17:11:44 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F60A166DE for ; Mon, 23 Jan 2023 14:11:18 -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 30NLiMNA020042; Mon, 23 Jan 2023 22:10: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-2022-7-12; bh=N+pmxlRd9rLb2qRFgocY7ga9Tgs/yAr7VbgDS5iVofU=; b=eYoDr9KXvBMUkzpf3xYMtxqVq15oNdy8XI2uHyAH+teCSzfpzoSO4a/f7KQi93QvgW5n wuEtvr2Zl+11eZDZVJtfnUsJBr85DL1GM4PKM478QMnJmFIrQARG5v3adTcpxqIYSsrE rtAU9RNIbLl/feC/urUtsObah9AqvapTGRcV5y6UDgKSNgQBxH6uvoqMpwIywdr9xINt gvZFjyN4TX4Z/6hCJSGDLk9M5VFU3V9XBrUqQtbgA+lBg3oVQdJDyADE0Qh/bTOqccJN VpKHiWBSlTECQoF6/ahx45WNKmMhhDkyEtAncbooIlSlePEt9myBOhBZOKyPL4ie2YOD eQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n86n0v3nm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:10:55 +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 30NL8TxF023227; Mon, 23 Jan 2023 22:10:54 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2100.outbound.protection.outlook.com [104.47.70.100]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g4e42p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:10:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=czaVSDu8FbmmQiEQ4IVdHKcNd0O1R77iBJU3+h2DcojWDtrL5jwKsOFfB2XT/e83pIqspIY8mQU9iLhpm+SYkSb+WokokiIJfztRQER7DeJNcxa3edmlmnYiUR1LY3rbm8iHem0uGj8bqKbcisWazuz0eGbznIhukJqxU2Pdw6efCP29Xi8Ibr0Df0lUp3KGdl97qdTckokCrdY+z2p0WbPKr9MKOmNMIfVdkcjt+/LG1aDl70/H+yfPpIFjbqFZIDWY//4sHxJUzcw62Uv9GFtvBlhU2HRbRgwHzx3gGM/b+mZBnPPHZo5ykkgKVUNsZA9M81DYLs0eFqPYjwoTqw== 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=N+pmxlRd9rLb2qRFgocY7ga9Tgs/yAr7VbgDS5iVofU=; b=YtpDNmXuc1+dLmqR7hfBwUUxbd7MdA+0uJQ/vNYJ5AdgkQBFAPG2e2aUfhPSD8nwSoi+H+uVETCLg0tcKjvg0OvpUylFSWuMtLKYiYzJRirx+prH0dz2ne4ix8fi088mjVfe8vw7k+xhaNiHtwqYQWEYeWwS0UMjpDwMakcP4zZfgTNKjTHhfu0fnSC29YeURV0+Vd3fGcuns1ue6GBfIxg/mDPXN3BajmcpKy/132vWLrvXd12zUDFKewClQEX6HuFacxI7STz6sNOVa3jDWAarWqnj0Cs0w0CpbaRx9tpiNH3i8Hs8mDY7ODkUcgimOgJNpjygRWypZrWOGYcDxA== 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=N+pmxlRd9rLb2qRFgocY7ga9Tgs/yAr7VbgDS5iVofU=; b=oEPd5SYM9srJ86D7pApQxASzjEUzmw02UTZJg9kUonwcFZU2ydeBTkFrXE2S/tjc/G/tf1xmIgXH8e+6s2NUbJ2JHcspceXkDjYXuOTtVGGwMrzUbxQ/ChQZzDd00CET0kZ4mUk+rBNwNovfksq82w9r20EWTlX7aeHsghcScrU= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CY5PR10MB6167.namprd10.prod.outlook.com (2603:10b6:930:31::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.9; Mon, 23 Jan 2023 22:10:52 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f%5]) with mapi id 15.20.6043.016; Mon, 23 Jan 2023 22:10:52 +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 v7 02/22] scsi: Allow passthrough to override what errors to retry Date: Mon, 23 Jan 2023 16:10:26 -0600 Message-Id: <20230123221046.125483-3-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123221046.125483-1-michael.christie@oracle.com> References: <20230123221046.125483-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR11CA0030.namprd11.prod.outlook.com (2603:10b6:610:54::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_|CY5PR10MB6167:EE_ X-MS-Office365-Filtering-Correlation-Id: 3aaf31f6-8502-4666-2519-08dafd8eb134 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3ghofE3lGKZqG6l4HwkR4KpgAtGWuyZKfd1RwNrNAdAGKCLZZQGAFylvB4q4mp/ExP5ZoNSerULv36qMl8DEiikv7Q5kAqZr1JW2YrDcRvb59iKlbC/rioRU/rCJg8J1cylOfxR+dRCuJylKbWqNtJN1pLAWpnqAANbzFO2QnG+mPb/R5Qy7dBoOg8iGmADJ5ijr8FTtFwrOWwqrF1hjVZZxcpxODP01Tg8nOzL7PVsD78oYCZy+7Kprz15ndHrQ4zep76O+WXKcnXt3DnOsbZ+nuAi/MUDu9hWyBqcCQ+9uDKO5pboD6xPm8NqZJtG/AaZ80WZBI8UG+LUEZ0rxLRV0uIKgYOhCzo0d2KlkP+OCyr9WprSjVh4gUsp2l6ICWzbtvVOT9S19wCJHCtFijCE2ntv3Sv085nyxDngfQr2wb8C0OS+m2c8ls25g+iMhNWcM6cgUe3m77y0sajWNTAe4KRkmk+YEvkR6ip+JRtwxoSA9q1ukt3ED0BLuhyaPpkZljjUxYcbctaDW0pnpPSx3C1nBmuhl7+3psz3qWvYt+YcoJAKIPDw3s7ypnElqGLurTLqrpBdLcLLw939de9xflEEuCyNsk9JD5ovIHr6omBW+bOnfK31tk0JSz+aLf+SldIvWb5Lj8CMIevZF+w== 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)(39860400002)(346002)(376002)(136003)(396003)(366004)(451199015)(86362001)(2906002)(8676002)(66946007)(26005)(6512007)(66476007)(186003)(41300700001)(4326008)(2616005)(478600001)(66556008)(1076003)(6486002)(6506007)(107886003)(316002)(6666004)(38100700002)(5660300002)(8936002)(83380400001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Lux151NM6nos+vlQlp49TIgIMO7PrMBzWVNiD93RqLSVcTZ9XFME8ve4M1yKm+8xWv+huFdmRclO9X9Mwm/4cCzhi+3XcvslbSmkGMWCaU0yIagVP5OlThFqc2iQlZRoQDeILwKloAJjBHJG1AiFjwWT2iKa/0Y3aPB28ZCrQ6RGqxvieUpggWzwQ44TzN4nHe03rLgrkl5jjU1qwIJIArhFSzenvj8NEhVCiRxijQ/3jyHrNWHRoa8+Ca+Mg9EgdggRQE4Zo4aXARSrdLtbm8MT7TT2kpt9zseFjYHbC3gcVAOrO5krt2mHXx/vw97FUcqTxM5Frp0dLm8s6FW5hqe4RQ3NjJn4WMkfua3ssLJwgWTTxbdAeIzwKwtzGbmXa3Lf6eSyzJRDtvQLze+LOwsh+HPkBLz6Eq7PCBB5WuveXuvfxQDDgjqpUc4IWFu2rqxx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FU04r83n328B491Dikp4QsiRQ6xi3i0nW4A+INQC2+eeTAdvzjiSQqzTjw1p1uMbrGhPpBTdnw60FK2H79+ZKDzQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 1KV7S4nD0GIc8N/yQiGcV5dzqVwX91r3tVgM5nRuMRrblAM+NtA4Erp9edw0/zprQB4Bk2+yb68CgZd+nu94PpzhmD+GbK9vtB53r1kSwltrvdMr8iyutQT+sHtKZQoe3qDgVJ2tw6aFpfb589iTsUFCAi9kv/xO+S7SnZ1futS8ZBA0osGfzoThxfGiFc4S4iojUt1mD89dhDsDZderPf9eptO08jDMWZV2MmtiaOEsLI+knM/3nlvSUbrXqJHjbBOe7pCfGTt5jr6zyhOpEGf6xMcKrARM7m8qMbV/JAwYvZYmUpekcI8l/s+luvbz323K5v2ISCA915ma/uogsAlupOnCJIhp9LCiHA2CvAbj1nDCIA1g7ofW/nS2+RBnLtISAHl8PatyEkfrolmjZFyBuCJW5htyn82K6lDQnGiZWRnMfSDctt9KoIYgeB6kxH2UMaBIUBR1EGhX2HiH2saXeUq5ubpAlA3+hL1xnfCaupqUR7V1rD8txT2mYExi+Nga5OC5vRNP+k8VXFPUtT9E9e4xqG9ynJm6m306Nla3fIClO27CTPQFaumcNkGUNulnTryh4AVg7m6Yb2Iwyyx4xyKQxgYmrGAg7bjqFXIDY3dB1yIfwYgecr2WdK4ED5TK2q0Cm0uUfJJO2FT1+j9cERa+02D2qNJ7tFDB6oUTfKQdmsWMaHBclBd0JWhv3pdVlYXPJNG0nWyClEkWlvGjtwlGSCBrZKhnpLxZH1QQQ6xzGqKUHwmqqGnzspot2EbKC6mnhtbUHnQmWWehyi11S9wudKoyw/z1TF4D6BGonWOrcsr5p8+cXHlLSE/v//d+JA1AWLeWoJdVuaOkBYvdTaU8eZx9/799RWgTJSkLv45t1xfmQrMFjFgxCEh0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3aaf31f6-8502-4666-2519-08dafd8eb134 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 22:10:52.7608 (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: KjkJNPV0BpzVHn6CRBsUynCx37hAr1rwfGNNgTdsAinf9Y+Vk4LNHEg737x8zRt++tDQE5WsjEdv2C2eowgKDsUTFtGerDgp+xZyOrMR3l0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR10MB6167 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 phishscore=0 suspectscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301230210 X-Proofpoint-GUID: WLw6I1B3XFGV9BJ2E2T5NpLT-wlA16LN X-Proofpoint-ORIG-GUID: WLw6I1B3XFGV9BJ2E2T5NpLT-wlA16LN 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 c68db2c39016..544bd97bbf3f 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -1830,6 +1830,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. @@ -1858,6 +1932,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 abe93ec8b7d0..0233623ec245 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -185,6 +185,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 @@ -1126,6 +1135,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 c2cb5f69635c..e410f485a409 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -66,6 +66,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 */ @@ -86,6 +103,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; @@ -389,5 +408,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 Mon Jan 23 22:10:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 645940 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 87B43C54EB4 for ; Mon, 23 Jan 2023 22:11:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233023AbjAWWLh (ORCPT ); Mon, 23 Jan 2023 17:11:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232907AbjAWWLd (ORCPT ); Mon, 23 Jan 2023 17:11:33 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77AA239B87 for ; Mon, 23 Jan 2023 14:11:13 -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 30NLi79Y022518; Mon, 23 Jan 2023 22:10: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-2022-7-12; bh=MTfW6axGo9QcKzmrt8pr0el/vEl699YFzwnb47Igr1g=; b=BhrGUnqQghtfPkR56/bxhd0GW4q35vDo0ulKu7kcOi4aA/m6J1ZooGmbaA4/FW1xRDKh E9JUJLSEyEOpwFW3EDM5JNkxwfom8GxlIJsPULYWy9K/4klkr/KfpGtosLBwhoB2GpJ4 PEls7LNsrA+h2FU+V9D3f4KRv6CEqpQ+/F/qei4XbZJqxfzZvqMIRMFDGcJjowSdo0a1 PxXF1JUEg3yzISsmLSyxZ0D5GrpApidzcRJnghw2015m+X2FBoT+9UyfyUdIuX8eRnrl 9Fnp5x8PBIA608IM90I28nmuTvpG4DGGl194jZSki3zSX5SvRwTxY4bLTl/3ZUF93+gu 2A== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n87xa417h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:10:57 +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 30NLAo0W023249; Mon, 23 Jan 2023 22:10:56 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2104.outbound.protection.outlook.com [104.47.70.104]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g4e43b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:10:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OCnMpz2vrqUmtwPqLFMb/tHuBFf/bxEnvkr0SauWy0Y+5a4zpRvI4Fdy9rNJgDWpccfWU/gYzAhoFJRW+E3kGgMh3ANAzx3MsoGKOi6iMYOnB0lJNqgppP558xeo46bK90FlB/cY59EKozOSeHJ1r7bq3oS9risC/WWSKIeySNCaAA2AXINu8GscXyYhomW3QBw+cjOTHD9iVIv1gcfpiTYkg9xYbklStxgEvUBcJJtH2bUumg6+LxXSPFpYp50jQy6oDgzvH81slmUbgwWDDuoW5HquTGvEMf+ceUYovKRLaeND/Amfy3EU7WSyFN0oc3LhPMNWt5z6ainut7jy/w== 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=MTfW6axGo9QcKzmrt8pr0el/vEl699YFzwnb47Igr1g=; b=CAn5cMK4ejKmBjwr7snc1RwK7wRGHb+RBt8guyDPuAeabVbMKePC5G2bJdxScbxro7NO5DmUJaJdPkrOrhFjkQxoapUF+BAxHMisGUW/4lOUjmBEMqplyLCTmKqt2t3M0t4mzGVFsa8DELWYEAgZqrAmKpvwxrURX62F2NvTWx5BlPdWc+tevBJtc/3TCr8H+pTTAtmCbjTTsPVTSRTa35FJ807+OTXOq5Xb9KrERswpKy47aFr3G5Yv+3UoKKnC8ftN6W7wHPLAR16rv5eowRgAGbCEGxw8NcSGuGSwfE6w4DyowRSm93yY8AEUhVSSLTuOQuqUSVkPLzrZWGCtIQ== 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=MTfW6axGo9QcKzmrt8pr0el/vEl699YFzwnb47Igr1g=; b=tqBRteBkHwifXB1TPebU9wjaV3UzNPFiIT/no9waIfXNKCx+GpWhT8ZSEF9AgI5utaC7HKWIZK2V0xKcvb4rn7+d6YDhqT6khtwm9DMY1ljBbYTZ+Og66xrf9d49kQAqaLSilccLzut86Wnx4P6mGNubfl1TWABHCCgK6z/oQWI= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CY5PR10MB6167.namprd10.prod.outlook.com (2603:10b6:930:31::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.9; Mon, 23 Jan 2023 22:10:54 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f%5]) with mapi id 15.20.6043.016; Mon, 23 Jan 2023 22:10:54 +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 v7 03/22] scsi: Add scsi_failure field to scsi_exec_args Date: Mon, 23 Jan 2023 16:10:27 -0600 Message-Id: <20230123221046.125483-4-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123221046.125483-1-michael.christie@oracle.com> References: <20230123221046.125483-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR11CA0012.namprd11.prod.outlook.com (2603:10b6:610:54::22) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CY5PR10MB6167:EE_ X-MS-Office365-Filtering-Correlation-Id: d5adbd8f-7066-4f75-146e-08dafd8eb22c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O2Fi/fuuXCgKsGXhKK82diqmJZUolQ6xmHGEs9rFGrUsiwUBD23K0myMUfd/Oaa9ujxcH6wfxnuNPGwMdlK5EkY+pHVP9mi+Uqtmg1hllYmARfK9ZOKCl7hkcBFJz4IQQN65O4ll7LAJhnzXAVMKlXfYteAIEypJ7pu1DjwsfOng56YO7XCOXrfnNEPGzFc3OZM00SeXN9lS1xE1s1VxNL//V0zjs5iYM+qCVIJ6ENvotkQ0EcYpBRvWX66MQyEhCDnxdD3ATSaiEHboNpn0ZkX/kErUWmoaesXFP216Le4Yjf7o87MyqV/tLDwzuW6r/dYl/WgK46yMBw4LPq653+mJTOTROZy0JfoFuN2WEKMKjVltRH83ypCJ3hW0SrgZ98MCVirk/RTJg7121fBAdyxZa6+y7fOmoVyaWVlycBlMvJ6N6niu1tP5nUSwrLAuM6+CgzfmxtTOmzQ6+VHpYox522Kgt9Xv6aQNojXdIxxjQqvO5XSqVSAB/jfr0kf0u7Il5nQomfZcbLJfpdR+CqkweKurUB0u11UoeNGO/pcmxDHbDSq3+jX8uX4IwVc3EmBfcTZ7tS8pJ/tHt5xuP1PqkMuyfKlG/XAadqwjRCcbf6kcA4vSkCvczwLD9+4Ip6osO3kf0akCPgOSmFY62w== 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)(39860400002)(346002)(376002)(136003)(396003)(366004)(451199015)(86362001)(2906002)(8676002)(66946007)(26005)(6512007)(66476007)(186003)(41300700001)(4326008)(2616005)(478600001)(66556008)(1076003)(6486002)(6506007)(107886003)(316002)(6666004)(38100700002)(5660300002)(8936002)(83380400001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nX8xPHF6t8Wz9FYQHj9H2fjwMiRcZnWdetU3Weq6m1Mz3n0thc/jFl3B6SPr84+ftnOFGxyo7nZXpbABnHZ/eh2EA9IvVTvAhOscutml3Y2NIWtYBzcKpTwkkHCz8JMzcYt421jSpmAL7YzFwTwQnLjsjGvrZ3y3niANF2/dBcgTvXH8XPXn42ECQqlbxSjNpW56lTfPaxeVNFVY3H0YA9Pif4y0pFe6lJcbe3h+wjcKCst68NfGbEqcFlHMUf7wVCY0zExK512obcxgEv9AFeUSpJt+BNzxZoF4mMsOIQNERifLHvQ9MDOqy4g4OiUzit+LQxhfrJ7KUgMxoYDhX6PO3sEQZcxjJ103noXwYm+Z0YUP4Cxjlue/9TeKVIOaSSB4HNulpE3P2jtN7CzKbG6l80L830NSXUftmYW3/0IHjNdpBDcZDAAcBgEB9rf+CYoOhdTBguFfbAN59r7J95I8Sknv26K8/ABJDcfIA3cXtoasG5boeYTG2QcKCF1M7lcP++zI2VEGgacEEcrQT27w/P3K2r/SC2tbc2en/VTS5Od3HTLKRQ+YV0zKyDyI3HuMnoPgIO9Jj7e0L8ObSaxkBQymXNHhkat6nuy9yxLfeZXkSxc1BwCCfTTx2WSoy3V9vHQwKJnTxlFDelZQlBNX/Et+D2TBOQFaBCc4hX6AnyS3r1NmfB1iRhbI/vbTqEG0hp6lHQZGhGhVfhVxPSXOnX7neRPY7+v+NMIF6qXENkZ2tzmfpX3p4zLDoa4WhK59dEkPYoU5rqrESp+WtCPJkSlVJGL4ZzbpGx2kjZmNNUgvKVOXOcQNIekADADIKsKM2byCq7VxmbK8XzKamr1fyNFRkU05kL3D1WqLE+N2sx6c0AXEW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UCZ17BxvT83msDpTAE04JkJlie59twxBI+Kj0mB9N3j5pjawMm/ZbjpOauAVnHC7xyhM5qxJ50Yf6KhnNS/PjeeBX2R/E1cfqtU3Yzd2lBH4Cez7BmUaSCylT9x/aeg6QGPGN+u1bEpfy5jw5FYWQQUITvJJRGx7k+D2eM/gMb0urNlj3ctoMg4Syc+jvr+cY/OM4LBd14G8lM7yOnQgIt18wbbBQ+pHS3U+txzGytCmOtkqC6CeZGoIGu8tzXY+7z3RiDrOU+mm1FSCUhNcM/O1P+tBcuy0lNqqAPaIvJnEi0WYLyEAIVLY9PrTFU7EgWfbRHOUb2K31oj2iKsXMwQ8TtjK8MmTINuemzpMSaf3PUIbFvXbuYNp3a7UmCS1YoXUR9qXMPP2WP8SAOkXCuXJSh3FCOs6TTKNUYOpzSm6FPwjXXpF+mZZRbc6uirGz6lakRCGZG+bHFWFWQTe1YjJrWh0i109viF8cTdls7Yvx0BT8uIhk6XmTw3O1fY4bmk6FtMupoC4WxFtnIicCXyOqr6kGKl4PO50Um7I5sYwPisU9Nba7NUwzZYdrRCl4g9/UgUdO+rQxF/a/0C/SvIWawt+vjLYaqrxHUa3C/RoK/FaSP+vrwm9oX/7odyj2gj7 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d5adbd8f-7066-4f75-146e-08dafd8eb22c X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 22:10:54.4169 (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: xpuuOfnu4A29Rz0vV6EhZPAqW7Ryxq981ASM6pO+CjBcvuLu9vJIkJeiLtqtYx+OjaZNcvmcXLafK8Ol8MXfIZcr0pxjAgvrAzooQaazJUw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR10MB6167 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 phishscore=0 suspectscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301230210 X-Proofpoint-GUID: P6PZHsusVUtsw4Zj0cttlJ_Dog936PYI X-Proofpoint-ORIG-GUID: P6PZHsusVUtsw4Zj0cttlJ_Dog936PYI 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 0233623ec245..50f6c967bd4a 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -238,6 +238,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; req->timeout = timeout; req->rq_flags |= RQF_QUIET; diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 7e95ec45138f..522a19b9e2db 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; @@ -463,6 +464,7 @@ struct scsi_exec_args { struct scsi_sense_hdr *sshdr; /* decoded sense header */ blk_mq_req_flags_t req_flags; /* BLK_MQ_REQ 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 Mon Jan 23 22:10:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 645939 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 EC59CC54EED for ; Mon, 23 Jan 2023 22:11:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233040AbjAWWLv (ORCPT ); Mon, 23 Jan 2023 17:11:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233045AbjAWWLr (ORCPT ); Mon, 23 Jan 2023 17:11:47 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E18BC38E9C for ; Mon, 23 Jan 2023 14:11:21 -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 30NLi0Fm011288; Mon, 23 Jan 2023 22:10: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-2022-7-12; bh=JaZxYv94/X51QMrAc3XPYEABLGjgKTB8h5z4CUHhVPQ=; b=MS+6vbN+/eyaB6oeXNDc82TpLKMZP3dP3E6TtkFrXmz+1hEBg5dfro3rwXQN/z28+Anu l7yA+OyFET/pRFvMiheLo/pwMvJQyckEUNHHDmJlkRFgzcs+93FbIbwkpBmaSo4gALzA T2Tndsh273M9gbqNHcwhlZYpBwLf1xfLE9rAZcPAUdW3qHn3Kz0Cp9C/iFwaXaRVR/bS kYt7/jaY0XyddGe+4ilAtvigDfftvcRtYtlmQcLM6jsPkSqg8W5nCSjv7DgJkKaWy4QQ R1ZTLVmCCD4nYRmVb10H3NrFxGtl27fOxlUcAKlTl4qM9IGcXwM+vtX60aGsYJ5rm9gT rg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n88ktuyj1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:10:59 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30NL8dej039567; Mon, 23 Jan 2023 22:10:57 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2105.outbound.protection.outlook.com [104.47.70.105]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n86gaxjnv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:10:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CuvEX5Tq/ZBKVz2VJ+d1a/4n/lIh/tnpCsp7NPdmsHeCZtme01F10TPmDnU+qnoO5zt6uMFvEnbEpCwNTHLzwMeCCtmDsLDGVVbwaJ4hf326iQhHLVSbY9v2iWq826V75lkJOFV5UiQ/J/fve9RdFOFBiJH9usG6mRWx2coHuNXOCIRX820WH83P7xlsY90/Qs2VYKUVnqg3X055iMkbCHH2ugXa7v022GHWrDbArVsEDLgeFDwVZYYHLwWKx5x+Nhgbn39YOYZ+km8w1sfE9ip2FunQ3CHATeCpjQgxSbMdaTA4k78rNGWbSveZjcQZA0DPhhRmOG76P0qYWU8tEQ== 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=JaZxYv94/X51QMrAc3XPYEABLGjgKTB8h5z4CUHhVPQ=; b=G2/rmG7PBvNztBAZ2AWY5IGwXnLwdbnxsEUuGbAneG1ltCj5jRC8K5RUhdhq2dew26yfmC0uBVZ1DVHjrLMTcuvXWskL5g6l8SgeR8j3AXsGAdFLr1+MGAVtt94F7wAWFzTh/AH37jVGSt0iYZ7JQGQnYZSesfDOqSEKbZnrB7trXuD77JFcSU5Xr+iIFyF4bTjjXyj46t70v5ADw7b6e0gZsQmnrB/GNosbwOJHtGMHC26JqKBQ3L6+nrz7L5R2z6waMkLTYvp+xlC1BIPgFdCcdnFdr+8NegEFVunLfroWwoNF9CFRvMgdD9WCUleagGhuOX+Y1XkHAYrQ4TaE9A== 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=JaZxYv94/X51QMrAc3XPYEABLGjgKTB8h5z4CUHhVPQ=; b=AA91j51YaibbaULn/+1cHXkht/1LC3mTn8geTpWlPWk0l1SEhKIZv/sjXjk5daB06mp8qSAMwDGF9MQ/P3p6hzsYGhDp+k9a3oisLDTtSCElbU1nOQDUtoOJmNpXwK7KwS3yv+Cq0Se2QzO0hWzAJjREwbPD/5oDtbbK1Mzz4xk= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CY5PR10MB6167.namprd10.prod.outlook.com (2603:10b6:930:31::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.9; Mon, 23 Jan 2023 22:10:56 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f%5]) with mapi id 15.20.6043.016; Mon, 23 Jan 2023 22:10: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 v7 04/22] scsi: Have scsi-ml retry scsi_probe_lun errors Date: Mon, 23 Jan 2023 16:10:28 -0600 Message-Id: <20230123221046.125483-5-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123221046.125483-1-michael.christie@oracle.com> References: <20230123221046.125483-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR11CA0007.namprd11.prod.outlook.com (2603:10b6:610:54::17) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CY5PR10MB6167:EE_ X-MS-Office365-Filtering-Correlation-Id: 801edb5a-61a4-4a72-b5fe-08dafd8eb315 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g/2je6jNGic+MHASaIstXS2lEci2AEGbqm2PzTOTH2w5iE7IfrqjjYDa2zoOa370GLTy87vOiB2QB7Uepu6P/h25K3ZxY6/TKR0o7sR8xVg/ZXSQPihz1wBdYS9THw9SAWzMcsUThEwfgR+fvVNdak8gi/D6LKWIjtJO2uc64hHx7RlDIgH9R4agHpmRbUsNlxosNni8gqig+8iPNOjbvmAUy4WmYoLYvxQsQacNaU9KuLSGHwBwg86EhUK9q09/XblhBcHxhLkUOMJ+EZREqAnSFDJBuYbuuiEq7zSnFyxo8lzp6aFIBj/XSXlEQWc65rJIH4qHtJzKNwPVRcKNpEhi/h1ni7IhRR1ROOwEUsqbt+NYEk1dpDbsVyUH1DospQsVjQUsVMD6+VlJjMr35XFHj3FB9kZjeJKIBb7FE5tj4Q1tXhTga398V5NE/pSyp2pGXYJM2/nTqP1uaXCyPc9i9qNfNtGPsyW7YsD2ND4a10LSwi6ot4BUHEyZeOUGmA5FLQcqijOCASZTldIyt58GC+Lf/H/+VTuMCYlFQDqEAJOYT+CGqFLEucnhZRfFf72OERSity4BIGkm8JNV8J8MAhU58AVSzhWeRxiVL7H0d1eNsJBiGdfcWEGspWNAMLoYAkWgfB21ArQPvsAeFw== 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)(39860400002)(346002)(376002)(136003)(396003)(366004)(451199015)(86362001)(2906002)(8676002)(66946007)(26005)(6512007)(66476007)(186003)(41300700001)(4326008)(2616005)(478600001)(66556008)(1076003)(6486002)(6506007)(107886003)(316002)(6666004)(38100700002)(5660300002)(8936002)(83380400001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UlxF4XUU7B/Y2W/qDgjYgsq3NOjJrIXDkL8yYvRMLPgDXt/4ImsFcRj6RF7fA7Jfv9et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QE/WC+6jK/Fyd3LbzrsAFNDhidIX2vgwz5zpI64g8EJVGrol2SDCULCb46md9zIElMzsciSRRsViVJ/mcymUoWnbNLOXT7PO8kYR32FLsiv+B/3JYtvy3upoEIiOyvxz1OQJAM2yoMl+1AmrkFGaYWn0yusIweqE7fPgTZh7+oLxBJnok9UTeY3QCmBSRyDGcwuc5SKholFnL4eOtJDnDuMlvJBKcZBl2xzMQbLsY5t6+nLcRByqijmAL+Pqyynd71+5sVNleYF+56u2vRaL4oVCdDrcWoXYpt03KU0pCIIVUsHsBHVmtc+0KnZ3wbEp5nWu4L9qTXR3cpMU8/mX3epLs7rkQPabg5Jv0nZqRg2vMds9hGxzGyvQkj+d5b3U5/o+fOMG0jSBXWuVUmLqdI/GeTr1g0m4g7tUWbNNvirmpJlAyzj7qRs3VRj10BrkSZsqGecMxKT6eEBtvbw2IQPd1kF7OiHsPAVaQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: jzk5JqhuxMU16WYxooLMl6J+yMDQMOfEDh0PumU+W7HB7qny5/TjjBueKaks2KqItGvvD3ooH3V6r2uQekHib/bHb/pclje/jK0gth6NwiPUNMr5MVzujaAB9IqT/0kwHXw1dImo2VDK9f1fUTFRy4KogOlD1j9iJT0Bjq45l6Ro6ZxDcWGWwYxphFM+9hszDdi4HHqX7KT6NZAT5ztkBicSjeWhCJj4zQP5Bq40bcEHQdW6bQZJj1rj7MFEqRDCOJUCYhU/VAcrKyza8pypepmdzZ2Yr5BvFj8ZnlGTeje9sroOQH/hXuphM5I3406wQzljnH/3xejjxst4GIKpqlS6q5iPhKZCibKTIpLlFBhyw/fTUS4xpzlDowcygqQTsV+qL8XczLkL4LPRBxKp/vgwNcISilru2Y75NhCgU9JJF95rcVrmKWytUk0jUyXTI3stbQuY58R1IhdwECkpX24Gr/Q5BcLObq5MDqalvH1f7TniqAy8iliR16A5tRyCE3dNfwiav/8WA1RBARg3heC7Bc/fymEpAuZQWqNFZm1RCb7VV3TZI7p87NWqxOzfFUsEetcfRSlUq9MxIpR1awGQf10dBQCJ08V58NZ24NMW+gRkiWo+To1n87b/sfWDb1zU3VXKefXfhR1tIGxjEnj/I+WNAzJd6V28dmKKnhx3T5MKhWkeGhKFtSrDzcqvbQf181Jc6qcZZqRs2fILfH2grPY3zIxQ8FbZ0qOo+3gA5ptFoDDzNnNdRsE6BjcQNSdnk2w/hBLnnCaKvaMFiCJy6KQwg4HvcXVDnkXlavyjTHbTTY5uaKexTNTsFPuZGokJxF35B1eiWQoYJAZnb1AniSVxwRWhLTXfUV4q/3PEpdtKStHJ29NgCoSDukv1 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 801edb5a-61a4-4a72-b5fe-08dafd8eb315 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 22:10:55.9481 (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: qZTF6T5FreVpqnMzH+kLB/Q1Pk0cFNJp7eXPPyOKzU3jwYAp/OepnU9nsia/Ye+tOQIYzGxaOC6lD1U5a+tdR9Q6+5aIBWwLh4i/RUocJSM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR10MB6167 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301230210 X-Proofpoint-GUID: zPrDagc1TeUadioFPbBnLm1V7n7yczuP X-Proofpoint-ORIG-GUID: zPrDagc1TeUadioFPbBnLm1V7n7yczuP 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 --- 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 a62925355c2c..1831a0c2b54c 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 Mon Jan 23 22:10:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 645938 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 63B09C54EAA for ; Mon, 23 Jan 2023 22:12:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233119AbjAWWMA (ORCPT ); Mon, 23 Jan 2023 17:12:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233066AbjAWWLt (ORCPT ); Mon, 23 Jan 2023 17:11:49 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB45123C7C for ; Mon, 23 Jan 2023 14:11:27 -0800 (PST) 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 30NLhwgT029679; Mon, 23 Jan 2023 22:11:00 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=S3XGpDHwlwpcVNqeENHvMC4ar4Sf5Sd4KEIldet0syA=; b=jyXIYOEPjprE/Li7r1nLdXAGt+tQM7cOJpQQpRCLHVbi8HKuZuje1yfjZko97Ye6ERtl AZZh0QPE1ipPJjh8z31KnaFDV3l67r+yqcor8u/FE6Q7Y7+iN5WwpmjoATChDGm7LV7w mqcaZvoGkAh6w1rxj/hucUQT9AJiq5HImwcylV4UX+0e1KdG25XZl5tPW17TuKSO91VJ dg1zt/RiKpNJmKF02+JKtAHD4W7/0m2dklCbVJpfNWN/RJr6z+Cqv57n18jaaxkhnqqt W2IslkfvlmF20E/iyQe4Ovl7m09IZz5V2MyC+PypXcNGng4sjBP9s0PRg2ERdt+a6JUc oA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n883c41nt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:00 +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 30NLEfqQ011737; Mon, 23 Jan 2023 22:10:59 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2109.outbound.protection.outlook.com [104.47.70.109]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g3nd9n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:10:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OxwyEeMWz0ztsvDo2tkXj+YnOzZ1YBm3k/vDiFb4X7Y4WTpTJ6VIaWSvGQZ466/Uj7AB6arqByTWiqhmxOkCF2/1hnbFYCaEjTpeJr/xZjAXW1BqWL8oFsPOrcIr5Gc/8L7+7fs60aHop04D6DLwgGXlXEP2kWjcM97WUZ7tz1f5dvjLFN+ksRrm4GgufyL3ZW+cAboljEgf2kYhuDqNa3/etUxFzhsTz/Ev57F5psxDacVO1f3EE1W0j9wPTunbjg9IfzZwG6vWtIStPy0yt3rHZLd/eDlPv0sQW+K8LYqatp0N7cvQRdTXA6Xnu/VX5Ug6EhyIr59ip6bGCIiddA== 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=S3XGpDHwlwpcVNqeENHvMC4ar4Sf5Sd4KEIldet0syA=; b=IkjCqdMk3JppAWzFAEIvLYaaKnJU35cUqGn33fXTbM6YAH8XwZMA2y685+usGxc/CSjJjkpKN5tU2xMuljr2YQ909pD4PkF+Occ1yauzd6Vsqr3MfUPQUuvzWfA0TrNlFDvzgLboebiqMrFoD8E5Bxqqke6YGaVxwzLLU0kHdeT/xJMadCzX7T5IWnAwe1MZb2ZV4/NFI5x6nYUSG4g3UokIfXYTHrZ9iRj2TBS/kocV8Ip9u80s2EO+WtQMXq4kphY/ZAdQHSgmvX2IGkfMm2RlxzLUlzqpBPQvRn0iPgXBHj4mKiI5WGUV2XCbF0dk/hslqSdBUNKAEvXRPdo42w== 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=S3XGpDHwlwpcVNqeENHvMC4ar4Sf5Sd4KEIldet0syA=; b=UzSdikO3NAVeTNpv3nlVrJSbWqq1yn7vIbOybJFCQi/kdaCEfXSr8txo4v1piJ+I+aBNqqd+VnBiE/ylpJYKGBoTRw4ja0xVl+TJTUrvogEXIcQps3WBQiQcHFmC+byz4HEEVd4pO7ZnCRFhElckCJiK56uNAIPaV7otqfIRgXs= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CY5PR10MB6167.namprd10.prod.outlook.com (2603:10b6:930:31::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.9; Mon, 23 Jan 2023 22:10:57 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f%5]) with mapi id 15.20.6043.016; Mon, 23 Jan 2023 22:10:57 +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 v7 05/22] scsi: retry INQUIRY after timeout Date: Mon, 23 Jan 2023 16:10:29 -0600 Message-Id: <20230123221046.125483-6-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123221046.125483-1-michael.christie@oracle.com> References: <20230123221046.125483-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR11CA0003.namprd11.prod.outlook.com (2603:10b6:610:54::13) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CY5PR10MB6167:EE_ X-MS-Office365-Filtering-Correlation-Id: 76370375-d44e-4b97-7e67-08dafd8eb406 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Bm4IO83jdOBBNDcYKywZ2U09AdRZg1Hjj2z8NeY6kmIQjuIKDTGGo49Zm1PsMB5PGMdKyTBZfOwp04afF2a3ASJjDseYwz1rrgTAXW3V23wUQtbO4AbBm8ZNQDN3LlkWumAiBDWN/vFF5n322UpvEC3DajZFmE33iJhZYKOLPJCdm8pcEXhwB3eUdm72SWuz6aZ0Yj8aKLsvVdcHiiDPv8nsQ+SxuTQ/V1KuB+6b+zGcA/eQY9vP9lIRlBU9U73nP/4SotYrfgPEd2FmAQ8fMqvRiK/uA78H6WPUacwTafq4MheaWHi17mUDZjqGfb9jMdJc9hjm71kX6Fki+2z5LXY+cV1i2ElrTLrjZiLEaUThn92BtioV9mPN+PDyKm1DpD8SqBjBkGayNCo+dOAQ/ra9atvneS/gmTQNF5YhBABY/fiAZnv3boYCyoppDvUOu1j9rXpKA23NkOaBlU/HH2tWjqb/52ZH7XcCvOmJnPgUSJFgVcAiOP6yQagi623wYslaYZqW39eqXdosYpZaw7xOXTyBHGcvlAfMUWAimWCsDoJgS4FE1YS9uL99Kf7om7eTWuCqh5FlGJocrSdM4VunKgEZCnu4tvknVVxUn98fMehJsiE8Xc1fD30/wpl8tKGfo+wTi5qK99ukXbngIA== 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)(39860400002)(346002)(376002)(136003)(396003)(366004)(451199015)(86362001)(2906002)(8676002)(66946007)(4744005)(26005)(6512007)(66476007)(186003)(41300700001)(4326008)(2616005)(478600001)(66556008)(1076003)(6486002)(6506007)(107886003)(316002)(6666004)(38100700002)(5660300002)(8936002)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gg6bA8F+JhXDYvoTUfkNHSPdCQKRwFrtHViJklAoyDHbWUT2jkCjyDeFni5ibNlnbRrtD4Kp1ADharTG4MViEFjdAeSw6QJCgocgs9Ir9zGI4ddQ65AeCwiRcJuqqpyQTm9af9iRcZc/scFgOr/4xSTnQPBYsB4/wZPPxAV8xt6/bGTX3sLR/kHE9B8QDyDbWLPvRL5hUTuZmrY6BJIROwIbWNwDUVFWlPopuoqCrHyJnKmdqrmlPAJPNl0pIkW+ONkb0KcGm/GHHrn0n9BYUQVBsGy1x9QtPO1STY7T3CxBR0+NMwXQreSLnIbnMGYL90eIFNptBxMleFKlbdnA1v+IOU3NiD1A9Riise3lY+eWRzbywuiVJ+3pu69g9pUnyxIwuK4nhwdlligRb0b9iqJvSQmwnEC+XX7UDdMg3Tgt/LKMOOpBwgIpuAZwXzhHxxHqRTHLZ9zJNzF9RABl7dnC+hPhrgCZKBl7R7G4cN/Hnkc9ruVUzjFDuDIeyBFBxF1dJNcGtGgqttNd2vAv4hARoSENVlbOVAmBdOHIlboEdb7ADzq2xpkmh08ov1CFA3fhCph0Ip1bWxyHLELMCLpq9j/EjaACcqW57Qf3tTZFDCXw7mM1honhOrtTcF8deV7XVJiFS/AT0fPs2/FS02LCBxZ/xQvaTxjxmGjmKNeg1jrIEl595TVMnNigMxz6UFeZUDpuAVSBGHbYL6q+8/8Ba2whSNLrRfNd2aH6+rCklndjMCHMKeJDltJKozlbfy93+jizHkYB6PYSKECB8v4ktOEGRRYUVQt65ffp6F7u/U9PYJoW8nM+7lXx2TEQTNOxCOQiQj4AVUlp9e6HR10UsffQsMKIAOTar+dk4Bc4My/niq9lvpUc/Qqj+lsUe0ZaNwQw1Y8ICArepZSzpEda2xVTaF6J5qhHMQ/Y0f1MNGEkZ86Wlqlf9QUagY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cU0Yb4mwKXFFOXtMdglsxoTyFTf5I6dJko0Yp7gAb2M8w4qA4pFi5fypzUVZQx7cGfSf6hsR0yZ9exoeOwCfS5X+bfmAgME3W5DMNpUohq1cnw7vmzQMf3H7CDjEWo5Qu2OY+aYwpBJX4rsH/Cnfhbs2l3nYQjO56SikGj5RYO9usjct+/o8s5LdncmHwFAuvuOJivwDmYx02pfuX4RnmXGr7a4UlrC6Ta48TFxRDaQdUHyhrMLK8ckQ9aRz/TppDafxMClmF77zOzSwsYc8JVDw3r1XdLdvynq1a9ZLKvMcpQEPVuC+teCVSXBbn1zIfkFsD/U/1WuDyFWypW1nwiKp6o6ZU3q/Z1DjzSvDO066NoMaVO/ZClxWocXoRaJucXLRZm2xWa8cIZyDYcm4pkKMcNuVz94lyfdC6KtOH6+RTc+9+4Fj2aAXjFkiCnf0e3UWdXXTpa3ok+Frkk4vutAgGwMphC/MXOiSbe2a3RLxGBg4KZ8BdTzFSm9YblAPpm7bJvmmsPlzO1k411/Ko3KK9xKTSv4zRa4fW3tC833qoKjfzHOD X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76370375-d44e-4b97-7e67-08dafd8eb406 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 22:10:57.5416 (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: SAJCsj7lrqR6qRMrvCcifip4LRf/r4adyaXJCbQTDgiYwe6ZkVfX7HQKh0hULS+JUCDuAvFAqWnrt2a06ZeouzyO7AHQBTGw0qCYRJ4/ivg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR10MB6167 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 bulkscore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301230210 X-Proofpoint-ORIG-GUID: V-PQT59u_ZEMuvbR6DgC2ED-Cd73-bqH X-Proofpoint-GUID: V-PQT59u_ZEMuvbR6DgC2ED-Cd73-bqH 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 --- 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 1831a0c2b54c..b8a526c4f6bf 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 Mon Jan 23 22:10:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 645937 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 2032FC25B50 for ; Mon, 23 Jan 2023 22:12:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233099AbjAWWMJ (ORCPT ); Mon, 23 Jan 2023 17:12:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233094AbjAWWLx (ORCPT ); Mon, 23 Jan 2023 17:11:53 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3071F17CF1 for ; Mon, 23 Jan 2023 14:11:33 -0800 (PST) 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 30NLhqW5010181; Mon, 23 Jan 2023 22:11: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-2022-7-12; bh=mBmjy9c/rx0fsXHDgd69dvVQgVOXKgQ9iudln9nEvyU=; b=R/vGWnFr9kTAeRXosdNv0oplchg91+TVoZ+X5JwxZe3oFy/MR2iRasfUU4L5ZwKQw5b7 Cz3C0N7dMsku3ACCSzNa6XtDeSdkazr3bhz0zPe4PtBoRKzZRdVjPTJKrrMf2CpsEJ0h hLlEWX7I3eJQ6K69ANNmmBvJ7T3MEFmsdaArMXXcQn0wxTqbg/pw+Fpn6V7MQXrblkLA h6fR2fUsz+Oc+5ESlttuAc/tTV8IRB/7+dYR39ihGDghA5YD5kAdHwCe1CHrzwMqrGlB z2YsyOW/DM0L083bi1N4hj0oSc4kNEMSUkwbA+5+klsxB9xjKsPUmsEB3FxSSCZ9ufGC 2w== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n86u2v27n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:02 +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 30NLN9bl040098; Mon, 23 Jan 2023 22:11:01 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2104.outbound.protection.outlook.com [104.47.70.104]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g450xp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QSetS9HWn9lTTnG/TBtzc2F7u8OkWx9+4Pf4Uz2r5Ri1bZ0WMseYn/WqxVP0c4xAS6o7b4AJ8zxGFe45EEruwo7BHFRJB2SilPGjr2tBTaFX63FGmFXi3aDj2McXceoLCxVd5GT03OB+/ZwaWJOTMnW8KvT3XhK4sH6L0XV0lnfImU23+xWKHF8jK8/GlSRi7Q9WJYCjCmXcTrRn2tprAhXhRowWNkzZSRWq9horGt8MY0Gu83hQsuUO34cbvERCUp4dZLbSr7bHPZfSfmo+uQInAd0esfYL2TMvrYEtYH/7FGoPU/45/niSiVZy1MqEh2vDJmd6mq5QWjeG0H9ODQ== 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=mBmjy9c/rx0fsXHDgd69dvVQgVOXKgQ9iudln9nEvyU=; b=Wvy3xukqgBE3i95TBGWQZK7C7Wf04LhelWZdOQ3+kgfBjdif0OkmGP5U58Z1lMoOF8+MkZVNHpc8VnwHKf2X1u79rMIsESZXrG3GRKH22eJxiACrlgSDsweciUfANawBTh27wbx7KoAss8uxVamMqFYAqP47PJy4RtZy7O1QnBqnlcaSGdP93CoCyujzrwP/pVi60tJs0rRfm2wgfcj0cgDe9oIKS8U7wCiGQ8QU7kLcT88RQDb/sw/k9jrj56+G6YmRuKdztYGhnEpwabLwMKCkVBIehg8BExC27ZhKzmoyzw2Kl2yv29JdVyZQYDY6jKGHg8g4EXJe7FnSFh+Spg== 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=mBmjy9c/rx0fsXHDgd69dvVQgVOXKgQ9iudln9nEvyU=; b=KwBW5voM3mYIQeoxzpp05W5t9o20SZ79nl59AR4vGMC9LSgELG0++TtEuAmsbsS8PTPF2DxT8ze6w3KYRXgUzBdCTcxK4L8nv53O9vpaLDGylagtiOCWLAtFbytaBF7XziuVmc1+uD52j2ZD/jX8rag/9IFuPENNtOXr4+6EO9s= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CY5PR10MB6167.namprd10.prod.outlook.com (2603:10b6:930:31::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.9; Mon, 23 Jan 2023 22:10:59 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f%5]) with mapi id 15.20.6043.016; Mon, 23 Jan 2023 22:10:59 +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 v7 06/22] scsi: Have scsi-ml retry read_capacity_16 errors Date: Mon, 23 Jan 2023 16:10:30 -0600 Message-Id: <20230123221046.125483-7-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123221046.125483-1-michael.christie@oracle.com> References: <20230123221046.125483-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR11CA0010.namprd11.prod.outlook.com (2603:10b6:610:54::20) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CY5PR10MB6167:EE_ X-MS-Office365-Filtering-Correlation-Id: cb439849-37bb-4348-8031-08dafd8eb511 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F4m8+q51ej4ijjOHX7eJjPUSjjBUnQJLMuN+95ko4hM06tT/6YrUrwpnrVX/33xuV8IsPQNdps/hQ65kRyhsOWjt3DpRddJW0u8S6KNaq5QQTzBH1tSBItI3Hn6V0hbGSsP3F9Sq+4Rw1OgDyPwuCh00q6J47SY2smyOrbXU4R5OXw11RnLUKDufjtBKYVckPQDehD5uPBXqhvl9K/9PWFLvdL5IUL0Y6khye/5o2oedvECJRzF20ikPlFFVS2Mtqzh+vRKWZfgTqJDCq8Tw2dhOycmHn3yksEoMFTxOG7RmGHjVsjx2xDVlr6Io3tju2TGGBDxumvvx65bH14UY1qeFqBAG3BR/da0cSm4sAo6Hpgh2yTRz96p9uNxK8gylRjBdzI5LdBOXqeNcSdC22f2Zj4tEc3l1Y2MlKMlYn+1QPXVnTGRpVvOlxrOtNIfIT9qObXcFOSuiuSZuLZ0LXCoyAjanbn9/afDB8t3YBZbZvV8OUD9YMrg6oP1UmK70sGaw0uUV1do6oL2Cw0AtqIprFEVnYsBcwtEQb59i02IuKVv0+1lh7jhz9b7eT0LmKwt5+km5TyrNoFzyIZN3cc82taEUNaRN1CTMuQMrG08hnPeoJkMwBy680bimz97l0Q6j2gtY/Ag9Zlb9osW6gg== 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)(39860400002)(346002)(376002)(136003)(396003)(366004)(451199015)(86362001)(2906002)(8676002)(66946007)(26005)(6512007)(66476007)(186003)(41300700001)(4326008)(2616005)(478600001)(66556008)(1076003)(6486002)(6506007)(107886003)(316002)(6666004)(38100700002)(5660300002)(8936002)(83380400001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: T2bWEUybWYiPAn/KGBkFa51SZ/+gDZWrx0A5wBPUJKt50XnrcOrFcexB9ETrk4VfDvtznq+w39OYe4MCQYF4229bAzSqlB1AzpyPU2eC90bGwNf25LVg6bgCrGAQiiddi9ErPXjpwIEy4510VbJ3aFdADHQo874nd+1PuG+pd4fTR8XqDTJOljOQpK3OusG5k/x1O3l+jnY5IFSEZiq/sBthJ1RMtuZLDpfh1W0sROIlOAZnrWvU6u3d/kLgjhOcB0piwnXQBJxKpzHvOJ3iGkMVHoQD1twzsKDN9SYahWyEYXGxsSZ1O7m8DtoI7J0zujRF3lchqDY2t79rLkTgV1JRGldMmd1H+vyyL65G6EvOs/jHUTm7AJRsTHYtSYt3lZQu3dgpjX8VCsUKYzra0spStJ/FxJneD7OK3IKuAHT47veBu44yHnYMos9ojtBZI0u+voKFsyQC2nHjWj98tCexKpwQkTr/7f+0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enant-Network-Message-Id: cb439849-37bb-4348-8031-08dafd8eb511 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 22:10:59.3383 (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: WWlBHMhd8aI+iJs88mdm2fuPOcJo2Ht1irw8W/H6HEI1gmcLXCOZFFYd/6bz3q5MMp1xDKHbmUuTZLMLbLoDSIqWVnueVOOGxAU5gJUjvh0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR10MB6167 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301230210 X-Proofpoint-GUID: bYOoJnqSQBMVl6Q4YNhRAmocPtaW9_GK X-Proofpoint-ORIG-GUID: bYOoJnqSQBMVl6Q4YNhRAmocPtaW9_GK 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 ths 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 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 --- drivers/scsi/sd.c | 105 ++++++++++++++++++++++++++++++---------------- 1 file changed, 68 insertions(+), 37 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 2aa3b0393b96..99fb4d72e0f7 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2308,56 +2308,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); + memset(buffer, 0, RC16_LEN); - if (media_not_present(sdkp, &sshdr)) - return -ENODEV; + 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) { - sense_valid = scsi_sense_valid(&sshdr); - if (sense_valid && - sshdr.sense_key == ILLEGAL_REQUEST && - (sshdr.asc == 0x20 || sshdr.asc == 0x24) && - sshdr.ascq == 0x00) - /* Invalid Command Operation Code or - * Invalid Field in CDB, just retry - * silently with RC10 */ - return -EINVAL; - if (sense_valid && - sshdr.sense_key == UNIT_ATTENTION && - sshdr.asc == 0x29 && sshdr.ascq == 0x00) - /* Device reset might occur several times, - * give it one more chance */ - if (--reset_retries > 0) - continue; - } - retries--; + if (media_not_present(sdkp, &sshdr)) + return -ENODEV; - } while (the_result && retries); + if (the_result > 0) { + sense_valid = scsi_sense_valid(&sshdr); + if (sense_valid && sshdr.sense_key == ILLEGAL_REQUEST && + (sshdr.asc == 0x20 || sshdr.asc == 0x24) && + sshdr.ascq == 0x00) + /* + * Invalid Command Operation Code or Invalid Field in + * CDB, just retry silently with RC10 + */ + return -EINVAL; + } if (the_result) { sd_print_result(sdkp, "Read Capacity(16) failed", the_result); From patchwork Mon Jan 23 22:10:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 646499 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 36423C05027 for ; Mon, 23 Jan 2023 22:12:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233073AbjAWWMC (ORCPT ); Mon, 23 Jan 2023 17:12:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233013AbjAWWLt (ORCPT ); Mon, 23 Jan 2023 17:11:49 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07CB738EB6 for ; Mon, 23 Jan 2023 14:11:28 -0800 (PST) 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 30NLhs40012711; Mon, 23 Jan 2023 22:11: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-2022-7-12; bh=sj3MjvcwUHnmrtqNOZobw46UHGxkrTAf4fx8nrxE2zU=; b=uBDuXI72nD7fBKZApCGGrIsmY5d2RXsKw6x2NSl9RUIp86jywgESZR9X86MpiEQgfF0p gzpZxC+5qSRigGFR9fQsyPTv31cNbXCYLzFh2HXNGBNKWjd1VzNjzTbhUoMprPMytFVH m0VQdKNb8kEIrcYlZuJ4oVBb39U+q5dGEd07NU1l8lEzTdqodQoiVx/qK3uIGR3r13L7 2ubE5CmJVx/UcBNvT7FFY4QBMKIJlvv1uWvoTeOy1+wCyqhb83Q3NFtbzNCqfYa9jGlz y3sc/fJ+wmEML9JA9BpMYXFWg1HKdsUcQXlkgZdEQA4OMTGtM/XfaIwvTEUU9toeLZwJ YQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n87nt41c0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:03 +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 30NLN9bm040098; Mon, 23 Jan 2023 22:11:02 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2104.outbound.protection.outlook.com [104.47.70.104]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g450xp-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gbvHnn+HIOJdvaVLSIghQcj8/QOiV9Ro1O/VEk88IwtsCeS84fSKTfW90HTrSuIq43jb05wwSRpp0AIHp2rCLGw2jU3C6T1Md/ejpeYf5CoUu5jTeQ1vG0geJ2BKix/ANpXKcphJZY4Amhr0d6ikq3jX9zm3oDj+Ao/5smwcP0Cp5uopHUDPKNPfxlvLtrMOrMeQvaGmWdXhUw/gGCuamMGvbjwbXTJm1FyvoIqlrZw4OgCwgxeKUc/UCFArYNcN2mptDS6503v2KLqRN61x3wOV3h92Hs5CAiopv2jLrDuPiEw3RdtucMI9Rtq0xiGQPrpgRbU6xyNnrDo4m85ujw== 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=sj3MjvcwUHnmrtqNOZobw46UHGxkrTAf4fx8nrxE2zU=; b=PuhSQV5/l1NtHgLcM5OG4xCfPLTgoT39zYkWcFTjfA/F+P3cYVAJKxnjwmMHgYev5wlIMAT1bQOwzSbZjdOO+xUlj2t9V2lPOBdJfeyldbJClLjcv8C6xXeGVmB1e/3esRd8DNPMl/t7bh4X9I5WMVgDVZpKJXOqeEVwEv2oqQVGeVeyH3OJBSGpGTEgDjeYRDi6Ro+fmARFm4h/YiPObTY9E11ikJkergp+nfmu/pJFVxIG0/7vvDyyVAUi6yZle9jkYOgd5VzKdx+irsGE2+/jTEEfo2XdbATihHPK0xfkp0B5vVpYGBnuW5wqEzSLZMnlmBYUql7TgxyYUft/Bw== 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=sj3MjvcwUHnmrtqNOZobw46UHGxkrTAf4fx8nrxE2zU=; b=j9XAPKH/EOB2E1dCRMFfkO279tLeFern+y+qW8ElyTOgbwQd8PPm79qhkctHxKM3T1O9aI8IOxEbmTYQcuvqYrO2YsVKx20lskU+z1O+iyD6sGDfTQLlDo5aMApm7gBnnVwWF7/ZE+9ux66yNY0xEtG9pziVwl+O01NCOadaggk= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CY5PR10MB6167.namprd10.prod.outlook.com (2603:10b6:930:31::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.9; Mon, 23 Jan 2023 22:11:01 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f%5]) with mapi id 15.20.6043.016; Mon, 23 Jan 2023 22:11:01 +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 v7 07/22] scsi: Use separate buf for START_STOP in sd_spinup_disk Date: Mon, 23 Jan 2023 16:10:31 -0600 Message-Id: <20230123221046.125483-8-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123221046.125483-1-michael.christie@oracle.com> References: <20230123221046.125483-1-michael.christie@oracle.com> X-ClientProxiedBy: DS7PR06CA0054.namprd06.prod.outlook.com (2603:10b6:8:54::34) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CY5PR10MB6167:EE_ X-MS-Office365-Filtering-Correlation-Id: 48d695c7-36e6-4175-d1cf-08dafd8eb60b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xqKXwUYJlB/J92T1k1gwd8y8IsoQ2lIrQ8RENQKt3eIxBYr/bTT+kKxeObF4aQlWGnxQR9zKBZTuEMUMsr8oA43SpJ7AqQhFEF9qavwXmBF+5kPtO3Gwo34ebyTwYSTYjy5cbSEkFL1RUt4BT29JjmPby6g6zPeCoV3B8VIlZQa8lqZrmOa57OjSGR1Z8CWvCdZF+f4sjyIrfRTnFwACcReGe39kY2ftW9FBLAGZpsrzvcuhVBNxhR5P8WI2vLwcqFyZTabAuHbDscG4RzNCFDDn09rjNzqVHNYHMcn3kehjJV+RpBaCH2y6KfZIH5KDrvDzSEzLBgF0B35mMpQ5y/wboGa2SQ+tkfuHsODVSykxWxuV1UzVDQb+U7pDBHdiNnaT6Fg6DaT8TRo+023cLsLxMC5TbkSEq2riLwJjsXsWnng6kZQpT6jCULqdDmKfHZwki/+gF8tlghAmFJnDoa+v9KY4IOQJLewEv1B2MQ1/2f1swLqwRnvItBsbRZaZJan8a1/BU8pXXz4nZr94XrWZ+WmOCRXmxGRcbPmRl/8sp0jn3RU5uGj4o6SiQS1LP/AXYOD+Oszr1UDS3wwnovG7XpF3lHNrb2mNGymSSW+TT6dTo1UiZCMVmA6i5J+gftAoSC5aUEzIaKymJKWWEQ== 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)(39860400002)(346002)(376002)(136003)(396003)(366004)(451199015)(86362001)(2906002)(8676002)(66946007)(26005)(6512007)(66476007)(186003)(41300700001)(4326008)(2616005)(478600001)(66556008)(1076003)(6486002)(6506007)(107886003)(316002)(6666004)(38100700002)(5660300002)(8936002)(83380400001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SFHriUCZkmKWYeBeiV4HWG8a33Tk3f3brbnwG+HHnQ/QVaBRfXmedh2fgwOkL8dNwvqpdVDtdxg2AyZxqSOETiDe4pKxza8ooDcQG3HkGKwlwqRaNHxg1URT0KnvMcWWPOW2vAcN7pP3i8nBRTsGNHTm82f8/M8ZsgnyicmEbmaNraAIPpxWiU4hjcUiLeb1COjFfPhiRbNxKHgJI16wCJPbVBuaf4pAOXGBxbd3vnuKVtVeSKO5udd7A8vzzaXCWivlLQBFWOqhd+p95Of6EKrs7rIhlsXEAimOXGAgQcMjeEI3Y0Lq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Z6e88S0ojhvhhi6+Z7eGj1S3VkU4gVA74pNdZiIU4H2TvD6NgC9VCbYaff9MYZy3ruWBSu31dwLvf2DnP9oyOLe6sRIMlJ8UqLQPn0TlanY+S3fP+CT X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 48d695c7-36e6-4175-d1cf-08dafd8eb60b X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 22:11:00.9163 (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: Ltjztj9ntFVNBY1evwtSfhCG1rzMOyFMpkb9mpTRbcciXa+EdOI8QnQ64tpSE7qCXR0BAtYY8CIOd3ZD1fPgrDOTwb4nH3DSqX8qkCcNO1k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR10MB6167 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301230210 X-Proofpoint-ORIG-GUID: 0iFMRmfUYlMPNEoV6wOgx5uMgVf05gT- X-Proofpoint-GUID: 0iFMRmfUYlMPNEoV6wOgx5uMgVf05gT- 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 --- 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 99fb4d72e0f7..ec7045a828dd 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2170,14 +2170,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 Mon Jan 23 22:10:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 645936 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 E18DDC05027 for ; Mon, 23 Jan 2023 22:12:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233205AbjAWWMY (ORCPT ); Mon, 23 Jan 2023 17:12:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233131AbjAWWMB (ORCPT ); Mon, 23 Jan 2023 17:12:01 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 322AB3929F for ; Mon, 23 Jan 2023 14:11:39 -0800 (PST) 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 30NLi7Ha011527; Mon, 23 Jan 2023 22:11:06 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=2G3PzWon0bmtxLzmPCX0+Gpuo2oqfRuxnTaFksRKmwg=; b=CcV2s7RPpnY3GRkt0pLbFNvECVrpwopcO7npRK449+smPa5OGSsjYx5McAFQY/5NbLuF jDgHrfNfRD70BDx1U3KGYhSQgY8uDPSX+E+BqdDhQsYsvH+nzC4T1ZAjDmO9SpAKb0/7 umFKrzOWQc6zSUO5lf0QkSAKTuAnF42DAgkPmI3gDIp0D21FLmPs3FRXulZAJV9x9Ihg HtTBDgLQ4yV/k9CN6Dg2DmElLCqdTHcmNhiB9ZcSOpffSy5DrEjbcnKQhFqWR0id9s3l 6xU7hANYHvHVCBYIhZNmaV5rxcouMhIgI3HVT7RxhQ1w1qMI/nu0T1479hgy9DRJmMzQ sg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n86u2v27q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:05 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30NL8deo039567; Mon, 23 Jan 2023 22:11:04 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2109.outbound.protection.outlook.com [104.47.70.109]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n86gaxjsq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=goKuDmbev1Z1XI8Mzbl43ULGlC9KVDFlV8SBK6Gw8UDQkMCCPqT+1NO1fZUvIjTDNzN7+NQv5qSY9wCQ+hIQZS9Q79AvF000gf+lhm7NXMYjxA6C1y42Zx0kRbIw4iIip/26EhGkkaSN6vx718Mj2SDwKW9muFdBXVbnHcyUjdDOp6aXS7q64pO47fwvOZxPjftn96kfSjWaUPBhyFxjBHBcbcRv+9W5di9iyfNdNW1ZANip1TORagOnsPO4jO1m0reNDFjyoc7wEqeAG1Rvw6cB6odwTR+z3j9pPUcjv+5jSzaS9B6YhsHuUIpHuz/SEM3uABCLihTZsNdpa4v6fQ== 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=2G3PzWon0bmtxLzmPCX0+Gpuo2oqfRuxnTaFksRKmwg=; b=PadWnlMju4625E2akqhBYpfz+Qw0AF3CBK0bTXBdAFGPk1Gh7iQ7Em9hWl9tmYn6xuq8Di/JTF6RxAjf+ZyHpCcO5cHvi0zPtyDmJ9t9UOkby7zCXwiyflcJ6GXZd2y0GLvT18iy97317fMlD+ypCZH0FPVKNKczYCZJyj9ZGlhaZMCRxe4bMsZHPc5lYCshGNcdv6otZsD6paIjldSYXZ9mCgBjZr6Mxd4qv4MW2x18bnd3Hc8MQn8tzx1TKQMsox00sPcJcNPsS5oK5klrQUllekbssdCPz+Z/JdbANU2IBaPBRC9/i2AoDOIJ/imd+wYSl7JFxx+kNS6fZhNzew== 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=2G3PzWon0bmtxLzmPCX0+Gpuo2oqfRuxnTaFksRKmwg=; b=lhYKgH64d03uHw2FbDwccUPOApa2kgJTIit/VKBEC5FTbwH+iLfnB9gO5WeXgm7uM+oVtWTPtlgTbkZiJkZaXG/pkkM0pXTrPIm6huaA45ighENzNyuycqkhE2l2SMsfVv0UflOMjj6Dm3JTw/Lp15yAupF7PgrVRXXGGvwHPc0= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by CY5PR10MB6167.namprd10.prod.outlook.com (2603:10b6:930:31::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.9; Mon, 23 Jan 2023 22:11:02 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f%5]) with mapi id 15.20.6043.016; Mon, 23 Jan 2023 22:11: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 v7 08/22] scsi: Have scsi-ml retry sd_spinup_disk errors Date: Mon, 23 Jan 2023 16:10:32 -0600 Message-Id: <20230123221046.125483-9-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123221046.125483-1-michael.christie@oracle.com> References: <20230123221046.125483-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0136.namprd02.prod.outlook.com (2603:10b6:5:1b4::38) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|CY5PR10MB6167:EE_ X-MS-Office365-Filtering-Correlation-Id: efd22205-800d-451d-4a5f-08dafd8eb70d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BT83KPyAAgzT2wI16fvKWrXiPtDsZq8herw4XWfXUvi1QIIpm/PD2gwwxd0f1z6vqL0XxwCiHZ4epQZO5I7Be7YqmajUePImFTaxHL1LWP5JKArGiaNjnGMpcTBpybQ3ZBl08bvKl8nAm1c4qKPDMehHb38pIAR0wwCVtc2okbd8uFLBrlGXBQMGGrxs5wemmUnX9s4BM26rAtsA43sU3sKT0bGUj1NGAdzpdAS2uvVdib3A7a9cUXrLlpbB4cL8CAaKFIqQw6mCu6NjNNZIS/Hg+8EzWVfFEmMnQXBwMqQ8AzacDgrSaK9NitYOrAY8qqr6GukoZ7wSoJpKeUbB3cQ+i451DmDDtRb22WhlentaqDV9uJhu2BGVmo/q8M24x20Snmr0YZja+fhrB/Tb80jFgpjIl8Zuf2l6WKEv5j2Y8LoFwN8HsBGZlo9dG+XwguoHYZRUynAnWC2u5mv7X+KJ8TdYk0thc69so3cf9RS3N0pg/7tTDynOW/rVkKNcROxpGUmtGKUaMP+CVeBHJxBRCEwZNm+XojjDE/ORueX6ch6u7qs1U1SvAtT+8xWoQ8REuwGv6GfVbfTbYqUSlH7AXgfxJnv1cJrSxIs1PXUpf9T6DzQY3Sk83/7kCn25PKCzm1Om06zPsg0IdxGK9A== 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)(39860400002)(346002)(376002)(136003)(396003)(366004)(451199015)(86362001)(2906002)(8676002)(66946007)(26005)(6512007)(66476007)(186003)(41300700001)(4326008)(2616005)(478600001)(66556008)(1076003)(6486002)(6506007)(107886003)(316002)(6666004)(38100700002)(5660300002)(8936002)(83380400001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mOx0a6xUvFRXmVt2bZA+WvC32zPtAID/7Sx+wqBP0ddIaysc85jsrQQd+BWrNErtOWV+r1d+WpVb708EeztS9QDTnB1cVJoTGy6zYfL5/c3uSyHVksqKMzlwUVaQhDKDOOorePh8beaiFhFvPb5rpErItZJFMhe0iMz+1mAt/uTg5HYoFFqsYacgHfabonIIEdkxLJZ7see+BoWLyTRPbL0rC4hc24ArZX7raEqUpnR+UzwScoPEh+5+Jf5qTec/HwqzjtkfkbBL0MjpLJ99BmvlBUJq92uDeae/6wu0XS/NewaYBSQyDD290r2sq0f1b4koHx1+yn7SauZtuXoAtIvkxHO9WV5Iybo4a3TZhe8R8iPtj6NsjW5kPtc3AO0s+uhvrWMaJtJ28I47cv44s9irkYlO3UM5Rkg0LqBL5bVmcJznYCSACb1gz2edRu4XrLXVs8uTf6P1MNBLZ/65dA2PZIfCzn3lQSxh993FcZjKYDCHSe7JAhtgMqkbUUqEI+W9kqX95jtSIt3j6BMlQLwnqWODklGMQmsdxL4bUiPaqaBkIwHiG4PY29SBu4wRKoConO2AsYnmVjTi+nK9jhYuVpQ2zW5mogpENTl030uxvjnwBz0mBxgUVsaMAG9aYMyosgxZpj3zYcFNtJvVIvE/v3yDkJg6hKoI8z7s0UM/0F4GFyFWDzp8sovTCOVMmMJMzDcvi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ZoI73nu4BoytbeRsuI3g2U0kQUaco+yxZuuaO35QRPLx4lGle7GJCo5TALMl803/nZFLy0EUGAxzgb3NIPAZk7A51jHFGrbsuKhjvavY5Cohwo3vPaXAqDTIpJxw7vLGg/vS+VHk8RHA8wkBs8HDXKjGGa6G2OmOTuhHfOXNMmofb1t/CXW64pxzzATsm590jQ2qvh4SY6a1NktDzTZ0s7vfGdCnTczfBMa1ttuvV8JUuZ5vQuFdkQNC3EY3RBj5oHZrOIIoVYXCjJsEMZ8gIiMQMWr4TuUhbDvidXYgUlTkx+uECu2AdlDSwTt5PPe3YO2lc2EGmsDxWwE5hsD0ICBGJ1DhOr50p0I7X0fuTNyOTP9bqzzJWFHa80d+ZUBhdrRapWLGa6pLs+VnjfDpoZI2WN35y7VfMhD6EGAxPqk/LIBXA1yLMnGVedqgjIIoMpw8UpBzd8ixaZNc1yIZXyfrutTXCKlEhwyruXzkp21mcH0k+aPOqob3bXeqJX2xwWZzb6WLwbOt/e4Gy+y9SxnZZtibBRTOWCKJmOTQSa25ckEOlN5nexDs4jjeWX84FWH5jGyXmcsZZi/KlZ9gpFuSnfn8LKTIXS9MjCWpY3cUvBJuc3VvUzoFMR/k/gW/kRVCnPMojvBfFqVtcPahMTeMaalJ7vuyupSBgOsFwEk7H5rgDz1x2/Q9YGdws0vtdUtxuZMDqbkNXVEv4b06Yam3mvmlx/rHFJMzyiNDjENFy8QaHSjJVAC542GWZ+LFaSXnmOoDVEQRNtKC3qUHBlenHVeXPWXo6SN X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: efd22205-800d-451d-4a5f-08dafd8eb70d X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 22:11:02.6037 (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: f3uJn78UAhrNRHbjUKVBN4SnVoRG9Su5ujBNtv43Kn9dz+uHGrlSJLMNkaUbklMuEzAv5TJnrEsPUEsC2qMkOB0iup/Ki9ZriXBxwsi8UGQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR10MB6167 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301230210 X-Proofpoint-GUID: Hzc8GbaYDDP1rE7vNKEbON-U8qQHhGP_ X-Proofpoint-ORIG-GUID: Hzc8GbaYDDP1rE7vNKEbON-U8qQHhGP_ 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 --- drivers/scsi/sd.c | 70 ++++++++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index ec7045a828dd..89aabab82763 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2093,53 +2093,61 @@ 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; + bool media_was_present = sdkp->media_present; - do { - bool media_was_present = sdkp->media_present; + scsi_reset_failures(failures); - cmd[0] = TEST_UNIT_READY; - memset((void *) &cmd[1], 0, 9); + 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 drive has indicated to us that it - * doesn't have any media in it, don't bother - * with any more polling. - */ - if (media_not_present(sdkp, &sshdr)) { - if (media_was_present) - sd_printk(KERN_NOTICE, sdkp, "Media removed, stopped polling\n"); - return; - } + /* + * If the drive has indicated to us that it doesn't have any + * media in it, don't bother with any more polling. + */ + if (media_not_present(sdkp, &sshdr)) { + if (media_was_present) + sd_printk(KERN_NOTICE, sdkp, "Media removed, stopped polling\n"); + return; + } - if (the_result) - sense_valid = scsi_sense_valid(&sshdr); - retries++; - } while (retries < 3 && - (!scsi_status_is_good(the_result) || - (scsi_status_is_check_condition(the_result) && - sense_valid && sshdr.sense_key == UNIT_ATTENTION))); + if (the_result) + sense_valid = scsi_sense_valid(&sshdr); if (!scsi_status_is_check_condition(the_result)) { /* no sense, TUR either succeeded or failed From patchwork Mon Jan 23 22:10:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 646495 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 729A9C25B50 for ; Mon, 23 Jan 2023 22:14:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233181AbjAWWOK (ORCPT ); Mon, 23 Jan 2023 17:14:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233135AbjAWWNw (ORCPT ); Mon, 23 Jan 2023 17:13:52 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC70039CF5 for ; Mon, 23 Jan 2023 14:13:23 -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 30NLi0Ic011292; Mon, 23 Jan 2023 22:11:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=dyKvGgN7XaD8emmd8NmO5vbJehdd/Fg4MXNwU8HQE9E=; b=yykNUUpH+ve7y7OCt2DFkd1ijlwb6AsgmcMQ9pXO0ivXeOeI7SWKIUeSO6Boi+u9C8Lv X7Mas1eHR5kVmGI4hmISyBZXvoen5/Bf+cihpcryngSFNaczEU703Fkgv8pc+13SrPKF Q8mgbZhqtZfODvgh6WaPpVoebpXnGGs4kGwCB8k80clxvTENLt4slbSmJrA0zYz0CXyx Yh8FduTJMhPqqC8GLhYGOa1YWsAy6vPooBsy72/rSsiMLo80pGqFGlBSddpbnkLuT4Nt /ZdrCu3B36XD9OqOTEMyx8RvZSqvgB34aWxVmHIqwmtk+1zgKcYE7/nAALA3Fjd9wFI6 uA== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n88ktuyjg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:08 +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 30NL0D0u001298; Mon, 23 Jan 2023 22:11:06 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n86gadtmk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rr9FnDK66xexNQALC2hXEo/sfytHFVZtc9GU1FJARWwiMsK04y/ug3trpAZNEWj9I79MavvA4SaZDu4UYJiS7nuwcsRtZSRgg8U8M6YNThH08nJmX3tCHoYlKjrnjOCSCy0m/aLt3KemPbci93L2JqPhVh1coOxdqlpiPVVM5c8KS8vxGJ3mOlS6L7oUHVLLIrj2g80/nBZbrT97kwUO8aeJSzsuyw2WLcqMQ6xPA3ANuh7xICJz3uJNGNFfQ3e6zQw9XStZ2HgTO/L+aVyZ6n55toWScIB17odeF9s83KUestbawrQIVt8lOug2tqavvQ8fP+trRJV3hYhkXY7ATQ== 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=dyKvGgN7XaD8emmd8NmO5vbJehdd/Fg4MXNwU8HQE9E=; b=iu7SH8bDEHNXADmdrsVxXODt22m+ocz6Oo+1wM82trBr+rsCuI1LGKueGmkwKFdnOUPMGAWZ7yM5P9PvUKvVy11KX7nX2DdavRtno39MsVUosA28tBsiepV7fvFFtTlir1VYvk331XlP3r8nT0Ec8atNzF5PNdxhs0y4YYNBYO9ojAsGzpGwzqPj5IoYZTCKlBbsq3qa0ApDjhRXkQQJfd37Jk7lx7zvxpVWA6F2Zn7vjTbnHn+pNhsAHaN1lwdLCtKUpxX/hsC7XVM6lFRWfOUwh9i/GctWTCk4kfT1e8sRoFMFrWwLDym87IiqmedYNDrxJ0rijsyl1NGixmngyw== 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=dyKvGgN7XaD8emmd8NmO5vbJehdd/Fg4MXNwU8HQE9E=; b=PVwR5LqQz0pEP41h3oJuq97EZEDvPHFDqHbHjftUXvUqpDeC28+IF8ULeZfrwCx4aLHNT8caLHqsEOeZaGFOcv24VRSCqKlGYwIPKi9KSlbSyij90VeK8iygwSyVbRDtsIINdi3yN31pKmoDhFkljZjcRmSBjG33ftmvTf26WCk= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5597.namprd10.prod.outlook.com (2603:10b6:a03:3d4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.16; Mon, 23 Jan 2023 22:11:04 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f%5]) with mapi id 15.20.6043.016; Mon, 23 Jan 2023 22:11: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 v7 09/22] scsi: hp_sw: Have scsi-ml retry scsi_exec_req errors Date: Mon, 23 Jan 2023 16:10:33 -0600 Message-Id: <20230123221046.125483-10-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123221046.125483-1-michael.christie@oracle.com> References: <20230123221046.125483-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0128.namprd02.prod.outlook.com (2603:10b6:5:1b4::30) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|SJ0PR10MB5597:EE_ X-MS-Office365-Filtering-Correlation-Id: 8d617ca5-a987-4b57-fe4e-08dafd8eb809 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7aaLRqdOi2cPNLB29c/WjSD60p7MubhEqPNnke9DNijXIX2BfzrZh4FOOjno+9ji7+xTelcsMQUYymr4UA+yWJRmW87EHHTYSTcsnKxhqQKx5pg3Zf8f93Grw5XdaWDT4g84A9lamtxjiYLvQ9IGl9hjq+MNZxqdqjIwmyLmG45i/QhAVA3CqrCiMKS9y83SYo7Vh6Id4GZt+ANq0LaoJye44ngk2qxkHv/poxQjmUxagM+A6hPvpYDMXGS8cAEKLnFA9Z6FEMlWQL4ik0lZFfJIlnSVBnj85HYRaOrDGJHZbhX4b1PFvURFYiXWzCOgdFTk7R2yYWjfhzhoL/RKqBY9b6Rq/2o+63YazLmwPYlNq8w/tfnMD1Blt39+ACsAWWqO0sgoCFQl9GMIxxBPt+pIVnSzcmDk5iiybFnFVSJHT02LbOgF1oPZVVfQFhE7HxKZQKV+VAtDy8N4qBNtKInHaS1H4He+ACQiOCovwCi6KPUGU7Vbv0d0al328zyzNWQwiC6rsqmv8JMtqOu4DyJS/NzxwPuJ63lym8WA3gr+mVsCHkOwlUYBJHgxiqbMRfFS0pVBQCQOkE/Gkn5SAX5r9z/Joc55JN5L4qB6gsS2+6rwrgaXAntKAM2Dy8R9r81prOPUCoJtyBF1z8+/UA== 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)(376002)(366004)(136003)(396003)(346002)(39860400002)(451199015)(1076003)(66946007)(4326008)(66556008)(8676002)(6486002)(2616005)(66476007)(83380400001)(6512007)(6666004)(107886003)(41300700001)(26005)(8936002)(186003)(5660300002)(6506007)(2906002)(38100700002)(316002)(478600001)(86362001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pUn3c8QGnw48V+oAEh5kN7szhCAopHUT+RcAsXbK2SphJ/Sljk6HwS7Bi0zrT4e9krDx2F5w4hCQut8H0viTjSOrTs4JoVm/+O2VKJZJORjngk1RqmGM6r7v5T2OtsIURR8RgMXGw97B7omXOlHKB+11UQ08KEhKvCTdE1UH8vPVJ+5BV66aDK7mBaq7B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VcG5oaAUTEuAMaHGHj5JIQBogQWHhCoGDdpEJmWyU50WBhUPADKQlXLAwhVsJjuTBSeCtrpAxLrI4J9FPuh1NzaU4cTVfbX3xoI+ZkGqL8lWrPRAH8L0J6C+uNyipNf3Ieu405fErZcbD5N9pMFivVqapo7GEUFoHulohGy+RDa1q+DTKNfLWAJqbbgP9g30BYarw9O/dITu5rXzVPZ560v3SZGhBcD0g0Ga X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8d617ca5-a987-4b57-fe4e-08dafd8eb809 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 22:11:04.2598 (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: ET70fybRfsLNVbMUusWZJDoi2qFBUDJYWm4w/U6XKC6A8yTAcYUAUSQ80ZmE6GjX9V/1CmH+hX2qJnFyIs5QCsIW+hFLxHrsRiUKLu0vnvA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5597 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301230210 X-Proofpoint-GUID: FNgDEbaWLyKEr3jc5c0pGHTtB4WrE0PQ X-Proofpoint-ORIG-GUID: FNgDEbaWLyKEr3jc5c0pGHTtB4WrE0PQ 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 --- 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 5f2f943d926c..6789ccfbf4f7 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 Mon Jan 23 22:10:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 645933 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 0BED2C05027 for ; Mon, 23 Jan 2023 22:14:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233222AbjAWWOM (ORCPT ); Mon, 23 Jan 2023 17:14:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233050AbjAWWNy (ORCPT ); Mon, 23 Jan 2023 17:13:54 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC62939CF4 for ; Mon, 23 Jan 2023 14:13:23 -0800 (PST) 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 30NLiKxP025538; Mon, 23 Jan 2023 22:11:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=uicPtf8cr52y5uT3OJfOB4GKllv6H8jMUhm74YHTjkk=; b=JhawqjoPHOaCo2MAqC66jrqmlu2WFUl2W+kw4GtAyOWDgkZAuyE/q0iNMeb+FjzDK1/B Fnv73hbKJDlVJAHWqS7G8+7hQkjQfROEe2iwrDL0d3P7gv/wf6kD/aNE8jeP5Ea/5FMt pJs1JIM2ODY86pV8Ws6uPUgzkljiEarVM6dvOB5nzHUvoCthwPF0JZJDondQGsaK8COA sw05O5tXeMD6dCbqObLmHP7JbZeUksyGrtQ1s0grZZbQnSSuXq9g/gwIz6qAv8dpfdgI qjT0pJkLI88epxzdIkM7Dw/jLdSd9nw78W6lpEBEikfpNCRAeTQk4UcI79Ie3mUZF8SI 1Q== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n86ybc2u3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:08 +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 30NL0D0v001298; Mon, 23 Jan 2023 22:11:07 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n86gadtmk-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YdSBz1xhLpfIJFVcoUQY41o/rz8ernHHwahN4FufiC9tx4SvTi24ecoWeh1SEqptO7MKmFk1RzdW6GdX5US2BU9FHsemMz0iXhkVJeVSy4kbVmzyE72ahbrKLoS4WLaxEfxQwGOvRynot6AWfODhyiaRGgy9MhNc2LQdntdvbVMHYLlrIdODt87blnD04cS4xXXYlFZOnLhRb8DU5j+O5UFVx9AeGdray8Z5SDLdisM0D7GvMSbM//j1it6kQkyB05BG1iaq6Bm18nb4M5eTgxpNfAjkRs2XvplaCxXuOGiI61lsV0N8z1Ou0PPh45xDZWJf2wNO4l8Ine38MbvBGg== 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=uicPtf8cr52y5uT3OJfOB4GKllv6H8jMUhm74YHTjkk=; b=bdWy4LYJlxIWaoIdInVKE1jDIRNgEPsptqTdeEfwMPxhpVNij62hJzgNbQDA8DK3UXwT3rbAuWjSmaMECwrjooyoqysuA3UiUzSyqD8HMH/4ZJlb74IVfLWncKAIklheVCK/EeI2KbcAml6yae3IbQzVi4gCWNv5942jJl2xz9NfctEVyISIkxBz69BzQAMecwiyoq6n3ZyckLsMdMegAgzWjerZQPRmyKcj4E6WRygvXw9wuSTsTq6nPc7BO2vOcuuYGP66nH2KSYxCiixnHTUpNEPmzdR/+4umFA7tdA7H7d1OMoLH25C3wA/6JB7nGeKWhjqQ80JkgrimX7JxvQ== 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=uicPtf8cr52y5uT3OJfOB4GKllv6H8jMUhm74YHTjkk=; b=siEHT+FbvmuoeeI5DTuIBXXDHN+AQ98wA/UhSZYTNKamuFre1X+dUfBqHqkH34YXHCcsp2PAwvTagjdbdo/1NuqMPvuu8BrvfbI4AhlglJXYgGDCU+yPs4poOiTrYI8ZFHDp7zpNrnoepTk12Ju8osRKd8W7ecUEdgxJekgVC1U= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5597.namprd10.prod.outlook.com (2603:10b6:a03:3d4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.16; Mon, 23 Jan 2023 22:11:05 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f%5]) with mapi id 15.20.6043.016; Mon, 23 Jan 2023 22:11: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 v7 10/22] scsi: rdac: Have scsi-ml retry send_mode_select errors Date: Mon, 23 Jan 2023 16:10:34 -0600 Message-Id: <20230123221046.125483-11-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123221046.125483-1-michael.christie@oracle.com> References: <20230123221046.125483-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0109.namprd02.prod.outlook.com (2603:10b6:5:1b4::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_|SJ0PR10MB5597:EE_ X-MS-Office365-Filtering-Correlation-Id: 340885e7-721e-4f4f-668a-08dafd8eb8d9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IQSlUbaaVQvUYZiCbwDNElrehKvMjZ8t7enrCmDW3CHMLYXVGUDmDi38/VY59brgEOvD0rU59w5JaQrdRhENh/c/M7cen4LeCDt+tEEG6ZE00nUYGjRe/upgxNoA2eAhViHvesLKzRx8WiCS4/MZcicD1m+op3+vtApAK0fSFE3JmQZ3cGGhWLQhAfiZQ7hq43gQ0NRdxPWWxJie25wK79qFCJYk0OW6AGRKGjgme2qZK42AUTz8/KVJhRCdPT4T/NphW4cAJKmamrgqcK3htpBGTolxZo0Yl6DdF/iHOHI7N/JAKWJuJ2Wxl0y4F8jwRMNOl1/Wj77AJxanJ/QNSr6sr7TG5AnoKIKJT5XoAViSUVf7HyrRX4oZqWyiqM3WRVPTf7xRchqqPiMwilZ0GReRM9q+W+c47KT4/kBso+ZDtbL/Tr56kryrfo5xzLTP3u817m7ciHvax/33lTT6puk7hUOMZScHzvyJnJwqyt+gDnWvOj+rtqhl/VhwHMsnWXSW2sfEnms+79za+vIb0Yea51uJq+txdUVKSI2sfV2IoH3sN+fmi4fW4jurI+DWYcyp2MvlWX9k3zrg0ciBp3LD2YcmOoMX6f23fREB6UR1H0smYQot8a8hgFGsWMlRqJowWcAvfOrdsrGPhp93gg== 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)(376002)(366004)(136003)(396003)(346002)(39860400002)(451199015)(1076003)(66946007)(4326008)(66556008)(8676002)(6486002)(2616005)(66476007)(83380400001)(6512007)(6666004)(107886003)(41300700001)(26005)(8936002)(186003)(5660300002)(6506007)(2906002)(38100700002)(316002)(478600001)(86362001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RqmtDNbkAidOhJVu2VpWi4TlCuZiMzBw7hkADd9Xb41/vuyU9qX8Gh8HidsgaWHmyIfSbIpPMPcU/xLi3Y1umcULJZLo246+P/2VX1GkB7uob06ghKhU/uxlt5wNB5u1kI4H37db4MAAq73sGCOQrapyEtKXOyFD1e7sbJAjJYDKU3O/Bky3lXf8kUk0bg76Odqzu3/ws8KxBKj3HyklaLX7C76E230CN46xZRDLuhoFYFvarnlccjzMMVrVZrRL2S7FSv/4fbuGykP+DuyDa+Bkmk14ZZPCBLemaNd5Noj3ruCKo+uEqKpY9a+Fgv1cUB/ZIRxGIEQ2R+Vx4kg2tgKt+AonGZUB7Y2SvdSnAs/zMH0TwMETQc6iT5FmTbu9yRkMnG6lY2eZz4G+CgnK+u91VNbruLH03HIxcTqBlZvRzJWQBwSlJQFTHZ9NwZRhcqTQpzkv4oFs02kze7GWY++PE9w8GcK8sSOBVXb+R9/C2xclaVlddFQh9YK6NXkCmnGaziULxF8IvDa/8dTyJpa7pcJ79sihcxCRE1bRjdM/jpzUIHGqOv0UgVOdvtMH7Cjvcd3LLbpsgmjqnXSoA3jPr2EVV+d0KqRqUqkhNFcrr/23+E0RxfNQ1Cf0ZboLYEWdVMa3cbQDkD/xHKBnP3qo3Q3FtOpxNz1Si9zAAS8uiF/MGaC0BoQpI0AO6dr3Yf21rG+s1U3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EeVVUx1iONCm1fTbZY4A+xdj5P7/QzniL8bh7xif/xFYJlAWkz+rh72kfVg0cOnogMCy95RZZ6echdChHyAPkIgBhxwAPGIHUOfBHfwJG/9UKIpDaU3Jucf78H6A9Phr2NpkzpD+bqALc95uLZMJbfew6H7YfUqy8UoUv5GKFRgbhxCXdsUi53u+nrMP5ozDant4ZcEgOxGhGnmHHlJtydEMQt+S0Hc0i564BkseksIODErbMkkO6lvdQBjQE7rOYhKW1945y/mKSHfYRUV52eESEkMc4vbLQrRcYLQDBe3Sxy0NXwGde6b/Wz2okBDsZGDSjWdhbIXeCoVtLVjI3l2qhq2X4WBl4HYrEyxKuiFU0tQ1DIdQngKluL95OA/yeNat+dJE/8Ffv5FfY9BrgLiiMwCSKnjmoza0MiyEycrxWwuPI5JwUGTV69ADzZDLlqT9vZZt7WIFvZfWBCyAQCtXBHVMrcYLwKwM+boTomhZUZMU0pijcS9V6MJAMfQp3K73VE7KKc3MGiL5zUz78IuwiTPLIKZSsMCBQhzqc20j6TClOld+W0wMv0PKTSNyuEdBU+8hUERa0nVDMP5nHEHvjoQ2rA6PcNtj25hH/oY0ljLcQ+rxEk+3VWlHYjQHnIMWw1tiOAZJ+nYLiftsaNE27XOAc5RYYcjl0kRzo+yyKdPaVKJJgjcwfAj/3ul6Fbopfd5LEa/WjQT5QzXi2Nb4YRCDX+i2CD4E2WQi6r/pnzpwpq6VB42GSHODqGtEWpZ329GRXhamcJPYJDJGvKnali0UpQIb44KF7G0yWqSJy X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 340885e7-721e-4f4f-668a-08dafd8eb8d9 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 22:11:05.6191 (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: MPJuG0/hPoCf+q9vMKFD+vqn+AaimbCS8uuK3/poEN7UsfSvbbuxXZAmCPKmrAXFq1Sj88zliKK74cbnPbWVf8N8TAdBLgfFZkqotIkwA0U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5597 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301230210 X-Proofpoint-GUID: kMHBntzoCaRi0ijzKMR5RaCSPm5M9crB X-Proofpoint-ORIG-GUID: kMHBntzoCaRi0ijzKMR5RaCSPm5M9crB 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 --- drivers/scsi/device_handler/scsi_dh_rdac.c | 91 ++++++++++++---------- 1 file changed, 51 insertions(+), 40 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index c5538645057a..a1192cb60406 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, }; spin_lock(&ctlr->ms_lock); @@ -548,24 +566,17 @@ 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); if (scsi_execute_cmd(sdev, cdb, opf, &h->ctlr->mode_select, data_size, - RDAC_TIMEOUT * HZ, RDAC_RETRIES, &exec_args)) { + RDAC_TIMEOUT * HZ, RDAC_RETRIES, &exec_args)) 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 Mon Jan 23 22:10:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 646498 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 EAAC7C54EB4 for ; Mon, 23 Jan 2023 22:12:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233114AbjAWWML (ORCPT ); Mon, 23 Jan 2023 17:12:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233112AbjAWWMA (ORCPT ); Mon, 23 Jan 2023 17:12:00 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 120F039B96 for ; Mon, 23 Jan 2023 14:11:38 -0800 (PST) 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 30NLhqW6010181; Mon, 23 Jan 2023 22:11:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=vZFa/DCZob2soIs3HDOIrsXCTWasD/+VR1h3elb7I+w=; b=DgBiHqs3azp1V4+iKCe3c8ze5nny7Z+Zm+0k2yxRCCogxDs+kxisOBcsZeVCUPdEutBL fjiBfBrEK2M51uVcQS+1IP/p/Hp88h4GpIjhAF6Z0J6PsMhf7IUPxHLVP+BCO7JztrEd IQvdDUr4f+5h62W+slo4lD64LujduLhVYS53QFtOPmLqpBVqWT6ZY90LSKvROP11r8Gk wPXa6eSRDpHW2p8V31I1g9cSKGqVvomXACzpj1yH5y7JBq5RV1p+DoC7QvxiVT0OJqQt AXU7q/TV00DrYNJEMzugvPcpGk55eN9ghw1l7t2bNEP0fYqKowWSORUNauFWO9otuDlo 2Q== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n86u2v27w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:10 +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 30NKRmF0040303; Mon, 23 Jan 2023 22:11:09 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2105.outbound.protection.outlook.com [104.47.70.105]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g4511n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gec4tuSDqrLOP/KkcaDxavx6a84yf5Q7eSjNF4QI2NHZojy0mVyl6lxNpOTFQj1UHEluIp2Y89g3HLHgZLRnwlr4LKOgOomP/Wtr65THRrYdbhJ1HyeioLdGoYU3KHHxxM8FslSGWGI3WL70fRdIyjJKDlpdaxrVu6bVluvxhzgvNo/aaRyDe+OeFoyB3RI6J5/BULLUSrdBAjDPQw1pEu8yoXXCBJwJJBz88l1O5kL+zgIa+hQYTzTNMYt6x2nvmaszEE5t4OOiaWE+KYNrqPeXQ08RBCB6WCZ2v5WsLD010n+3vaDUinDPdZGaN384D9IM94f/gQH3c9xUzQheyg== 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=vZFa/DCZob2soIs3HDOIrsXCTWasD/+VR1h3elb7I+w=; b=URDWbgEIs5wSOVFilpHDy36rYNg5ua3S9hFCPq2GSy4QtKGXtNBvYyux0UiUCqiG/pF/U+wtAHBw/gx+pVdXWj9R6S+Bi02E25pjPOgu3Kjr06cNlquEOqIngjONqeUp8wR8TDSedDmZzBnZhIWpbq72GVYy67cA1b5OX7UL2fMOLyLS3s036jpq3pbMc2dc6ZDfDe2LiqM+SKYRW0fNCFJYWseu6DvhvkzGrJU9oFgEPPSCHzKAmm4U7GlGni9VnWep9KP2eTji+2gNNUqjYfcK/l0V/H1G1YTnUJK73731KBpnCAd2GajOOlsKJTTRL3fwibalOzercvRcyQq7tw== 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=vZFa/DCZob2soIs3HDOIrsXCTWasD/+VR1h3elb7I+w=; b=xXTRbREAdnTgOnPtBIAWIVMDw3aGdngd2NwKkuXOZGR3P+y9v6Hfo5bhWdQZjhQjqUsDZkUoXqdInCm6wddnW7Vfjjmatu4HH6NuYXpbthEUB14aQ3zKrvFHewQcqKQBrT+APFzq9o8Rs8h18fIUvD9DPmnxe/9WDicYUzuqIhA= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5597.namprd10.prod.outlook.com (2603:10b6:a03:3d4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.16; Mon, 23 Jan 2023 22:11:07 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f%5]) with mapi id 15.20.6043.016; Mon, 23 Jan 2023 22:11: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 v7 11/22] scsi: spi: Have scsi-ml retry spi_execute errors Date: Mon, 23 Jan 2023 16:10:35 -0600 Message-Id: <20230123221046.125483-12-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123221046.125483-1-michael.christie@oracle.com> References: <20230123221046.125483-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0134.namprd02.prod.outlook.com (2603:10b6:5:1b4::36) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|SJ0PR10MB5597:EE_ X-MS-Office365-Filtering-Correlation-Id: e109bef7-45e3-4a85-e130-08dafd8eb9bb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qUIOu65XXg8TZGFSsMvtegYji0clZNTimQekWhNafPU3PVDSk5T0pm60WR0GQ6Ihyqp5NNkfnqu+J2nzL7qJqnI1RLqxyFKfFcZ1ZkirifP3Obc3XWdk99U3ZGhMOSEw9qbaOX6wzbj3x7DYtMeL1wnxg566kLRhnu6HNfQPukR8SnNkntF7OJ/FcV3cEOE5du3bayaMa4rR079/8JzPw+eqZ8unN0oiKbzOh2vIyDMhfFsCKFStLvKeXCHz2nHyCXUH/JqIKD4vbYm1DxKh7ThWry6ci4/eMCR0QRPsgE9L7U9vu3xOphEp1BnRaYu5QqH/Dyhsla5wVvlLs5XMkddMkZNbygb9sdzNCoBNIY24hDHhQdYYhGwyfrimFBSggAmlZLU6LwssZr3OFXi/twdTdVg+v3T2yI3kjJ0QOOAqiu9lfaepkQeoepHj6iELZ3WEmpjoimIVD1eKLllBZ3037j4mEaRLZ5LksdQbtmOJpIpVP3+/GJCCDqwpWjdjg56b3N5vqfvNVA7AK3AzXJjdbaAvET7z/lpX2Ebzt4UC2a8uN3nKS0srAnIN3S3Ubkbrp3KYqn7MjxBA9NrbxqZ7UqqC+1uko88bFkL2jrKzAj7fpe+N5akgrOyppw+E3ln+SQCP+YDuJltKcZA/dA== 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)(376002)(366004)(136003)(396003)(346002)(39860400002)(451199015)(1076003)(66946007)(4326008)(66556008)(8676002)(6486002)(2616005)(66476007)(83380400001)(6512007)(6666004)(107886003)(41300700001)(26005)(8936002)(186003)(5660300002)(6506007)(2906002)(38100700002)(316002)(478600001)(86362001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1pDJ6OTdqISw+RBbplr7ktXhUqdaYAvPnhtbk/D2SGNf9R4wdYdjbt1Fz6+lu8MqR/SS3Nmnxb0mf4Ycu7ap+MGOWZ7Ukf3XqnD/dvthR0K52tkJ6SMQEmRzxEd4vbkcZYv8SUmFCka381Ngq3312fSV5ZPj3IytyQkmHZI67XD0Yj3NpMCFoElghRkNgxQmuo00DEi6RWeShjqp/wNbCvppDPRVXmNyJZ8L5juOrgH6kQ7XdUwkJUZO+dWxpJsw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Ru7MRYmg4d11T6LztGPEHhtXG8gL28QrgQTAyOtMlJLoZX7vT6SIU5SUbkI/ephJYjW21d8HBRCxPrihUxm23SttbEP8UVRxLJ9G1xUFWWLYO4D047a6kXWjwvw+ZT2GqzsBCd5brqfCVuY+9aOOJgNjrpVFciwoiOb9wWXoXzsIti9i/rHCjPOMe13gII8zrib7h X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e109bef7-45e3-4a85-e130-08dafd8eb9bb X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 22:11:07.0877 (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: qeViLjCTVepF2XQm4NM2UtwGvkUbPA3M6uSWD7g2irbL7WfYBQm2+a2hejk4oD7O7c+TlpyzNQ6ZkhBziyg3Qh1RedqWeJ8ODaazPhyYM94= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5597 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301230210 X-Proofpoint-GUID: Ukx3Km6gCF5MMmRT2Up6c874_eh3ZEzJ X-Proofpoint-ORIG-GUID: Ukx3Km6gCF5MMmRT2Up6c874_eh3ZEzJ 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. 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 --- 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 2442d4d2e3f3..b269144dca3e 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 Mon Jan 23 22:10:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 646497 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 13FC6C54EAA for ; Mon, 23 Jan 2023 22:12:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233082AbjAWWM0 (ORCPT ); Mon, 23 Jan 2023 17:12:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233132AbjAWWMH (ORCPT ); Mon, 23 Jan 2023 17:12:07 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3CCB39B85 for ; Mon, 23 Jan 2023 14:11:42 -0800 (PST) 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 30NLhmIS029599; Mon, 23 Jan 2023 22:11:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=vjQmDYi56qgd/4v4ggJXrsu+1iFKLC3hEjq5b+aU1NE=; b=b8mIFxQwBZQmEwyFUZwELjMT5nao7ZJnEqXbIlE6aaskSvEtszDAIhho2az5QeKXRtae vF0HCfet8xa0cdme+qMvhLDwi42SrtvpcSy+H3HUxD8X1xuOaLDnmbXbbeD84dh8sw5n PQZUAiCpiINZjYdaKiLnjiI3TnjNY7KSO6XUUJXisJcslZewCNA128FoIWaSG1n9oPRU IyOzMvAGQJeDQpLb5t5U7JfRAZIOAeAXAinF4jrHulyAJlWFr/oT5+F4eS/J74XqVmrF xAcmnqazQ7T8TFclU0eCANKmEXx55XeMEJCmtygy2wC8Qo0FuwcLl54g8wxe4lfvhqo3 Nw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n883c41p5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:10 +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 30NKRmF1040303; Mon, 23 Jan 2023 22:11:09 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2105.outbound.protection.outlook.com [104.47.70.105]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g4511n-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WuADLq9jD+LFF//QWAh+go6doI2Bc15yx6TyGpxbvZdU77aNCRffwV84zXxN6LYNfSKzb/T1iuYkEdkBT6KBOFpZkbPclkbbqLnb+sxDd4e3a++Eq3Y4bq6h5UaCaA63iSFI2FUPfF66JwcoPmvRdLrs4essArL/ueA02IHH8JsMK8Oxj+h3NXHBp+6QJZQ/AV3AvQVkq28R+VgHG0xYcDFGY0hTHtZH8TgYLPmVq2CcGqhJgB+EA+nw1TXEYEW5ZgpzU7T0ZxsupO75g2NO7xMi5Qm5VCd8NiB0rO+Gp6FMVWN+Fi3GrImS6VoWK1eeeIBIvUjmTa2FKvJ1T9PPiA== 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=vjQmDYi56qgd/4v4ggJXrsu+1iFKLC3hEjq5b+aU1NE=; b=HyqDy1NNh1BxKdLD8hPSTJxCKvN7QeNqGsdP9MldZ4Akdruhm+g+HfSh5pAsHuMebBvNXwwCBklVNzPP0QEHzIGfcquP6Fnk2dS59mtqShxGgQaMbTsmXzT5rIitYjdGxCQCjeR6RE0KLclPCOjM7qgtiHTjhF2sujd7D00OdsUdulmO8jjBphWvDGr2IdhUxwjkbzPnk8xBTjcEtFu/RbGn4Uo4pctts1gqtAfxU7e6h+HGsvD1JEBC92w0lSUWfPKGxXyBeVZ9VHD7a5Csh4dViGJmock2ix2cHPRFhLljPI8qS0Pc3UzOQlWqkQ6/sZIl12ZcZ/Q4Httsh1OgKA== 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=vjQmDYi56qgd/4v4ggJXrsu+1iFKLC3hEjq5b+aU1NE=; b=pvNDwnE0EWpl71or80pzFAELzadRViZnPCRReWNQL4n4TcEqC22HLOy9hbF+tbcZS4+vX7vtICMvny+NIO8J7sCa3kWI04Y15TlRH4DAAbGXMWpyPiMqgn3niw+nFYuz/lbmNJN4U1SNvj3O8wuImnvMMSFqJwSAauAen01IUs8= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5597.namprd10.prod.outlook.com (2603:10b6:a03:3d4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.16; Mon, 23 Jan 2023 22:11:08 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f%5]) with mapi id 15.20.6043.016; Mon, 23 Jan 2023 22:11:08 +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 v7 12/22] scsi: sd: Have scsi-ml retry sd_sync_cache errors Date: Mon, 23 Jan 2023 16:10:36 -0600 Message-Id: <20230123221046.125483-13-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123221046.125483-1-michael.christie@oracle.com> References: <20230123221046.125483-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0128.namprd02.prod.outlook.com (2603:10b6:5:1b4::30) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|SJ0PR10MB5597:EE_ X-MS-Office365-Filtering-Correlation-Id: 65bc47e5-050e-4a28-34e4-08dafd8eba97 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ed31hleMu6eVS7LqWzGesucnY/z8IysVjDTYtUaLGKDp7ceCJDqlXWs86sBgFav8y7SKtjECBRhecCY11fM+TcJYwIT05CfX2qmpOtyY63MRlLPAZZ2CMS9FkwCx9CHikqNxG2ZIqNqHqlddikrtJ4YlIyFCJ0tPpCt9ua8+GKPlR6+ChtDf+UWTiLMQYGwSX/FofyOvArNTYlPLFfINjA7GhLT7puDLhEqtp/ExPuJz7aOudrh+1vqIM7CUjBEd18e6sotQFHAyWLu6chhRitUaopj4yf8DJZVmi1kAlINyK00eqdwL9ySHFcZVpKspeKlHMRsI6XWuERxWWRI5JKoaNvbKwCLU9+XjgzFsSmOLnLMk4OmS3RzsMXI4WIXWDdE/WPtiZ31VGjGrHGt70q249z5k1Tdia/+L7/VMc7NN4FQnkd3i2Xf9RBvlZWRtcxsYqHa9p0mh2Xa9JyEtdnB1HkEOQh6+nxPRdd2Cu2tjZly7kddQ+3xY7rATY04OXFWtDdlsfQ0RWv8qAGYq5Yym6aqGuQiCdbF4pwHbzzqu4Ae+NvyD2GiRK2JVJT6/ZIzKFGuHu11l84RV1SoEmnCgzIKcsd88PiyNGIwNs8qm4sotXFtjxcOfFVA7W7qP+Ma0oLb1lEXiTxH5QYGPvA== 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)(376002)(366004)(136003)(396003)(346002)(39860400002)(451199015)(1076003)(66946007)(4326008)(66556008)(8676002)(6486002)(2616005)(66476007)(83380400001)(6512007)(6666004)(107886003)(41300700001)(26005)(8936002)(186003)(5660300002)(6506007)(2906002)(38100700002)(316002)(478600001)(86362001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CRfkd/DGZNeOCcvNOXdb3B7oZi7Sik192rUZ0ebsaCzzFVS1SjkWDcgMWO2YwvjJ8ZI9Z7JCiJdrN+GMVE5v5gdjxvdyfPc5Y6SXCy50W7gn8xCP1Y8N1ryrlb3Y3IUaRZLgKmiZdvXI8XDN1tB7bpyZRo3bfbss4je25LrNMg6NZT53TYkaVDpfYG+ZxPj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euLtFa0Sr99uCdGr8PmJdXGIrRjkFWxDS4wBm6WqGg9fPzBrK9et8HwaJgMsFeKIpGOoaSGOiyWO8lw/MMWIU42apZIr7nDLnQgBSoJNY0QtbqhgCr0loJoR2ChjPSGtm1i1KG3B/SF+pe36TXDJX2C25D2m9Z+oY/eB2h1gFePD9bmvRcpRd6THk7I6ZIB+P+zN2VZYhQXCNQDzpaTE6MgMTs2Kf2jACj4zb/Db8WqA9D3+wTG5RKx9sDKI X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 65bc47e5-050e-4a28-34e4-08dafd8eba97 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 22:11:08.5563 (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: /+xekq34KBTH0fnkeqVkW+/L3NKZhrWCpBYaIVx5aAy397SVB/XTAoZGPpvZX21Im4iolr3ns5HwzUJkJeNknxZ/QaLdEHSC6QDZ1nRafDs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5597 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301230210 X-Proofpoint-ORIG-GUID: hI25rbnqyQvmnNAX_D0_fU6R1M7-qXnY X-Proofpoint-GUID: hI25rbnqyQvmnNAX_D0_fU6R1M7-qXnY 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 --- 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 89aabab82763..63d2c6ebf948 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1581,15 +1581,26 @@ static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing) static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr) { - int retries, res; + 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 my_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, /* caller might not be interested in sense, but we need it */ .sshdr = sshdr ? : &my_sshdr, + .failures = failures, }; if (!scsi_device_online(sdp)) @@ -1597,23 +1608,8 @@ static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr) sshdr = exec_args.sshdr; - 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 Mon Jan 23 22:10:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 645932 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 53986C05027 for ; Mon, 23 Jan 2023 22:14:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232742AbjAWWOe (ORCPT ); Mon, 23 Jan 2023 17:14:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232884AbjAWWOH (ORCPT ); Mon, 23 Jan 2023 17:14:07 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 107643A591 for ; Mon, 23 Jan 2023 14:13:42 -0800 (PST) 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 30NLiDnX025136; Mon, 23 Jan 2023 22:11:13 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=lZ5SYPXfZY3lLNsmnfLK7nwS7WHlq3O0bKCzK2LHI3M=; b=e48zq3jIvg/v8En+HzCKDEZsxJusboDNH7c4hg4Ndi3TX0ERQG9ctXBYaMbo820qOawW Bf/tCmKq3P90x2iDWoGwYZCT0pF3nTU7vmm0vmmHU5goHmboSLi2krk1aBk575gulJes h4WTkwbDZUpze1OZi+N71w7aDPAArifv+k1cmFseROx4ogryPRH5GTxTepGSDMc7igiA py4kfsrsF/moraXeESGQgWpPfLjzIZRc+s4mCzaL6O9djFxR1SnrzgsSah6/klwpjUb/ ZEs3gw4TW5tbWLGvvs6suOnz5boy56JB3DuZUj246dtkIKUMen3F12DSaZ162F70SMO1 Vw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n86ybc2ub-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:13 +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 30NKeOFM023165; Mon, 23 Jan 2023 22:11:12 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2102.outbound.protection.outlook.com [104.47.70.102]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g4e4cb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c3xivOfA2EqDxaLJLolNB46E/McXB6aSlI3YyEIc00IyLJ/NZgrVWulvjoqudDgUjVq0YPDd7DOnmRvC8PvklbyOhoKJs0fIG9j966yrcemc7es8vPUS3r02B8BxWEO1zfzJgln7drxHYGI2gcf2Mu60+tFHo4inMGiI3mtkdtw7jE92IGDAldls6erNElMW26UHcdi3HgeNW5d3b8eOAyHaNe3xlIcpsDfjiWH2/lrnXkj9gQtR1aihoKOqYy3sY+mhOYaOIF36xfTShQESrgrarAYKOmw0TSKwz9pxgaw2txJ4uOu12wRYBmTEXM6Qc0ttfEuKQKsXBQldRGfhFw== 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=lZ5SYPXfZY3lLNsmnfLK7nwS7WHlq3O0bKCzK2LHI3M=; b=R9GMcR3w3e//ajoXgo7OBsgqkz7x4tgiNupPe7MGxgZxa0KAzgL6cQ71PNBim7HWw97wkEsDW0yz8doJ3CAaetg9JMKgHeuSI6FygnM+kgIActJkQRqJxXP4SqQzlZn6qoSxHMMqibmU/TTmCviu0Odx+1Cir8HtsxrYqzgHUzgCs9OiAShAjZkuVxgy1hzgtb2fMLya2HAlnjhp+re207li5TZ4HzY42H2Sw+3ivNgO4or/NHL3WgvVA4NQEI2xd+dnLIBeVlXJfwotNgqL4G7/g6wXc1i1fx4D0PpyORpDLUMxRIe0iEZGhFLZdrBi+A/UvSNrdB2s3+32/tWc9Q== 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=lZ5SYPXfZY3lLNsmnfLK7nwS7WHlq3O0bKCzK2LHI3M=; b=J/QTXJg3QYXW7kUzgaEFOoPT9jw1EeLyQtDdrsYCO7cH7dzKPxBzVhZ8ziL6pDdKqqzmlNbclW/3lfqpawk+SRyzITc5b9BvAnvbZtkYQEF3pY0cV7lJB4bKT+afBDvGtSgR/6+z9wbbPemYKla/JNHVcgkXslSyo1JTdLGxhbw= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5597.namprd10.prod.outlook.com (2603:10b6:a03:3d4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.16; Mon, 23 Jan 2023 22:11:10 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f%5]) with mapi id 15.20.6043.016; Mon, 23 Jan 2023 22:11: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 v7 13/22] scsi: ch: Remove unit_attention Date: Mon, 23 Jan 2023 16:10:37 -0600 Message-Id: <20230123221046.125483-14-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123221046.125483-1-michael.christie@oracle.com> References: <20230123221046.125483-1-michael.christie@oracle.com> X-ClientProxiedBy: CH0PR13CA0004.namprd13.prod.outlook.com (2603:10b6:610:b1::9) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|SJ0PR10MB5597:EE_ X-MS-Office365-Filtering-Correlation-Id: 74f8da7d-21ff-4001-222e-08dafd8ebbae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ye6J5q8/PEzWIqS1viPbIHlhOsCBVwxunTPX4EFJeWhhjbWIYiRRqJen1f4y07i5xhStgrw62tTFEVx2SIdGK6uaeWCf76dVUCI5NEdtnMW6CZB4dNrM9rRGlYnAAiUT7RaGkfLAw9G3Shqno9kEMkYZCLTROuxzmu0BS0DxI49ATkB9+wc9RyI3XrERjCsAbc13iV/mPmud924iFt1m2La0VaWfQGyUdhcTvdkwE/Mthrisf7hTN81WPSWXUPl8e6PxsVcWFhHanRroVpMRq+myj4rTtu61plGQEoqC3kklWejXylHQDHiita8Bh0t/mY0+5V7nz5BlIp8m3x6ub37OTCfUy3vS9XdC11RWsp4VLps8z7Ntco/5Q3s8FXJuI68tmaGYR66OfEaLx1X/Y3edrhrp4Q2XObubQuIy+chL6UZFxAaHvrEuxwbh26DZuFVQYYSr+fZYJ5WdQywcVLLT/KV/H27dLi/JxNw+B3Rx8jOQmdhtDtFfrRKKKmqyXzrTkjSP1hJjV6flwYRYJBPailSGmES+fzzEHjkZmTwLK4r2xMKtxO1I2elrWLV6BW1JH+GA5/RIJWP82c2zugd6kM7dNLJO2KpyWUignAed/6M7ydeXMkwQbGZrnLVmkLGVU3z2GBMKn/kp2qm0Hg== 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)(376002)(366004)(136003)(396003)(346002)(39860400002)(451199015)(1076003)(66946007)(4326008)(66556008)(8676002)(6486002)(2616005)(66476007)(83380400001)(6512007)(6666004)(107886003)(41300700001)(26005)(8936002)(4744005)(186003)(5660300002)(6506007)(2906002)(38100700002)(316002)(478600001)(86362001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: d3AYDfefv6IeU4DfB6LGfvGUV22Qhqm6ulphQqilpejqNi6MJCGD7atCRk0PBAcP62UDxUcX0WabsZxZ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Afjvc14JIJdi3dEdoDXXTBcoH+h6gd2MFG3ylD5Mkf+bH6+zSEq0R8vFdGPV2E0SMHITpiFtbMl78IS1dGXtZnSBdESXZfdinjV7lBioZPPzv6/rupe2Y8RTtH62teAIFBiMeV4XSHkkAzWJrd23Z7KIiRheWfoPUiYA2Z3U0oqIjwxG3yA+9flahBlJMnBDrM9RNUg33w7YYAS2XRrDXog8gcR0FWbhlusjPLr3W10fCEgu2rk9C5lNqIhoM1iYT5mLPloTP6m3ZgMPeI0ERKEIGsAEzGN/QcITPdkF0ZqpDZuc3p1g9bJxumqQy1kga1JEMGc9mGb5AUO0635eIjdYE1NRuHJWk/XyXqvVSAS1t X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 74f8da7d-21ff-4001-222e-08dafd8ebbae X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 22:11:10.3843 (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: uw843P3rFPh03vU8CArXHA+nMN5AYZAkqpSigYlR0vLu4ISvkYnyTRtxvZLOA5n5hH63mg5nAf7I1i4qgcXO/O9B9NNBrJelT4M6IoX95TE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5597 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 phishscore=0 suspectscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301230210 X-Proofpoint-GUID: -3yILpUZx-3Kuj_Gf7T7e7eIhtD0t8J0 X-Proofpoint-ORIG-GUID: -3yILpUZx-3Kuj_Gf7T7e7eIhtD0t8J0 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 --- drivers/scsi/ch.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 72fe6df78bc5..87eb3ca0d362 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 Mon Jan 23 22:10:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 646493 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 24CF9C54EAA for ; Mon, 23 Jan 2023 22:14:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233252AbjAWWOf (ORCPT ); Mon, 23 Jan 2023 17:14:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232664AbjAWWOH (ORCPT ); Mon, 23 Jan 2023 17:14:07 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8824A3A59A for ; Mon, 23 Jan 2023 14:13:42 -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 30NLiKN2020011; Mon, 23 Jan 2023 22:11:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=Kw7EAiu2JBG8mY+hDbJDK4Ii9I6tBJxSqr5rWF50Y3U=; b=ae4SOyn+MRQAUuHLj+ym79W1DcYnLF9GMGXma/J/xMM16k3WHN/ImOjZpIgaXNN7dRK5 3rBcsh2/jRvYntcqXpteAa1MicwKL+DLNGsODOXJ/gNizIUGbKxs7PDSQKuX0f4syXt4 rt6Xy8GlDye6CQdXfDRS/tryILmo/V4+g2IbI2IEBloybZmXdFWe1WUEza5lQ+uRDdN7 myIJLYxRXNS/mSRj4WpPNTWRWaYHEPsZ1XSVxK8xm8FuWMMdJTbM01htXzHMWdzOyHT7 JW51oCUgawTvbW1FNzUMpFZC9ONpPJQvMqoB4KXF337YiSOiwbaA482tjQnWR1xJy+88 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 3n86n0v3pt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:15 +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 30NLAgj3040260; Mon, 23 Jan 2023 22:11:14 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2102.outbound.protection.outlook.com [104.47.70.102]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g4513w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D/O2ZzMw2mPxAzZsEptg6cfV1eMk8yCaZf+LBUTEHtjO/Pi1eW1UANAMsDUO3GRfrVQ8RFV4ZTer5Xm58lOnwk7IKFo09aW8upwLA91CvjcvU9x4fdSEZabBWxYSn6nbaH9P60ZaJ86j4xApeQo48nLf+XNgjLT/xIZrYRm6XFZh6/FpMp8HTGJufMCEjcqos91qR41/lu4tw6QphVSRtHAQX7gFfgLoFFK2tMppGdM9rRaoVhwxG+ejgp9JkRdW1urdSnaNZHmG3+ofNCKnCszgrEm228f0Jnn1HeYnpuW3jF/xSsxf2dNaHo8vOxvpsaKQRPyL15fuY9akdYspnw== 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=Kw7EAiu2JBG8mY+hDbJDK4Ii9I6tBJxSqr5rWF50Y3U=; b=Mc4NZAfO7AV6clyV+IlVMLwfVuC0Ev1sks3b5V8U/UZ4HbuoidNqNEN1bCn8FvcKb5l92PoD1B1+IlmivsRTr0mrFm9KQ/HpsEEVQmuPsDea537tfV8rYYuoMbf30kMCPhnBsSvYePFpEKTAtBwKcHd2Orz4ZncJgT/T01GVRaSWgccVqTcQEpGki5Az7kuU8sloZXk5V3wYTcC945/Il0kwafV26JZ8xyqWW7IUv0IZMyvbVlQUzyqD9r9UcropNTsVbmZTWDFcYvODA3SiFlwECUb4fqe8g0GOHeJf31yE3vuoAa0n5LiAIIOuuQynG5zr4mfJaaJ958TUvKpBRA== 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=Kw7EAiu2JBG8mY+hDbJDK4Ii9I6tBJxSqr5rWF50Y3U=; b=Nb0vKlvmfRrVtMntZr2MktMedlrDK1oFGkzNQ2FlJaDMHa2Z0J/y8sMsYRL+o8u45INahatmD/VMIG3BU1mKsyjWQMBzxsmIjJMSty07d13aaPDoctA5XwxLUoni7CTLG7p8bikWMoKzgtKSwo7Q8zxiHoekPMF4jiT3gwAjpFk= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5597.namprd10.prod.outlook.com (2603:10b6:a03:3d4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.16; Mon, 23 Jan 2023 22:11:12 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f%5]) with mapi id 15.20.6043.016; Mon, 23 Jan 2023 22:11:11 +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 v7 14/22] scsi: ch: Have scsi-ml retry ch_do_scsi errors Date: Mon, 23 Jan 2023 16:10:38 -0600 Message-Id: <20230123221046.125483-15-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123221046.125483-1-michael.christie@oracle.com> References: <20230123221046.125483-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR08CA0025.namprd08.prod.outlook.com (2603:10b6:610:5a::35) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|SJ0PR10MB5597:EE_ X-MS-Office365-Filtering-Correlation-Id: be1ffffe-4246-436c-ff20-08dafd8ebc92 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vbh6xzdiSjQ3jI6lVqQJc6RdDl0KqEpGTEKrlsHTlAcWotFNBWLu5xAShXehSLatuSCzWgJCI1uxlKHZFIUUQowsNGbceKxhCDr0iukM4Hpnckf1ZhsQBuFqI19+uI/qKDq2foXvzv1XyEsEnbwZpsDIZAuLAec+BuN6u8Jj7I3gZbJqWoeO89fWXbjDC/Vaq8CPYfOoAcgdceDWv9Tm4E9TZECuHerwlN25Ojj39eu4gFyG2TnKJKsMAcC0Owc1EozLpV6Gi2shzA0iQMd2wBsxbL4TorvO4kCAF+O7182eJlInJnhM/ilfrHbFMPO8vW9PxdMFyaKYvjtwAmwb72WToA0x3sfFUg5YsIzQ48P7rqiiEbgbSRRMCBtEABIV3s4X6SP+34xb0bk4ra7SQAlbJJqNslFNmHFQff0GN3TNch3SZhSYkXJ+ZxEE508m+iCcEdtEBEz81a/HQBOQfLlwcH1w+vRf67DoUg+MiCSvZ+R/iKJ9Q6sw1l3S1TW02FkHkzSBvXI6JsM0svGMtcUdfanwxzuB9edqyA6idiCbh1QNNRQM1HrUjOMMIRqVAQ8UoI7lco1Pr2PwqXjnXd/+ouoZLEokXVCpQXEzpMFkT5sgddei8RdD+NeKEO5haw+7erfpypm+f4wc0B4Mow== 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)(376002)(366004)(136003)(396003)(346002)(39860400002)(451199015)(1076003)(66946007)(4326008)(66556008)(8676002)(6486002)(2616005)(66476007)(83380400001)(6512007)(6666004)(107886003)(41300700001)(26005)(8936002)(186003)(5660300002)(6506007)(2906002)(38100700002)(316002)(478600001)(86362001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RNj1E4SVutyj4+cPB0gaMDS/id/yJKerwIikPWUWXXGgtk7xWVYr/2zZPz/OWLwy4eAqCaM2BIj2RhyH5F0wlFAQojgkP29hLndyEdxLW0/yE3ojsAHIJOfHLm/QrQwhViJQALVEaZ99yEqafVrkFLEE3Vo14RIvKvkaeL/w2ujm56oTvhcjIVwQD6HqsgIlpMoaKWms7iWUTXWIcc96gtmD2UITl6ZHTH3wjU/QbgJtRkVfM2/LURVcKSjGhe32bw9d/oTmvCpwgqqKF00hsf1gNJsMMDy/sR08g5A2X5ukGUzUuAOgjPPFMo2hd+0Rjle3rBZxTIFUSq9rkpCGEzGJWeCtvP5ylFhUCJsTXw+Qjw27jutOo6SMi9HZjpRs/kCB/SiAdC/5EtRpUVfKOFa7NJxn2Wn8PcsJOfHSc5pHdL23NoCM7JRkSlw55o1FUE0NuVZ6GZZMbxuIocpJ29SCRXs88WWDMpeobEAV2ZhAj854v3M7eI6RXiCuLck4JAKyc6y1MTzdYlhhEjKDHxzahg7XZL9bvAPeox+ZN9yU+G3BXa+iHIw+I47fz0hzwvmSfanWDfhORFE0b6MXwjjbRx/PIPIojsKoQRAMB7ulMtdwbpIx7GB/8SVQZ4VVOE+P9+eau0vQLcke6ogyJiJAZg7YWz4Nkao18Mdm5syKYCRWcgH19H4zKbfxLwUcq9whiA/Z9V+ZSuo911tvzW19fzoPOosijBQQ+8kucIUt2Es6TxtWbCRPRFFbKsiqO7ZUfo+h2fiYaey0pOuYUdIRf9liwaGKjyObSFrD64EEFyYssxxBAEhyylag5JOz57YXkpkM18zKx+FisiOAgEkUtbkbrEZGADLLh2hrbWbQRMY//3xaHmM9c1PUqunru6E1OOSuWmppy9SkZMZO5x43VfFkYMPYhFTaW4tM5IjtSOAikuGBdGJUVCUc/tco6fhSO+ZipDsCgsHrty5+LX9/e5pQ2er5YrpMZmGgMro0gKVxcWIUrygsoLOiFjzP/+Y673P36O7sxT0VAngXb+Oq+abepU9sQg+wi12qzi25kS3vtLCVXphMB7bI7TDaqRL10f36Gif1b9DE92LwM7l6BvWirqFbSfkv7STspadgz7NqYbQcEcqSwUn+odftEQEBW8xjPTqK1BRCEf2WETFk7gukp2cJB/8h9j6VQ9Rs4qZK0q+Oux9eBI6H68tjBL1b3nw6r9sSQkUnlahC9Ag+e6aDLi8TkNQn48RjZ0qeDaEenm37sHSMQfgIz0sFfBM62b2e/SrzjbNeSzJPOOQLc2/zLdfuVvC1xQ1hqviEykHs3C2gOU0RPcgL3CYxowAwO9AU7td4vX+3EqKNUHYG5HcpFgdaGE7GhQbre9b7TWPFbf7nlORSasmDLx3vqCSCmMQjlW1TvYBI6kgOdcuWEj0tQuntkKU3rlOce+By+nOqYhJh/n74Dyyp35DFtzP7hxZMsCpqH6HerN3O2s6kYMsONcUPrlKeY6NJH4HMwUIfwt5r3QGefXDi1jq1KnRIUULkO0e99rYzJxH5S9UdgjYNzKAU3vdnsu1AFwSZhtPodaei44pnaog2cJHVN45mX3ujFloztcfLGcp5IA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: R2WllCglN1/Y29EqtMENDbfp4EupIhktw4xromCckjlP/OjVV8gKJZP2S9lmcaQ1OOCagN708bfzyFVQc3BugrnwcStRO8LHupxW5nezo8SWrhbRXUXm/0FGY2OUuyO9cgnQCwlsyZ+f+LC6sx5LrQQk7/MvrsSBt2KcXIY0o6Fa+mItTkAUldhSuku3/qcLs6zYUIJ2/DD3GeoktHb/STLRMkJllwPCHscQeeEmqoGqCcG+BgDNHhH4MNyQ4zGiRhNZQsFOZtaihIFXZNBn1Pg84hIVii/5sbgW7EiVNH7Hvzn+95ZF/yn4Q4nsVrUO4JZMx7IgTS0J0LZUWmGIHTe20sVUD/35H4ro4mZgOkAVqQw9BFNOYohKjHHaX7QgCiL783g1lPA8XkfsRLTia5SXrClQrO8UobCC7dXaqYDFzboKjifWxMyKU2A3dUj5vtxgO+KmihAgx1EtXLVxofrucZUX5dBIxXaSEJN9BGDQ6m1PpxF+cGYQ1Am8xRwt09GOn8bEx40vWnUHxOScxCuJh8XpUTnv83b/Rl6v1ohjdTwuFnXtKCBdXJaiUr5ZtBavRPA6yB5Q/zvrfX1gjcV+laSNbsRhXef7zXOEZKtT//vv6KZz7SFR2qkPYZAiII9T8LLpZgT+6Eos+I/4jcbFHdLoPAVHxPSjddOO5WJyuJuzbY4amMohOdG1VI/bU+bOmEcl8e9Z441SWvxPIOZpWQs6hd3zDLyHsTdE+3riGnGUxmn69iTE8vq+HlqFVXDLe7WwiWpc8PRNdxv8bCw/NyEmBZzsX//dbIxkgmdgmhQkWpqX40Af7EMF+1z8x48TdiHaxRR2C4FfK4wx8GyIwuMgzQxidDGgrBem8rV+0V9YDW/u2Hkyyl8k5emE X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: be1ffffe-4246-436c-ff20-08dafd8ebc92 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 22:11:11.8842 (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: cFSYeak+vYmc6aoSXeaNI7ExdWosX20VBjzd9w/e3mopE/61h7QfPXsVzawlThNS6Ey6r6tHHKsLZbI4V2hSi9kCihI6EKbEkk09+VbrF+Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5597 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301230210 X-Proofpoint-GUID: 6KBA5FMFZw7iPLFjTtcjXdY8bQkWX1kZ X-Proofpoint-ORIG-GUID: 6KBA5FMFZw7iPLFjTtcjXdY8bQkWX1kZ Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This has ch_do_scsi have scsi-ml retry errors instead of driving them itself. Signed-off-by: Mike Christie --- drivers/scsi/ch.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 87eb3ca0d362..3e29c83f7c1f 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 Mon Jan 23 22:10:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 645935 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 AFE42C25B50 for ; Mon, 23 Jan 2023 22:12:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233152AbjAWWMf (ORCPT ); Mon, 23 Jan 2023 17:12:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233052AbjAWWMI (ORCPT ); Mon, 23 Jan 2023 17:12:08 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B33339BAC for ; Mon, 23 Jan 2023 14:11:47 -0800 (PST) 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 30NLhwgW029679; Mon, 23 Jan 2023 22:11: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=CZtTPJGyqsi6Tm/xsLWLNv8mtCgR/rKM8dIu8RzfoOk=; b=SBJhrC/j2H9NAO6dnuBLs3V0W51RDabaDz97kfhQsAXumxvk45bsuBqwS7mTCJr/AVVs qhq8gpv0iiPgX0iqnuXD/r3S2pjSwsQcAaxOS+al0yto/aitjNRmEZYWSN3vlH45EURH kPYhFQ591p9cbsKU6khN4wfhU47n62CY9WBoGDKPo1QXivYpYkL20PSw0w2BvWDCNHl7 ZXX5rI36Oa/5vBZEUAis3H1/X2IBZtkyR0PaKShJ+Mr1cJDOqkLYhSyn9M2wvda4bzMS lghschaoIk+A/3Yo7J/n+h7QNca4y7svX7F7njLR/QEhT5GYV1awl6diVhuE/ixpAEN6 0Q== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n883c41pm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:17 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30NLMEwI023119; Mon, 23 Jan 2023 22:11:16 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2106.outbound.protection.outlook.com [104.47.70.106]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g45en0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LX7kG3Uz8R+ICExuC7x+ix6UN+lke/7Dp1SkBqpHnw6ZieNFsMFcKlivsNc5OjSErPJ/B6rZVuRJUYWWyHV5fiuspC7cOrGXwvBJB8occ3N38LqD4VM/Iq6cKWOqeLCHxFIiMVD7GBaeFa5KGIce0hxRqN4DG4+oX375dk/eaeoIsOSUITtNexIfl0xbQ3V4D7A1gFgOzzx/fBiSM7LgXXaynRdVtDYeCbE6PsgWo9u0Y3mcluwT6/JzWu9QPaWs+4xKaxulgTxd9j95D6H2b3MRHrsGUYJnWhIOLTFkXwi8V2MCppHCXYzR8GjuWX8llCSnuBddKQ3z+QEOLtwKvQ== 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=CZtTPJGyqsi6Tm/xsLWLNv8mtCgR/rKM8dIu8RzfoOk=; b=nzpYETcu10qr+7a6ZgN6Y072OI8EoxIEj6vNjl+yG9kPudsXQ0PIxHI4HaxsQkqrYykGceqSGinDyRpLMGfZLL9qq8WKZ/rQ7696IXn3c1HhL6pkz8pTxbVG1mV78SRQ2EgXGCIZO0YYK3fJcPjmnvTTVnurNpjCx1xzbwDC7ujPTcqPdvySfQSc7mMrVQH4uacz9NFRyTMsHpB9ZD2ciFAgcXKWQ/ezCq/YPXwo99YPEjHpbucm7SeFx8NIM7EKPwihhQa1Q5iYntCoPsDhqkwJAmWl5g092Yz+gWqCSlWf9tVRATLtdHFXWkActAAUdiwgcnGknJZ2L8DBtvz0GA== 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=CZtTPJGyqsi6Tm/xsLWLNv8mtCgR/rKM8dIu8RzfoOk=; b=nYf1+a+Yis+PKNBOMVK57P2FzJ+bkvMB56Ax2vopq/QIx/dnD6DlIgburCsKy7SSTsN80JNCG1se2hCDwgVC02zChdm43PRLf6LIjUdTJK6AEFMKjb4AQ4HrESqGvfgf0fs7VgXDtaQCFXerxfObfjL3HpyNpABerpbE2TxAyYQ= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5597.namprd10.prod.outlook.com (2603:10b6:a03:3d4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.16; Mon, 23 Jan 2023 22:11:14 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f%5]) with mapi id 15.20.6043.016; Mon, 23 Jan 2023 22:11:13 +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 v7 15/22] scsi: Have scsi-ml retry scsi_mode_sense UAs Date: Mon, 23 Jan 2023 16:10:39 -0600 Message-Id: <20230123221046.125483-16-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123221046.125483-1-michael.christie@oracle.com> References: <20230123221046.125483-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR08CA0003.namprd08.prod.outlook.com (2603:10b6:610:5a::13) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|SJ0PR10MB5597:EE_ X-MS-Office365-Filtering-Correlation-Id: e7a8e0ec-38cc-41ee-8a0f-08dafd8ebda7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ezLIrRkyLCG4obeCDR1WgraIn7VRuJV7XrM9oNSMo2XW+QOaGhumscuVKd6xVIq9Bj5hzguPd+l1kvLDp/Yie7APcSD5xert+I3qCHV1E/FBriL/7/64rGVmpYNYG4O9RxspjSK6mWlzXMLDH/AslcIKV4LSEkoqXs5awgetG/pV/s+POSBF4yHssDVdyzsdbk1UBe2+3zRniTJCs5f0XphJUXUP7lQACdAPbsfwGXvaqe8mTWbLI/A8kJSPRS8F/DqSvClkOu8jAYqr2Qoz1yUWEUSxVXm/DAyQh1wZ1OtBvNyDD3U6z4hACJfunVV2XlXL0GBI3Ek/3n8oFkMNjxiFEFTCcEn/fZViNzuwLq4tCsxpIYThZWVSHJW1C7NaIk2AJdFju/yxdf2KtqPyYeczgxnGxjA3UWpJ6C8xg0mgi4ri+cN4cJy/mevn753a+ZRVsuYyk8qv8ha2pEo6WwpiYDWj+pEu9DgKYLVl8nQZ7O0yKb3OOMYwKdzMAI6bA89aiJ/XU7PdkTIU4d3zIwVBYue+kUHVycnZhzMWbrnD8NcMNTnc+YWDR4HVPOcgvGsUgGRhTJy59Kbu+xYXlFE9IA7vVrhLso9KPaeAfOigfoVykOsT6tpLlQcm4DcXtLN8nVfKRn1F1+u9Zz2G2g== 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)(376002)(366004)(136003)(396003)(346002)(39860400002)(451199015)(1076003)(66946007)(4326008)(66556008)(8676002)(6486002)(2616005)(66476007)(83380400001)(6512007)(6666004)(107886003)(41300700001)(26005)(8936002)(186003)(5660300002)(6506007)(2906002)(38100700002)(316002)(478600001)(86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pBzMWHfFrCKxa2S0D5tDQOUPrbrsftNSGdTkTHfXNd5dEcoXFZfx550KjPCr1D4proTV+4wvKoN26DDAqFxJe3+bdb+u0RsXQGYIMvC+DF4uZJ0wPFU82G/BmiHMgPd/BB1r4w2z3TPE4TVbg4zN01uBqTohcPDc26r/30UxgZfrmmwNW1CwoTmNkSt0JSHW5oayeGbinnmcNFYcg4oifhQOTn2sdDr+4Klk+YbSI07AX3BvILsqB+8QmMKInFV4RLgSvNXXT4SVUOQznzHJnYNTlZKaYwwbnzA0UuhrpdtQRNR2/C5BSGdWQUvbGFHUFDjbmuzOcjUvGM6Fr3FJyzcZtwfLNtcrs+e4PRy5KsJZiM39O8PKjIhcZ+aPNLXjG4keHTvQ81tye0aKgP6Dc+O/x2BC/g5mzteV2TnUwAv0RSxrRQYUPvPjtzUgUrX54gTT5AW/q9V0jlseaYGfGyfMRgwCf/9M83+r99lZC+6RM/BI0ZLe/S0N8iX36d2lhMwHLMvYeawWR5M5Y X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7a8e0ec-38cc-41ee-8a0f-08dafd8ebda7 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 22:11:13.6653 (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: Ba9CeG6gTok5H+pvMVNOwMiLlfmSRYprlcV5NAtJar60hUFNSGmGpSdEg99HVTPO2yPCilXGOQsWH6k7IZkeG6o/1IGBauN1G402zNTS++8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5597 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301230210 X-Proofpoint-ORIG-GUID: KI-g5IjRvSrE7KOw-PKghiTpVlyEMpLS X-Proofpoint-GUID: KI-g5IjRvSrE7KOw-PKghiTpVlyEMpLS 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 --- 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 50f6c967bd4a..90070b33061d 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2177,11 +2177,22 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, unsigned char cmd[12]; int use_10_for_ms; int header_length; - int result, retry_count = retries; + int result; struct scsi_sense_hdr my_sshdr; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = retries, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; 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)); @@ -2242,12 +2253,6 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, goto retry; } } - if (scsi_status_is_check_condition(result) && - sshdr->sense_key == UNIT_ATTENTION && - retry_count) { - retry_count--; - goto retry; - } } return -EIO; } From patchwork Mon Jan 23 22:10:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 646496 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 61540C05027 for ; Mon, 23 Jan 2023 22:12:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233109AbjAWWMh (ORCPT ); Mon, 23 Jan 2023 17:12:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233102AbjAWWMJ (ORCPT ); Mon, 23 Jan 2023 17:12:09 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 350AF39BAD for ; Mon, 23 Jan 2023 14:11:47 -0800 (PST) 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 30NLhto6012751; Mon, 23 Jan 2023 22:11:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=URXHOzeksmNXgv5HYAoDfaGsM7Vyn4YmOq/KPp4BlPU=; b=Byl69ALZWgDQlxrNbu7e8bCQGijw9vV6loDJRsTEQLMDjEMd7JQyS6+Q5/PwKDcPBJGr Bng7ApcfRw7pe3KeVXjp07aY0CQoI3YQh0tqO/cq5oEM3HB7uIP/Hu2EUGSNhq3rYY+C jiFAbLRMseelLntcQb3HRwSsItmOXkkQnIbxMeHCnHBtxuc5C2HtpDa2nPAynj3XhmNB pZpzRYSHr4ATfUF3NZlWRFoEXOvV+vvO1A6lOCa7J7cQpnK0ufjKSG0yMMCxMwrQXdOL PQB4aRjHvMMxlMQP5Bl2kKQt3OIt/y3GCpc0c85IqhgS8K75yydvEnCPWU7U8BdI9sJD 2A== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n87nt41cp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:17 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30NLMEwJ023119; Mon, 23 Jan 2023 22:11:16 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2106.outbound.protection.outlook.com [104.47.70.106]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g45en0-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ly/cx4Y6F/PAX+VST3Qa4sCmTYyaH5YO2tEpDQr6qbrvWddAf61bXqukwv/w70+sxz6/YwetBzEDapFgv8I1B201wPewmi7jmNscezlyWVSoJvzw+N4RN46BlRPsxY3QoESE6c27bcODyyd+XU9tFr/D582mMENFlZ3qz7yfQT7k4FOG7y/T3cIdWFaW1n3ZIDqyZTSrAFnSldu80p4hl5lQgtJKh0ZmvWolJKbKBvRWEdpNKcllQPe6hYZ9V3yaTP8tXe6IJm7ajydlSoHN087MwIO88xUCL2kUEcsqhbQLIB7ZBHCLMXGeHjy4yicqgIRJKEpnmOxENhF1XyLG1A== 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=URXHOzeksmNXgv5HYAoDfaGsM7Vyn4YmOq/KPp4BlPU=; b=CNo2LkLad2Nsdb4COcJguSrl51VMejOlSUWOwsYul9NtsjIrS4vqyD7P8PB1fhFsi4PvchMg8gkY/hQ1682YDXJdmbQTg5HvukO41psDHWvo0y6TWrEEKE6+U4hu1EmnhR4SFhc5Ih1tIsjkwT5TsgMjzIAWRWj1x71gtJPy03bLg/7zV2hywjJjz9XtIi3D9S3fl2dUngDMucs2ijRQ1yxVh+ssA25gFYbbyjv1iESCkzoe/bzt3toasV7PM22izTA3XKkj3QAT+t+WfBFbRKHdyaxKV0sfRTaWsHOuRXUNTcnWZ0oCTe3f4m4ZFyC8/jhEntOH+BYcdP6ZKSkBUA== 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=URXHOzeksmNXgv5HYAoDfaGsM7Vyn4YmOq/KPp4BlPU=; b=GlwfB+1vkbufEvM5SbgA3+DarJaVm6IpAYCH44bxZ2zIfpwbgU0lIW/fdaB6gPwSTc1dIsFkocD2KW7TAtyYqVUYrOZHJGnBdCsYgmA5Hfkl0AcP0uB09nSYm1Z/rpDzR44BR82Rvd2BVhz0DW8d+36d7V47t/RBWDuDaMZ1J/o= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5597.namprd10.prod.outlook.com (2603:10b6:a03:3d4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.16; Mon, 23 Jan 2023 22:11:15 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f%5]) with mapi id 15.20.6043.016; Mon, 23 Jan 2023 22:11: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 v7 16/22] scsi: Have scsi-ml retry scsi_report_lun_scan errors Date: Mon, 23 Jan 2023 16:10:40 -0600 Message-Id: <20230123221046.125483-17-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123221046.125483-1-michael.christie@oracle.com> References: <20230123221046.125483-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR08CA0020.namprd08.prod.outlook.com (2603:10b6:610:5a::30) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|SJ0PR10MB5597:EE_ X-MS-Office365-Filtering-Correlation-Id: 0588e01c-726a-4afb-8ded-08dafd8ebe93 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: grPuR1Dz08RxZWmOV0TdOu3/VTnXvJjqdxYqlEkDr1h0+g+amUisE9ch2Ab0C9ufzgSxpWZPIk11xVsEGMhX+XlQsSVQMtPSnDvBCMmh4vtpnWbP5Y4EVmi0QpTwufArLSm23ZjNPmzg4h3n974d+2pUd3sP6gwt4zCLDIhqAePUokATngkzmi1t+q+Ihg0JE0iIVrmoMbmyaPGDilQwdiYxJ8omOJbqdGZfq3XNSTGnlxJzofTlw3U3iu5caRUq1KhNRecUJq51lonoPa7SX5svNk8YZjC54Ti0Ha7Xc9SoMRodiZ3VuuZ82JmseTpNnqFvjHejlgWw20xaUHzf1jgj8eSxyYj2a34XFsGMQe08rjeZQnZjuo7I6tBAsKfkYMrBwAIdwf95YaccJ66KF0WqZvQh32ozY2DxoYHiFK81wywd7B5Uhxvcl0zQUtchck8A6W5GRvZkQm7J97TCeWIiPhaxOxiHz0oVs9IcmCkMhUsgpMKtSVRxUlBXp7huO9ct0VyQZfKiav9qKzjWQfuKBmX/YJcfBY7K1flxQmAvkmKMtWD7COs1EWBamgWjmeKUspLMXD5tk2tWAVCmHF2YliPy58sBTduYx1EAnB27nlckNo24qrQlrjWQ3cK65TiF0LzMW0V5I3FeMLnVMQ== 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)(376002)(366004)(136003)(396003)(346002)(39860400002)(451199015)(1076003)(66946007)(4326008)(66556008)(8676002)(6486002)(2616005)(66476007)(83380400001)(6512007)(6666004)(107886003)(41300700001)(26005)(8936002)(186003)(5660300002)(6506007)(2906002)(38100700002)(316002)(478600001)(86362001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: s7138n/cR79zi+aYhFvl5pbJJ6yrA70fv97y69ZF91txZIIUfameG4Oaq4sGfpJJSnXgjABIIWzzCJYthVUaVAnt1BoQoUU/IZbztwMbo6BSa1d9abor3VzAijbtlBYsU+Tcs5MjILOJRId/KLNwdhE6Xe+1VK9d8dkDnCDTOIMni9rBp+PGvOMIXu65DZifZBEKGFpxdnR5+46fV3viLhGv6hLMahQx4PAxBEPnkzmbl3zYXvTYFUqAs3f51hfQREvDtdbbNbu9h+xeEB0hX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HY8mLNQSVuQgPnGuvGMAFA8As+j13WFum6GUF7w7Yo9SSBLy0WOz47w5Ugy0XFcqAuE50+gbg9F3u+gWNa+NAA9+2ctv6UMlCS++zLPll/yVnGYHPV6k+LuRmQnLNe4l6mN4O+5FQAvzmG4DobeLH1osc7KmIcLXfVs44HksVh0lbXKqgUWySS/kLJ8valp5+Jx2bam2JsgBlQJrm4f5y5jVu9Hy6XM4od6sAqqzar5RWwH5bMta0z4iI4QPcZMk8WRE7XykQ/Y+nTOk5Cjkme490YaDg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: HkXwTiVw82aSGgi5b7Yx2tz6Dg/xo4XmnFglADUGd1tPwummiz1jg2XX0P/eNsqf40z19Ogk68Eteq3wo8X4nssMB/MMQ6Ou9hWjv0zqqmcvd4DifUjjBfCi6q1bTbL6NdKLu/E+Ds0XwXZWZ3MwleLXxaILsIQKtJUK/MLS9XxnBVHU4wdXvGzaSvBcL8rho782O6PprgI/D6CerNBr9Xw/bydDSeH0+86M83kfMtGVAFVErthn66Q/XW/fT7EcOXIeBkdcchzWvcxIgIPX8JD4rK5cOHrh43WnuwWhobJeQcECmqo1730RhsX7xeNYfidVfODhAhlsMKLnfWHa/73hwOwIofNUVHNcFbn6B/f35FidyBYv2ob077P4VFBxpuE2sHspQqKGxJIiqBazVHB61rHnyU1nMdFLYJznDmB4oGuV05vV4Ssdrl8xFJInwsXJckP8g66XviosoGrg69GVI5ZcqrWmWwfRwq31lD0NpsKyphx+qju3elPbZiVHv4tEZtfCcB/XtJzC0dgdb4N8xdlw1/1Z/cq1HjvwfF9FVcPpJp2Dn4LYbRQycdo0HLlOOihbK4F7BMen8YjGFibgS6oVfigg9yUL7orkywtkoGZmtSaVTkWjb19CIitsYIKPWJXW3O3nsHYXhZp/8Q2+xhKYGEYYHdHT4JWZhUz6nOXz0j+rIVJCF7scyzJBwEdlrB85Zel+dMW5OQJ82DaPiodqv6M8n7YX1EROjhBOjq8XlqYZQaDUzvsnOFCqqb/LFDrCUICOZrC3ALPjYtkv6RzaYDlcGwEI0VXSbqQri4xAO9YeZV5k/u+WlYS8gEziA6vXlqFUrdvapK6JRf6Eu4ZDaoOcYT7yOGcId+o2R2aEpyG24/bYixLNqfDG X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0588e01c-726a-4afb-8ded-08dafd8ebe93 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 22:11:15.2120 (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: wSyGN6vawL2reolU7luUiUXzbD7ukWAHukAYyYXjSL4NauLo6Or4LxKMxZLwBQLpZ/4wg64rDoDPUTMMAuuEu1JOLh0eAjoD7gXMbPziGCI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5597 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301230210 X-Proofpoint-ORIG-GUID: 7NbsNh_I6JG491E2ZyjV_k3IfOwDCHRQ X-Proofpoint-GUID: 7NbsNh_I6JG491E2ZyjV_k3IfOwDCHRQ 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 --- 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 b8a526c4f6bf..05be4e11102f 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -1408,14 +1408,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; @@ -1486,29 +1505,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 Mon Jan 23 22:10:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 645931 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 082A8C25B50 for ; Mon, 23 Jan 2023 22:15:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232770AbjAWWOt (ORCPT ); Mon, 23 Jan 2023 17:14:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233241AbjAWWOX (ORCPT ); Mon, 23 Jan 2023 17:14:23 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 941EE126F0 for ; Mon, 23 Jan 2023 14:13:57 -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 30NLiMrL022667; Mon, 23 Jan 2023 22:11:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=gHmhyM9trD+AmfYLS3p9E/Y6iU9S9GdvQ+UOcQJz+0w=; b=YtSDviHohDdCLNBJNIEHWfgvERBKI2u7sQNe4jx/Zg/qOIZw7/FSbdKt+QIAAYEUza71 x+oxIXb/BXIbin8reXMRxcelUTNwKwWXRg6ttqSstxh9AkxCHerbKCB1/WmFyMh0A22x PWVnX3T6iJoPDnMs7HmFvJewA1KsVFxYov/Bp4bUG65sPmyKjbxAL50t7tziY/pER3K9 fEfjrw6PLpRfrA4DnRglLVTF1IG6bQyizFU9cA9cquj7CfAYayZZxEFt2u299osWgItS uf9lQO6qocEG97UtoNmo0Qef7mDgHHPXhNmpgoo0QvFf8RuTD23DG0bV1OqTlQe4lHZn KQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n87xa4197-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:19 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30NLHUSE023144; Mon, 23 Jan 2023 22:11:19 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g45epg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T0YEAZnU9Th6/HfyLYOB5h64LXXhWfgYHJAAd2joRvphEoUeHY9zdV46peOvdUoP/KrjcFwv10IJbx9szLLE/fYwrrQTLGC0wOSII/M3H2KagtFXFOniSrxDkjxeRSUpZbsXlcAHtKHNH3rIZBcMlEzjQprka2e7/aThVlQJlMI2pi1dUAIPn1n7HP/5oHpku7UGhp0b3ufAkbm3mRJbxKwMPBwFze9PzXekE+iLc721K+uNcQnOVHpBgD8yB+fKEL/yQK/WFsNLUoJLSMZfbt4srzn1xVEIZjCrg3eFEOwLRUgTFMfcJtPhBtAS1ecu0SuWiMS2C8gVHfFei8NaZw== 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=gHmhyM9trD+AmfYLS3p9E/Y6iU9S9GdvQ+UOcQJz+0w=; b=n6XLnrZ8TOWKN/UJlyKjIZM+21E5y1/hglwC0KVkK67CY6h3Cth8Okfjeoj35uFPuP6A1w9I+h2Kyp6Q4NEdpKTcBQ0ubJyJtdD8n5Jr7WkZ6F6puE2ltf0JGUU9ct8bFuMX8TdRpfMc4NR++80TN9IztnxIwI32/NilwP4trUz0xdn13cLLpQusUPnt37dg0+/F5NhiV711bRmiPl6iqt6IBca3zYVbeY9sXJVjKp+lEVdNiLn4B8/3jsy7Nlji24zTN/yDBxwK9Oyw3YLztl4qVqbB+16p0JCUqoCeMv4tKKX74Ny0DyAFQKBKkoMfuLB1NoxEHa16cdptzA9YFA== 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=gHmhyM9trD+AmfYLS3p9E/Y6iU9S9GdvQ+UOcQJz+0w=; b=Nb0XjFhXiW8otfb8nz3PFZXMemOHGKg+jANnBbaS9hIbb+5VSIdsDD/lh3OPa899FC77bNbjOfn9Dyjz6oN2MfJpIIhpeE4/gCBz228rkz7lG9Lrm3glJ9HYTVyrTHxxXulGy50WOY4jvtqLP/0SBg5UmLXcpF+hAEh7+gUOUfk= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5597.namprd10.prod.outlook.com (2603:10b6:a03:3d4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.16; Mon, 23 Jan 2023 22:11:16 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f%5]) with mapi id 15.20.6043.016; Mon, 23 Jan 2023 22:11:16 +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 v7 17/22] scsi: sd: Have sd_pr_command retry UAs Date: Mon, 23 Jan 2023 16:10:41 -0600 Message-Id: <20230123221046.125483-18-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123221046.125483-1-michael.christie@oracle.com> References: <20230123221046.125483-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR08CA0024.namprd08.prod.outlook.com (2603:10b6:610:5a::34) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|SJ0PR10MB5597:EE_ X-MS-Office365-Filtering-Correlation-Id: 848dec88-b476-4dc5-6adb-08dafd8ebf78 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6/Ishs6vtLwHJytuiEDqd8ADGuQ9FHNxJuj3He/zjdzGFWUs9sCdjRDFoMUAhkzC9mYaFkSbjeddCW3pQdckpOE3QYdvOt6K2H550X8GhLF3vF0QgRQsDHIoHE2FwuzattlWHpM4tgKNopogvnb35cXNaSQy0lf80zvJ9MYjCYfGsKNSCDx4au5yRBrNAki+EaW9fpxb48eTxjYx+H8YDCQ6zzJfK71yk4F3HA69CTqTrCNvV8GNzLs/KgtNNxQe1hGAmQRZ9UYfELGhC1aXPNqWPfVgx+qSbdl4bEIC9bjB3R2MZNX96mwnrw0I87sHU1/e4NtTZWrgU36tG0iJffpto9LwgcyMigzD1sqpJ8C8TKS7M4XVTNA7cvT5PKqhbZHxI9FKWuoMt0wwcgwYZBSvXgKORyd3ZVjw42udITkpSrWEkZMofXdxxFqJh7WqEHlzpqooIBx01XJO4w960ALZOoMujIjZ30Ng5Nep8JWu15FDtGZeckdPfE4mY+H5GdhdBag1jpWcaiTBJhgl5dWV1dlk4rS8OjBcXMeXzFrTleT4EvPAV+pOLDSSc/wBfgivvblPOk+K8pZHNHalV6wmP0g2i4p3s7QrypC+qLeT48Gb4tafBgjg/d2Am5TAnkEz8RK9+RC526mDt0GYBg== 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)(376002)(366004)(136003)(396003)(346002)(39860400002)(451199015)(1076003)(66946007)(4326008)(66556008)(8676002)(6486002)(2616005)(66476007)(83380400001)(6512007)(6666004)(107886003)(41300700001)(26005)(8936002)(186003)(5660300002)(6506007)(2906002)(38100700002)(316002)(478600001)(86362001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +p2Z8r/463EztPIs5siAt/5aVeSUHEOsPRtlB4Hw1R8XBTulBcsj1Rsnj4NYtPir01WvnkaDdzusQh/itLu6qVf1CVAkPqyjJ9yLnvywLMbNX+QNOxZV9xUdB/96kUNAloa0zpRYp7bekENVeI3Yw+3j1c2yOGIgt+NcLrptSj1ahHidW7MQjR7GdGR07XYzcYmFYgjEq92wgEaJkbCogBoS17zj9ZKj8YxqI9Xx3F+Zua26bXPOGaqFZsz3CRZw4OooGOJqdfIfcoYixCvGWVca0HOS7WhubpT9zQ195xvxJpOZpJ5rXlHNE/27W/OF14hGTO+Wxwzmkz/efIeDR45afKB1iNrw4X07e2oTfOrjRr34kgkuPWwHVppFfZ3JdYaCH/DQuNWKKRBOvjEWGFXeLHaLSna3YtavAKlnjJg/kxLrGSqY/6041MCW12VediyjZKh3ndtZzBPIQSG8aijKfWhMVGOMrEux0AG/5F2biv6TEyfc+jax4wvtRZm1mSkUweQqx7nvea0Tw5EpX6oGZwro5+Bfty1zRF0PKHkzAhhh4y8yP4xR595Z82GH6YaQvw9ZYNj7Gvmk2E1pXI6/XYQL82dYoaVEpIQB02RjF35WnJz3LDSfQZXtDomxCS7FybYfe0aGmjSi58XoJa+3xll44wy8+uz2x1TnhXjU4Uyv1YFle/ALcTAO8MXcEYgb1T+qCefx6+vHJjnYof1b0rrJDqCb1iOWBDFA6KDjvD93Z3Amge0Hc6VfpCDB0tN/NOqEvcxw+NTa+wZkJJ3GyulWWHDRg/75tveU/fNi5blVCkGqIm/f29f1RBYYW4YVOj7AKbCyl8zQtw09VArCNFnokrPwP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HNlSGy0mVLuJcukwsrG9GEjCg1qOlQLglsA8csnjQOs56sZUaApJCSlPyX6uxjk05InokstjMrE0sSPb70aUZjLDO5BQcayACox7Z+Fsn+a0AeIp+sUVYem9teCJE1ejJeBi/H6oNqSbeQwS74NxVNjvzseCuy4QK2NI9p+/IcNinGHf7IwiQG4kUt/An8gNFLJ4IQWBt0yt2xonsbnmjoNcuc+Sihf/7mQu6DTgG6220yY8CZKSlFHaZN3DaCa2YOnKl+T6aWmy/hH3a8dcvdZFpDRgJtUljStDKaNOkwpCm5g6J/hEc9djXuhTVOmn6hqJxRo9OvlO7qrssH82Ef5MM9FmCswFTY8ENYyyREr+mizlt6CF4+dgeFwN0cYqag3ohMVqiuZmxfikxCDfSYPZbgiJD+bPBvuPXmiMmOg7Oy4wcjhcvnUAQVwivGYE/eAEy1kZA9oJIkq9gGKPI/Zy+tqmG+cuhlFs7gyDCGkAiJ7Pu7xbsi+OyLmmSP6P/VefqC2px3UTvHUCsyRIpVemHK9rFF5/lR/UCT2WyNeVyFUiKooiJ4CmWOKs4IWnD29COxUfzEWtB+mm322qry3pkAW1LKL6GGfRp+mjgPOV5El8pdPf/4TSEKsek1b3tQhxS79LfCauj13S4B1J X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 848dec88-b476-4dc5-6adb-08dafd8ebf78 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 22:11:16.7744 (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: g5eUD2QRJCfth5o8cGgvcgVo1pVqZHURy3MKWAkaN7r9GfG8kpzRy/eh1NguJ+M+GexMls4d5jxmR4KMm+GSYfkbV/Mr+PTQ+Zisb3YyFAk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5597 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301230210 X-Proofpoint-GUID: ss-wF8ao-7sik4Rix5mLQ-_6bAILew_0 X-Proofpoint-ORIG-GUID: ss-wF8ao-7sik4Rix5mLQ-_6bAILew_0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org It's common to get a UA when doing PR commands. It could be due to a target restarting, transport level relogin or other PR commands like a release causing it. The upper layers don't get the sense and in some cases have no idea if it's a SCSI device, so this has the sd layer retry. Signed-off-by: Mike Christie --- drivers/scsi/sd.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 63d2c6ebf948..ba1970283966 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1747,8 +1747,19 @@ static int sd_pr_command(struct block_device *bdev, u8 sa, 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 Mon Jan 23 22:10:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 646494 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 08FFAC25B50 for ; Mon, 23 Jan 2023 22:14:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233235AbjAWWOW (ORCPT ); Mon, 23 Jan 2023 17:14:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233152AbjAWWN6 (ORCPT ); Mon, 23 Jan 2023 17:13:58 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFEB138B63 for ; Mon, 23 Jan 2023 14:13:31 -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 30NLiMNL020042; Mon, 23 Jan 2023 22:11:21 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=QR1NNSR7VWGSWxL8QqC2iLGpQ5QjflEeZHp24yggcTI=; b=Pq3TG4AYxh5byoTzjXJtawSBeGMre9YstUJO5FB7PQzIZdf3zJlzN822YL//euWuNFOh jOjPdVP6CxnPbwSOd9MnXUIuQ6LnNh+9GkH5MRpxFaAvKgTDuwd/wc+p0BbEGsPUfE9j +VnJOqfREX3rfYaAavb0885j0ZlUSvhii5IcPpsWnIIjuaoA0D7mmbLu540jTljfYz6u CjwWACl8AO0jtXeb5SsKHIEsUeI+0i4nhlTWxkQ/rbKyTw6Q8EgUJyo4f+uhWaVOMNPz Onm6xlx71JcAxSM+QlbN1rsSFgtJUWxnmNSh5X468Dgy+HLWE2LuEDRnVZ7HrbG4/CA8 2w== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n86n0v3qj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:21 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30NKuAZe039685; Mon, 23 Jan 2023 22:11:20 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2105.outbound.protection.outlook.com [104.47.70.105]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n86gaxk2u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WxONMxE0kY3tKl03Vx++xOyne6EXFIgcPqDoIsIbgQce+WL7pC3R5N7XbC+J61T/hnpOC/L0E61XzPp/sTpIWRMRlkQyXfADWpHz2w44PxoYZ8uhn6Pa8DAh+EPwEsevX8KoodGBuq9fy204dTclbAMieQKSRgvA6FfjrQzpH56mKwzQxIxlgqQ6+hquhd6LMha8tyCaV/rtdvN5KhpoCCeXeF6LFitoYvzEY8WrQDpEnFhg8J2yw1/7KY9RWxwwMvq8DIdFSIHkw7H5Pi98VF9JuFe6JHs4sgOSWQvEPwL7Yvv8ZtpSTo6YiboPmDJA0481ERU7YApOrTWAfbymZQ== 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=QR1NNSR7VWGSWxL8QqC2iLGpQ5QjflEeZHp24yggcTI=; b=FKK6K8NGvLezclh70BHxjCFz23D5+GcoqDh8ZsV1QdO13y3RwDh3H6kfY9bq7KDRgcDlTmzZbiYp2rzNjjLMgxO08c34GvfuUNqo34ZzmdsmWqg3p8uktSmw8moy8IivOoDlY0UZS3mHsiAsdVTFocTZ9cOpILgYDf9dubfTCXl5MT+1uJ7kTZ7So0Od1YqdRhIDvoIkzkPPw21QwndGizxEdlrH2SFgBUA9m5AfepGtGzvd9mvztbGpRJkdzCFsG5ucpCuGQWi+25y7wOiTjV3/QMSYMipE+jlyq+pq5lJWhNnGbhckbOttFprBIYH4IMunwDTPCMgj/82HzGYuiw== 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=QR1NNSR7VWGSWxL8QqC2iLGpQ5QjflEeZHp24yggcTI=; b=hfv3zUcZqjSDKGU7d2zedz3wbWNatyzksBdB7u+qiMdIdG/EtQhbsSfslQF9NOHOIlJv5R742FX6GvvjQ7yQARqGgIKyo+bOKazCX6xmFkAQDEBiH9XN2ml5R9kFH2tPrdeXKhdR+tnYtrM68z0OOsiqb/JmyxdNeuAcpXAXI10= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5597.namprd10.prod.outlook.com (2603:10b6:a03:3d4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.16; Mon, 23 Jan 2023 22:11:18 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f%5]) with mapi id 15.20.6043.016; Mon, 23 Jan 2023 22:11: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 v7 18/22] scsi: sd: Have scsi-ml retry read_capacity_10 errors Date: Mon, 23 Jan 2023 16:10:42 -0600 Message-Id: <20230123221046.125483-19-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123221046.125483-1-michael.christie@oracle.com> References: <20230123221046.125483-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR21CA0006.namprd21.prod.outlook.com (2603:10b6:5:174::16) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|SJ0PR10MB5597:EE_ X-MS-Office365-Filtering-Correlation-Id: 99b27daa-eaea-4247-6eaf-08dafd8ec064 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Nsiqb65PiCsSSKxXW3YlIOrC/rwUDuCZ2CP8OXE4hoGclNaOFrmVWZRx33vhr9vVdvLSotvbsOktXLGEu3b3I+YxUkRc5kewe4DrVoRUKn79SAd9rxV8n1TOOpP9ifArwVp7jiZ69qAu9LNq1+iQJU6HcW2R/k18iIon1wWEOe3iTzyjjpJJwRS6yMBSN+JACxr6XpfC/pbhAju2UaiLj1MrymykiiB34gj8+5Z1+3JIiAJvVka33ieeHxS6Lr9b8Ec9y3ntmgZXDtF7XoGHYUaRxX7fUzmVkVML5E6Q3xd3EfGHv/THq14kqTo1W9nPhOm6TCby4hdPF2qg1HPzudqoN95CmsPI1q7pmiQWZu+Z+D8gjVtA4prHxhiCCHgtDIINleubH3MsssyUKBzpa8CTMjCq84i3J4F+qh3fhSNqhdj9wzhB4r8aOeR9UPrsBZXxEd+Om4qHMq1Tx+hInJ+PzTaUnJ7q1FhjaJfBpI4oVoQpjI2bCOm0hxyzY7BO3F9d7BZbQpD4MSwSEKhWpa7kiq2YFK6Anqwl1WgIzoqa85qfuiAiiCjp8kks+h4nlzWg/gAxlZ7sjnScWPOYaprksQVLXrOHkpwUTka+XIuP1vhk0OEW4kNuy7V4HKHNeQ+zwifhTWc/OyFSXGgUaA== 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)(376002)(366004)(136003)(396003)(346002)(39860400002)(451199015)(1076003)(66946007)(4326008)(66556008)(8676002)(6486002)(2616005)(66476007)(83380400001)(6512007)(6666004)(107886003)(41300700001)(26005)(8936002)(186003)(5660300002)(6506007)(2906002)(38100700002)(316002)(478600001)(86362001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AnD3DzA0m1nDBR3rT76OIRhVZf9PU73nFjAAEmDaZhAng2czVVa4HiT4+0bH3fYKWA45/Em7+GZIXcHSlb6cTamx8dxA+r8kkSJVTH2Rbm7SgnTzZCUf7/tOO6UbbVJ2zlTH3L5saz4qi9Knww8kmHkyjaDgeXtXZN7EunVrpZpNiMb/DGMKZZInmYOXWtFTbaUXlUT5d/MGq7hba2c6QBkc+4WWDT+ltjTLafc/VXQyrJSbnqFN67Ns7YvZVo9kQp/n4vVH3Ack7WZIpX/m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tsrShsdf+h/9MIqxEt8Io5BHnhvV3neHbUExmItCrfi1U977on1dFY4U+wkfrXRST7R25FV/TwZplI8dvp6XH2qM1GV+itjI6IDE1nyCRy0dXrJIM02NLRy0u4qs2j4tTZjLL6IfQZiOFcxx9XjRu59i5Gfv81mULv X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 99b27daa-eaea-4247-6eaf-08dafd8ec064 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 22:11:18.2587 (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: vQV2II3oQVSfzA+1ouAVqKcYXALlbaEXIKKushpcZaozjKluHuUXMv0exw3e8QSlJcNkG7OTDvwuZZAJawddZbobDzBAHGr+iPbWUZYfSe4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5597 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301230210 X-Proofpoint-GUID: rEJ6OxIWbk2EhJBjk0KYgF7Gi1Z4xMlM X-Proofpoint-ORIG-GUID: rEJ6OxIWbk2EhJBjk0KYgF7Gi1Z4xMlM 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 --- drivers/scsi/sd.c | 64 +++++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 25 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index ba1970283966..8fe97a9f8a4f 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2447,42 +2447,56 @@ 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); - - the_result = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, buffer, - 8, SD_TIMEOUT, sdkp->max_retries, - &exec_args); + memset(buffer, 0, 8); - 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--; + the_result = scsi_execute_cmd(sdp, cmd, REQ_OP_DRV_IN, buffer, + 8, SD_TIMEOUT, sdkp->max_retries, + &exec_args); - } while (the_result && retries); + if (media_not_present(sdkp, &sshdr)) + return -ENODEV; if (the_result) { sd_print_result(sdkp, "Read Capacity(10) failed", the_result); From patchwork Mon Jan 23 22:10:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 645934 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 F11EBC05027 for ; Mon, 23 Jan 2023 22:12:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233168AbjAWWMp (ORCPT ); Mon, 23 Jan 2023 17:12:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233119AbjAWWMV (ORCPT ); Mon, 23 Jan 2023 17:12:21 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADD6739BB7 for ; Mon, 23 Jan 2023 14:11:50 -0800 (PST) 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 30NLhxlY012806; Mon, 23 Jan 2023 22:11:23 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=L7gOYP/YfkrJ688kJDqXulwemOeiUNA6XwvdqpESgIw=; b=AXwM1LkaZ98k7jdAkdm9YCWEBNKIV88z1gLQ4vpS8bioSq/tmEm55xPCLDMva9dEuDtZ mL7B3EmmhZBG8T/MQajsDr3kQXst1JL+dnvOYmBsrMQ99UV6cthnRvkRGya+BODOembw ioz/6XNZJRZb0Nb75iKAIKf4zKdQ+bpcSLy7lLeFmOLggbpXkfoUNoGhg6JnwIDO75Rn bR6bf2b/vNSss5GBIYHrONog5rt7w9kov4wvqg5V+NV+j7Aee2VQ1qPK9e+sSlX4y0rJ 4J6gJEYnC7+MkzeubxdKkR6y1hxAzXyVd13Tlq+xWAW9V/2qNeZguvAc2W5+aAQ5B46d dA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n87nt41d6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:22 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30NLL02J023237; Mon, 23 Jan 2023 22:11:22 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2104.outbound.protection.outlook.com [104.47.70.104]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g45er6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dghJJ9pDIQx5cedO+g7HG9h1KyaYzjX5rKGZcKG1kXIoNZ86LnUmLKyg0DYaYSGAielVhLP5f247z0Tc48H0DVlRiZNioK+j8rl9uG7nFIJ8BMqn5zHy64GLk4dGep0lYHMUsjmV0IlDjXbFKYC/kqKQW+dZttW+Gyq/nvwi6qsy+c73Rbuk5jvOdXxS+og/x1PVyec5we80OjEJlWAprPIsqV4OI8WexhOUTqP2WKP/4lTKq1NEugZL1zyXUI3R1NrZC8WwzEziUYUkUOAekoEKNXATIZOlEjnTYBdIlzyc/Us4AN+rxUtZbllaujS6BNKcoWhzOBakvLVmRif+RQ== 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=L7gOYP/YfkrJ688kJDqXulwemOeiUNA6XwvdqpESgIw=; b=b8XKe5N3icPPbo4qUyx7DtztZjeDg70/w8eMG0CBxsgVZfQwHbUj3XNS085zBHNvTjRgDyHkOmqjPG1EFE2M1I5G8rE1aM8hX+a0ioEPFAtb22lXrpNJhrM4U6IHYKRP6xdA1IKxcDu6lU+DVtbBKq4DaHnwIE6RAianvI8rJhQSqBK5wm2BUI1k65EzkS06y0xjQDpdOPCr+VnEH7SZhEGN10MO/oLdOMQq+7gOYV4lRyfdl10uVyIRJ1DbJF5Ojqsdqp4FrkbP99VlufJwsfSQ29QQRkeVm9l82xrgNGzNBO28cKVya5SKqdDIGA5bnJR0Se+aYoxvieTEJFFWnQ== 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=L7gOYP/YfkrJ688kJDqXulwemOeiUNA6XwvdqpESgIw=; b=orEFhen94PMMGCfT2hCFXvPzqMLfX6y4VJrD2iAkiq6AyQGoJzIER5Fg4MvWIW8H5ruOcjmgIf/tN98xHFAzJ4eFABapFonabDrMykT9P8bktMzfTrqo3o43N5ft1NGDoUv/YRsOmLXn0j+E09gBk0RpjLmS0vx/w7H8KQH5k1A= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5597.namprd10.prod.outlook.com (2603:10b6:a03:3d4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.16; Mon, 23 Jan 2023 22:11:19 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f%5]) with mapi id 15.20.6043.016; Mon, 23 Jan 2023 22:11:19 +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 v7 19/22] scsi: ses: Have scsi-ml retry scsi_exec_req errors Date: Mon, 23 Jan 2023 16:10:43 -0600 Message-Id: <20230123221046.125483-20-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123221046.125483-1-michael.christie@oracle.com> References: <20230123221046.125483-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR03CA0074.namprd03.prod.outlook.com (2603:10b6:5:333::7) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|SJ0PR10MB5597:EE_ X-MS-Office365-Filtering-Correlation-Id: 2546f28d-971a-41a7-124c-08dafd8ec12f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k+ZUVaKlITREZRs0sWPEt8TgUU6Y3Ed0tWCaP+MVEqavR0kI93tosDR1fqd+GmHkOLB6C4wYLgod+i+4vSNAwHBagQiAjTowoMOEVnG9o8KKmvPSfVUHWXiLG3wgfNRkWiMiykIm2mexi5xp+ySN8hIOqtAM1b8z/1eWiP3ZuRxga5lcoOGPhdwJjD87FKSsa+XZ8c3kqyQOfJsbreBIfGBJrS62IplZx+ClL8U5/rcT4oFU4RcAaMpC5sEZskJ00S0XAnzZbXNLybNhuTzk8Uj+JBqE7CwfexUCLYEYiCa1rnf8al2Dzj7dptRMJCHRTdDcsAa85J74kMRZhDWnbcftZuWTDqgpKAszwZr897Fxo0OXuledyW5GsjrsMDq5ilUqcj8Pn0EN7SCkitnpQ0edkHJDplMwfwfcwjp3WqrSS18Nye7x//psaOP8ZtFHf7InLVifQGYdw9WE+0OOkzkrhAJ6x6IlnE1xoZAYs1XQ0G2rG+kc+bAMLgxQuEFs6EEwHFeFRTdVHA4pucy70sTFM+QKxvx5p4UTUIYpCffAQ12dtshIDBHBioztdhz77QNkpEXH3holeGwAv5q1RxYR7vIeK2CGfdfFz6JGNrgBkc4Pfuo9duxjcXZ62DQGNM+EkiR/nzpfNRPNAttXOg== 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)(376002)(366004)(136003)(396003)(346002)(39860400002)(451199015)(1076003)(66946007)(4326008)(66556008)(8676002)(6486002)(2616005)(66476007)(83380400001)(6512007)(6666004)(107886003)(41300700001)(26005)(8936002)(186003)(5660300002)(6506007)(2906002)(38100700002)(316002)(478600001)(86362001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ilRXjv1U9Osml1yWpZp7JNdcZHzmf9w0IpxSdp92vqyWbhbKLO8/pjxfWaPhMN0JOyIyWAbKweV9m/aWBKjrOd5LnU55Smtbxb+0dL6H/ICbYQePRcIr40qmsTz1Razz+VgNt61t3akEID/0mAhtrcHZNIDeW5Vt9quUI8wMqEKpLEZ1ZZSVvoWhXr9LtgbPWbZ33kKrzGXEgly78SSDcf+8CehlZI4s72l5ACwX85wAZ19bvHuaeZ2Jrhn7wb8wg9M0F/kNdAVg0MrGvIxIP53Iux5V6WAHQxxT7sxHOyrfQ3xa0OQSF8YSeoAHgfnqjYRy6UabPCOYC3JUQmjcgFsBf8hN/m8alhNJ4mb1QtqYg0IF8uCHuTQKbqsp8zZCA0b4isinuhqEroLWWtb+tIkIcu+ak2ZqA1lKWuWxdeWrRQoLKRIxC/0A1aQfOsuBAbaR8pbmbVSs1nPb+w0tfqmdprP9IF548LKXekJPgM5DoA0gN414PEmx0SkmjI9nPwTQcBIfBEOEZnaK2BCkefQ3H9c5rLN+5Kh1wtGshOTBxEKeS1cs8wsKWdNUpv4+ej4CAyYBX20G5493mOmo0AD2w0qBlRY30vNm5RihTvzT9v5CEhbNhUa46j4EHwAbX2FJLiSYDppYWYfllcgvMbBrPNzfsIaRd54rWfOVWmVccE4HcejBWpGAtNYDZgRIujze0GtKxDQhIL4iqB7Sybz4fK7Ur91Rjqpf8HB0u902jmbMclswiGKMxYqyjuHVg2T7z97jezYF9tZp8UF1VrC+jlIWZFdv8bRrfomMcju4hdfntpGeDIdBytXF/vU9zNiP1CXb/IB7eWhhZih/xmTlum1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HdPLMXKPJxbiav0lZ3STJJ8f/CTj2z4OoDoQj4KC6Of4ynEgsiQbpvFdN+UPFEtc4zG5UnRlvC/8Spz9v4PU+IWm3YkMP62IXuu+W4enGTmE4/uwCQ+cdM44IHlIGMLLBnSnB1NbHv42xzqtFbL9N5libmstRaCSCYwYwsGnfciki97c9JY2ihxg0C78gxZYjr1akBG4vByzcp48HFFqlXW/m+TL8gxSncm/gzLnxwNkRkV1GqjnLZjYBy9eoJYocJyRWNbgfuQH/bwU5pWc5kAX37bmklFuPRjXi2yIieiv49522rJoWyh1pWwmnnQxTZ4nJNOcGYvFL11/zx6cjOWz0JGIqBI1CkSlq6kWNsptXykod8Xt7BSn3hjHrBhaINfFUdBK24uGqZVkk5ccJxT5wyK9CgIkyQobVFabJ106GheU+JEiIZuBXs50Vjsqf7kMubdZdP+fsEkT2IiOynhkCXbc6qTYMr/eCoh/LoH8IUfgyn17YZB425vFWZcy5oe+gYuWOc+RsNtH4h2pP5U+2RuQjpTerNunn15vF9YOAOr3NA16wquJFG1fdlNBoqI30ca682iBWCKf33LxRzbs9xb9sL15uux2QjDuXDzMuhn8DXnOhI7HVUI0UU54NmYl6LAV9QqxS1N2gCDpsoDFNNA X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2546f28d-971a-41a7-124c-08dafd8ec12f X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 22:11:19.5711 (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: qpl0ezmIkyDAO6hBE7l2ZC1krff+I47CyYPFkT932Wemd77WRkz5SqVOmnK4U5qQLhc9mMXCr/dqtWgkia5osMqX9QoFN+cfxpW5u75g8L8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5597 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301230210 X-Proofpoint-ORIG-GUID: dwxaM69RVJp2Ii0HeVhYfSqmSX_zn4Yu X-Proofpoint-GUID: dwxaM69RVJp2Ii0HeVhYfSqmSX_zn4Yu 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 --- 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 869ca9c7f23f..c9090ce66781 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 Mon Jan 23 22:10:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 646492 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 99798C05027 for ; Mon, 23 Jan 2023 22:15:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232183AbjAWWPM (ORCPT ); Mon, 23 Jan 2023 17:15:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233117AbjAWWO3 (ORCPT ); Mon, 23 Jan 2023 17:14:29 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A1EC3A5B2 for ; Mon, 23 Jan 2023 14:14:00 -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 30NLi4mM022499; Mon, 23 Jan 2023 22:11:23 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=zJYhQcNYm0T52T4KhPWZshh1qlutl10ILcxUYoTKdX8=; b=akx0VBvE0EAkefWrWbq5rbGI63FWQsIFrXbLHmEUp29MeNfesYdctO6ClwkpcAtrVs1w zDbMWiv/H3/fwe6D/5t9NKpJntpwlrYOcUPzYWPRWXSkWarewirEQWjm3e63ENi72Nrb sd68IAnLr3dyujEoRUvHhiqRTDKDoNJbQdKgxlq3e1o7K1a613CoS1v3i0cOxHAjkbUu qKig2I4sKyAhkhK1Mm7IPKu15b0ts/DDP2MAPcfwAeAyGcp7s73RWAGp8ZnNgaBW1ry/ pyMZv/aAP8R/zjk776DSAMTy/jDE4M/7a84AWO0E0RgX5x/czb6KtdsOTOZr6zTnboMW iQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n87xa419t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:23 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30NLL02K023237; Mon, 23 Jan 2023 22:11:22 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2104.outbound.protection.outlook.com [104.47.70.104]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g45er6-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KYRoYkoFjnyqNB4NqKSJMGF5OrD3md+uPFj4dld/eBZ5bM8nxa2FS8ver0gVM9kzJ4GNRgAh42JlYBzcGJ9AFAlp/jR+mvOo1ltmkM1SvhpFL9uRVXI11Kp8CzJRTSpqmcg/mWSKW/OyEHxvjrhXjcP7qytrq+7F1qeMjb8SWEqGiXVzRo/1BNRlVh9jBJ86EQkBNGtRB54G0nRjtu8bP9VXJk3ZQAg1XGOPUGa37hNBBG23c6uahCvM3pD4K18HqR8MOSnlK6NKqAH7nLi2mssy3Gu81lApM0lVztDtcQFpb1oCMj1ijx+oTE0N1qCWIcB2tyrGcEtfvpyBbtRqig== 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=zJYhQcNYm0T52T4KhPWZshh1qlutl10ILcxUYoTKdX8=; b=FMx9d6ZTQPSo8I0FrD20BtJWO8WKvBNaZ90+OMAghCgX93jHWnbw4FwRb95t1KtTy5VL4egj7iDZ/L9PPoFye8u6QiOK1JqAnrPOnf0fbGTVSijBeChuFWCBbswJyxo+ygklYQzlA8R8Ggk722ayoUyZt4x6+e7YSJmO1amz2jsfJRe+L0WlJvLsVmTbMPM/9q49/K5GTUpNGMaQbyP4LzUk7V6NHcerXnmHYvhiBrt6dG6JEasONcpC2uG75KAcZ3xiqX2Qbcq04Y3nCuC3p+WrI8LPm96i0rT9T/Xp7BpQd45VTomuDWMqUPCc7TPsbB2rK+FBXjlhp6blTPXKEQ== 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=zJYhQcNYm0T52T4KhPWZshh1qlutl10ILcxUYoTKdX8=; b=qnuukE8L/Jc3GOYqU5OTqvU47DIYYfB2pKBpYT7dnMyK4XPacOE5ZNQPvqeFO+/jxshMdlEggCJPk9rjt+LOYEUYe8hAq9tUme2+hLA6XLXwUnHqqcvsQf0sd/eKTw1YzB0zivML6cZVtyOxNbZkB1ExoH+BTMFVoEb3uAgNndI= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5597.namprd10.prod.outlook.com (2603:10b6:a03:3d4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.16; Mon, 23 Jan 2023 22:11:20 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f%5]) with mapi id 15.20.6043.016; Mon, 23 Jan 2023 22:11:20 +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 v7 20/22] scsi: sr: Have scsi-ml retry get_sectorsize errors Date: Mon, 23 Jan 2023 16:10:44 -0600 Message-Id: <20230123221046.125483-21-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123221046.125483-1-michael.christie@oracle.com> References: <20230123221046.125483-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR03CA0084.namprd03.prod.outlook.com (2603:10b6:5:333::17) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|SJ0PR10MB5597:EE_ X-MS-Office365-Filtering-Correlation-Id: 11803a70-73c8-4c93-7ca3-08dafd8ec1df X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rzShsp1AMlQeRky0MpLvYimF4PESB6lbV7sZ/BObCgQv+syQn6tcVgtVbtOTxF7qx6svqudv+8MPZOceQXLFFEDu519SIC5f/pLSknR9y1bzmkyy0pF5zHVNmDMraiP1vaSdtAIDrp8GDLf6oRtzPupBSmgv4GlE6afZLrkDbUG/tPyqr579KJlQoXmx7jFTwrmQY9VdjxmsFc/q5HyPU5/VEqUdILrcUzREYtbeDD78ZXzhF8x1hGZ+UlEx0lQkLjwgp8FXXBd8aCZHqOkZsSaCUxc0bwnMADJS2xmRUOw7u4J45k9Y26dScJz9Zp8kFdYq62cl6DHL0XGyeVKo/tC/UnBG41G7BIp4HaIWgR7EchrVo9khLOOzucUh/Lm+yMZmzmHefKFH3UhJY7eaKGP7YIznveUVQtSXROgvMbFyXM73tAdNE6R05JshEiI77+vH/zuTFhQOUrTOSNbVlO2ZiYqX+5aU29t27wHqXTBgmetSKAy/OrRMmY9mqgXB4U1wmFbX950bxR6fkdNr9s5qKu7zPq5O2B1j4RDCDH4Sj6LxkmP4+ovh0EKDWn1OTI+Q9qVcqHrNwVKyB59/fcWl/ph4upiKBuADbuPfhFgeGJAydY8Bq55bsSkOuUI1FMsH7mEGiyXLyjkG6xkkXg== 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)(376002)(366004)(136003)(396003)(346002)(39860400002)(451199015)(1076003)(66946007)(4326008)(66556008)(8676002)(6486002)(2616005)(66476007)(83380400001)(6512007)(6666004)(107886003)(41300700001)(26005)(8936002)(186003)(5660300002)(6506007)(2906002)(38100700002)(316002)(478600001)(86362001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rN6u3lhxCe0uZcKOl6zFPaoGUhSSUZeKplEEiLty6qClYG5bROiYnUxckovPD6lLLIGj1wzXc4A83wusEj9/o829p6nYBN5aknJnnBvGtzoSNSPisloujHi4A/8GY6YHZP62sbbqA4UBO6qQgfTi1iDcH8uiz3XOlFNieAdv9zHWpLej7flPGGeK3HBPewySejK/vJZVimD5u58N5CiBO/QYNQP31KmR4vHsfZYPmHLXtp7N1D8qCCP9lzgeK94DFFnu1Zxkp/gH2JbeHM2J+U98hscdIey23eearSM5I786jg65qgUL2AwGi2lsSp26ZLB16r35i61kwuQ3BJNhqZI3SO4Kvbj87RQTJKGnmY1M3GkVn8FjRML6euAvuV/h5tGVDV0YnyiWkw3rzVpYsVHpch8BYV8WI0Nxpu+XSUbpohCgZuTK/vp/5LO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+tnlF3FUlOX8wPb2YBCmWdTA0A3OaZ/6TPkQUX1Y1s9zYQidvXHfMUhgTrIntVVyUYeyhjocWlWVsGsvSFgRFOYXw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: NNeKyqzhxtkwX6g9O02MyA8EXLTlDdmM09W/t8OmtKulCjZTur8G8togznDi2n5QoVzT2NPAoBCOqFpC5s2hZ/C07OP+1+XWQqBcyNlTG5Yg2Mnng9FJUc9mISrDLJUDt+geuuEyCxUjddPm+TZt3OlQqSiRq8Aa/6/eV3R3j8dW2xXKGVgqc6as2LEAdBIsfaUaLqbn4shZHihnXhaIjqtnisJBMxYnfXWT6t3z5BO2TuQLbfl3bXiidCyUQDL4U9TTunaIvSYymvxbyxPcRRLIqcYJfdwpCR/cJIW2hPPILKkRWRrLVow2fm0hsF+3A4fU36MIayWqWvMwwVl3UtNdXnLOmBtCpfPX8ERas/eD7GKG/gvei/tqtdesryKzDnPdSFXRJ41+4GyW+vPdwaZydfUNdUBn+XQgb+Y5IVf97RohsOK5wa5NSWBUjaGKklul4Ourpd2SMd37ocJKblEF0s2YuKueLIt/xHOwv7YI1sJKJcq77cQ1f4gBDVUlTQzn/NQZZN9Aly9r6OBAfP1pavytzr/XX68RcAnxV3/Cvj82Gr9+eUgun36YY7creO/yhzJxLclCcqRFl1v6dKBw8pan/znVgcaCwJgkxCc2rbFfMYt+8DjZVAHEAB4WDgESK+G6JyJgdIGNrkcp2Qr9G8GrBUoEvv18sHzXJEt49+h7+n8RaNNuxwWqs5+e9+m0EOA1wXTZoomXW1ozCePTY7luYkVR+qk2fd0BlpaEceaLRTiS5Rs2KTowJ2OHtJK/YVZh9YqOBO7xZ5dvZRi4TDueJZcUKuZBKIeXPZKyHQgSfI3xAswjyUUchE6ee72jOAhhFPEuhDNGWLYMtvKQbP3VDVhEOO0/pQK34p2lCqK2TKYmYQrUtg4qPQJM X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11803a70-73c8-4c93-7ca3-08dafd8ec1df X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 22:11:20.7585 (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: I2MB0wHXjBe23AKWdgmEfFYF5ksbQJyYaJk8HQ3lhvk+CfCF2Ap+pi/u2po9XkqxzYY9bvFlnUEcac8h7paakEAEOdx6R4792mpO9jTZyH4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5597 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301230210 X-Proofpoint-GUID: Vi9mKMH0tqLEvley-uAXTUD6JiC9AaXk X-Proofpoint-ORIG-GUID: Vi9mKMH0tqLEvley-uAXTUD6JiC9AaXk 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 --- 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 9e51dcd30bfd..81802a080189 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -721,27 +721,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 Mon Jan 23 22:10:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 645930 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 72823C54EAA for ; Mon, 23 Jan 2023 22:15:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233045AbjAWWPO (ORCPT ); Mon, 23 Jan 2023 17:15:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233129AbjAWWOd (ORCPT ); Mon, 23 Jan 2023 17:14:33 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 708F930195 for ; Mon, 23 Jan 2023 14:14:01 -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 30NLi4mN022499; Mon, 23 Jan 2023 22:11: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=SG8UdETG8/T5tOOtF6sh4E4k6+6wcX55YJ6vLZ/YqnY=; b=m26kk7cmnddF8wbYpT7kxgrz/Tr+2f6kKYXX+Wl5c8Smoe8GMH8/3M0kjDHfIdmHIVQQ MSR5aP/lk0gsyHzte74ucnyj5O5ksi9JFDmYXy3juwUooZ+/66jIvjloDGjazFeduAwx EiGShBtindTlPRr8mTSzTOMyu8QcGUlRNeiduSd/4lfoTklLMEAa9XFFgEPWpCtRC/kw MOngt/ZSrGzFvWxfXRa3xrTUBnQhfSK9oAxTA36jnQPVTQLtqfwqb5WiZAk0+NpbvUAR ve/M6+bKYBcAO7xVvDWfZ7GviWCjoxsT/oo+rda58NLcbcfQ10dECIluxiLoTVY8dNz5 nQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n87xa419y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:25 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30NLXtNp011704; Mon, 23 Jan 2023 22:11:24 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2103.outbound.protection.outlook.com [104.47.70.103]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g3ndqs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RE8xa6ye3/7573IJgRlXu3j4m6D7VHr6tNllVs1r2lEQoaBiQOTtZrJJpj9w17rvBJVona1BfjJbxrIj8YLprtVXcWUEd1SKjzUdnJNSpO5JWbG4Ij2kXROiiqqHJyNefMpzhW0AYbDDbWn+oHWtHMQ6xD/0G/lISPYPpxQi7FU5/Pcro1kmMyT0lbFdkrnlyOyRxG8RsDnosRjX9wExyOcdCXUh98PLlcBqHSrYcFGTf//0kx0g5vK4PdrIntk6i6S4fAhJgN05QYt+W/HweyROxIQv20uplNEQue6eyCJYpvhwOlXRSrdHUUeuxP747z4WeYCLBU9kWjCQi78ozw== 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=SG8UdETG8/T5tOOtF6sh4E4k6+6wcX55YJ6vLZ/YqnY=; b=FFbo3boRx38TNODvbK7bR6yYSbJ4cQDiqOm+b3+Gygxu7db5OQIi3me6/TLqL7z3Cv0Bhqmq8FIVmYOUYlGYwo/I3REaGcTNQ337oWVWe2MN4DwwzxAhdqPZ2UsafZlY/SX8KHj91Jzq8S9VnBb2sc3S8E60Y7xVjlS0SP3Tll37HcwSbdxR6s8stSz4xhhdNSrNoPt63ekaUPX4Ag+KXM7EPW0CvFbJFh4lymcHZ0mkQnkeEWXdLTc46sWXaFlP/H03cnX/3h97nMb1o1eZjjnJKtitmW9TH5vT9/Nr4lvF1lm+43fLcapzmRz8xCM5wgMP5beRRk62xiLQNCB6IQ== 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=SG8UdETG8/T5tOOtF6sh4E4k6+6wcX55YJ6vLZ/YqnY=; b=Z08TdQ1Lyk4p6INeLlEIK/d7ixDIcFOlc787LYO/bsTBNaqpNJfq6LhOqYItjxnC6hzbfeTMi/pgnr3x8WNnWSf0jm9OyQe2HYN9Gtx5il8LMo4Pc/veTuz17TfN2HSZWkygrd9RN6mymqAC/LEx4vABk/OSNjSO6kWlhXq7Y68= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5597.namprd10.prod.outlook.com (2603:10b6:a03:3d4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.16; Mon, 23 Jan 2023 22:11:22 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f%5]) with mapi id 15.20.6043.016; Mon, 23 Jan 2023 22:11:22 +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 v7 21/22] scsi: ufs: Have scsi-ml retry start stop errors Date: Mon, 23 Jan 2023 16:10:45 -0600 Message-Id: <20230123221046.125483-22-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123221046.125483-1-michael.christie@oracle.com> References: <20230123221046.125483-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR03CA0095.namprd03.prod.outlook.com (2603:10b6:5:333::28) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|SJ0PR10MB5597:EE_ X-MS-Office365-Filtering-Correlation-Id: 584cd1f3-4f34-4652-f94e-08dafd8ec2a2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WZBigT1c2pTNYxUj7bpzmri+osfBwEFbqcvqvR4d0stxkC3Vg+/3Tnxir94PPlzWpM2mSQIGhWpcWXrQBbak0kUN6i+4UHMtZzQon27z0p8CVvfLnEPdPIEAL+HhTKab9VGHmslklAIr4mePx5fu0qTU6xppxo+ne+TybL3+40SEcwH7h+YE8iIlcqSTTze0sG5fqBzHK2/biRgW58rBX4SSNIdv62JxUi1b3m79hCPk7ZlgjXvTtQQJg6EHPDwzS1rOABMcXlgp8pqeWEzcc3VvOJCYOzSYGy6w7XKLf/NcAZC6x+zDcUVwx0LO6HimRKkJuo1DdW9razeH5wOrFiAaGeCitK8V9yW5aeNrUrsXtho687FkjMUUXIPzcpWE3hBrljm8WeKQ3PnTUAHk5X7pOWyn+K2hp3eUQidM4JrWhD7w8vPe8yydiLtGB9MxgcqDiis5kEAgpI6IWDX6/++6ab0ZPb7nVfbQdB73dSP58ag8VxQXOnX9s6r7FACsYhyZRB5ZDcxdguHKU4FazI+Gu9+FJEQTSskXbkJFgWlHdLYlIZsz57JiQzRc+1QLR0kBOkyxbbqEsEpprBqeHpeDG+3VibsrWQ8kwfltzhCiipd5+FOn1Ch0AbSz2vJigCgOVLwfo1emuRmYZ2A8eQ== 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)(376002)(366004)(136003)(396003)(346002)(39860400002)(451199015)(1076003)(66946007)(4326008)(66556008)(8676002)(6486002)(2616005)(66476007)(83380400001)(6512007)(6666004)(107886003)(41300700001)(26005)(8936002)(186003)(5660300002)(6506007)(2906002)(38100700002)(316002)(478600001)(86362001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZC/Pjskyhjae7dss4LmTXfegX6oawSapLaCN2XgF5ZUnW93+9aPEkz5DgJ+04eUzPL3PCf7CYdrpCdSjc68y2jDggYPLPlUh+5NZlN13xwbYNol6GKif5Br5RS4RBlrAi6gM90aFeYWvAQbmheMqSfJAVTLGkPxoYYnnukQlC2Vxr1rEVPiv/CpEQS/a9RKq9P8C5otNTDmxp/SZ4t1UVV3WFwK4s5RRjeWx5VbV8JgB97V1bJGMNiLVDYsvP7sAxqovLd9XgdvQy+gLMPb9hV1pI8+yMY+JYz+pUeeSUm2Z1/lmwTPfVBnq4C4uREw8JkqQ18juKiewgw6DUXDp/JPEpdDjExZEIECAT/cRLjlWoHguj22HNTa0Z8dia91qh9G8icuxS7Y6EBCQiBTBph7Q2ssqF8vM2ySrTI0rl6abWxFfAsKYa7rKlUdzgbGBdFn8rxpbGPJmeiPBY9+7dImF+TmpJAAEPaZCnFDvESmrOx1RLL3Dd4VAwYyqKW+lCvSyMyYmUyR/QI2N6ZuPTg49wViXG2tq2KqkR4BwruBktW3CtFR1eXg4c3FXrVeyvhgVJ176vdjhaXiMJ/xxhAG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iSpam-ExternalHop-MessageData-0: xau6U6Dx9fGfxXlHOqcC0afZGmf4Q7SuzCU+c/a+IvUZhTKapDAnq4VEIDPxA2v9ck9kY9+yVtJatYKtFPkmpL8m8kp1+ayQDi2PwHV9gDQpvbLFLTnpCfMj6EXdrYTdF5zgNS3+kPH0tLwhjYeF6laBySolL8Z2ZeD2WgkMb2pN4GLDjWnYeGF9qwoW1ckdn8sYRsQPQ1mHB6XQ5g9+9sUzR/zcHv7lR8CLH+SgvI4HmzIfE8DCrU+3ZT8iz8ulDb1pl4OpgsIlcZai0XtbA6tHKs0fZ+Drc/epjuSnQByBKF3Nwoxq8GxBy/3isUoCCPu43D2RrHlLyrjnW5v6tmx/N6wbtKtvsU5rbeC3Q+PgsVZhRKX2pu3RTFMgIG+4U1NusiR8mQaaC1u016vs9kAb77lgBK0C4QXrQE3c4Stsbsat24bW5hAbgJLRRN6qc1vGNf2vCJIg41IBxLG75aBAeKFqIGp3OxFQ02jmk9hba6IugK7SUMm3UG6Qw+eDNL3cPy1QXuViAtvr+R0y5Xm2H5410jQcUvbxEu2WLXINRnJNppCDZUa/oNsGEzQXTQ88K/Kusa+DxmBSGNuCH4114KEPt4WYeJ5V4kGpbAnt3RwBAfTL2jzLYuo9TAvS3WLWBf3ax2IlKDYG6ZF5PlMk+po31Ex1MFXgcvKtGRw2TAa8s50yaA3N9gePXkbuV+cZX1OvX7yjQeoHsjbarGzBqOCJnPTzdPDWWwKZWgQvunDKpNT0LNllTnL0hUi3Qq22bhE/32r/Y3mkX4OxIaXH+nPUwQytM/yzNLq0dpXmxJv5jJ+nt4YDjoQUaTPpmLcHctliCo1qhzsVzAvrsSNVsuEKP+C/YQDnQ+Awv9AlvFMgRgIoTEFN/aqUuXIN X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 584cd1f3-4f34-4652-f94e-08dafd8ec2a2 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 22:11:22.0396 (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: p7kisjCSt1K1TEfCevbKOsNj+a88qJIGeTC03XjwqmYJBSBIkTp2F3MLkgcks0s7+ccRZhvtTDy+gUmo0QER7VyTXT7xEMxHctZNAUtMFtE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5597 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 bulkscore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301230210 X-Proofpoint-GUID: s9ZWvXoWwyY_cesaEkeo7pBBvD2KQglK X-Proofpoint-ORIG-GUID: s9ZWvXoWwyY_cesaEkeo7pBBvD2KQglK 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 --- 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 064a6d8605c1..9f37c3993d1c 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -9126,6 +9126,12 @@ static int ufshcd_execute_start_stop(struct scsi_device *sdev, struct request *req; struct scsi_cmnd *scmd; int ret; + struct scsi_failure failures[] = { + { + .allowed = 2, + .result = SCMD_FAILURE_RESULT_ANY, + }, + }; req = scsi_alloc_request(sdev->request_queue, REQ_OP_DRV_IN, BLK_MQ_REQ_PM); @@ -9137,6 +9143,7 @@ static int ufshcd_execute_start_stop(struct scsi_device *sdev, memcpy(scmd->cmnd, cdb, scmd->cmd_len); scmd->allowed = 0/*retries*/; scmd->flags |= SCMD_FAIL_IF_RECOVERING; + scmd->failures = failures; req->timeout = 1 * HZ; req->rq_flags |= RQF_PM | RQF_QUIET; @@ -9167,7 +9174,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; @@ -9193,15 +9200,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 Mon Jan 23 22:10:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 646491 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 77148C25B50 for ; Mon, 23 Jan 2023 22:15:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233082AbjAWWPP (ORCPT ); Mon, 23 Jan 2023 17:15:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233190AbjAWWOn (ORCPT ); Mon, 23 Jan 2023 17:14:43 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5CBA392B0 for ; Mon, 23 Jan 2023 14:14:05 -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 30NLi2FA022478; Mon, 23 Jan 2023 22:11:26 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=RwXppX8pb+G51XPAbPzFU86sUL4Ih00edQ16NAZDhAk=; b=seZHqNHlGLHVueI5FCZKS5ePfb4L1EoxdKRZqkzVy4P1mrAaM7fcgk5a6KiSilFq2TQP swLxHErYH+871FawylCclOfUB5KTclYv/sGbfGlClNh/HP2QrDLENKns1IEMh0WVa8jP slDCJAuUT5LAeW60barcynaDvJdnDI5IeSNdCXZGTgPcZNNQyexKvNub+fx3JytZc37D hPxgSVkbZ7dXYlz/MSF/c2dkHRRRH7CYH9HDcMSsAqXA5wtjqqqTncm3yeJzaer8DHZB aOBqLIiTDLH2U7CmvRmX0BbYAb2DyA1IEiAh998ULoXOas97FvklqSmV1do8NcWW1gYK /Q== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n87xa41a0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:25 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30NLXtNr011704; Mon, 23 Jan 2023 22:11:25 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2103.outbound.protection.outlook.com [104.47.70.103]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g3ndqs-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jan 2023 22:11:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B2g7bdfEki8yyX+JPWnuNg9blzQybx+nsoSN93RsFd8cdXd0o6zN0l8uAxBhT9xrtZmXh3yZePInZENIqSdMm0g7PVyZkev4efViZvqUbAcwT+3K21O3cXGNhsgxqoxM0UnjaPNlvvgRVgw9PJDsa7fB7n56e4DeMkizNu8+gHMdnBP9u9L3L6DGlJwy5MHMlvsNIbmvdA7/JtimYrWs3yOswkZMqpvLbv1KX+HKIu8Kfvb8bqD09/WD2kcem6ybkpnVZI8SGDR+r4QMbZkjG7EDofsHJZwHhH6c3pz32OoOVdsm1x8UHJSQ1IEtzmZK7/Gw0YDJZsgpSFNjaU3oXw== 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=RwXppX8pb+G51XPAbPzFU86sUL4Ih00edQ16NAZDhAk=; b=L2G76pjCy1fPN5MTYVzb/uoSMljk4teA5v/vsHkvjgA/vEnRYO7GLkWCn72cM+EhHkMQ4tjQYwksZrqK1wckQrbEa5S6zwmgaDCzcpTqY1S8kSFe7aZaEyRJfXfqYT33vSF9HTjUP40KbnBCCMztzSpV68qvrtGq+3KpupFXFRvsxQcYL+KngNYTbNoAaHbjqErch4D/mNDTfuzwKUG/GrwZQDFe3wUvj/nkhkDzUnaJFwpJi1j1CItoo7QrAT9awJSP+vaolXD91zCGuxTUntiGymFb8aqWfwvR6WYRDcdzQ1r/tqv3qmUkF+NaC2wqxC9oqojunRzBtf4pEc7lJw== 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=RwXppX8pb+G51XPAbPzFU86sUL4Ih00edQ16NAZDhAk=; b=aou0WHiqk/NvP8YpKZ6bsfasgRThR51DsU84IGw51pUYz1e0Nae7spJqm3ZnogVDXcMmD9XpfV385VNQ+zYwar8bjJKucA5WUz6VjO/wQbMAVipoAZjJ8xNNlNiF67FH851Fym7R1S4ybDxDxKXTb9yq5gTA7RwAORCFxfqqaac= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SJ0PR10MB5597.namprd10.prod.outlook.com (2603:10b6:a03:3d4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.16; Mon, 23 Jan 2023 22:11:23 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::c888:aca:1eb9:ca4f%5]) with mapi id 15.20.6043.016; Mon, 23 Jan 2023 22:11:23 +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 v7 22/22] scsi: Add kunit tests for scsi_check_passthrough Date: Mon, 23 Jan 2023 16:10:46 -0600 Message-Id: <20230123221046.125483-23-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123221046.125483-1-michael.christie@oracle.com> References: <20230123221046.125483-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR03CA0093.namprd03.prod.outlook.com (2603:10b6:5:333::26) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|SJ0PR10MB5597:EE_ X-MS-Office365-Filtering-Correlation-Id: e55bee44-3741-405f-d85b-08dafd8ec368 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ORTblCqP64oayOzkUhQ9/HhgG5HO8avdzVHCAUvQVOI62KQSt9Mu3NY1ZVRQQoc8N6dvvK3WdYsJSxFafG/R3Sne1f2p5vnVE8WWt0Vf100S1hDj0R9YR5a/RyTHmai43AoRKAcXZoukiqo33p6nR/bCHVZ6qJZCdmm3gSM+MyTbGGbCZ4R4G2zPH2GP6yP7addYFQqhAkgRzTmNZCARk7JL5jRHZoAHnW9NC3q/KbH9YkuYSAexKdPc+F7Yn1xsJZGu88x6/F9CN1Ghh1HnfQhlHlDe6yia+95c/U5G2utcO+OBO1zGWQa8kSUT8dXB61uM9PllnrR2C3Ajdfm39jTimA7O5Xt6xfhhvDgvhJyRCDuG7SA7W8qENdBOqE3HmBA3HOoFY34X5qiWsZTQHCrKYx0yftT46DSR570vtLBRulDwjzfg/+bTLgyLDBHUExVnUR1RYc8WS7RcDPF0cwkHb1VWIxeKe2X/ZHTHQtWLUlTSDRnLAG0Ciz69ADiESQKBW6EP+oQ10GAGIWt8JC5wdYbkUqEU65I8EEDwSLxvPbwO8Qav7G0Y107nhwfieC+VD39dpT3sezE/V4sjxfdAQcBaelrBjhIcuGFOt1XYCf8jLvQ1++QJI9wZTDrh3rgHPSKp2CfZwzQbKV/hzA== 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)(376002)(366004)(136003)(396003)(346002)(39860400002)(451199015)(1076003)(66946007)(4326008)(66556008)(8676002)(6486002)(2616005)(66476007)(83380400001)(6512007)(6666004)(107886003)(41300700001)(26005)(8936002)(186003)(5660300002)(6506007)(2906002)(38100700002)(316002)(478600001)(86362001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7YHIRUV+SfsLbWFNlkCJMl4yMY4C2lfE21+NyWC5/u/omQanLUMI6QgfrRriAOvWh81wZjEdM+lRgbW9JjZ1A14UrxVz3LRt95aviWsdL+ngxXhgfswNK6Mq7YX9yC1mb9AEvF/KwcwdVB+QOdvVQQKNZr7Qro2VF97UCIF8UVcfyfbCcflsQLqB2E5F1HlzBgwWnGKpfPIY0kbNPg7KrG7PN+M/TJ/2i81goyI0P1jnjIder5uSB1Y5cau5lW8ADfVC40tLv0zf5GWDiH4Dyzgm0KZPlFbpjumfwp8fNIJZCfO2+Cs3zZU3ewzsgZ854ZX1wf2ctnVlRsN0TSmOVxH8fnmmOL0cXF98K8YQoGZ+MDelHLxzGTFaxPiUhPtdy/+EkiUjtNSkXDmVBfOcTyHcLUDi0Ixv1iJ/Vdv4odEMEDaXtykwutwyKOVPMsmb03kx65jcGBeszqAXQ+bBIGni5UqF+4fS8cmpVbouTSpvJDZsR6fTr8YvHCzOwx/auazHwHzXiay8RjcpFWVRcimEx14ptLUEQqeIbddjnM62KIMo/4zFAEY6HKuC/O/gJDYTkdtsStFqrtlDOyZiBNal5Ts0zZy/QNb084mDybxbEZ01NNMKrWuPyD8qglA2DitN2XbAmqbbqaA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xAXqqWULdbk5zfGJrk/aYvcARCjiXrTJv/nNq9bOVvLnrtmUaFuCdx1fNYQkdMOMyxpkUcoUb5SfYEhpqcAAKI1whwsnp5+GjZI/7VyOxPreRIgZ2QlotvekSrpiz6Ry9U5hxiFRK8TGS7dNix6SgHTrb1wWhQlJOeKGItZ6MSbjLihkZIXWr2WmohWkQ1rmfycf5t2j87SkYWVgiD4+TSSloREOixcfLry2cTtZlpu2P5IRbQx0LrM/RHCIGjJgb8mtiKaz0oNe7YfWt7Ye/KV47iRy8Yxb0WozDMY1lfHKiq068zUlA/clKrLqe1DfwfZVOx9ZtIOuhWEKFzLW09YzIKxpzK8ciL98kuUy7Kih4REj2HL9K15pT5ibsDQwD/VyH09ichm91ATicEwvtdQY3G8lEg4af6V/eVCbHzcj8FP4eEa9Ezs0eZczoEknOCtoI34isRZa0S1ZFUkzkxqkMNrRhPX98VOxqzHyvUd02dA2m8LNIvNQUY4yQtcOy5eCEePjLBmZ5aioxY8/oONIMdUlTOMYPU9WJPagK0mKKZwrNEXk/CnENjRX+9ssVhB4ITwE5LLWLRu3LgEJclZ50vfYCsuAl4oPzXh7k3b3XF1N/V7GRhAxpHYzCPYDhwv83MnCyVcPDthviQvGx8HvuOp96sxDzrv+u1+160uiRI4IJ5TEK3aKm0S8Te8PjbzRNuz7/IhuBLH8r8X/636ZN5K38dgQAAnczLeqrPQedWGMPtwjxGhjp/SHyG4A3a+eNhRm2aJSk5tbKV7jKQahOvyKG9ToYfo3KDgWZMz4kFOKbpEhjvy6smPFmbIPFhCpkVRw357MQQ+s9yOdf6x X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e55bee44-3741-405f-d85b-08dafd8ec368 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 22:11:23.3208 (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: rizWk7mc2LoBXF7/gRstFAVSqT0ytqFdJ1hM7HpuHW8IEvVYcVLu/9P/6lP+oDhSe4q0GYJLqEfOzkGBjN3FICzA/jOXFzllzoBIHcsKFdw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5597 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 bulkscore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301230210 X-Proofpoint-GUID: MFKioB9dWbgmdGz4HMx80bDxjRrkmhXU X-Proofpoint-ORIG-GUID: MFKioB9dWbgmdGz4HMx80bDxjRrkmhXU 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 --- 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 03e71e3d5e5b..52147a848824 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 544bd97bbf3f..b8c3a236c524 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -2612,3 +2612,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);