[dm-devel] Regression: wrong DIO alignment check with dm-crypt
Dmitrii Tcvetkov
me at demsh.org
Wed Nov 2 17:03:45 UTC 2022
On Wed, 2 Nov 2022 10:14:52 -0600
Keith Busch <kbusch at kernel.org> wrote:
> This is what I'm coming up with. Only compile tested (still setting up
> an enviroment to actually run it).
>
> ---
> diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
> index 159c6806c19b..9334e58a4c9f 100644
> --- a/drivers/md/dm-crypt.c
> +++ b/drivers/md/dm-crypt.c
> @@ -43,6 +43,7 @@
> #include <linux/device-mapper.h>
>
> #include "dm-audit.h"
> +#include "dm-core.h"
>
> #define DM_MSG_PREFIX "crypt"
>
> @@ -3615,7 +3616,9 @@ static int crypt_iterate_devices(struct
> dm_target *ti,
> static void crypt_io_hints(struct dm_target *ti, struct queue_limits
> *limits) {
> + struct mapped_device *md = dm_table_get_md(ti->table);
> struct crypt_config *cc = ti->private;
> + struct request_queue *q = md->queue;
>
> /*
> * Unfortunate constraint that is required to avoid the
> potential @@ -3630,6 +3633,8 @@ static void crypt_io_hints(struct
> dm_target *ti, struct queue_limits *limits)
> limits->physical_block_size = max_t(unsigned,
> limits->physical_block_size, cc->sector_size); limits->io_min =
> max_t(unsigned, limits->io_min, cc->sector_size); +
> + blk_queue_dma_alignment(q, limits->logical_block_size - 1);
> }
>
> static struct target_type crypt_target = {
> --
Applied on top 6.1-rc3, the issue still reproduces.
More information about the dm-devel
mailing list