From 334727990d8ea6c3942da5db2476d512caabf780 Mon Sep 17 00:00:00 2001 From: John Garry Date: Thu, 31 Oct 2024 09:59:14 +0000 Subject: [PATCH] block: Error an attempt to split an atomic write in bio_split() This is disallowed. Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Signed-off-by: John Garry Reviewed-by: Hannes Reinecke Link: https://lore.kernel.org/r/20241031095918.99964-3-john.g.garry@oracle.com Signed-off-by: Jens Axboe --- block/bio.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/bio.c b/block/bio.c index 584cec38aacc..e41585d049a8 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); -- 2.25.1