[PATCH RFC 2/6] block: Error an attempt to split an atomic write in bio_split()
From: John Garry
Date: Thu Sep 19 2024 - 05:24:59 EST
This is disallowed.
Signed-off-by: John Garry <john.g.garry@xxxxxxxxxx>
---
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);
--
2.31.1