Skip to content

Commit b4f6642

Browse files
committed
Merge tag 'nvme-5.11-2021-01-14' of git://git.infradead.org/nvme into block-5.11
Pull NVMe fixes from Christoph: "nvme fixes for 5.11: - don't initialize hwmon for discover controllers (Sagi Grimberg) - fix iov_iter handling in nvme-tcp (Sagi Grimberg) - fix a preempt warning in nvme-tcp (Sagi Grimberg) - fix a possible NULL pointer dereference in nvme (Israel Rukshin)" * tag 'nvme-5.11-2021-01-14' of git://git.infradead.org/nvme: nvme: don't intialize hwmon for discovery controllers nvme-tcp: fix possible data corruption with bio merges nvme-tcp: Fix warning with CONFIG_DEBUG_PREEMPT nvmet-rdma: Fix NULL deref when setting pi_enable and traddr INADDR_ANY
2 parents 5342fd4 + 5ab25a3 commit b4f6642

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

drivers/nvme/host/core.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2856,6 +2856,11 @@ static const struct attribute_group *nvme_subsys_attrs_groups[] = {
28562856
NULL,
28572857
};
28582858

2859+
static inline bool nvme_discovery_ctrl(struct nvme_ctrl *ctrl)
2860+
{
2861+
return ctrl->opts && ctrl->opts->discovery_nqn;
2862+
}
2863+
28592864
static bool nvme_validate_cntlid(struct nvme_subsystem *subsys,
28602865
struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
28612866
{
@@ -2875,7 +2880,7 @@ static bool nvme_validate_cntlid(struct nvme_subsystem *subsys,
28752880
}
28762881

28772882
if ((id->cmic & NVME_CTRL_CMIC_MULTI_CTRL) ||
2878-
(ctrl->opts && ctrl->opts->discovery_nqn))
2883+
nvme_discovery_ctrl(ctrl))
28792884
continue;
28802885

28812886
dev_err(ctrl->device,
@@ -3144,7 +3149,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
31443149
goto out_free;
31453150
}
31463151

3147-
if (!ctrl->opts->discovery_nqn && !ctrl->kas) {
3152+
if (!nvme_discovery_ctrl(ctrl) && !ctrl->kas) {
31483153
dev_err(ctrl->device,
31493154
"keep-alive support is mandatory for fabrics\n");
31503155
ret = -EINVAL;
@@ -3184,7 +3189,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
31843189
if (ret < 0)
31853190
return ret;
31863191

3187-
if (!ctrl->identified) {
3192+
if (!ctrl->identified && !nvme_discovery_ctrl(ctrl)) {
31883193
ret = nvme_hwmon_init(ctrl);
31893194
if (ret < 0)
31903195
return ret;

drivers/nvme/host/tcp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ static inline size_t nvme_tcp_req_cur_offset(struct nvme_tcp_request *req)
201201

202202
static inline size_t nvme_tcp_req_cur_length(struct nvme_tcp_request *req)
203203
{
204-
return min_t(size_t, req->iter.bvec->bv_len - req->iter.iov_offset,
204+
return min_t(size_t, iov_iter_single_seg_count(&req->iter),
205205
req->pdu_len - req->pdu_sent);
206206
}
207207

@@ -286,7 +286,7 @@ static inline void nvme_tcp_queue_request(struct nvme_tcp_request *req,
286286
* directly, otherwise queue io_work. Also, only do that if we
287287
* are on the same cpu, so we don't introduce contention.
288288
*/
289-
if (queue->io_cpu == smp_processor_id() &&
289+
if (queue->io_cpu == __smp_processor_id() &&
290290
sync && empty && mutex_trylock(&queue->send_mutex)) {
291291
queue->more_requests = !last;
292292
nvme_tcp_send_all(queue);

drivers/nvme/target/rdma.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,14 @@ nvmet_rdma_find_get_device(struct rdma_cm_id *cm_id)
12201220
}
12211221
ndev->inline_data_size = nport->inline_data_size;
12221222
ndev->inline_page_count = inline_page_count;
1223+
1224+
if (nport->pi_enable && !(cm_id->device->attrs.device_cap_flags &
1225+
IB_DEVICE_INTEGRITY_HANDOVER)) {
1226+
pr_warn("T10-PI is not supported by device %s. Disabling it\n",
1227+
cm_id->device->name);
1228+
nport->pi_enable = false;
1229+
}
1230+
12231231
ndev->device = cm_id->device;
12241232
kref_init(&ndev->ref);
12251233

@@ -1855,14 +1863,6 @@ static int nvmet_rdma_enable_port(struct nvmet_rdma_port *port)
18551863
goto out_destroy_id;
18561864
}
18571865

1858-
if (port->nport->pi_enable &&
1859-
!(cm_id->device->attrs.device_cap_flags &
1860-
IB_DEVICE_INTEGRITY_HANDOVER)) {
1861-
pr_err("T10-PI is not supported for %pISpcs\n", addr);
1862-
ret = -EINVAL;
1863-
goto out_destroy_id;
1864-
}
1865-
18661866
port->cm_id = cm_id;
18671867
return 0;
18681868

0 commit comments

Comments
 (0)