From patchwork Sun Oct 16 19:59:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 615656 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 2C109C4332F for ; Sun, 16 Oct 2022 20:02:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229896AbiJPUCI (ORCPT ); Sun, 16 Oct 2022 16:02:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229892AbiJPUBZ (ORCPT ); Sun, 16 Oct 2022 16:01:25 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 111EB2BB20 for ; Sun, 16 Oct 2022 13:01:25 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29GK1Ifx015345; Sun, 16 Oct 2022 20:01: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=v9Vt/+4lByIQ55PCkLsLJOhzpSiQJJplu+tsS3gcByM=; b=QDqQU184T5Xy6eRxRX9z4WaHc5h3DlXzE4ZuGUngQemgh6Q2WyLfU8AXDFJ3I/ToMWy6 0Am4g4b0bXDi4t44z5C6Yso6b2K53mycwIllVosfHPoNTXA98WolybD9ON1HuRKOeIg9 U+Mi0jMSjuFejgsGKc66lmvBgy0PM3zWRBrZxVyypJ6Lk4j3AYvoGEcW6iqAB8iUvFT6 h77a51TzsWH+SXJ2wUseWOzVqa8QQnwA9sE3NLt2mtxb8bIa/4+I5fBAO+WQfROfkc6H NBEcgwuDT15m7VAmGMvll6VKGgTcevwNPt1R9+w8fVFOST+PHR1KF/Q3O+K5zJqU/f1A 9Q== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3k7mtyt2cb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Oct 2022 20:01:18 +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 29GCHbSh034322; Sun, 16 Oct 2022 20:01:17 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2174.outbound.protection.outlook.com [104.47.56.174]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3k8hu54e0w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Oct 2022 20:01:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VFVQukB/A0ntYVy3mZowkSvKoJe9Tsy4NKuIpSTAa2ZQw/Ut6uywNNXF4k3dE5D2JpOyA3ipzP+FqEvk0pO+BR+D8G8Hv673a2gBwBUjIOrXqLTJ+kWpqOEs9il31yhbXrhoRojuXgREA1CVEnK0Nlyyd2QTh52qx3TLn2rBoRweHqH/NC43SB5pkehXiQCHLAjevExptovEa+WlbXoYwdlAcVOZdunQkkG1vBWf1BEhgbzMZ7fmZJItaGl9T9ad3dR11F8iT8h5WSm9REln6CWWTzUZYz9nR7rUV7vMwANG2mDISVXdqs6XckAC0D2f+kZH4itJpruDLoSTgMOWCQ== 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=v9Vt/+4lByIQ55PCkLsLJOhzpSiQJJplu+tsS3gcByM=; b=DCwSx2yWvxqBURCZMIdSWtXhJwjq8TGOdsdBZF2bNaXj3cm1JBlb7sFc5sYkmf8EEvrZ7Z+hivOloRr9QuNQwM9fsgYNBaFH75aLuYDU3BWjYK+AaO071pOkIFJo/kh3sBq0PUnuzNVXe+a7W1FhEjVJuGFgYVYxRon/WMtPTrfYIxwavsFK3qzGvKZd624dWj56/+UT2od67E6flxK1IMKvQcvlhYtuYXZxzhV7Fo0VBPfObRHMlDwkEFwUr4dGOSTHu+YPwAQBJdGnWxO9ngVgx6Yl+fLrIxZe6oy/HJY/z44Yq6i0Eg4uZhztiASK02P4w1pr7nBWHRB3r4r+HQ== 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=v9Vt/+4lByIQ55PCkLsLJOhzpSiQJJplu+tsS3gcByM=; b=Cz34PgbnhQVsKuJwzQThdnXRo17NwSfwjzfRU2pX6kQn70u/TUFfLx1XGaQiCOx9JgOwm9ESBoA8vNAw29Qx9UGr3ivuzJey+3xSxi7MrQsph7QgQbd+hOum0/1m3cqyzTCCwHiqAqn32yyzpAUQm+Vef2MubhtO47HdS9cOwQU= Received: from DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) by SA2PR10MB4603.namprd10.prod.outlook.com (2603:10b6:806:119::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.32; Sun, 16 Oct 2022 20:01:15 +0000 Received: from DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df]) by DM5PR10MB1466.namprd10.prod.outlook.com ([fe80::19f7:e081:85b4:c5df%7]) with mapi id 15.20.5723.033; Sun, 16 Oct 2022 20:01: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 v4 30/36] scsi: Have scsi-ml retry scsi_report_lun_scan errors Date: Sun, 16 Oct 2022 14:59:40 -0500 Message-Id: <20221016195946.7613-31-michael.christie@oracle.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221016195946.7613-1-michael.christie@oracle.com> References: <20221016195946.7613-1-michael.christie@oracle.com> X-ClientProxiedBy: CH2PR05CA0038.namprd05.prod.outlook.com (2603:10b6:610:38::15) To DM5PR10MB1466.namprd10.prod.outlook.com (2603:10b6:3:b::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR10MB1466:EE_|SA2PR10MB4603:EE_ X-MS-Office365-Filtering-Correlation-Id: 828042a3-0e95-46af-6e24-08daafb11c74 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bDiKuHQP1U1hc0ibzX0r14NDZoYVfJJUX1yQo+m3MX6PklvpB6UBqxMmkbQLRL4DoMeBorXaafNrvOpU7pme/n4G1QV302NC5K8K+I8E9SarNMvZLQB2XFhP4NqnGg9KSUhSXAMyyeLjvJGdOYmO5sR92PsMhzksYOpmoYKT4Ilm1XmYMznQ9WjYe8ARB+4rkdbv9u1uY8qE1Xotfxo4f44S+kfbPSeruwwB69fjdyo0lVaR3K0c78ZTe1iA5LYVsfMJKq/9z2LKxrEUwY4aeyROBqCE8HZvArnva4Q/+vNrxZWQWRGBIqA134IwrkdMvrqZMDAV5OudwO6osZLjx+1SHgNQcvLxfA/Ng/z0XdVKZlaWWiYBSKZdve5u4ZBqVhMU1HFOOLCQOtQopxhYCyO3b3Jnz/7KRCpHohPLnbnhK5qf0co8XZ7AL2Q9wrIjyjJunxX6jtVvgVHCZiwGUjam/rq6aiTrzJ6cnQgcG5dJ/GhTaoTFEV2pWNlVjmuWnKr1zZu9SQkDSTm8IGH15ut7YaHI+B+w+u7Dia744npiQfKa+X3OcnTuXF3YcWdBLOoBjcE5bvOrMT8cB9r19TKbFbAMS1Ba4eMMlATukmzbt+3INja4FAbYwm/z8PRXx6BpOjhRvWnNvcG1qTE03I8N+z57NMJwaVG//Ms/2r+a+XlLgWoEqNve0NzrjAf7IsZCyWJ2u0xTMjUcPSdxrA== 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)(39860400002)(136003)(396003)(366004)(346002)(451199015)(6486002)(4326008)(6666004)(316002)(478600001)(107886003)(66946007)(2616005)(66476007)(8676002)(66556008)(1076003)(5660300002)(2906002)(6506007)(186003)(41300700001)(8936002)(6512007)(36756003)(26005)(83380400001)(38100700002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: b4cHdgrj+n4aXJ63AJu0M5KcqbPWy3yVJ0FzmwmrPW4sIf8aDyzW1iE/q2/73tTSIO5gDlS5760kbhvOtATOkyreWMuuRzg3pgqajstnGNCxpoz++udCXNeX+Je6t0ueUWEf9+IxGCEAbknOQrtSvhMT9thea+g1D3lr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3bWUpJCHhkUkGL40xZV6154oi/Tl1wj6Y6kPCmqx8ZTqQ4ezCSu6//S4yDt2+CTomjvmd1AxQvQkA6kTqTSxa8kpOeOppjCeK/DYSTsluEb4tohRhhcX8Or++EKbDLz4Ou1M8zYOGqqOi0q+XPppLzbc9RoI3wijrFOLV84iLtT2fr2CJIH30jIUIFsGvlUkLDPiCXP4VMZOrHn8KI9FFSFu6MoIhzbonuWWFima1EhQKuSnvooj+GQUWSS+/INh3WnqVgI1pqBlOfKnPYHZknpXpV4aoJkWBqFgzKXLnVzO6K3rUZvLu5nG7ZafNghx2XesjwGlOLmldG0zGIh4GtfhGt3Qt4a//RdK/th/ZV1PmAUelAHckuFPXZp1zwmQSdOUP4qg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 828042a3-0e95-46af-6e24-08daafb11c74 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB1466.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2022 20:00:44.8904 (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: zhkd6gn9G/Lswfdt8dbnhZkqkM4Vtyu0dC9xIxi2cb758PHxnDDODYZpRLwl0ikxBu+OQ7yO6r2M1unr5I40hYacw7Bjt3nHhpvAXk+1YEQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4603 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-16_15,2022-10-14_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 adultscore=0 mlxscore=0 spamscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210160124 X-Proofpoint-ORIG-GUID: _laxGahyO1eC_YVjWxfZ-9LHVhwmeHoU X-Proofpoint-GUID: _laxGahyO1eC_YVjWxfZ-9LHVhwmeHoU 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. Signed-off-by: Mike Christie Reviewed-by: Martin Wilck --- drivers/scsi/scsi_scan.c | 57 ++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 28d53efc192b..564ab7507f2e 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -1425,13 +1425,21 @@ 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); - int ret = 0; + int ret = 0, i; + struct scsi_failure failures[] = { + { + .sense = UNIT_ATTENTION, + .asc = SCMD_FAILURE_ASC_ANY, + .ascq = SCMD_FAILURE_ASCQ_ANY, + .allowed = 3, + .result = SAM_STAT_CHECK_CONDITION, + }, + {}, + }; /* * Only support SCSI-3 and up devices if BLIST_NOREPORTLUN is not set. @@ -1500,34 +1508,25 @@ 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)); + for (i = 0; i < ARRAY_SIZE(failures); i++) + failures[i].retries = 0; - result = scsi_exec_req(((struct scsi_exec_args) { - .sdev = sdev, - .cmd = scsi_cmd, - .data_dir = DMA_FROM_DEVICE, - .buf = lun_data, - .buf_len = length, - .sshdr = &sshdr, - .timeout = SCSI_REPORT_LUNS_TIMEOUT, - .retries = 3 })); - - 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_exec_req(((struct scsi_exec_args) { + .sdev = sdev, + .cmd = scsi_cmd, + .data_dir = DMA_FROM_DEVICE, + .buf = lun_data, + .buf_len = length, + .timeout = SCSI_REPORT_LUNS_TIMEOUT, + .retries = 3, + .failures = failures })); + 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