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>
This commit is contained in:
parent
6a7e17b220
commit
554b22864c
1 changed files with 4 additions and 0 deletions
|
@ -1610,6 +1610,10 @@ EXPORT_SYMBOL(bio_split);
|
|||
*/
|
||||
void bio_trim(struct bio *bio, sector_t offset, sector_t size)
|
||||
{
|
||||
/* We should never trim an atomic write */
|
||||
if (WARN_ON_ONCE(bio->bi_opf & REQ_ATOMIC && size))
|
||||
return;
|
||||
|
||||
if (WARN_ON_ONCE(offset > BIO_MAX_SECTORS || size > BIO_MAX_SECTORS ||
|
||||
offset + size > bio_sectors(bio)))
|
||||
return;
|
||||
|
|
Loading…
Add table
Reference in a new issue