hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/md/dm-verity-target.c
....@@ -482,7 +482,7 @@
482482 sector_t cur_block = io->block + b;
483483 struct ahash_request *req = verity_io_hash_req(v, io);
484484
485
- if (v->validated_blocks &&
485
+ if (v->validated_blocks && bio->bi_status == BLK_STS_OK &&
486486 likely(test_bit(cur_block, v->validated_blocks))) {
487487 verity_bv_skip_block(v, io, &io->iter);
488488 continue;
....@@ -538,7 +538,7 @@
538538 return -EIO;
539539 }
540540 if (verity_handle_err(v, DM_VERITY_BLOCK_TYPE_DATA,
541
- cur_block))
541
+ cur_block))
542542 return -EIO;
543543 }
544544 }
....@@ -1219,8 +1219,16 @@
12191219 goto bad;
12201220 }
12211221
1222
- /* WQ_UNBOUND greatly improves performance when running on ramdisk */
1223
- v->verify_wq = alloc_workqueue("kverityd", WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM | WQ_UNBOUND, num_online_cpus());
1222
+ /*
1223
+ * Using WQ_HIGHPRI improves throughput and completion latency by
1224
+ * reducing wait times when reading from a dm-verity device.
1225
+ *
1226
+ * Also as required for the "try_verify_in_tasklet" feature: WQ_HIGHPRI
1227
+ * allows verify_wq to preempt softirq since verification in tasklet
1228
+ * will fall-back to using it for error handling (or if the bufio cache
1229
+ * doesn't have required hashes).
1230
+ */
1231
+ v->verify_wq = alloc_workqueue("kverityd", WQ_MEM_RECLAIM | WQ_HIGHPRI, 0);
12241232 if (!v->verify_wq) {
12251233 ti->error = "Cannot allocate workqueue";
12261234 r = -ENOMEM;