Skip to content

Commit a592ab6

Browse files
committed
Merge tag 'nvme-6.5-2023-08-02' of git://git.infradead.org/nvme into block-6.5
Pull NVMe fixes from Keith: "nvme fixes for Linux 6.5 - Fixes for request_queue state (Ming) - Another uuid quirk (August)" * tag 'nvme-6.5-2023-08-02' of git://git.infradead.org/nvme: nvme-pci: add NVME_QUIRK_BOGUS_NID for Samsung PM9B1 256G and 512G nvme-rdma: fix potential unbalanced freeze & unfreeze nvme-tcp: fix potential unbalanced freeze & unfreeze nvme: fix possible hang when removing a controller during error recovery
2 parents 3e9dce8 + 688b419 commit a592ab6

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

drivers/nvme/host/core.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3933,6 +3933,12 @@ void nvme_remove_namespaces(struct nvme_ctrl *ctrl)
39333933
*/
39343934
nvme_mpath_clear_ctrl_paths(ctrl);
39353935

3936+
/*
3937+
* Unquiesce io queues so any pending IO won't hang, especially
3938+
* those submitted from scan work
3939+
*/
3940+
nvme_unquiesce_io_queues(ctrl);
3941+
39363942
/* prevent racing with ns scanning */
39373943
flush_work(&ctrl->scan_work);
39383944

@@ -3942,10 +3948,8 @@ void nvme_remove_namespaces(struct nvme_ctrl *ctrl)
39423948
* removing the namespaces' disks; fail all the queues now to avoid
39433949
* potentially having to clean up the failed sync later.
39443950
*/
3945-
if (ctrl->state == NVME_CTRL_DEAD) {
3951+
if (ctrl->state == NVME_CTRL_DEAD)
39463952
nvme_mark_namespaces_dead(ctrl);
3947-
nvme_unquiesce_io_queues(ctrl);
3948-
}
39493953

39503954
/* this is a no-op when called from the controller reset handler */
39513955
nvme_change_ctrl_state(ctrl, NVME_CTRL_DELETING_NOIO);

drivers/nvme/host/pci.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3402,7 +3402,8 @@ static const struct pci_device_id nvme_id_table[] = {
34023402
{ PCI_DEVICE(0x1d97, 0x2263), /* SPCC */
34033403
.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
34043404
{ PCI_DEVICE(0x144d, 0xa80b), /* Samsung PM9B1 256G and 512G */
3405-
.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
3405+
.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES |
3406+
NVME_QUIRK_BOGUS_NID, },
34063407
{ PCI_DEVICE(0x144d, 0xa809), /* Samsung MZALQ256HBJD 256G */
34073408
.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
34083409
{ PCI_DEVICE(0x144d, 0xa802), /* Samsung SM953 */

drivers/nvme/host/rdma.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,7 @@ static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new)
883883
goto out_cleanup_tagset;
884884

885885
if (!new) {
886+
nvme_start_freeze(&ctrl->ctrl);
886887
nvme_unquiesce_io_queues(&ctrl->ctrl);
887888
if (!nvme_wait_freeze_timeout(&ctrl->ctrl, NVME_IO_TIMEOUT)) {
888889
/*
@@ -891,6 +892,7 @@ static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new)
891892
* to be safe.
892893
*/
893894
ret = -ENODEV;
895+
nvme_unfreeze(&ctrl->ctrl);
894896
goto out_wait_freeze_timed_out;
895897
}
896898
blk_mq_update_nr_hw_queues(ctrl->ctrl.tagset,
@@ -940,7 +942,6 @@ static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl,
940942
bool remove)
941943
{
942944
if (ctrl->ctrl.queue_count > 1) {
943-
nvme_start_freeze(&ctrl->ctrl);
944945
nvme_quiesce_io_queues(&ctrl->ctrl);
945946
nvme_sync_io_queues(&ctrl->ctrl);
946947
nvme_rdma_stop_io_queues(ctrl);

drivers/nvme/host/tcp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1868,6 +1868,7 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new)
18681868
goto out_cleanup_connect_q;
18691869

18701870
if (!new) {
1871+
nvme_start_freeze(ctrl);
18711872
nvme_unquiesce_io_queues(ctrl);
18721873
if (!nvme_wait_freeze_timeout(ctrl, NVME_IO_TIMEOUT)) {
18731874
/*
@@ -1876,6 +1877,7 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new)
18761877
* to be safe.
18771878
*/
18781879
ret = -ENODEV;
1880+
nvme_unfreeze(ctrl);
18791881
goto out_wait_freeze_timed_out;
18801882
}
18811883
blk_mq_update_nr_hw_queues(ctrl->tagset,
@@ -1980,7 +1982,6 @@ static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl,
19801982
if (ctrl->queue_count <= 1)
19811983
return;
19821984
nvme_quiesce_admin_queue(ctrl);
1983-
nvme_start_freeze(ctrl);
19841985
nvme_quiesce_io_queues(ctrl);
19851986
nvme_sync_io_queues(ctrl);
19861987
nvme_tcp_stop_io_queues(ctrl);

0 commit comments

Comments
 (0)