From patchwork Thu Oct 31 09:59:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13857769 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.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 530E8198E6F; Thu, 31 Oct 2024 09:59:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730368796; cv=fail; b=ipq5W72aeyu0WF7aLESfQYGITdGYMin+Yoz2wbBYo4lG2p2LQjzjGrDhMe04iNbK4eS9kpim+PsWXCwg7c4a3x3GHzP77Gf3//TUrfMGkB8A0M8NfbN8dZnLvK4LKBmUI4poAerjCxHHisM8/JZwGZ8ZZZrODJffov7+MNFx0To= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730368796; c=relaxed/simple; bh=ETOzPuqoqEfEuMWJuPJkO/ik9DAxJLhvFIXkXvvv6rs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=YNEbzvSa0jzbvnNNg6SHdJWoOokmcUF7mQlrlnK13X7t4AmmsV+S5dstCpdf/2+Ee5CuWIzd2YbmMn6nX5P+FbJk8dlZHN4tMZ1/yxnmFLnaO2es/v2FOwYVTivmrB265H1r9IiyfvmD+AqNKXofvwJu225uy3x7Bl6XxrnjBaU= 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=O9xDreko; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=bM8w2doc; arc=fail smtp.client-ip=205.220.177.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="O9xDreko"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="bM8w2doc" Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49V8taRM021893; Thu, 31 Oct 2024 09:59:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=JSW0tMVT/UtmEnJkgzaxHO7fXwcCXfZENqI01ubJRvQ=; b= O9xDrekoAzZ58m3V+vjEXrkjvq10pk6bRAx5ByarDL9YD5o3ljyntcMEbqfhoGJb pveHqQRJkZLO4xX+URimu6oh8Ej0LWJO890s1wC2Azw/gswM8AQjF8wMyx1omRWP ffDJWQLzty3/qHgacPgoo9rc6lMxkA2ucFcACgFcVCSXKj91o5Tc/6tZtTAPMhQB 5tQ7VhXlZhrDosbdwCanC098Z31WIDGx/C86L6bcCSCIUhbRHJL1gbm4sqo/4EwU jMRo8sviILgFVcgoM7cExl4bUpszy+NyMnblGIeEFdnwVndfW9G7uUVio3uI1ju+ 6Wahs9iwqlI7iWqd7pcV6g== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42grc21tyd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Oct 2024 09:59:34 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49V7o0c7004797; Thu, 31 Oct 2024 09:59:33 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2045.outbound.protection.outlook.com [104.47.66.45]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42jb2wseth-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Oct 2024 09:59:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DnmhBizG4Hd/ygGbMDA4eFb+3ADZ2ejMaOcgVZuLeb933TgZfsQ5TFU8sqxG0v+icK0+SfOaScLiISMDuu8q5ee6smniSacIWPuWqL07/ZrI6Z9+MBaF+a5qaWXRe56krOk+pQZCjoyGw+UX8xVSm3LHNRbSwC1aOX9HWNv1DXfv/+uc+Wm5dLKpbz87QiRqNeq5pD5QQurj43D005xWlSBYDnceoWonnxiKvTf7+SO3gC+mQqR84j1max1Zz8IpWaD85wNVHDDbmemQ3YXIFQdN/1pN1EPBfchOBJnkVx28k4WRzi1cF/lMu2ShZLzbTpjlxEfmqNl2hxqA/uKB6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=JSW0tMVT/UtmEnJkgzaxHO7fXwcCXfZENqI01ubJRvQ=; b=lT4lAp9YhSX7Zo2BUtow6DOHAKufHS2VP9ryI/v9YYmjPf2iT76KbZPQ5d9Ao9tC9WEvpfPmjIbvFITrs18SEh0ceCgb4cnfJoypvM9JE6GzEm3qlLM6jZyKK8Yt3Veoe8f09YfHKKHr4bMrb4S8T8OjaS535zMtCqGyXDr2k54ZjHH8MtAxg3W+qAYEKGfKGaEg1pNGQ4DSgFAfxZzJ3aB1xgZaLdlzdoTVz0E0Uk1ufOeMsoqdNsuiyOvBzV+sEFd6Wp8BxE/6WTdXTW3QOezgFutAGM35dj2Qe5Hi4LLYFg5/RvhqTkHq3owGiMSnddAStUPCEotyx3+wv66NJg== 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=JSW0tMVT/UtmEnJkgzaxHO7fXwcCXfZENqI01ubJRvQ=; b=bM8w2doc1xj2X6O/HXXd7Jair8MXPFWv3P9NkTic0RfOwyJIEQnTBNrCjdsVl2MxDOdHOV4GZn4NgXKyclQsVtcuyTK9/dPEcA6Ez0SyE5ZbKyzjGSAlG2MCNMqC03zvYVEyNCQlNqT7rZpANDNV7p2FbRZ71obe9X30chsBUOY= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by PH7PR10MB5724.namprd10.prod.outlook.com (2603:10b6:510:125::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Thu, 31 Oct 2024 09:59:31 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%5]) with mapi id 15.20.8093.027; Thu, 31 Oct 2024 09:59:30 +0000 From: John Garry To: axboe@kernel.dk, song@kernel.org, yukuai3@huawei.com, hch@lst.de Cc: martin.petersen@oracle.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, hare@suse.de, Johannes.Thumshirn@wdc.com, John Garry , Johannes Thumshirn Subject: [PATCH v3 2/6] block: Error an attempt to split an atomic write in bio_split() Date: Thu, 31 Oct 2024 09:59:14 +0000 Message-Id: <20241031095918.99964-3-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241031095918.99964-1-john.g.garry@oracle.com> References: <20241031095918.99964-1-john.g.garry@oracle.com> X-ClientProxiedBy: MN0PR05CA0016.namprd05.prod.outlook.com (2603:10b6:208:52c::15) 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_|PH7PR10MB5724:EE_ X-MS-Office365-Filtering-Correlation-Id: 4051da85-6149-4709-cd0d-08dcf992b6b7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: vTQgl4jlzlKb+Gd5oR29Iy99Ba5s7+eDUb2zVlIfhB7FbA4/++WvI4rwZOKcDJCP5Gi3RmGUO/wmEF9MlQAAYBQRCa4PiRs0mqBt8yul2Osf3fBFgIZwlWryNmyQ2SjQpifYHWTS3MYHRSBktPTAU04XWbkKEcYc3nlSzUSTAAFeeBlrhT9Z7zz+7EIsAWk7muxqu5epOwIxNpzHrnJUEDHP1v19p3cZ75IG/u+vyrBZ24J3+nTwg0n/eaKX6cwFJNtqJ59OAE9SVQcqN+QWAURp56ZL0Jk96ytOdzT+ZNCbdX3zElUtA9eXFoPIk21zfA7H2EShkKo1vrqwkB+A7OPgW+tT9KbBGzczmnL23164GwH44vKfWckrUvu0mYG2SRp7Nhti7H9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FmHpy8CdRlfdWp0UHNZuusnd0P8lL3sKQGEz8chs40RfmARe23YIjUjY5MMLlDMO+BLqM5iHWTiK4D/JSeH4WsPa/t0sOhPkqM6SI13QQrEFFEaIgzraiqjncFXzrHER3e/gAjkXdEftWiOoc4/nUyGwZXcsk81vkgIcXBhSKOMUwspUvx+b6M1ekKLsWNSqbhqUuBG/S3ovsGsyaIQLdb04BbVy6dklCm9/61aDsq168Zz6wyypLVwgc+VGGyKS5SpmuCwhjAxQQLUii1LQxjL2Al+t1bCw5y18KnRbfpAls1VtKhytgEzx22/KaZMsyIRephBrZYJLxakQswX+A7juhm3r7pCgl7NmIRZnFcPRI+g7tFAKnuP9NRZG+vEwVmAtRrG8sQLhXtGQS1m+bhhpewmtqL1j79DxLgltIKnbR3VkdfZRDuoU34YIlVG2m413+tuAtMp3LM2FDzJ7dXPGt7UYsPf7z9uBAQy6rRBpp5spS0Ex+lnp0aa76HbmhmqqW5vpcmAazmToGZfASkr/veH5r96VjHF0TQxje0U3z9ILPPCBvSf1737mUta4tW4C7LMku+IMZ740j2toPqkxdJXNWQ1aQruhCmJ/WxclfVKod4fUUVDpBg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: l/pNmap4DZuC3kvadCwqxGqLH6nPI78lKXFU7mpViU+61s+1pRV0dutqQQnEraBaQEh4bptkPNRS62R9EjRkYFE1CnOgmyk8NR664Up2PBxGVmpOLvmK5L5Pe30P0m3Xo/05meuBBjUgTsEuE+3wrwqNgExQtCU5MTGZd1PNPbDnWxeloDUCFfb5X3yNikP5b34vnw9a1bgqXgI5DPEg74PySgNL0PpLTsd8lUPKX7eh6Gk7LQJBVsvDttHxUWUTP8BM9FGsKc8Btowa3X9OJ332YBW4riFcw9A61BWdRZlVlDNS47l8fjFg9YpSEsej9Hg6vBqGdAz4QYX0FxlhvcvqNEU6hBI0/PJRnwNr+q9cSkvaeYkWD4UVmLVPaxlRvJhtXY+5cO+Thjp+Tsd40tp0AfOXkgN163l3bppW9rCjYLSWeE+lagFnxkcLm/kky6FWUZHDH7QiCPZJW4cOYLf5XsODwARxEPmNQdQIvQ5u4YamhQ0JZbWDuKpSJZIjj90+PQebA0D+sUfLMBj+P50GWzRELg9u62iUKLvhspX50dk6pL3WqHHzUJliXaQ1EDDOhSOcjPITgMXfqvkaovxTfELUB+5jOvsSRf8fgTw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4051da85-6149-4709-cd0d-08dcf992b6b7 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 09:59:30.6717 (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: h4pR3UXz2XiIWRlwMAT1Kc3SkC8Z1KL88Wdmjy5tssvnfIqVjOyfALA5zwHhTCjetQAvvhwYr03wpwDjM4pQpg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB5724 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-31_01,2024-10-30_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 bulkscore=0 adultscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410310075 X-Proofpoint-GUID: SI0wtIA0cGR_2YF-Xr-d6pJyORuW9xkg X-Proofpoint-ORIG-GUID: SI0wtIA0cGR_2YF-Xr-d6pJyORuW9xkg This is disallowed. Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Signed-off-by: John Garry Reviewed-by: Hannes Reinecke --- block/bio.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/bio.c b/block/bio.c index 7a93724e4a49..07b971853768 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1749,6 +1749,10 @@ struct bio *bio_split(struct bio *bio, int sectors, if (WARN_ON_ONCE(bio_op(bio) == REQ_OP_ZONE_APPEND)) return ERR_PTR(-EINVAL); + /* atomic writes cannot be split */ + if (bio->bi_opf & REQ_ATOMIC) + return ERR_PTR(-EINVAL); + split = bio_alloc_clone(bio->bi_bdev, bio, gfp, bs); if (!split) return ERR_PTR(-ENOMEM);