From nobody Sat Nov 23 19:40:51 2024 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 69A8019C561; Mon, 11 Nov 2024 11:22:37 +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=1731324159; cv=fail; b=iJvhCYgMF+V3L64ScGSHrzfyrFV6CzlHV7jMypV1p51sQyiy5S+TjsoZ+uw40lB6m4AxsFCKqkLg5e28OP2tyZgiDeQmK6YSWDyKEg1ytmUm5rUKjLD3xvaWZXojUXTL/KhODklJ7exk2jMvEXCzCULkQ+2iOqgMyJysX4oCuUo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731324159; c=relaxed/simple; bh=nzsCz5XEEpm86cJNR+kao2AMFvFvM0fEOkIS+JBMN5Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=jv8ZbuHFR5lbfGy64Ao5vCK+JkwCZVo9UIu2feV5A/YwKAB9JAjueHwzyv/CVE7pddqU27Nsv5iTw7HLMrh8cVqmW/y6eONuRe5XlbsQnb8Q8z1Wnj45NqtW4DlpPmvD37Ar4H08adIfkI6ZJi11+lbelp5JLP/aM9SZmgXyhHg= 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=PPMHz45L; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=XrfjzLOh; 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="PPMHz45L"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="XrfjzLOh" 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 4AB9smoN002344; Mon, 11 Nov 2024 11:22:13 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=ChAfyyuIaKBf4ykPWgO7t1wJJxxpAdlnX/Jyw4MXPC8=; b= PPMHz45LC0zjPspB01QBLfKP8eWHc5hiJvWeVzAJLS7365axNT9YyQIbwD4g4PtU Ap3Rdc5WC3UyT3XLpuMKfZas+pPjyzKdsw87jYY5uREo5lZzaRp6X2g7Ib+OFndL jb5Tfr/bGY0HRrapmtWaHWU4FQOjxIalc/c8lG1+qnPcHriXz5BaaAlmyS6dM/2n A8S1cG6l67onjKnF+U9XmtbUYL3I1a+uBROr98YGrG4D/Y1V0kxpdtqbJ//1ycnW eVwbVvtxtFFvFlsNgJPY73tEAkifnXXycpUMRS81AJhqpF9EZMvKvSzpSe5e0kQO vRIZcoPYxvUfQF7cqAcNog== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42t0hej7as-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Nov 2024 11:22:12 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4ABB0JNp023621; Mon, 11 Nov 2024 11:22:11 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2046.outbound.protection.outlook.com [104.47.55.46]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42sx66ntxy-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Nov 2024 11:22:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HrcX6jVLU4MZ2fcN+03U8Fnjy08L8u0mNIxLK1lJ2A47x3iz0G/MKxjrya98qUWAbL8xlMorlKn3TzVhB5At5C83bMLctUI3rGPWNS8FNAsoX4nsuEuTL2JjzbCmYrFddlLMartfqR26gUgJYo4kOjY7y48uUMLiqeDZRFaun0iigUiRpB67YirwltawpOlWVvMkkAgBxZDjkX4U3SD0c9+QCaq6ZaPIeGGcrfvq6vKXuoG2JxSxnmA5Gzv1mP1BQhTd9BBiPdViTU7d2ekZr6TGVPtg5/meeF8ETRtCLuiPPJ6CLPHDBZxj6yYK8KuEunVOqBRyJhamz4noQulZaA== 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=ChAfyyuIaKBf4ykPWgO7t1wJJxxpAdlnX/Jyw4MXPC8=; b=UrY0tDuc7xcrBoxDZ0/NgA2NUFwpgPJ96H00oMOSBUxljEblYcjJ56vNFyE5EgDzk5ouZPY8xg9JZmAkE/l+M7Oo0hfgAX98MQNPe6D6ijZybCUtwZiXMdtFoFPRTmAec4wh1z9GeAhJo91cr7C7f1xPXIdO26zEflPypTyRcz/UD8MCVqC4rN3UTxN+KE/H7Q0hxMbrNI6oilVlVFdVhf7tUClsJsODs0K4BpcdBe+7AIfxp5jwmo5ODsir+36pcgiDnktdRKGcupK01dWCx9DZAJdG/zpwLBmLOnxzXmxYBFNRkbhl1ksoJ19MrR9QQJxNUOlY/N3Wn69cz14xQw== 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=ChAfyyuIaKBf4ykPWgO7t1wJJxxpAdlnX/Jyw4MXPC8=; b=XrfjzLOhE1QAAre5ieEljzWlX1cgvdp0i/Gq7NtUJ1TCV8Jm/5GQClMG5ZK+mQd5R/XKWy0RIHGEzN7MdvvqgGEJpLxX4o53e2zLrToLOR7pYUl2Dk9lNSDtYIKNNQtTRIwnHAgYuEzcYgOQTmnrwaXqJ73WiZeynFWI6+YBKBA= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by CH0PR10MB5194.namprd10.prod.outlook.com (2603:10b6:610:d9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.29; Mon, 11 Nov 2024 11:22:10 +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.8137.027; Mon, 11 Nov 2024 11:22:10 +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 v4 1/6] block: Rework bio_split() return value Date: Mon, 11 Nov 2024 11:21:45 +0000 Message-Id: <20241111112150.3756529-2-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241111112150.3756529-1-john.g.garry@oracle.com> References: <20241111112150.3756529-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: MN2PR15CA0012.namprd15.prod.outlook.com (2603:10b6:208:1b4::25) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|CH0PR10MB5194:EE_ X-MS-Office365-Filtering-Correlation-Id: 0d2e7749-a8a6-48f7-5718-08dd02431573 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?OGzzXL5p422WznqPiLePla9ot70Mjib7Kk04UhbYGsCGy8Aavkle1iibXz2k?= =?us-ascii?Q?3HFlv64SpXJY5f4sfwL/O0daT8HAUAo8o6KUWVa4zNWG8sgHtke8Q6xDfqKN?= =?us-ascii?Q?6hrXZWQZykbXU0zyEV89FsYq+LTWQ6NwVi9Y9O64a2vpVU1uVm9PTSduigeF?= =?us-ascii?Q?zs+Vtpc3zLTKkRr5jd4b8SJjxB7k2pBNvyHc5WaBxF8kegIcP6Motj7M6fwC?= =?us-ascii?Q?J155ImoFxJVXBE+Da98YdAsSrfZFi6Gje6lnKXDv4uNnTVtvaYKAGl228oAD?= =?us-ascii?Q?s9h1mPDMj7ofgTz0qYcTrvTwARHrF3AA6u4kBJrK2veHDSfaQBGm+lUD3WpP?= =?us-ascii?Q?eWg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SMZsMtP127qUJTPp+?= =?us-ascii?Q?O+PjfY5ZBgWa7PJg59/kerimpWy/bDdhTqoON5Pi93qNA0UJ1ZInpfdPOppy?= =?us-ascii?Q?2Da0KrhQocTiVYrgizfKWYVC?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?5IhyUntmjc2ywRHmMQ7CKZuwI8I+6Lk3DavQ+Bhl0sbIjtTc5EpLWcsD42Oa?= =?us-ascii?Q?5FeiSZLms9Ymh9fkaebU4z2MCB8dFxT4KXJw63rl4+felIsJcoZQzuuB513M?= =?us-ascii?Q?y2CO4ZO1+6pR5XrQBOFwZ+bsojqAUh7wTaIFt3/Ld4O+YfYzuT6ceHnUt7iy?= =?us-ascii?Q?JN8HTHmgg26NYu34wEGUOOjs1F4pqfrhfjXznk3e8zpe3B0PxjFfl3cCD3YA?= =?us-ascii?Q?cno4HA2Wvv7twzmTmE199Wlpugsdu24321N+iuh1t2zhKMDYVPTB9CQBP7Mk?= =?us-ascii?Q?vVBiMnKU6+vF3kR/vPCPupDACG0yHTwjF6G2Sk8e4YsA7h4xK6qWOOh6vvb0?= =?us-ascii?Q?/xOrVf4gcysZyVzbMX8l0BPxc8a2w4DqfOhojHTAT2pPyS6Uroj0jcyR1YFA?= =?us-ascii?Q?tn/skTORq0lTUxVz72BDn9gpc6q63yLpjyUAgX8W0vT8ngVKEi0Q6AMtJErP?= =?us-ascii?Q?UOF48g12tu9yAw0I7VwgIarLs1GrT7TxwSppBwrZVmemsIp0Uiw1C+m1z74z?= =?us-ascii?Q?mXVHL9mFtv6VL82uneqFghiL3pWwV/HK9gVwlsUwtKYszS4BMcutPcMpyaPH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0Xnvnr6rY8gQe6fuaTTZdsxOLhNg/Z?= =?us-ascii?Q?5jYjA3EwaDKP+xmQ7BOtq//BMwsb7UQvbwMcFLG2KmvMXk1rbbwWWmJlZ8Xx?= =?us-ascii?Q?DlshGyWIefKiiDEkxVI/IzsfnxKr9qFaorUBTK0rv5YR/Ee9ts2E2zUBjkkY?= =?us-ascii?Q?kw=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: aF6KTgxY0Lv0/0h0E8LO5EsUgjQrfYIchULe2kFF15yeLAQ49etpmyWLzJlY3uodgY0Uxca4tXSmfKCaOGqAkX6Eko79rfytmKXmh4prNOztuwLt9SPqkRWgm6gtpj07/8OjSDlXYuNWIJDsnD0Q5lIMw3Ji4fYvCgEvKvIWQrtYKc7mdI1OAwMePCiJFt9S1W7ZNddhG5AIbsYgKC7gAzKCEhSWzcQW+1mw7uVtOxnTG/9JqXwiNZjwtIFw3Jg3cMUzEjgkoAMHByzv4HiGl6tc+9sh/ZaRMUg7c+JLPshthM/k5d8YPybnfNqs8zMwoDQZtqJwtFsXMnDHQSy0Zt4La5cE5BgKsNuNuBUgLzm7LaGX6wRYSsVXGQEc9Eh+jIVHV8Xnt74bPaR7phT1JQ+OY+j1xgZLcJYxxG65DilKdLNqW/tZrdwa6dgVbJxeoLeeKyfzelnQJXd82skoJJ5duaaIAQ21OyUq4E5TacwFzY2T9DPEtvoQZ2h83rPxLHcrJWCH+Tz0h/nkN2mx8Ob5vc1UOE88CHTePWIAMBB8iVkSjw2N6KIEZMz0YPWLtjXXXL84OsWk4/9NvIHLeCq8uT7DQvQd1bBN1PcZg5E= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0d2e7749-a8a6-48f7-5718-08dd02431573 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2024 11:22:10.3714 (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: 3cKxcdodmECnG9tr6cz66G3KGy21n3Ei9eB0GozMY54a2/yr9l5kGSXIjtSLb0kHaueDGBATSDrxLWLuy0S56w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5194 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-11_08,2024-11-08_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 mlxscore=0 bulkscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411110095 X-Proofpoint-ORIG-GUID: SswmFGv3ZnmsErlecFOTs0mQmN_FZ2T7 X-Proofpoint-GUID: SswmFGv3ZnmsErlecFOTs0mQmN_FZ2T7 Content-Type: text/plain; charset="utf-8" Instead of returning an inconclusive value of NULL for an error in calling bio_split(), return a ERR_PTR() always. Also remove the BUG_ON() calls, and WARN_ON_ONCE() instead. Indeed, since almost all callers don't check the return code from bio_split(), we'll crash anyway (for those failures). Fix up the only user which checks bio_split() return code today (directly or indirectly), blk_crypto_fallback_split_bio_if_needed(). The md/bcache code does check the return code in cached_dev_cache_miss() -> bio_next_split() -> bio_split(), but only to see if there was a split, so there would be no change in behaviour here (when returning a ERR_PTR()). Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Signed-off-by: John Garry Reviewed-by: Hannes Reinecke --- block/bio.c | 10 ++++++---- block/blk-crypto-fallback.c | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/block/bio.c b/block/bio.c index daceb0a5c1d7..948b22825510 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1665,16 +1665,18 @@ struct bio *bio_split(struct bio *bio, int sectors, { struct bio *split; =20 - BUG_ON(sectors <=3D 0); - BUG_ON(sectors >=3D bio_sectors(bio)); + if (WARN_ON_ONCE(sectors <=3D 0)) + return ERR_PTR(-EINVAL); + if (WARN_ON_ONCE(sectors >=3D bio_sectors(bio))) + return ERR_PTR(-EINVAL); =20 /* Zone append commands cannot be split */ if (WARN_ON_ONCE(bio_op(bio) =3D=3D REQ_OP_ZONE_APPEND)) - return NULL; + return ERR_PTR(-EINVAL); =20 split =3D bio_alloc_clone(bio->bi_bdev, bio, gfp, bs); if (!split) - return NULL; + return ERR_PTR(-ENOMEM); =20 split->bi_iter.bi_size =3D sectors << 9; =20 diff --git a/block/blk-crypto-fallback.c b/block/blk-crypto-fallback.c index b1e7415f8439..29a205482617 100644 --- a/block/blk-crypto-fallback.c +++ b/block/blk-crypto-fallback.c @@ -226,7 +226,7 @@ static bool blk_crypto_fallback_split_bio_if_needed(str= uct bio **bio_ptr) =20 split_bio =3D bio_split(bio, num_sectors, GFP_NOIO, &crypto_bio_split); - if (!split_bio) { + if (IS_ERR(split_bio)) { bio->bi_status =3D BLK_STS_RESOURCE; return false; } --=20 2.31.1 From nobody Sat Nov 23 19:40:51 2024 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 A52B418B477; Mon, 11 Nov 2024 11:22:28 +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=1731324150; cv=fail; b=UwSHsFColVg0rJ6k5QmhaTvWZIsE+evtVa3y0zGBXVqpr47J2tIPA0EGdfc6W2a2V6ryIukbIuBKltClIXdm9+M7pMXOzrAbWSJjKHpOiQblbPj9Dpnsf6evNIKSgUslzQ/58MTpgNZKNec9YA0gJwgwr5/Rtg8r9DaoiRZ3kgw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731324150; c=relaxed/simple; bh=/cHOfbTG835JH6CcIrHYYYWjHtICskM0tWppthHvILE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=SR+ziH8DMLOdRMT5cxOTkYg+coKtd7zIJ2ZxP8ba02wE9/Fh/QKZPvqQIJlbCQtj78ceXXgGfWLtE0IPI7QA5yG//cGelfYf6i7GePaqzU8n2mfozqn34hY/3RzTsPkt006qmduVj992fi6/mN5mMsjf25WPzLI9pSOKYIISIyg= 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=OYkMUqKU; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=SlGcR+8c; 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="OYkMUqKU"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="SlGcR+8c" Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AB9sp9g016893; Mon, 11 Nov 2024 11:22:15 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=YHu9JCA4EnCLsG+rZcsG2+5GuMDIeKNW2lw0WFo48B0=; b= OYkMUqKUkZ/9Pf5hafQ/SJCCvwm2cq4t/3J32Ksi32LYW3ppE5MTWTtSrFO1Zx/t gdm7w9Mm2pBram+9P53ze5nckj234hFvG16uexDMgN48NVbn3BpwcQ24L0EjdtkY kOG3DMSxR9H9EMcShyj4xexTolZkWx3+DDcgHpHBC36MoRbDIjncFq6HE4KdNr/Z qeyLoF0+PhXnJU43j6Bvfkrueroxy0MiTv9pqQPmMvAfK/ghb3F83FeIc6frzD3s hkBnfyclI7YNbsvNdc7xjCy15SSi8eUBnzkJpFKFOWUiBGYL4zl0csIS+RxBmG2O B2zTg2kMLZLNtrIukZnMtQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42t0hna7bb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Nov 2024 11:22:14 +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 4ABAnmBV037166; Mon, 11 Nov 2024 11:22:14 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2047.outbound.protection.outlook.com [104.47.55.47]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42sx66wt8t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Nov 2024 11:22:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HOJBBYg9735vAFjpGjWyzEMBPGRvlE0ajrJyDbFSLp/YoArmDPTbCO0I028Eoo2u5Hq4v7MpQmjq9yKoit3iG85j/8t3Fp9nXBGic+E4hH3ntW0cl/7qKh7L/DlA9l6aJeFYLHs2wPQ3LQmSRumUdH71US9ytIJ9m5OPiaHpqkmmV+WmtfKOWqOC/zrOcTcbk8S0JyRMODaC0lRL+RjX+vdSnkax9kn+zz2H/6NJHkdoawcCySfZyzaLlKQvTN3juDdGQmYaNIsKi8ZvJj4rMLLAnbtByTkWVt+52DcE51SQUm28dM17ZBlFsWQACtQ/UX4xuXGaZLU9n89ThcqfLw== 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=YHu9JCA4EnCLsG+rZcsG2+5GuMDIeKNW2lw0WFo48B0=; b=ePCSpx4tX3XahKOtN+keghepmwKz3/QmZqgIQSAVKJymTKBBVb1DZ2uMI9dkLFt7N/NXoScO95gR9WrTTAbrrBPog5exQagQRPWeKmGfV9kN7IPzu0Tn4muLU7gL830Nb/UhFGDNK2v9KPMa17pZukxlWxEvv30OlAbpH/EH9VljU7N7bxr/W3cqmH0zLO0dVZ+gvpDCPUC3UdkKyRZ2uHT10X1tI4kzVQehRbYagCmd9IqNDBkdjLlfx6tLvmuz9e56uoJWvxJkNIO4adFqK5pVL7pMA0PzYwzRfAdzifV3XVuPBfdyEKrx2oxacBVAe39T3++q9iEjdO6xK2cmpg== 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=YHu9JCA4EnCLsG+rZcsG2+5GuMDIeKNW2lw0WFo48B0=; b=SlGcR+8cFeNH3rplXYrQw1SQ5aio7jhIY3ZwNts6VTuDzRo+Voaotn8FZQSM/het9LK0K3eh34cEc3cqdMPRsaxMUFjCdJ9WzJohsVt8Bz0Gt5fwZrgH/OTboHN/QbyEXfmATiP7+o9ripo1wSQnlAAxqbfVf3kTTOka3Md+ags= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by CH0PR10MB5194.namprd10.prod.outlook.com (2603:10b6:610:d9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.29; Mon, 11 Nov 2024 11:22:11 +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.8137.027; Mon, 11 Nov 2024 11:22:11 +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 v4 2/6] block: Error an attempt to split an atomic write in bio_split() Date: Mon, 11 Nov 2024 11:21:46 +0000 Message-Id: <20241111112150.3756529-3-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241111112150.3756529-1-john.g.garry@oracle.com> References: <20241111112150.3756529-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: MN0P220CA0003.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:52e::32) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|CH0PR10MB5194:EE_ X-MS-Office365-Filtering-Correlation-Id: d3d1645a-1773-4eef-6353-08dd02431648 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?YSl55J6UbuNGpNNy8ZfbSuj1jQJ+Qikmth8fqyJG9pr6qBWF8Z42Ld8duAs6?= =?us-ascii?Q?e4/EiZZiRIFoZ3Wp1ZDxyyZRlzB0Ielm3WH5gCxd2IUtnt1zCLunIodCc2W2?= =?us-ascii?Q?AURI12Ul++cXOn6B3Ixse15PlM+ALoqDCsN+judwSAPL4A8bdttL2J22poEM?= =?us-ascii?Q?2GA3nw8wBP03+x24jUUcwWZ2emiwCGdE257XCd44lgbhFvpe85wXwDf4mPb+?= =?us-ascii?Q?EuYbw3Zcir7ABfohRZdn9/BlDOZdRgUmAhJ22kqQtpQoVPzTw1tcHvS73hc4?= =?us-ascii?Q?SXRckTSiSmpaXSJFHGQUaOsS513NbB0ZWvcOUfXWMPxK7jKoPWgyaWH4zns0?= =?us-ascii?Q?caF8IETgLY94qsMC/LWZV0cCNKvchlBWG6ZCP8JI+PS40hEivVHfkk8iZb0h?= =?us-ascii?Q?325QiTI4PrL7I+o8dplOvdoCFX0w/6IeEoDf0igqF50mwkVZc0BEMGieSSR7?= =?us-ascii?Q?M4Q9iRPo7I5CBy9HVZLncUl/g7ALFrAGmK2Tga+wMkzuJDz2EAoc5daSQNpl?= =?us-ascii?Q?hV7R/vR91sFLqVsidHKZ/Dy2d8CD0v24wsgsja2QRTvq3jtz/ZcEyxms7/l9?= =?us-ascii?Q?noqsJY0hfNqpLa3aGFOZymCcwQNhflsO09p17rtPOFxOMAoRYJ4SFqZ451Oh?= =?us-ascii?Q?tN90kDGBf6KVFbfqC3NCF0suU60rvaiMMvyVAchNzN2gMvLazFtRDCS2GK9t?= =?us-ascii?Q?UQWqftNMUKvTipg0HRFm8+Y1cbltUi8YhVsDpJvmEnPKTbnvHl52JtNOxk0c?= =?us-ascii?Q?JTRZm0hrYWRl/hKtIOwb9k4pnwDHnBxBDgYApV/h+ymZ8WS3Wm9OxossBYrU?= =?us-ascii?Q?JSlUe9BY+WcUEOqqmsRPdZXsaMvhCbUeMHzTjdQUFK1f9Y4k3zS6QeQKXxdK?= =?us-ascii?Q?TbPILn6dqT4+LhxoH0F94z54X+aSKXWhq72rTSzNDp33cno8m2GH3EbjICqX?= =?us-ascii?Q?Cyjz/7/XdF47WXjf7JDG+pgr6us7r7STGGjQ7rgzIRDoLpHArKTHKmBGubDg?= =?us-ascii?Q?M47Hawln7/2l5ImBHTYvU4/EFhyeigejWN2C21O9yNg/BTL5D+PCF3dHBqXE?= =?us-ascii?Q?xUFF4KwuWdnnQ7fWY7ceyCbHRuGxcM3NMfWLboK2pcUaoN1Pd7VZsyM6/m/T?= =?us-ascii?Q?Rnr/7fs46USeHCPhtGwBVPvbOnOuOCiqtmLVTqXHV8e3NmvNO5TGQTaVbu4i?= =?us-ascii?Q?myfe7i91GusJ0OT5o65X2+1Raa0+iZcX6EL8rx2ajlwuQZbSDdx+lBHu8efk?= =?us-ascii?Q?RGzliQ23XWdvnVpsrug32EiHNcLybR819q/rnoAaWs/NLKC9YgaYGgciLCb+?= =?us-ascii?Q?mXDeDJuBb2H6dsIIlta1ssX+?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?kx9DhU74V4cv0BPs8WBsREp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bFgbC5q3AFpC?= =?us-ascii?Q?jSHJp4T/adnmUDGUKhN9rwyPkfQ76hSCy0Jzqj+CQkuolR/kCgWBatkgs3SM?= =?us-ascii?Q?1PWIUi/BKv5yO+DZXJRLYfAME2bqpFr21PTBbYggm+pgbSKyc1G3eSUU2EIV?= =?us-ascii?Q?S5Qt9eu1mtjfR5+a9JG4yp1EW4uger3KacsCjRAHFfv3Px+p/XnKKMzhZCFs?= =?us-ascii?Q?DFIKvC40Mv4q9+aS2Xt/YsZmJZxULt4OP/WDZa/+W9A0u4zZdl0yDYkvTqbY?= =?us-ascii?Q?eOXFFtbkZ66JjLv/iKTXJVf1rtNoJ8il/JCJO/Tea+GebKq7JYl4jNUnLTFe?= =?us-ascii?Q?RxTpoxIOSIqOBi8WfKUrIu+D8dARMeS5J/y2STknjRDYy+fiVkSseQlCYass?= =?us-ascii?Q?0huH5si11hC+mnJFUdmTB3llyZ0gQeyWkgcOe+xT1DvlduYdDO65uNlwRIhX?= =?us-ascii?Q?iLkQ4x2OQn3cGGztxKFdoXWX5+c916a8uohiU94M1ULM5GRFcApgCCW1WwzP?= =?us-ascii?Q?mGxa/1cg8DwNNdOZCpJnWesbP62n9KKvpDZN4Z6Fn1uXEtZkAIJkKEeSofOE?= =?us-ascii?Q?2Y9Mi6dB5AtzMN/Cm2tj5y4GsPCaYQm1fAF3vW+fZDjzzuMD78uVAsUTSIib?= =?us-ascii?Q?OAyQmyW1J73P///+iCf2tBZSDFux8r+FNXfa9aetgemorZUpjjSdkj/tWYvS?= =?us-ascii?Q?DBzGliiVwRyM4QVu+GOtAq38HZZou90Vm9nNfIjtBsvqQbDtHfp0Kxz/VmnF?= =?us-ascii?Q?Rw=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 82t+fjaTog9BI6GWRzmoyclIjwMOhPbRKEf/ln7QApjQCIUIk4hinvWekxLbuOz7SKrzM8GvhW3O/YBBp7ab1rxQUhn11tOWsR/Mj5mr18UuSEW6Q3dPiI9qF17oLOwMDsy5HtITuufXB+jD5+cEP0RLbNmIYQ7geUBof8rH9V3foLV4oIBRd1a5YFDFuJdTDIPZgLY5tYraJft250zAr3I2Ssc+bW5cGC+fuEuZTZKoW6auR9TfvYhNttO/X0wy6HD9Igx6ZKnhAuvT+vIsDVSU1d7qWNn+xb34fC9R4OaN0hnSPRvHl4aaWMOofL5WehpL6QspQvViYiU6bIfIDkxZkznEuKy65xKFEbjL6YVQwyWJEhaCTgegdTjhS77pgxZml8/J8rkdkZ9QPffk27d+2mQVKEvA/reVwXeVtgGEHGDoS8JLsmZqr3E3+BZHcreTUQCUC3s6N+7DQDW7Zt5JfDeWPE3dn6mDSIjnniYODZ5s3qwgrzYN4IMuJu9dQwIJ/Pu8wlsbENvaw1U1uOk4HADSaJqmNdcvRgXYNMiUnKq+HjE9tXeY9OrMf5bEpmPx2TQTTrlzY3kF3krs26NI+EvU2+zQzvXhVzccA9w= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d3d1645a-1773-4eef-6353-08dd02431648 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2024 11:22:11.7456 (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: 5eohu50yRAWXUngXGBqp7m+nGzeU0zAjTSs2Uud0Ht2hDpukjnVwkHVGD5gSPIcYkY8WQNpfy6vb+RO559HQ6w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5194 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-11_08,2024-11-08_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 spamscore=0 phishscore=0 bulkscore=0 malwarescore=0 suspectscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411110095 X-Proofpoint-GUID: xtGAQxezlkusHtCxCaCwkqlAXkq1iVAA X-Proofpoint-ORIG-GUID: xtGAQxezlkusHtCxCaCwkqlAXkq1iVAA Content-Type: text/plain; charset="utf-8" This is disallowed. Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Reviewed-by: Hannes Reinecke Signed-off-by: John Garry --- block/bio.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/bio.c b/block/bio.c index 948b22825510..699a78c85c75 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1674,6 +1674,10 @@ struct bio *bio_split(struct bio *bio, int sectors, if (WARN_ON_ONCE(bio_op(bio) =3D=3D REQ_OP_ZONE_APPEND)) return ERR_PTR(-EINVAL); =20 + /* atomic writes cannot be split */ + if (bio->bi_opf & REQ_ATOMIC) + return ERR_PTR(-EINVAL); + split =3D bio_alloc_clone(bio->bi_bdev, bio, gfp, bs); if (!split) return ERR_PTR(-ENOMEM); --=20 2.31.1 From nobody Sat Nov 23 19:40:51 2024 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 11A8A189BAD; Mon, 11 Nov 2024 11:24:34 +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=1731324277; cv=fail; b=lzHC6Ba9tcadXAGuetS5tjb2NFwl+9qccTWZVCdfVYTwRTwOsd+s0m4/w8UrHCK7n9ypXFBGaM34K6ZHUn/R8Dz4tTrVCTvo5sUP8risEIfvKZBfLzF9mYiTktlwDLlXtzU4I0c3P1QAtzDyaryphmTedMuN5YMrdfn2DmRQA2I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731324277; c=relaxed/simple; bh=9p9Hf9mfZvHDuPIntFbjvs3Lh/e+LJ9Z0sTNZIxNTak=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=YK1sxjgUp3K7gN5KkRzVPfOLX+4nFrSRW6GnLdnQ5R77GJqvfrhqoO+D+wKRKJmUV5dyMsxiQm66XcIbL7CYFXtbqKLte+m2bkzxaPMvs0wman/l/DpnCSIkEImYDb6Yjjuvp2r5RI45LWI8z7FEqviJJ6dE5iOVakNesoX4cpU= 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=fm1DD9Qo; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=r38oIisO; 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="fm1DD9Qo"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="r38oIisO" Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AB9sqc9017741; Mon, 11 Nov 2024 11:22:16 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=mERBgal2NjUMyVe/2gn647OuzFE18WkFOymC5X6Nqds=; b= fm1DD9QoHRTS4j148ieiVyYoHK5Hegsa5xzkDZc8wg+5b9i7LXhfEUrcjRfTbQPF 6wef72uZItlTRl+sE7V7UVA8JCEw8Y9K0F5lpcZACT8/OLyliMERcaizdrvpPGEC eGyctVIyxyXthkWFo5/0Zor3T/dh9HsGGQz87wNRpK6dcGVvUj5y9RZbrPIvc3DA 4kCKqRSsK/v32ASBGR22W02yulHsTT5Z9o3jFRuK0XVVP7fCN/dqRj4kbb0yf1MZ vAZarl9VkN7wYb+LhKqgOmd69K1osbtq0etZ/IauhA6RonE46FzfrArFmrjfWPp6 3CtRsTTMYvPi03a1iXlIyQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42t0n4t7ey-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Nov 2024 11:22:16 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4AB9eMTs025432; Mon, 11 Nov 2024 11:22:15 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2168.outbound.protection.outlook.com [104.47.55.168]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42sx66tkug-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Nov 2024 11:22:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=k6EtvoeniMWPm6GjcDS8YxopBvGpJc2t19f0ng9ane+hqyU9Xsd1/lzbLUY28QqMfhlhHj3dwgKnRunbic8zOeaJzuJG/LC4zb/4uWRxpjPcVb+bXhE1MTCYg003xWeQnmOttY7rwebozemgdc6fEBDOEGzFt5kUnxwUWmkM1DUHz5DMZlBM04WbQUERe40nGaxYZk7zshvYp66tK/mpHjdwcF8jG9USDe7CIxZT9VgUSFrUZuhAwZXvP0a+qeYlnvMCsjNLAqP/OY4rEkCTb0V/mmYfFcsa3fQtYOavgFw6TRU2jUIGEOqGYEDuV3oJvbgTYR/BIOSDr8gCT77F4g== 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=mERBgal2NjUMyVe/2gn647OuzFE18WkFOymC5X6Nqds=; b=Wr8/SodxRk6HimI5QctQ6rghgpjzWRQbN7PVAnFWSmvI5Z9iztIb5O7PNuenej+NxRUgEasQJq3RcyUXU3W6uRN2N6+ry5Zin5Q+EgPrLjEt1VEwq3SmRz/oNt9IEWzecP6H2OnfEH9FMAVvStaCozi8Auv3EONjCDMYJRuWmstHV++bcZ7XhRSTksrjvUYgXKFv+BY0yHV8GlgLVT27m+nKyw540jfchq6r+mo3IZDj5vGGvj/IaNyMsUefHQHPUgKLEMFJLYoNj5r37Uu+a5u6/phdm8RELG1PmmXwOvEWEtlWpToSVXx/5kRVgePOoLCEFjbu6B6uE4SaAP70Fg== 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=mERBgal2NjUMyVe/2gn647OuzFE18WkFOymC5X6Nqds=; b=r38oIisOlwyLWGgbV7rNOEtRNaUcsH6vPzWKZwubCirqruQshpWpwwEvmzSwS7D7Jn0O2mZQSHK/f64FJYv+rRVj3Mh4ivydkBc88SgAe41FsqS3h3Ykam1kcIgx8AYWMP1vNm00rWuuqTuInYG++PQskJWn9gyg6tafHLew3Ok= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by CH0PR10MB5194.namprd10.prod.outlook.com (2603:10b6:610:d9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.29; Mon, 11 Nov 2024 11:22:12 +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.8137.027; Mon, 11 Nov 2024 11:22:12 +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 v4 3/6] block: Handle bio_split() errors in bio_submit_split() Date: Mon, 11 Nov 2024 11:21:47 +0000 Message-Id: <20241111112150.3756529-4-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241111112150.3756529-1-john.g.garry@oracle.com> References: <20241111112150.3756529-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BLAPR03CA0014.namprd03.prod.outlook.com (2603:10b6:208:32b::19) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|CH0PR10MB5194:EE_ X-MS-Office365-Filtering-Correlation-Id: f3d8a859-24cc-46f7-d420-08dd024316f1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?wV/EBDPSZE/IRuWoCra6DmCoZElOy0+dVnE4wHbNRS59Fsmbxc+PDb/9aW8s?= =?us-ascii?Q?I5+7g8x6YVMptUJM/tevTmZW1JoQjYg/utt/oPDijUo5VAmmTwJAsl+DGay0?= =?us-ascii?Q?Ygb6tEzzq1tFhhrzo/kxKI8oHNAbDN6sPl1CpSSRpIE1ygp9lppo3Dp9QoBn?= =?us-ascii?Q?RaXwObrZ1xySi68REScHOgCmgpIwFVJCvmuyAgHf3UU2hmh6NhXrsxHMHTT0?= =?us-ascii?Q?quyPAIEzZx1Yqx9VQAKNcdDHhtuP+HgfjniH2SaqOcVVdWAIARBvs66BBgOz?= =?us-ascii?Q?borFNHCT6u4afTjSj9iswEM69I7aIwZ4LROH3DlI5LzcYN7i2ptOVf2rAoVS?= =?us-ascii?Q?shVZx/ei/eux8vtR6b+987X4d4OQFsghZz2yCi/Hx4xXxyacIN1rUNPgJTFM?= =?us-ascii?Q?rW+Qd9AyJDX0NJQa+n7vFehl8okDZ0H11odvyoMIq22plU+ChZay9g7XrttQ?= =?us-ascii?Q?zfq6QhDpTXeI2e8cooATTiUoDzi0Sv3YnYC4K5N60MBIT1HB0K/glVnNb6jJ?= =?us-ascii?Q?rPzYs2ViiLgSpMHctHKe9KF2NM7iSALQw9zwgwXJwlcNgPpQGMme/P5QSRL3?= =?us-ascii?Q?SKfD6lDqgZOgAsggyAmvxcIjyvCT0foKAT3FoUHUjjgVICJAftrY7KoNY4Nq?= =?us-ascii?Q?moM4CK53g/dMKLgzbaJGp2Hs4uATciy0fwkmRwIols5FKwnZ4b6fOTbWBbLn?= =?us-ascii?Q?LXREygvz/HIg/pGz5YzjAOhCm3FhOeltW/NEaabKlcmIA36S7tpOk8LM36O8?= =?us-ascii?Q?wwbZFEADZApllnerfg4gL6UwkRszb5YE7zTRPNZ7c/vgXVEppF6AenSat2Q4?= =?us-ascii?Q?ppkjalljWM09F4dpIdSwLgXG+eF/fiGPsPJEIhVmvZqfd8VxSIURPqWYF2TE?= =?us-ascii?Q?n3oF2tVdSK+iQa0H1rrbDuNnEBDRGzUq2yqE/KsMWTO/XgvpVRUYxmUZJBdJ?= =?us-ascii?Q?WFdXThzag7UeeG1m26e8lGLVr5yGh7BlwyHjVUTyX2EXjokKViSiptUlf/Zp?= =?us-ascii?Q?LUQ6FsRiQYV5V3g5RLwdqZ1ir9JErXZbL+QkopQ8uU+090ic1BX82kMx1VtX?= =?us-ascii?Q?AVfN8vfcy6A7V9tGDS8WKiNgbcd9BHCJqVZTm6eenVxR+QE5UftAf/UTBGP4?= =?us-ascii?Q?JtIgeJTZQBw8lXQRP2pmD0N1I8ctsfWL/6+aCoN2PNhewdtvLxge/I7Zjsaf?= =?us-ascii?Q?2mpe3AV/8iEhLBCLX/pVm4eZZtMayscGdIxKWWQ2bn6TEfTxLB07/npKZRFA?= =?us-ascii?Q?egSAD+M83H0sWKYOMlzJqR7fuxUY7krDjqXOWhQmd2PMs8HDNtc7A+taRQzq?= =?us-ascii?Q?ANQ=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?uu6njKJIvZ1H1vSDG0DSxs+3o0SDl54Ycxuea84haZPyR2X4s4Tx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7Wa2w2KnuI1aRq/HVHc5ikqq+jzlTH/AkxVLavY9jEbGs1L?= =?us-ascii?Q?3T6ete+ldO0tnyUo6e1LzLdiaaCgiFGymn2SqPRuv8H2hFNSNaz1zJZLM65q?= =?us-ascii?Q?l2LZfociVq+omwRzSzwGhbaGUIh9EFYAWU9QU9wiSq0uVQdZhq4v3cWoH81+?= =?us-ascii?Q?H5CvkbCh9U3+6Sin2Gfb1vv5uJ7a9KOyVDNMZtX5djvyKpizRYHJaioTnfNe?= =?us-ascii?Q?CSk2lxNDHaOb5ifSLZJVyjzJJZFXjxT+YbylmHYnQy+kh2UQi0iQBke9FSjR?= =?us-ascii?Q?HKytP+A+rVrAFQq4bcxf9yQnDKRWxe8JQsbVst6spDFwQ/LSNhnf4psTZbbn?= =?us-ascii?Q?rAT11cYlTHuZOxl9pQYQKxIUfysMDBzKSSn4NFzuU7kYSxRe1sOWlZ3VFYHo?= =?us-ascii?Q?lJo55be6sdG3w7rwev0AuacFKWOmj/1OsDATxoqWmbSX4bkvPcnmfgp/JLIV?= =?us-ascii?Q?trz0M/dAM/QbG/6X1gPiOHDF/xum1HoDrG2VR+7HdawPZwUnkJoroJ8Y1uVO?= =?us-ascii?Q?8XZGs7qPpwRVYeM1H+kLWaCTdzzen0ouvJvormTTA1NoBMkwbu5pxF+CrImn?= =?us-ascii?Q?T77vS0XFykZpldMX/uiSDK/U51tdFl7UsHQFfChVcw9VV1gDSrC5xfXmmBEC?= =?us-ascii?Q?PB2651ZaSQHq1+EatLUfg7ckgxNYG+HDyDgbogbOH4h8AYXzgD+aNUXEjGY+?= =?us-ascii?Q?WQ=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: kldapGGOPAxKvMxgEugL/XOnJ7JX9iIgkqFMiprKfkcY5LfY+WLBPPRQeuqJ8ZJS3wU5DZqSSyw2ILnxDsDAVZUtX/n/CXL2Z5xmRQazwn5jVdoNLjULyZkJzFJmHcjG7os4OQV3YMLQePkS3hYwp6CmGTVqe6bWWwa8V+oTV5kuwBFrP8bdL617lLEH0bE0qk1e0ebYSs1tN8I5r4eNqsvXPD+AgH8IvrhrqkjDNER5wVfHmS9l0/WCM4gOqPw8GF9FPLIqcJU7IYi2cz1rPO6IKztgYLVJX0VTkT4+cJT5MhNxb0fpXt5mHUNpYrpcvDmCXsypXSBxDOSFL/0J7INGFxy3h6VCILMUJ1hMeG5iCYFMt9XNkR7JsY5gZFd+iiba74Uh8K4eqzR4b1g8b9zrVoPSfCl30EWwULQyAzcfWH+OS2Q5vw4pn2DSndT9dWQwPiZUvntvlRKejX+enf4vGkWEFEzb2zuA3cuBe7bQ6cH8VfWDWo8fJHWuSqsKaOx3U2tLL2EAlSxdWnJtlA1ul5RLJK0CYvVDrzbBEUCHRrKVBPInt8Xa6+YATKTiClC80N1LmpXoyiAW32WOPRTsSeuOy4CmsAdc2s33xBg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3d8a859-24cc-46f7-d420-08dd024316f1 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2024 11:22:12.8584 (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: MP4Y/LwL1VpE4BwlLaLaKBWNWyfQXKyK3NRMsO9iwpDTdt768y9bm3ghyY4D4bLN3CVn7nixyokoKopGCP+IuA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5194 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-11_08,2024-11-08_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 spamscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411110095 X-Proofpoint-ORIG-GUID: u8JyW6NxuSyzZBVfSduRGHxWlGz04SZC X-Proofpoint-GUID: u8JyW6NxuSyzZBVfSduRGHxWlGz04SZC Content-Type: text/plain; charset="utf-8" bio_split() may error, so check this. Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Reviewed-by: Hannes Reinecke Signed-off-by: John Garry --- block/blk-merge.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/block/blk-merge.c b/block/blk-merge.c index d813d799cee7..4cbccdbba638 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -107,17 +107,18 @@ static unsigned int bio_allowed_max_sectors(const str= uct queue_limits *lim) =20 static struct bio *bio_submit_split(struct bio *bio, int split_sectors) { - if (unlikely(split_sectors < 0)) { - bio->bi_status =3D errno_to_blk_status(split_sectors); - bio_endio(bio); - return NULL; - } + if (unlikely(split_sectors < 0)) + goto error; =20 if (split_sectors) { struct bio *split; =20 split =3D bio_split(bio, split_sectors, GFP_NOIO, &bio->bi_bdev->bd_disk->bio_split); + if (IS_ERR(split)) { + split_sectors =3D PTR_ERR(split); + goto error; + } split->bi_opf |=3D REQ_NOMERGE; blkcg_bio_issue_init(split); bio_chain(split, bio); @@ -128,6 +129,10 @@ static struct bio *bio_submit_split(struct bio *bio, i= nt split_sectors) } =20 return bio; +error: + bio->bi_status =3D errno_to_blk_status(split_sectors); + bio_endio(bio); + return NULL; } =20 struct bio *bio_split_discard(struct bio *bio, const struct queue_limits *= lim, --=20 2.31.1 From nobody Sat Nov 23 19:40:51 2024 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 26EA119C569; Mon, 11 Nov 2024 11:22:37 +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=1731324159; cv=fail; b=S3ViVkn9iMlWe34UM2JjMeOsb166u191bRoej+XHWsASqeW/mVsKa7TMoDNojUbeVPHE06j9LQYgDNTuGKFnmqf7EZIU74eVaw7LgI6gukufPFOPOQ9RoZo4so6YmU59vnsK8h9ZN1S3UZl4/+8Q4M601AoCxmDOUOtMLhHaXuI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731324159; c=relaxed/simple; bh=YgIWu+gRho0DWVFHIS1ep9fWnuhXwjhXBFE6/KiX6ao=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=qhT6/vO1RSb3rrHORthpsx5c/360NQA9p0DYE2GgnV2VA5U5jEFN+STm9pg/FwUR3IDCLsyOG8+4N4GrEp95F19+1LIKdcyiPolUmnOSrhMijRs/6lvVgAnhdhh/0gJTy0SzKv09axjSzIWkeLql7kdbz0PfM4WYzE1+HKg1/RA= 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=VOpxuRix; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=FAPaUTxA; 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="VOpxuRix"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="FAPaUTxA" Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AB9soPx026311; Mon, 11 Nov 2024 11:22:16 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=KhWjyQCIdgXhGu+NFJbChwjVKIMzf483Wrsdnuia4so=; b= VOpxuRixgDabr6AE24E0Sm5ULwlO130rilyMdm+tV6Ezdq3X+bm0/IaBL0LMhpTU dE0C1omdr25cidxN3/NLe21DzJXt/4RSlsuAP9Z2kxhPt2pkvlF9+/o1PQplhU6O MSheSVHWovieci+jfebn+MwF8hlEs22IA9K/5y1esS6snAo1sgWoaNBpyGYMriQs Lj5Gf9Kzrxaw3W0fSTzZ1CNRSqa5/cOpjQtMoon58xiOFF4lOyXP1xAfW2ldGo03 /LgJEtEr1bwRhD+H0TQa5RJwXf4ChLeQkK6bgsQ5nEOJDo2jeIsJMdNOmQhf9oFk /OHiyG5JBMzaFLFj1rCrig== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42t0k5a75x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Nov 2024 11:22:16 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4AB9eMTt025432; Mon, 11 Nov 2024 11:22:15 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2168.outbound.protection.outlook.com [104.47.55.168]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42sx66tkug-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Nov 2024 11:22:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lBmvqaixvvZ2CqMbxy+EnHK2Ulo9COHZsniwopY+cJPZ52yLRFb9sWG3oJip2aGL/uaQQ0CjDRlcvNfWNe+ogPHSf/5JBNohC9AX8g2xabuclqc3xbul+6x8xsvnHzUExs1wbVcrZ7y5Tc3wUrxIIHKwUvqiM6F/PNT6xSGfts6GGHmR0QxIRzKcYubBYy7UDj/9oFacrrz5qUsAbmkSwGTXIL7qKcmyPBlWDXas/uq7wnLiiKc9seBRH2CwaWWQRTizeShQDhWLNPC6L4YAeoPb6jMQcHK7la4mM3TlkbGID94lKcbk4WRP8/QPXK/cj0IlMo8PpghQM+JH15wUcw== 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=KhWjyQCIdgXhGu+NFJbChwjVKIMzf483Wrsdnuia4so=; b=TzoIh5J9qgu7FQ1GCyveffDsnc+01ajEgaFUo3wOGTKR0Dp7o+aF3zGxBEgi3t8Zq6owiytY4bwukAkcMU3wC2IhwxHZ756WN8CZA9iu+EnrzublixcrwZ3R/YS9/q9iGbjS6yHkHpdmlwJvJr9iMD1E6EMa28OnaCPVvo/rxg5iAwXN8kloffPg6LxKuGoYZaVy3zOOGcpdTtDyr1s25+bCngwbOtGAiAMaEW58jsGvIk3QFvGAuMTzNI0jMyAaC7VeTThF3yKzrL8JJT+sBqoskdKoGZIPRWicllORjEd9wmug0cJpBPuzZLRkEdx1g+B6xNj7Bu/UfKJh2bmamw== 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=KhWjyQCIdgXhGu+NFJbChwjVKIMzf483Wrsdnuia4so=; b=FAPaUTxATuneP4wksfDhDWOnDy4DT3y3IewhpY7GzdwOScKQiGjP6UOgu0jbPyCttBRYisCSCJXWqxeeSa4b4q+74NSyFZ+RVx2KBhfDwXl7ykTlm6bGkMSVXmL3eFyYT564IZMc5fDmczMi+AdVyrkjDXzTQQYapPdupIdqEfE= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by CH0PR10MB5194.namprd10.prod.outlook.com (2603:10b6:610:d9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.29; Mon, 11 Nov 2024 11:22:14 +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.8137.027; Mon, 11 Nov 2024 11:22:14 +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 Subject: [PATCH v4 4/6] md/raid0: Handle bio_split() errors Date: Mon, 11 Nov 2024 11:21:48 +0000 Message-Id: <20241111112150.3756529-5-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241111112150.3756529-1-john.g.garry@oracle.com> References: <20241111112150.3756529-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: MN2PR15CA0026.namprd15.prod.outlook.com (2603:10b6:208:1b4::39) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|CH0PR10MB5194:EE_ X-MS-Office365-Filtering-Correlation-Id: 4809d5aa-750d-4f7f-17c6-08dd02431796 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Kax0i7Uy1z7vfeJ+rUw4yakoxrdUxY0/AqzlRMQHdCo7PYFp64OzBDhVKvV7?= =?us-ascii?Q?Oa9ELlNYQ17QxpybK69QWfZ/pwWLflVReBRoxaPOpQ2bYYlk+Bl+FE7N+APd?= =?us-ascii?Q?SAbG0k7pgNN5PvkoG9w8HCdPE5imc1Px3Aq5y41Q6a2V81BTaXRg42okgHys?= =?us-ascii?Q?tpChrD4I0w0yVv8WHvTeQSm/OwE2HeDneCi6SEi0azw42jG55c27cd/bgeXQ?= =?us-ascii?Q?JoFPa3NU2fCjLNmf15zAkEaUvtJWIfienPI9HhSVlkBKzjVWnws4OyMRRMIM?= =?us-ascii?Q?WHeIthR7ndOUCwlZCXI1i6M6pfFJiSnyXKIkSTrRiS7wOKZM39yaI3ztLiKo?= =?us-ascii?Q?4bxPqnyB6wxGjbkrNKNg0b4jHJpWgnUMqV/Y9XpubInj5w4u9er4BmfEU0PB?= =?us-ascii?Q?0GPs7hNiJO26jB6dTvwGeNn3qoB5Q+5bYB0SISwacftGMBU8Wo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am-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?CcBF2jlEzfsGCt1DBaveE62T8pnQZ4bH8BLnwV2BCW5QG0DLqKyxpwdWdT0X?= =?us-ascii?Q?R380ETWwwhvXbGD2qPDyhXTR+wA0EVQtUOiIAhdxUsU6bcht5WWUaYx3bA/p?= =?us-ascii?Q?84FGNrgSvfREfz6kZNgMsyvx8dZ7kb2LNOD00EmnpU7IvLWwPwy1spl8p/Zh?= =?us-ascii?Q?gAe012Tb3WtPDZRpN1nh5oppVL770nd01pkkaK1ezpaCSIWSGiAfhPD6yJfY?= =?us-ascii?Q?GHbdnEBc3hhVWAWWXX4StXHk0b8sZpkalO6mUT7RiFGzHpv6MFWJNCDyXdHb?= =?us-ascii?Q?TlBmpoh6cgtnVnWtKLna1mvWa9ApPiisMTUPzDiGUVFfrk1OceuMnxn4RAzV?= =?us-ascii?Q?eBchJCiXcPq0Pnrzwd07jMB+x1PxhWVNTi8ZhTkmWABA9rwQ+arxIGEfC58x?= =?us-ascii?Q?xavIqKop2Z9dxDVRmMT50qa2y9L/MuPotvr/+vusozqjGUmVp4NVeHKuaw7V?= =?us-ascii?Q?7dD4oxNfwWGnpA6X+UvHhg1EqeNsnv61TSclaUScus8wIGlyqtYKjVP+h4Ul?= =?us-ascii?Q?ycmBMa+WGoHMFwa49bM42IM4+dvMTJb6v0GMvDr81ayDLD9fzXWxu8MMN49Y?= =?us-ascii?Q?GzHaKyWsjyDsjt2MEBH7EEN4Ja1urMH8nbnExKO5pEnE5Y3WeiLrq4j8lDn5?= =?us-ascii?Q?8Ex+UpQzn1oXz7+7d9Kk87Ef+aQrgrHKqAukbg5A8ur+Tewe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g9iBvAAEybmDIOGoM3RThXN9aVlgaGa1w4dfaV2nnEmSuotNrObqrH?= =?us-ascii?Q?6g=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: iHCY/c8JUJQhkAIOC1ArtkLD9jcZdwb4yZyuhDulFVpC0m7TWtwJQjxGHAnqxwR+6KpPn4fVTBKUA4vr/5qF7d2UihfExi6epPohK2We3OxpkimrI7M0JmWSYnE/Byq8fdjnkPwKRjenaGRuHsw19scJvdLIKP9riA/8sggvN2iyDFPdzok7fGHD+GLX5Wb5sMCdX4q4hREiM/kzbD3KsQ+hbwJnKqrjAKtCUg9T32Ho9MLL4e/8Pxrso88FaDu70B5BwuzdtneWhOT5RXv8sfxL/KH/yEqondW7zHk2dS6riMRGS/HmKxrtE07gzgrfARbIXFHVadAmz8aUu6MtrORJd0CN+75XRfLpIlvO2SsIFol31zd+qBeyPb0Gn83p7NghzdXH9/+VuyAuep+VOgpCIQYQV7Ozz7wHWRTK76F2SQneC8GW8WsgsMfZ+kKg4LeIVByZcD8Cf/0Wr90lfQ2dLgbewBm4zqOJHvktw/3MhrNjMKiYJyFZTseYmrtfHmYP8V+87Pw5835Mdh+bM537syN0ruGMCdrYZmBlYNvmok+Lox1nPYlkOhqdvw+ilgdIeE//H6OfhlE4IyhyvJu371pXcZd7Thea5DQtidg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4809d5aa-750d-4f7f-17c6-08dd02431796 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2024 11:22:13.9476 (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: DVXEvTWXeR2+WEhlGakkwDWFa/nRlu8BQ2a4h4HpHrRFLOKhytI01bRGozGk+rKYkCIH1lw/KeqBXQp2S6JmFw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5194 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-11_08,2024-11-08_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 spamscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411110095 X-Proofpoint-ORIG-GUID: 0lsFeLWACn_5L37U37hdH3sSjtfrR0DL X-Proofpoint-GUID: 0lsFeLWACn_5L37U37hdH3sSjtfrR0DL Content-Type: text/plain; charset="utf-8" Add proper bio_split() error handling. For any error, set bi_status, end the bio, and return. Reviewed-by: Yu Kuai Reviewed-by: Hannes Reinecke Signed-off-by: John Garry --- drivers/md/raid0.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 32d587524778..baaf5f8b80ae 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -466,6 +466,12 @@ static void raid0_handle_discard(struct mddev *mddev, = struct bio *bio) struct bio *split =3D bio_split(bio, zone->zone_end - bio->bi_iter.bi_sector, GFP_NOIO, &mddev->bio_set); + + if (IS_ERR(split)) { + bio->bi_status =3D errno_to_blk_status(PTR_ERR(split)); + bio_endio(bio); + return; + } bio_chain(split, bio); submit_bio_noacct(bio); bio =3D split; @@ -608,6 +614,12 @@ static bool raid0_make_request(struct mddev *mddev, st= ruct bio *bio) if (sectors < bio_sectors(bio)) { struct bio *split =3D bio_split(bio, sectors, GFP_NOIO, &mddev->bio_set); + + if (IS_ERR(split)) { + bio->bi_status =3D errno_to_blk_status(PTR_ERR(split)); + bio_endio(bio); + return true; + } bio_chain(split, bio); raid0_map_submit_bio(mddev, bio); bio =3D split; --=20 2.31.1 From nobody Sat Nov 23 19:40:51 2024 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 E1E9B1991CB; Mon, 11 Nov 2024 11:22:32 +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=1731324154; cv=fail; b=X3RfZtY/575nS9DeHmRdi8hrXlK3NfYhB1GMZ1Wq0jeTduS95shJEGfwZZbB76daYvPCf1SXKFipyoVDzEpGWEr+4p29chj0FSYrS7afPHkWmVEuIUKgHwWSqGgL19rRZEHkZ5oMhsQtKbDGiebugH1h+iSn8B+dg3bRjswBR9c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731324154; c=relaxed/simple; bh=O3v4Lh0FMLcYn2uY58xLZMnq8LdsAaXA33qajPMvJas=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=MoIEgHAKvWh8QaMSCTmkPKPma86k2RUgW8Z/i8naxeR6vTOQeZ41UPIzEp9jJy7lxSj3GCAQVQsNzDMYCaxgI7gBa3hPYEltBWRr65gJQamw0ZHcGr9WBZw7BEockHLFmHDXOABQODVptO95EuYtiKEmDDrflivgY8szXlis4yU= 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=AsEFN2GD; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=fom5Cgwj; 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="AsEFN2GD"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="fom5Cgwj" Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AB9so2G016875; Mon, 11 Nov 2024 11:22:18 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=IaGBlRkaNVlDb+VuOsFayU1qabt3CslcEd2H7HvvlzA=; b= AsEFN2GDBkFAoZg6joZzB25sshsga2h12A7ePFbk+f3hX3P0TAxIjJeUWXGblpc4 c5FleTKEx51siwkNC1/jxDhR98xSA60RYWDKTY5W9wcvefB9QleeOYdLc42pxYlX Odb1HmyrspuSxhv0tmuj6ZYfsM4ufoTxo3fJzPorrgd/VoKIW5z2NehlAAnMrOZE ciX6mbJIzmSFtvfqWWd87RXEWZtx2+UI/qM/hX3yGCJ8R3NOV2B1EX9KYCV3xL+n +/Uygvy2N6c6TI7mPiDZIsW1sls5SvpKIouxVJNetBlGhymfaToNbsYHaMaQDZv3 D43B6Xp7J+xGenMYRkR+cw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42t0hna7bd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Nov 2024 11:22:18 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4ABBINoQ021562; Mon, 11 Nov 2024 11:22:17 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2044.outbound.protection.outlook.com [104.47.58.44]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42sx66p8te-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Nov 2024 11:22:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eiAItwgoXYyPkTclIqXWk7Kt7m1mL3JQns26q7+D1eB8oOuRgJZfZYAm3gnwkhR7GT4fdcdUTl3AO5AWgw5cKtyCZGGyRYlLYJS1RpWRKt02OOZfN2ksgwtBvySKTBPSI/U8Fa2zLIWETnF/a38UFjbQbyPAFzqjlvWjX0hPKZJz3LuEyl9VGmgPLxnDKGKuGldR6Xs+kcnhvZ90NH9MJYzGF6+kFTS1ey9zw76IXIwt4aabdJyfEvOYdu3ywH2MdDHvp6omEJdW4nwxusakGSTGJcV91T1i5WtIbzglPZooHvw9RNisOasqTBK+UHUkE2tA0NzgfXiTOcsiTFmOTQ== 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=IaGBlRkaNVlDb+VuOsFayU1qabt3CslcEd2H7HvvlzA=; b=QgcXgy7TIJGFOhCkjCW8itOjm6at2FQqyRzOKT4o0kryV5JgA1Hn1JErKUZCu7PT4CwlqaYT1kbSdYiB96DOUGg60G37zSKhmLUWekwwkSkf7DBripnFBf59GrqXyzsvmuASdjDuLqkB2H+NRpq4jQoHXcvmj0+eDFtOL5C6APA7TWh2XYulHclp6aBAZD3qyUsPPRPHvaKRI3rZ77TOWpNyHSYy6gSrT2y2MfjK0EQUPgYTpnfneBwKHA6hCENaD6YTih+eNte+YpS5SXUJ4JW8ulscp8C68pmZSn5+EzNZfh8rMPcw+OuOHv7/XdLFS89Bge435E1lmhNS/rdGcQ== 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=IaGBlRkaNVlDb+VuOsFayU1qabt3CslcEd2H7HvvlzA=; b=fom5CgwjMN5VaB/QxWH6onGtkgJtUXuJP2XYFjQNrEfC0FsQbXJVDCrWxb1p8r4HpzJ4q8u8gsFoF6hyCFAomhDgag+jqw63tsRG8t893/uBm25MfEeD7S5DnhWhQUVfbIyxNF1iznVr4hSo3APE1YJd5k0C1DI61ueaMvvwdWY= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by CH0PR10MB5194.namprd10.prod.outlook.com (2603:10b6:610:d9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.29; Mon, 11 Nov 2024 11:22:15 +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.8137.027; Mon, 11 Nov 2024 11:22:15 +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 Subject: [PATCH v4 5/6] md/raid1: Handle bio_split() errors Date: Mon, 11 Nov 2024 11:21:49 +0000 Message-Id: <20241111112150.3756529-6-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241111112150.3756529-1-john.g.garry@oracle.com> References: <20241111112150.3756529-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BN9PR03CA0460.namprd03.prod.outlook.com (2603:10b6:408:139::15) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|CH0PR10MB5194:EE_ X-MS-Office365-Filtering-Correlation-Id: 423fc276-2d64-4e48-f236-08dd0243185f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?5AF7vbeC7b2+1zkOe81FQvVy0tpq7VlAlK6RX9cTdl6W8/2a6BQ3WBPaHY/M?= =?us-ascii?Q?T62Y2GfnnsbYW4ed3pKNKu2mH40Kw5ZgtV6M4Bup0tcakbuzgUq80JRWeply?= =?us-ascii?Q?BnRyJJ+nHLmmFokq0tGZ6BLVypjA68pSVr0sHmNjzI2tgpSrNPXbCnicIldI?= =?us-ascii?Q?38L9f5epkJm4SA4Bp7VB+Qnzrvo2yKnWE+xFbaE1+27/ezkZjlxIVRToNs3T?= =?us-ascii?Q?mMBU6E88g7WfQ4Y/7dpvpCIdlYoDnKgy+fO1cXXnWTrxuCktfuVKOPcV9N7v?= =?us-ascii?Q?ayB1ScFwSAArR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us-ascii?Q?DR0x8ztgTpEKKbnTju4BUv9oeGOl94zcDV0hhShWNngZIyKd/XLGA8x8EU+4?= =?us-ascii?Q?a2BfewPLviKRdCYskG++Su7x53MQXKv+NsGUSOSP6Hxu5dbZPZYJWc58z6NI?= =?us-ascii?Q?Jm3ckwWoIJRB0X2j55c38EaR?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?7bRY0OONuFdxsnsU9EqXWTFAHYICFK+yD16VEol91SbW9Bm0GKzLZ0da4Rhf?= =?us-ascii?Q?ygF+HGSSgmzFWgqN4b4B+HUZsIgBKVOIK/k4DSpFjXlO2x8sX8Yzl63hC1w2?= =?us-ascii?Q?PKHXaKhz8kAXAUm0fRe/wqU3DcuK8Cj2ryEextDbutKkMrXajTDq5aOP1QW1?= =?us-ascii?Q?tIB5QBfhRzNEEHbyOnHlga8598CAWSo2oZAvn04t4mFQB74fLiDSWfbGdu30?= =?us-ascii?Q?BjuxIYuj/PavLRcIZGlYccop4syXagaXAw25x1desnpL0WW7u+zlyONyI1i5?= =?us-ascii?Q?wVvktTc7FLx51dDBb1o3i+eVpZJKeKFl2Pr2719n7F/9SujJs669SjRqkNWD?= =?us-ascii?Q?GItPhh2plRIdFefxMorOKqnuBD/6t1IqLuH1gjNNi+ZNCHe9NrFCYqjXZiF9?= =?us-ascii?Q?V/9AFcck7D5j1gdri9Gmybc7hP6YE60+vOKkMkN9EJmxAYCEhZrLrYsApv/I?= =?us-ascii?Q?Ogb6XRjQvKqqfRgpyb/nXCiStEera7Uft7hheT2uvy3WC3oTkHCGTAaTAOnk?= =?us-ascii?Q?74uq4Zif5EZDG7re1mqhJ5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Oo1o94zKcVe4dNQ56JW0J0cd+FInpa1YA75V/BNr+JFeGMiK8EKpTH4G4b?= =?us-ascii?Q?tMJqSmCly+iLcpFepUuQgz4mM/bRPDCOMMw/LO75gNPI93CwgL6QkgTLV5WB?= =?us-ascii?Q?9iF8SxplXIvSabh8OsPZb6qxKRR5bMMGzWnfw3S0wWc9W36b8DxTrrOoFQ1G?= =?us-ascii?Q?bw=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: HBmzIA29tE5L2DaLqYyRimu1vh0zlDECFWCLkjPR9X9ennA9w64eHudcesObN3IThKHOPFPsCiazdvP2BBuKrWtTBmXa74ZtEeYkhfRLz6BiDoYp6kqSh44ACqK/eBR75/xzgD3HFHx4b1TRjViniuhHfuYOg3RD5W9FRQpm+7vWg5P3R5D1FW3MgcEM1xBQPlwZzMQGLogstA4WRp6jnQ4fDcbPO0ENDwzjvAm/+HMUaidq+m5IinEsQH64wQ/KBcMiM1KhdfGvyqbnBZG1vYjN8x/HSoYduuIdh5svnDdoSsKVfQLLxpHTJAWnafxf1avaSEi6uBdDprIIMPQPFr0sIbrKdBkinVkdWNbI5pLT663mkimvqVKKMWcvp3VKGuXKiuqSZk0IZ4Q7sAOv92aOim7Ao4prsmNXSO1JFwQtrKyGH4hK8lHgfVW4wwes3k7IvExCouGOl6VpKy7GqVUCwph1DUJ5zO/RDh4w8kzkrN2CeoUun4NC3BE2MZyz75Bie12X3/SxrN2H1htYAwELkr0FCYpGSHwu7ejneAI4Zr09wu1dT6QqkMYArMidGIW3KQdBZSR42kWpV76gQx/ULlgdTTKiCfMltRUz7XA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 423fc276-2d64-4e48-f236-08dd0243185f X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2024 11:22:15.2688 (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: Eyd7QaZBdTMjzDV+ZvzRIKVp47jzVlnF8xAmsJoxErfZ0XoZ8owQKyKaNJVA37UKHYHmch4xb5ReDEGpnSRizw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5194 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-11_08,2024-11-08_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 spamscore=0 bulkscore=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411110095 X-Proofpoint-GUID: pMskVLsYYjv4_qkj2VBxVZQKOVNn4b5J X-Proofpoint-ORIG-GUID: pMskVLsYYjv4_qkj2VBxVZQKOVNn4b5J Content-Type: text/plain; charset="utf-8" Add proper bio_split() error handling. For any error, call raid_end_bio_io() and return. For the case of an in the write path, we need to undo the increment in the rdev pending count and NULLify the r1_bio->bios[] pointers. For read path failure, we need to undo rdev pending count increment from the earlier read_balance() call. Reviewed-by: Yu Kuai Reviewed-by: Hannes Reinecke Signed-off-by: John Garry --- drivers/md/raid1.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index cd3e94dceabc..a5adf08ee174 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1322,7 +1322,7 @@ static void raid1_read_request(struct mddev *mddev, s= truct bio *bio, const enum req_op op =3D bio_op(bio); const blk_opf_t do_sync =3D bio->bi_opf & REQ_SYNC; int max_sectors; - int rdisk; + int rdisk, error; bool r1bio_existed =3D !!r1_bio; =20 /* @@ -1383,6 +1383,11 @@ static void raid1_read_request(struct mddev *mddev, = struct bio *bio, if (max_sectors < bio_sectors(bio)) { struct bio *split =3D bio_split(bio, max_sectors, gfp, &conf->bio_split); + + if (IS_ERR(split)) { + error =3D PTR_ERR(split); + goto err_handle; + } bio_chain(split, bio); submit_bio_noacct(bio); bio =3D split; @@ -1410,6 +1415,13 @@ static void raid1_read_request(struct mddev *mddev, = struct bio *bio, read_bio->bi_private =3D r1_bio; mddev_trace_remap(mddev, read_bio, r1_bio->sector); submit_bio_noacct(read_bio); + return; + +err_handle: + atomic_dec(&mirror->rdev->nr_pending); + bio->bi_status =3D errno_to_blk_status(error); + set_bit(R1BIO_Uptodate, &r1_bio->state); + raid_end_bio_io(r1_bio); } =20 static bool wait_blocked_rdev(struct mddev *mddev, struct bio *bio) @@ -1451,7 +1463,7 @@ static void raid1_write_request(struct mddev *mddev, = struct bio *bio, { struct r1conf *conf =3D mddev->private; struct r1bio *r1_bio; - int i, disks; + int i, disks, k, error; unsigned long flags; int first_clone; int max_sectors; @@ -1579,6 +1591,11 @@ static void raid1_write_request(struct mddev *mddev,= struct bio *bio, if (max_sectors < bio_sectors(bio)) { struct bio *split =3D bio_split(bio, max_sectors, GFP_NOIO, &conf->bio_split); + + if (IS_ERR(split)) { + error =3D PTR_ERR(split); + goto err_handle; + } bio_chain(split, bio); submit_bio_noacct(bio); bio =3D split; @@ -1663,6 +1680,18 @@ static void raid1_write_request(struct mddev *mddev,= struct bio *bio, =20 /* In case raid1d snuck in to freeze_array */ wake_up_barrier(conf); + return; +err_handle: + for (k =3D 0; k < i; k++) { + if (r1_bio->bios[k]) { + rdev_dec_pending(conf->mirrors[k].rdev, mddev); + r1_bio->bios[k] =3D NULL; + } + } + + bio->bi_status =3D errno_to_blk_status(error); + set_bit(R1BIO_Uptodate, &r1_bio->state); + raid_end_bio_io(r1_bio); } =20 static bool raid1_make_request(struct mddev *mddev, struct bio *bio) --=20 2.31.1 From nobody Sat Nov 23 19:40:51 2024 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 AF3D41991A8; Mon, 11 Nov 2024 11:22:32 +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=1731324154; cv=fail; b=qbysOi2GEOMbsjRwFp7mN3BY3yA6kOak7wl3VGrh05E4e4UbbFTV+vNz0LyttvV2WibW0uTtRUtLGoX0je9XHBanQpkwtAJ3TA63ICsAQqkCc6NQExmvOK+dGWIJwuhjq5zrK67vo9jpAhok28vLkZYX+WYkVWRjDIDIAF236OE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731324154; c=relaxed/simple; bh=T4yGx2wrthShkCYGE17VcAijgCO0w8DzhpTwGncd3rs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=IEfbxwF1Tf80Ot3+9luVZQaxvPAbz1dBwr4eBo/aux40mZVk0PxlJNzDHWpY2/9oEtshbjbTQw6KFoM/ouIYsu5YjuSWBzZiaoqwNq3NU3XX0l4K7G/kF39MBbbWwqofzCqltYq6Gq1NVbsbdcIpj7DNchT1oxKkT/I+C4FUVVU= 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=hk8jMJpb; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=WLyEbvQp; 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="hk8jMJpb"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="WLyEbvQp" Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AB9sp9h016893; Mon, 11 Nov 2024 11:22:19 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=bvVqVn1C+fG6UvhbHOsRuxfwztl7EmpyqXk8gHMg/BY=; b= hk8jMJpbg7g29ZA/cqdPb2lF6ypuOYBtuia5y6IB1vmWS1HzNdgNB3DVeJZ1cgCc 48LRjn3dHu2mnKDDdby8YZDwFfPM5JyQWFHjh3AOW9nZ1pizWc0yAeYeaHwy/u86 nJRdHnH9yWWg7S+a/I7iYCQ4aTqVZyNV4s1k31IIbhNK58kBm/qci7uobhZP3iMT b8XHRtX23B/J33g/P4esu3PbCv+XrySq1toJm94WBxt9njhoG4OxeLLoaCOv9aKW 8tGhCn1elRlTrD58LILy7Fsr1ob5fIoEZ3eqHbJZ45+HE7DbojDvhNdZ9SG2Kmra IVOqU8lqdYoBp/iZmCBbYw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42t0hna7be-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Nov 2024 11:22:18 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4ABBINoR021562; Mon, 11 Nov 2024 11:22:18 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2044.outbound.protection.outlook.com [104.47.58.44]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42sx66p8te-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Nov 2024 11:22:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fir79+uDBS2DRxg0KGUGBb/5/xyVviDVYkdPQ+KBQ/YNXT02Af7KBMy4OSRGGFRm2tLeXSrgw5euomcIoDlS3vZHTp5vDahLz1TSgWDhzTBaHBpdWX9u4LthpiL+1u56wrkcvxp3VBw44IHMp+h1ZNsiVHTpxH0HBDnvhiz78tIeYSaL8nT/iiKE1e0ibUbyGhznKJmolhVtolmtf0ufXpLVAyibP6gQr6eZQ3DAIY2XzSPk85iG6wMmo9Pb8DphQpA9nxntUor6h4Hkx4nJ/Bg00w9KmUOLisbNT8GUuW0/vRBY8dNUBNcWvLqXD3qb33ufs/GqQ0qaK8JpimXukw== 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=bvVqVn1C+fG6UvhbHOsRuxfwztl7EmpyqXk8gHMg/BY=; b=pZZDFOnIFRIWY5CFINbz0GWNgj5xPPwQ0ho1XExuuVQ5nJsenYw+e5T1FgobMQvZ9NoeJufXPmUW+tXKkQtKCAezZ0MYTPrAzHbx6mw+y01FAK+hRtAVgGDpeoBvoVZsZ7jjsBUGs5zmFzp+V+dWr5RocEVMWLjm16chkWWB/vP/Ig9HxAGePXXN/B86y063liwM7OymA2zjzkWlglT5OHK5RioS25xlqomWp2CLQRdipGFlULnRlPRJ9gowv8G9BmzFtyvj8SVArTWlKupOS5mjblBbvlxDY99ttx78fSpRodU//q+rlKA6Ve/2o7HVwwQXHfBHOOMr3xXxV/211g== 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=bvVqVn1C+fG6UvhbHOsRuxfwztl7EmpyqXk8gHMg/BY=; b=WLyEbvQp6NNEd0jNMAQCD2xe93r2D6k5KtH+V0x4dQMiD2tkwESRNpnOFJmLkEXorJKVnnRjMWSoeHagIjDQ2Jfx33cZt8H5a2I4aUCROBUAL/lPZ6mDhj8l0rjWuHhdkd27Mz0Kk4D9msZudnyOAp8B0a/lxuXS+wv+4D6hCEY= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by CH0PR10MB5194.namprd10.prod.outlook.com (2603:10b6:610:d9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.29; Mon, 11 Nov 2024 11:22:16 +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.8137.027; Mon, 11 Nov 2024 11:22:16 +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 Subject: [PATCH v4 6/6] md/raid10: Handle bio_split() errors Date: Mon, 11 Nov 2024 11:21:50 +0000 Message-Id: <20241111112150.3756529-7-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241111112150.3756529-1-john.g.garry@oracle.com> References: <20241111112150.3756529-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: MN0P220CA0002.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:52e::31) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|CH0PR10MB5194:EE_ X-MS-Office365-Filtering-Correlation-Id: c48498f0-ef36-4ae2-16e2-08dd02431914 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?g/VG2DhTBIa1yYEuBK60HfEqzE2+Xq1NVRquS5Zxs1w/wUXwGOJoC2xUiwm0?= =?us-ascii?Q?qSr7dtEu+6v8c2dn71aZhAcikjSbmnrCwYdCql1iWbIuZ7NIIJRwnzpZpbbT?= =?us-ascii?Q?q8OdhEPhVrQrpoh/WKn322gH6CsLl3JC6bktKL7qMhnE8dp5ld3zhaPCzxDA?= =?us-ascii?Q?YCRrGG4FiWPGDoruXBi68PjkNDErkzYcLuFohbMxdAlCjwMLpwxCfhhRMxXY?= =?us-ascii?Q?X32O/ltJghIzYKpA8I8D/5LFoimq3cW2oZzwgc+2ZKDbRDWfU5K3Pjgq7/GV?= =?us-ascii?Q?6YGz4Ta5iEkd6qLmpJ775cSsPQVN5zy747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ezr5hyLtsdeWSY/UNfCHlMQ4ymXPOfi+t0RkbaTtrVzI1MCpwbu?= =?us-ascii?Q?rTx5famq6UcNFlD4huotcV3P/cyB4t+QZNapG+i2YZkbR+D/hlPoIsNtD3vS?= =?us-ascii?Q?W4E=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?dATdYrBeLGo88py9ro3PA+RI2n/w0EFNW6QFf7S8cil6wWxxcJy+umAiJqlU?= =?us-ascii?Q?Phe50u00TW2uJw2SSYpv4RbC28yn+UBSySgFqNUlKG4jUE8SbWBeSMRQKWTb?= =?us-ascii?Q?CC/84xYVlaYzVZB2vnUdlLLfrZcN5DOSiKhPFtjQkpFbwu8aDu1aCtnh3jmS?= =?us-ascii?Q?4D2hqh4BfZAhP/e8oyTh4611Z+B1UC9Kbljc+2jf074bHM6j5mN8LUs6ubXL?= =?us-ascii?Q?ryhw0SaPKEjCkJcXsKHFFrRWurlelph29l/KxEwCsXE2pvjIsiGaS6MvarQf?= =?us-ascii?Q?EfJk+jNWnUjDBls0iWtUNq04zIPIM0JgWxSHPpin5Rrs0ce4ovGfXXZMDnAf?= =?us-ascii?Q?4pTLBfrItyQGRh9vYVxegdpfP/5tauCOdXzpQa2HuB6SCBcHr/Jjdzw/86VY?= =?us-ascii?Q?BNVBW2y0O4zN4elS3v1fEgv2YmuPQzKhQmWghMfoXsd9gRynxk+wIluIdG9K?= =?us-ascii?Q?7jjvqv2VUPKXI+lWZBdvtbuhTX03+Rgynx93tfig0t+tC/qk+ANsctFf07CX?= =?us-ascii?Q?08YjjHZMYjq5aaCm8ovh3ercmqa9jZ70gaDr6UwhDkZnUZkV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9L27HjCKEFP5AZ09BHIivCtegBYCtU7z2zvO+cCM+vyYLGof?= =?us-ascii?Q?uYkllV+E3/CdFvwNmNobY4P1k/C/suKBxAK5IKszLX/BkZ745lqTYK+d7aHe?= =?us-ascii?Q?2K88YYEPInvZR5O4y4WimkFWuXWe723Jmk+1q08BF22woYPXW2RKDmKQWDsf?= =?us-ascii?Q?KQ=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: AsqWX3hqD8UoBB1f67WOZLsxbul40vviuE2zUyBJU6Ta58sbYMGbPIAqXHwR2yNCLsM65cHbEEQCjsKI4C1yxXbGjZ0bWTh093h4Gm1FGaeKMJBPbVsxLNkv7gWImRZ1/4RHU/xdcnaJ1THG2oVHQUybAjpm4B2iFqYzQTrbxUuDcL2ipoFEKzIXqk1XYFuYqvYe8ZdIPpMW9olzVDnsOdEQKT+4jkS6PoDrqSLnftzfObwhs6FFGi/uKNF7scNCDccrwp2tWcebLgk8q6w5wCifCQ5sIJg6OAJyjPw4U0eAtx1D0nk3IPAQLN5+PLIPyPpWvrQSvXJsompY6zy+V6gybCuy2dEFd30x3ZnNaZyuVJ5Z3CPLsMIiljoVqqf9ziScxVdipgm6Ax1uOBoyKHzYEGFEV45h3J/DzqFXnuJEhHDo4KsXRT89ygbW8AhSHtbDGfznqbz84VCr5ZthIghNVUCHGB6eDpUvTz98myoq+ExjB70ca+JzaKXuYuDNnVILY+WXPLY6lfeLP+Inbozfk7tgXGWGfrTYGf9YhJpjfts7F0P0qSkDd8zu3TNv+3ctAQd+NTamBof7Mkf70RwufuQVBCvnWsaPMP++hu4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c48498f0-ef36-4ae2-16e2-08dd02431914 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2024 11:22:16.4588 (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: uxynCyn+yHRze80+SW0H1ovbMGf8sdjKvT314OaFGJk0T/9+JgAldvkXzHzqm/0HrA7SHP3eReRT6Z0ShhDdzQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB5194 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-11_08,2024-11-08_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 spamscore=0 bulkscore=0 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411110095 X-Proofpoint-GUID: UPCKQt3NsMrE1r1jkL56-xVjbTJU90Ql X-Proofpoint-ORIG-GUID: UPCKQt3NsMrE1r1jkL56-xVjbTJU90Ql Content-Type: text/plain; charset="utf-8" Add proper bio_split() error handling. For any error, call raid_end_bio_io() and return. Except for discard, where we end the bio directly. Reviewed-by: Yu Kuai Reviewed-by: Hannes Reinecke Signed-off-by: John Garry --- drivers/md/raid10.c | 47 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index ff73db2f6c41..8c7f5daa073a 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -1159,6 +1159,7 @@ static void raid10_read_request(struct mddev *mddev, = struct bio *bio, int slot =3D r10_bio->read_slot; struct md_rdev *err_rdev =3D NULL; gfp_t gfp =3D GFP_NOIO; + int error; =20 if (slot >=3D 0 && r10_bio->devs[slot].rdev) { /* @@ -1206,6 +1207,10 @@ static void raid10_read_request(struct mddev *mddev,= struct bio *bio, if (max_sectors < bio_sectors(bio)) { struct bio *split =3D bio_split(bio, max_sectors, gfp, &conf->bio_split); + if (IS_ERR(split)) { + error =3D PTR_ERR(split); + goto err_handle; + } bio_chain(split, bio); allow_barrier(conf); submit_bio_noacct(bio); @@ -1236,6 +1241,11 @@ static void raid10_read_request(struct mddev *mddev,= struct bio *bio, mddev_trace_remap(mddev, read_bio, r10_bio->sector); submit_bio_noacct(read_bio); return; +err_handle: + atomic_dec(&rdev->nr_pending); + bio->bi_status =3D errno_to_blk_status(error); + set_bit(R10BIO_Uptodate, &r10_bio->state); + raid_end_bio_io(r10_bio); } =20 static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_= bio, @@ -1343,9 +1353,10 @@ static void raid10_write_request(struct mddev *mddev= , struct bio *bio, struct r10bio *r10_bio) { struct r10conf *conf =3D mddev->private; - int i; + int i, k; sector_t sectors; int max_sectors; + int error; =20 if ((mddev_is_clustered(mddev) && md_cluster_ops->area_resyncing(mddev, WRITE, @@ -1478,6 +1489,10 @@ static void raid10_write_request(struct mddev *mddev= , struct bio *bio, if (r10_bio->sectors < bio_sectors(bio)) { struct bio *split =3D bio_split(bio, r10_bio->sectors, GFP_NOIO, &conf->bio_split); + if (IS_ERR(split)) { + error =3D PTR_ERR(split); + goto err_handle; + } bio_chain(split, bio); allow_barrier(conf); submit_bio_noacct(bio); @@ -1499,6 +1514,26 @@ static void raid10_write_request(struct mddev *mddev= , struct bio *bio, raid10_write_one_disk(mddev, r10_bio, bio, true, i); } one_write_done(r10_bio); + return; +err_handle: + for (k =3D 0; k < i; k++) { + int d =3D r10_bio->devs[k].devnum; + struct md_rdev *rdev =3D conf->mirrors[d].rdev; + struct md_rdev *rrdev =3D conf->mirrors[d].replacement; + + if (r10_bio->devs[k].bio) { + rdev_dec_pending(rdev, mddev); + r10_bio->devs[k].bio =3D NULL; + } + if (r10_bio->devs[k].repl_bio) { + rdev_dec_pending(rrdev, mddev); + r10_bio->devs[k].repl_bio =3D NULL; + } + } + + bio->bi_status =3D errno_to_blk_status(error); + set_bit(R10BIO_Uptodate, &r10_bio->state); + raid_end_bio_io(r10_bio); } =20 static void __make_request(struct mddev *mddev, struct bio *bio, int secto= rs) @@ -1640,6 +1675,11 @@ static int raid10_handle_discard(struct mddev *mddev= , struct bio *bio) if (remainder) { split_size =3D stripe_size - remainder; split =3D bio_split(bio, split_size, GFP_NOIO, &conf->bio_split); + if (IS_ERR(split)) { + bio->bi_status =3D errno_to_blk_status(PTR_ERR(split)); + bio_endio(bio); + return 0; + } bio_chain(split, bio); allow_barrier(conf); /* Resend the fist split part */ @@ -1650,6 +1690,11 @@ static int raid10_handle_discard(struct mddev *mddev= , struct bio *bio) if (remainder) { split_size =3D bio_sectors(bio) - remainder; split =3D bio_split(bio, split_size, GFP_NOIO, &conf->bio_split); + if (IS_ERR(split)) { + bio->bi_status =3D errno_to_blk_status(PTR_ERR(split)); + bio_endio(bio); + return 0; + } bio_chain(split, bio); allow_barrier(conf); /* Resend the second split part */ --=20 2.31.1