From: Hongyu Jin <[email protected]>

Since dm-crypt queues writes to a different kernel thread (workqueue),
the bios will dispatch from tasks with different io_context->ioprio
settings and blkcg than the submitting task, thus giving incorrect
ioprio to the io scheduler.

Get the original IO priority setting via struct dm_crypt_io::base_bio
and set this priority in the bio for write.

Link: 
https://lore.kernel.org/dm-devel/[email protected]

Signed-off-by: Hongyu Jin <[email protected]>
Reviewed-by: Eric Biggers <[email protected]>
Reviewed-by: Mikulas Patocka <[email protected]>
Signed-off-by: Mike Snitzer <[email protected]>
---
 drivers/md/dm-crypt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index ab1e30630e64..2b4671d15201 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -1683,6 +1683,7 @@ static struct bio *crypt_alloc_buffer(struct dm_crypt_io 
*io, unsigned int size)
                                 GFP_NOIO, &cc->bs);
        clone->bi_private = io;
        clone->bi_end_io = crypt_endio;
+       clone->bi_ioprio = io->base_bio->bi_ioprio;
 
        remaining_size = size;
 
-- 
2.40.0


Reply via email to