From patchwork Tue Nov 14 01:37:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 744598 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 72294C4332F for ; Tue, 14 Nov 2023 01:46:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232005AbjKNBkj (ORCPT ); Mon, 13 Nov 2023 20:40:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231956AbjKNBk3 (ORCPT ); Mon, 13 Nov 2023 20:40:29 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E16231AB for ; Mon, 13 Nov 2023 17:40:25 -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 3ADNseAc016967; Tue, 14 Nov 2023 01:38:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=i5vXS1djHmBsng2QRrTpw3owfNQ1wdfmYnh5ZA9b1yk=; b=sw4/I42hyP8GuKCNhgDMZViUIXsEIHVquaKeolBuX9zeGbr52UbBlGeylTmlLnoO0cow 5gyxRwrtmu8dx+9vJq+h4+1+Nazvmn21vXN/meNZ7ODcarFKhjTuUvUtvyDtrZMwHnWu F+VvmRVn/F5cT8owU7jlOHRxhfgnZCBt5PYw+f0u2i4dCjZXZqTyt8Ox24M3JthPfqmb FfxUv5gdAj4X8H+THmlSjtb+g6HZBTyTwSxaSgf3qGBsEZo7B+O1laaSBY/UFWVqYuCf gDMniLZKuE3UNsvK/w11xFJn9vtbtQq7gUwVm0fMN0nOSbDUTktfDM4rtGkjvlNRBl02 tw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ua2m2c4gm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:19 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AE0MswD004499; Tue, 14 Nov 2023 01:38:18 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2040.outbound.protection.outlook.com [104.47.56.40]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ub5k2j1pt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Nov 2023 01:38:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d6Q2RKYbf3L9K6/d3ptfaSSNeFG8Jpu2VgkdJZfIDM2L9ZLgNr1e2JAvDta6mzgUsGXfwbLSTc0ePDZZmJantOwg5OZZMZbZSfB5t8JiZdp/VMKyWcn5UKskYYnS26qI7TmkvLNcRCZK6LHGMq7cBoIWRCG+H2hh6uru5nQVlQMWWdmKFAoWmp/16B9bgs/ZUd5Xua5irO+bl8NbFWPQxFIM79cOtSvzAVpbN04hjJFClNm8+lRcH+tR0fCRe/lWQXnWrhX3bnF94tmoJBD8lzM4cztFNufPcGzGIBD5bgTOhbiv+yaDHj+thI6xsmRqQNC+X2mS1ChGhb6qScle0w== 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=i5vXS1djHmBsng2QRrTpw3owfNQ1wdfmYnh5ZA9b1yk=; b=UbO0NZE6a2t4PnuzUB13n2usITG58Q5f8Jdf6zOdaZaDwfHUfv9YBYwhgUADGXo/TgSGOUAGhp/O4Aa02wYX5aRN6IxEAkzFlRFFV897ziDQAGg5NTBxw/Cfs10L4qKuQpegh0HoJFXbiaV8wrgAkJCiSu+WUjwDQZ69Y1jAfVOUvGhgHCNv+rXVyFx0+4CH3nV2/IIzgCVKC7ryc8FWMvIRRn3DD0263bX5mdjlSz4WlPq8Z0hMFEy/X5fVU9yGvZtEDthInycKgqBqtSBE14JosusB+a2VQfseetEhnqGpfKxs5g+WkhjwPpohqxc+sAJcmvzTcMCGigk609b5og== 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=i5vXS1djHmBsng2QRrTpw3owfNQ1wdfmYnh5ZA9b1yk=; b=Qtdm5h5IxnicCPB0RNMCHiaaSm++ZvQW2yY+D3FM+LZscFBYKFcYbyLjinAJjWtrreHtugIOPIAhoDC7QdMOdF/jpdNa9dtWCmO3ho2qg1QcUvrzM240jUNRl2M/BIkTh1e+rIrPpg0rsCrpdDn1bK4O0c1IkdBKmDgT3Jika1Q= Received: from CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) by CH2PR10MB4199.namprd10.prod.outlook.com (2603:10b6:610:7f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.31; Tue, 14 Nov 2023 01:38:16 +0000 Received: from CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e]) by CY8PR10MB7243.namprd10.prod.outlook.com ([fe80::449f:4fd9:2d3e%4]) with mapi id 15.20.6977.029; Tue, 14 Nov 2023 01:38:16 +0000 From: Mike Christie To: mwilck@suse.com, john.g.garry@oracle.com, bvanassche@acm.org, hch@lst.de, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, james.bottomley@hansenpartnership.com Cc: Mike Christie Subject: [PATCH v12 18/20] scsi: sr: Have scsi-ml retry get_sectorsize errors Date: Mon, 13 Nov 2023 19:37:48 -0600 Message-Id: <20231114013750.76609-19-michael.christie@oracle.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231114013750.76609-1-michael.christie@oracle.com> References: <20231114013750.76609-1-michael.christie@oracle.com> X-ClientProxiedBy: DM6PR02CA0042.namprd02.prod.outlook.com (2603:10b6:5:177::19) To CY8PR10MB7243.namprd10.prod.outlook.com (2603:10b6:930:7c::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY8PR10MB7243:EE_|CH2PR10MB4199:EE_ X-MS-Office365-Filtering-Correlation-Id: 52693522-e4af-4a39-5e00-08dbe4b25f8e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yKBu2pbyd9GWv94C6/9Ih8VK6biNVjI55KPwtkEByvZtwiZ2Qa5jlIMtN1aeqbCkjWx+1AtiCp3MjwCir+W5VMTzF5yqSdKH1Zp7a3x/NrrmU1A3mwSZQspNtqyTbibcQx+a8CTuOMzRp++1mkNXL8BpvfMpeSmRWxJahSg36hgFPNGEfe6xg7xMOmsFhsJ9/uE1qppku+jQGL8WMZi7DlV18PMujLatetsyJangMsmwCukFStUixTekBBafaglstUGOZqHZk17o/soNWlMaABiH5BgZApRvd4Vuf/Y5DcTOsH+p22APY2HuU54qD2iwvNHbM7GZ+wd6eSRScFUoCVxCrICT8/pi2rpsC83p6Fd6OXqS+48Sh/2hbCMukoXJeg1kNzJPt3+itczAJBL8tPrh4uklE9AJd7mS4fvaKSQkE2EK3IvqJmEaVZV1ZRa73em0/YWt0O7il6DXnD7fJQd7UPakMJI42dM6X6CgHS81F7/Y5+i+8NRvB/DiLuvvpIvIQOBj8kcPpNw2LNauTXYSlPI/JHqGeD671idr8bcJ2c+nRDbdk/yCg2quzyvf X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY8PR10MB7243.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(346002)(376002)(136003)(366004)(396003)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(83380400001)(107886003)(1076003)(2616005)(26005)(2906002)(38100700002)(36756003)(86362001)(41300700001)(6666004)(8676002)(8936002)(4326008)(6486002)(478600001)(6506007)(66476007)(66946007)(66556008)(316002)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Q8axpojM+HjFFNrgjv1s3BCgFJcmPFjQaoIpsRkQ6VZq3mh8tcyMGK60ObHdUQ+q9Q/w/tC0JVhwbiXtCXEvXn1/60p0fWKDHXvuRUvtqGIEc19hP+Hf1/Lqzf/DbNDFb2pkXSIXcxY11TNsU0ou6paKxJZqkYF9q5TI/CJaYaHFH+YDgMUJHjRMiisilh52LvRJCBPQ6czGGqY+ZSzI6TbJMiJY8F7EUhDoz6jTudEIKLi8zQfs/xE4ToaIp6x/THnYAbW85vGa9Q0Y/KEGohow1n7zu5vaRkMFVQ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Ul/zp0lr1cxFHc5OGRYDe2+DqK7evYskymDX77NNsQjSYfnbdnYyn8bC2DXe7lAzPzlBoItvtBqY83+jpvwQCxYckUIHGD1ZvoZCGX62CVRwbU15x7Hh7uin/TDMQ/WFqKvg1WieIXsjYHVJl7Dt+ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52693522-e4af-4a39-5e00-08dbe4b25f8e X-MS-Exchange-CrossTenant-AuthSource: CY8PR10MB7243.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2023 01:38:16.2806 (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: D2brNQsjyA0BZ6R5QqnkjbfpsyFey4nkM8ejGzgJORcZlrHJxy55KQO3rDb8AFyfu0OfFJ6Lx1vJ8s5fHaCiZFdpqbV+M8iDRy9d4yeUb2Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4199 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-14_01,2023-11-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311140010 X-Proofpoint-GUID: a-2ZJOv6KkjV7MHucatHkFMIx2FVVlhl X-Proofpoint-ORIG-GUID: a-2ZJOv6KkjV7MHucatHkFMIx2FVVlhl 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 | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index d093dd187b2f..268b3a40891e 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -717,27 +717,29 @@ 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 failure_defs[] = { + { + .result = SCMD_FAILURE_RESULT_ANY, + .allowed = 3, + }, + {} + }; + struct scsi_failures failures = { + .failure_definitions = failure_defs, + }; + 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 */