Skip to content

Commit 5f430e3

Browse files
johnpgarryMikulas Patocka
authored andcommitted
dm: Ensure cloned bio is same length for atomic write
For an atomic write, a cloned bio must be same length as the original bio, i.e. no splitting. Error in case it is not. Per-dm device queue limits should be setup to ensure that this does not happen, but error this case as an insurance policy. Signed-off-by: John Garry <[email protected]> Reviewed-by: Mike Snitzer <[email protected]> Signed-off-by: Mikulas Patocka <[email protected]>
1 parent 3194e36 commit 5f430e3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/md/dm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,6 +1745,9 @@ static blk_status_t __split_and_process_bio(struct clone_info *ci)
17451745
ci->submit_as_polled = !!(ci->bio->bi_opf & REQ_POLLED);
17461746

17471747
len = min_t(sector_t, max_io_len(ti, ci->sector), ci->sector_count);
1748+
if (ci->bio->bi_opf & REQ_ATOMIC && len != ci->sector_count)
1749+
return BLK_STS_IOERR;
1750+
17481751
setup_split_accounting(ci, len);
17491752

17501753
if (unlikely(ci->bio->bi_opf & REQ_NOWAIT)) {

0 commit comments

Comments
 (0)