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.1-2022-10-28' of git://git.kernel.dk/linux

Pull block fixes from Jens Axboe:

- NVMe pull request via Christoph:
- make the multipath dma alignment match the non-multipath one
(Keith Busch)
- fix a bogus use of sg_init_marker() (Nam Cao)
- fix circulr locking in nvme-tcp (Sagi Grimberg)

- Initialization fix for requests allocated via the special hw queue
allocator (John)

- Fix for a regression added in this release with the batched
completions of end_io backed requests (Ming)

- Error handling leak fix for rbd (Yang)

- Error handling leak fix for add_disk() failure (Yu)

* tag 'block-6.1-2022-10-28' of git://git.kernel.dk/linux:
blk-mq: Properly init requests from blk_mq_alloc_request_hctx()
blk-mq: don't add non-pt request with ->end_io to batch
rbd: fix possible memory leak in rbd_sysfs_init()
nvme-multipath: set queue dma alignment to 3
nvme-tcp: fix possible circular locking when deleting a controller under memory pressure
nvme-tcp: replace sg_init_marker() with sg_init_table()
block: fix memory leak for elevator on add_disk failure

+31 -9
+6 -1
block/blk-mq.c
··· 611 611 .nr_tags = 1, 612 612 }; 613 613 u64 alloc_time_ns = 0; 614 + struct request *rq; 614 615 unsigned int cpu; 615 616 unsigned int tag; 616 617 int ret; ··· 661 660 tag = blk_mq_get_tag(&data); 662 661 if (tag == BLK_MQ_NO_TAG) 663 662 goto out_queue_exit; 664 - return blk_mq_rq_ctx_init(&data, blk_mq_tags_from_data(&data), tag, 663 + rq = blk_mq_rq_ctx_init(&data, blk_mq_tags_from_data(&data), tag, 665 664 alloc_time_ns); 665 + rq->__data_len = 0; 666 + rq->__sector = (sector_t) -1; 667 + rq->bio = rq->biotail = NULL; 668 + return rq; 666 669 667 670 out_queue_exit: 668 671 blk_queue_exit(q);
+8 -4
block/genhd.c
··· 410 410 * Otherwise just allocate the device numbers for both the whole device 411 411 * and all partitions from the extended dev_t space. 412 412 */ 413 + ret = -EINVAL; 413 414 if (disk->major) { 414 415 if (WARN_ON(!disk->minors)) 415 - return -EINVAL; 416 + goto out_exit_elevator; 416 417 417 418 if (disk->minors > DISK_MAX_PARTS) { 418 419 pr_err("block: can't allocate more than %d partitions\n", ··· 421 420 disk->minors = DISK_MAX_PARTS; 422 421 } 423 422 if (disk->first_minor + disk->minors > MINORMASK + 1) 424 - return -EINVAL; 423 + goto out_exit_elevator; 425 424 } else { 426 425 if (WARN_ON(disk->minors)) 427 - return -EINVAL; 426 + goto out_exit_elevator; 428 427 429 428 ret = blk_alloc_ext_minor(); 430 429 if (ret < 0) 431 - return ret; 430 + goto out_exit_elevator; 432 431 disk->major = BLOCK_EXT_MAJOR; 433 432 disk->first_minor = ret; 434 433 } ··· 541 540 out_free_ext_minor: 542 541 if (disk->major == BLOCK_EXT_MAJOR) 543 542 blk_free_ext_minor(disk->first_minor); 543 + out_exit_elevator: 544 + if (disk->queue->elevator) 545 + elevator_exit(disk->queue); 544 546 return ret; 545 547 } 546 548 EXPORT_SYMBOL(device_add_disk);
+3 -1
drivers/block/rbd.c
··· 7222 7222 int ret; 7223 7223 7224 7224 ret = device_register(&rbd_root_dev); 7225 - if (ret < 0) 7225 + if (ret < 0) { 7226 + put_device(&rbd_root_dev); 7226 7227 return ret; 7228 + } 7227 7229 7228 7230 ret = bus_register(&rbd_bus_type); 7229 7231 if (ret < 0)
+1
drivers/nvme/host/multipath.c
··· 516 516 /* set to a default value of 512 until the disk is validated */ 517 517 blk_queue_logical_block_size(head->disk->queue, 512); 518 518 blk_set_stacking_limits(&head->disk->queue->limits); 519 + blk_queue_dma_alignment(head->disk->queue, 3); 519 520 520 521 /* we need to propagate up the VMC settings */ 521 522 if (ctrl->vwc & NVME_CTRL_VWC_PRESENT)
+11 -2
drivers/nvme/host/tcp.c
··· 387 387 { 388 388 struct scatterlist sg; 389 389 390 - sg_init_marker(&sg, 1); 390 + sg_init_table(&sg, 1); 391 391 sg_set_page(&sg, page, len, off); 392 392 ahash_request_set_crypt(hash, &sg, NULL, len); 393 393 crypto_ahash_update(hash); ··· 1141 1141 static int nvme_tcp_try_send(struct nvme_tcp_queue *queue) 1142 1142 { 1143 1143 struct nvme_tcp_request *req; 1144 + unsigned int noreclaim_flag; 1144 1145 int ret = 1; 1145 1146 1146 1147 if (!queue->request) { ··· 1151 1150 } 1152 1151 req = queue->request; 1153 1152 1153 + noreclaim_flag = memalloc_noreclaim_save(); 1154 1154 if (req->state == NVME_TCP_SEND_CMD_PDU) { 1155 1155 ret = nvme_tcp_try_send_cmd_pdu(req); 1156 1156 if (ret <= 0) 1157 1157 goto done; 1158 1158 if (!nvme_tcp_has_inline_data(req)) 1159 - return ret; 1159 + goto out; 1160 1160 } 1161 1161 1162 1162 if (req->state == NVME_TCP_SEND_H2C_PDU) { ··· 1183 1181 nvme_tcp_fail_request(queue->request); 1184 1182 nvme_tcp_done_send_req(queue); 1185 1183 } 1184 + out: 1185 + memalloc_noreclaim_restore(noreclaim_flag); 1186 1186 return ret; 1187 1187 } 1188 1188 ··· 1300 1296 struct page *page; 1301 1297 struct nvme_tcp_ctrl *ctrl = to_tcp_ctrl(nctrl); 1302 1298 struct nvme_tcp_queue *queue = &ctrl->queues[qid]; 1299 + unsigned int noreclaim_flag; 1303 1300 1304 1301 if (!test_and_clear_bit(NVME_TCP_Q_ALLOCATED, &queue->flags)) 1305 1302 return; ··· 1313 1308 __page_frag_cache_drain(page, queue->pf_cache.pagecnt_bias); 1314 1309 queue->pf_cache.va = NULL; 1315 1310 } 1311 + 1312 + noreclaim_flag = memalloc_noreclaim_save(); 1316 1313 sock_release(queue->sock); 1314 + memalloc_noreclaim_restore(noreclaim_flag); 1315 + 1317 1316 kfree(queue->pdu); 1318 1317 mutex_destroy(&queue->send_mutex); 1319 1318 mutex_destroy(&queue->queue_lock);
+2 -1
include/linux/blk-mq.h
··· 853 853 struct io_comp_batch *iob, int ioerror, 854 854 void (*complete)(struct io_comp_batch *)) 855 855 { 856 - if (!iob || (req->rq_flags & RQF_ELV) || ioerror) 856 + if (!iob || (req->rq_flags & RQF_ELV) || ioerror || 857 + (req->end_io && !blk_rq_is_passthrough(req))) 857 858 return false; 858 859 859 860 if (!iob->complete)