Commit 9a66e6bd authored by Jens Axboe's avatar Jens Axboe

Merge tag 'nvme-5.13-2021-05-20' of git://git.infradead.org/nvme into block-5.13

Pull NVMe fixes from Christoph:

"nvme fixes for Linux 5.13:

 - nvme-tcp corruption and timeout fixes (Sagi Grimberg, Keith Busch)
 - nvme-fc teardown fix (James Smart)
 - nvmet/nvme-loop memory leak fixes (Wu Bo)"

* tag 'nvme-5.13-2021-05-20' of git://git.infradead.org/nvme:
  nvme-fc: clear q_live at beginning of association teardown
  nvme-tcp: rerun io_work if req_list is not empty
  nvme-tcp: fix possible use-after-completion
  nvme-loop: fix memory leak in nvme_loop_create_ctrl()
  nvmet: fix memory leak in nvmet_alloc_ctrl()
parents 4bc20823 a7d13914
...@@ -2461,6 +2461,18 @@ nvme_fc_terminate_exchange(struct request *req, void *data, bool reserved) ...@@ -2461,6 +2461,18 @@ nvme_fc_terminate_exchange(struct request *req, void *data, bool reserved)
static void static void
__nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues) __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues)
{ {
int q;
/*
* if aborting io, the queues are no longer good, mark them
* all as not live.
*/
if (ctrl->ctrl.queue_count > 1) {
for (q = 1; q < ctrl->ctrl.queue_count; q++)
clear_bit(NVME_FC_Q_LIVE, &ctrl->queues[q].flags);
}
clear_bit(NVME_FC_Q_LIVE, &ctrl->queues[0].flags);
/* /*
* If io queues are present, stop them and terminate all outstanding * If io queues are present, stop them and terminate all outstanding
* ios on them. As FC allocates FC exchange for each io, the * ios on them. As FC allocates FC exchange for each io, the
......
...@@ -943,7 +943,6 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req) ...@@ -943,7 +943,6 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req)
if (ret <= 0) if (ret <= 0)
return ret; return ret;
nvme_tcp_advance_req(req, ret);
if (queue->data_digest) if (queue->data_digest)
nvme_tcp_ddgst_update(queue->snd_hash, page, nvme_tcp_ddgst_update(queue->snd_hash, page,
offset, ret); offset, ret);
...@@ -960,6 +959,7 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req) ...@@ -960,6 +959,7 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req)
} }
return 1; return 1;
} }
nvme_tcp_advance_req(req, ret);
} }
return -EAGAIN; return -EAGAIN;
} }
...@@ -1140,7 +1140,8 @@ static void nvme_tcp_io_work(struct work_struct *w) ...@@ -1140,7 +1140,8 @@ static void nvme_tcp_io_work(struct work_struct *w)
pending = true; pending = true;
else if (unlikely(result < 0)) else if (unlikely(result < 0))
break; break;
} } else
pending = !llist_empty(&queue->req_list);
result = nvme_tcp_try_recv(queue); result = nvme_tcp_try_recv(queue);
if (result > 0) if (result > 0)
......
...@@ -1372,7 +1372,7 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn, ...@@ -1372,7 +1372,7 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
goto out_free_changed_ns_list; goto out_free_changed_ns_list;
if (subsys->cntlid_min > subsys->cntlid_max) if (subsys->cntlid_min > subsys->cntlid_max)
goto out_free_changed_ns_list; goto out_free_sqs;
ret = ida_simple_get(&cntlid_ida, ret = ida_simple_get(&cntlid_ida,
subsys->cntlid_min, subsys->cntlid_max, subsys->cntlid_min, subsys->cntlid_max,
......
...@@ -590,8 +590,10 @@ static struct nvme_ctrl *nvme_loop_create_ctrl(struct device *dev, ...@@ -590,8 +590,10 @@ static struct nvme_ctrl *nvme_loop_create_ctrl(struct device *dev,
ret = nvme_init_ctrl(&ctrl->ctrl, dev, &nvme_loop_ctrl_ops, ret = nvme_init_ctrl(&ctrl->ctrl, dev, &nvme_loop_ctrl_ops,
0 /* no quirks, we're perfect! */); 0 /* no quirks, we're perfect! */);
if (ret) if (ret) {
kfree(ctrl);
goto out; goto out;
}
if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING))
WARN_ON_ONCE(1); WARN_ON_ONCE(1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment