From patchwork Mon Oct 28 15:27:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13853675 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 5396F1D7E5F; Mon, 28 Oct 2024 15:28:03 +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=1730129285; cv=fail; b=AzH1tp+yf/frTUadbBrP7ub8o+KDb31tx6T2SJabOf6UddqOltYixRYTrPjpVOeDolFtU1JZBFnPOKlgdbRjIsz1Ru54UI8woQ5/CsxHuQwNNGgGFZ5PDbLzpLp41Sw/cbX/c5wE5b8/7a7AdGztBOi2cMKgXU3McPmSu0kubQg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730129285; c=relaxed/simple; bh=/4omSu4YaAMpctlgfIn9gujW/VBkrN8GppceQWZl39g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=hsHk61JsmBvGP4qip5b7G49r1gNz5M41Ve+r+yd/wLPDv69Yqw+R0nsvxKCSxlyGN3aJwHZp13Jq7Uevb5VAbxlBOPekRBJepuUW1MS79zjdJ0xdU1YJWSTdo/ejCqaqcE+eNlQulJBXKWeO7XGfo+lGrwY1wiUtG31t2J92HdQ= 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=E9sMpdBD; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=LApqyeeV; 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="E9sMpdBD"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="LApqyeeV" 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 49SEu6O7030117; Mon, 28 Oct 2024 15:27:47 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=og8QgRIQ+tfdEcc8RIfmH1HHOLcNejdMCU4XsdgeyAU=; b= E9sMpdBD1mSyiyhCTxhzUQ4PvyKQ2SW05J1emIMQgGUWuajQ5SKrHxzncTODScTe 131Q3R/xjEGsXIR+k58NlFGqZDvnrJyRqTdo5r6kQvuCx8+bMiHOIWhcDyggC1Qh CBHEdbW0OwRrOJ77s/xE1SmNzBifxpn+SxNOIMWzsk7xHg/7Rn5uB/VQOs4O1Egq kifHrLnbby/YcBiU2ZVWv1gcF9W6oONDeVjnFkc4sI0Ud2SSMl3cOufiyrM/Ea22 lWZBnPyUzZWPg9GiAJ/L6+GKK6Fgbyf7tdrsrTUBrhjUDCCkN7yu2cbCifBlqCUi IyTGOiQIeYKGY9hjUNjZYw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42grc1u5a3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Oct 2024 15:27:47 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49SExQoJ008380; Mon, 28 Oct 2024 15:27:46 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2171.outbound.protection.outlook.com [104.47.59.171]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42hne82en1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Oct 2024 15:27:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cn8YkPPvaeeU2E3endDiDg7WbylE5/YlpX+2CWnS29FOv0RD1VG37mJpBKCmZkmIV8sv9ifBB+bqvkcAdRka5aSGywreU7Jo8rwPUYS471twpTry/3vyYpooV4sdRseHtDgyhbbeJdXrzyBFxmgaRsetXIwvsdh8XoxBrQwaugz0pEHbtP4Wv7Y9vQ9ew/GGKiomviF7rGixDvyenTheRkzGGfqi2gj7fznhh610jA51zxMJZMS1Y4He+kyx5aM/2++brXjOpJEHz3y7vx6kx5eNo09Nl4m6VlDMum8VzdERCmEKCSAEpeB2KgyiG5ZSwvnMGdMDHqlFH7OPUatkeA== 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=og8QgRIQ+tfdEcc8RIfmH1HHOLcNejdMCU4XsdgeyAU=; b=yiPSPh5VAzQAES4NP99UkUFcQDp3oLuUo7j0BixNIQI9Os2ShMmRE+xK8VfO1NYsedlE5oE4LsWiMqhVa5hsrZ3yO28HiOrlyacyqZNXvI8zpiWFMHOe3n74PrZf1dHCgVVbHfMVgG1TynlzhPrynEgPVYiXKpFsx4voCqbxPwXg7CPtQUTr/wXFXL/AoTvVO+dqph7LT9hSYdxWQY2magblanWkFI6PNew/lJEvtph/a3HK7I7xa+r4CBi4RPL3W2Z1xe4oKZR2gyZYpoz2ClDfW7sZQhX85zVcoRXWmm7xKKLMHqazxUurl59RFgTQVXuQM/m9EPpzxd1LCFgfKA== 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=og8QgRIQ+tfdEcc8RIfmH1HHOLcNejdMCU4XsdgeyAU=; b=LApqyeeVWnQlWoa34q3/cv1xPmZd2jc7m1acgfKZ65Nor+uORyE574KNr+99PmU7mQABnnxk6ZRIc54jigcYOl9JN0W1QGWCe3ZnCKsI9CWRTYoUH0aZ/UZggRh0pco9LqRG8pjA1W3LiAviLsmQ63MMhO34C/YXszHWmLApKSA= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DM6PR10MB4170.namprd10.prod.outlook.com (2603:10b6:5:213::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.27; Mon, 28 Oct 2024 15:27:45 +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.024; Mon, 28 Oct 2024 15:27:45 +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 v2 1/7] block: Use BLK_STS_OK in bio_init() Date: Mon, 28 Oct 2024 15:27:24 +0000 Message-Id: <20241028152730.3377030-2-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241028152730.3377030-1-john.g.garry@oracle.com> References: <20241028152730.3377030-1-john.g.garry@oracle.com> X-ClientProxiedBy: BYAPR04CA0007.namprd04.prod.outlook.com (2603:10b6:a03:40::20) 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_|DM6PR10MB4170:EE_ X-MS-Office365-Filtering-Correlation-Id: 2451c86b-7690-4e2c-466d-08dcf7651230 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: 1YGyraYuje2lQZLJIsB/rQ54OgiM7M6kTnbWMoOQlV66NLzBgbJM2ik6IWAGnhZd301z4Vic5v0OA6Wvh5LKVEbSipTzuiJjTFH6JZDtQBhIrYSS7Hnp6xnU3WpdFTea5bTSA4xpOckVWoefXD93zX58Lzu6GjUj3S96QqdgxU/CUugjoBO//1uZKmWsSiTtBdE/woPeqbfS+Okn+DYyi7xjDIeVRdo+tGVCFqbsiSmDPVm8dJYQD9SKtoUk9Ua+3AoP6IstQWyx2GDTt8OG2W/1+IvOupeC3C02TnP8XrOl6uV6Y/9h2QjtgtgNnCjJ1ehvlasBC8sKeguPhLAhpG0OlLtpsuoyKkJSELwRKSw/SZeDdDC5i+8HLbAQXJo2amXIfaFYOtewU9yn9TZT2bMoJ5/98h1Y4wCWaKDSpFLxfV3i3I4RkS5F7jYR2+1gN54wB1TsOzYdHZM0GAyZ5UY4iZ2sJLB7oFGq4LWd1QlsU+eoa1VItMYcRJl9E2V90zf6tbRMBzAHESS1JBPj/y3C9RslnUL7PUsEtvGoznD3OX/+tliICtvI3MRrJn7M/p6OjAQ8v2sqHJeUX+g+S3+Np79/8nJ/7RX0HveU7fjrq20zbJqDxc6EneQI2/u1ChKJtlurDW8pxCT0fYCVbBxlTDmT89iq0up01t1hiOhLyvEvbi9ITag6kr1IfvrtTq0sJ9yRkDpUJdoF2wORPNXIPdQR+mVvwGHxIYwgofcMzyPDXt4N+4x1JR1cPqHq4pcG5XWRMj31P21J2JHJRo+90vaHqR8HHvaXqtpOfBzvnD3s/wU2v7KpDexzVFw3++ZcUD2slGEIBMCZLsv6t9TcigbJxG8UMdr2zwDplC6PhgoXGyGG4KO4w7jLs3RTsz8BIA6ScSCzsAtnDKuc8S9u4fBBCdA8S+R9oKc1p2Y886x25OugNco66z8vnkEzlLtmeb8iLesqR2GNmBa0Nccu09/7rSL+NfKFt//qNOsz6bJfZbx1Kmk2dqJ6irSFxDi4ZYClGfE+Dt5XkjzzYZcUCU1+buIbfig3QyEVLywUNRiQk2X/zlOR4WZFLwP45+8SOHxR6o17UF7WmSS4VLLNYYRRB755aRs/7UDGoLqQDlbqqyj19V0UqodDfuZNdAkPD0sLVvF5ykhYQGwXLrH0p+w+Ror7p97rjNww92h0sdjMLk2GR1mPx2y0YwAmcWZbcY63IY/3n9jozfnkiNZLLExoxNZFsPDQ7SNu9o9T2ChfuY7blLxf+DpoWzwzipwH2EatD3lssdEz5qmxceUCyU/3PYqNC8zlTnaSzvy4aU6wqLf9c/xpY09gsO2Y 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)(1800799024)(366016)(376014);DIR:OUT;S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MqBAk5ngzqVULuibWKkQFvMGvy8ZCEW2tZua05SBkM1YXRNZ+fsSMUJX8dJEZBP26kc0cVFfngQAgHUnZz0j5opoNuqciRa9MNMRYUjcVhcTrRzQbMm32MJm3jaIWtu6vlVhVfIl7XUwywd095KA3Hu2tPIT1hXFsMJYMFI9S1q0V8kdJkceM5UGQWSL5eDaSI3OqinqqDIJVfROVXyknjRqEGTNVphR1EtxcGZbfSKA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2451c86b-7690-4e2c-466d-08dcf7651230 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 15:27:44.9789 (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: drukg7IkUA/I/Za3XWgBu1EHWQTxzTJQLKeW3+WaZPoxJaIgpKh1aMQbe2zvs/eBbr6U0WWgY/wp/5C8tek/vw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4170 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-28_04,2024-10-28_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410280123 X-Proofpoint-GUID: 0HPY0vj0JDkqoD5WDb2gbmbjqDxbjJoI X-Proofpoint-ORIG-GUID: 0HPY0vj0JDkqoD5WDb2gbmbjqDxbjJoI Use the proper blk_status_t value to init the bi_status. Signed-off-by: John Garry --- block/bio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/bio.c b/block/bio.c index 95e2ee14cea2..4cc33ee68640 100644 --- a/block/bio.c +++ b/block/bio.c @@ -251,7 +251,7 @@ void bio_init(struct bio *bio, struct block_device *bdev, struct bio_vec *table, bio->bi_flags = 0; bio->bi_ioprio = 0; bio->bi_write_hint = 0; - bio->bi_status = 0; + bio->bi_status = BLK_STS_OK; bio->bi_iter.bi_sector = 0; bio->bi_iter.bi_size = 0; bio->bi_iter.bi_idx = 0; From patchwork Mon Oct 28 15:27:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13853676 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 5392215E5B8; Mon, 28 Oct 2024 15:28:03 +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=1730129285; cv=fail; b=XjARmuRp95XcSnkdUQg68VU22OtY6cOVtl7S+Opgxhg08A2PXSbPDa1Ekn7tyoaVdU8XYVefqhxQsO90AOwP/EbMVfAdeSgmRQlXiyyOU5SS1QSSnlb07GNfPmQcIGYqriOpIyxKZpTmAgtCELPYgUyiIs8SY8R1cFUdI5PGSAw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730129285; c=relaxed/simple; bh=WOytXhGw2l8zmHcugBBzMEkDHojRhg4cYilZsy1hGVA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=A1z1VUTjPhSybmDeg9cZwGLWnRbTerlqiV1NAjRtR7IJIM30ouqmNR+FC2bYv1IcIObRQ5P3TvooQtFyC44dkowgLhe5HMpYo0uUNfQSIV+Z0IXz3DDQ2Y5K8lr5q0GK0m/L+ZVxLbrbVc2KdSMHXuM2chZ4Hp2bKNcnV8h84mg= 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=C6cjIEIs; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=Qm6GYEOL; 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="C6cjIEIs"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="Qm6GYEOL" Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49SEtaJN007132; Mon, 28 Oct 2024 15:27:51 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=cAJEcTdLmcQaI2cuNpR/9hiKCLKV1sOWvUvBSVSEV6E=; b= C6cjIEIsJz762/tKRDdTFPNZDiLDHAvgV/Ziox1s6dETtzeirCzR53Zta4M3yaKy hHFmWz8x53dOwcksOARn/5Yx4wp82SxmK4ulvJrO+1V3jzeWtkrgQ0/rSz0fbsds 03WovXCGcA6BZ/UmHVFuVAlsl1PVGlYstrKZeL/vQPJG7kz79TGqWMzOY46JDs+p Qi+i4K4VyylMSj2aedJ5BKA4CeHfH2Di8wDge4Cvsxl1nnJXUoz14OFxZNkjPrkC lL6KibdMU6mR/vpMcUhKIzc6+Quva+j5ANEExEiz+HPLbJpXbgqp1h53fwsh+Wrb 9rFRNiSrWRpkCHpG+8HnTg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42grgmb730-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Oct 2024 15:27:51 +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 49SF0FsI040424; Mon, 28 Oct 2024 15:27:50 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2173.outbound.protection.outlook.com [104.47.55.173]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42hnamj91q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Oct 2024 15:27:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cdzYs4nILQoyE9GDxu+L/aUHboMGiYu8LMU/zPSG7JYb/dMw380AoJzHcP0c2MCoAVglcAh/gpkqG9BKtgZGIDgF8JNXzYCFZuIyyJeMalqUvu544+C2FJt0PzJUqpgq4ogsaEUQmtDszWPDyPsW7J0VA2hoNI/2dawkkV91VjRWXnHtgbVsez7VJaRtxzCzVWvABn6SZEckty1UMpl3rKsVhyEzm+ZWBIrmRyApdp1B/2PuH8AP936TIt3eDeWl8LfCL9SSXW+wc6RmPhD+krdUVrg7Go79KOu7GbfeI6uCb7RVlbJBcF6YNyuUbCd0SBVu0ZLOeO+yp5iO76QQuw== 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=cAJEcTdLmcQaI2cuNpR/9hiKCLKV1sOWvUvBSVSEV6E=; b=MQ4HfmptVUgdLxBGWeYB7FIZCmH6TlRkK8pDgSih6V6/XX/nkoZGMzDyzWNjEVnM50KuJ8OSOkDh86sNixODNbPJ21cLaRKBG3hhrwB6hKVARFL6NtFfZYpQ4wE5Nm9L6wxdFFXxOxEqrz+pD+twvreBepH5PSSbghIKDCM8Mc+oBuSrE7X/HMaw3C9oFTfUpgqvcQ6IlIwmEPiet47HtRZDIlrVqprBRcHgidKXhd1HmC619U/VL3R3JIdeHRtI9TcFlug9bm63vK/k3qazfsZOOPcTbfdmn2fl/TOUny3khhMY2PhfX/uKrE4elFghmMm6P8xnkcqWo7xdlfthUg== 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=cAJEcTdLmcQaI2cuNpR/9hiKCLKV1sOWvUvBSVSEV6E=; b=Qm6GYEOLQYUmWDxXkIxUEo5jRRdOk+w5exKjtudMJfgu9K7qIPXirJDU8ctknSG5WnMUe3eQrOsNb1Y8+D4Mjz/Mpiw4QOm6qJL4LwkT/k3bZZnemB/cT4Nqdm+fA1e0vZ4yRPkRZkoYJtqueDlANXjJvx3Hc6xstzUUuV5n7A4= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DM6PR10MB4170.namprd10.prod.outlook.com (2603:10b6:5:213::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.27; Mon, 28 Oct 2024 15:27:47 +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.024; Mon, 28 Oct 2024 15:27:47 +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 v2 2/7] block: Rework bio_split() return value Date: Mon, 28 Oct 2024 15:27:25 +0000 Message-Id: <20241028152730.3377030-3-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241028152730.3377030-1-john.g.garry@oracle.com> References: <20241028152730.3377030-1-john.g.garry@oracle.com> X-ClientProxiedBy: BYAPR04CA0012.namprd04.prod.outlook.com (2603:10b6:a03:40::25) 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_|DM6PR10MB4170:EE_ X-MS-Office365-Filtering-Correlation-Id: c38979e1-eee2-4110-38a8-08dcf765135c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: Z/RtGmrplEDTR/ZELPdBhEAOivbQKTuPKXCzzlMwauZUFQQbOXY7m+PbsN97z29Ie9ZpODGDjjH5vx046aQ3PG9q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oj0sZ2f1Hx11uhAbwIYSAZBkL/E5FzvGg0ldYEFl7svhDQH/mH7EqSdFfQNLPPZ8Si9xwHAJIyf+A8rzj0ImsQXwY7LJ7qMf7YOMmIuhGp3pUuVWVgTcNJuotpQV2tsEe7YaD1UjvVdRAtpegz6q8aN73S2+5HFsl 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)(1800799024)(366016)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5u+q2AIuBF+x5E8KvQ35dRdgs8uHpgGdBmpqnYQaBSIjM1go4u5WA0y3fXXMn3NbYj9Yyx8YAZbbH2zJW0GR68d5EMH0vAcoONycycAzQ3Xe3vbDqooDsU/Tpqmq+Aj5TTwXaC38bhkvm3cO+5ibtTwssFezaOsyeUuSVFAIAaN5ZpDpwmHT/zUL7J1mxeOGEHl3dkNM/AZ4DNEagWu3hvFi+2rlPj/NFDUyC5dkWUgv+wAw7RN2Zt1JpY2Cqq+iehibTFP5jLWz+QMJL6p3etAJGhoVWw4L/sSHGtpoEIAJTLJ7olW7XpoemItjwnhEeafJDpoMIcVuAI6de7YJYYyFtQF/10z4vvKYE0hcaGYPIUpODEjE726OYkrYyqq0aI6jPHK7AUjOeehzZH1dDA9xUY/8gG8auqt+5XE9NYrWGpvqSmTkjMLRjF+bd4y/zBpCHOLNzQ+CiCJGjIno4zWhvwBJ3ZcgjsS1YWScM6Kn6B68ZUr4aE92J68OgCCnnzZ1d+sdOEOigdGlu2wDUNdl60waCn2H+XQvtnpTS2l8HFfnqXfVqCAKZD1jjRxZUgqSdvmXuapn4ZnYg6Jh86gojU8N6sZ5F4QcqHvL00hzt29msCKqVdMm94nts4dsdfjKOOTcLMNb3tCOt0FEUAjy3q4fIRM0EZvj7WX48Mwi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czd2L3VMel6QPCuHw2TW/gD0m71J7YsEEJjp0KSxzqNCUIxA3Yv9pipjZkT2Ib1p0T3PbuPTdE2eObtrr/HkW2sQQAJeLNtDXyLtBD5LzqYrX2u9B40vhRXbU6cbM/WAoZIyWDgPR3fWzHdOEuvtd4yxK6QV19DHOJuoXaq9479dyjBPOVRvr7JguKZ240C51UUgpXnu2w15pDpk9rlf5L6BCsxe9ZcA4YYtdCJfBKS3BKbBanlipze6RcqkHAJNt3b6k8yMfd4pPZNxcBP6NDGnDm8xMSXHjS59t+2/Ugap1JR+kRGOVqOscms39vZU5omodwB//jwo2rwOR8De9IhFX6Gtrj9osE2pPTChN8gAwigQS/CMG8JPTGSYHoxtL5NY8eb96jZ+X3Uh7Z/OsbahePWBfwPpWUE4uH8wVEUbaoYPtLbsGHg3yAS02xaxBcOEY8UAu9odZ/JEOKLruuRmXlpgaIp8TtBqbtR8asra10xPFzpdVk2AFgCB8yTqc3g83H6gWPF2DipCA20fReDWlpZ/O10Vy8qyuc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c38979e1-eee2-4110-38a8-08dcf765135c X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 15:27:46.9838 (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: rc7qxweWkgJnL64I1aP5GVGtlk0buuNMpLobUJppNdOMVc8N9e8aKszfkKfzdAOtjoqFXAOJFru1OAv9W36dJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4170 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-28_04,2024-10-28_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410280123 X-Proofpoint-GUID: HehrSHNuv8mG4JQ9gaTY45Ii5e5uJtly X-Proofpoint-ORIG-GUID: HehrSHNuv8mG4JQ9gaTY45Ii5e5uJtly 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()). Signed-off-by: John Garry Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn --- 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 4cc33ee68640..42cac7c46e55 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1740,16 +1740,18 @@ struct bio *bio_split(struct bio *bio, int sectors, { struct bio *split; - BUG_ON(sectors <= 0); - BUG_ON(sectors >= bio_sectors(bio)); + if (WARN_ON_ONCE(sectors <= 0)) + return ERR_PTR(-EINVAL); + if (WARN_ON_ONCE(sectors >= bio_sectors(bio))) + return ERR_PTR(-EINVAL); /* Zone append commands cannot be split */ if (WARN_ON_ONCE(bio_op(bio) == REQ_OP_ZONE_APPEND)) - return NULL; + return ERR_PTR(-EINVAL); split = bio_alloc_clone(bio->bi_bdev, bio, gfp, bs); if (!split) - return NULL; + return ERR_PTR(-ENOMEM); split->bi_iter.bi_size = sectors << 9; 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(struct bio **bio_ptr) split_bio = bio_split(bio, num_sectors, GFP_NOIO, &crypto_bio_split); - if (!split_bio) { + if (IS_ERR(split_bio)) { bio->bi_status = BLK_STS_RESOURCE; return false; } From patchwork Mon Oct 28 15:27:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13853678 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 C47C01DE4D1; Mon, 28 Oct 2024 15:28:05 +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=1730129287; cv=fail; b=Wk/bBfBhqPjhNebTXpA68EcV2ylIqbrf/vVi5hQF+w8X6WEyil6+HDYlC0fFtnK8M7N18+JpfQ/BCHGb+gRHdhK8/lGV0HihU4QP/tkTv38BGXA3SN104QFihlpOc0GSCXF9OzsdRLSi8J/dwwkdjTvoOExEY7frbxjZuy9gogk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730129287; c=relaxed/simple; bh=WRHKSnaSgD997yIucatJroHRtR+E0jB6VZEbSMMQmYk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=XXwX8W6MGUe/QYgL/+xfVrlf3ehNagN7tNhOC/RzrI4wy7rILxbNrP0yBKhkUuKTraHZ6iPLlYwZYwvRpLXCBYfFGaGw44BZk7acOPbfAFqIK5XPV7lxJu0Dhd+6N5EcNJjLXKD2w7Zlj6X64z8VdBTasKVtckUkX05bkM150Mw= 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=n4Pi3ZCZ; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=ZFg5FiO7; 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="n4Pi3ZCZ"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="ZFg5FiO7" 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 49SEtcP6029536; Mon, 28 Oct 2024 15:27:51 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=k1mi2FeK4hPZbDgmP/GU+BLYQVVpbgR8Q/UkIZ+SyBc=; b= n4Pi3ZCZiQNXbG0lHW72rA890PoFxd2RCaabdfvkSWNVmLIVPWorhTE0TXqdsQ4f qXaHyJh6X8GH4wsZebUrLXjmuMWRbG6hOGMkuPHg/deghXrdX+TrOepmW/Y/gXHM za9O/2KFODxxFlh4uSUuaxyTyU5gtaC2zPI2hrIT1K+0KlLePO4RovQu34icZMG+ 7KSAQ0Hn+/9TUV/XTAXhH0i83n/9LmUAjn57YiwKZAFN/mbVt7mlBPLwusckfHRj Gvq0X333MqIHwjQqJxmGWRLV1jvYTIHoasAQHIiLhDRFihVdeUvtVjzMWMcA/e+8 nVlbhA0N8l2f2Sl3y+bU8Q== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42grc1u5ae-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Oct 2024 15:27:51 +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 49SF0FsJ040424; Mon, 28 Oct 2024 15:27:50 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2173.outbound.protection.outlook.com [104.47.55.173]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42hnamj91q-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Oct 2024 15:27:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NxiErHxmhqA2VQP8t/iUcKgIaE9DQQaONlpgjXIWQU6nxJUq3FBr7kXGMTQRD2E7AUDD0UJg9CXiH31rkue7s3Aj0mcoSXIrXR3mD3uKJpG0IC5okC+bwHuXUD3FtaIa4sKnB0okVsGRzCh+IsJ+VY++0G8gQPKPPGq6t3hl9lHUuM6hcwkRjorVDMUMofmq8jSASjo2fmfvYfrVJn1h1XAJ/ozyCPOdLnWMFRkdRmZFW6ZNTDkfR3rmrqrsYxZGrL0hcPOu/Ofi4mjFY4zLiuq0G4Q9N/r4V9WtwZVhKocBkqrEo1mGfBHyJAwWQPw8WjvzseyX1X10psjQz+AbTQ== 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=k1mi2FeK4hPZbDgmP/GU+BLYQVVpbgR8Q/UkIZ+SyBc=; b=UYyqg0ThQsSAPOk+m4cJK2dWNR2V32gZ0/D6vNZzkIyBtQEfGpZXEld+7igpYXjgEsrHX/EfpPEcsUFTjUujQUqfwxOLaUz3cIw0NPlRq38bq+FDBNa7jvLguw9Mw1eg3FUlvqhpB3tcVGBzyO6Ot1doZXdJdfCyDmZc2A0Eq9NroA1kuDZGAXwRZy3YGP9EYQIDqDRM+tTBfAmWOpAz4R9HqsrXTVSfBkfhvDFIgossrbR+/j8HRSNtaw6hsLI0UWhH6coik51hSbSkebIaAKJ63bRPXckMVtWbum2yy26fXcUvoNafL5TZa819DQYssjTLFp3hP79QCPefcUS4aA== 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=k1mi2FeK4hPZbDgmP/GU+BLYQVVpbgR8Q/UkIZ+SyBc=; b=ZFg5FiO7R9KTUp35eMRvsvDyd2RkL1iPILLRT79ns+n8dNZ79orxO5O7bAxCJR2Xy2pDStGrpW6Uar4JjnfAI5qGKUH5oaDIHHxtKJfMMI2eJBwNezEvpFxm5RXlxYotgBbcXSAbr8PZBk8IEvxyNibJaMafQvj+kYwXF46GIUU= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DM6PR10MB4170.namprd10.prod.outlook.com (2603:10b6:5:213::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.27; Mon, 28 Oct 2024 15:27: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%5]) with mapi id 15.20.8093.024; Mon, 28 Oct 2024 15:27:49 +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 v2 3/7] block: Error an attempt to split an atomic write in bio_split() Date: Mon, 28 Oct 2024 15:27:26 +0000 Message-Id: <20241028152730.3377030-4-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241028152730.3377030-1-john.g.garry@oracle.com> References: <20241028152730.3377030-1-john.g.garry@oracle.com> X-ClientProxiedBy: SJ0PR13CA0212.namprd13.prod.outlook.com (2603:10b6:a03:2c1::7) 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_|DM6PR10MB4170:EE_ X-MS-Office365-Filtering-Correlation-Id: dc1bbcdd-51ce-4eac-8831-08dcf765149e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: j5d7T5hgRetEv7/6nC16kiXbMsBaxVfK2DH2SHjx3fECDFlpiZsH8iexsRCeyzmewPxvKwWekxRSW3/6KC838rSDMF5BWmqYHy2u5lh8eVU8v52/RHXPQBM5omD9d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MOc5NAzRa/sJu7BsGWUpmCGEQfXMHCH1seJrQOb+xFvTaI528xX9aG/SjzCIGPZTjVdJFC5w4Vuc1YRp1201/8ienydf5xyZXAwen87vxCfr4rcr/tVERpEkwMFbaMO4vjF2YSG 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)(1800799024)(366016)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FDkA2r4G0eSXRQvnSKzwgg2NR9TAE8fwlOlbLIIQqUQX5n40hBe313AoqcOC7qZpo/PjOaUfgW+hhNV9J/ylDaSnkCwHCjgcT78FBCbfoA8BBwLYE32lLvaKfYGm0dXj/ZPvQHFAYmlVR7VEpUnwHEdP1GmZP3n5SeMyG4Axy6JslHYAgIDsQ9T6frYS27XAUUbE/AkEJsiLn13QOPglxNY8UES0PJX7GV3YimpV98mcMF0ADVFp6WIEMGM1Dk/dV5p3ey2wASaVrkKbEngj2ktLd/r49dPjmdOJLe76HnytdXKwjC1WbEWhynbsuwqi6ANl4OhuWVIYb4Z15HX78DNBVSLZkOTz/r4OLjH+8E4XK5qcpErQylJgTt1lbCU0ZJOpEOuh67MVDvmfNhq+8lrQ3OQ+1/PdI1M8YtiQjQ0zFmMETCBsmnJK328KopoMTyyNU8yoSkIDOiOSR/UBf5WBWlWFS9bdv1iGMc/s7kHcGzGMf1r0fMYW6PFwrWbv4EIq+rDS8O0AE5APYO14th42hwjlEMVCRmk/YUulonRimV805qfRq5+suvmN3PSjKzoihTP+uMVy5x8OZ4P1bYKXN/pp+1nR/L70UlDMEjkUIaKRzQIt+aiygFkghQj/bnIpu0gBIoxF4Avz2xVsuWH9LCHzdclQonNO1LO3EI5ee4uW8FHF4cnN+W68T64pbjZZLe09ABhU5Snd5HkOqN4lLDxjgFj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UgE/t7IHaEuEg9UcWd1sNcXNOrVv5vCelUX/khR2nQ5MwGVHlr6jUr85IOOmzXvkglNHFs7wusMLHpsH2dWZIztBzGpxfj5ok8jI5yg9/kbeNWXpL5+xRb0heOl5yf7bdMY8BHHmoKnHBTm+thtM1kektlAKL+CffguIqxCdGLzcOfFIKGV8YrQxdjc0trl21+YC0XBY//wRHHlh7kLZHoH9fnNsGFyZ6jeKd3ya+1wKmLUd02qVVpSV69e0+RaSDEtSAM27CDqcqIuBn/H2D87bSE0GuUVAmdfsuhYXW6o4Cs0weLEvtT5plsaQSHN187Wnh+6ntU4WO2a9tWoPfauW1FdRhEqGUDzxrCNh4AN5jpfc6pTQxXEKpD8pLkBptIz6Ru0NXD0Ho1ost3+i0d9VaSpTj+Zrq9IYB4lElvcgHrkYtmQkHUnOnIKPVIaGpUNdZple0LBrjkMlWe6jj7qEQ5ShAIgc4rX0edhjg35UDxEZ8kj/Q8yx9hHIrOekNahU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: dc1bbcdd-51ce-4eac-8831-08dcf765149e X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 15:27:49.0445 (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: kzdBW9QaWVn1z3d18LXyCUxudQQVWGuwZRnBP+TmLPFnTFZR3lIL7a0JshylGrHtK2aJYZlqnlUmGIqD08Q3CA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4170 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-28_04,2024-10-28_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410280123 X-Proofpoint-GUID: 74FKbV-mPz-HDyO3drbJM_inbF3qdz6K X-Proofpoint-ORIG-GUID: 74FKbV-mPz-HDyO3drbJM_inbF3qdz6K This is disallowed. Signed-off-by: John Garry Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn --- block/bio.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/bio.c b/block/bio.c index 42cac7c46e55..ac2b11b164af 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); From patchwork Mon Oct 28 15:27: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: 13853680 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 AE5651DE4E0; Mon, 28 Oct 2024 15:29:07 +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=1730129349; cv=fail; b=bfomurXDcGwDf+PGw55ae2DJbL0MIVmCIuzfSUbRSdDajFd5Nhz+Y/C2hkYLjqdHnmu+kTLmeHrTJorR2BBZKQPHmWTMsWBvEFK1WmmmiN618qZcfWCsqp1h1QkS3N/3c2CrLl4PNDRwkAMsC7DGVZnb2YmiRvd473EkzQU0jtw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730129349; c=relaxed/simple; bh=wfJxrWHXPA5YhkPSQf1lq2Qa6GVsnrDhw47V3asnLDE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=tDDMYC6Qsh3c34nnESYR1+oG8PPpCED6D6rDd6p7NR5pY5StgzV/gQvy34/LVx5PzsNylOl9vYyeQGxYZ3ygcLQ5iRgJdxEgnSguYDHekp0eKr3tVWv58oa0ICwgCyPPArMJgWq5eVsVXCgkd56T/U7zlpTpjIb2rSAyjw4dxm8= 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=W/3VQg6/; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=e4GK6mNU; 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="W/3VQg6/"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="e4GK6mNU" Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49SEtbBV022365; Mon, 28 Oct 2024 15:27:55 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=eI/46pvMtf0+TrOXZu8yO8DexourEwTZqsgrWS+KEKM=; b= W/3VQg6/hlsE03GfVcXYzRLtq0oK+OhGT4AmfK0R2XpFeXmeUKZqUcfk9YcAVVJ/ nysCFg515Bxe4NKEUXHnmPOOtqLXpPJjzgzBJyJtRJSfn1YLVVnFSElZkO7WXATh G95FG+oXMkZ+JicUh2xGz8jR+/5mKW+lyz+6vdywM7bLjMQBN0ThL8S2I2ejNksT 20f3E/l8N1uWCMV4ztHaN97fvfhdd9z3c5yvMvvWnpn69+xStmgzre8RzdL35Uka MWyTgYrGIjMj3b6SXFlEkAIt8kbd2XJXXy3xO4JXQ1i8lwRxTdWFc3bMLdtntIqL RrgKs+Lx7RhieoSuz+67tA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42grdp35wy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Oct 2024 15:27:54 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49SEoWrb008350; Mon, 28 Oct 2024 15:27:54 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2175.outbound.protection.outlook.com [104.47.55.175]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42hne82epp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Oct 2024 15:27:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SBN6xdZ3S8AzvXBUhAUITrk2cgQWucjeAleTaylGxjmW2y76tr4WhAzdQ/s76A8vFzI3vlf05FcfVehQaduEHAg0oG54cfU1UezfdOH4Qlj/NDNgejXBZP8yvrL0J7JrspXnG/FBCMK0D0gxNEECfMaYzXufib5MZjNUQVa4PTD6YVUTwU0UNC/XeSQE5BJwROSiXulS/pmu1HPVLlx9Ki6xaPDZNOQK5YitBk8kv5mce79BtI2Yakw12soluat9B5VkQARClqGzdPUGF2iW0jnt+88+3OvSxTeKDFGtjJwtlZMqFxmqlfcn8QYSKBAjq99pC90ansXL3LKFoijYuQ== 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=eI/46pvMtf0+TrOXZu8yO8DexourEwTZqsgrWS+KEKM=; b=nrQgSItBZk3RAl6AIf9kVTIsdYqb14DemeF4BGVuBNXw/LCk26il3oegLVTV4w3kNePu6S7wt2CyIF2DMLoj874vR/W5Ec3/noMfMmt4mEwuLcL3S7Q3FQtwNT73yb/U0D132MAt9AGM2x4c0beONmFzf9UYGg57LPLxJRKWZtgtKR3hxheOX5nJs2ECcYVmnl7VxAjsFYr97M+JP9ZsHUj278kpPFuhyfdvYls16cXRldlQPQwAJH1wHhQ3qU8bLdQ9tzZJI1B7HYKSlGGVtqDFBd6b5J2IsZDOBbg9WKgfhI95nIW7VpNOR986Tgyl5QEHhtn4DdQzIpS4JqGQgg== 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=eI/46pvMtf0+TrOXZu8yO8DexourEwTZqsgrWS+KEKM=; b=e4GK6mNUu3MOww3Kf5L2Vw/4rYTVxyW1Z6ANepQxrPKCxpbwnC35AkNTggPWtXswFcFMTM0WLVHN77UhkW1OZlBmEz4mHswZufoWp0GGi0jBl3C7P5AsDc48xAhOaO8ehIo3Hit46vvYnnn1hG4XOMz9g3k5rBAfKaod2VhUcdE= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DM6PR10MB4170.namprd10.prod.outlook.com (2603:10b6:5:213::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.27; Mon, 28 Oct 2024 15:27:51 +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.024; Mon, 28 Oct 2024 15:27:51 +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 v2 4/7] block: Handle bio_split() errors in bio_submit_split() Date: Mon, 28 Oct 2024 15:27:27 +0000 Message-Id: <20241028152730.3377030-5-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241028152730.3377030-1-john.g.garry@oracle.com> References: <20241028152730.3377030-1-john.g.garry@oracle.com> X-ClientProxiedBy: BYAPR03CA0018.namprd03.prod.outlook.com (2603:10b6:a02:a8::31) 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_|DM6PR10MB4170:EE_ X-MS-Office365-Filtering-Correlation-Id: 9dc59dbd-edc4-4124-042b-08dcf76515d4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: mTvXdpwUOJpr8UEKn+/M7xZfWyIb8PRp0/MKvKmPx7dAz41wh+9R60GLq3w0KSx4iDmkEj6G7gs4b9UTUXOMZIAK9HexUSytPCmFgKATyPjiH82EXjer7BLCxKHWNg2I/7NzvlMggcMINdaf9iFbiZxBn7X+8Ne7/6XfIqYyP8RyViaY11bADAGyHrJWroprItI+pomf1YL5ihdd7rw8AuuBjOpQSmHJBxhjBh1wzvYphJTQQ5QJ/xB4RtuR0eqXvWpgLz1M5qJxqFUkRt+fEnNIjwi3F3JRfX1pf4eTXNjDPaVUdlWSStyA1WBWKWZeIzIhqtdNeGBPZ/Cr2Zb+gj1sJbfo2RvjQYf7lE0v4wxfyVcbu8X7RTNdvbU1EkSuFxST4MRXr2MCRzy4hmsm9xEnd0RPJYaXtjJfzgJzJeO7LMXxeoh5gMpjdzGZTbWBmBROozw+z5nfVWbHh4G7b84gKn+XgVAa5SZhhEezeJZShD8FIqwtoM09e7W9PFP/+EamkXIDd4bGI3spIFkhinNqG8hexcbpdpURFEEqPUErVbAHgUZTsEXQWKyDorM13DRvqR8JLf7zmOpXj68DGoB1aWo75JG0zj4cxJMjYoBffENbsrA8XV3Wc+d0/My6twIgdkUsNuAMlHSWUBRH6BWSKV4e+XjCHzImXKAuSZcp3/MrCBCld/81Wro0nKUstuw5gBjCIy0VjKmPjGJR3yUaL4BimxNjpXiAhb2IBTETPGm4NJ087D+DgIjmxKc6sUqyo8KoXz9dOOIHxAJuM6JRa54SKgDKIymFqKthJy6jzUJKB4lu3EA2ThjtqXVu6hgBFJOzkRtYwdA8ghERWigroodWph/+jdYYmrgfdMmhmEKU5TVNbWPD7tx6rOP/4C5JNimtxqB2isko0kPuyCjwOfD8PV7cC27NwUkXKa+H9N6xnW5ekbT2kgjtOuwwOeyuV5HczO+vSRZl8G+r9FKoq3EAJ0gG1ZAMfddcs0avVRZP7BJRK8uGbn7+uQfN8gkmC1/Oigq5nqh6r76kNxB8gvCe8JmOHvw+o3TBCn/FJtEcplrpi/dS+BgSePYKChEWN8C0ECDmVc8ilcTxJy1yVfputUGHtMhs0dPSB7RatLKfNcRfEqrhLySU36uKCLZAErq0xwMgJtriw3iXwd7rX3cqXXXcidtAt6p7PrHq8N2gkNPkYGQ2GLdHkIpvmikswp13Cmxp9SA9/33M4blaehV4lXfg6lDDYpG/XNvfMA0Yws/MGWEWhZt0q92I27do16OfgGnmLs87rOs5z7HRAykrdzHOZg5WD5pT9lq5gA1Wh/iHNLgQFt69JiUZ 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)(1800799024)(366016)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: L4TtEezXJqzwBtch4czUv1j6BRohnGg+9cIoMwQInEtU+RoIl+4ypnQR0oT5+THSxWL98VCE/Wd6BehrXKWNdIKk1R7IP8WSFC06LvkgN18SjozhIKnMScuOSb2TTPc4OtfSjicg3Ydlr4qvA5qVu+dcoC9Cx+7vjw+ntvTANr28MlIAmR2ikrFPso4XMlQCE0rDIug8eOMAu6K13OscYuKG8lSCeLdUMb3SbboLwFJTbD1jBk4M4zn2pcrFkITUY21f+YdR30Oe479ukxYaiCmblLL343Fm9LWUso//xAf98sHEpwID3hB3TbHooMduZdVdUfDWkCQ7glD1NDXa9rC1uAH+T/65g8qwz+Vlvn8R8qTTqIbkK14x6ibEKlE9NKCV1E34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rHIg9fSMwt/zdobfdsCDDgNJ9cUJtrpiglBAiUTQm1Pkn7vB0BlUSFKeXtfnwZjRDO0apAY4EoOfXw20PuuXBX2MfEYk33c1iGnBeHNcLtsR7sQzX5Crb+8fa1Mmj5BUdzH8Muk0M5Q== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Wp7tpvaGUe9y6uNhRZEwcl8lJKrv+/3WbGs+Zjh+9Rq6/4QZfMcit4T0j33J7lnZj0Xa+Z7dTxvO9GeX64W+PZ+nx4gqt5ud0Xrd97QCZO14CQrYpN46tZI1JOxLeByxAcZDpYhGksbbdrFS8/iOjRpCyZFpjrUI4X9sIl+w5EkHCVUrpf71PeADBRIT9SoxS5Up0u+nXS/mNo2bPCgTlynwumFvYholQfD+4kK2Xl8BZ+Z0NsuwBNJsquxZZhk4KanyPR+pvtuN8J5qJ4oOPnITwNvv/4qMQT2+SNFu8sCM07ip1K3IXXzP7M1cTeSOKSQqA/dZCDqObm7ursTNzPdXV0h2/SCjoLABiOjb7MAsJrhNffiGyGE7N+eUg+Sg3B5AQEUxp+JyNJcYO8NYfYlQNJwQ6uDwVoYUaCu8rM323n3sfsMb4dKsODB8tZKHFUlk7HQsmEdYj9JARU2VvyQTY8ejCrMNkio8phKIVRPUTjzGxZe/5BXYqGfUPnn4R9aKewa+fwhK+vgwiilxpKGunSTBILA83b1YJsROHWxbTMRVBF9p7F0X8A9ewimA0Bb5qSjCeAZ1STEHEYo5gmZIAx6Z9xltBJ7qSrzXHys= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9dc59dbd-edc4-4124-042b-08dcf76515d4 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 15:27:51.1107 (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: ys9UXIIQO4YizarHh4j4Qs8MTAuls3W2mvj/0WtMx5opTys4bexoy0DZKlza6JZW6577DTGbomsBKLTqMTgsyA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4170 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-28_04,2024-10-28_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410280123 X-Proofpoint-ORIG-GUID: C2keqsBry7I5-SxyD7rpcFm7RyX_AuLp X-Proofpoint-GUID: C2keqsBry7I5-SxyD7rpcFm7RyX_AuLp bio_split() may error, so check this. Signed-off-by: John Garry Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn --- 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 1c73fd37cbee..b640477c190d 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -107,11 +107,8 @@ static unsigned int bio_allowed_max_sectors(const struct queue_limits *lim) static struct bio *bio_submit_split(struct bio *bio, int split_sectors) { - if (unlikely(split_sectors < 0)) { - bio->bi_status = errno_to_blk_status(split_sectors); - bio_endio(bio); - return NULL; - } + if (unlikely(split_sectors < 0)) + goto error; if (unlikely((bio_op(bio) == REQ_OP_DISCARD))) @@ -123,6 +120,10 @@ static struct bio *bio_submit_split(struct bio *bio, int split_sectors) split = bio_split(bio, split_sectors, GFP_NOIO, &bio->bi_bdev->bd_disk->bio_split); + if (IS_ERR(split)) { + split_sectors = PTR_ERR(split); + goto error; + } split->bi_opf |= REQ_NOMERGE; blkcg_bio_issue_init(split); bio_chain(split, bio); @@ -133,6 +134,10 @@ static struct bio *bio_submit_split(struct bio *bio, int split_sectors) } return bio; +error: + bio->bi_status = errno_to_blk_status(split_sectors); + bio_endio(bio); + return NULL; } struct bio *bio_split_discard(struct bio *bio, const struct queue_limits *lim, From patchwork Mon Oct 28 15:27:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13853689 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 32E611DCB09; Mon, 28 Oct 2024 15:33:07 +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=1730129590; cv=fail; b=GWIAxx6P/Rj7E9zrmxst1onWXeKjGqMNyEoOQm1SfNmuB9/DfDqq2X0/bQHis9Cws7h3amv57w6o1hi4MTRbAUNNJ8/Y/S/Sg18qE+xgK+XF0gGtk4VOl+lV8qcRlc/PNoqW8+RnDqtnF8qZCzC6Vs5h81EwOxIY4kUwLo2AbMM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730129590; c=relaxed/simple; bh=8WGjZZ2uUdJqXAx8ssuat2BO+LakOC7yercpb8ILtNI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=EiC7VLukD8ZABKmwzy7nvfANn155zrEOUSZjFoiTgyXp4/OTgfPoMW9UoEUVpeyQIz+psh1bgxOtIrq/lfUsPXfPpbOATEZKJqCodwPEHDyBAJKnNBsdU2rxTTRWNIC0y89AagYMrBe7eE0OxzqQgSL6aKkOztEcb9udXEH2RbU= 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=ayfU0pu3; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=uM+KlPAr; 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="ayfU0pu3"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="uM+KlPAr" 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 49SEtdEC029653; Mon, 28 Oct 2024 15:27:55 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=s677yWTqAq4MHUiT5TjTqne9AHZBYCflsasBGA+1yro=; b= ayfU0pu3R1WB26CY6yLy7C4AphW13EHxYBy4m6qxA1DepjdQFVv40fAPF2v1aPUv S0P0FUTNB0JIrYG3JtqW1hFfFu61lbj+Rv5XTSVErYWvtss+d3wnnPLpWOoUnO2x mB0CX5vgapclh590VwatEQBmYIVk0lYQFF2Sfmqh1rOm58BPP7HXPjL2Q/89VjsG 8gmLB0qavT9URLkBhy8rBL5enRkauhCJUbLPFZReQ6hxF/wrinaoERFwJKBK1TX7 8MPTDA+hUm26UNkCgLArhdoQ+hdcZjP6d4Y4ib3lbMkf0xHhzU8SYIMqM3EgODDV CXp8XKCHUD7J6K/MI8bUCg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42grc1u5aj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Oct 2024 15:27:55 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49SEoWrc008350; Mon, 28 Oct 2024 15:27:54 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2175.outbound.protection.outlook.com [104.47.55.175]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42hne82epp-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Oct 2024 15:27:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=R7Dvcei+woKHu0/Hk5voMvnWItNOpQDSqwmkx4T56R6v+mLtydVSLKBISp93Hxx79hgXJH97rPbtpCEUcPS/TA708FdXP9vG+VqHGLPN3P5yh18vNb1tvMZrCzMDW66uhS0NTl4Ko9RAjIBGNFQeVaqPjNz2gJ5oyQLQp3zAi2UmyWEjuZ2PubB05yYxa4HgkXHdVo95LEM7g75M5cukim9hvwt7zPHHKKQqwGsCyubDQZrcITaQWxbKSsgek/7r1eAEDmjX1WYmv37ZNyerKkdywMN05oRtLuWfy/2RUvkSQQqaPeVb5/p4+LxLan0+xa06IrVcT69rLiMTzz+Zyg== 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=s677yWTqAq4MHUiT5TjTqne9AHZBYCflsasBGA+1yro=; b=f5CuOk342eBcnmpOvD8ehHYDrojE8T0xmPm2aFsch73n80BKr+5Z/mqX5F9/5qj0Dby6Rh7IajPBo5enoooTpTkQCkvPVS63AeOAco6Gt/FcCXGkLddLjrLXVHW/7Knisk7umcZGJ5C4cI7M4mPCZhanzF4D1PDyuZVQednr+sSJGHNRnyG1MsqydtFg6YF+SxVndOz8/C941wjHHf2G+pT1usWRKQyVJZW81fAm9YwqgWf8Zfoz+wqJvc5RCA8GIXLphv6OkEbrK+nU0CIxBOhYekxwOehXr4Ic4iw6JcxwPfpugWCJlFmx54Wu9Yb4XCqe3LGesZ3RKd74UCrGtA== 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=s677yWTqAq4MHUiT5TjTqne9AHZBYCflsasBGA+1yro=; b=uM+KlPAr/wrm01M1EkFdwsOaGqdMwFa9LJgostCyzzimLkyQZXCuw/rxkpSzHlxwfJF6e1EknETh8k9dduLb3i64NBFgrYxg5D6lLjSwaRfgxulDItWNQQ3sICp+I9f6rlAq2EBAeh0c7lVBUxN+jmuV5eYSF1Xl8NuD/R0QG/A= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DM6PR10MB4170.namprd10.prod.outlook.com (2603:10b6:5:213::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.27; Mon, 28 Oct 2024 15:27:53 +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.024; Mon, 28 Oct 2024 15:27:53 +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 v2 5/7] md/raid0: Handle bio_split() errors Date: Mon, 28 Oct 2024 15:27:28 +0000 Message-Id: <20241028152730.3377030-6-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241028152730.3377030-1-john.g.garry@oracle.com> References: <20241028152730.3377030-1-john.g.garry@oracle.com> X-ClientProxiedBy: SJ0PR13CA0220.namprd13.prod.outlook.com (2603:10b6:a03:2c1::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_|DM6PR10MB4170:EE_ X-MS-Office365-Filtering-Correlation-Id: 5f3b22c9-62dc-4d14-cd8c-08dcf765170b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: LDnYOzG69RtQuw+Y9A9ji/+t1tdZLgU6xu8Ldp5J0OGtJVl2FFFFuDl63VOqyc6nLOGMgi0DBUGXQLUlUTD8t+YaFeSSkMP0n2kuOWDEZtBIrQcKx9tFS07XfDY7UTDAIDJQX7vbHBS0qBdMSzNZnedjBf13qoPlaYR7/dpLQN9yVXFN2F5DkrjdS7qu0ILb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rBqJ+Whe212ntQyaS9oA/cIBwgC7xFNNQXw5yk8TKk= 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)(1800799024)(366016)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZKPBH+pqVAW6PmyvWSEU7D8oEi2YamqaVosxnl8ifSZFFUtop9RaLn+Cj2wrUQE8+dqYutbyLkbbPZb30HKgb5LvuigYDqJ3S6w16NeVwWrqpCKkOPdjsO8hGtzTpTacm0Ai+IO37krTnxwggjLuT3PAwMgWt5tNpHyDwwx6hsxnhWg39RHrEGegkFR+KCb16qtnZMyYrck6jK9DlUVJgFBDzb6Fj+IaFBNXxcV4r5CDwdZ87NrxXjIgjGzRCCxQkmkcdQdrhziVYy//9j7OvzfKcgolnqI0l15oUX8l22t59vZtRHN8Jw3n28NR2gc2myxFoufGrUk5Ck0zh3Pp7VlVexKmVB8N4F4ehz/4Y+2T4DNo6CEAhvYzB5DXTIWXl6oenQHSFE8xxJBtsXVkamkhuHoGkRqHrpHzpIf5SRv4WmtHF8weGRZO6x8BJXZRR7NFjCl4MdONSDZA7+/Jkxml7uMfMN53uXMXJjJCTXULzTos7DQtjigo2uCmJhvKMBabH1koe584GCEaJgVx5wwu05NveFopqhI8JdNZ3nQ4BXmLLHCpXBj6dlVO4ljB/vGhNpjfu7zIuApHn4mnrXyI16Xq2TnsO/ESydte9TVSEWDNqYNrVKunYr/a9vAFUE96BW/zyoEzjFNPrpUpUCIUnGeml2UI1VivB/S3uVi4d5+XT/r9VI/bYTENr7b3OhWT6uLqgRS2jl4fjLhBL4L6jpLqRNlPs/zCa2aNmKgA4cjwAb+67pjOJRbl8ZJR/AD0zG1rpYrgg0NyLp1Dk9Zkes5XMwFmk1ZfhtQtr+8cB16Gr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ASGCE0JYNi711jd5xqHsiWIux5249gcBFE6VTxA7t76F3SU6WiymUC+Xx7axneACFwSmIQMeNGkLBwUbiC3GMHdkmlSkAvslYWftijbbzyXBLqGX+aeWToUVdKFNz2OOiXD0U4JotuU6cUYjblWgseGfD7fJB9qOiDehqtOGIsQZySJ/qZC0LLt85291N5SknjQUsxs6rehN064PQeSmYUAJ7Rd9RWQ/IpgGHWp0iRQ5mwcMcg5MVDB/gp2MD29+jNW3Npk+QK8blalKk+Jd63E+oQ4ZSiYtzvw8/3x2JD1vg1Bbk/e4I5CIq9WchdemtKtldbbjhzS9wIBlVsP7RH1o7bTjcZd3amhUpdfICjMAMvUFH7NLCoVWRndW/h3Fgi052jIfEzfesyeXITlc3avpQY13IwafaP0Ug+M= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5f3b22c9-62dc-4d14-cd8c-08dcf765170b X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 15:27:53.1698 (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: kKiMwES/+Gf4yCHNo5Fit8HBOncmoR1S+7asj2PqxQ3Eo+ljA1QYEYqGxuOuBi+P2Pcorqz99hSOgxtd7Wp2FA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4170 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-28_04,2024-10-28_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410280123 X-Proofpoint-GUID: ib1Gd2WpcbuO_Xj_DI2Mrit6vmwj0ADl X-Proofpoint-ORIG-GUID: ib1Gd2WpcbuO_Xj_DI2Mrit6vmwj0ADl Add proper bio_split() error handling. For any error, set bi_status, end the bio, and return. Signed-off-by: John Garry Reviewed-by: Yu Kuai --- 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 = bio_split(bio, zone->zone_end - bio->bi_iter.bi_sector, GFP_NOIO, &mddev->bio_set); + + if (IS_ERR(split)) { + bio->bi_status = errno_to_blk_status(PTR_ERR(split)); + bio_endio(bio); + return; + } bio_chain(split, bio); submit_bio_noacct(bio); bio = split; @@ -608,6 +614,12 @@ static bool raid0_make_request(struct mddev *mddev, struct bio *bio) if (sectors < bio_sectors(bio)) { struct bio *split = bio_split(bio, sectors, GFP_NOIO, &mddev->bio_set); + + if (IS_ERR(split)) { + bio->bi_status = errno_to_blk_status(PTR_ERR(split)); + bio_endio(bio); + return true; + } bio_chain(split, bio); raid0_map_submit_bio(mddev, bio); bio = split; From patchwork Mon Oct 28 15:27:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13853679 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 C93521DE3D2; Mon, 28 Oct 2024 15:28: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=1730129295; cv=fail; b=dlXCPqun/IjZkSUfZY8L4sf8vTF8qYxoVwf+e9wa8lzQx0EfC0zsUWCUNkXu/gBGPkvGqZLCndfY+ShisFiM9/yVhEGMwGwn13QSNIsmsCkf9JgLghGydiCUsVVMuC/JRCBKejgN0AiaPxiGyKiu7JxCyNdRjxa5Z2Uq+q+rEwE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730129295; c=relaxed/simple; bh=WoI/r1QWjcKziwARogBwfu+3/1dypH6ZqHWD7GAU9AQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Pc5t0Ifq8Hjavxb7f285PJxmsGRt2mC4nHa2lKA9DdjAUgljfO3fVv8UOgzUATgvFWxgrxe0larwkbCS75WyhqARlWP4JTcdzAl5SLzXhqFLONiIUIWunhBm26dV8ctQbxEZCriJVsJ0GrZkRDqORQAI8FNuBEKb5Nqs1CtwhdQ= 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=gGFDrfhv; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=QFmF1zDn; 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="gGFDrfhv"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="QFmF1zDn" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49SEtdr2020892; Mon, 28 Oct 2024 15:27:58 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=PSfIh2A/tpTl7ijGOPTvbARB0SZo71fMqtf9XqBRTiQ=; b= gGFDrfhvU3nXZznPw2nrZEYV4BdZ0NDNtMhnEIi7BfArdZN2K4y/JLEK7X2ZHAsl ZBn/WYEzXzI/A2sfJyHIYXq3rf2ZDwjlDtOhC8T/27m2MsYDrEfJGgpOjiYpIkk7 AXKA6PA9d7FIRnlCCs+fv/D5/NHNN8bLXXxI6zA2sucMoBsWpn9etsdPi0dwX7lN 8GZYgnhZ8kdagTvGSB2YOWzIHTDriKzd4vmvyG4Zk9/kdr5ywqoFGgPxI3FIABD/ EtclLCAO+dRW/2DAuM4CgQxV+bTRdlgg/JJeQ+8jPXkksXkAzXILLw1qNabDuaNb DNg4OB/hKwdngP4hbLntmw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42grys35py-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Oct 2024 15:27:58 +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 49SECO09040341; Mon, 28 Oct 2024 15:27:57 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2171.outbound.protection.outlook.com [104.47.59.171]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42hnamj935-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Oct 2024 15:27:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nOicKrmdv+FPdaZXAvh2Jc/p8+a3NG89mkvDl4+CbkHgq2SGKPH6CIYscmHRkSemL8N/9fPLPqkcldUG4sOa9YMhnl/x0saKbIVltVA0SIQfRO207DYIzG2N2P3icyKYeU0L98Ll54HGvfQjIUcP96vYfQtM8J5MlJe4k0lK24fUa63Y2okbHJaUiZy8XndFzSRl5qaHE6N4MaiocOtmxpjjOIRdhEwbfb2oKVlUbUoERMOqhYBx1euIKp7hUg3pmarvW3gfa0QMBOc30N3eHal5dFC9TE5vWW0IH8KBXG111DrmPyUAgVqfvJhPgAW1H+4yQy3gBn1F+ly0LJXLug== 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=PSfIh2A/tpTl7ijGOPTvbARB0SZo71fMqtf9XqBRTiQ=; b=rxJwDZnOWKCgVlp2AYKwQViYbv07GFKY/874Alh3yVi+/0myaj8D+KHYNO3ScRBWMIvayINWbMAnpUknD6OuX2v4aakE8KDJ6XC2bEqEJj+QUhgOuPU6FFhW2OnsSb8gEVIzA5hGN13iZGkoN7mWty+X4jBpcqD2u5jMeiAu9HKPFRO10Z3C1EpBJzFGrbHCrJPWZ7xB1vdAjMYjW4Zq4Bx0s13r0LggZqi9Kn9N1okTF3Ngh9Gn26bKKIiKC/7ED+WrPAxZNLNoXnLC6HfBsbZORqg8XZO0hVbBX3G1PmIeFBm9qrFXc1MT/9yUPb065T5o2a+0jHyImqsv5M3Xhg== 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=PSfIh2A/tpTl7ijGOPTvbARB0SZo71fMqtf9XqBRTiQ=; b=QFmF1zDngODP+im4iWkUFRT1ul6unHIKUdwu2koCYwDZM6cKqea6c3sVaQf5iU5jQ4F5fkaeEx098cEsd088fKqH0gS3u2lDjAhb0+kU5ekTwFR6QvOOu1b9Q0QddoFuaZ3dXW+mcXXz466Pd56H/2sLHoIWUjjG0ZwRGbnNvww= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by DM6PR10MB4170.namprd10.prod.outlook.com (2603:10b6:5:213::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.27; Mon, 28 Oct 2024 15:27:55 +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.024; Mon, 28 Oct 2024 15:27:55 +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 v2 6/7] md/raid1: Handle bio_split() errors Date: Mon, 28 Oct 2024 15:27:29 +0000 Message-Id: <20241028152730.3377030-7-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241028152730.3377030-1-john.g.garry@oracle.com> References: <20241028152730.3377030-1-john.g.garry@oracle.com> X-ClientProxiedBy: SJ0PR03CA0390.namprd03.prod.outlook.com (2603:10b6:a03:3a1::35) 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_|DM6PR10MB4170:EE_ X-MS-Office365-Filtering-Correlation-Id: 6655ea1a-6705-4c74-6b17-08dcf765185c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: fMPpf8cGOz6TBd/Kfa8QnRJhIb7ue1Gf4IKCLuSVb2/8du2dqbWfuBEFBVa80IWWHHalo/GBDlBqlCwoH2GYs6O6eJQSu5+9XpVEB+9CSVG1ZSvv7ZUZYl413UukW9N22Fa1KXkQsP36+Mv/3h92U0pQxKfDvP5kmINzkuEKO/fKPr6OEYf4u/inzJRA/RPgkodnyJNISVdnbvy4LViuwvmObWFioJqDGmnSABOZBK0F9uUg1ZlF8QoSHmkaBFZ7AetzUN89MmefsZJlV2B7DJADaHzPMj5bjphlzPO9SveAPjDEaxBAOwJWdlc24vDAOduy0mKOmHVyYheuEFQ5Rk8EQgUYn/cpSid/jSRByTUGKdAf2YgtkCQK1yzFsPPPAwLGmYRuBZ0dKDvBdpKNQimoD3g8MUuXEQ0DqD4BtR6XSlDR+qfywAk22/BwIqD7mwfemDMTfoMPhuFofNKPuMQcnQ5KU0vVTlhDPjV9OifzlDy0mgC5GuU6BEBP4E+xXcwXZijiXt9bNwS7kLy4c1d0chNeHc/L2zNrC784NQZVFvcLe/osH+nPhNEOHLmuz419va09ap+OLLgWhSwab8jXtcKj8HzERhFVeVp6d5PKLKxV+pakej9hO8wy3vzqGIt5xE79nbV4HHrJutfX2GYsjKdbEjFyu+ipCXFHoDbpc/BDRm+brbdSD4r4EFE2HrgDHPnO3iUUzrIvizM7JJ7I7zkhxh6Earpaf6SR/T4Dg15XdPvegYMLE3iEIQ2+ViyJ90j8Mzwzv3dwXBXEdvInZQOfJO04Izza4D29/m8dqtU7CPXuGnZSraTBckg+FPKwe+2XFLMKl5oCpsLZ5cgzgCulzQ6QoCuxItZz5C9D3l4lXKUXNMDxMcg9BXofK0tULbiZhoXKtoE31BtozEGFE5oyXsk/h6jvsDvaknKYtkAiqbTAHJpujEERztBTcpYcXj4v8mejxoMU2waGd0HGJJdlzXSi7Drv1DAIAHwZDmsXwgixx0ZYLZHaI9REci2+bTLzIqXPnsnbJwjpxQBmqrXOMSERBFMGa7LvTDfrnX5FR12TPURLT2vsBQ1rHSEZ7SbjvEaWqIk5UOy92dNywO5i8CVSZzT7HiGFirIzQ3LCoSM4L/1ooG9z8mohuEpRgaqcVnZzFDnGZ0Aqk4FIQwG0sLGU0OfqwUKkjTb1HH3RJC3UNlVzY4yLE7yvgm2lgo214iNfMo/Vi+KDXYx3rMhpD467kGvcMUmL0t4mJiOA4aQ6Bvont+6LQeWCQC2NDWdKMgD3I/erjVsMq1MvQOnKzgrovYUvIQu9F9HY4rpYmVDAhWXmo78gOeaw 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)(1800799024)(366016)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rwUJhx9zp7JT/lGaQ2j7bzGGtxJDCb8W2LrsI7Evg/hSbXVzpA7yIsqzqGoMX6RFTuY0Iag8vazR+EK1QnetB3xSNhIxOXrHb45FDkVc7Xncr5ImxKZaNZGBPI9hQi37HwpcXk9nTLHLLtNp4vslnlZ7nz43eeza0YbLC7FWD5sG9ynUIt5X2XJAH/eOLwk15TTgagBhLGToNaGbQ5urFxp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Z+XZwRqv91Z4r4tzBgKhMSobZ5GdIZy9sZwznmhqe2onx+2P4nglnzWNE3XzU7Un4y65utLwgBxl4M0obX/hFrSzIKNYC84bgPRndVDT/YEFSTG79cMFtW1LXDurWUzhdM9WmVFOWwRgOfleQ2liAYCuOkzarVgLOzAR6IG7RDYpL/szKkFkrHP2paZXyn0B0vNxolVXXe5dIV8pKRAIJwV9+jAFxymfkB3fcb0HgZK6R/BEAvM2RstcLdOB32Eayk0l3XlhqFZwHwQhhBaVxY1Z04ln2+iX+Jp8ZnBBjFpwBHEgD0GTCZGfZEY6p8wj7Q== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 7QR1tIKT6NXK06drnLwpi6Yv/HppaUSTB36DWF2lMUWNdpIBjCNfpm7AKR3v3Mhkp/dAipxN1DoD6g40kNkL6zpxhhHT5hgubzMozOUvaNguHoZ1qqULKFNQTY9jpIgwV006Z/gWMOA+baRCJ8e+zr94kOtKjDg7tKagWyOE6pRHoVjZ7Eso4dQS+XrpJ+U23taWD/mFv0dAzDBgiAXyrc99YqT677TOaXiZt9tVk4lQVoCf3xqYqcoPlvgSQyJL/N4lazX0C+Fuw7eAm/890o4WTHJ+DfjRNIwiLXfF0hIV/k81oj5q7NlHdMVKOVZFeZzdWWtbhOpoiNPWWNRimrT+lXBx1kpKMmxEsms0rBzf5lOxd8xtT9hbBQNZ5B+WDapXksc2+f1TXA3ubIu/yLdDSj6361anMdjmPo9pY79t1Ga7ktoaUQ52qUouEJM5Fut4EWGaTaJZBuiN3IVvQmuAeowYxqwMx0zfE76gcWguMyZFpFsge6CSNgSVegq2vCcahuR5vhFqnhViterNnyjqMF1CrfWXDRQHB4MMyVQcOfSVlfypWw0R9YwAHtbz+0HkGWJG3hZ4g8fP1WVrBJzhBWa9RG9tPShJkCtMXvM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6655ea1a-6705-4c74-6b17-08dcf765185c X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 15:27:55.3782 (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: pGuS97pJqEnB5njhAy+yNNJ618wRqs4xK91Y0yTwyqnYWy8EmnbPKxST4SMrG820857jFTHx9KLQrwIIO4XrCA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4170 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-28_04,2024-10-28_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410280123 X-Proofpoint-ORIG-GUID: fZztBXoHjoptEBLDejg6y-Ar02q20RZz X-Proofpoint-GUID: fZztBXoHjoptEBLDejg6y-Ar02q20RZz 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 panding count and NULLify the r1_bio->bios[] pointers. Signed-off-by: John Garry Reviewed-by: Yu Kuai --- drivers/md/raid1.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 6c9d24203f39..a10018282629 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1322,7 +1322,7 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio, const enum req_op op = bio_op(bio); const blk_opf_t do_sync = bio->bi_opf & REQ_SYNC; int max_sectors; - int rdisk; + int rdisk, error; bool r1bio_existed = !!r1_bio; /* @@ -1383,6 +1383,11 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio, if (max_sectors < bio_sectors(bio)) { struct bio *split = bio_split(bio, max_sectors, gfp, &conf->bio_split); + + if (IS_ERR(split)) { + error = PTR_ERR(split); + goto err_handle; + } bio_chain(split, bio); submit_bio_noacct(bio); bio = split; @@ -1410,6 +1415,12 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio, read_bio->bi_private = r1_bio; mddev_trace_remap(mddev, read_bio, r1_bio->sector); submit_bio_noacct(read_bio); + return; + +err_handle: + bio->bi_status = errno_to_blk_status(error); + set_bit(R1BIO_Uptodate, &r1_bio->state); + raid_end_bio_io(r1_bio); } static void raid1_write_request(struct mddev *mddev, struct bio *bio, @@ -1417,7 +1428,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio, { struct r1conf *conf = mddev->private; struct r1bio *r1_bio; - int i, disks; + int i, disks, k, error; unsigned long flags; struct md_rdev *blocked_rdev; int first_clone; @@ -1576,6 +1587,11 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio, if (max_sectors < bio_sectors(bio)) { struct bio *split = bio_split(bio, max_sectors, GFP_NOIO, &conf->bio_split); + + if (IS_ERR(split)) { + error = PTR_ERR(split); + goto err_handle; + } bio_chain(split, bio); submit_bio_noacct(bio); bio = split; @@ -1660,6 +1676,18 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio, /* In case raid1d snuck in to freeze_array */ wake_up_barrier(conf); + return; +err_handle: + for (k = 0; k < i; k++) { + if (r1_bio->bios[k]) { + rdev_dec_pending(conf->mirrors[k].rdev, mddev); + r1_bio->bios[k] = NULL; + } + } + + bio->bi_status = errno_to_blk_status(error); + set_bit(R1BIO_Uptodate, &r1_bio->state); + raid_end_bio_io(r1_bio); } static bool raid1_make_request(struct mddev *mddev, struct bio *bio) From patchwork Mon Oct 28 15:27:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13853681 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 723351DE4E0; Mon, 28 Oct 2024 15:29:15 +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=1730129357; cv=fail; b=Lvb5v2REY9ldqUF6bBhJNix9ESQrIsHKuM2x3tBbVRJRtkzmi9lvJ07Wxyxn+GEgQt9T1z8vWxq9sSlex/59emNlYoAl4lTdQZkwlBkwd4HhXESU6DRXcyhRsz8FysBFUKEINR+C0IE+6dgfhQOCrqbjhr5xepgaXFL8LTWF2gk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730129357; c=relaxed/simple; bh=iTpHGOmou9QZgep/pRVn/CxUTYsxJkracQjiLbQ/YLk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=WPWmLLmqIXsKy3skm+/2KjvNfqPOBVMYfHSP/xGadEAaypTjx81V/hFgiNRf1YBEtSbucHKDSqsgXQaCjQvx4lAh9MYZqaBuo8+JzGNRjTAqzLJFdLFOl1BSMKRhmb6M8C7uGLr4e0UhqxETtzJi+fsN0Zz1UruyV6E6YiKepCA= 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=TJECCVZN; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=I2CVBH2U; 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="TJECCVZN"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="I2CVBH2U" Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49SEtedf020914; Mon, 28 Oct 2024 15:29:02 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=Q5CXf+PHJ4l2cVACcluwS/nmIExXFJ+hJGBwEkz4JSA=; b= TJECCVZN/54XgYb1sWXw6vHsjbRMyfzrEyM3ZIltrcHl/MsJfd0z9A/s8hGreE6q 0GRsoV+l0RWFk3cCAHUWV+G8I9wzyEG49psoFdmRpKVNHrMSBfJ3y/bFRRsCyfBM 1HpsrqoSiTrRJLnkCxLymg79+eze6m9r234T7Tx4GvFspuxzEphDBmVi5czpKzkP 6QHUmPhbTcpWuv8rLSMkw1FH018OyGMl6v2F9h+EfMtzacdXPrGnNFI8DHJNIl5f Stin3NwO91fiooJEvK2G8HNFD4VHv+Yh6EjoVjgzf+rf92HCS63rZ9Sr+aGaNrtf GYZ6dIB28dDSHNF/f/GqOw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42grys35sm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Oct 2024 15:29:02 +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 49SFFiB6011746; Mon, 28 Oct 2024 15:29:01 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2048.outbound.protection.outlook.com [104.47.70.48]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42hnaavq6u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Oct 2024 15:29:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pWU599GgKHgdW7hXUfyduYzyZ3PhA6IqCIQA5x+ubsY8PNwXY2U+ZUPu8UW4WGbcRHbQgZoSqL0xS3KOid++nuvGCi/RmslZLlT58pSqFHXOm1hmc/GGCCtbfzUqx7Uqq96UlGvLW+lAUWA/C516dwl7ZvHHAi+U+KsP51yTIIiQqN1gRHRpPFIycnvijKzLKD73DWRQXAPnsg/kEvhIWFPYQgoalypo5X1c0Che1dov71mNZ3HgAp72X5kbM1Owuk2nqwOukzVsZwGrljMWB7+THKpshaaZrLVpTbR705cg1FIpGL0EkJZPemSuIFsML1zhDR0mwrOF0JklXBVR3A== 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=Q5CXf+PHJ4l2cVACcluwS/nmIExXFJ+hJGBwEkz4JSA=; b=Du+Maqg1Xwe7/bHkCSvriiBPdvDwKg3Hh3MfyYrAjFJ8blry3ozUyRHRmK6I9ituslz3pgUa00wr9FGwOStY5XbEKusoLdD39RB9DAkNyBQQz0m7VkoPAoiXi1MIZ1udxUZmL7aItA7sXK5lKxTGTXpoghW7gWkJ0KojubgiTc/mnp6bMudSloD5i7CUxX34oU+JDUx7cl8ML3QHtQTng4TNkXL9PcEajS7i2eYEhVgsQdlVhFtARRo7dV5pBPKPkHJjfCr8TE8o10dfQUry5aSubxHWZZdaoe1iuOGt9uYCyI6mJ1TmpyhPkMYPapABA9Vm3wPlybgv2UonZaIxsw== 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=Q5CXf+PHJ4l2cVACcluwS/nmIExXFJ+hJGBwEkz4JSA=; b=I2CVBH2UZxrX9TIiYE02DrA0mkgtUqZPSH1BsJQs4W1Fu0dna3Qx54CB9RcNn0z6u8cgeiYev0+9Uo2pp77BS59rQaAJAuidNGEQzjTPAlUE5pSmVTVzGScvved46+iScmiUXrp1Jp30g2dnqw6dXueEaeKn4wk5olRNEuQa+3M= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by MW4PR10MB6299.namprd10.prod.outlook.com (2603:10b6:303:1e2::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Mon, 28 Oct 2024 15:27:57 +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.024; Mon, 28 Oct 2024 15:27:57 +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 v2 7/7] md/raid10: Handle bio_split() errors Date: Mon, 28 Oct 2024 15:27:30 +0000 Message-Id: <20241028152730.3377030-8-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241028152730.3377030-1-john.g.garry@oracle.com> References: <20241028152730.3377030-1-john.g.garry@oracle.com> X-ClientProxiedBy: SJ0PR03CA0155.namprd03.prod.outlook.com (2603:10b6:a03:338::10) 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_|MW4PR10MB6299:EE_ X-MS-Office365-Filtering-Correlation-Id: f73769d8-dfdd-4f66-fdf2-08dcf76519aa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|1800799024; X-Microsoft-Antispam-Message-Info: CQ9NXAyzaCe6jkVKgn9S/yjhnbCR7yPbpK6+4LH4tCsq/N0cDzesGdfDGn+D2OQHch7ZHmKDiKgYCGfOoYC/bkDOF0gJlcVjodTwjKCMD59lOpigMOHP1Tnb2sq6YwrVRrN2M6wyvSLffnM7CplUH2pP+flKsakWbubiB1JO11GlXrFf0PQCxK0S6G+vUB4OIGLUKoKXi4Licc/97BBkhvsYJmDLWAYnstTQKZ/PvWvMKIqAyOpp0OeXIA0h/jhgTFB+bvmQ+7jt7CdbV/FuVCHK6uqP6Y2hDTt6oZ1F9n4OKI/gaxer/MeNLlwpAxWdQaXF0C+rCyDWQQivacMmSwflg032MWgssAaJiDvqwq7+5Be1iIvJYp6Bs+9hJ8Pax69ZKXoCsEu1JoFwh2krU0lEDFhjglebyaP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tq9BL9LMUavzJl1nlB+h7TXRxluLPXProOyFXRjDoCxSuj/y7N89X8L9hzGLOuu6mUduycTlHme5QT8WkYJvGtfzlnFh6Qk+SJOWGIUo1pNTxSREyI2QT/NnvNTa0ILkBJbw09miB1S07A4fvddvgBq/YKH19vARy5aPZNZgeqPQfKwT4r9x1Czb5k4b7rZT52KLtootcd7X5Dv9E3OpYMKozEX4qtX2hCu+iCjyjCi0lPbkMgOEHgwtpCBtHGpb80GPWI8lLMDNO2fvq0S9+mHi0wA7aYR65euZeDd8UvqsZvWninwERU/+CCaSOfWbOH3h/UNnpjP8AKdOKD2ZptizDLg1b7kI0f481KOrOCo258jFVsS7d1DUfqIEx0mxFn0L2zXfo8dxEbB79H/samNFYnuH4OaI0MttvFdNqkhKXMZ+C9vDHFdzMaQ0plf2FnbPQWuaDBOMe6r4o8oWJmFQXTGtmV/tpCp44vfIpMjhIHVz2/pNGZ7DfMAhsRLrv/dl7QgbcMS2taBkId01AM5yHqCDVAIgjAVSf5o4jTtBIyQmdeQMzKgpRiEQD1UJ98gn0W1N0jHlLb4avlQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ApcYgCrxHEY3T3HRIQ11M9OLuKY0AYfHstDRd8IapBXjLA8s+WVlQktouRfT1mcinAp70rwpJmQv46NzQTogrWFkayydeIS7KnlXoOJk8Ki+IQr/hdBeUTLSF6ZbKNk0QI/2DTfDemD/lFv3cwIwYrLXRwDedyvxwBaUhJKoaCIv23H4m/TIBlKXcD62+SHCnMWiRU94ph6OlUoblgce8a2U170cQh1zPohfX++87v3hp9n+SgVg2iZekCk5VFmuDFT6glzUZrAApWrGWZ3p7Dd6K2XShusua3KViLNu0SECQJnW0Og9sT9TWHWNihhj6bNPLCr4em6TcXsQKOkCacIrzY9VM8XdKZRFe4cbU3LUalJG+rfCm5aOc8xmoFebvTXbftbGw+dKOzifLRdMGQG6LHBocYJmuIZ14BxYN2F7+kj0uIYbnl0kkmUfciawP/8UgNnBKQTnbvUJDPxw1uQIa+3PGDRwdU2h2olTrni+08zTdikqnKj5Ux0de9t+uh8h60OnrjTjHaLSAI7LukTp1C/ZhK/QKR2ld2m2H58PDSXT5tQAuTfcRoudHk5Btr8MJInuM9gqth0FTCdsLDukIU/lHPYD/savNVhBn7o= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f73769d8-dfdd-4f66-fdf2-08dcf76519aa X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 15:27:57.5726 (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: /sTf9GOY8g6wmzp4G4NfYcHuXrXsMEWDtov9nEwiyiK1Q5ks1NwF/4oYgXWfvtvvQcJtISBSghAmFTW+gowwDQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR10MB6299 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-28_04,2024-10-28_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 spamscore=0 bulkscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410280124 X-Proofpoint-ORIG-GUID: TBTtwxzJwTIe6riRWRu-RpkVbDyxXMYp X-Proofpoint-GUID: TBTtwxzJwTIe6riRWRu-RpkVbDyxXMYp 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. 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 f3bf1116794a..9c56b27b754a 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 = r10_bio->read_slot; struct md_rdev *err_rdev = NULL; gfp_t gfp = GFP_NOIO; + int error; if (slot >= 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 = bio_split(bio, max_sectors, gfp, &conf->bio_split); + if (IS_ERR(split)) { + error = PTR_ERR(split); + goto err_handle; + } bio_chain(split, bio); allow_barrier(conf); submit_bio_noacct(bio); @@ -1236,6 +1241,12 @@ 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 = errno_to_blk_status(error); + set_bit(R10BIO_Uptodate, &r10_bio->state); + raid_end_bio_io(r10_bio); } static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio, @@ -1347,9 +1358,10 @@ static void raid10_write_request(struct mddev *mddev, struct bio *bio, struct r10bio *r10_bio) { struct r10conf *conf = mddev->private; - int i; + int i, k; sector_t sectors; int max_sectors; + int error; if ((mddev_is_clustered(mddev) && md_cluster_ops->area_resyncing(mddev, WRITE, @@ -1482,6 +1494,10 @@ static void raid10_write_request(struct mddev *mddev, struct bio *bio, if (r10_bio->sectors < bio_sectors(bio)) { struct bio *split = bio_split(bio, r10_bio->sectors, GFP_NOIO, &conf->bio_split); + if (IS_ERR(split)) { + error = PTR_ERR(split); + goto err_handle; + } bio_chain(split, bio); allow_barrier(conf); submit_bio_noacct(bio); @@ -1503,6 +1519,25 @@ 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 = 0; k < i; k++) { + struct md_rdev *rdev, *rrdev; + + rdev = conf->mirrors[k].rdev; + rrdev = conf->mirrors[k].replacement; + + if (rdev) + rdev_dec_pending(conf->mirrors[k].rdev, mddev); + if (rrdev) + rdev_dec_pending(conf->mirrors[k].rdev, mddev); + r10_bio->devs[k].bio = NULL; + r10_bio->devs[k].repl_bio = NULL; + } + + bio->bi_status = errno_to_blk_status(error); + set_bit(R10BIO_Uptodate, &r10_bio->state); + raid_end_bio_io(r10_bio); } static void __make_request(struct mddev *mddev, struct bio *bio, int sectors) @@ -1644,6 +1679,11 @@ static int raid10_handle_discard(struct mddev *mddev, struct bio *bio) if (remainder) { split_size = stripe_size - remainder; split = bio_split(bio, split_size, GFP_NOIO, &conf->bio_split); + if (IS_ERR(split)) { + bio->bi_status = errno_to_blk_status(PTR_ERR(split)); + bio_endio(bio); + return 0; + } bio_chain(split, bio); allow_barrier(conf); /* Resend the fist split part */ @@ -1654,6 +1694,11 @@ static int raid10_handle_discard(struct mddev *mddev, struct bio *bio) if (remainder) { split_size = bio_sectors(bio) - remainder; split = bio_split(bio, split_size, GFP_NOIO, &conf->bio_split); + if (IS_ERR(split)) { + bio->bi_status = errno_to_blk_status(PTR_ERR(split)); + bio_endio(bio); + return 0; + } bio_chain(split, bio); allow_barrier(conf); /* Resend the second split part */