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.14-20250313' of git://git.kernel.dk/linux

Pull block fixes from Jens Axboe:

- NVMe pull request via Keith:
- Concurrent pci error and hotplug handling fix (Keith)
- Endpoint function fixes (Damien)

- Fix for a regression introduced in this cycle with error checking for
batched request completions (Shin'ichiro)

* tag 'block-6.14-20250313' of git://git.kernel.dk/linux:
block: change blk_mq_add_to_batch() third argument type to bool
nvme: move error logging from nvme_end_req() to __nvme_end_req()
nvmet: pci-epf: Do not add an IRQ vector if not needed
nvmet: pci-epf: Set NVMET_PCI_EPF_Q_LIVE when a queue is fully created
nvme-pci: fix stuck reset on concurrent DPC and HP

+54 -32
+2 -2
drivers/block/null_blk/main.c
··· 1549 1549 cmd = blk_mq_rq_to_pdu(req); 1550 1550 cmd->error = null_process_cmd(cmd, req_op(req), blk_rq_pos(req), 1551 1551 blk_rq_sectors(req)); 1552 - if (!blk_mq_add_to_batch(req, iob, (__force int) cmd->error, 1553 - blk_mq_end_request_batch)) 1552 + if (!blk_mq_add_to_batch(req, iob, cmd->error != BLK_STS_OK, 1553 + blk_mq_end_request_batch)) 1554 1554 blk_mq_end_request(req, cmd->error); 1555 1555 nr++; 1556 1556 }
+3 -2
drivers/block/virtio_blk.c
··· 1207 1207 1208 1208 while ((vbr = virtqueue_get_buf(vq->vq, &len)) != NULL) { 1209 1209 struct request *req = blk_mq_rq_from_pdu(vbr); 1210 + u8 status = virtblk_vbr_status(vbr); 1210 1211 1211 1212 found++; 1212 1213 if (!blk_mq_complete_request_remote(req) && 1213 - !blk_mq_add_to_batch(req, iob, virtblk_vbr_status(vbr), 1214 - virtblk_complete_batch)) 1214 + !blk_mq_add_to_batch(req, iob, status != VIRTIO_BLK_S_OK, 1215 + virtblk_complete_batch)) 1215 1216 virtblk_request_done(req); 1216 1217 } 1217 1218
+2 -1
drivers/nvme/host/apple.c
··· 599 599 } 600 600 601 601 if (!nvme_try_complete_req(req, cqe->status, cqe->result) && 602 - !blk_mq_add_to_batch(req, iob, nvme_req(req)->status, 602 + !blk_mq_add_to_batch(req, iob, 603 + nvme_req(req)->status != NVME_SC_SUCCESS, 603 604 apple_nvme_complete_batch)) 604 605 apple_nvme_complete_rq(req); 605 606 }
+6 -6
drivers/nvme/host/core.c
··· 431 431 432 432 static inline void __nvme_end_req(struct request *req) 433 433 { 434 + if (unlikely(nvme_req(req)->status && !(req->rq_flags & RQF_QUIET))) { 435 + if (blk_rq_is_passthrough(req)) 436 + nvme_log_err_passthru(req); 437 + else 438 + nvme_log_error(req); 439 + } 434 440 nvme_end_req_zoned(req); 435 441 nvme_trace_bio_complete(req); 436 442 if (req->cmd_flags & REQ_NVME_MPATH) ··· 447 441 { 448 442 blk_status_t status = nvme_error_status(nvme_req(req)->status); 449 443 450 - if (unlikely(nvme_req(req)->status && !(req->rq_flags & RQF_QUIET))) { 451 - if (blk_rq_is_passthrough(req)) 452 - nvme_log_err_passthru(req); 453 - else 454 - nvme_log_error(req); 455 - } 456 444 __nvme_end_req(req); 457 445 blk_mq_end_request(req, status); 458 446 }
+15 -3
drivers/nvme/host/pci.c
··· 1130 1130 1131 1131 trace_nvme_sq(req, cqe->sq_head, nvmeq->sq_tail); 1132 1132 if (!nvme_try_complete_req(req, cqe->status, cqe->result) && 1133 - !blk_mq_add_to_batch(req, iob, nvme_req(req)->status, 1134 - nvme_pci_complete_batch)) 1133 + !blk_mq_add_to_batch(req, iob, 1134 + nvme_req(req)->status != NVME_SC_SUCCESS, 1135 + nvme_pci_complete_batch)) 1135 1136 nvme_pci_complete_rq(req); 1136 1137 } 1137 1138 ··· 1412 1411 struct nvme_dev *dev = nvmeq->dev; 1413 1412 struct request *abort_req; 1414 1413 struct nvme_command cmd = { }; 1414 + struct pci_dev *pdev = to_pci_dev(dev->dev); 1415 1415 u32 csts = readl(dev->bar + NVME_REG_CSTS); 1416 1416 u8 opcode; 1417 1417 1418 + /* 1419 + * Shutdown the device immediately if we see it is disconnected. This 1420 + * unblocks PCIe error handling if the nvme driver is waiting in 1421 + * error_resume for a device that has been removed. We can't unbind the 1422 + * driver while the driver's error callback is waiting to complete, so 1423 + * we're relying on a timeout to break that deadlock if a removal 1424 + * occurs while reset work is running. 1425 + */ 1426 + if (pci_dev_is_disconnected(pdev)) 1427 + nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DELETING); 1418 1428 if (nvme_state_terminal(&dev->ctrl)) 1419 1429 goto disable; 1420 1430 ··· 1433 1421 * the recovery mechanism will surely fail. 1434 1422 */ 1435 1423 mb(); 1436 - if (pci_channel_offline(to_pci_dev(dev->dev))) 1424 + if (pci_channel_offline(pdev)) 1437 1425 return BLK_EH_RESET_TIMER; 1438 1426 1439 1427 /*
+14 -14
drivers/nvme/target/pci-epf.c
··· 1265 1265 struct nvmet_pci_epf_queue *cq = &ctrl->cq[cqid]; 1266 1266 u16 status; 1267 1267 1268 - if (test_and_set_bit(NVMET_PCI_EPF_Q_LIVE, &cq->flags)) 1268 + if (test_bit(NVMET_PCI_EPF_Q_LIVE, &cq->flags)) 1269 1269 return NVME_SC_QID_INVALID | NVME_STATUS_DNR; 1270 1270 1271 1271 if (!(flags & NVME_QUEUE_PHYS_CONTIG)) 1272 1272 return NVME_SC_INVALID_QUEUE | NVME_STATUS_DNR; 1273 - 1274 - if (flags & NVME_CQ_IRQ_ENABLED) 1275 - set_bit(NVMET_PCI_EPF_Q_IRQ_ENABLED, &cq->flags); 1276 1273 1277 1274 cq->pci_addr = pci_addr; 1278 1275 cq->qid = cqid; ··· 1287 1290 cq->qes = ctrl->io_cqes; 1288 1291 cq->pci_size = cq->qes * cq->depth; 1289 1292 1290 - cq->iv = nvmet_pci_epf_add_irq_vector(ctrl, vector); 1291 - if (!cq->iv) { 1292 - status = NVME_SC_INTERNAL | NVME_STATUS_DNR; 1293 - goto err; 1293 + if (flags & NVME_CQ_IRQ_ENABLED) { 1294 + cq->iv = nvmet_pci_epf_add_irq_vector(ctrl, vector); 1295 + if (!cq->iv) 1296 + return NVME_SC_INTERNAL | NVME_STATUS_DNR; 1297 + set_bit(NVMET_PCI_EPF_Q_IRQ_ENABLED, &cq->flags); 1294 1298 } 1295 1299 1296 1300 status = nvmet_cq_create(tctrl, &cq->nvme_cq, cqid, cq->depth); 1297 1301 if (status != NVME_SC_SUCCESS) 1298 1302 goto err; 1303 + 1304 + set_bit(NVMET_PCI_EPF_Q_LIVE, &cq->flags); 1299 1305 1300 1306 dev_dbg(ctrl->dev, "CQ[%u]: %u entries of %zu B, IRQ vector %u\n", 1301 1307 cqid, qsize, cq->qes, cq->vector); ··· 1306 1306 return NVME_SC_SUCCESS; 1307 1307 1308 1308 err: 1309 - clear_bit(NVMET_PCI_EPF_Q_IRQ_ENABLED, &cq->flags); 1310 - clear_bit(NVMET_PCI_EPF_Q_LIVE, &cq->flags); 1309 + if (test_and_clear_bit(NVMET_PCI_EPF_Q_IRQ_ENABLED, &cq->flags)) 1310 + nvmet_pci_epf_remove_irq_vector(ctrl, cq->vector); 1311 1311 return status; 1312 1312 } 1313 1313 ··· 1333 1333 struct nvmet_pci_epf_queue *sq = &ctrl->sq[sqid]; 1334 1334 u16 status; 1335 1335 1336 - if (test_and_set_bit(NVMET_PCI_EPF_Q_LIVE, &sq->flags)) 1336 + if (test_bit(NVMET_PCI_EPF_Q_LIVE, &sq->flags)) 1337 1337 return NVME_SC_QID_INVALID | NVME_STATUS_DNR; 1338 1338 1339 1339 if (!(flags & NVME_QUEUE_PHYS_CONTIG)) ··· 1355 1355 1356 1356 status = nvmet_sq_create(tctrl, &sq->nvme_sq, sqid, sq->depth); 1357 1357 if (status != NVME_SC_SUCCESS) 1358 - goto out_clear_bit; 1358 + return status; 1359 1359 1360 1360 sq->iod_wq = alloc_workqueue("sq%d_wq", WQ_UNBOUND, 1361 1361 min_t(int, sq->depth, WQ_MAX_ACTIVE), sqid); ··· 1365 1365 goto out_destroy_sq; 1366 1366 } 1367 1367 1368 + set_bit(NVMET_PCI_EPF_Q_LIVE, &sq->flags); 1369 + 1368 1370 dev_dbg(ctrl->dev, "SQ[%u]: %u entries of %zu B\n", 1369 1371 sqid, qsize, sq->qes); 1370 1372 ··· 1374 1372 1375 1373 out_destroy_sq: 1376 1374 nvmet_sq_destroy(&sq->nvme_sq); 1377 - out_clear_bit: 1378 - clear_bit(NVMET_PCI_EPF_Q_LIVE, &sq->flags); 1379 1375 return status; 1380 1376 } 1381 1377
+12 -4
include/linux/blk-mq.h
··· 852 852 return rq->rq_flags & RQF_RESV; 853 853 } 854 854 855 - /* 855 + /** 856 + * blk_mq_add_to_batch() - add a request to the completion batch 857 + * @req: The request to add to batch 858 + * @iob: The batch to add the request 859 + * @is_error: Specify true if the request failed with an error 860 + * @complete: The completaion handler for the request 861 + * 856 862 * Batched completions only work when there is no I/O error and no special 857 863 * ->end_io handler. 864 + * 865 + * Return: true when the request was added to the batch, otherwise false 858 866 */ 859 867 static inline bool blk_mq_add_to_batch(struct request *req, 860 - struct io_comp_batch *iob, int ioerror, 868 + struct io_comp_batch *iob, bool is_error, 861 869 void (*complete)(struct io_comp_batch *)) 862 870 { 863 871 /* ··· 873 865 * 1) No batch container 874 866 * 2) Has scheduler data attached 875 867 * 3) Not a passthrough request and end_io set 876 - * 4) Not a passthrough request and an ioerror 868 + * 4) Not a passthrough request and failed with an error 877 869 */ 878 870 if (!iob) 879 871 return false; ··· 882 874 if (!blk_rq_is_passthrough(req)) { 883 875 if (req->end_io) 884 876 return false; 885 - if (ioerror < 0) 877 + if (is_error) 886 878 return false; 887 879 } 888 880