Pull block fixes from Jens Axboe: - NVMe pull request via Keith: - iostats accounting fixed on multipath retries (Amit) - secure concatenation response fixup (Martin) - tls partial record fixup (Wilfred) - Fix for a lockdep reported issue with the elevator lock and blk group frozen operations - Fix for a regression in this merge window, where updating 'nr_requests' would not do the right thing for queues with shared tags * tag 'block-6.18-20251016' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux: nvme/tcp: handle tls partially sent records in write_space() block: Remove elevator_lock usage from blkg_conf frozen operations blk-mq: fix stale tag depth for shared sched tags in blk_mq_update_nr_requests() nvme-auth: update sc_c in host response nvme-multipath: Skip nr_active increments in RETRY disposition
Unified · Split
| @@ -812,8 +812,7 @@ int blkg_conf_open_bdev(struct blkg_conf_ctx *ctx) · 811 unmodified lines | |||
| 812 | } | 812 | } |
| 813 | /* | 813 | /* |
| 814 | * Similar to blkg_conf_open_bdev, but additionally freezes the queue, | 814 | * Similar to blkg_conf_open_bdev, but additionally freezes the queue, |
| 815 | * acquires q->elevator_lock, and ensures the correct locking order | 815 | * ensures the correct locking order between freeze queue and q->rq_qos_mutex. |
| 816 | * between q->elevator_lock and q->rq_qos_mutex. | ||
| 817 | * | 816 | * |
| 818 | * This function returns negative error on failure. On success it returns | 817 | * This function returns negative error on failure. On success it returns |
| 819 | * memflags which must be saved and later passed to blkg_conf_exit_frozen | 818 | * memflags which must be saved and later passed to blkg_conf_exit_frozen |
| @@ -834,13 +833,11 @@ unsigned long __must_check blkg_conf_open_bdev_frozen(struct blkg_conf_ctx *ctx) · 14 unmodified lines | |||
| 834 | * At this point, we haven’t started protecting anything related to QoS, | 833 | * At this point, we haven’t started protecting anything related to QoS, |
| 835 | * so we release q->rq_qos_mutex here, which was first acquired in blkg_ | 834 | * so we release q->rq_qos_mutex here, which was first acquired in blkg_ |
| 836 | * conf_open_bdev. Later, we re-acquire q->rq_qos_mutex after freezing | 835 | * conf_open_bdev. Later, we re-acquire q->rq_qos_mutex after freezing |
| 837 | * the queue and acquiring q->elevator_lock to maintain the correct | 836 | * the queue to maintain the correct locking order. |
| 838 | * locking order. | ||
| 839 | */ | 837 | */ |
| 840 | mutex_unlock(&ctx->bdev->bd_queue->rq_qos_mutex); | 838 | mutex_unlock(&ctx->bdev->bd_queue->rq_qos_mutex); |
| 841 | 839 | ||
| 842 | memflags = blk_mq_freeze_queue(ctx->bdev->bd_queue); | 840 | memflags = blk_mq_freeze_queue(ctx->bdev->bd_queue); |
| 843 | mutex_lock(&ctx->bdev->bd_queue->elevator_lock); | ||
| 844 | mutex_lock(&ctx->bdev->bd_queue->rq_qos_mutex); | 841 | mutex_lock(&ctx->bdev->bd_queue->rq_qos_mutex); |
| 845 | 842 | ||
| 846 | return memflags; | 843 | return memflags; |
| @@ -995,9 +992,8 @@ void blkg_conf_exit(struct blkg_conf_ctx *ctx) · 148 unmodified lines | |||
| 995 | EXPORT_SYMBOL_GPL(blkg_conf_exit); | 992 | EXPORT_SYMBOL_GPL(blkg_conf_exit); |
| 996 | 993 | ||
| 997 | /* | 994 | /* |
| 998 | * Similar to blkg_conf_exit, but also unfreezes the queue and releases | 995 | * Similar to blkg_conf_exit, but also unfreezes the queue. Should be used |
| 999 | * q->elevator_lock. Should be used when blkg_conf_open_bdev_frozen | 996 | * when blkg_conf_open_bdev_frozen is used to open the bdev. |
| 1000 | * is used to open the bdev. | ||
| 1001 | */ | 997 | */ |
| 1002 | void blkg_conf_exit_frozen(struct blkg_conf_ctx *ctx, unsigned long memflags) | 998 | void blkg_conf_exit_frozen(struct blkg_conf_ctx *ctx, unsigned long memflags) |
| 1003 | { | 999 | { |
| @@ -1005,7 +1001,6 @@ void blkg_conf_exit_frozen(struct blkg_conf_ctx *ctx, unsigned long memflags) · 1 unmodified line | |||
| 1005 | struct request_queue *q = ctx->bdev->bd_queue; | 1001 | struct request_queue *q = ctx->bdev->bd_queue; |
| 1006 | 1002 | ||
| 1007 | blkg_conf_exit(ctx); | 1003 | blkg_conf_exit(ctx); |
| 1008 | mutex_unlock(&q->elevator_lock); | ||
| 1009 | blk_mq_unfreeze_queue(q, memflags); | 1004 | blk_mq_unfreeze_queue(q, memflags); |
| 1010 | } | 1005 | } |
| 1011 | } | 1006 | } |
| @@ -557,7 +557,7 @@ int blk_mq_init_sched(struct request_queue *q, struct elevator_type *e, · 556 unmodified lines | |||
| 557 | if (blk_mq_is_shared_tags(flags)) { | 557 | if (blk_mq_is_shared_tags(flags)) { |
| 558 | /* Shared tags are stored at index 0 in @et->tags. */ | 558 | /* Shared tags are stored at index 0 in @et->tags. */ |
| 559 | q->sched_shared_tags = et->tags[0]; | 559 | q->sched_shared_tags = et->tags[0]; |
| 560 | blk_mq_tag_update_sched_shared_tags(q); | 560 | blk_mq_tag_update_sched_shared_tags(q, et->nr_requests); |
| 561 | } | 561 | } |
| 562 | 562 | ||
| 563 | queue_for_each_hw_ctx(q, hctx, i) { | 563 | queue_for_each_hw_ctx(q, hctx, i) { |
| @@ -622,10 +622,11 @@ void blk_mq_tag_resize_shared_tags(struct blk_mq_tag_set *set, unsigned int size · 621 unmodified lines | |||
| 622 | sbitmap_queue_resize(&tags->bitmap_tags, size - set->reserved_tags); | 622 | sbitmap_queue_resize(&tags->bitmap_tags, size - set->reserved_tags); |
| 623 | } | 623 | } |
| 624 | 624 | ||
| 625 | void blk_mq_tag_update_sched_shared_tags(struct request_queue *q) | 625 | void blk_mq_tag_update_sched_shared_tags(struct request_queue *q, |
| 626 | unsigned int nr) | ||
| 626 | { | 627 | { |
| 627 | sbitmap_queue_resize(&q->sched_shared_tags->bitmap_tags, | 628 | sbitmap_queue_resize(&q->sched_shared_tags->bitmap_tags, |
| 628 | q->nr_requests - q->tag_set->reserved_tags); | 629 | nr - q->tag_set->reserved_tags); |
| 629 | } | 630 | } |
| 630 | 631 | ||
| 631 | /** | 632 | /** |
| @@ -4941,7 +4941,7 @@ struct elevator_tags *blk_mq_update_nr_requests(struct request_queue *q, · 4940 unmodified lines | |||
| 4941 | * tags can't grow, see blk_mq_alloc_sched_tags(). | 4941 | * tags can't grow, see blk_mq_alloc_sched_tags(). |
| 4942 | */ | 4942 | */ |
| 4943 | if (q->elevator) | 4943 | if (q->elevator) |
| 4944 | blk_mq_tag_update_sched_shared_tags(q); | 4944 | blk_mq_tag_update_sched_shared_tags(q, nr); |
| 4945 | else | 4945 | else |
| 4946 | blk_mq_tag_resize_shared_tags(set, nr); | 4946 | blk_mq_tag_resize_shared_tags(set, nr); |
| 4947 | } else if (!q->elevator) { | 4947 | } else if (!q->elevator) { |
| @@ -186,7 +186,8 @@ void blk_mq_put_tag(struct blk_mq_tags *tags, struct blk_mq_ctx *ctx, · 185 unmodified lines | |||
| 186 | void blk_mq_put_tags(struct blk_mq_tags *tags, int *tag_array, int nr_tags); | 186 | void blk_mq_put_tags(struct blk_mq_tags *tags, int *tag_array, int nr_tags); |
| 187 | void blk_mq_tag_resize_shared_tags(struct blk_mq_tag_set *set, | 187 | void blk_mq_tag_resize_shared_tags(struct blk_mq_tag_set *set, |
| 188 | unsigned int size); | 188 | unsigned int size); |
| 189 | void blk_mq_tag_update_sched_shared_tags(struct request_queue *q); | 189 | void blk_mq_tag_update_sched_shared_tags(struct request_queue *q, |
| 190 | unsigned int nr); | ||
| 190 | 191 | ||
| 191 | void blk_mq_tag_wakeup_all(struct blk_mq_tags *tags, bool); | 192 | void blk_mq_tag_wakeup_all(struct blk_mq_tags *tags, bool); |
| 192 | void blk_mq_queue_tag_busy_iter(struct request_queue *q, busy_tag_iter_fn *fn, | 193 | void blk_mq_queue_tag_busy_iter(struct request_queue *q, busy_tag_iter_fn *fn, |
| @@ -36,6 +36,7 @@ struct nvme_dhchap_queue_context { · 35 unmodified lines | |||
| 36 | u8 status; | 36 | u8 status; |
| 37 | u8 dhgroup_id; | 37 | u8 dhgroup_id; |
| 38 | u8 hash_id; | 38 | u8 hash_id; |
| 39 | u8 sc_c; | ||
| 39 | size_t hash_len; | 40 | size_t hash_len; |
| 40 | u8 c1[64]; | 41 | u8 c1[64]; |
| 41 | u8 c2[64]; | 42 | u8 c2[64]; |
| @@ -154,6 +155,8 @@ static int nvme_auth_set_dhchap_negotiate_data(struct nvme_ctrl *ctrl, · 112 unmodified lines | |||
| 154 | data->auth_protocol[0].dhchap.idlist[34] = NVME_AUTH_DHGROUP_6144; | 155 | data->auth_protocol[0].dhchap.idlist[34] = NVME_AUTH_DHGROUP_6144; |
| 155 | data->auth_protocol[0].dhchap.idlist[35] = NVME_AUTH_DHGROUP_8192; | 156 | data->auth_protocol[0].dhchap.idlist[35] = NVME_AUTH_DHGROUP_8192; |
| 156 | 157 | ||
| 158 | chap->sc_c = data->sc_c; | ||
| 159 | |||
| 157 | return size; | 160 | return size; |
| 158 | } | 161 | } |
| 159 | 162 | ||
| @@ -489,7 +492,7 @@ static int nvme_auth_dhchap_setup_host_response(struct nvme_ctrl *ctrl, · 329 unmodified lines | |||
| 489 | ret = crypto_shash_update(shash, buf, 2); | 492 | ret = crypto_shash_update(shash, buf, 2); |
| 490 | if (ret) | 493 | if (ret) |
| 491 | goto out; | 494 | goto out; |
| 492 | memset(buf, 0, sizeof(buf)); | 495 | *buf = chap->sc_c; |
| 493 | ret = crypto_shash_update(shash, buf, 1); | 496 | ret = crypto_shash_update(shash, buf, 1); |
| 494 | if (ret) | 497 | if (ret) |
| 495 | goto out; | 498 | goto out; |
| @@ -500,6 +503,7 @@ static int nvme_auth_dhchap_setup_host_response(struct nvme_ctrl *ctrl, · 4 unmodified lines | |||
| 500 | strlen(ctrl->opts->host->nqn)); | 503 | strlen(ctrl->opts->host->nqn)); |
| 501 | if (ret) | 504 | if (ret) |
| 502 | goto out; | 505 | goto out; |
| 506 | memset(buf, 0, sizeof(buf)); | ||
| 503 | ret = crypto_shash_update(shash, buf, 1); | 507 | ret = crypto_shash_update(shash, buf, 1); |
| 504 | if (ret) | 508 | if (ret) |
| 505 | goto out; | 509 | goto out; |
| @@ -182,12 +182,14 @@ void nvme_mpath_start_request(struct request *rq) · 181 unmodified lines | |||
| 182 | struct nvme_ns *ns = rq->q->queuedata; | 182 | struct nvme_ns *ns = rq->q->queuedata; |
| 183 | struct gendisk *disk = ns->head->disk; | 183 | struct gendisk *disk = ns->head->disk; |
| 184 | 184 | ||
| 185 | if (READ_ONCE(ns->head->subsys->iopolicy) == NVME_IOPOLICY_QD) { | 185 | if ((READ_ONCE(ns->head->subsys->iopolicy) == NVME_IOPOLICY_QD) && |
| 186 | !(nvme_req(rq)->flags & NVME_MPATH_CNT_ACTIVE)) { | ||
| 186 | atomic_inc(&ns->ctrl->nr_active); | 187 | atomic_inc(&ns->ctrl->nr_active); |
| 187 | nvme_req(rq)->flags |= NVME_MPATH_CNT_ACTIVE; | 188 | nvme_req(rq)->flags |= NVME_MPATH_CNT_ACTIVE; |
| 188 | } | 189 | } |
| 189 | 190 | ||
| 190 | if (!blk_queue_io_stat(disk->queue) || blk_rq_is_passthrough(rq)) | 191 | if (!blk_queue_io_stat(disk->queue) || blk_rq_is_passthrough(rq) || |
| 192 | (nvme_req(rq)->flags & NVME_MPATH_IO_STATS)) | ||
| 191 | return; | 193 | return; |
| 192 | 194 | ||
| 193 | nvme_req(rq)->flags |= NVME_MPATH_IO_STATS; | 195 | nvme_req(rq)->flags |= NVME_MPATH_IO_STATS; |
| @@ -1081,6 +1081,9 @@ static void nvme_tcp_write_space(struct sock *sk) · 1080 unmodified lines | |||
| 1081 | queue = sk->sk_user_data; | 1081 | queue = sk->sk_user_data; |
| 1082 | if (likely(queue && sk_stream_is_writeable(sk))) { | 1082 | if (likely(queue && sk_stream_is_writeable(sk))) { |
| 1083 | clear_bit(SOCK_NOSPACE, &sk->sk_socket->flags); | 1083 | clear_bit(SOCK_NOSPACE, &sk->sk_socket->flags); |
| 1084 | /* Ensure pending TLS partial records are retried */ | ||
| 1085 | if (nvme_tcp_queue_tls(queue)) | ||
| 1086 | queue->write_space(sk); | ||
| 1084 | queue_work_on(queue->io_cpu, nvme_tcp_wq, &queue->io_work); | 1087 | queue_work_on(queue->io_cpu, nvme_tcp_wq, &queue->io_work); |
| 1085 | } | 1088 | } |
| 1086 | read_unlock_bh(&sk->sk_callback_lock); | 1089 | read_unlock_bh(&sk->sk_callback_lock); |