All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dm: revert 8f50e358153d ("dm: limit the max bio size as BIO_MAX_PAGES * PAGE_SIZE")
@ 2019-03-21 20:46 Mikulas Patocka
  0 siblings, 0 replies; only message in thread
From: Mikulas Patocka @ 2019-03-21 20:46 UTC (permalink / raw)
  To: Mike Snitzer, Ming Lei, dm-devel; +Cc: Jens Axboe, Alasdair Kergon

The limit was already incorporated to dm-crypt (4e870e948fba - "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.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org	# v4.16+
Fixes: 8f50e358153d ("dm: limit the max bio size as BIO_MAX_PAGES * PAGE_SIZE")

---
 drivers/md/dm.c |   10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

Index: linux-2.6/drivers/md/dm.c
===================================================================
--- linux-2.6.orig/drivers/md/dm.c	2019-03-18 10:28:50.000000000 +0100
+++ linux-2.6/drivers/md/dm.c	2019-03-21 19:49:23.000000000 +0100
@@ -1042,15 +1042,7 @@ int dm_set_target_max_io_len(struct dm_t
 		return -EINVAL;
 	}
 
-	/*
-	 * BIO based queue uses its own splitting. When multipage bvecs
-	 * is switched on, size of the incoming bio may be too big to
-	 * be handled in some targets, such as crypt.
-	 *
-	 * When these targets are ready for the big bio, we can remove
-	 * the limit.
-	 */
-	ti->max_io_len = min_t(uint32_t, len, BIO_MAX_PAGES * PAGE_SIZE);
+	ti->max_io_len = (uint32_t) len;
 
 	return 0;
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-03-21 20:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-21 20:46 [PATCH] dm: revert 8f50e358153d ("dm: limit the max bio size as BIO_MAX_PAGES * PAGE_SIZE") Mikulas Patocka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.