From nobody Mon Nov 25 01:25:06 2024 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9DB7712C478; Thu, 31 Oct 2024 10:00:48 +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=1730368850; cv=fail; b=F6eUCiMkdTBBaSQPQi+6zaM0maW0qb34drJFLKEHqGQxboYL3eDxSaIOBAd0GwyG1ZjEEPhlPBthzFqJD5g5svvm88NW25HPGEP8Ei2pHeBHYTJxm1fI0LzSu6XOscqheifrziEDP8/p45VJImJpjJW56c4bnHTo1KufK4G+lQA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730368850; c=relaxed/simple; bh=c8jIdfcSXPK27JqrUv3aGlnqFxwBeuuS2G6M8t/UsZ0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=HQIwEpr3q/A/BVVw8t0MRxUXJT777JOSs8D+wILAT+wug5zMsIx1RmnGbBOuWM+dR2fzbrLa0ieMypFJJ8iq0jFnbac0QFfkZxZgopiCbvkUa72C3Hn89GjYwFBInstlWhImao6PRJqP3y14anzhM1nJAElGpB6qdzl/WeZeymg= 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=flcfALMr; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=jAFUDvWW; 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="flcfALMr"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="jAFUDvWW" 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 49V8uGSp018312; Thu, 31 Oct 2024 09:59:34 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=ccL7dpCz2tD4y6CvA90jIiAn1II3KkIhe5SH+XRX/Ow=; b= flcfALMrhBNhOoorox2WKU+KQLLtN3Kid0PY4rP5CbD98f6G3mIwIEUycWGiY7Iv 6itW7BVYuaSHXQHC1uTqqbJ0y5C6LmiXEddfWJwMGvxplOj+YFTtf2o5sM95yXnk p3RBvFbilMymEnH0tXbQzxgMGN4An8ULtw1LaHz/bWb8l+gjgJJSz2t3w+LqGuY1 XD9eJUlWPuWcpcWJSWxRbFV2LSFMuru8BJnSs7ZuIb5Phd0gRiUljnYFHT647tjt mNf2Hf200RbncIIQm0uG+vebd1ATFbq3bylri5EmtA74smT4P24oLdgEUE8b22Xn dOy5Vd9NHZhWQmwaT0cdRQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42grdp9wq7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Oct 2024 09:59:34 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49V81xtP010074; Thu, 31 Oct 2024 09:59:33 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2043.outbound.protection.outlook.com [104.47.70.43]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42hn90ct53-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Oct 2024 09:59:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VR8DAp5HS1Fr1szoWuMGv9Fl0h+AU50zfmLs4IOJUOI/WaOE9yEmVEpjFky66AX1Q/Sm6lk5ucGkyPHuK2RfmtlzmNlx8h4WrvpbS8HXICUCug01D8YxyCyglclxuBEgwun6HxYSkdLVWmpSR1wUJOX6f3KHGX6sAN187It+ZCau9/Bnwm1VMvyf5Ct2zTqLWueCLXO3dj5QVu+sLYPn9MaYvkLwdIeIRngkn+gEM3x5de0UFO2PpRkCkRu/M4czfS8lLkl9N75I+uMuV/27li8zA551M9thSEWFqJ3+bCfhzD/LlJKTD1Pp4FZC1fLW/ipotJH6OhAB3+59zzucAA== 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=ccL7dpCz2tD4y6CvA90jIiAn1II3KkIhe5SH+XRX/Ow=; b=qV3sssRySG2bWXuflOOK1H0l8mga0AME4sffJR45OSr/JAs46VXAZQp8SpEQmEzyCzr9LN1LtEceGpYNj2v1/5QdrZm26Y340Gjl7hOXJW1ZD55TVvetNfypZOBgQkAuRVhDJm6WsrZrQw8GlLt988kkQxIxdKVGrnAKWUByyK8NojFEbPvqWhlmn3IkHv3EKY5fVtPWeXBgfz2bXc2aSpmAKJ9WhyWRJwp+GLvGCU/o5EZm4pKMvcMwqouCXPJynR8ihvK/NhzNvIb7Xe5OTcB2Zk2/krq4GJPvf4BG7N9TFRJ9H716nMykhLYACHvto71U9V0tynk8CAOy3y64Vg== 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=ccL7dpCz2tD4y6CvA90jIiAn1II3KkIhe5SH+XRX/Ow=; b=jAFUDvWW6yXZYIbQoJeOOm/aghPXPmmR+wdJxzPTJct2kEfhr4/usd8Zk+lxK3aQM1vMdV9cEqa5lalbcTZsTqaVnU7DMvb6APDfqWDVIvqiIrWo/8n4yC7giVLtawhXWLj9n/IeVLlSFhawbLqvn+FQN7ShXWKmPyZ+GaC6ipI= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by CO1PR10MB4708.namprd10.prod.outlook.com (2603:10b6:303:90::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.22; Thu, 31 Oct 2024 09:59:29 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%5]) with mapi id 15.20.8093.027; Thu, 31 Oct 2024 09:59:29 +0000 From: John Garry To: axboe@kernel.dk, song@kernel.org, yukuai3@huawei.com, hch@lst.de Cc: martin.petersen@oracle.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, hare@suse.de, Johannes.Thumshirn@wdc.com, John Garry , Johannes Thumshirn Subject: [PATCH v3 1/6] block: Rework bio_split() return value Date: Thu, 31 Oct 2024 09:59:13 +0000 Message-Id: <20241031095918.99964-2-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241031095918.99964-1-john.g.garry@oracle.com> References: <20241031095918.99964-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BN0PR07CA0012.namprd07.prod.outlook.com (2603:10b6:408:141::34) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|CO1PR10MB4708:EE_ X-MS-Office365-Filtering-Correlation-Id: 898680e4-1ecd-4b34-c622-08dcf992b5ff 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: =?us-ascii?Q?BS1hwqVLpIRSc540GzgGoBtD7KhzMUI0hmKKv0uvAXFmHW/xp4OMnGEZlkIN?= =?us-ascii?Q?3UkeCmAvRUgMlBdJ6yHgVYMWWGBaEdk+Cj3d8xtInwVtEjH8xIA9smEcxaF1?= =?us-ascii?Q?VF/DV+57pfxeDNxwcJsnc1+G6rXSW4DJ7/QZw9JLYB7xvvudlwo3wF9/ZlOB?= =?us-ascii?Q?L0hhHKLfIniO+j54I07zUJworPKL9usaxvNwLfG5iIU65hXRUvZzk4SG9E84?= =?us-ascii?Q?9Cz9/MxP7jQMdWx0VUuf2y33tlloZO8l0WCWn7J9qPajdGFUwSEfWKpQ54IQ?= =?us-ascii?Q?lhctvUfSnM7GhywipggiasVwDsoozQ0MIb5V5bZM0hgCeR6sLcHAbS25AA8K?= =?us-ascii?Q?Ab2MgpL62l/VhTdFxRrmDYKeBZDU6UTfrY+w7Z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?= =?us-ascii?Q?ydO5dgttzDWYnFIwsRU+UTakEitXjRpCCSR2ybU7+O0MRkfXZlRB1qmTpyil?= =?us-ascii?Q?oWjgbrtBg8AEgJ7TVY0l5SWA?= 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)(376014)(366016)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?21tj0bAm+UUggVIzw35oT+2s6nft1FeooqK+gO3aVoxyhlVU5BiHxXpD31w+?= =?us-ascii?Q?BD7bIV2OTYwjYVmYAOrZA22CGLrtiFyxlhZnsXan+vxFQtuQs2gIh9B7XRm+?= =?us-ascii?Q?sL86wAGRjKIzcns2csjTV4kmvfDUCPaQRxnS0QFvIZSneX5Pe/QG4wZxfHhB?= =?us-ascii?Q?2lxsvulNhEtmuD4ZhZDOXUkZZPJva7wjw0nv21agphXEDMvkyNea/9tkf0OE?= =?us-ascii?Q?vUzuKah5Yuz2tc5zUmGXUhmz0gWbl97iP8sJ4GyZf61JGGlHVPi5JT/BS+JH?= =?us-ascii?Q?eOn3INYoVwhgpL0v0LgCMTYYwP6RL/m4xge/12Cs8fsXblWpWneppb6nmIcQ?= =?us-ascii?Q?YW6PmcD//N9pLXNZWZZYVOWM14meuPxTwevRW2gNjMq7/tOdamLxmlIo/LdJ?= =?us-ascii?Q?U3p0B5LfK9sWVbZLwtvQE8ZpdbCCs5l/MWN41kURtnxTheZZc7049sdbr2sf?= =?us-ascii?Q?p+xc9MhF3JuUUFw/UzWugPMJl7AoebaVM+p+lhyjVdhF2ZqYRvwZtS0BnJQq?= =?us-ascii?Q?E1Nv3etFJgFWzevmiojU85bcVn0kDMT1JB3eDFRO6+bbmdO+/gpd6XFrA7MF?= =?us-ascii?Q?SD/wzA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hhukk4UQ+o1rSR1?= =?us-ascii?Q?ZWIbO0U1mzFLytv34z3pQf2ATn8sI+jgoUrxCxmKPFgqMhfUYm7cL2ncM3PW?= =?us-ascii?Q?0SUenFHV53lSf4QJ/+lvb0RsG8h8mNs2N41NdewqQNgOvtCUWajwdIJ6BQNT?= =?us-ascii?Q?Kw=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ch7yR9NCEstvqRn8lKSOWLfZmFSM2urLrwCQ5uEpIiZmCm+3G3vUlKS6AeZFFUIyDaaYKoCf4kt/DeCsu2eqZti279qABweH/5liZD08Cpz0ljDYQto6dPYr3Ljn8isyJtIL4OSe9sOXEzv48N7SK8CLG8E6H3ebHrfqP0+blxjZBTtyG6rZseITb3YRw/PU7ZmO7L7EQip+KOnvcRQie86QpKVMOD3VSkTGaapWdju7UV9u0kIujPPLKe1bBFqCiHmmLCqSff2iOsGciEtwVB6rTW4L87n4VfeX87Rwf+4BnGoFsJIzFWStcV58ftfvL8EYgNZ54qRCUZ9VA3hzwrOH/u2E44efU6jCzMo/LNHocdLZ7f7IieS89Q9ucBef1h+/GW9rcAXIsZsWDch1jcmFvTfApm0U0h5gK1FJwpOCVQxB9lM2tBglGSBYfOqIRSpLQytMWBfR5sefIoSZw3vVCQa3wmE52Mv6LrWuX8heQ7MA1jT49L3lWWzgT0VDWYe3RACB9n009qYQ2QdLiEVKNCgU/Ctkwu+6qjR4RBZU1AhaZN+KV7ZVIkBlco9zCToJDnDL4J/9b0qZFXAbnHAjgnV/MYAmxjTIRlSu5UI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 898680e4-1ecd-4b34-c622-08dcf992b5ff X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 09:59:29.5368 (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: nUyX5vSNqtVv3SpUvYKppKITWr9vlNgWKnec7uQHAIJmwbmbZ/WHsB6vivmDMHDGpAw3z4RYr2tEB6d4r5C7/w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4708 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-31_01,2024-10-30_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 spamscore=0 phishscore=0 suspectscore=0 malwarescore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410310075 X-Proofpoint-ORIG-GUID: RhtkHurnV6R-QSob7Qk4AL12jzbrBYlS X-Proofpoint-GUID: RhtkHurnV6R-QSob7Qk4AL12jzbrBYlS Content-Type: text/plain; charset="utf-8" Instead of returning an inconclusive value of NULL for an error in calling bio_split(), return a ERR_PTR() always. Also remove the BUG_ON() calls, and WARN_ON_ONCE() instead. Indeed, since almost all callers don't check the return code from bio_split(), we'll crash anyway (for those failures). Fix up the only user which checks bio_split() return code today (directly or indirectly), blk_crypto_fallback_split_bio_if_needed(). The md/bcache code does check the return code in cached_dev_cache_miss() -> bio_next_split() -> bio_split(), but only to see if there was a split, so there would be no change in behaviour here (when returning a ERR_PTR()). Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Signed-off-by: John Garry --- 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 95e2ee14cea2..7a93724e4a49 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; =20 - BUG_ON(sectors <=3D 0); - BUG_ON(sectors >=3D bio_sectors(bio)); + if (WARN_ON_ONCE(sectors <=3D 0)) + return ERR_PTR(-EINVAL); + if (WARN_ON_ONCE(sectors >=3D bio_sectors(bio))) + return ERR_PTR(-EINVAL); =20 /* Zone append commands cannot be split */ if (WARN_ON_ONCE(bio_op(bio) =3D=3D REQ_OP_ZONE_APPEND)) - return NULL; + return ERR_PTR(-EINVAL); =20 split =3D bio_alloc_clone(bio->bi_bdev, bio, gfp, bs); if (!split) - return NULL; + return ERR_PTR(-ENOMEM); =20 split->bi_iter.bi_size =3D sectors << 9; =20 diff --git a/block/blk-crypto-fallback.c b/block/blk-crypto-fallback.c index b1e7415f8439..29a205482617 100644 --- a/block/blk-crypto-fallback.c +++ b/block/blk-crypto-fallback.c @@ -226,7 +226,7 @@ static bool blk_crypto_fallback_split_bio_if_needed(str= uct bio **bio_ptr) =20 split_bio =3D bio_split(bio, num_sectors, GFP_NOIO, &crypto_bio_split); - if (!split_bio) { + if (IS_ERR(split_bio)) { bio->bi_status =3D BLK_STS_RESOURCE; return false; } --=20 2.31.1 From nobody Mon Nov 25 01:25:06 2024 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 530E8198E6F; Thu, 31 Oct 2024 09:59:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730368796; cv=fail; b=ipq5W72aeyu0WF7aLESfQYGITdGYMin+Yoz2wbBYo4lG2p2LQjzjGrDhMe04iNbK4eS9kpim+PsWXCwg7c4a3x3GHzP77Gf3//TUrfMGkB8A0M8NfbN8dZnLvK4LKBmUI4poAerjCxHHisM8/JZwGZ8ZZZrODJffov7+MNFx0To= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730368796; c=relaxed/simple; bh=ETOzPuqoqEfEuMWJuPJkO/ik9DAxJLhvFIXkXvvv6rs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=YNEbzvSa0jzbvnNNg6SHdJWoOokmcUF7mQlrlnK13X7t4AmmsV+S5dstCpdf/2+Ee5CuWIzd2YbmMn6nX5P+FbJk8dlZHN4tMZ1/yxnmFLnaO2es/v2FOwYVTivmrB265H1r9IiyfvmD+AqNKXofvwJu225uy3x7Bl6XxrnjBaU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=O9xDreko; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=bM8w2doc; arc=fail smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="O9xDreko"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="bM8w2doc" Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49V8taRM021893; Thu, 31 Oct 2024 09:59:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=JSW0tMVT/UtmEnJkgzaxHO7fXwcCXfZENqI01ubJRvQ=; b= O9xDrekoAzZ58m3V+vjEXrkjvq10pk6bRAx5ByarDL9YD5o3ljyntcMEbqfhoGJb pveHqQRJkZLO4xX+URimu6oh8Ej0LWJO890s1wC2Azw/gswM8AQjF8wMyx1omRWP ffDJWQLzty3/qHgacPgoo9rc6lMxkA2ucFcACgFcVCSXKj91o5Tc/6tZtTAPMhQB 5tQ7VhXlZhrDosbdwCanC098Z31WIDGx/C86L6bcCSCIUhbRHJL1gbm4sqo/4EwU jMRo8sviILgFVcgoM7cExl4bUpszy+NyMnblGIeEFdnwVndfW9G7uUVio3uI1ju+ 6Wahs9iwqlI7iWqd7pcV6g== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42grc21tyd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Oct 2024 09:59:34 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49V7o0c7004797; Thu, 31 Oct 2024 09:59:33 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2045.outbound.protection.outlook.com [104.47.66.45]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42jb2wseth-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Oct 2024 09:59:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DnmhBizG4Hd/ygGbMDA4eFb+3ADZ2ejMaOcgVZuLeb933TgZfsQ5TFU8sqxG0v+icK0+SfOaScLiISMDuu8q5ee6smniSacIWPuWqL07/ZrI6Z9+MBaF+a5qaWXRe56krOk+pQZCjoyGw+UX8xVSm3LHNRbSwC1aOX9HWNv1DXfv/+uc+Wm5dLKpbz87QiRqNeq5pD5QQurj43D005xWlSBYDnceoWonnxiKvTf7+SO3gC+mQqR84j1max1Zz8IpWaD85wNVHDDbmemQ3YXIFQdN/1pN1EPBfchOBJnkVx28k4WRzi1cF/lMu2ShZLzbTpjlxEfmqNl2hxqA/uKB6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JSW0tMVT/UtmEnJkgzaxHO7fXwcCXfZENqI01ubJRvQ=; b=lT4lAp9YhSX7Zo2BUtow6DOHAKufHS2VP9ryI/v9YYmjPf2iT76KbZPQ5d9Ao9tC9WEvpfPmjIbvFITrs18SEh0ceCgb4cnfJoypvM9JE6GzEm3qlLM6jZyKK8Yt3Veoe8f09YfHKKHr4bMrb4S8T8OjaS535zMtCqGyXDr2k54ZjHH8MtAxg3W+qAYEKGfKGaEg1pNGQ4DSgFAfxZzJ3aB1xgZaLdlzdoTVz0E0Uk1ufOeMsoqdNsuiyOvBzV+sEFd6Wp8BxE/6WTdXTW3QOezgFutAGM35dj2Qe5Hi4LLYFg5/RvhqTkHq3owGiMSnddAStUPCEotyx3+wv66NJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JSW0tMVT/UtmEnJkgzaxHO7fXwcCXfZENqI01ubJRvQ=; b=bM8w2doc1xj2X6O/HXXd7Jair8MXPFWv3P9NkTic0RfOwyJIEQnTBNrCjdsVl2MxDOdHOV4GZn4NgXKyclQsVtcuyTK9/dPEcA6Ez0SyE5ZbKyzjGSAlG2MCNMqC03zvYVEyNCQlNqT7rZpANDNV7p2FbRZ71obe9X30chsBUOY= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by PH7PR10MB5724.namprd10.prod.outlook.com (2603:10b6:510:125::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Thu, 31 Oct 2024 09:59:31 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%5]) with mapi id 15.20.8093.027; Thu, 31 Oct 2024 09:59:30 +0000 From: John Garry To: axboe@kernel.dk, song@kernel.org, yukuai3@huawei.com, hch@lst.de Cc: martin.petersen@oracle.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, hare@suse.de, Johannes.Thumshirn@wdc.com, John Garry , Johannes Thumshirn Subject: [PATCH v3 2/6] block: Error an attempt to split an atomic write in bio_split() Date: Thu, 31 Oct 2024 09:59:14 +0000 Message-Id: <20241031095918.99964-3-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241031095918.99964-1-john.g.garry@oracle.com> References: <20241031095918.99964-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: MN0PR05CA0016.namprd05.prod.outlook.com (2603:10b6:208:52c::15) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|PH7PR10MB5724:EE_ X-MS-Office365-Filtering-Correlation-Id: 4051da85-6149-4709-cd0d-08dcf992b6b7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?vTQgl4jlzlKb+Gd5oR29Iy99Ba5s7+eDUb2zVlIfhB7FbA4/++WvI4rwZOKc?= =?us-ascii?Q?DJCP5Gi3RmGUO/wmEF9MlQAAYBQRCa4PiRs0mqBt8yul2Osf3fBFgIZwlWry?= =?us-ascii?Q?NmyQ2SjQpifYHWTS3MYHRSBktPTAU04XWbkKEcYc3nlSzUSTAAFeeBlrhT9Z?= =?us-ascii?Q?7zz+7EIsAWk7muxqu5epOwIxNpzHrnJUEDHP1v19p3cZ75IG/u+vyrBZ24J3?= =?us-ascii?Q?+nTwg0n/eaKX6cwFJNtqJ59OAE9SVQcqN+QWAURp56ZL0Jk96ytOdzT+ZNCb?= =?us-ascii?Q?dX3zElUtA9eXFoPIk21zfA7H2EShkKo1vrqwkB+A7OPgW+tT9KbBGzczmnL2?= =?us-ascii?Q?3164GwH44vKfWckrUvu0mYG2SRp7Nhti7H9WwEHoY4C7CeeJQ5U/uMOKd3TW?= =?us-ascii?Q?kae9LHw8xVO7FnHLwX193dCINdjZdPflWoCEcUtTeSzZSjvpcODO5GrJ8pXR?= =?us-ascii?Q?JG5JQwaDG/5bNKhXNZbqUuiRv2a5ubNMKXIthfxL0W6Pa6jDWp0PEEVdCurj?= =?us-ascii?Q?ccEh98sQW9OhkXuj8I8wuEdP9zpKhKYF/qkGB+zQ9lLj9KfbtjS2gkOwIxu+?= =?us-ascii?Q?Y3qmKwENbw48ZoDFHhYmpazT/W0OFzPWjkV7AhurvPbb/kuA8b3313As83yF?= =?us-ascii?Q?XfsPGDuuVFZV/8Cow8r9yx6NR/40KmUR+51g3h/LF28pyRK3lGvLbyc/YcB/?= =?us-ascii?Q?iQUZexokPdrKVTvhNMznZqkKzC4lWn+Q4H5b3NbtcLhxzkRPGuZvGKy8XZEq?= =?us-ascii?Q?LFBVtMKB+HQR4zLd0Tm2eNIDlmcfFNAHyt5yJQmDSEOf8wkMDQcHHsjzm+fT?= =?us-ascii?Q?JMk7Rzx54v8sDDvMWpIbg+tZqdOFTC0y1z5xnt2/VdJUkzUxNiwwJ5Kd2bsC?= =?us-ascii?Q?sEPEG2akFb9R+8GW0qb2D4+ExMJ5BWNhCG5iiQaNSeoyUcmL8QjnoqITePjf?= =?us-ascii?Q?wUVSht/obelS1GkYc/wT8K94eJBKetJXXv+dR210RxkMhRciMtJhzjthD+0Y?= =?us-ascii?Q?YhpvpD0e6hXrEmpdbyl47n3KjUGN9ROLs9tR9pEBIWfKuGfHpy3lD6cukGmS?= =?us-ascii?Q?7a94ZmUXwz2PpkGFROOBMOHDxb9vyOkuHkTEGxx7oBeON7ohuXnl0gIeR1mS?= =?us-ascii?Q?tXEBx8hpkdyXQ4i5fmWjY2IpF028jhL3UzU4jG9w+BGJuEYevEYnx9AUHLw9?= =?us-ascii?Q?b0oSy0wlWCafWk3hXLm9VWs3JONx9FBR45wsUahg8lrlKbbfpuktDa6q72dD?= =?us-ascii?Q?DdWTFp8yEhadSUUpijapwIGSBX7NkH0QbalieymA9m/KUYyFL09lvJkxEUqE?= =?us-ascii?Q?jS0SfodEJKV7G2vlVnT4vupW?= 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)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?GkNNuOEaXP+3y1ku3qfxHtf8Hgwp//BnQ9D4EA0mrdhK9skqXbyjp+1PWF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n+L2XfFSt2SKfGzJZcs1jA3ZTydkQAjgP?= =?us-ascii?Q?3ZXvrf7yU2ZuvAVQzE/EJiwgc/4iFmHpy8CdRlfdWp0UHNZuusnd0P8lL3sK?= =?us-ascii?Q?QGEz8chs40RfmARe23YIjUjY5MMLlDMO+BLqM5iHWTiK4D/JSeH4WsPa/t0s?= =?us-ascii?Q?OhPkqM6SI13QQrEFFEaIgzraiqjncFXzrHER3e/gAjkXdEftWiOoc4/nUyGw?= =?us-ascii?Q?ZXcsk81vkgIcXBhSKOMUwspUvx+b6M1ekKLsWNSqbhqUuBG/S3ovsGsyaIQL?= =?us-ascii?Q?db04BbVy6dklCm9/61aDsq168Zz6wyypLVwgc+VGGyKS5SpmuCwhjAxQQLUi?= =?us-ascii?Q?i1LQxjL2Al+t1bCw5y18KnRbfpAls1VtKhytgEzx22/KaZMsyIRephBrZYJL?= =?us-ascii?Q?xakQswX+A7juhm3r7pCgl7NmIRZnFcPRI+g7tFAKnuP9NRZG+vEwVmAtRrG8?= =?us-ascii?Q?sQLhXtGQS1m+bhhpewmtqL1j79DxLgltIKnbR3VkdfZRDuoU34YIlVG2m413?= =?us-ascii?Q?+tuAtMp3LM2FDzJ7dXPGt7UYsPf7z9uBAQy6rRBpp5spS0Ex+lnp0aa76Hbm?= =?us-ascii?Q?hmqqW5vpcmAazmToGZfASkr/veH5r96VjHF0TQxje0U3z9ILPPCBvSf1737m?= =?us-ascii?Q?Uta4tW4C7LMku+IMZ740j2toPqkxdJXNWQ1aQruhCmJ/WxclfVKod4fUUVDp?= =?us-ascii?Q?Bg=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: l/pNmap4DZuC3kvadCwqxGqLH6nPI78lKXFU7mpViU+61s+1pRV0dutqQQnEraBaQEh4bptkPNRS62R9EjRkYFE1CnOgmyk8NR664Up2PBxGVmpOLvmK5L5Pe30P0m3Xo/05meuBBjUgTsEuE+3wrwqNgExQtCU5MTGZd1PNPbDnWxeloDUCFfb5X3yNikP5b34vnw9a1bgqXgI5DPEg74PySgNL0PpLTsd8lUPKX7eh6Gk7LQJBVsvDttHxUWUTP8BM9FGsKc8Btowa3X9OJ332YBW4riFcw9A61BWdRZlVlDNS47l8fjFg9YpSEsej9Hg6vBqGdAz4QYX0FxlhvcvqNEU6hBI0/PJRnwNr+q9cSkvaeYkWD4UVmLVPaxlRvJhtXY+5cO+Thjp+Tsd40tp0AfOXkgN163l3bppW9rCjYLSWeE+lagFnxkcLm/kky6FWUZHDH7QiCPZJW4cOYLf5XsODwARxEPmNQdQIvQ5u4YamhQ0JZbWDuKpSJZIjj90+PQebA0D+sUfLMBj+P50GWzRELg9u62iUKLvhspX50dk6pL3WqHHzUJliXaQ1EDDOhSOcjPITgMXfqvkaovxTfELUB+5jOvsSRf8fgTw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4051da85-6149-4709-cd0d-08dcf992b6b7 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 09:59:30.6717 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: h4pR3UXz2XiIWRlwMAT1Kc3SkC8Z1KL88Wdmjy5tssvnfIqVjOyfALA5zwHhTCjetQAvvhwYr03wpwDjM4pQpg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB5724 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-31_01,2024-10-30_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 bulkscore=0 adultscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410310075 X-Proofpoint-GUID: SI0wtIA0cGR_2YF-Xr-d6pJyORuW9xkg X-Proofpoint-ORIG-GUID: SI0wtIA0cGR_2YF-Xr-d6pJyORuW9xkg Content-Type: text/plain; charset="utf-8" This is disallowed. Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Signed-off-by: John Garry Reviewed-by: Hannes Reinecke --- block/bio.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/bio.c b/block/bio.c index 7a93724e4a49..07b971853768 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1749,6 +1749,10 @@ struct bio *bio_split(struct bio *bio, int sectors, if (WARN_ON_ONCE(bio_op(bio) =3D=3D REQ_OP_ZONE_APPEND)) return ERR_PTR(-EINVAL); =20 + /* atomic writes cannot be split */ + if (bio->bi_opf & REQ_ATOMIC) + return ERR_PTR(-EINVAL); + split =3D bio_alloc_clone(bio->bi_bdev, bio, gfp, bs); if (!split) return ERR_PTR(-ENOMEM); --=20 2.31.1 From nobody Mon Nov 25 01:25:06 2024 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D1C61946CF; Thu, 31 Oct 2024 09:59:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730368796; cv=fail; b=NcMa9/2qZTpjZyEygJ3KDGTUKawuh42JVS1eFF+i6Mgs9hg/kNhpwd39VEsaVbtn3haMDl4+MMuHoCvG2kS8ELxbZYLWyIu1e3Jao3qTm7hscuymZ22iU4Kyj+fyTTBnuSmdNPVa7WgYo9bPw5ey+uN3rvvF9ycHGnW9K6XCFcc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730368796; c=relaxed/simple; bh=v4nOGCmFNEuWX5Uz8qhdjbrYvJXMkYK17ZhVv/feAvg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=UkR8d/Hoh1p3PKJmXfV9bfjMcw2m4zl0TseoLd+yQh8pPdQH4uEuxyQjLqiThuHVVJ1CshUEs/QQpXxEkGbn6D0hW0dlgGkvM3qLvOErH4sOj2bjtZGLxr5Tx8GwotgpWmNO8ki6KZLvZFLPBZGtWtQjT8dl177z30mPqTeIuHg= 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=WcHhHe5T; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=fFXb9r2T; 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="WcHhHe5T"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="fFXb9r2T" 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 49V8tYBr023697; Thu, 31 Oct 2024 09:59:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=cq2c9PaCfs12GusU7c16wxubjOv2Jyc75uiQcQrT4F4=; b= WcHhHe5TFtRUSkbhNhG0dIFeYyq+ETdiJEVWY6bXsXISlmcGP5P6vf99sjv5cqwb 9nl9GN4MQs7KJsFXMau/WYJxbNAx/gXXU6lR6DyuuJck8DFU9L9/b5LoOwNvR8df 18ZsN76r7OwQpyceg0FnNqIiav/acJxb7ifGIR7uDvajR3ZztWDQo5BhDrOa3cOf PS8HrfXF2P5F3Vif34Qn2m74WJwRnlzQNJnIJlIzzL6RNuOCP2ij0iak8M4E7nvn 9l5JzxZ+FqbtwA53ZLkawcPwIXUZNjhldbwjYucw4gkvONcDvR2FDxA/M41htZSQ xeHnkdtxN50ClO9g28UTzQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42grgmj0t5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Oct 2024 09:59:35 +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 49V7o0c8004797; Thu, 31 Oct 2024 09:59:34 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2045.outbound.protection.outlook.com [104.47.66.45]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42jb2wseth-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Oct 2024 09:59:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=U8YmFe72m9NIezy0ghBXKNrAmI+eXHnPX2JuVz9+KrtJ76YNiReTC6adB1lJ8s74WorIdEw7ivp4KveFgqOLXiS3bQllDhR0a0Y7jBfLwYR6hx5XppaXe5RxSU63t/kQSqtqfezKFWBXRjq8CgJB/2wFOt4UtkEQhMmhg/NEnqgWl4y2QnfAMS70UMFZmIvajlaDeqijqYadJMJRIBubqWqQ/IXIwcrCdFRJs3Jm6WtWRuPw1OGfRgrfbO/5K1DcjsPUaRVWppC9WTI4dZdbqhfwGU+VLH2V5wiF9fK6wcuJfczKl/FJ9gZ7m+6mkSUupWF4csnLhmmFT7PjGxST5A== 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=cq2c9PaCfs12GusU7c16wxubjOv2Jyc75uiQcQrT4F4=; b=VjDI4+Yp4v2+uOw9dskuWe84akEQqjPQpsmRKMeymakOt4dsEDSdoWy4Af6rgic5iSqlzG7YYywOtUbnr+uRSMgN0hQyWZr8/GGkl0NwBKi7VNZl4ln+08ad4E6pQPy9I0L0kzlsCT32Yhff2FZbFUtAg5OY0s+j8y8HtkmxMcDFTymS/gZX+tcEI5Lerqz54BAutviXpxTwyuk6R4SXAmbV50GpDRPjFF96IpGz3Fd1iK+i/f9ulRaRgBPVDq+onMkY7MaufPsTOIFiCd0ZQVtmx/m7ZVZYyl1P98Gxls77sF90/AZovIRtV7JnUhQLTPrDKqci48lHjfC/67I06Q== 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=cq2c9PaCfs12GusU7c16wxubjOv2Jyc75uiQcQrT4F4=; b=fFXb9r2TVs7tYnHOf38M3IHLKI/eVcRaZfh/aC+TdDq3OD1cmOlG/AnGzMpZaJ7EZlgMijZg6ENJbVUc9b2EjgGB9UMcf/MBRYiC/Xn6s100Xlb+ZfO9fcjoBmkQel8kdJhKOmOc6eT1K/8fF70fQ01lQYJKMt7BXLu5EvsIAdM= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by PH7PR10MB5724.namprd10.prod.outlook.com (2603:10b6:510:125::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Thu, 31 Oct 2024 09:59:32 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%5]) with mapi id 15.20.8093.027; Thu, 31 Oct 2024 09:59:32 +0000 From: John Garry To: axboe@kernel.dk, song@kernel.org, yukuai3@huawei.com, hch@lst.de Cc: martin.petersen@oracle.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, hare@suse.de, Johannes.Thumshirn@wdc.com, John Garry , Johannes Thumshirn Subject: [PATCH v3 3/6] block: Handle bio_split() errors in bio_submit_split() Date: Thu, 31 Oct 2024 09:59:15 +0000 Message-Id: <20241031095918.99964-4-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241031095918.99964-1-john.g.garry@oracle.com> References: <20241031095918.99964-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BN9PR03CA0092.namprd03.prod.outlook.com (2603:10b6:408:fd::7) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|PH7PR10MB5724:EE_ X-MS-Office365-Filtering-Correlation-Id: 6bf9d3a5-3c0f-4c08-6178-08dcf992b781 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ZevnE8ZQsKnPE7Q1PNehq5OsAZBrfeaCNlNqzkkJlbaZgFs4/cHO8l2LqJyH?= =?us-ascii?Q?EEsrfHBUkuwec1BdfpsAD/3gU8Bb5zrOvUBnK6PxQFzyf+uxpUqVyW0ALJjT?= =?us-ascii?Q?uxCjGi65uEszZiMWYlnUIjujtdSTB9nYgaQrad1nOGDDu2j6kWMsuGTUhgCP?= =?us-ascii?Q?0mLt/CTeM5gPaQYKpnw4mPQFENonFXYXRjq0knH28nQwI/a77mGzHtioyWMq?= =?us-ascii?Q?2zvr2zcuWFwDF7gp18BABwTbEWujAVY9qhiVsiuE2KEYwDb7miaBb3ij3DMb?= =?us-ascii?Q?5ix3VDo0CSOsNrdcm0mCG/i7ScYmMNdLGyNjj6nMx78up5kqujfbsUD+611D?= =?us-ascii?Q?9ATLa/dITo8fWJ8euNpj467OsrSDf9rTHuAfThjEsSdigGctxzRNQwUQgibh?= =?us-ascii?Q?kIaYDWKPM+BXXUDG6U1FW6fnp57bf8ebzuxsUdqM8VgQwpJ+DsY2uW72MYwc?= =?us-ascii?Q?9+CxbH+Q0q2j+94GjUm8qIFd90C8jz+d8xik/nSFcToMe1FQaZ4ZUvZ5c7Ar?= =?us-ascii?Q?bmL7BP+xXzy56UyZp1bw7wr7AOfKngPH51FB+Wtb71lSSQtLNx7JJxncU7Yy?= =?us-ascii?Q?c65bm27cG81lzsjcJM2VWfOIeWSXaRpFEQG8QA1WbTn1pp9wv40+VKf6DoGr?= =?us-ascii?Q?FfTNCJdOPl6pp+s6uDNYSg0dtGwT3GCILhD6G0eRdSYkSJSKbbMn7gBS9uDM?= =?us-ascii?Q?+TWP3xwlzp7CU0lUNGcQ1OCeVHycPIma3Mteh144OMsBjBuuRaOfi6VXtspw?= =?us-ascii?Q?0fJVyTMtfoqyZuX+7kifenPXI216l7/2VCs3xzB2sSXFqta6kfNh45gNuKSe?= =?us-ascii?Q?LdJJzvHwDKY4wQ5SnBWX3eoVgksMCxvht7c3NXG8hnYBENKhAH+VtN/Qw3xA?= =?us-ascii?Q?jcHt2El8fClQcfJm9RxGwFC3unN12FEQtJspAkQE0xmcuStATLO2F1O9WGhr?= =?us-ascii?Q?bBAPocc5z6QuYoROdoF2OKt8fJRvhK0rhGvlB7JJatePlwmibsmsJz1gWcWv?= =?us-ascii?Q?XOn7QMDpOmgAZF1jxXwFIY35jnL+7f0jmYnEdcM80jBgD0lhLdc5U/QwCiKg?= =?us-ascii?Q?U5BLmFyDHx0ikg+TyLxWEVL1S3GZlNPjntmWhtNU7WFLcFeN3OTCkbyGktX0?= =?us-ascii?Q?3SuPGEdjlVYJsiJq26APpsQb8rU16Zj/awReW7SyLbDal6lzskr1vDeMcUGQ?= =?us-ascii?Q?Ua9mLdY4vFMOyS9s+Qagz4bHO0kGpSZRCdesuHFrWPGl+WNKXRYIMTxyip3h?= =?us-ascii?Q?jAKlyzf8v2FjPSAlFWtaEXvzdbWOaTOQkA7RvF3vc0xba/AssEP/rQPRAmDa?= =?us-ascii?Q?mbo=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?L+KIhPzmHIb/BSnqz9UAAlIo47HaY3MfeDdwmX2nV7x6z1TyFQRYDbMjtXat?= =?us-ascii?Q?CFcUaxUBY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hqkq?= =?us-ascii?Q?nW8eKmgW39rHbeLrTriwT98j7Ur/MWijdOv8Tf0V+gGt4ks2B9cXMvmQSjog?= =?us-ascii?Q?a/v/2pca61eCRwwu7Cy38jVzTx4I+Fe8KqHDQhh5YNrMRhHp+c1jv1geRAkV?= =?us-ascii?Q?k8+JkDKxh7G4g8XmoQrjQ9bih6WmXMQATWvFiXbVXp78BwMVI0vA5P6129dI?= =?us-ascii?Q?QEBpchYygZSCkRXBEk+c/0FF4xYQBBQXyKeQe5/Vxfmc0jGCndRbvtyiIUHy?= =?us-ascii?Q?XKeyCT3QxO6BQPVtm6Dqfyfjuxx1PgH49MNS37p1X5ZWfynPfy9lF09eTYWB?= =?us-ascii?Q?MrrzWH0zLUTLJcBc/bSldyvMq7FHyusOLlEdTYowlyV03bCDOd4MAFCBSmEg?= =?us-ascii?Q?iDxM9/Ld2uWU8tedzNzZmGpPJMRoKIt+oaFhABwDI0e+xVALn43EXvsfnO/w?= =?us-ascii?Q?ubsluEoIKkH3wsF/2NEyr3IbHow8I5QhKlIvO3aDc5L1Ko7HYePHoHMUn7uv?= =?us-ascii?Q?h5L1L9pfFDokmx9IfCWmls+SFwPSUPstoUjxYjc+gyoLp3n6PmXfede1mJY+?= =?us-ascii?Q?k0F2EZ/3V5WIzwXadhTWAnyrGZCUdZjWukpT3nl98/zR92lKpAmH1OAj8ngJ?= =?us-ascii?Q?uPaQYj3898izCPSTuGgEvxLcoqx6tkml6R0wslCyR7pi/o6xQ91QzEo2qrYV?= =?us-ascii?Q?VA=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: sTd6bYF2XjjSUp4TBWZ2HoDLHBiRN3xRWx8JCRM2PP5FLDl413dMihl24eQpWu3uAGZxazKraVCD+ZbwCKNjwvkWz8a1K2UHbovb4uqnNbaq3U1szgbbuNoc05bopimuhiIemDEuZiaE02lPnM5iCxLdEo9ZoB8lia3RFt6pRwuleLw9tlbnBFXo5XbMZjUvpapRNvERIz2QSH8JLYhhSH9RYkHBPMScsTJqfZfPDgcswIXZxgXaWZM/EjqCHQerQd0bTASAsRcd7bW9xqyBfcH/SeN4WcOMQHxVpyy/A31HsAXE4coGnDm+Mzsm3Q+KpvZxiBi+HITbTXh8I8dnRfBei1Y5woVccmS2IygNhLxjph2oVmImrv02CgHUZY+q7mdIbWtuirlLn5Lm+h/r/f6xNjxhksyI9h6+Q8Lg6rqkCL6nXOI9i3MkT0MccAji3ln9HghswSsvOTJW3uWXjyY52aKCsVx7myw8qTM6CO34Nm/lv+bd5wwlBc23BR81lfGT2z6dqWtXXVIvH9UWyBZE65xf7UGm/qc0FOIxKwybafnbTDLHJHH7ofuK0onPn9G2SGwL7A96FZEtMJN5wa5xREmgqiaruDIlQZYlzdk= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6bf9d3a5-3c0f-4c08-6178-08dcf992b781 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 09:59:32.1084 (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: tP+u9jvfwxhH7han7lc56RyrMNhO0IuxVY1J3ZevSeSulc6tP+XU0ODW2EagzJVDfqxKrLRjWK1uT2Cn12pLug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB5724 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-31_01,2024-10-30_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 bulkscore=0 adultscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410310075 X-Proofpoint-GUID: 4vyZIEjWYW3je6xwK7wb1YmmFyMndIH0 X-Proofpoint-ORIG-GUID: 4vyZIEjWYW3je6xwK7wb1YmmFyMndIH0 Content-Type: text/plain; charset="utf-8" bio_split() may error, so check this. Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Signed-off-by: John Garry Reviewed-by: Hannes Reinecke --- 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 a16abf7b65dc..4d7b6bc8814c 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -107,11 +107,8 @@ static unsigned int bio_allowed_max_sectors(const stru= ct queue_limits *lim) =20 static struct bio *bio_submit_split(struct bio *bio, int split_sectors) { - if (unlikely(split_sectors < 0)) { - bio->bi_status =3D errno_to_blk_status(split_sectors); - bio_endio(bio); - return NULL; - } + if (unlikely(split_sectors < 0)) + goto error; =20 =20 if (unlikely((bio_op(bio) =3D=3D REQ_OP_DISCARD))) @@ -123,6 +120,10 @@ static struct bio *bio_submit_split(struct bio *bio, i= nt split_sectors) =20 split =3D bio_split(bio, split_sectors, GFP_NOIO, &bio->bi_bdev->bd_disk->bio_split); + if (IS_ERR(split)) { + split_sectors =3D PTR_ERR(split); + goto error; + } split->bi_opf |=3D REQ_NOMERGE; blkcg_bio_issue_init(split); bio_chain(split, bio); @@ -133,6 +134,10 @@ static struct bio *bio_submit_split(struct bio *bio, i= nt split_sectors) } =20 return bio; +error: + bio->bi_status =3D errno_to_blk_status(split_sectors); + bio_endio(bio); + return NULL; } =20 struct bio *bio_split_discard(struct bio *bio, const struct queue_limits *= lim, --=20 2.31.1 From nobody Mon Nov 25 01:25:06 2024 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F26E198A39; Thu, 31 Oct 2024 09:59:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730368795; cv=fail; b=tiXPioO4Csr5B8EGfJf2EaI96n3ZuuGqqieA0MTNd5SWMfXOlyu85qtX4adfOw4iW4RM6u/ErCRcfd5WdqeTFmaBQjggF9qb8tcX2k1ftJRHMULUmT8Pzt9+4UuKMCVerbSWWQ5dhAyYeFo8wHlGg/oWHlLkj5geaNk0OcgyHjA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730368795; c=relaxed/simple; bh=0USIRZVpezm/X62HP1KGA+g5Fu8SGGeC+lFeSf6kW5s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Pb1y93H0x9sKTLYfHFuQqMpOtJOxGboUQQjlWMFf4e+ktXGX8kSM2mWACmyF1GH6yiCo+MjG3sZK6nKz4YWKUHJ1DZcxpQO1AWFClVtDLo68D6N8rIibxmE04OODmANPGXi+DO474L54rD7okXu3qKsJGhYqwx+2OQ7Ko3g54t8= 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=dA8rh+1X; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=vO/JkPda; 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="dA8rh+1X"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="vO/JkPda" 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 49V8tXpg023668; Thu, 31 Oct 2024 09:59:37 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=8CTkAiAm3wkP0fnGTSU/PIk4vtwjDT8tO9VDip3utlA=; b= dA8rh+1X3lj8ztJedbxILTMr43lq2ehF//gLshXlZNp9zPHTKD1ER0wcOBf1GbFX k3pbIvsf+V5+fb2xTBFWN/5qx89bk9OChJuMkbecwrhnk+EqcEUVMxCAEJE7QnuQ Pk4EXlgXi71TYDEAZiIlvazc0W405s3foDOriIDaYhCeUVh7pNNSU5SsC4vOUk1w QSWfOaS7+21AqyNZmzPAYAnULHOzOAIqnjDeY3sM1b6XZih4Rkx4GpIil/9rCRFC DDkZJS/4wOlxDTPTDl0WNiJoTOLe7rbucW7tMzPfri7At0m/EZp/taAgXT5aU0Cp rZuVG+6gIK3R7+4gWrF9og== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42grgmj0t8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Oct 2024 09:59:36 +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 49V7XVSM011848; Thu, 31 Oct 2024 09:59:36 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2043.outbound.protection.outlook.com [104.47.66.43]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42hnaf5vwp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Oct 2024 09:59:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Rc/kSVDSvk1OPtVbKdvSdyJ+zLj+5hEMDpm3eKoPClikv8YxqXi0DZgQQuEMMkwmuVVtm0GOxfx1+NpUSHiiNZ++ueIVJ5chVa8EmM+3qA2to2kXFRJOayNYvYdljktaMxvarmhP59Ljy0K3cA4T+UxmBxc2MLDHo9nCstaAEsI2chBs8uqQG9+4MQnA/S0eAeKn5QAXKOyeA/w/JoBzDBZqQbhOub36uyofgDnpJpJ5xORtO3Rmv9D2H+nlRGkyaEGsufq8e6gQ2/W8yRoP4f0dD6nTVG5ytFgPm81DdwRD8COKmOS7cXdEAICpz32CJrhp2bCn4snCfOLBtr+U8g== 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=8CTkAiAm3wkP0fnGTSU/PIk4vtwjDT8tO9VDip3utlA=; b=xfo5bom2BY0rLseAMpFPpAICdadQ6sg9lV6qU0uasyR9cyxvNb1myInpaZkHX1PbBop/grLOzIRefPbfRUDJiLF3TC17NjFVrbMI+caAk8siaVruLOY9HJvPk4cf4KXRcf5pozWlRGA0PuG6v+rRwSdPjmSBxbgoxGYupBZ+ZjFWn3SWN4t7E/B42QVkzB4ReoBo7N16MTAZhGUkkqoMaIo2lEUQ5X01OFiEOr1V90dk/FA2ZrVzDOYRrPiylqYSeIhtKDz5tojR6qGElsfjC8GjEU5nAB2mRlmew+teUn+cmK7u24MXQ5sMQJ8Ki53tt8pG+AlcgxqVdpLpfCpotQ== 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=8CTkAiAm3wkP0fnGTSU/PIk4vtwjDT8tO9VDip3utlA=; b=vO/JkPdamVAX5jSED72MpgvvyI9LSsc5V2ezAKDgErVfCxJozV+XC3RH1WrENQc0t6BjhULTnkjy5cJcrWRY/sQS3oAzE0PvISnepXaAmGYlcR5wM/kqy9UB8u1zXvWLG/ujbQSfUxLlefwf41ILtn3fO5dkCagwfPm1wh0XgUs= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by PH7PR10MB5724.namprd10.prod.outlook.com (2603:10b6:510:125::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Thu, 31 Oct 2024 09:59:33 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%5]) with mapi id 15.20.8093.027; Thu, 31 Oct 2024 09:59:33 +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 v3 4/6] md/raid0: Handle bio_split() errors Date: Thu, 31 Oct 2024 09:59:16 +0000 Message-Id: <20241031095918.99964-5-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241031095918.99964-1-john.g.garry@oracle.com> References: <20241031095918.99964-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BN0PR07CA0029.namprd07.prod.outlook.com (2603:10b6:408:141::11) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|PH7PR10MB5724:EE_ X-MS-Office365-Filtering-Correlation-Id: dae6cf3d-f978-4379-9eb3-08dcf992b864 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?QZyNHwMBFMk8sJ0hUoGEh183mV1a4Vgc9r63pMRNn09MbaO6PKKGLoQUou3Y?= =?us-ascii?Q?bQK5uRjiEfpWChmyulJ7MaocpNG4sswrUtUezDDGBJt78Ll6Yo4+Cd5uX+Pr?= =?us-ascii?Q?/RL+vW6zbA7bGy80bA8eKphB7qW8Rz4lBs5ug4Y9y126I6qfUMeeZ84PWxRD?= =?us-ascii?Q?usNZ5SOLwIA8+/B31/HUiUas2uDT8/nHutuw+6OKYgbnyevqBDPSnYRhsosY?= =?us-ascii?Q?9viyqdj282RYe0tcBdbPQ3SjbnjTuTjQP9/k2v1yBu3AHaWdNtTrJLldlt01?= =?us-ascii?Q?PcRsdOUMY/tZUKqbbKMUU/lzlI1Bu0yF7lM3w8N6K+3RYYDgCGCR3ZZp81bQ?= =?us-ascii?Q?2iONtr8F9W4mS9HWZ3ManI19fuu3fJ6XM08bjAtzwG5MvipqhhfWwDs884UQ?= =?us-ascii?Q?+XU9iFnPUdU34yuE1BfzVe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=?us-ascii?Q?2RE=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR10MB4313.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?q5UccMs/nIxP43CQcFIVdGa2eSkGKR0UIWT/dRJ0ZddZnAEAuYUewb7LxYwz?= =?us-ascii?Q?MdE2arDn3ByC6egR4c3Hc5CvQM2kHsDWzjeqQspyguzRLH+ciSY75BPzeYFj?= =?us-ascii?Q?DoJN/p04+9yE+ADuG2dCC6PB6g1jZ82b/Ajs+mRMNZlIDR+r1hcEpp+Kj0Rm?= =?us-ascii?Q?qlxXGVCjEt9qKRDfWyA4GNCAFP/jciN/T4xXlMtJVZnTFcXzWOv+g8879pc7?= =?us-ascii?Q?s3B2bsItHWywhX0nYhgfN0/vrQBhd9/sNjtMxTmNgjWN2sZhfNxUtaUH9DDc?= =?us-ascii?Q?I6vSID4xpml+SQCxJihVt4fFIf1Ocs80SxWIVAWg7aYR1CvdYlBtJK2jhnlE?= =?us-ascii?Q?FSJZCQ0gsEpb8RQupDW18LXRKXzCl2Fhpss4riG7R1xm2fCDOpNM9g7LYtis?= =?us-ascii?Q?THbaSHgcC+KoAARejLpO8lLAzNUTo0/ST4dekLEDX3l05SwRxdMEij0AsJQN?= =?us-ascii?Q?9JglXpvQ38LOlHuPQlUlcGa5Wstymu2mLzZLToaAxQd9mybgMtkfdGDO2Wj9?= =?us-ascii?Q?i2LDi2rPhT8/clbY9HvMCpkoPBupNk3d8IkXfYLrjTc6GiPfSM1YNQSKXSum?= =?us-ascii?Q?HYq73n5r6qY+k8Zn1afQzPhpPV1HBdV7p4gc6y4N7kfC+Blo8Bif5++43qCX?= =?us-ascii?Q?qzAOJ26gdGw4f/FTFF1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ii?Q?i5fNqYGcYgTicj8wv6ibjgGWvd0iOBI8z3sPzdDSY68TpJumfWgE2merbWbV?= =?us-ascii?Q?YA=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: QRBDjpp/59SeKBEBWv35F+O3gepQk95zHA/D74eWMIsqCq6p/TdOaN4s+K2WxTFmIN48uCuPd2rt6FxRnqe4l376aAqnb2JT9/00Fe9fb7zpGfpww6jcQkiuj6/AGDagzHIAg9G5Vba830CLg6UmvHLLC22KN0UkdkxzypxmH+VhDjqHzCrIqxzaLo50SUcpz8/WuMIyT3qTrmdFfMX7eZEkWna0SG6/0DshH3rbB3z87Ljxl1E19wU7F91tb0GztQQDlj+Ww1GtdvFa0qOjP/kKCPubLrslMeBwAEE9CRtfUeX3syd339U97UHFoy3fgxFbDVh3gfDVIdtNRHKLJQjrjIna67PC8EkyazgysksyQNStMCnLC8rBNU0cM+O4SMJiFKy8XR44yfsFyuY78wLx2eMl0CM1DVbIgtUlMq/29STwRK6EsvxFtfHgETmKkxNA7IXqX9m6lkVHYH2JgDNkvJFMMF90rijK3dsFrqEretyK6sre/W69CgqdTwKL4qIIo+GtPO9gZPuoFARjtx8rBcftRElYs2zUoP3SRWm/VzGqHsli3QhHBrmoUQNEHI7TkVGqbr4zurN6mAjrNDBBnWZ/mN83r3uy/bpqO8k= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: dae6cf3d-f978-4379-9eb3-08dcf992b864 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 09:59:33.5024 (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: qMB4ms5IbRdJBnKeuavDuxxU7LjqLo+5PS2tYqY72K+6IRwhw4CQ+oA4kKhPiXVSD5uQ+F71YbtZQjbJipu06A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB5724 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-31_01,2024-10-30_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 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-2410310075 X-Proofpoint-GUID: fzn38IynrcVtdyJFfMQ2ovSfQeUWqGoW X-Proofpoint-ORIG-GUID: fzn38IynrcVtdyJFfMQ2ovSfQeUWqGoW Content-Type: text/plain; charset="utf-8" Add proper bio_split() error handling. For any error, set bi_status, end the bio, and return. Reviewed-by: Yu Kuai Signed-off-by: John Garry Reviewed-by: Hannes Reinecke --- drivers/md/raid0.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 32d587524778..baaf5f8b80ae 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -466,6 +466,12 @@ static void raid0_handle_discard(struct mddev *mddev, = struct bio *bio) struct bio *split =3D bio_split(bio, zone->zone_end - bio->bi_iter.bi_sector, GFP_NOIO, &mddev->bio_set); + + if (IS_ERR(split)) { + bio->bi_status =3D errno_to_blk_status(PTR_ERR(split)); + bio_endio(bio); + return; + } bio_chain(split, bio); submit_bio_noacct(bio); bio =3D split; @@ -608,6 +614,12 @@ static bool raid0_make_request(struct mddev *mddev, st= ruct bio *bio) if (sectors < bio_sectors(bio)) { struct bio *split =3D bio_split(bio, sectors, GFP_NOIO, &mddev->bio_set); + + if (IS_ERR(split)) { + bio->bi_status =3D errno_to_blk_status(PTR_ERR(split)); + bio_endio(bio); + return true; + } bio_chain(split, bio); raid0_map_submit_bio(mddev, bio); bio =3D split; --=20 2.31.1 From nobody Mon Nov 25 01:25:06 2024 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51966198E65; Thu, 31 Oct 2024 09:59:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730368795; cv=fail; b=Rtl1M8sK750GQbQhcOpSc+aL1KUdQgeutiMVOyTVUMA6DrjiRfrPwkYz58glOQbnKjrt+67ET9aigG4Z19odnkulUDzGawivBCUl/m7/8e+H6N3e8da5BgSC9Ipkl7UWU3o05ctuIQKgRs/ZWUiGQlaDhdyrCMYiB9imeJILNmw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730368795; c=relaxed/simple; bh=bVFgN+Nx0yow5WSnyzUjLTqB7/9BGHm247QIroS0xbU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=KrXftKO4t4P6ID28gOQeWIwrDdAWSjXeG99voVA4U3lkE0XOEW6LF9p7Z610aqbklop+G9HcfUsOdL6E2ALRoQk+YDeK87QFOi3qXQPzcdGEgoFiJa3txd7t5QSkaTHqxYiZaHDUen1dZ9TJf/8DcHwOT5uZyskvrh2w8v/gYOY= 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=gO6WIn8a; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=fu29Wsnt; 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="gO6WIn8a"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="fu29Wsnt" 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 49V8tXd5023675; Thu, 31 Oct 2024 09:59:37 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=42s53HmVDS8VAifHu8BZCjh+QcI4tyInVm3M2lBnnCo=; b= gO6WIn8autgp8JZMFvqtoQd4spAby4AkGvoL8ta3ps5FdXR79E+0zPnt/MP+Ysil vf8PhjUDrTlqDbxM98oRgOCplJZx8bYb7htWjONxeeR/twXCFOkPaHWZ2Qd13+o8 qsrgklwnMUTM7Bgvc9CaZd4yOChf6oNxKwJIccIQA5GaphQL0Z4lsq4kXRzdjYnC gT3264cuiPtFgQ6rNm/BR2UGMt5Ew2O4VfH9nMm4rjBsTGc5bcILTyn2FgogCFJz 2H4paWtHO4TksFlaYiE+Y+eIwFny8icIAr/52mknznzdsXGGPbxTqb8kCVy0XQoB G5oMEpDhbuQMQakOBuXigw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42grgmj0t9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Oct 2024 09:59:37 +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 49V7XVSN011848; Thu, 31 Oct 2024 09:59:36 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2043.outbound.protection.outlook.com [104.47.66.43]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42hnaf5vwp-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Oct 2024 09:59:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LWGO9p7+GI7xriA0WjvkH12GLjrkmnhyHEZaAWDiVv1T+wcQ5zyvSX4YV3lbyMVTqw51ldn3o/axg89/egi3e4mN7Zgi9/FFTn0G3PqrnIOVB82HpJOJ/dOtUE+ztPJUYK2Jl3hD6KeMVB+dt12KfOi5i9kxC16zpPzTlejkhsm7UFkB6i70+V6/y4CaLYXt9QfMj0Bn4SBPB8VevXJZ1FabYLrx2/BIJFIwhpXV0ebV/0wRqDM+/k4iZWUsfAl2j4NykElkh3uCCdkutDNnrJJTe7E3pgixWeCr/4Z20hk6NCig8Nw6wiO0grHdR9tjCP70jZxBLCHy2jfOH9PT2w== 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=42s53HmVDS8VAifHu8BZCjh+QcI4tyInVm3M2lBnnCo=; b=sxAxzkZ2g5LwkVNLLTERHT1tPImUCHddmlUaT952w5kzN8iArQAeS26eenLOKLT835gROrpa3QkJYgixLZdTooVWzD+UjIEoQK2zlSxJeOGs5u2zy/fYvx1r2fccPUt9lf+s7Ce8PPz2umhhQHU7Wt9G+g3JnDlZ0pSwlAfDGqOhv/Xhxhl/WyuDS5gAfPWFslZZRpS49VOKg3lDtZbiYMULxQ+Yn0YihNkwb3QFpwItfOJZiSwcnnH8YNkEj878RyFhAnqsYFuuRNEURqeMz+jLB65jNYYf3Q1rngzW/GpGFA/eKfhXXmD8HgsHiY8ynrtVojCA2u9fmyIa1jAmVw== 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=42s53HmVDS8VAifHu8BZCjh+QcI4tyInVm3M2lBnnCo=; b=fu29WsntEWUat+eVB5b7PkdZ3iVco3Ho/qbRStMiMzZRCU5Y2JC/2q7P4t/ymytmBTMYrTtfYQA7jSPl6My4E8UH6ZtrJhXHbExbeTLAe0VRSxI+RPnqTSAEFQlTz2QRpKUuw2jjWNSmqLQlEn82OJQ5o4jscHMwEZ7ynSB/X3s= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by PH7PR10MB5724.namprd10.prod.outlook.com (2603:10b6:510:125::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Thu, 31 Oct 2024 09:59:34 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%5]) with mapi id 15.20.8093.027; Thu, 31 Oct 2024 09:59:34 +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 v3 5/6] md/raid1: Handle bio_split() errors Date: Thu, 31 Oct 2024 09:59:17 +0000 Message-Id: <20241031095918.99964-6-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241031095918.99964-1-john.g.garry@oracle.com> References: <20241031095918.99964-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: MN0PR05CA0028.namprd05.prod.outlook.com (2603:10b6:208:52c::12) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|PH7PR10MB5724:EE_ X-MS-Office365-Filtering-Correlation-Id: b91b2115-e8c4-48b8-5ca8-08dcf992b8ec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?a+zqSv5mEILDM46nUE+IfJOQWaRvuQfRipyi6Ppthi/svqRFhzUOFayI+t3X?= =?us-ascii?Q?yC2iT8Qx6EGh/S87abtrDbE9MO1sTBLN1dL39KPKwA8TKGI7kcc4YDzcb68t?= =?us-ascii?Q?2Hnm2OoRs45j4AKEPD16sm20qs3oqMwnTzkXQ/FTXB3sOrIj8Sg1gaNGSJLM?= =?us-ascii?Q?mYyBuZzxAab2wfR80uHTGW/f1KwanysanwMJiD0cOaIio2a4O5x418kMX+3Q?= =?us-ascii?Q?27+0EJE1KLpCpfHVixBNexAjfEgOuQS3WcbCFKWDbgyoeWzACIbpuwcGohAx?= =?us-ascii?Q?PKAhv+E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JTVLzgva?= =?us-ascii?Q?e8qLJpJdsjvRg43bO3A3UnaeqNpqpc48K3XW8lsXmrNExSebGvtUd53511gB?= =?us-ascii?Q?riXwi95gtAaVNNh10u/M9HzQ25eCyRt7FaCuPZHxeo0U7i3NQsMJYHgFGR83?= =?us-ascii?Q?mPtmMIHcschG7iEFZgOMWMIS?= 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)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?RYKHBJoT7b7Kv4kbjlErWYk1czg9vtiCHNM+eFlz18ZXG848RpCz6/Tm835U?= =?us-ascii?Q?bNPZBk5twXLl9msTfM4BPClZcGS5ctL8uKK9jbdkH34/QbsBlHoFnO6nCbbA?= =?us-ascii?Q?K9WTIYOfnI5d3JQLjlj3yuJh8gF0pdVdS0cOVZNdN5awA1n5UZYxFQlujzzO?= =?us-ascii?Q?emkwPMdcaYwAUzAkitgUnkfvK2WNT/VjLV+yf9bA9SzIVyLjpU5YQy3nQzh6?= =?us-ascii?Q?4m+5rqZGioaO2GklLNCUu34j/UhKIEBmiGxbr6IDkb05E5VcFJHjW7iYL1gg?= =?us-ascii?Q?ILwXXviPCBRyF+WiWWcEvTImR3LTOihElk9HhScMWlEJuCKpnaprsEzeb5m8?= =?us-ascii?Q?7Ym/o2yjyOHxw0Meu1rj5TLiJXuSIQee8pI/VYn/bvSrlIJ3dh9EIQrfN0SZ?= =?us-ascii?Q?PmgMLb3+esjkrU4jQTVfh15gtJHOWsFzqSTQB0Pbgr6/YvEYi7DtLjFy0W/b?= =?us-ascii?Q?h0R6VzyDnvqIZW9FKvGm5DjI3ZgGiPRcvEqqZgXOg0wNKGzS5gC7rvakzDfM?= =?us-ascii?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h/30vhQ?= =?us-ascii?Q?CQBP+nrLQHg6IYQVuzq1CAILe0mhK0UyGRa6gdUpevFhzfUQYQvGUmbI9pMU?= =?us-ascii?Q?OE35HRZfYawjtnYAXHNTj2rBzG/Vngn2bvcIpALL+Z1KJA8qLtA3DOSznXZE?= =?us-ascii?Q?KtaILLHuANMVixIsgTXHubBm4nIwHyQArogJo8jsx6HylZt2zZBGEuGgVXNv?= =?us-ascii?Q?Yw=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 4ire01YzlMae56WkLKhiqVj/K5s2bhatk8TSky45TBKQH82cIlE8QXDb+jbMxs9j+GU5nPyrJiwdPpHd5EYlVoZMPMM43p/RhFmp528kpunME4bk6jAR/xWXLaJUj38HEI30W5T6amEOO88jFGiXuqgDWuImr4/YA13t9NfgeUmZ5Oo517XlcYETHZ1Me1Gciud0BjmgSKOM6hbrFbg9NvdyFa+tgtcBEgUowCyDFhV+fCuNmBec895+j/9Ha97hv14sH+AcE7tQfMO7VLPP9b+OUx4YGZjYJOMFDmawfMaW4HWrNufhkh8YzYWC+CkiZ/4Ed/SOgou49J+7C/BbNPLRR3lfcJx5NuA2bUYJ2SFvAi3qASIuuTjHgrKXVen4eRORJKI1EYlrlZrQzbRyoplHAdnToWzasJ5ySfMgpV2IUZATfp48ESF+sw84g/vW+tlLnE5U6f+NIoHblYwdgE22IVMaM3ZG8XHikyYkFYQL8FvrE1iTohFJk6Oc2hV84+NScufHYrX6A1LjgIOMuB4GNOyj63UBFD2foRWm2lz4OHaOa5f3Of30NT1MkTqTLpUlIdL7XYWINMcGzeTBPRmGXpJ3oorEAHWML6tFxoE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b91b2115-e8c4-48b8-5ca8-08dcf992b8ec X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 09:59:34.4036 (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: 8iaw063zT8n8xdZ6AGxX4D3dnS56foUlvW+yXrnsBYH2XIstzN5fyu4d6vfK+boCDzNhj030bIZBVt9k3FUJQg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB5724 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-31_01,2024-10-30_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 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-2410310075 X-Proofpoint-GUID: 8WZ8D8EEhSuq5jHrLdccFbTF16Ni1rxL X-Proofpoint-ORIG-GUID: 8WZ8D8EEhSuq5jHrLdccFbTF16Ni1rxL Content-Type: text/plain; charset="utf-8" Add proper bio_split() error handling. For any error, call raid_end_bio_io() and return. For the case of an in the write path, we need to undo the increment in the rdev pending count and NULLify the r1_bio->bios[] pointers. For read path failure, we need to undo rdev pending count increment from the earlier read_balance() call. Signed-off-by: John Garry Reviewed-by: Hannes Reinecke Reviewed-by: Yu Kuai --- drivers/md/raid1.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 6c9d24203f39..7e023e9303c8 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1322,7 +1322,7 @@ static void raid1_read_request(struct mddev *mddev, s= truct bio *bio, const enum req_op op =3D bio_op(bio); const blk_opf_t do_sync =3D bio->bi_opf & REQ_SYNC; int max_sectors; - int rdisk; + int rdisk, error; bool r1bio_existed =3D !!r1_bio; =20 /* @@ -1383,6 +1383,11 @@ static void raid1_read_request(struct mddev *mddev, = struct bio *bio, if (max_sectors < bio_sectors(bio)) { struct bio *split =3D bio_split(bio, max_sectors, gfp, &conf->bio_split); + + if (IS_ERR(split)) { + error =3D PTR_ERR(split); + goto err_handle; + } bio_chain(split, bio); submit_bio_noacct(bio); bio =3D split; @@ -1410,6 +1415,13 @@ static void raid1_read_request(struct mddev *mddev, = struct bio *bio, read_bio->bi_private =3D r1_bio; mddev_trace_remap(mddev, read_bio, r1_bio->sector); submit_bio_noacct(read_bio); + return; + +err_handle: + atomic_dec(&mirror->rdev->nr_pending); + bio->bi_status =3D errno_to_blk_status(error); + set_bit(R1BIO_Uptodate, &r1_bio->state); + raid_end_bio_io(r1_bio); } =20 static void raid1_write_request(struct mddev *mddev, struct bio *bio, @@ -1417,7 +1429,7 @@ static void raid1_write_request(struct mddev *mddev, = struct bio *bio, { struct r1conf *conf =3D mddev->private; struct r1bio *r1_bio; - int i, disks; + int i, disks, k, error; unsigned long flags; struct md_rdev *blocked_rdev; int first_clone; @@ -1576,6 +1588,11 @@ static void raid1_write_request(struct mddev *mddev,= struct bio *bio, if (max_sectors < bio_sectors(bio)) { struct bio *split =3D bio_split(bio, max_sectors, GFP_NOIO, &conf->bio_split); + + if (IS_ERR(split)) { + error =3D PTR_ERR(split); + goto err_handle; + } bio_chain(split, bio); submit_bio_noacct(bio); bio =3D split; @@ -1660,6 +1677,18 @@ static void raid1_write_request(struct mddev *mddev,= struct bio *bio, =20 /* In case raid1d snuck in to freeze_array */ wake_up_barrier(conf); + return; +err_handle: + for (k =3D 0; k < i; k++) { + if (r1_bio->bios[k]) { + rdev_dec_pending(conf->mirrors[k].rdev, mddev); + r1_bio->bios[k] =3D NULL; + } + } + + bio->bi_status =3D errno_to_blk_status(error); + set_bit(R1BIO_Uptodate, &r1_bio->state); + raid_end_bio_io(r1_bio); } =20 static bool raid1_make_request(struct mddev *mddev, struct bio *bio) --=20 2.31.1 From nobody Mon Nov 25 01:25:06 2024 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49C29198A22; Thu, 31 Oct 2024 10:01:51 +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=1730368914; cv=fail; b=SPNZflnBu6TEiGhDin8IbqxxMCHjcZEp9gzA7gRHEVQRC5rG6jDEf4kAxU3RVsSL8PPk3kvPgB+LTbjTMjOgGEe9/5JnlwtJAyDla4qJhptDPfU6ESEcnNQmY8aHLGMNmi+QS8IR+mJIq8tMwPIygqaPBtn/SAyTYpEEC1I9dqY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730368914; c=relaxed/simple; bh=IQ8Ai2d9D6HUH04vHx/RfA9bTRvNZeNq4WJQeq0y8mQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=HnMd6LXEDltPZpH2CjVdJrnoukVMIvmW4Terj/N1CLCY/pdlliItEsFAMe3w9jHh3XxoG4pdpztddd3q/K4RLJcTocXJmGUNlebuZ7iJO0fIs3ZFyWLB6FaPNbrpm1nZGOtsTLJkDXWEAPYiSemXQ4pRx92rNGHEkTt7yoRgwUA= 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=MONltmRZ; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b=pPG0UIKx; 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="MONltmRZ"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="pPG0UIKx" 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 49V8tXph023668; Thu, 31 Oct 2024 09:59:39 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=c6EReUW9QYM0vi5N0RYoxOHXOcFSJKmg2fpDWnAvUmE=; b= MONltmRZk2j7Q2qiO6cZ8+9g0yHPMUBmCjeIHTqN/QwegQrq4f2SPiDu/lmj9eoa 8Isp8I+EXuMb3fKnWcNf5YVax9R97QJhDECGqBNjasTimipnNY8kXZPRMxPslxqw pPL5sDsWerPJs+EsH0CXrvvE1agmRQLmjiey9bVczcE1IdgXrCIrLdKodqsNpb6T X6lxuiX5dw/+N9+8UBAGOKNiN5Q6TQtZ53i+PvnSdrFJ6E3a4c1ml435qZOQDGsM iT+Nf3JBd1usjJowL2rxYqPp2xvRsypCEinc9SVPyWEth9n8Og2dX+cT0GSTfodA Ieur+v0knot2iUgiZSl93A== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42grgmj0td-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Oct 2024 09:59:39 +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 49V86dKT034810; Thu, 31 Oct 2024 09:59:38 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2049.outbound.protection.outlook.com [104.47.66.49]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42hnda7b52-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Oct 2024 09:59:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GciMFW/sE+7Aqcennopag8xUvvA5nFkUzMUyiQj0Jskn0/+4j4TIZuhk/I29amp5Gd9Eb9CTAZif16FPQK4WMPYbM6Fe98Al/gp8ys4N7EuckhdSAUNQimXsIccrG7wqwamOpv7skya2MetQlNgX/VYXT/MF15PXWNOylmknRmSdb7oAxHgR+bff4kbS2nag8gN00aGfg3bF85j81nvt7usyfk6sb8uqQtbYFWuXMpCBSxl/XXEtNkOs8yJJ1GuxaOIxsI5ojTJ/Ep/8LKp9UXW68fPc4xz7srLoEIX0J39VWGjW1h2Z/51zokPOlrV9gaz+WO7g9wP3ntthM32vZg== 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=c6EReUW9QYM0vi5N0RYoxOHXOcFSJKmg2fpDWnAvUmE=; b=bhsoYeGFYxHi00VmDSg9/qXWG6kTGlsrQBr7gn5UHOsH4FPk6SEZOxv3aUlm2E8L/777Ek8m9pUlDRM8eMvXiEtgWNIScEd9Ms24kj235uPSRFmpd2D0zKGeSPYcBkunsAxJal6/FZhlXtzRJNsq1NUYNEIuzZSX2UP8NwXve0pExVXM5vh6AyTaQwuOq0UNtCUa5whXTyjYfj+NtKHCEse2fxLlF+HUgN84O4NrQP1rw/hPlfaDZZKXfsNFoCMxerWhjGRV2pOLP9MNM/BlIdI7xOhrvMH7QvhLqbPZPjY42Q6DxMVc/6Kt0WaFo+x2esVoSiVPteQ4SxOUK2eT/w== 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=c6EReUW9QYM0vi5N0RYoxOHXOcFSJKmg2fpDWnAvUmE=; b=pPG0UIKxCP8gXIhTlY1hZOxTMFP8j8NBv+z9VfXZkHnBVQXcnSiX5AtYWk49cgLvlOhOo2wNBCWH3UOxblnqAT+/17liOSktlgb6QUWyIwWJ/FjdDnv0YbsLcYRtS8DIG3qZk0Yd7W2RcOQapIkqEQwWu2DnS/bHM9AAIG0WjOo= Received: from DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) by PH7PR10MB5724.namprd10.prod.outlook.com (2603:10b6:510:125::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Thu, 31 Oct 2024 09:59:35 +0000 Received: from DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088]) by DM6PR10MB4313.namprd10.prod.outlook.com ([fe80::4f45:f4ab:121:e088%5]) with mapi id 15.20.8093.027; Thu, 31 Oct 2024 09:59:35 +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 v3 6/6] md/raid10: Handle bio_split() errors Date: Thu, 31 Oct 2024 09:59:18 +0000 Message-Id: <20241031095918.99964-7-john.g.garry@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20241031095918.99964-1-john.g.garry@oracle.com> References: <20241031095918.99964-1-john.g.garry@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: MN0PR05CA0011.namprd05.prod.outlook.com (2603:10b6:208:52c::17) To DM6PR10MB4313.namprd10.prod.outlook.com (2603:10b6:5:212::20) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR10MB4313:EE_|PH7PR10MB5724:EE_ X-MS-Office365-Filtering-Correlation-Id: 49433b04-9604-423c-e726-08dcf992b9c5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?rVyvoXpM6QMFrDTgAVpBi5wjDeRpgau+XKniEGiZByi5gWTb2FUxAmdxzW1m?= =?us-ascii?Q?trcYytDraZIfPULX+5b3+XzA6mi1kLg1hFl+at/NF7rThANihnRJAXu0CxSV?= =?us-ascii?Q?eu4XhurgomopZ/FGGl95lIooLNoVoAfNHLW+8cQb+GF9jkwFkSveisJvKfWF?= =?us-ascii?Q?qME9fbtrxDcu6uTOk1SfUi/ESpJo3mvdVmGjyCe1BARfG1PrwtWs/Jd9izU2?= =?us-ascii?Q?YXBwLWl2/ZJXT+cYJdp7PUdrkEUma5b9VlvPVyLPfpNg9GydeWqqmzQsIrQR?= =?us-ascii?Q?Q+JzS7B2cZXw1A2CuB/wTVMW8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6IQ1c?= =?us-ascii?Q?ftczxP4IbfYCMj6hR+8W0kkwg+epxHmkhQAT70kx/q9SqK2mVYcMAZqNIhvU?= =?us-ascii?Q?NAF1t6KGrlvRn38x8U+YJiNTd1TrmVCiZ2sTmvzG/GMNmt7Q1NPZs0WufJdR?= =?us-ascii?Q?sLilX7GwF4+gTSWfZb9EgSS7?= 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)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ER5HoOgAjrAau2WSFT+qEMWXYoFNmNVnndZihCUm+6ZJoxNIoXggVp8pgd9y?= =?us-ascii?Q?e2vVFbPecRluh+J43iYg5L/ci2McsaFuc0boPCSzqLE0UoFeoBUIRis8gz6v?= =?us-ascii?Q?nEcqkn9zn00GLDRnCyN2UOub/sjnMmI5M0FyfT26s0x4Exq5FwaX/ScwG/au?= =?us-ascii?Q?H9xpu7ymDyM7hfgD2iIW1RwthcDES5BStvhTZe2235UMFiwpt3/rrJzt6Z/L?= =?us-ascii?Q?UQGj3p1acX89eIv+vOF28S/iCBx6zQ5biHppLsMKTVALNm/fi/jQEB6LgCR2?= =?us-ascii?Q?vsdkfnZDIxCQweeDXUG0Sm1qUCrNd2xW/f34rYgEfskAkWm2I5+bZwcpymVe?= =?us-ascii?Q?qqkY35qkmfaMnTyBfkRosExAm50Zw8RLpYIuXid14/GM9QuE5hvd36HdPq3x?= =?us-ascii?Q?EPZs+cuLiIUYuajfuJFV15uPOJMMj+/ck3YiJk7OzlWw07vQqoceutmRwwek?= =?us-ascii?Q?Dc5RW979kS3Vs7dt/XUULrs5oli2BX9T7ESAxpxHVmtqrpZfa96vjjFgLoRB?= =?us-ascii?Q?63Cg+cjmflIuRxBqgRVcQwZ95+JNcJS40YnaCySKGt+6iF76hbBQComBOZA/?= =?us-ascii?Q?C6WRnww3AmusgYpGST7TDyqPvVctdmbb5bKdF6lQRAPpKxIg12K3Urcw+Q7o?= =?us-ascii?Q?0G6YSgFaOvjtakDnSgY9N+3A7FHxlVkACdD4zvnLxbBHulhh0PiyTTSm18WG?= =?us-ascii?Q?L3lssEI5K2XG7kYRGl5/V9tfha8Vm8MMDBhSTQMZjP9NVcb3FbzpJFX7chUU?= =?us-ascii?Q?vTVvUaxhFUwXaHphBEAKReI6MQcqulZ5ltuaKqp9+jm78363YSzb3sBxOkWr?= =?us-ascii?Q?pulM0j4hddK1mLVZBz0qR6byjD0NFYDDaa/2FoFETYEcnL07OmUkBPqT3E89?= =?us-ascii?Q?vwfRAzR4x5rYezIstRzGVCW+FiuyEf35ofPQ+lUEP/xllzkjes9uY8pBxIB1?= =?us-ascii?Q?ZllZJp84sUykIJ1oZXgKnNazGvBnIqrG7gvQvudDFCBJMP7pg/IPnu5oxD+P?= =?us-ascii?Q?5uBqhs7PRvmfkfkdyqP4402YPDtM4tjf2bihqx5S+hmeziFxDhJNK7QCeNEa?= =?us-ascii?Q?y8XFtxTnaDitPQda0ctIwlgmPp0nM5O4pEIWSlaYk5XDPm169xs21HmPnPt3?= =?us-ascii?Q?fS35XAItR1smJBng/lJLhh666roZWeDzDyUCCvQsdyCIBRwQ+uM9pxNaMiLH?= =?us-ascii?Q?KFnNYH4oFs7UCWoepsghP5RgCiR2C9jocQFxm4lYErRLN028X29puRgcG6m6?= =?us-ascii?Q?MccKijX/AvArtaqCPYpNKGo8vxRX78BltXZUdX6fLQeV1uY1nXVjzJrOJtvm?= =?us-ascii?Q?asq1EzCGf0f54W6S7sDId36DjjDFWN2xKjwzbD39BaT/TFWFgOuA9umJJv6/?= =?us-ascii?Q?Vdx9hdJqdotKi1arD8n5X249y8IHhPZUzkoIx7OE28iuAzbTU/HTiXldQQeT?= =?us-ascii?Q?zIM0F46UybCV1cKBSTqPtybc8gskKU2Malo5Un7jiu0bJhehIG9u7/fPWMuG?= =?us-ascii?Q?X+7J2TjIAAjhayJ/gDjjUUQrP4TNWcq1nUC+f1H+yzc/uAcVI9GJ9Xkm03MY?= =?us-ascii?Q?/+4JWFi+2eIv/5M5IDlnPfRpOzYz2XTQNpLwBA89er8hZkmA8v79QR0T642D?= =?us-ascii?Q?Mg=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Y5tHLmHVGirnAjlXOW8IdGaquhVS4Xk4LTYDZ2XzQX6jFZz6RCHFg+68lJvHNnOB2DrCbYvPon1GZhdgrh3alKdcXzarsprgRZatvaUVOCG1BM3FOhdCTsrDjnKpJ2IgzhXD62wix90+C8OV+C/+H1bml+V53Dqt+M20bk9AcFRgDJWbH2pXhsVkCBui4ZYj9Z/I6MfkPajeAUghAhuAr6P5zPA9jxJag79bm1BcMTwfUXP2yCKGSvLSe/CNgJrpsuUPcx+CEJpCMSzHdrrzY8fCE5FKRUPknLJzo6+CNm2AhKK0WJGI+mU4SPRgoNzCudCqc/UGz1SlSBPOeGIc5Wek3DL9SfjIl9ZcBFs20QzEqder8mbMsZG/nNr1vntOKMsFy9KxEf1p5l/lGyaSndK8bbmtJlINj/c1LeMLQJ9yE4kKoIcdoyc6+/joqi984/Vq56HndTBTfpsDuKL3/53nm99EtgJvFJmP8DzLjmvx8wjKUEKYKJn7fLMDfvd1PR5df3466FdsL0BL7sBtzti5U4O7oj7GS6uZPO7wQ9CEiUq2UqiDq+udT0+xr0XYBuqvotooPmyzmGWYUhnGsCRIwZAIFMDvoqqUxVQOkGk= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 49433b04-9604-423c-e726-08dcf992b9c5 X-MS-Exchange-CrossTenant-AuthSource: DM6PR10MB4313.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 09:59:35.8122 (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: SxCJXCkSAm+FUm50/n3SDiIo6rtvfpkYRJCrV8Q+n9gSMB7XrHNo9Ya5ghWknVYxSvW2YUGgyfvTKQDTZFlQBg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB5724 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-31_01,2024-10-30_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 spamscore=0 phishscore=0 mlxscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410310075 X-Proofpoint-GUID: af5f3xDWuiOii_YXBPZv_vWtYNeEsHbA X-Proofpoint-ORIG-GUID: af5f3xDWuiOii_YXBPZv_vWtYNeEsHbA Content-Type: text/plain; charset="utf-8" Add proper bio_split() error handling. For any error, call raid_end_bio_io() and return. Except for discard, where we end the bio directly. Signed-off-by: John Garry Reviewed-by: Hannes Reinecke Reviewed-by: Yu Kuai --- 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..ccd95459b192 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -1159,6 +1159,7 @@ static void raid10_read_request(struct mddev *mddev, = struct bio *bio, int slot =3D r10_bio->read_slot; struct md_rdev *err_rdev =3D NULL; gfp_t gfp =3D GFP_NOIO; + int error; =20 if (slot >=3D 0 && r10_bio->devs[slot].rdev) { /* @@ -1206,6 +1207,10 @@ static void raid10_read_request(struct mddev *mddev,= struct bio *bio, if (max_sectors < bio_sectors(bio)) { struct bio *split =3D bio_split(bio, max_sectors, gfp, &conf->bio_split); + if (IS_ERR(split)) { + error =3D PTR_ERR(split); + goto err_handle; + } bio_chain(split, bio); allow_barrier(conf); submit_bio_noacct(bio); @@ -1236,6 +1241,11 @@ static void raid10_read_request(struct mddev *mddev,= struct bio *bio, mddev_trace_remap(mddev, read_bio, r10_bio->sector); submit_bio_noacct(read_bio); return; +err_handle: + atomic_dec(&rdev->nr_pending); + bio->bi_status =3D errno_to_blk_status(error); + set_bit(R10BIO_Uptodate, &r10_bio->state); + raid_end_bio_io(r10_bio); } =20 static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_= bio, @@ -1347,9 +1357,10 @@ static void raid10_write_request(struct mddev *mddev= , struct bio *bio, struct r10bio *r10_bio) { struct r10conf *conf =3D mddev->private; - int i; + int i, k; sector_t sectors; int max_sectors; + int error; =20 if ((mddev_is_clustered(mddev) && md_cluster_ops->area_resyncing(mddev, WRITE, @@ -1482,6 +1493,10 @@ static void raid10_write_request(struct mddev *mddev= , struct bio *bio, if (r10_bio->sectors < bio_sectors(bio)) { struct bio *split =3D bio_split(bio, r10_bio->sectors, GFP_NOIO, &conf->bio_split); + if (IS_ERR(split)) { + error =3D PTR_ERR(split); + goto err_handle; + } bio_chain(split, bio); allow_barrier(conf); submit_bio_noacct(bio); @@ -1503,6 +1518,26 @@ static void raid10_write_request(struct mddev *mddev= , struct bio *bio, raid10_write_one_disk(mddev, r10_bio, bio, true, i); } one_write_done(r10_bio); + return; +err_handle: + for (k =3D 0; k < i; k++) { + int d =3D r10_bio->devs[k].devnum; + struct md_rdev *rdev =3D conf->mirrors[d].rdev; + struct md_rdev *rrdev =3D conf->mirrors[d].replacement; + + if (r10_bio->devs[k].bio) { + rdev_dec_pending(rdev, mddev); + r10_bio->devs[k].bio =3D NULL; + } + if (r10_bio->devs[k].repl_bio) { + rdev_dec_pending(rrdev, mddev); + r10_bio->devs[k].repl_bio =3D NULL; + } + } + + bio->bi_status =3D errno_to_blk_status(error); + set_bit(R10BIO_Uptodate, &r10_bio->state); + raid_end_bio_io(r10_bio); } =20 static void __make_request(struct mddev *mddev, struct bio *bio, int secto= rs) @@ -1644,6 +1679,11 @@ static int raid10_handle_discard(struct mddev *mddev= , struct bio *bio) if (remainder) { split_size =3D stripe_size - remainder; split =3D bio_split(bio, split_size, GFP_NOIO, &conf->bio_split); + if (IS_ERR(split)) { + bio->bi_status =3D errno_to_blk_status(PTR_ERR(split)); + bio_endio(bio); + return 0; + } bio_chain(split, bio); allow_barrier(conf); /* Resend the fist split part */ @@ -1654,6 +1694,11 @@ static int raid10_handle_discard(struct mddev *mddev= , struct bio *bio) if (remainder) { split_size =3D bio_sectors(bio) - remainder; split =3D bio_split(bio, split_size, GFP_NOIO, &conf->bio_split); + if (IS_ERR(split)) { + bio->bi_status =3D errno_to_blk_status(PTR_ERR(split)); + bio_endio(bio); + return 0; + } bio_chain(split, bio); allow_barrier(conf); /* Resend the second split part */ --=20 2.31.1