Driver handling for broken devices
Subsystems (2)
cover Driver handling for broken devices
These are just a couple simple patches for when the device stops working. I think handling the unload was mentioned on another thread somewhere on this mailing list. I'm not particularly thrilled with this since a truely broken device will take 2 minutes per queue for the unload or hot-unplug to complete, but I think it is a step in the right direction.
Keith Busch (2):
NVMe: Clear timed out IO
NVMe: Schedule timeout for sync commands
drivers/block/nvme-core.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
PATCH 1/2 NVMe: Clear timed out IO
This cancels a timed out IO only once and clears the timeout so we don't log the same problem every second. This may also prove useful if we implement async events, which don't have timeouts.
--- drivers/block/nvme-core.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/block/nvme-core.c +3 -1
@@ -878,9 +878,11 @@ static void nvme_cancel_ios(struct nvme_queue *nvmeq, bool timeout) .status = cpu_to_le16(NVME_SC_ABORT_REQ << 1), }; -if (timeout && !time_after (now, info[cmdid].timeout)) +if (timeout && (!time_after (now, info[cmdid].timeout) || + !info[cmdid].timeout))continue ;dev_warn (nvmeq->q_dmadev,"Cancelling I/O %d\n" , cmdid); + info[cmdid].timeout =0 ; ctx =cancel_cmdid (nvmeq, cmdid, &fn);fn (nvmeq->dev, ctx, &cqe); }
Signature · 1 line
1.7.0.4
PATCH 2/2 NVMe: Schedule timeout for sync commands
In reply to Keith BuschSchedule a timeout on sync commands in case the command times out and the device is not being polled for timeouts. This prevents device removal from hanging forever if the device has stopped responding.
--- drivers/block/nvme-core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/block/nvme-core.c +1 -1
@@ -731,7 +731,7 @@ int nvme_submit_sync_cmd(struct nvme_queue *nvmeq, struct nvme_command *cmd,set_current_state (TASK_KILLABLE );nvme_submit_cmd (nvmeq, cmd); -schedule (); +schedule_timeout (timeout);if (cmdinfo.status == -EINTR ) {nvme_abort_command (nvmeq, cmdid);
Signature · 1 line
1.7.0.4