Skip to content

Commit 27b26f0

Browse files
johnpgarryaxboe
authored andcommitted
block: Error an attempt to split an atomic write in bio_split()
This is disallowed. Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: John Garry <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent e546fe1 commit 27b26f0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

block/bio.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,6 +1674,10 @@ struct bio *bio_split(struct bio *bio, int sectors,
16741674
if (WARN_ON_ONCE(bio_op(bio) == REQ_OP_ZONE_APPEND))
16751675
return ERR_PTR(-EINVAL);
16761676

1677+
/* atomic writes cannot be split */
1678+
if (bio->bi_opf & REQ_ATOMIC)
1679+
return ERR_PTR(-EINVAL);
1680+
16771681
split = bio_alloc_clone(bio->bi_bdev, bio, gfp, bs);
16781682
if (!split)
16791683
return ERR_PTR(-ENOMEM);

0 commit comments

Comments
 (0)