hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/block/blk-core.c
....@@ -420,8 +420,6 @@
420420 blk_mq_sched_free_requests(q);
421421 mutex_unlock(&q->sysfs_lock);
422422
423
- percpu_ref_exit(&q->q_usage_counter);
424
-
425423 /* @q is and will stay empty, shutdown and put */
426424 blk_put_queue(q);
427425 }
....@@ -706,9 +704,7 @@
706704
707705 if (op_is_flush(bio->bi_opf) && !bio_sectors(bio))
708706 return false;
709
-
710
- WARN_ONCE(1,
711
- "Trying to write to read-only block-device %s (partno %d)\n",
707
+ pr_warn("Trying to write to read-only block-device %s (partno %d)\n",
712708 bio_devname(bio, b), part->partno);
713709 /* Older lvm-tools actually trigger this */
714710 return false;
....@@ -1452,6 +1448,13 @@
14521448 req->q->integrity.profile->complete_fn(req, nr_bytes);
14531449 #endif
14541450
1451
+ /*
1452
+ * Upper layers may call blk_crypto_evict_key() anytime after the last
1453
+ * bio_endio(). Therefore, the keyslot must be released before that.
1454
+ */
1455
+ if (blk_crypto_rq_has_keyslot(req) && nr_bytes >= blk_rq_bytes(req))
1456
+ __blk_crypto_rq_put_keyslot(req);
1457
+
14551458 if (unlikely(error && !blk_rq_is_passthrough(req) &&
14561459 !(req->rq_flags & RQF_QUIET)))
14571460 print_req_error(req, error, __func__);