From: John Garry Date: Thu, 31 Oct 2024 09:59:14 +0000 (+0000) Subject: block: Error an attempt to split an atomic write in bio_split() X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=refs%2Fheads%2Ffor-6.13%2Fblock-atomic;p=linux-2.6-block.git 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 --- 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);