From patchwork Thu Sep 19 09:22:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13807586 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 A240D19922A; Thu, 19 Sep 2024 09:23:50 +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=1726737832; cv=fail; b=lQQhN5mbZib6+gMubDH0iN4TTO25wyueTQnnzn05p5ugimLXfD4t+6hp2nMw/OR3bzt8ctAk5NX18sqBdD3M11Q8cZyocDZZcxsWJ9ckfAtY3MpANS+qSImatbY/h81XRf58VizPpsctvdsyhNlBw5aCW62cHAtcrfqjlhUGekg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726737832; c=relaxed/simple; bh=xfndRRfR2Jq+bHPzc/3VY/dAHbY9DcMESxxWT9aFZxs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Y4j/VXUDNTYXo2YP2ol9LrI6maiBcSQRfHAPtj/4qs86dlLrnJR8yjFV+T9YbZeQgwuljE9meaXNI3Ja50Wt1r/E8jlW1UdCDW0BuOIopNI/o2n26bS3XQUySSADxR3hsobVMDa2Pvurz+u8Z+UgUDZcYrh3Pi63j/591Di1kIQ= 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=ZO0rzcLy; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=kNfmOLiH; 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="ZO0rzcLy"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="kNfmOLiH" 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 48J7tWLR001460; Thu, 19 Sep 2024 09:23:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=ArrDeQ6Lb0PjB3tI/2f8n47f0LRAGqU99EWV9u9uwQA=; b= ZO0rzcLyHRSjVlKL/DjoCLA4BY61CIoGb/HVHoNme4fPksZ4hf0Y2BGMxDNtR+jw XbBFOr2oamdmNy2Uv163r6dLA5Sw7VlmoIdN67Qo/bOwkCgW6UKnUrHPRLHpHCi0 YtGV+M62+APzJpV0GxIdXLAPlKGoMeVOhGPtQNFM7ikY6fnIDQ2EdRY8Ve8o9jwU 4t/Upet8rqwc5RAxh6/1WbV28OPkSm8DDwnQJIRkRxQGlhZik8L3tCd9JclkP+GB qUzBpnaT5Xn1A4pqP2GW12E5OefREMpjvrvaXK/IuAUcSyRgtlqnd55Wspl6z8uF AokEyWOfe8ZeijgpgILZjg== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 41n3rx3g3c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Sep 2024 09:23:46 +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 48J7gWoi040473; Thu, 19 Sep 2024 09:23:45 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2177.outbound.protection.outlook.com [104.47.57.177]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 41nydxtetr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Sep 2024 09:23:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GcjqrGEhSPXJZomI5SdcnBDliyuSICUHAhbeLjvdy3ycmYwzZNA0tp0W9But9JtG/EgIsjPZ0lttCyscFn+vcfp6wop5Q5dItDr+YM7r3XX9U2LuMLb7CIM7y6iTLAuQVv0CAkygbT+EgkG3YsEwnlAYSCvE578vUXbmhC2n0YuyRVAem+sKggbp+9NjHRD5iLwbdRRmZ2HEWZ8Bijb4uwH0Ji9Qq6JRTJnYx7JSDKLbk/oL+ocKZwFC1svHRtdsHhgi8gFBzle5NGWpPVXqmciqZHkx6v1EdlIzw95YHPRu5e3sNOZfVk0pO7iFw/Oz+ePgQBH6WA9qf4hCH1oi6A== 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=ArrDeQ6Lb0PjB3tI/2f8n47f0LRAGqU99EWV9u9uwQA=; b=gwzz61+NosScRwvH3bkfc13q8+BeBLPMYlsgnegn8iF7enrH2To5MbqzMn9xVp9k4rVaqhPvJurPAEeRKKt1HZ1GkynnQjZe83y8JOSEWfiyV3Mw7QVQXMlOnDCkQhGkyj2Vu50uEDNURW7DvGdG8kF/ccfdZ4CIjowuz3flzHnvJ3lbWTp1rsqA3HD1YwzfMrzxaqG3AJrExwo1lgsHh/UoGRpXh6dby3YNor6Exy0530OypUyX3q3x1QDuxbGGw39jfQzZ0rJqH9Hw18SreiX2ljY/N+IOTIPLeBV/bbSMj9uEQ66db458b/nzpsJVzGGIcu6uNV+BICRYNzB15w== 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=ArrDeQ6Lb0PjB3tI/2f8n47f0LRAGqU99EWV9u9uwQA=; b=kNfmOLiHcoY5zZPGRsvjvhnxePyD8hQA24+r5LHmnrshh5q9HXT+s2AuHtCuTfxDrsQ0z82BCYziCuIozXHefwRrBlz/cryQpJhrwv+vTjPWLN3NV/uUkkJSKwPYPhXkJZJlshRTJjGUzQZb9eNYLXdsvcOvXvNHGHqEwyDrxe0= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by LV3PR10MB7769.namprd10.prod.outlook.com (2603:10b6:408:1b7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.10; Thu, 19 Sep 2024 09:23:43 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%3]) with mapi id 15.20.8005.006; Thu, 19 Sep 2024 09:23:43 +0000 From: John Garry To: axboe@kernel.dk, hch@lst.de Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, martin.petersen@oracle.com, John Garry Subject: [PATCH RFC 1/6] block: Rework bio_split() return value Date: Thu, 19 Sep 2024 09:22:57 +0000 Message-Id: <20240919092302.3094725-2-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240919092302.3094725-1-john.g.garry@oracle.com> References: <20240919092302.3094725-1-john.g.garry@oracle.com> X-ClientProxiedBy: LO4P123CA0469.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a8::6) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-raid@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|LV3PR10MB7769:EE_ X-MS-Office365-Filtering-Correlation-Id: 9eedf12f-f997-43fd-8b37-08dcd88cc162 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: hXMq34ROVk6amKaQ6COiZ3ECIEOKgwjQxB2ZINeTX7Q2mmJxb9cCg+0tH1brVQQtmHTMN99ZPyR8txqCl4rp7QrXQO9cMss0bA4vgZc8fO9c74bSIIGprPRBMz4NBNVhPFXmRHI1DNgt2pMTRE9NshBvXenS/i99Pt2adHbzDQkKCjThxjwA7Wp1c55cWeP5R242LXkJYIei8fPdshDADr+8MypxnsMUrPIxU7QBnq/78+7uBeO06g3sRtXyDMFC3Wf0wjkmuBAFRXvozCxwfuFOt5UczzuPHZOL/6X7lVNwgQLa24Arr5clpFu91rno3x1qMu/KFho/qiq6PCMgt1aEABmE/X/pYvgEJMlOYAH558JoAnn5Z/HehO3t/8DT7BnhzoNm5AjhdsBZ/BsLiQQOxPLBjtco6E05mlIT0vFnunIxKTrt+RBFUU8sUtFrL+/XFtgme4kXX9CDCLZZ0hOL4piD8B0G4g6JsfFeKThR5fL2E0ElR/IuDx97sWpcawXFxMK8LXzQn62ZquICZSEMhFm91QDZfcF10hAe+6/tYsZKi34wwHTktwnvmJeCNrBo7/9OcMG7fR4AealjodbItBWcDZ25nMduJe7DpmhwkgKfCspiU7nXyx+vS2vGwGCOVCPk/1LF3o40jujCqMwY47VJ6IDRvH31BNceMNIZHWZSxnoIELrNbBoCs6hEPdQmYCsA5g0M1H5QX4HBuNschdjOGoKNUZLPy1mfRr3OVDMHbqQTGYyEoA1csgxoZ05kzx7qjeJvszy1ElRSpCEUWm2muU7P56P6C/4Q1gb3+sCGIQpbSuOGpenwLBdG5W/GTjQ+4ONKaYOZgxYjzEWDf/YiKMwg8KQ8pF+zH9sDBElYcDYL/HNhRzh5t1DUQleqQn6IoJ6hw51eFvJnxoalTVE6cjb7cjevCS97p1pHNFg6vBmFuFWYOAlPK/pLLpR7X/kKNHuLlMWy3siBu7mYs3vwqzMitP8+0u9ub1OXlB7tspxgU3qu3W/n6F47tZk8BNurHYnev5Mdu1i0Et5vJxLSUlkPW3H+5rx2C5xADPyaKzmLy6TyyFiuWKnxixV+cmIiEDurdN9EJvB05FXfMnkUxhKHXp4rIXOaecjFWC7Eu9d8jMkpCvNe++LozAS396GVGdr/YGA9qEcgRKh0axt6zoOa+bLavSCU2Vr90DQ88eZ9fZ1S2N5PzaWfmeIQdFUpi3a9wC7tai18KDGHrWcNwFI9JaMEFFM6P8dhSXq45OVa2fW9gFMvcE1Y1uPngatOKMOr4leoLVJvHzZRVwnkKrq+uxdK2fvHmqQHc/4a2I/YHTu4yaQJkida1QyWa/2KPM59fvx6xAwT1A== 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-Ant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vL+cvGYK+56Q9tqkkmhK6Uw9eug4DN6uj6WgjLY3GA2fENmzWsXnAg4s4CtS9D+kuJVcKsJZGEdEr5je/CL+TvjbNV8ZJghOWV775Fqz79HeDOL8bCumKDdBFnKwYDodqaT+1mk6KcF3CVpDdFaab8SFfwD2AM3a/5kfneVfXRhh2Za3Ev3FpGot+fDpbG7fAzeL9dCCYueXZwwcCVETmK8fXuM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9eedf12f-f997-43fd-8b37-08dcd88cc162 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2024 09:23:43.3317 (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: W74jc+XFR7Ze0xiYVgJCXF0+V2CvOYGdOqP7UxVMzX2TYw4Fg8TufKkxczjCXDKbiYPfixryO0SP5qDmLLFXgA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR10MB7769 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-19_05,2024-09-18_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2408220000 definitions=main-2409190059 X-Proofpoint-GUID: EtLUJHvjoDMwSXgssH6khVDAloNffUf8 X-Proofpoint-ORIG-GUID: EtLUJHvjoDMwSXgssH6khVDAloNffUf8 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() instead. Indeed, since almost all callers don't check the return code from bio_split(), we'll crash anyway (for those failures). Signed-off-by: John Garry --- 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 ac4d77c88932..784ad8d35bd0 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1728,16 +1728,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(sectors <= 0)) + return ERR_PTR(-EINVAL); + if (WARN_ON(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 Thu Sep 19 09:22:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13807587 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 B935519A288; Thu, 19 Sep 2024 09:23:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726737836; cv=fail; b=RYXxQF10rF6XLGEaT4M67yq+Skii2U00TxYEleLJXe8plx9HzFH5kcoSgaWWnM6PFBkmWqzPeAxMnU+QsYgr4fZGUjEy1MOdPkaDNUUlD+wevzbaVmqq+1/4zGKqxiCMj9ZWYZHP1LrdO9qj2ccR31/CDsV6jxN0XNgbb2Wgx/w= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726737836; c=relaxed/simple; bh=PhJAdLM7FqgBy3a96esENhZwU+N7ilrYmVNrExOZNpk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=G371MT092q2gkv8shlhVPnqHxzSfjNgBf/73lA+PdyLqKgFr2yDDsep0yfQIdJtGYNK5QH+Noy7utQcfGDBxSBvNJZ9NFvcQIRVLGEYfUUUBsX6UD1Bhnt+F3+RZ1k3oMA0PpbxpxOGCydcnpxNbRuW/ssHvb+V+dZ7fRtdu2fY= 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=cCFF2M7C; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=RojhGgtE; 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="cCFF2M7C"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="RojhGgtE" 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 48J7tYXD001188; Thu, 19 Sep 2024 09:23:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=enqSZCLGKXElcAq3OZ8//9QBHRZ4j93Ztk5qLwlbl24=; b= cCFF2M7CXYpLeSLR+sHwqqz8Xza/JiESMyk5Pym3mndLktvyyj8VZqhsf1dcSyNH Zk2BtbadMh78Oun30TuxwYDe8teGNa1kHf0r5oghKFHGbscnBL3U1o5d7ehLVnv7 r7y4GnPmve7I2xcR6aaBlUq1ZGNoJwXIr/1AN+SPKQ3BUaFKrfhCAJvHqVInDq6U 3NRd6q66njej0fDGtwrAmcwnADftIUIezM/lTYH8gXTlyQOoaijPTl1Yx9v50rnu WV+Y+aotsNdve+Phk7E70d17Cb3nxZwNaCcyI8rHPXaVWe/N600n4K+PNSry/ZsQ nnMM+jvkuodu9TD2S9Rpnw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 41n3rk3d01-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Sep 2024 09:23:50 +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 48J8rlxi017777; Thu, 19 Sep 2024 09:23:48 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2174.outbound.protection.outlook.com [104.47.57.174]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 41nyd08cb7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Sep 2024 09:23:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=skGuQvM+DSnNhJTLhVaBhPq5puzgAwD1MMjuXhASavhNwFftiVuTkzmoC1jHKL7JYzum3wQ7qKD+rxRtO2pDeKA3/y9FWgUZZm7uxG7MFpTsJDK8cn1MtHGOqzSMC0sHlgosBj/VzDZorhk6ApYRL3lZ4fZayYqpih7vB9p1J5+H3BfmTxS+y3WgDc/jn+E4nLyX9BDo0hsTK6oSGAUAxiwPjBfiHfAuzcwebepJMgPUfgRRL0Gg2nF070nemBiecLJPf9xBHPa6Lnwlzzp9qqgYOQjgXcvI6JT6ZgdFk09dqSU0IKQ1nsLf1paoDC+TDEezpsk8x0NGa/hbI0LgOw== 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=enqSZCLGKXElcAq3OZ8//9QBHRZ4j93Ztk5qLwlbl24=; b=DyTsarlfj97vt4LLOz9bcXAwEqBlYN7dmkBmiQPIgSCeH5Zo+3tbGvLO71amip7k9MOASJHIYw+hT+2XTJbFrGS7S2WxR3gQfzsOPBbSPGjTVku0EZOs/ahIz8yLrKbvVxR6/WaOjb7NIfecnH91Ln5b/ajA79FbDnXUttJuRxX71PeYvdN3WV65un6yAcy0i4PbQKvoUP7TcTq4K2DUIckxAAsTtUcUH0LtA/R7mCWM/JSYY5VU8KRw8oRaG59uxYQc5gSEM+IvWRtoIVBWusJ1red/7kwjgsxts4hR7/lWM7gZPdlmMrR8GtV6UBr5p3jF9BxqKagGrp9vaH9DyA== 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=enqSZCLGKXElcAq3OZ8//9QBHRZ4j93Ztk5qLwlbl24=; b=RojhGgtEbYeENfToURsHMNa3ie/tAGFOF0yeuJxerZ02V6Uye0AaD677Ng67Xy94ToDaFmAkrPlda/sHSfm7Y4DZMHmi0GqhTHa2afM7VYkcRcGgWj9EyDOTmqhhxk9wbmsGH3QBk7MkmEmJNPlG2fbeuH6LkmrKi/+hSoLI5w8= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by LV3PR10MB7769.namprd10.prod.outlook.com (2603:10b6:408:1b7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.10; Thu, 19 Sep 2024 09:23:46 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%3]) with mapi id 15.20.8005.006; Thu, 19 Sep 2024 09:23:46 +0000 From: John Garry To: axboe@kernel.dk, hch@lst.de Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, martin.petersen@oracle.com, John Garry Subject: [PATCH RFC 2/6] block: Error an attempt to split an atomic write in bio_split() Date: Thu, 19 Sep 2024 09:22:58 +0000 Message-Id: <20240919092302.3094725-3-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240919092302.3094725-1-john.g.garry@oracle.com> References: <20240919092302.3094725-1-john.g.garry@oracle.com> X-ClientProxiedBy: LNXP265CA0034.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5c::22) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-raid@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|LV3PR10MB7769:EE_ X-MS-Office365-Filtering-Correlation-Id: fc618e73-2565-431a-998d-08dcd88cc352 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: KjZ3TeERcKBk9MaPStlpdvT9VGakVY/AvO7zBx7YRdBdQqeWd0Lpu3bLR+BYKUSiDmDn0x7UZj69GKO0eaH0THqJinqESEHvzX7tNId9yPL42qQNBkmwwoeyxssl7KnsVLIayaqlBBtNSvhKRmbohjKXEcMBqA+bAX+8WSFpW51T3FSgxyOwOekcjv6JcO3NLWuoB5xkGJfnvAU8SUGcntcBRBfZ1vOdmpSPjJLIHdWHl1I6s5hlw0bQHnmimiccbbtEpCcXvMj0regkLd6vMgiBPGXE+AEa6evpkwZ9YInryqDkIHX4iNk4luBsm+F0h0tnxIoWijYNwNkB6vxDoaHr6WAJSJ4OwSa0EBrxzb7pv5C0KfAvVuthxFLhFQkHJnGpDAe5bxcq9k8UMgo46cUMt9eYkFeF5Gf7m8o5TQzpcen0BWvA8YmIeyDHtUeRofz/KVF/aoO5go6qmBrgMWfxR3vSTvmr5t0VppvV21SeuHb8vBTCVgOYpkmHJm2mE7JuJ8x6OSlUVj2wJr3hPxu/7QcWZ+ubJcon4DpMk4eCr71l9B+i8HKN9Umi2jf/gXKEJfj1FRUfNiF89OhC0ctrFBe4qtr80HJA5sSDxnpmK962iG21UZUyRC8XHRxRtF9rCyKbHc+f7LYU9iyNcAr+5TP5RQpxduSnVcItUuYaB1JZIM09L1g20Jeo75MPYNl+cXSWiNjw0ErDL/wkhrQD4PQTdSdVicP4Lqnfop5IZW84JnDPiFC9ZjtyjukJO1M+PiOzuYCLLCdqUvtgMtSSg5nDlHeJgeCD2ni+/egXLxmXvhpHBVV/pLrX/vC5HCGYjzkynWi+Ff5uJH9/ZzrBUOj1+vQTevEvOd+7j3NKS3IoHhTVwKxs4/zCumoa2Qi7Xh1uYcEI/OlV1qQR9R8atmUBh8wIcD12wYL8NkCb3crF8kJuJxZc5PteHa+VTontF4kKGabmg0Ryim7v4EK0hTv9ApRGOlcqjfeNELYxtk3z2fjAQNg0ol2183gjBrxLYkrr8rohRYpyCSWXudi9Q864Xd7vdvY3LQHo6BSpuM1XGSgjxHrr4ax11YKmWvemxYpbEsZPx5ouTaMSkAIFXmx2wVrQ5YfALlm8+4HFhYxdSGlI8EOxITitouX2brbgvKX/tvlbSkPdKBPETIFU1qDbPIoVjMzf3PzENMaalWBi+yiJ4qwT1fcmVSIx8klugPzPbonSXjoR3P3FftaJCWq+Mh8Y9waNh9xqXBlG6wpxn5F8rzXKfyj63p1bcIfQhcaV5TEOiBX5ND6bGxQGZPXRbj19AQIiW3n6X+AJ1xM5l8zVrNI+ro01bTJyEYkL+s+wodUq9+y3ZY/aDQ== 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: pkIO9jD7Qli99zTZnERxAFex94TDM/KYHqKTzLPHkH9+J8draLGDrl9+eHAjj7vU8lrQJ3zMgUNFS82SjtK3zRShrGY4jfGl5TEXp7EP4daXd9RPGf7WatGxM74mKBFQOdL7NHJlAa0P/pKcpz1S+lFwSdaTi0m94eO4Rnj3d0/6M+6JHiaR5Sd3ShnY8Vyw5M5p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SQiZRmAlIX45xq9GSadAb7Zz0R+Ay9xhtg0AqHDcqW6tHjNlDBCJLdKku6MEOfSiFyLnpvMS2zCEAgY7rXQ55EULS8nkvKZn+8pIU/zZJZhV9UphqY3gcxVC6MPOxrtz0B/Hw0zcoKTGts+HxUwjBDwZrx7gX6OW3kwpk1+ls+jT6xvWIvmXnadxgVvMsThQvdWwUOf2j25/SZ2n+QoBF1tUV2vy5zAQa+Tashxo8dpYRN78eEYiEAGFV73OkIKpQjYm0k4BtmbEVeLoOj7rd16sYybJbDSuHYvjhkrUvU+5fu7tBBxmIZShznIrw5ADOkEWIldAYEiLmKKbB9I4X5BA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 9n8E5Lf5DTVseIwRp01/0JshWS2QnBFedhSDMOOTFfrzZsYIXhkmwXtlQGIBVkYvXTmsxjO9833n0sJbXZlNm/O7GN0QgQexApQyVsO5VoGYsiSlQbiZozMkdnalt/EuLmzgR2ndGOVeFxe0AHeGiqVjYHxvHGQiga8t+YyRMD1pFsGirBwNz7Qsamk0815lbOvwqgN/teZ0VqqC0HJEGVlcRinwNiAOr7n+OErYh11PZwvyVIhun6ag8wFvcs4DoWbD/8k7YyX/IRuZiaBcQwfDO78bHlRJwI1z3ZL3s44CiAxPPiTxz/RwARREwNeXQ54CpwFiNXf86a3tcUL6Drp6FKch6hecNmq2i6lySWbpJjCN1nVek01yltdFZ2WkuXS8+4QD3ftw94OUklDvNkXUtH00Rk8Htzic0W9AZcOYpRUX+LJH0gwj2dqusDJAbzpXKr/wyx1h09bZaFzt+2ST67v8XOzTI0cqTvACcdS5Niq4TmJjQVdLA8qJ7EiRZzdr4oxYImJyOU9siVpKVDQkdTeBQDrbmO8TTOChi5/cc2hBVFPryzejQtjdLVP7o8nkkbcLIXN3MjvL4qdRBotSIEFo/u+FRSzidbA3u+c= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc618e73-2565-431a-998d-08dcd88cc352 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2024 09:23:46.4790 (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: PJqq+BzSHZYhIwqJ8B8WRUb6ZQ+whfpWfBkJt/JYQj1gl7K5CYGeIHO62zVIzs43yREeCfALikb7WiYoMik7Ag== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR10MB7769 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-19_05,2024-09-18_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2408220000 definitions=main-2409190059 X-Proofpoint-ORIG-GUID: tmhes765YiIOMT2uSAlfQ70xnHsAB1Im X-Proofpoint-GUID: tmhes765YiIOMT2uSAlfQ70xnHsAB1Im This is disallowed. 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 784ad8d35bd0..08caee855ca4 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1737,6 +1737,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 Thu Sep 19 09:22:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13807590 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 AD1F213C9B3; Thu, 19 Sep 2024 09:24:23 +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=1726737865; cv=fail; b=o0ygAsrhdg573FlH8Mk4V/7VeG7MltWxVnhlXWW/iGSUBodL8yCuNgfoWqY9XbtYpjHokQiTdy9UZ49nox3EbWbk+vT/ZMvqALsup6fEljiH9+lIEZT7pwwnX4gwUvGd6D+6zPuYdjoeWQB50CjCti3N7iltbnpbmrekEZiE3aQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726737865; c=relaxed/simple; bh=KT8bVDVywdwZiLBRvjTcJo6fjnpwC3GdLKEv+25gdlw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=UW19LbOPA5556mXTJf7kBhjXbKbShpmFgFolzD0qlD4FsELgiNIrXuLug/41TAzEzAdx/jOZSim6P7kmpO6zfHr4znicBkWt5ZvdzMvvOxLnXiOICUBF+k04eff0FKvWsAILQqmgLEYrq66ALfsOtAEViW9NCu6Bca3tUhDJsBI= 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=U7t3Xzbu; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=fRuk/6FU; 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="U7t3Xzbu"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="fRuk/6FU" 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 48J7tYxu008069; Thu, 19 Sep 2024 09:23:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=ySc3wwXatpzkf7zkGttVK3zZi0Od14WZX2lVeRDTy0E=; b= U7t3XzbuA3ZBSqM9SABjhwO0uREhnQp6kUudfDLhTNu9NG8kryj+P5yQ3+dHfevb 0yp4nug6lO9mqQK+A+2SyQvPqoalp1bC4Fon4fPqx5pj4T8xnqyGCMQ/hiFmJMiS 0utnsQKKK8JM6iusIbqyU4OA5hNvfSpnbfU9NLrSm0fiPbHXA4fiMoFgviAjzHOg jJhUZj/4Y7pZTe0DZXTHLE/8qIjc+9n+lRZ91zldcbZPXyHwYKW6q7tZT3mucqiu eUfxQh8NDZ+ddNxMU4ZxgRjUXN3sa6CHoMtNzlGaD94TRLqCF1Vu1yo1bg3nO/nk BzFTIBYXSJNb4QWXrC5WUA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129] (may be forged)) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 41n3sd3qf4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Sep 2024 09:23:52 +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 48J93GE9034154; Thu, 19 Sep 2024 09:23:51 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2170.outbound.protection.outlook.com [104.47.57.170]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 41nyckh7x6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Sep 2024 09:23:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yGW2zYBBuq5Ag4pW6bBJCBV0PlTHsa2kBHMBVmUcVMTGRCDYE4eBXwUuA+9HNtMessJNIjNQqNso5NwM2oQGCejVJWVtzgu2GNGL2pr0Iub3luvp9EULtjU5EkkaRCV2rQHx5lYZ2MVI9+eSfTIylOtfJVNqacqVujWGedor0fMqf2prHlj6/RbjgkjYjho2KCQd0cwwsoH6jdnV6bXlmxYA+Td/S9vrqDve0Qp41WTiveAVzFL7yUN1b7qVUxhEr3rRnZNDv1L4TJO+FlLmdfYV9EKtihIb25zANfFrmEoLDRSZwDXYmMV7nBGqECk/XycsRBQ7mOdNkMGFG97jWg== 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=ySc3wwXatpzkf7zkGttVK3zZi0Od14WZX2lVeRDTy0E=; b=lMnQ8dN+9tPj2t1qYz02Tsg2LyERqMp0F4wWjxvtP99XLWLp47GM4o12MuBuUxTHmo2elRWjGUth5RJk63XFLlVJF6z+tBu/NUyki4e0Z5Z+d6mc6fxBhPTLxqWQW7v3xwMg/6YSga1ylrzxbzkqpieoj6tRBcyVvgnDwGjAG7P7qHGH/uij/rg0sQY2vE3Mv2o3LgsjK+xOnVZ9ysVOEEthpTiOIMER8dg/sKBr5lmGpLjOB9pnuTrNnre41gOc+8cXnK5ubvVZTbZduvxwmNO0o8XGZYl73BxLF+6Fk86tKbAHnprr5vCpYvNYeyIqklN0/mdebcYmAudb4rlqQA== 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=ySc3wwXatpzkf7zkGttVK3zZi0Od14WZX2lVeRDTy0E=; b=fRuk/6FU3bVur8DmQVWh312EWF/LPTRYstDwU+MmrYPux0wVrESsoe/FqLHE7SiIVRyH2g+PGnQ+DqjXna116Z0IIiJejKyxYnaqNnFLb1O7n74ARdoVjtQhFbr+8uafGKA5c/qH4d7aY8J2+YV0R1yVWAcKxXvXPbv8xuQSuwk= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by LV3PR10MB7769.namprd10.prod.outlook.com (2603:10b6:408:1b7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.10; Thu, 19 Sep 2024 09:23: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%3]) with mapi id 15.20.8005.006; Thu, 19 Sep 2024 09:23:49 +0000 From: John Garry To: axboe@kernel.dk, hch@lst.de Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, martin.petersen@oracle.com, John Garry Subject: [PATCH RFC 3/6] block: Handle bio_split() errors in bio_submit_split() Date: Thu, 19 Sep 2024 09:22:59 +0000 Message-Id: <20240919092302.3094725-4-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240919092302.3094725-1-john.g.garry@oracle.com> References: <20240919092302.3094725-1-john.g.garry@oracle.com> X-ClientProxiedBy: LO2P265CA0354.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:d::30) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-raid@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|LV3PR10MB7769:EE_ X-MS-Office365-Filtering-Correlation-Id: 6bd68465-69b8-4258-3176-08dcd88cc50c 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: DAIvYHX/35+KFRyrC+CwXQlDcK1mimZoxxaDvEYo1oaIsToyoRzk0rt3k23zH1YYJOWDDTme/NcZWH+ioi744WxDaJo7lWivCOSqE1P8+keUX/OlHrwPGUYpbof2mO/Yxa8xiA8hDb3YHcU62zatCodAtbd3DoIclGSmTZri7BpwrR3gEQNfZlQnTCNZU0bW6pTGd1AcHlgVmNiLX5t3n4SOCDPsv3ZyCfQ9BcAll1QMl8J+DsR42d1kkN+fElU/r8abUDn4OW7rN/OAETuiPiKkWhDDQdTG+TVxk4kd5ykol+YxkB1Z6yj+7NFapvhkH/dCuhoLxHpqwpumio9tWel3mB/g3cHSyWwdOCOxIu7LUDGBfJY4pzNfAU1r6MmTP30YqtskQrpUoXQB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i1IyReTJCTJhCWmntRR2gcsXD23BiSVsyihsNgOn61ruy2PpBuU0gM8cZ3fduM9osfbeQ+GDqE8QSIZ6nduMA7g2bagJVAS3ZKgX2zUSJlHf2BP9yAP9fPCnBODNfCr0t98V3rZmkGXEoEeN+x/44B7nlK67Z83Y5CawliK7k8gT0309WEYvgFoWNhSMYuDq1MSrg7r4/tZiJjc+cSoVYzN3OJsZTY5DfcwsL2j4Lo/YlMhSPCPkc9ZDjb6Jlf0+87B7c= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6bd68465-69b8-4258-3176-08dcd88cc50c X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2024 09:23:49.3566 (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: 6iUpHCNJvMEBvYlH1ikgzflESLmrV9IUrD543d3mPxIscIt2MczF/OCPB8fhSQfcjuvuXJ9Tv7I74FlURzvFBA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR10MB7769 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-19_05,2024-09-18_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 mlxscore=0 adultscore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2408220000 definitions=main-2409190059 X-Proofpoint-ORIG-GUID: aZnPloJd_ToA19Qi-vq6Er5MwPEVbvoX X-Proofpoint-GUID: aZnPloJd_ToA19Qi-vq6Er5MwPEVbvoX bio_split() may error, so check this. Signed-off-by: John Garry --- Should we move the WARN_ON_ONCE(bio_zone_write_plugging(bio)) call (not shown) in bio_submit_split() to bio_split()? block/blk-merge.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/block/blk-merge.c b/block/blk-merge.c index ad763ec313b6..ec7be2031819 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -118,6 +118,11 @@ 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)) { + bio->bi_status = errno_to_blk_status(PTR_ERR(split)); + bio_endio(bio); + return NULL; + } split->bi_opf |= REQ_NOMERGE; blkcg_bio_issue_init(split); bio_chain(split, bio); From patchwork Thu Sep 19 09:23:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13807588 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 EBF7219B3D3; Thu, 19 Sep 2024 09:23:58 +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=1726737840; cv=fail; b=cNOE37P4GMx+HmNlktbjhRDboD53TYQvNzvT3yWqJtpwvg1XpMzG0WAf12JIKq+YBA0WMfepaOrcfYjzkyYVGVTdvElpikXNCSBtu9eFUysiaNUxRxr7WWnEpY1E9gVWeZ2cfMv77DRMwIovyhI1CVllKUt3Quzu/0dVbZnZqNA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726737840; c=relaxed/simple; bh=wVIKOmse9cotmcM447ue9hT29S/M20kz4mIrTUpMi/Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=X4nHU57T/yYvPmnnnlpcgSBj8AbXa5K9FqjGoaAmnEp6jQCQ3Cbf3WqlInU0ullzMmrjnDvAF9LUUEs5oyv28om0zxK1Go6uE3ZAEpn2CHky9nqo8pOySnyn5EPZ6GubBCAOucOnarVglhN34mcYn5C9aabA5tCOqHuSbtuAx+w= 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=VVZpGopB; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=S2GTGitV; 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="VVZpGopB"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="S2GTGitV" 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 48J7tWcL027028; Thu, 19 Sep 2024 09:23:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=Y+5fIuIpZqqSbAffqwFfJYt9lmtkn5/VFvOJfmnsHvA=; b= VVZpGopBQutUelc2bWcwyjdn00EPk3ARhgHvPgexTlo82c6z95vcVwdf05xF6fCB tDYHUHkX6i53ONT+xXMNMFm0qbzWGwVc6zFZ7r/Q+t8O8FY2jFN0hT6L/mdiLw5A oQIxoKBll5tyqEa9NcVyj2QBi8XUUOLweGP1l6Vm9CZU95WUPmFMSUvi4KSiIdwC HDxTQePMbB9ys99NYOFUqY981uEiY8E3VWt5zxUdhKv4XL0Cp8TSsajvAyuLbi1X rrR9Cv48cHlpV6aw8qVW/FMRBiNl7VL6oeWSklqZxYB/So/cxIudIhsUOFBXd2SA 6QlJN8u9TQSQB36zLeRKrw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 41n3nfujnt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Sep 2024 09:23:55 +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 48J94OfO034143; Thu, 19 Sep 2024 09:23:54 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2173.outbound.protection.outlook.com [104.47.56.173]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 41nyckh80k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Sep 2024 09:23:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VMKs/B0JoV3WT/8sXkhM04v+a00g9mYrBs98MQLwetVsxA5g0Y8l5zCpCiFbGMj3YRPnqGN71CxflpaGCZFaC5gwd4Jt4qUTu2uQoNSuJHz0WjjORh+59l4Mv7awnnylHYu/Lm1qZrD4UMPmEH2xSCGOoZ6ZLxlPmRrrkx/wNUJCbD8TLh4Axy4OlzWFkh72QZz5yTVKLT55JR9BzIXRnBq62KCy1AC/c1RlpQqcVyaGAVTZot3vZFnBAuZRLuJtZioBcLRbYaVJ8YyEZvH9XVjAciDIgh0/ltxUl+PjeSPZIN+7lHZKfbAuETGsiORYWctuCd1stN6gQfOi77vI5A== 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=Y+5fIuIpZqqSbAffqwFfJYt9lmtkn5/VFvOJfmnsHvA=; b=wiWJm2CJaofUoUYzPituXRleZS/JNtbnvOiyKXuWIumLvhaQpyGQCKXT49kRyC78I4r2G2f+q9nkWGKm47rpYnaZRCF3n8Dfi5N6XMgTL6yx+bclE3edy6Ro9e9LBTia9ARHor9bkxvS9ErmJ41U45484htya4NIpdRTYxiSA85iLwibJjxDBCuAqGmhkFsYd06z8Cgr+LnGD8cmzm8fIxQPpL0gC14kx3rNE/+TmQ/BE9OY9M4WVrjXWlustcxy5V95nvOA9uJeDGTVWf5F5H7puTXhAWt8UO3ZDFpwW19+rfqaR7DQs4aZhtyzqo8pLMTJ9OgfdW+xDZ7QGiCBjg== 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=Y+5fIuIpZqqSbAffqwFfJYt9lmtkn5/VFvOJfmnsHvA=; b=S2GTGitVWSP9xLyzVy0QCtRK7RgjCQTJKktaWhC91LzzYVS8hK7ltdkK4FBPwSwF7d8FV6HXN4d3HtW+asItl3LLTDLTiTGDrTTGgL6aucDF/gFJVs6YmTdnPUmVXo7y3p8I2VYHql2YC2XUHWjfUsZ43+eb95qDpMCdxA1F4wA= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by LV3PR10MB7769.namprd10.prod.outlook.com (2603:10b6:408:1b7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.10; Thu, 19 Sep 2024 09:23:52 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%3]) with mapi id 15.20.8005.006; Thu, 19 Sep 2024 09:23:52 +0000 From: John Garry To: axboe@kernel.dk, hch@lst.de Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, martin.petersen@oracle.com, John Garry Subject: [PATCH RFC 4/6] md/raid0: Handle bio_split() errors Date: Thu, 19 Sep 2024 09:23:00 +0000 Message-Id: <20240919092302.3094725-5-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240919092302.3094725-1-john.g.garry@oracle.com> References: <20240919092302.3094725-1-john.g.garry@oracle.com> X-ClientProxiedBy: LO4P123CA0517.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:272::20) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-raid@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|LV3PR10MB7769:EE_ X-MS-Office365-Filtering-Correlation-Id: db53b01e-3407-4eae-f94d-08dcd88cc6f5 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: pa0ZTGusRSF0F3ReI4B0kPf22SEoHvaRI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dGULUhZj/Y+BjHBslHXkut2TozWQZXmubudcmr5o6xOJRb17qv4FoYzehPtt+u2XDRBFiTxKtAS3fsnhFY83GE/ClIC5PuKPPmNXBbmdZPuhGtF9fjaVRfaLKnK1ZAFLRk2KzAIyBRLidhvJZBcJ4p9PHqVJeQhldIHtvGBL0DI4DOpCAh9yv3b4w6naBs8PwPOCPJHabdcaTH3Py6YuXGbDAPTNwF9H5h7Mgd4dftloRqXvM4yLeO6A== 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: 2AzR4MHzi182/iwd48N5gjMLovLrSDxFCjNjLZ1AI6/Dm1v+8f3jsw/cQ5qaJhoZsS7w/US2JRZwfScjaoPIHoCfbPKZpc4gfEbgeVcjTYGvrPCf3AuMgJ4fX4C4SQ/CcQpHQ1LYbhvUwcwN9ggtNDULX+aKvtRt9sKtGCsJieKvrlLPKpsaKwuHQ6MHrpKF9VAw80twjrp+FmaA10bzafusAAZ3MGAB4l6G/kSJov67F96RchYblPaQfyMgntuVXm1S2IghBJzvCElidvgembuRgxLb7zr+c5mn0W9emif3bL+U6VcZJqqStop0fFXIInA5hRWOVmA6189E3lcd/oKLFIZxn6bh+dHRatKoXlILRHwuQKBko8tNc2hud0ZHDR4GkMp7YHzEwHwl6TFQtfgf3mVwEQbTaCmH+OaqmGzyQrbPw/wfySE9V3dU2Vsn97r1RDxZcRSAE9REi2JihkRiaNcBtFwMIbFO8O/T5pUAYfnCqH4uaZBeZ8+nOhp403eYK0OrnbAXqFGdWRRQze9ZOOhRo959TA54CtYbVUW3KAkMyMNOzknCuXta4xK9opzJbn4pUmjP0dJD8yC6mxRMwS4GaHQR1UitwtWhpJjnI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pam-ExternalHop-MessageData-0: QaGt+FSo+NDYG4V8pilUR4qrrQD/63Y01f/gb2qgQeYud5+xzJ8uF78/Fhpg3+sr3dtAB+b09UgOvHmixvfmK0Owz0B55SMI8TAYlmKKIh297MCSSu5eJbxBodPrRvxXvKbtXy5GMRmLOPHHdweJopE9w+CJZ335fDdCENMvzkNpWxJLPDn+5lesLlw8h9olp5LhJ03yPpoCoFCKUgQ+6qeJAggbIqQHf6c3iC8EI+UpOCLDK2kss5KTbnuYBgXewn2Q7YwqqSirXesIZ080pPCrBA/29avBn/CrWINkDYac88EYyHnDsUu+RKsBPKvryx8jsV9atiE40Y3UWMFrA1/L7LtpPTwgCYdX6ywSeDWGkZWRQfYm3lxtvfoXf/jSZqJwOaVyRBt6jZOWCL1SEEeV7pGkxTnhAhzTNagEkLc2CsZg3CuRmTcLMT+qTggARVwQAYrirJX6VFbpQPXqb9R0BDVCf4C/bo4tk8kUj+iFVVrdTSypcs1fmEpADs2EPTSpb0hGvR1sDQjbPVK+GAr7Qrf839BwWhUb4ueyKFa+ivhXIIZPqV5gzIIqnDZLFXagZ6DVDe1SwG5WHhvA/wvGtbu1eEprPQMiJNUnrIU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: db53b01e-3407-4eae-f94d-08dcd88cc6f5 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2024 09:23:52.6718 (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: g8Fx+Q+Mv3jkkvaZmfa0HrbkSvcHT8RPCBQcziyeIK/sz1faf/uudwsgnnGZ9yhMo5xEFDsIOATJpOl9ldVtpA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR10MB7769 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-19_05,2024-09-18_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 mlxscore=0 adultscore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2408220000 definitions=main-2409190059 X-Proofpoint-GUID: hRLwaKwixyk3Ia7pgexfr3x9soUcw-IN X-Proofpoint-ORIG-GUID: hRLwaKwixyk3Ia7pgexfr3x9soUcw-IN Add proper bio_split() error handling. For any error, set bi_status, end the bio, and return. Signed-off-by: John Garry --- drivers/md/raid0.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 32d587524778..d8ad69620c9d 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -466,6 +466,11 @@ 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 +613,11 @@ 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 Thu Sep 19 09:23:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13807591 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 A2ECA199937; Thu, 19 Sep 2024 09:24:24 +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=1726737868; cv=fail; b=fP3WXKHYhgVYnsyfkPZXV0opT7lFcA3X9u0OsLHqLN3LESAVlk4SUEFuX1vRoOy1BfF29SPWF7tLAt+tI9ng6N3UCHkkDl3ymyZMnwigSblt/PurA/8kZKoV6ZNoFWDBuji98wySXnGRhz8lUjZQs+fesAirFXKn5grubLdyND8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726737868; c=relaxed/simple; bh=aEYqZlzGeJxvd6dN9vMuVZ29TGhh8Fw1bn1lk+tIiLI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=TCVsmYFBER/IlStNcdk3hVcYbPNvVGTdSzlivBru7B1Cfak6QQNh0NujKeKJS1rothfrkr+4baH3OF9qOHI64mrTelhAwOK59IM3Gmh03RBV69sMZDcFO9Qh9ZbDVdxE/49yiSBCnqO5fH0u6FmHY8OS7R8T4Wa5P00fA1q1euA= 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=cjqSdjFo; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=YKHu59jM; 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="cjqSdjFo"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="YKHu59jM" 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 48J7taxt003713; Thu, 19 Sep 2024 09:23:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=SwBTRq8fhEmqnqW2YuLhLptD85qvbdoK+v0E9le2bJo=; b= cjqSdjFo9weGXIYdfDLTJlZdHQt41RFNVB2fIKby0ipfJuJfRFiGHvvvocLz2sw1 izS9Zw/ipvwmnDku0DAgXljEswgkvdJSj2cJbs5pLFskkG90tbMwvwx+QGcdqval JDkNu9f3/K7a0ChR6RJnR5/5NRUnT1egPE5Q8X3SZ9AeJ6x2wyiPVRqW90fpHjKv nAryn4x7iHcMQKT8UT/O1hynt1iWg6rdUwykaHSmgHRkcu0MVUOF2tVaR4tO2/jf OVNaf/Z69rNSjZ/Dp40ZJasybx2wCx2JT/SAHHyfaB81VKuaSjuxHWjDYBF0BL+6 wF9w9k11BC2yMu1HWglhVw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232] (may be forged)) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 41n3nskpp6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Sep 2024 09:23: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 48J9Epl0018566; Thu, 19 Sep 2024 09:23:57 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2169.outbound.protection.outlook.com [104.47.56.169]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 41nyd08chy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Sep 2024 09:23:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=im/vFJl30d3I0HzLYdTXM3VZLfdH5MJo3eaMcZwdR7prL4pvqM/KFoXlXrLrCLwOujNhuPubQgyJs0JfdMdGJnITYIJECtU5Z3jYbMDsa0W2LWTsplQ4TbUB96ztKcFBcfyAtpjLzt6DQ5gpOvcl9jNGiHp/p1GzDTocT4+W4TqzPo2AcnvJQO8sKz5opz2cwBeJSIH/8gJ8wbk1cQYUTRJV/Fc3QN8L6zbZapNlQqkgUSHA8gBwrd2p/O32e45jcM5nyYEV/FiEd8I66B2ccsd1iBkhovuzOiwGUlX+6djtOvNDz4hKlElyEl1koeCIRSBTTqZzoPtoJn/Q6HCeUA== 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=SwBTRq8fhEmqnqW2YuLhLptD85qvbdoK+v0E9le2bJo=; b=af3IdMs8tFtDCHdh1pI9L9riqWSbMj+1HdNSVsK9dfHroJAdcwFwJQcGdBCSi5waraDBaiL/zFsr/Tc8ZOv2Zz5ZAEudyMFBustT2gnQoBQW7QomMqK1loKhssUE7PUolIrya07uKPQsH/TesvelpIsLoVtF8wYP16XmwIwOSjm5cCkQBOq6KMA3NdnzpDCFT4zWiP8qjT0Ap+Ja44QpfPrE//oBJPnoeY+IVWeTTLWWjY1RWgNFQ86PMKmVKZSqES/dX91eDyZHj4gF0J9f068hUZGiqk8CBjrr5i4LzblFuyj9K5rOoCLA5Bk+WAo46xyWJ3tBOGmEExt4c2PrcQ== 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=SwBTRq8fhEmqnqW2YuLhLptD85qvbdoK+v0E9le2bJo=; b=YKHu59jMvpAChMEpw0cd6wV00/0OB9U7PZPUsK9+WkX0rPgwISZLwg6s7ipQ70UKVUNa/InDJbAaGCoWd7MUNWY0t8+U3p9+JPya+3wG3LAbkcBaKhjK7hA9g9vT8GVnl0xJJ7JADN4JirUfEvOfHVlixNybjE7357Tuy7t2WeE= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by LV3PR10MB7769.namprd10.prod.outlook.com (2603:10b6:408:1b7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.10; Thu, 19 Sep 2024 09:23: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%3]) with mapi id 15.20.8005.006; Thu, 19 Sep 2024 09:23:55 +0000 From: John Garry To: axboe@kernel.dk, hch@lst.de Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, martin.petersen@oracle.com, John Garry Subject: [PATCH RFC 5/6] md/raid1: Handle bio_split() errors Date: Thu, 19 Sep 2024 09:23:01 +0000 Message-Id: <20240919092302.3094725-6-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240919092302.3094725-1-john.g.garry@oracle.com> References: <20240919092302.3094725-1-john.g.garry@oracle.com> X-ClientProxiedBy: LO4P265CA0261.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:37c::14) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-raid@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|LV3PR10MB7769:EE_ X-MS-Office365-Filtering-Correlation-Id: ac495188-46a2-4bae-3832-08dcd88cc8c7 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: yfEq8NjY5gAQoFjo/w2M2suSHSKuM1RY+uVV29RNbr/D9YwthUUnJZ0Y96+yTv/Fe62iFUh++MvyJjxz3csvBN8tf6qhD9NbEW1laYD+tK8EMwS7NqUJQCenkmnBC58KN+9FYXZ+x4pn3wrahFuiMGPolayhcudemUbF9uSH8v2Kso019LJn0OMkTGIh2EgtEr9UuDZggrVScknspp69gOTm4r+iyexM5lHHYb2ToQfhLR3MUp0hZlA+gC43URTw5OtW5TuLLWpYUK5EJC0rVJaIsVO3DEURn938iL9t6ty9INWANlRS6iP6eQfiQzoi5s5X8mhJhw5o8QzGQ0LySgenSv3gsG2klTxPl1FrguIaC9VUrAZXSH0Lp0joTVR//KGSv/pFzKKa/RHDM+eOa1VeJr1wmAmnGl4OqCQP+arL1ccgCk+nz4iTjdv/fSJsYCOFn0JqV0rutwMqmqY+3KP5k+kBTA14Zk316SAvlUeV0epHdCqrovubAtIPJQ6OkRTHgSY7Ke99RoeBkxMvGxXBXd+rY39VaG2Vuxiwu6OilnNNgd/1NGlNAnEa+F5uzLOcIXvyRp4apdd8dlmMPQroSZwDV4x2hdC/nJesjlC1qHy6XFXvVgMIucaHSQKGfnbAdmUz0sbL5W6vnZFHYwW41h3rQF6qvkXui9JeDAH8RXwshE3WjMtyMJT7Enc/Q0w+YIlXsXBRAkgHvA+CgVwCQYBvXvCELVhSq5OOXmqkMhOwiWiyWxt1fwEXh4EnS9QuIwL3WsLsykDB25PcnP9I54Zagiik/otll7ubkx3STb05ivWrHavb74oYVQup4FO9+/9N7aGzg7Ijd0+rCf6wooh40UR2U+yFyk0C1CZjqESvtxlwaLjBDEz7y+EEusdGv19BK/ZMrwX4x3CBeOt0rSr3di6RAWPsf1IUl+hKd3Z6OsHn16tmvYrEfMhj7KR4UrxsLYNnmQ+am70IQWf0/BquMEUamKMr/Dqq6pUM3U/7yHTGl5qnA2cNJiP+3Zr4Yfa0nNb/UDjuMztdjdB2btiY/7aWYfRG+HwlCCVgTpdzF4mF47XSKpkSCEJGMFDFSc3rFOpaByv5wOnWfeXDx7m0iMKPmrEqUngK+VbKZnuCJHmRZrJMqTPObo1qbC8/QRgTl/rVv/aZi6FZp//y8EsbwST+/cwYnFdJr716D9fhlRvhMNZBlFmVqUXquVXVRI7xByUBUZeOa/K51mftbdfaItr8T7o8hk6lSr70y/hfbYfNZMrrbUhnASwTvVWTvUMfswVbR1LaAoqfa17h0l9hFtld50K6Hw5MvKD18A5wlbMvBcsDe5E5zlvP9nCD+jeCieGGLR5fTxbvXQ== 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: MKVUi6SiPOq1WnoVamxpL5yvR04X5KPcSwRx3uHVEYl+PTV4Uzy3kDQQUIUAzSJN7O/tJLx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Ci0CiwsuIv7QXUNh/TrCvk1t8xM1PqREymdZH61Yi4r+1XcL5GSktqPzk+ATAtrMhqDZ114vXtiPmfRoBTw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac495188-46a2-4bae-3832-08dcd88cc8c7 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2024 09:23:55.6212 (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: eXCvDT88YSQ/YzAbF1at6OyeoO3KdpmZRaFPDzeS+fhgE0Z7SMqTuQyih11o69a0+udBMk+GQLDWv76/eo46EA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR10MB7769 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-19_05,2024-09-18_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 spamscore=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2408220000 definitions=main-2409190059 X-Proofpoint-GUID: CSH6D5vk1iZ_4BkTRsd-obrvHsu4IUVI X-Proofpoint-ORIG-GUID: CSH6D5vk1iZ_4BkTRsd-obrvHsu4IUVI Add proper bio_split() error handling. For any error, call raid_end_bio_io() and return; Signed-off-by: John Garry --- drivers/md/raid1.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 6c9d24203f39..c561e2d185e2 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1383,6 +1383,10 @@ 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)) { + raid_end_bio_io(r1_bio); + return; + } bio_chain(split, bio); submit_bio_noacct(bio); bio = split; @@ -1576,6 +1580,10 @@ 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)) { + raid_end_bio_io(r1_bio); + return; + } bio_chain(split, bio); submit_bio_noacct(bio); bio = split; From patchwork Thu Sep 19 09:23:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 13807589 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 2FA1F19CD1E; Thu, 19 Sep 2024 09:24:04 +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=1726737847; cv=fail; b=QH1EF5ESSKfHrM3xMM5NP2un9DGu5kHs5d8VqY82IyM6OrihMk6XZsXWvRD/s5t2c2pg9PClynjdOUMaU2cKn11Hv3/YSeTWQRdIF6fMXf7xX4M3bxESBZNm0S8Z2dCapNIUa3pIX6Wa67rP2CeFLWD0+YWgeM9SUrjS+159F/g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726737847; c=relaxed/simple; bh=Z8re0RMdr69vpdP/7cGmkrIQn6PP9R7KrghbjvycA9s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Ij5AHWNJpxaW+D3pEqi2OZpFhfb4FM+QXDjv/V33ou9cKGm5hsqh3sCmkexJB9niz1hBOCKHOi8tvIYGg7XMVylIQ/Q1yefbNrKLF5AZiU1kPHfvwBqIoosHw/Yite2ZpsloNFWUK90C0bDgcJycig3GlBnWPdzyTZcW8LLmamQ= 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=neuQTLEA; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=vL+pg5dd; 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="neuQTLEA"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="vL+pg5dd" 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 48J7tbJq004943; Thu, 19 Sep 2024 09:24:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=567uA2+dCFvvRcaFd4bvjf2j4G2z8F7uyWQTrfEvk+o=; b= neuQTLEAKHCL/SB31E42RqoKV8kJosWQyAh8g4lx0VKxwggA7ljchn4ObdSvTi7Y VP9MTPXW30zWt53Biv9E0ZuS0ZzUhP9dZAev9L4GxiMF4gO8A8ZX/9O/wI3X0uah vg/O1OaLEVg2ze8TaoqWYfC90z3b8n6A9EAAeViKD0lNUc2TDIvUerKrANloFYKR UWGjrTTbdMPjm0Oejp64fAq1iT8780jqRNt4w9sCcp72XQxYfpahb7AwFjSJwZtv 6MhG0+FiYlpa6YzHTVum/C9Jb+X8UvGPh5MQYkQtpEG0rHAcNiIHoy/pP+0kXLiA xcyycKHawID902vGC645rw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 41n3pdu9ea-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Sep 2024 09:24:01 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 48J9Dk7s008942; Thu, 19 Sep 2024 09:24:01 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2171.outbound.protection.outlook.com [104.47.56.171]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 41nyfejk4s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Sep 2024 09:24:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SFkmae6p9V8rooMADiOEQmwJjbUfWl5jxCxCTZV3iNXVFHgDwAFnmcpQquwk5ovedQaJ+k0utQvgi/yplZIaex6OupPBPwdZT98KwZJQ/zMMrMg+eJmCzig2DbN7TTcYSMQJjztEl0T28XRLywzrKVW2fMObBhbyD5FnSWI7R2vHn4pfn5CXiumF/54v3cAMRpU6WeHA/Eb3UeloO7FLKy34r8adyI6WmBUhZ5DAXkzVFhhNHIvOhEUyojeMR81IXsGGbItxZV+u7Ayx2WQn0ElCklRXN6iVrr+TVNFvH2XnKZVE5kbTMVv9T8CrfhOPvAePueIdkeY15BfXHjzcMQ== 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=567uA2+dCFvvRcaFd4bvjf2j4G2z8F7uyWQTrfEvk+o=; b=vDqJEaJL/IbYmo6bHnClmd/mTeX8nEQO3CXt1HJR80g0DoDJONDFDAw1FIHQMYZA+6owaWMgwsAHVbR4tBiL2ua4A9nkbuuiKKeeZmRg87jEQiU+1hLhQxiSgN6ijTZ+9DD7oBbpwIoNoo07CeelPsAb3081G4qsot/Iwr6sBm+5LWX/kII2vORkyYyYaWqeo9i6nE9f3NkJXYeyxieZWykN7I9990QBP67popmGckNSXHf4LPEPLA0ta2mOVrA/Oiz6cZGPUnOainZ+z7DWGB319eqJg8vNoNdEEJ5Ae5oH4/VBmkv/K0IExziqXuCQDVXZGqFKFk+ORgW2bL0kRg== 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=567uA2+dCFvvRcaFd4bvjf2j4G2z8F7uyWQTrfEvk+o=; b=vL+pg5ddeIHtbF44UGosbbLEl6GkMSEp1pELNu7oU80QyOv1mvlhInKqZZEZ9ZxC8vrqvCDZKWQV1LAAQV/hG8UzvbRHvmhSLcbS8iyuoE2GI9OBHVbvmiiZLl0bZq5HeOmgV6kj8BoogMVybWlDPkO5jC/6t9ZUpAWC9vGSRkQ= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by LV3PR10MB7769.namprd10.prod.outlook.com (2603:10b6:408:1b7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.10; Thu, 19 Sep 2024 09:23:58 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%3]) with mapi id 15.20.8005.006; Thu, 19 Sep 2024 09:23:58 +0000 From: John Garry To: axboe@kernel.dk, hch@lst.de Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, martin.petersen@oracle.com, John Garry Subject: [PATCH RFC 6/6] md/raid10: Handle bio_split() errors Date: Thu, 19 Sep 2024 09:23:02 +0000 Message-Id: <20240919092302.3094725-7-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240919092302.3094725-1-john.g.garry@oracle.com> References: <20240919092302.3094725-1-john.g.garry@oracle.com> X-ClientProxiedBy: LO4P123CA0452.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1aa::7) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-raid@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|LV3PR10MB7769:EE_ X-MS-Office365-Filtering-Correlation-Id: 21f1d6f4-d201-4937-05c0-08dcd88cca91 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: t84Z64YMg9xt/braNI46NpRXZjJ8YcpgmqXYFqD8MoAkjg4CSNQ0PmsY919jXjc7OmywVtrFg5kjcsxWZUj1ZKNHvU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O8z17g0NgK/2eSzdfYei5gFumXXbI0y0sNrCDynJtksTlY+CTsWaeMpY0TLwWfgWa7zxaIlModXjeWmT95N6sUr0v/hBMG3GcSlAcRGHOI1Pf9W23XQWBQKHqUxbVZ9gVZZpI27ETMzmDJoCJfY9YQolIxDOH/BgqQUXUKv1pG23n3OV5IE1btze1q/cwqXdlCcHUsqx8GiqM0lM+bg== 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: eXxraicGT8H/pfd+WHOdwv+WDcV014ibm25Nyyct5wIydT7IyXqPCxe3OrO3j21Xsv364B6IFeSLqeMxDdDe+rfoKrvBKvskdDHkd9ptr2YjjrA92mLvOhb1wBfxea25cpBX1PSA49R64ONBoU+Ahj8Cp2FXKiz7suethbfe17OFhGmws4EKrgpo6xBAlaY8Ba04d9JaCLaha3RTfR47wkjEUNxvRP9JXzK20btreepkcT3QRfkKC6xavMo/9DHE6MyI/Iu8RxwRUI4z135kEwV8uVxrXDSn/VzJF7PNbC18CtLwYT8c5wUQAhPLyCJBA8Hu7SLIcQCm47UnjOpyS+iQoHlz+BRhcf8B+kUW8VWcH3z5tlv3dFVDBpu6BBWLOa4xnyqFn7vXOQtQqj+7tyGvP4rQZarh1QGGGQLNUvXVl6emk6/IaDltqtEfXEbv6CwkpzhVdeoeejXNJxuGEiDJpV+8vdzBhrmKfIXLPijFJ/MxPKXJftmVrfM+f4uvz4656FuwLungnZBexk9DebCENdscHGZaVPOvgnKw8kSQmmoUVZVl+vRwg81WhtYvMOAcVEEQBkedEVjWjbHKvYl6Re78rruBXilFsuwDos65wxo25qBGF7VqcYzwDdnDyTzVBayHKuTrkp7yDPDI/4vR08XnITwD2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NoDYq1Y9C45U8qvhvLNoE73JyD0WklA2aNKv1Zu5xPcCzUOYtVqzjEYqIj0GBM7AmI4K7irqX/6s2v5MV2E4C3gYspDkb5CMYS4qEiKfntmiqLui8pRD8weQOt9rkp746Q7VhPz6xGBKtz5usoF/LwltIn38lfMX0FtFkCrTXb3BtHFFaEXbFfCuv27gEqwiB0VinOT0hOhOvnqZfqpsZ/loXgF8njeFXnaWa8rQYCkESXhwje5eyFzVSTyhrWWVRIwLs4J+IDUOPIBhHK3jEwNKL1UhvFalEKMmrsPxDrl93LOJb32y8/2Extg3k/JsLVOMjU6dmZTaP+eP7n3kD6zi5n6ApPf6/j3d6NGEPUjB9X4wzARkQWbQ0jqbwq1fwgs+OO1Efha3i05O8rcQyIQUsA1Xc0VbaY+HEkti6AGWZNWPsGrVhgbsYeb4UvsZXFEkvjREPLFFb9mlwFKc9yxFmpkYpJEQFq/Gm8Tt3LsnmqQBt1Y4TtEnUYywob0nv0LSK8w3k1MATiUpMUz2DM9BCQJVTrzL8NnygdgikOFprZVJ5duIH8LHaPPI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 21f1d6f4-d201-4937-05c0-08dcd88cca91 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2024 09:23:58.7159 (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: 4kZ2HkrkPMB4FSNZ+PNFJPQypMm4j1XL+7+l4vF0XwammJlXWfoW8fKPpmYWDrM4xBgmC5FBGKJNQvIkoglAcA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR10MB7769 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-19_05,2024-09-18_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 mlxscore=0 phishscore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2408220000 definitions=main-2409190059 X-Proofpoint-GUID: 9F15uFOJm0zM9pa5P88kX6pN9uQZCAiB X-Proofpoint-ORIG-GUID: 9F15uFOJm0zM9pa5P88kX6pN9uQZCAiB Add proper bio_split() error handling. For any read or write error, call raid_end_bio_io() and return. For discard errors, just end the bio with an error. Signed-off-by: John Garry --- drivers/md/raid10.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index f3bf1116794a..865f063acda6 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -1206,6 +1206,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)) { + raid_end_bio_io(r10_bio); + return; + } bio_chain(split, bio); allow_barrier(conf); submit_bio_noacct(bio); @@ -1482,6 +1486,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)) { + raid_end_bio_io(r10_bio); + return; + } bio_chain(split, bio); allow_barrier(conf); submit_bio_noacct(bio); @@ -1644,6 +1652,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 +1667,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 */