Skip to content

Commit fd04358

Browse files
committed
Merge tag 'nvme-5.9-2020-09-10' of git://git.infradead.org/nvme into block-5.9
Pull NVMe fixes from Christoph. "nvme fixes for 5.9 - cancel async events before freeing them (David Milburn) - revert a broken race fix (James Smart) - fix command processing during resets (Sagi Grimberg)" * tag 'nvme-5.9-2020-09-10' of git://git.infradead.org/nvme: nvme-fabrics: allow to queue requests for live queues nvme-tcp: cancel async events before freeing event struct nvme-rdma: cancel async events before freeing event struct nvme-fc: cancel async events before freeing event struct nvme: Revert: Fix controller creation races with teardown flow
2 parents 2cd896a + 73a5379 commit fd04358

File tree

6 files changed

+11
-10
lines changed

6 files changed

+11
-10
lines changed

drivers/nvme/host/core.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3525,10 +3525,6 @@ static ssize_t nvme_sysfs_delete(struct device *dev,
35253525
{
35263526
struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
35273527

3528-
/* Can't delete non-created controllers */
3529-
if (!ctrl->created)
3530-
return -EBUSY;
3531-
35323528
if (device_remove_file_self(dev, attr))
35333529
nvme_delete_ctrl_sync(ctrl);
35343530
return count;
@@ -4403,7 +4399,6 @@ void nvme_start_ctrl(struct nvme_ctrl *ctrl)
44034399
nvme_queue_scan(ctrl);
44044400
nvme_start_queues(ctrl);
44054401
}
4406-
ctrl->created = true;
44074402
}
44084403
EXPORT_SYMBOL_GPL(nvme_start_ctrl);
44094404

drivers/nvme/host/fabrics.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -565,10 +565,14 @@ bool __nvmf_check_ready(struct nvme_ctrl *ctrl, struct request *rq,
565565
struct nvme_request *req = nvme_req(rq);
566566

567567
/*
568-
* If we are in some state of setup or teardown only allow
569-
* internally generated commands.
568+
* currently we have a problem sending passthru commands
569+
* on the admin_q if the controller is not LIVE because we can't
570+
* make sure that they are going out after the admin connect,
571+
* controller enable and/or other commands in the initialization
572+
* sequence. until the controller will be LIVE, fail with
573+
* BLK_STS_RESOURCE so that they will be rescheduled.
570574
*/
571-
if (!blk_rq_is_passthrough(rq) || (req->flags & NVME_REQ_USERCMD))
575+
if (rq->q == ctrl->admin_q && (req->flags & NVME_REQ_USERCMD))
572576
return false;
573577

574578
/*
@@ -577,7 +581,7 @@ bool __nvmf_check_ready(struct nvme_ctrl *ctrl, struct request *rq,
577581
*/
578582
switch (ctrl->state) {
579583
case NVME_CTRL_CONNECTING:
580-
if (nvme_is_fabrics(req->cmd) &&
584+
if (blk_rq_is_passthrough(rq) && nvme_is_fabrics(req->cmd) &&
581585
req->cmd->fabrics.fctype == nvme_fabrics_type_connect)
582586
return true;
583587
break;

drivers/nvme/host/fc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2160,6 +2160,7 @@ nvme_fc_term_aen_ops(struct nvme_fc_ctrl *ctrl)
21602160
struct nvme_fc_fcp_op *aen_op;
21612161
int i;
21622162

2163+
cancel_work_sync(&ctrl->ctrl.async_event_work);
21632164
aen_op = ctrl->aen_ops;
21642165
for (i = 0; i < NVME_NR_AEN_COMMANDS; i++, aen_op++) {
21652166
__nvme_fc_exit_request(ctrl, aen_op);

drivers/nvme/host/nvme.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@ struct nvme_ctrl {
307307
struct nvme_command ka_cmd;
308308
struct work_struct fw_act_work;
309309
unsigned long events;
310-
bool created;
311310

312311
#ifdef CONFIG_NVME_MULTIPATH
313312
/* asymmetric namespace access: */

drivers/nvme/host/rdma.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,7 @@ static void nvme_rdma_destroy_admin_queue(struct nvme_rdma_ctrl *ctrl,
835835
blk_mq_free_tag_set(ctrl->ctrl.admin_tagset);
836836
}
837837
if (ctrl->async_event_sqe.data) {
838+
cancel_work_sync(&ctrl->ctrl.async_event_work);
838839
nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe,
839840
sizeof(struct nvme_command), DMA_TO_DEVICE);
840841
ctrl->async_event_sqe.data = NULL;

drivers/nvme/host/tcp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,6 +1597,7 @@ static struct blk_mq_tag_set *nvme_tcp_alloc_tagset(struct nvme_ctrl *nctrl,
15971597
static void nvme_tcp_free_admin_queue(struct nvme_ctrl *ctrl)
15981598
{
15991599
if (to_tcp_ctrl(ctrl)->async_req.pdu) {
1600+
cancel_work_sync(&ctrl->async_event_work);
16001601
nvme_tcp_free_async_req(to_tcp_ctrl(ctrl));
16011602
to_tcp_ctrl(ctrl)->async_req.pdu = NULL;
16021603
}

0 commit comments

Comments
 (0)