Skip to content

Commit 6e34e78

Browse files
committed
Merge tag 'nvme-6.5-2023-06-30' of git://git.infradead.org/nvme into block-6.5
Pull NVMe fixes from Keith: "nvme fixes for Linux 6.5 - Reduce spamming kernel logs on repeated controller updates (Breno) - Improved struct packing (Christophe JAILLET) - Misspelled command name in error logging (Damien) - Failover fix for temporary frozen queue (Sagi) - Reset error handling fixes (Keith)" * tag 'nvme-6.5-2023-06-30' of git://git.infradead.org/nvme: nvme: disable controller on reset state failure nvme: sync timeout work on failed reset nvme: ensure unquiesce on teardown nvme-mpath: fix I/O failure with EAGAIN when failing over I/O nvme: host: fix command name spelling nvmet: Reorder fields in 'struct nvmet_ns' nvme: Print capabilities changes just once
2 parents a587b04 + 4e69d4d commit 6e34e78

6 files changed

Lines changed: 20 additions & 4 deletions

File tree

drivers/nvme/host/constants.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ static const char * const nvme_ops[] = {
1212
[nvme_cmd_read] = "Read",
1313
[nvme_cmd_write_uncor] = "Write Uncorrectable",
1414
[nvme_cmd_compare] = "Compare",
15-
[nvme_cmd_write_zeroes] = "Write Zeros",
15+
[nvme_cmd_write_zeroes] = "Write Zeroes",
1616
[nvme_cmd_dsm] = "Dataset Management",
1717
[nvme_cmd_verify] = "Verify",
1818
[nvme_cmd_resv_register] = "Reservation Register",

drivers/nvme/host/core.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,8 +1134,11 @@ void nvme_passthru_end(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u32 effects,
11341134
mutex_unlock(&ctrl->scan_lock);
11351135
}
11361136
if (effects & NVME_CMD_EFFECTS_CCC) {
1137-
dev_info(ctrl->device,
1137+
if (!test_and_set_bit(NVME_CTRL_DIRTY_CAPABILITY,
1138+
&ctrl->flags)) {
1139+
dev_info(ctrl->device,
11381140
"controller capabilities changed, reset may be required to take effect.\n");
1141+
}
11391142
}
11401143
if (effects & (NVME_CMD_EFFECTS_NIC | NVME_CMD_EFFECTS_NCC)) {
11411144
nvme_queue_scan(ctrl);
@@ -3324,6 +3327,7 @@ int nvme_init_ctrl_finish(struct nvme_ctrl *ctrl, bool was_suspended)
33243327
return ret;
33253328
}
33263329

3330+
clear_bit(NVME_CTRL_DIRTY_CAPABILITY, &ctrl->flags);
33273331
ctrl->identified = true;
33283332

33293333
return 0;

drivers/nvme/host/multipath.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ void nvme_failover_req(struct request *req)
106106
bio->bi_opf &= ~REQ_POLLED;
107107
bio->bi_cookie = BLK_QC_T_NONE;
108108
}
109+
/*
110+
* The alternate request queue that we may end up submitting
111+
* the bio to may be frozen temporarily, in this case REQ_NOWAIT
112+
* will fail the I/O immediately with EAGAIN to the issuer.
113+
* We are not in the issuer context which cannot block. Clear
114+
* the flag to avoid spurious EAGAIN I/O failures.
115+
*/
116+
bio->bi_opf &= ~REQ_NOWAIT;
109117
}
110118
blk_steal_bios(&ns->head->requeue_list, req);
111119
spin_unlock_irqrestore(&ns->head->requeue_lock, flags);

drivers/nvme/host/nvme.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ enum nvme_ctrl_flags {
248248
NVME_CTRL_STARTED_ONCE = 2,
249249
NVME_CTRL_STOPPED = 3,
250250
NVME_CTRL_SKIP_ID_CNS_CS = 4,
251+
NVME_CTRL_DIRTY_CAPABILITY = 5,
251252
};
252253

253254
struct nvme_ctrl {

drivers/nvme/host/pci.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2690,7 +2690,8 @@ static void nvme_reset_work(struct work_struct *work)
26902690
if (dev->ctrl.state != NVME_CTRL_RESETTING) {
26912691
dev_warn(dev->ctrl.device, "ctrl state %d is not RESETTING\n",
26922692
dev->ctrl.state);
2693-
return;
2693+
result = -ENODEV;
2694+
goto out;
26942695
}
26952696

26962697
/*
@@ -2777,7 +2778,9 @@ static void nvme_reset_work(struct work_struct *work)
27772778
result);
27782779
nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DELETING);
27792780
nvme_dev_disable(dev, true);
2781+
nvme_sync_queues(&dev->ctrl);
27802782
nvme_mark_namespaces_dead(&dev->ctrl);
2783+
nvme_unquiesce_io_queues(&dev->ctrl);
27812784
nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DEAD);
27822785
}
27832786

drivers/nvme/target/nvmet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ struct nvmet_ns {
7979
struct completion disable_done;
8080
mempool_t *bvec_pool;
8181

82-
int use_p2pmem;
8382
struct pci_dev *p2p_dev;
83+
int use_p2pmem;
8484
int pi_type;
8585
int metadata_size;
8686
u8 csi;

0 commit comments

Comments
 (0)