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 <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> Link: https://lore.kernel.org/r/20241111112150.3756529-3-john.g.garry@oracle.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent e546fe1 commit 27b26f0

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

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)