diff mbox series

[v4,2/6] block: Error an attempt to split an atomic write in bio_split()

Message ID 20241111112150.3756529-3-john.g.garry@oracle.com (mailing list archive)
State Handled Elsewhere
Headers show
Series bio_split() error handling rework | expand

Checks

Context Check Description
mdraidci/vmtest-md-6_13-PR success PR summary
mdraidci/vmtest-md-6_13-VM_Test-0 success Logs for per-patch-testing

Commit Message

John Garry Nov. 11, 2024, 11:21 a.m. UTC
This is disallowed.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: John Garry <john.g.garry@oracle.com>
---
 block/bio.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/block/bio.c b/block/bio.c
index 948b22825510..699a78c85c75 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);