Skip to content

Commit

Permalink
Merge branch 'nvme-4.13' of git://git.infradead.org/nvme into for-linus
Browse files Browse the repository at this point in the history
Pull followup NVMe (mostly) changes from Sagi:

I added the quiesce/unquiesce patches in here as it's
easy for me easily apply changes on top. It has accumulated
reviews and includes mostly nvme anyway, please tell me if
you don't want to take them with this.

This includes:
- quiesce/unquiesce fixes in nvme and others from me
- nvme-fc add create association padding spec updates from James
- some more quirking from MKP
- nvmet nit cleanup from Max
- Fix nvme-rdma racy RDMA completion signalling from Marta
- some centralization patches from me
- add tagset nr_hw_queues updates on controller resets in
  nvme drivers from me
- nvme-rdma fix resources recycling when doing error recovery from me
- minor cleanups in nvme-fc from me
  • Loading branch information
axboe committed Jul 10, 2017
2 parents 56c7641 + c2f30f0 commit 459bd0d
Show file tree
Hide file tree
Showing 12 changed files with 248 additions and 202 deletions.
19 changes: 15 additions & 4 deletions drivers/block/mtip32xx/mtip32xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ static int mtip_quiesce_io(struct mtip_port *port, unsigned long timeout)
unsigned long to;
bool active = true;

blk_mq_stop_hw_queues(port->dd->queue);
blk_mq_quiesce_queue(port->dd->queue);

to = jiffies + msecs_to_jiffies(timeout);
do {
Expand All @@ -970,10 +970,10 @@ static int mtip_quiesce_io(struct mtip_port *port, unsigned long timeout)
break;
} while (time_before(jiffies, to));

blk_mq_start_stopped_hw_queues(port->dd->queue, true);
blk_mq_unquiesce_queue(port->dd->queue);
return active ? -EBUSY : 0;
err_fault:
blk_mq_start_stopped_hw_queues(port->dd->queue, true);
blk_mq_unquiesce_queue(port->dd->queue);
return -EFAULT;
}

Expand Down Expand Up @@ -2737,6 +2737,9 @@ static void mtip_abort_cmd(struct request *req, void *data,
struct mtip_cmd *cmd = blk_mq_rq_to_pdu(req);
struct driver_data *dd = data;

if (!blk_mq_request_started(req))
return;

dbg_printk(MTIP_DRV_NAME " Aborting request, tag = %d\n", req->tag);

clear_bit(req->tag, dd->port->cmds_to_issue);
Expand All @@ -2749,6 +2752,9 @@ static void mtip_queue_cmd(struct request *req, void *data,
{
struct driver_data *dd = data;

if (!blk_mq_request_started(req))
return;

set_bit(req->tag, dd->port->cmds_to_issue);
blk_abort_request(req);
}
Expand Down Expand Up @@ -2814,6 +2820,8 @@ static int mtip_service_thread(void *data)
dev_warn(&dd->pdev->dev,
"Completion workers still active!");

blk_mq_quiesce_queue(dd->queue);

spin_lock(dd->queue->queue_lock);
blk_mq_tagset_busy_iter(&dd->tags,
mtip_queue_cmd, dd);
Expand All @@ -2826,6 +2834,8 @@ static int mtip_service_thread(void *data)
mtip_abort_cmd, dd);

clear_bit(MTIP_PF_TO_ACTIVE_BIT, &dd->port->flags);

blk_mq_unquiesce_queue(dd->queue);
}

if (test_bit(MTIP_PF_ISSUE_CMDS_BIT, &port->flags)) {
Expand Down Expand Up @@ -3995,8 +4005,9 @@ static int mtip_block_remove(struct driver_data *dd)
dd->disk->disk_name);

blk_freeze_queue_start(dd->queue);
blk_mq_stop_hw_queues(dd->queue);
blk_mq_quiesce_queue(dd->queue);
blk_mq_tagset_busy_iter(&dd->tags, mtip_no_dev_cleanup, dd);
blk_mq_unquiesce_queue(dd->queue);

/*
* Delete our gendisk structure. This also removes the device
Expand Down
4 changes: 2 additions & 2 deletions drivers/block/nbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,9 @@ static void nbd_clear_req(struct request *req, void *data, bool reserved)

static void nbd_clear_que(struct nbd_device *nbd)
{
blk_mq_stop_hw_queues(nbd->disk->queue);
blk_mq_quiesce_queue(nbd->disk->queue);
blk_mq_tagset_busy_iter(&nbd->tag_set, nbd_clear_req, NULL);
blk_mq_start_hw_queues(nbd->disk->queue);
blk_mq_unquiesce_queue(nbd->disk->queue);
dev_dbg(disk_to_dev(nbd->disk), "queue cleared\n");
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/block/virtio_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ static int virtblk_freeze(struct virtio_device *vdev)
/* Make sure no work handler is accessing the device. */
flush_work(&vblk->config_work);

blk_mq_stop_hw_queues(vblk->disk->queue);
blk_mq_quiesce_queue(vblk->disk->queue);

vdev->config->del_vqs(vdev);
return 0;
Expand All @@ -857,7 +857,7 @@ static int virtblk_restore(struct virtio_device *vdev)

virtio_device_ready(vdev);

blk_mq_start_stopped_hw_queues(vblk->disk->queue, true);
blk_mq_unquiesce_queue(vblk->disk->queue);
return 0;
}
#endif
Expand Down
40 changes: 21 additions & 19 deletions drivers/nvme/host/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void nvme_complete_rq(struct request *req)
{
if (unlikely(nvme_req(req)->status && nvme_req_needs_retry(req))) {
nvme_req(req)->retries++;
blk_mq_requeue_request(req, !blk_mq_queue_stopped(req->q));
blk_mq_requeue_request(req, true);
return;
}

Expand Down Expand Up @@ -2591,12 +2591,29 @@ static void nvme_release_instance(struct nvme_ctrl *ctrl)
spin_unlock(&dev_list_lock);
}

void nvme_uninit_ctrl(struct nvme_ctrl *ctrl)
void nvme_stop_ctrl(struct nvme_ctrl *ctrl)
{
nvme_stop_keep_alive(ctrl);
flush_work(&ctrl->async_event_work);
flush_work(&ctrl->scan_work);
nvme_remove_namespaces(ctrl);
}
EXPORT_SYMBOL_GPL(nvme_stop_ctrl);

void nvme_start_ctrl(struct nvme_ctrl *ctrl)
{
if (ctrl->kato)
nvme_start_keep_alive(ctrl);

if (ctrl->queue_count > 1) {
nvme_queue_scan(ctrl);
nvme_queue_async_events(ctrl);
nvme_start_queues(ctrl);
}
}
EXPORT_SYMBOL_GPL(nvme_start_ctrl);

void nvme_uninit_ctrl(struct nvme_ctrl *ctrl)
{
device_destroy(nvme_class, MKDEV(nvme_char_major, ctrl->instance));

spin_lock(&dev_list_lock);
Expand Down Expand Up @@ -2694,9 +2711,6 @@ void nvme_kill_queues(struct nvme_ctrl *ctrl)
/* Forcibly unquiesce queues to avoid blocking dispatch */
blk_mq_unquiesce_queue(ctrl->admin_q);

/* Forcibly start all queues to avoid having stuck requests */
blk_mq_start_hw_queues(ctrl->admin_q);

list_for_each_entry(ns, &ctrl->namespaces, list) {
/*
* Revalidating a dead namespace sets capacity to 0. This will
Expand All @@ -2709,16 +2723,6 @@ void nvme_kill_queues(struct nvme_ctrl *ctrl)

/* Forcibly unquiesce queues to avoid blocking dispatch */
blk_mq_unquiesce_queue(ns->queue);

/*
* Forcibly start all queues to avoid having stuck requests.
* Note that we must ensure the queues are not stopped
* when the final removal happens.
*/
blk_mq_start_hw_queues(ns->queue);

/* draining requests in requeue list */
blk_mq_kick_requeue_list(ns->queue);
}
mutex_unlock(&ctrl->namespaces_mutex);
}
Expand Down Expand Up @@ -2787,10 +2791,8 @@ void nvme_start_queues(struct nvme_ctrl *ctrl)
struct nvme_ns *ns;

mutex_lock(&ctrl->namespaces_mutex);
list_for_each_entry(ns, &ctrl->namespaces, list) {
list_for_each_entry(ns, &ctrl->namespaces, list)
blk_mq_unquiesce_queue(ns->queue);
blk_mq_kick_requeue_list(ns->queue);
}
mutex_unlock(&ctrl->namespaces_mutex);
}
EXPORT_SYMBOL_GPL(nvme_start_queues);
Expand Down
Loading

0 comments on commit 459bd0d

Please sign in to comment.