Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'block-6.9-20240503' of git://git.kernel.dk/linux

Pull block fixes from Jens Axboe:
"Nothing major in here - an nvme pull request with mostly auth/tcp
fixes, and a single fix for ublk not setting segment count and size
limits"

* tag 'block-6.9-20240503' of git://git.kernel.dk/linux:
nvme-tcp: strict pdu pacing to avoid send stalls on TLS
nvmet: fix nvme status code when namespace is disabled
nvmet-tcp: fix possible memory leak when tearing down a controller
nvme: cancel pending I/O if nvme controller is in terminal state
nvmet-auth: replace pr_debug() with pr_err() to report an error.
nvmet-auth: return the error code to the nvmet_auth_host_hash() callers
nvme: find numa distance only if controller has valid numa id
ublk: remove segment count and size limits
nvme: fix warn output about shared namespaces without CONFIG_NVME_MULTIPATH

+67 -39
+2 -1
drivers/block/ublk_drv.c
··· 2177 2177 .max_hw_sectors = p->max_sectors, 2178 2178 .chunk_sectors = p->chunk_sectors, 2179 2179 .virt_boundary_mask = p->virt_boundary_mask, 2180 - 2180 + .max_segments = USHRT_MAX, 2181 + .max_segment_size = UINT_MAX, 2181 2182 }; 2182 2183 struct gendisk *disk; 2183 2184 int ret = -EINVAL;
+1 -22
drivers/nvme/host/core.c
··· 629 629 EXPORT_SYMBOL_GPL(nvme_change_ctrl_state); 630 630 631 631 /* 632 - * Returns true for sink states that can't ever transition back to live. 633 - */ 634 - static bool nvme_state_terminal(struct nvme_ctrl *ctrl) 635 - { 636 - switch (nvme_ctrl_state(ctrl)) { 637 - case NVME_CTRL_NEW: 638 - case NVME_CTRL_LIVE: 639 - case NVME_CTRL_RESETTING: 640 - case NVME_CTRL_CONNECTING: 641 - return false; 642 - case NVME_CTRL_DELETING: 643 - case NVME_CTRL_DELETING_NOIO: 644 - case NVME_CTRL_DEAD: 645 - return true; 646 - default: 647 - WARN_ONCE(1, "Unhandled ctrl state:%d", ctrl->state); 648 - return true; 649 - } 650 - } 651 - 652 - /* 653 632 * Waits for the controller state to be resetting, or returns false if it is 654 633 * not possible to ever transition to that state. 655 634 */ ··· 3660 3681 "Found shared namespace %d, but multipathing not supported.\n", 3661 3682 info->nsid); 3662 3683 dev_warn_once(ctrl->device, 3663 - "Support for shared namespaces without CONFIG_NVME_MULTIPATH is deprecated and will be removed in Linux 6.0\n."); 3684 + "Support for shared namespaces without CONFIG_NVME_MULTIPATH is deprecated and will be removed in Linux 6.0.\n"); 3664 3685 } 3665 3686 } 3666 3687
+2 -1
drivers/nvme/host/multipath.c
··· 247 247 if (nvme_path_is_disabled(ns)) 248 248 continue; 249 249 250 - if (READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_NUMA) 250 + if (ns->ctrl->numa_node != NUMA_NO_NODE && 251 + READ_ONCE(head->subsys->iopolicy) == NVME_IOPOLICY_NUMA) 251 252 distance = node_distance(node, ns->ctrl->numa_node); 252 253 else 253 254 distance = LOCAL_DISTANCE;
+21
drivers/nvme/host/nvme.h
··· 741 741 nvme_tag_from_cid(command_id) >= NVME_AQ_BLK_MQ_DEPTH; 742 742 } 743 743 744 + /* 745 + * Returns true for sink states that can't ever transition back to live. 746 + */ 747 + static inline bool nvme_state_terminal(struct nvme_ctrl *ctrl) 748 + { 749 + switch (nvme_ctrl_state(ctrl)) { 750 + case NVME_CTRL_NEW: 751 + case NVME_CTRL_LIVE: 752 + case NVME_CTRL_RESETTING: 753 + case NVME_CTRL_CONNECTING: 754 + return false; 755 + case NVME_CTRL_DELETING: 756 + case NVME_CTRL_DELETING_NOIO: 757 + case NVME_CTRL_DEAD: 758 + return true; 759 + default: 760 + WARN_ONCE(1, "Unhandled ctrl state:%d", ctrl->state); 761 + return true; 762 + } 763 + } 764 + 744 765 void nvme_complete_rq(struct request *req); 745 766 void nvme_complete_batch_req(struct request *req); 746 767
+7 -1
drivers/nvme/host/pci.c
··· 1286 1286 u32 csts = readl(dev->bar + NVME_REG_CSTS); 1287 1287 u8 opcode; 1288 1288 1289 + if (nvme_state_terminal(&dev->ctrl)) 1290 + goto disable; 1291 + 1289 1292 /* If PCI error recovery process is happening, we cannot reset or 1290 1293 * the recovery mechanism will surely fail. 1291 1294 */ ··· 1393 1390 return BLK_EH_RESET_TIMER; 1394 1391 1395 1392 disable: 1396 - if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESETTING)) 1393 + if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESETTING)) { 1394 + if (nvme_state_terminal(&dev->ctrl)) 1395 + nvme_dev_disable(dev, true); 1397 1396 return BLK_EH_DONE; 1397 + } 1398 1398 1399 1399 nvme_dev_disable(dev, false); 1400 1400 if (nvme_try_sched_reset(&dev->ctrl))
+8 -2
drivers/nvme/host/tcp.c
··· 360 360 } while (ret > 0); 361 361 } 362 362 363 - static inline bool nvme_tcp_queue_more(struct nvme_tcp_queue *queue) 363 + static inline bool nvme_tcp_queue_has_pending(struct nvme_tcp_queue *queue) 364 364 { 365 365 return !list_empty(&queue->send_list) || 366 366 !llist_empty(&queue->req_list); 367 + } 368 + 369 + static inline bool nvme_tcp_queue_more(struct nvme_tcp_queue *queue) 370 + { 371 + return !nvme_tcp_tls(&queue->ctrl->ctrl) && 372 + nvme_tcp_queue_has_pending(queue); 367 373 } 368 374 369 375 static inline void nvme_tcp_queue_request(struct nvme_tcp_request *req, ··· 392 386 mutex_unlock(&queue->send_mutex); 393 387 } 394 388 395 - if (last && nvme_tcp_queue_more(queue)) 389 + if (last && nvme_tcp_queue_has_pending(queue)) 396 390 queue_work_on(queue->io_cpu, nvme_tcp_wq, &queue->io_work); 397 391 } 398 392
+4 -4
drivers/nvme/target/auth.c
··· 285 285 } 286 286 287 287 if (shash_len != crypto_shash_digestsize(shash_tfm)) { 288 - pr_debug("%s: hash len mismatch (len %d digest %d)\n", 289 - __func__, shash_len, 290 - crypto_shash_digestsize(shash_tfm)); 288 + pr_err("%s: hash len mismatch (len %d digest %d)\n", 289 + __func__, shash_len, 290 + crypto_shash_digestsize(shash_tfm)); 291 291 ret = -EINVAL; 292 292 goto out_free_tfm; 293 293 } ··· 370 370 nvme_auth_free_key(transformed_key); 371 371 out_free_tfm: 372 372 crypto_free_shash(shash_tfm); 373 - return 0; 373 + return ret; 374 374 } 375 375 376 376 int nvmet_auth_ctrl_hash(struct nvmet_req *req, u8 *response,
+13
drivers/nvme/target/configfs.c
··· 754 754 NULL, 755 755 }; 756 756 757 + bool nvmet_subsys_nsid_exists(struct nvmet_subsys *subsys, u32 nsid) 758 + { 759 + struct config_item *ns_item; 760 + char name[4] = {}; 761 + 762 + if (sprintf(name, "%u", nsid) <= 0) 763 + return false; 764 + mutex_lock(&subsys->namespaces_group.cg_subsys->su_mutex); 765 + ns_item = config_group_find_item(&subsys->namespaces_group, name); 766 + mutex_unlock(&subsys->namespaces_group.cg_subsys->su_mutex); 767 + return ns_item != NULL; 768 + } 769 + 757 770 static void nvmet_ns_release(struct config_item *item) 758 771 { 759 772 struct nvmet_ns *ns = to_nvmet_ns(item);
+4 -1
drivers/nvme/target/core.c
··· 437 437 u16 nvmet_req_find_ns(struct nvmet_req *req) 438 438 { 439 439 u32 nsid = le32_to_cpu(req->cmd->common.nsid); 440 + struct nvmet_subsys *subsys = nvmet_req_subsys(req); 440 441 441 - req->ns = xa_load(&nvmet_req_subsys(req)->namespaces, nsid); 442 + req->ns = xa_load(&subsys->namespaces, nsid); 442 443 if (unlikely(!req->ns)) { 443 444 req->error_loc = offsetof(struct nvme_common_command, nsid); 445 + if (nvmet_subsys_nsid_exists(subsys, nsid)) 446 + return NVME_SC_INTERNAL_PATH_ERROR; 444 447 return NVME_SC_INVALID_NS | NVME_SC_DNR; 445 448 } 446 449
+1
drivers/nvme/target/nvmet.h
··· 543 543 struct nvmet_host *host); 544 544 void nvmet_add_async_event(struct nvmet_ctrl *ctrl, u8 event_type, 545 545 u8 event_info, u8 log_page); 546 + bool nvmet_subsys_nsid_exists(struct nvmet_subsys *subsys, u32 nsid); 546 547 547 548 #define NVMET_MIN_QUEUE_SIZE 16 548 549 #define NVMET_MAX_QUEUE_SIZE 1024
+4 -7
drivers/nvme/target/tcp.c
··· 348 348 return 0; 349 349 } 350 350 351 + /* If cmd buffers are NULL, no operation is performed */ 351 352 static void nvmet_tcp_free_cmd_buffers(struct nvmet_tcp_cmd *cmd) 352 353 { 353 354 kfree(cmd->iov); ··· 1582 1581 struct nvmet_tcp_cmd *cmd = queue->cmds; 1583 1582 int i; 1584 1583 1585 - for (i = 0; i < queue->nr_cmds; i++, cmd++) { 1586 - if (nvmet_tcp_need_data_in(cmd)) 1587 - nvmet_tcp_free_cmd_buffers(cmd); 1588 - } 1589 - 1590 - if (!queue->nr_cmds && nvmet_tcp_need_data_in(&queue->connect)) 1591 - nvmet_tcp_free_cmd_buffers(&queue->connect); 1584 + for (i = 0; i < queue->nr_cmds; i++, cmd++) 1585 + nvmet_tcp_free_cmd_buffers(cmd); 1586 + nvmet_tcp_free_cmd_buffers(&queue->connect); 1592 1587 } 1593 1588 1594 1589 static void nvmet_tcp_release_queue_work(struct work_struct *w)