Skip to content

Commit 8805841

Browse files
committed
Merge tag 'for-linus-20181201' of git://git.kernel.dk/linux-block
Pull block layer fixes from Jens Axboe: - Single range elevator discard merge fix, that caused crashes (Ming) - Fix for a regression in O_DIRECT, where we could potentially lose the error value (Maximilian Heyne) - NVMe pull request from Christoph, with little fixes all over the map for NVMe. * tag 'for-linus-20181201' of git://git.kernel.dk/linux-block: block: fix single range discard merge nvme-rdma: fix double freeing of async event data nvme: flush namespace scanning work just before removing namespaces nvme: warn when finding multi-port subsystems without multipathing enabled fs: fix lost error code in dio_complete nvme-pci: fix surprise removal nvme-fc: initialize nvme_req(rq)->ctrl after calling __nvme_fc_init_request() nvme: Free ctrl device name on init failure
2 parents c734b42 + 1c9b357 commit 8805841

File tree

6 files changed

+14
-7
lines changed

6 files changed

+14
-7
lines changed

block/blk-merge.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ static struct request *attempt_merge(struct request_queue *q,
820820

821821
req->__data_len += blk_rq_bytes(next);
822822

823-
if (req_op(req) != REQ_OP_DISCARD)
823+
if (!blk_discard_mergable(req))
824824
elv_merge_requests(q, req, next);
825825

826826
/*

drivers/nvme/host/core.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3314,6 +3314,9 @@ void nvme_remove_namespaces(struct nvme_ctrl *ctrl)
33143314
struct nvme_ns *ns, *next;
33153315
LIST_HEAD(ns_list);
33163316

3317+
/* prevent racing with ns scanning */
3318+
flush_work(&ctrl->scan_work);
3319+
33173320
/*
33183321
* The dead states indicates the controller was not gracefully
33193322
* disconnected. In that case, we won't be able to flush any data while
@@ -3476,7 +3479,6 @@ void nvme_stop_ctrl(struct nvme_ctrl *ctrl)
34763479
nvme_mpath_stop(ctrl);
34773480
nvme_stop_keep_alive(ctrl);
34783481
flush_work(&ctrl->async_event_work);
3479-
flush_work(&ctrl->scan_work);
34803482
cancel_work_sync(&ctrl->fw_act_work);
34813483
if (ctrl->ops->stop_ctrl)
34823484
ctrl->ops->stop_ctrl(ctrl);
@@ -3585,7 +3587,7 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev,
35853587

35863588
return 0;
35873589
out_free_name:
3588-
kfree_const(dev->kobj.name);
3590+
kfree_const(ctrl->device->kobj.name);
35893591
out_release_instance:
35903592
ida_simple_remove(&nvme_instance_ida, ctrl->instance);
35913593
out:
@@ -3607,7 +3609,7 @@ void nvme_kill_queues(struct nvme_ctrl *ctrl)
36073609
down_read(&ctrl->namespaces_rwsem);
36083610

36093611
/* Forcibly unquiesce queues to avoid blocking dispatch */
3610-
if (ctrl->admin_q)
3612+
if (ctrl->admin_q && !blk_queue_dying(ctrl->admin_q))
36113613
blk_mq_unquiesce_queue(ctrl->admin_q);
36123614

36133615
list_for_each_entry(ns, &ctrl->namespaces, list)

drivers/nvme/host/fc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1752,12 +1752,12 @@ nvme_fc_init_request(struct blk_mq_tag_set *set, struct request *rq,
17521752
struct nvme_fc_queue *queue = &ctrl->queues[queue_idx];
17531753
int res;
17541754

1755-
nvme_req(rq)->ctrl = &ctrl->ctrl;
17561755
res = __nvme_fc_init_request(ctrl, queue, &op->op, rq, queue->rqcnt++);
17571756
if (res)
17581757
return res;
17591758
op->op.fcp_req.first_sgl = &op->sgl[0];
17601759
op->op.fcp_req.private = &op->priv[0];
1760+
nvme_req(rq)->ctrl = &ctrl->ctrl;
17611761
return res;
17621762
}
17631763

drivers/nvme/host/nvme.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,9 @@ static inline void nvme_mpath_check_last_path(struct nvme_ns *ns)
531531
static inline int nvme_mpath_init(struct nvme_ctrl *ctrl,
532532
struct nvme_id_ctrl *id)
533533
{
534+
if (ctrl->subsys->cmic & (1 << 3))
535+
dev_warn(ctrl->device,
536+
"Please enable CONFIG_NVME_MULTIPATH for full support of multi-port devices.\n");
534537
return 0;
535538
}
536539
static inline void nvme_mpath_uninit(struct nvme_ctrl *ctrl)

drivers/nvme/host/rdma.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ static int nvme_rdma_alloc_qe(struct ib_device *ibdev, struct nvme_rdma_qe *qe,
184184
qe->dma = ib_dma_map_single(ibdev, qe->data, capsule_size, dir);
185185
if (ib_dma_mapping_error(ibdev, qe->dma)) {
186186
kfree(qe->data);
187+
qe->data = NULL;
187188
return -ENOMEM;
188189
}
189190

@@ -823,6 +824,7 @@ static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl,
823824
out_free_async_qe:
824825
nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe,
825826
sizeof(struct nvme_command), DMA_TO_DEVICE);
827+
ctrl->async_event_sqe.data = NULL;
826828
out_free_queue:
827829
nvme_rdma_free_queue(&ctrl->queues[0]);
828830
return error;

fs/direct-io.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ static ssize_t dio_complete(struct dio *dio, ssize_t ret, unsigned int flags)
325325
*/
326326
dio->iocb->ki_pos += transferred;
327327

328-
if (dio->op == REQ_OP_WRITE)
329-
ret = generic_write_sync(dio->iocb, transferred);
328+
if (ret > 0 && dio->op == REQ_OP_WRITE)
329+
ret = generic_write_sync(dio->iocb, ret);
330330
dio->iocb->ki_complete(dio->iocb, ret, 0);
331331
}
332332

0 commit comments

Comments
 (0)