Skip to contentSkip to conversation

dm-verity: pass correct bytes to verity_use_bh

PATCH In review LongPing Wei 2 participants 2 messages Mar 28, 2025 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm-verity: pass correct bytes to verity_use_bh

bi_size is always 0 here since the iterator was already advanced.

Fixes 8cf3ae875ee4 ("dm-verity: support block number limits for different ioprio classes")
---
 drivers/md/dm-verity-target.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/dm-verity-target.c +2 -1
index 2ed10b4c63c5..40448a8c74b1 100644
@@ -689,6 +689,7 @@ static void verity_end_io(struct bio *bio)
 {
 	struct dm_verity_io *io = bio->bi_private;
 	unsigned short ioprio = IOPRIO_PRIO_CLASS(bio->bi_ioprio);
+	unsigned int bytes = io->n_blocks << io->v->data_dev_block_bits;
 
 	if (bio->bi_status &&
 	    (!verity_fec_is_enabled(io->v) ||
@@ -699,7 +700,7 @@ static void verity_end_io(struct bio *bio)
 	}
 
 	if (static_branch_unlikely(&use_bh_wq_enabled) && io->v->use_bh_wq &&
-		verity_use_bh(bio->bi_iter.bi_size, ioprio)) {
+		verity_use_bh(bytes, ioprio)) {
 		if (in_hardirq() || irqs_disabled()) {
 			INIT_WORK(&io->bh_work, verity_bh_work);
 			queue_work(system_bh_wq, &io->bh_work);
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 31 lines · LongPing Wei

bi_size is always 0 here since the iterator was already advanced.

Fixes 8cf3ae875ee4 ("dm-verity: support block number limits for different ioprio classes")
---
 drivers/md/dm-verity-target.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/dm-verity-target.c +2 -1
index 2ed10b4c63c5..40448a8c74b1 100644
@@ -689,6 +689,7 @@ static void verity_end_io(struct bio *bio)
 {
 	struct dm_verity_io *io = bio->bi_private;
 	unsigned short ioprio = IOPRIO_PRIO_CLASS(bio->bi_ioprio);
+	unsigned int bytes = io->n_blocks << io->v->data_dev_block_bits;
 
 	if (bio->bi_status &&
 	    (!verity_fec_is_enabled(io->v) ||
@@ -699,7 +700,7 @@ static void verity_end_io(struct bio *bio)
 	}
 
 	if (static_branch_unlikely(&use_bh_wq_enabled) && io->v->use_bh_wq &&
-		verity_use_bh(bio->bi_iter.bi_size, ioprio)) {
+		verity_use_bh(bytes, ioprio)) {
 		if (in_hardirq() || irqs_disabled()) {
 			INIT_WORK(&io->bh_work, verity_bh_work);
 			queue_work(system_bh_wq, &io->bh_work);
Signature · 1 line
2.34.1

OK, I merged both patches into the existing patch.

Mikulas