From: John Garry Date: Mon, 11 Nov 2024 11:21:46 +0000 (+0000) Subject: block: Error an attempt to split an atomic write in bio_split() X-Git-Tag: v6.13-rc1~211^2~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=27b26f09a7e6ae3ecae460299349b31fe0b5452f;p=thirdparty%2Fkernel%2Flinux.git block: Error an attempt to split an atomic write in bio_split() This is disallowed. Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Reviewed-by: Hannes Reinecke Signed-off-by: John Garry Link: https://lore.kernel.org/r/20241111112150.3756529-3-john.g.garry@oracle.com Signed-off-by: Jens Axboe --- diff --git a/block/bio.c b/block/bio.c index 948b22825510b..699a78c85c756 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1674,6 +1674,10 @@ struct bio *bio_split(struct bio *bio, int sectors, if (WARN_ON_ONCE(bio_op(bio) == 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);