From patchwork Fri Jul 5 11:51:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13725030 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A09614A096; Fri, 5 Jul 2024 11:53:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720180395; cv=fail; b=e9OGuUjC0N8HMacrtjycck7hTN6zTopBhPvvlcDOTU/Z4unxltPoQhC7v+pR1AMO/Ux3+zKPcCBA7dnGPpALmd5Ehd11RdKOmchXK1vjHXvZlrMKvJh0m27f2eXg4BRHhO6pk7sc9c9PhVmQvkL8f0Oj4ZYjdxpvfVVnUz1qoHk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720180395; c=relaxed/simple; bh=Ug8nG4l8dlW4rygc9iwEOO/+v4czMQR1chck2loVKSk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=amcmxQQqAkVcWyfnZDijiRtR3x+gYcHt7H7mBhzjb66xASu5N0Sf7ih1n6fr5a1AW6A1q6PX3cG2IKz/Hau8z55s0Lr9n/ONK8LUyUbc4spL4pj8iHYTts6EjEHfXzs/Cv5JFFrvgfgyw13XeG/oiggkKN1XbGwZ6SQ1AJu2Nqs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=Si+H+j5W; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=nh1HJh3p; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Si+H+j5W"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="nh1HJh3p" Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 465BfVjl023320; Fri, 5 Jul 2024 11:51:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=+CS5gOGc0m3PJkZ44+tNF1y2jyDsxVhfLJTXUpxL8Mg=; b= Si+H+j5WGqqAJ/xZzWDzI5TzMOriyDpE8cfhm64QLE84TshR9GmZVVictLinYTPs OGw8KAZ33GZfbdEu1wG9ewrGJq2tDK0fuojdAIPQYKZ1vIQpZUb32WExhxpV+wdt LNGZztCf26TAVNJyw3sTx5+4kLOHWJQ4Y/t5GGkTVVYBztlDjb1yM5oikf2pUCvL 0nbjGWx5Uvh5mnAV0+2YeGcwF7tpPNVEzi7dRMSA+zrckpwYSLUggZ30ZkOBmt8W 8iN+k7F+o7VN7eYlF0mb2SQnCfZZBc0GH0quSb8Dno9ntw8Ck+uwp30TjTyx8L5l bLoAFv7mNtm3z4EFSz8yTQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40296b3t73-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 Jul 2024 11:51:52 +0000 (GMT) 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 465BUrR5023586; Fri, 5 Jul 2024 11:51:51 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 404n129232-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 05 Jul 2024 11:51:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V9xZk60HYq6JGVI10WPKskp7PwxXq5oXBW04o2PmluT9LyIbOPWInimlM5W4puMR9b1j9k2lTaxvJwNi3cj3rMVctCc0BXfkNQptjZrc2vGixXaW0OAOwcUCFsB0NZ6i/jJ6YadeSe/sfMOlCB0K1tG2j2H6VTCdOUk0vaLuBok7WJFnEvU+BeDpZToF8hslAxgmmdzQZzF0mA4UpyK7W++z/3gi71LJLNafpkGEp94spwQRQdpn2dmLaYycLxnJxDygYx1QU4Vo1YEDl9lYYOGJJ9QPiImZSw0JSM/m0lfaJHh12Iw04wk06X+4+rtqFsPVcY4QqMutj3feBWzKWA== 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=+CS5gOGc0m3PJkZ44+tNF1y2jyDsxVhfLJTXUpxL8Mg=; b=nMvo6rJlSawLeuJMtoo4qYVv+JWrF5qTAUup65kbtlul6hO6bolCmv6EkymkSuJak78tZNK+JVkezzpOQDDS4W7gKSF7u/2TBoYCaA+htl2Qn6bffofWtBf3BQR9W1px1tm1bCNQwzQfd8ZMefBZc7dl8Kfju6QfU/jSXzifYDPkppxQDrUAKoJV91H1OW4JzBNm2uSbLlSMhURmDHByVGCS+YtEaEwMd5FVnSqlnSCyujoIdlcayQcJbPjBNmMO+Tp6p9GI5QOkaZG/yhGMm6MtBn7bYvAMRAWAvytsTsNHfVVSXW5CZE4/1n86Srjhp835csuCcBMSLaRmCo11Hg== 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=+CS5gOGc0m3PJkZ44+tNF1y2jyDsxVhfLJTXUpxL8Mg=; b=nh1HJh3ph5p0lrpXzyKDAoNuxZ2e3QgZv/IlczPPbMNAdvE2jprA23ePjwZ6ATGQ68C7iBHbWfUpYr/5F27wUZ+k2mvhUH0iSMP/pn+0yrYmfQMmx3vJDM4W/640zOEM24GgXKgIIB/ebF7/KBEC6f+z6y568HIQGu0y+EPQWZY= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DS0PR10MB8080.namprd10.prod.outlook.com (2603:10b6:8:1f7::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.27; Fri, 5 Jul 2024 11:51:49 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%6]) with mapi id 15.20.7741.025; Fri, 5 Jul 2024 11:51:49 +0000 From: John Garry To: axboe@kernel.dk, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, pbonzini@redhat.com, stefanha@redhat.com, hare@suse.de, kbusch@kernel.org, hch@lst.de Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, John Garry Subject: [PATCH 5/5] loop: Don't bother validating blocksize Date: Fri, 5 Jul 2024 11:51:27 +0000 Message-Id: <20240705115127.3417539-6-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240705115127.3417539-1-john.g.garry@oracle.com> References: <20240705115127.3417539-1-john.g.garry@oracle.com> X-ClientProxiedBy: MN0P220CA0001.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:52e::29) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|DS0PR10MB8080:EE_ X-MS-Office365-Filtering-Correlation-Id: 6635d540-e9da-411e-f09d-08dc9ce8da81 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|366016|921020; X-Microsoft-Antispam-Message-Info: ysqX3ohX5BzRtWWqliKMZOfYkNm6tPL0YImlmSU1UpECYSQY+kFE6fWbhCKv3kUMu7yJnqIZ/JTWZLvkMQqtpQ11wyovgSWpv02XLlcGDZNuyiS3HA8Vgd6ePOEUUtE0Fk04eZodwUM3kUG+WTqIR767iSwCuU8yrjobKjdRZbDjIF5YlZbJcoLuRBWXXCsLW0z5K9IA/UjAPeudi2iFZMFsV4ymsapptdFh2i2Tue+39cfzwI80SkSkaNUzmfFoNU6kr75r0xJdUMEmqgoSD5hiDMDuzQJkUJMI+z8eIBBA3czobDu7EL7qXKfybrnWHeaz88U53+IV5e+sWDxfzRyPcjKmMPOU5fxBpVEx1zh0I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Y:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(376014)(1800799024)(366016)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: m/XDC215E95UWcBSVfs6hnGG7+ms/QQ8ZxgYF75sNJMPI4OLd7bseri3WGoXkQiYqYieDY7Yggoub63hY+BiiQX8bkhM5Se4vUAYGo8+WR4hxD865H9aHf5+83NeKfPKGmcrNCuE2xKrp9xJnXaxGu9MQ0dGjIwniaefsiXmr3CXcXASuEppq3cDwgrzubYGcmzc6Pvq4b7gn5pB2qUvIGC4h0vIJrVEF9KXulDcjxfkEpfP/22xLJxMj5NkCEH8evBjmnArGgD0ISvTFjQ+yeqdZ+dcP3xbwKQNbSgs7JvjeAzbx4wnPvnCOdB6g6ALVkEMgOpOJQIuT60I0CsaaZ5rXTGEKFfh5zuTtQV60wbKRdqF44VdFMsqfhmTXfi7ioQSRMSvurSwMbwiJL5zp2mnMDDK16Hj756F/s4u8+KR+NvTXNCTZi4VDCIPiwv5sKAAFSXNgMXmmKMUbahcHC+YrqN0DwnV8tAlII96mMNVwJchB0y8STJQ8UuElxYvjRfvuBgQ3NPPLKkbOnlqOA7DczEw8sP4jinEjIazeZKJw7vjCRW10s8dcqJatFkan/ts75UWlBCaMMXKrOE0pie3lHgoKZT3CRUEHP8IhALPHqNWQt7XT+Gy+9cxjEqis5984DzXno6LPCci4ygvaWCIFZMukfYXUSDJWbuDrLAqu2lcIU9Qudjsf4VcytFj+p69blQTPRfVG40iDZ4fsLC76Ux8aHCWpA6sMI1BBQoVqblFNUVMBZk8jjlkqUoByqKqR9Q7JyBlr0Rr8ePYKbR0LVMecWJkJSjfydsgarBYfwgqlz/d8bYfw4KyCYcousy8MrsF37cb+ldmRYup0q8EBRYxsaw9Cmb45leGrKPCmYYWxQppIHwys8SSRmZ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t8OXUur4fPlExKM8OBQoHIYqtnbXmRcUpcFn/PhtjjS2MS4fgf9Wmc6q3JhXaA+kqSqk9DsQuTKOfsgPKIWFv+JvTRWsVta3SA+nY28qXEqWOoNNCw3+TVADVuXIH8JlDNyyk40ZFFgJ3gU84CGUssV1S4YGAVE8e+zr1l/JE+lrL83vp3rYyUywfFoklnag/nCFHf+W4FKx71eLb8AePHNw/U0mH50kN/cTKX4FoDAL7FwR/CmBKvOu5AkubJo2kT0gM963bvim8S1O8q63snsSDVC9jypmWt7oUD7+HwM+8bbgb1yOn4XBO5BfXsnMbvuGGgSDe7cZmat0qk2B0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6635d540-e9da-411e-f09d-08dc9ce8da81 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2024 11:51:49.3354 (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: dIkPvKewbay5u6sGmdcFgwKMaIexjvDK6j8pfeFHYQoSqgwEZE6uKFHK7J8LnvQUU5sWzo/xLW5h9BefxKBJ4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB8080 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-05_08,2024-07-05_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 bulkscore=0 adultscore=0 malwarescore=0 spamscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2406180000 definitions=main-2407050088 X-Proofpoint-GUID: Li81OcNydv_oArUG7hLNYS9snBLLb-C2 X-Proofpoint-ORIG-GUID: Li81OcNydv_oArUG7hLNYS9snBLLb-C2 The block queue limits validation does this for us now. The loop_configure() -> WARN_ON_ONCE() call is dropped, as an invalid block size would trigger this now. We don't want userspace to be able to directly trigger WARNs. Signed-off-by: John Garry Reviewed-by: Christoph Hellwig --- drivers/block/loop.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 1580327dbc1e..736467dc3ca7 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1061,12 +1061,6 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode, goto out_unlock; } - if (config->block_size) { - error = blk_validate_block_size(config->block_size); - if (error) - goto out_unlock; - } - error = loop_set_status_from_info(lo, &config->info); if (error) goto out_unlock; @@ -1098,7 +1092,7 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode, mapping_set_gfp_mask(mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS)); error = loop_reconfigure_limits(lo, config->block_size); - if (WARN_ON_ONCE(error)) + if (error) goto out_unlock; loop_update_dio(lo); @@ -1470,10 +1464,6 @@ static int loop_set_block_size(struct loop_device *lo, unsigned long arg) if (lo->lo_state != Lo_bound) return -ENXIO; - err = blk_validate_block_size(arg); - if (err) - return err; - if (lo->lo_queue->limits.logical_block_size == arg) return 0;