Skip to content

Commit 75ae193

Browse files
Mikulas Patockasnitm
authored andcommitted
dm: revert 8f50e35 ("dm: limit the max bio size as BIO_MAX_PAGES * PAGE_SIZE")
The limit was already incorporated to dm-crypt with commit 4e870e9 ("dm crypt: fix error with too large bios"), so we don't need to apply it globally to all targets. The quantity BIO_MAX_PAGES * PAGE_SIZE is wrong anyway because the variable ti->max_io_len it is supposed to be in the units of 512-byte sectors not in bytes. Reduction of the limit to 1048576 sectors could even cause data corruption in rare cases - suppose that we have a dm-striped device with stripe size 768MiB. The target will call dm_set_target_max_io_len with the value 1572864. The buggy code would reduce it to 1048576. Now, the dm-core will errorneously split the bios on 1048576-sector boundary insetad of 1572864-sector boundary and pass these stripe-crossing bios to the striped target. Cc: stable@vger.kernel.org # v4.16+ Fixes: 8f50e35 ("dm: limit the max bio size as BIO_MAX_PAGES * PAGE_SIZE") Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Acked-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
1 parent 93fc916 commit 75ae193

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

drivers/md/dm.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,15 +1042,7 @@ int dm_set_target_max_io_len(struct dm_target *ti, sector_t len)
10421042
return -EINVAL;
10431043
}
10441044

1045-
/*
1046-
* BIO based queue uses its own splitting. When multipage bvecs
1047-
* is switched on, size of the incoming bio may be too big to
1048-
* be handled in some targets, such as crypt.
1049-
*
1050-
* When these targets are ready for the big bio, we can remove
1051-
* the limit.
1052-
*/
1053-
ti->max_io_len = min_t(uint32_t, len, BIO_MAX_PAGES * PAGE_SIZE);
1045+
ti->max_io_len = (uint32_t) len;
10541046

10551047
return 0;
10561048
}

0 commit comments

Comments
 (0)