Skip to content

Commit 554b228

Browse files
johnpgarryaxboe
authored andcommitted
block: Don't trim an atomic write
This is disallowed. This check will now be relevant since the device mapper personalities will start to support atomic writes, and they use this function. Signed-off-by: John Garry <john.g.garry@oracle.com> Reviewed-by: Mike Snitzer <snitzer@kernel.org> Link: https://lore.kernel.org/r/20250116170301.474130-3-john.g.garry@oracle.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 6a7e17b commit 554b228

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
@@ -1610,6 +1610,10 @@ EXPORT_SYMBOL(bio_split);
16101610
*/
16111611
void bio_trim(struct bio *bio, sector_t offset, sector_t size)
16121612
{
1613+
/* We should never trim an atomic write */
1614+
if (WARN_ON_ONCE(bio->bi_opf & REQ_ATOMIC && size))
1615+
return;
1616+
16131617
if (WARN_ON_ONCE(offset > BIO_MAX_SECTORS || size > BIO_MAX_SECTORS ||
16141618
offset + size > bio_sectors(bio)))
16151619
return;

0 commit comments

Comments
 (0)