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

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
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -2461,6 +2461,18 @@ nvme_fc_terminate_exchange(struct request *req, void *data, bool reserved)
static void
__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
	 * ios on them. As FC allocates FC exchange for each io, the
+3 −2
Original line number Diff line number Diff line
@@ -943,7 +943,6 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req)
		if (ret <= 0)
			return ret;

		nvme_tcp_advance_req(req, ret);
		if (queue->data_digest)
			nvme_tcp_ddgst_update(queue->snd_hash, page,
					offset, ret);
@@ -960,6 +959,7 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req)
			}
			return 1;
		}
		nvme_tcp_advance_req(req, ret);
	}
	return -EAGAIN;
}
@@ -1140,7 +1140,8 @@ static void nvme_tcp_io_work(struct work_struct *w)
				pending = true;
			else if (unlikely(result < 0))
				break;
		}
		} else
			pending = !llist_empty(&queue->req_list);

		result = nvme_tcp_try_recv(queue);
		if (result > 0)
+1 −1
Original line number Diff line number Diff line
@@ -1372,7 +1372,7 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
		goto out_free_changed_ns_list;

	if (subsys->cntlid_min > subsys->cntlid_max)
		goto out_free_changed_ns_list;
		goto out_free_sqs;

	ret = ida_simple_get(&cntlid_ida,
			     subsys->cntlid_min, subsys->cntlid_max,
+3 −1
Original line number Diff line number Diff line
@@ -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,
				0 /* no quirks, we're perfect! */);
	if (ret)
	if (ret) {
		kfree(ctrl);
		goto out;
	}

	if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING))
		WARN_ON_ONCE(1);