Skip to content

Commit 04b1ecb

Browse files
committed
Merge tag 'nvme-5.11-2021-01-07' of git://git.infradead.org/nvme into block-5.11
Pull NVMe updates from Christoph: "nvme updates for 5.11: - fix a race in the nvme-tcp send code (Sagi Grimberg) - fix a list corruption in an nvme-rdma error path (Israel Rukshin) - avoid a possible double fetch in nvme-pci (Lalithambika Krishnakumar) - add the susystem NQN quirk for a Samsung driver (Gopal Tiwari) - fix two compiler warnings in nvme-fcloop (James Smart) - don't call sleeping functions from irq context in nvme-fc (James Smart) - remove an unused argument (Max Gurtovoy) - remove unused exports (Minwoo Im)" * tag 'nvme-5.11-2021-01-07' of git://git.infradead.org/nvme: nvme: remove the unused status argument from nvme_trace_bio_complete nvmet-rdma: Fix list_del corruption on queue establishment failure nvme: unexport functions with no external caller nvme: avoid possible double fetch in handling CQE nvme-tcp: Fix possible race of io_work and direct send nvme-pci: mark Samsung PM1725a as IGNORE_DEV_SUBNQN nvme-fcloop: Fix sscanf type and list_first_entry_or_null warnings nvme-fc: avoid calling _nvme_fc_abort_outstanding_ios from interrupt context
2 parents 04a6a53 + 2b59787 commit 04b1ecb

7 files changed

Lines changed: 50 additions & 21 deletions

File tree

drivers/nvme/host/core.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ int nvme_reset_ctrl(struct nvme_ctrl *ctrl)
179179
}
180180
EXPORT_SYMBOL_GPL(nvme_reset_ctrl);
181181

182-
int nvme_reset_ctrl_sync(struct nvme_ctrl *ctrl)
182+
static int nvme_reset_ctrl_sync(struct nvme_ctrl *ctrl)
183183
{
184184
int ret;
185185

@@ -192,7 +192,6 @@ int nvme_reset_ctrl_sync(struct nvme_ctrl *ctrl)
192192

193193
return ret;
194194
}
195-
EXPORT_SYMBOL_GPL(nvme_reset_ctrl_sync);
196195

197196
static void nvme_do_delete_ctrl(struct nvme_ctrl *ctrl)
198197
{
@@ -331,7 +330,7 @@ static inline void nvme_end_req(struct request *req)
331330
req->__sector = nvme_lba_to_sect(req->q->queuedata,
332331
le64_to_cpu(nvme_req(req)->result.u64));
333332

334-
nvme_trace_bio_complete(req, status);
333+
nvme_trace_bio_complete(req);
335334
blk_mq_end_request(req, status);
336335
}
337336

@@ -578,7 +577,7 @@ struct request *nvme_alloc_request(struct request_queue *q,
578577
}
579578
EXPORT_SYMBOL_GPL(nvme_alloc_request);
580579

581-
struct request *nvme_alloc_request_qid(struct request_queue *q,
580+
static struct request *nvme_alloc_request_qid(struct request_queue *q,
582581
struct nvme_command *cmd, blk_mq_req_flags_t flags, int qid)
583582
{
584583
struct request *req;
@@ -589,7 +588,6 @@ struct request *nvme_alloc_request_qid(struct request_queue *q,
589588
nvme_init_request(req, cmd);
590589
return req;
591590
}
592-
EXPORT_SYMBOL_GPL(nvme_alloc_request_qid);
593591

594592
static int nvme_toggle_streams(struct nvme_ctrl *ctrl, bool enable)
595593
{

drivers/nvme/host/fc.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ struct nvme_fc_ctrl {
166166
struct blk_mq_tag_set admin_tag_set;
167167
struct blk_mq_tag_set tag_set;
168168

169+
struct work_struct ioerr_work;
169170
struct delayed_work connect_work;
170171

171172
struct kref ref;
@@ -1888,6 +1889,15 @@ __nvme_fc_fcpop_chk_teardowns(struct nvme_fc_ctrl *ctrl,
18881889
}
18891890
}
18901891

1892+
static void
1893+
nvme_fc_ctrl_ioerr_work(struct work_struct *work)
1894+
{
1895+
struct nvme_fc_ctrl *ctrl =
1896+
container_of(work, struct nvme_fc_ctrl, ioerr_work);
1897+
1898+
nvme_fc_error_recovery(ctrl, "transport detected io error");
1899+
}
1900+
18911901
static void
18921902
nvme_fc_fcpio_done(struct nvmefc_fcp_req *req)
18931903
{
@@ -2046,7 +2056,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req)
20462056

20472057
check_error:
20482058
if (terminate_assoc)
2049-
nvme_fc_error_recovery(ctrl, "transport detected io error");
2059+
queue_work(nvme_reset_wq, &ctrl->ioerr_work);
20502060
}
20512061

20522062
static int
@@ -3233,6 +3243,7 @@ nvme_fc_delete_ctrl(struct nvme_ctrl *nctrl)
32333243
{
32343244
struct nvme_fc_ctrl *ctrl = to_fc_ctrl(nctrl);
32353245

3246+
cancel_work_sync(&ctrl->ioerr_work);
32363247
cancel_delayed_work_sync(&ctrl->connect_work);
32373248
/*
32383249
* kill the association on the link side. this will block
@@ -3449,6 +3460,7 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
34493460

34503461
INIT_WORK(&ctrl->ctrl.reset_work, nvme_fc_reset_ctrl_work);
34513462
INIT_DELAYED_WORK(&ctrl->connect_work, nvme_fc_connect_ctrl_work);
3463+
INIT_WORK(&ctrl->ioerr_work, nvme_fc_ctrl_ioerr_work);
34523464
spin_lock_init(&ctrl->lock);
34533465

34543466
/* io queue count */
@@ -3540,6 +3552,7 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
35403552

35413553
fail_ctrl:
35423554
nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_DELETING);
3555+
cancel_work_sync(&ctrl->ioerr_work);
35433556
cancel_work_sync(&ctrl->ctrl.reset_work);
35443557
cancel_delayed_work_sync(&ctrl->connect_work);
35453558

drivers/nvme/host/nvme.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -610,8 +610,6 @@ void nvme_start_freeze(struct nvme_ctrl *ctrl);
610610
#define NVME_QID_ANY -1
611611
struct request *nvme_alloc_request(struct request_queue *q,
612612
struct nvme_command *cmd, blk_mq_req_flags_t flags);
613-
struct request *nvme_alloc_request_qid(struct request_queue *q,
614-
struct nvme_command *cmd, blk_mq_req_flags_t flags, int qid);
615613
void nvme_cleanup_cmd(struct request *req);
616614
blk_status_t nvme_setup_cmd(struct nvme_ns *ns, struct request *req,
617615
struct nvme_command *cmd);
@@ -630,7 +628,6 @@ int nvme_get_features(struct nvme_ctrl *dev, unsigned int fid,
630628
int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count);
631629
void nvme_stop_keep_alive(struct nvme_ctrl *ctrl);
632630
int nvme_reset_ctrl(struct nvme_ctrl *ctrl);
633-
int nvme_reset_ctrl_sync(struct nvme_ctrl *ctrl);
634631
int nvme_try_sched_reset(struct nvme_ctrl *ctrl);
635632
int nvme_delete_ctrl(struct nvme_ctrl *ctrl);
636633

@@ -675,8 +672,7 @@ static inline void nvme_mpath_check_last_path(struct nvme_ns *ns)
675672
kblockd_schedule_work(&head->requeue_work);
676673
}
677674

678-
static inline void nvme_trace_bio_complete(struct request *req,
679-
blk_status_t status)
675+
static inline void nvme_trace_bio_complete(struct request *req)
680676
{
681677
struct nvme_ns *ns = req->q->queuedata;
682678

@@ -731,8 +727,7 @@ static inline void nvme_mpath_clear_ctrl_paths(struct nvme_ctrl *ctrl)
731727
static inline void nvme_mpath_check_last_path(struct nvme_ns *ns)
732728
{
733729
}
734-
static inline void nvme_trace_bio_complete(struct request *req,
735-
blk_status_t status)
730+
static inline void nvme_trace_bio_complete(struct request *req)
736731
{
737732
}
738733
static inline int nvme_mpath_init(struct nvme_ctrl *ctrl,

drivers/nvme/host/pci.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,7 @@ static inline struct blk_mq_tags *nvme_queue_tagset(struct nvme_queue *nvmeq)
967967
static inline void nvme_handle_cqe(struct nvme_queue *nvmeq, u16 idx)
968968
{
969969
struct nvme_completion *cqe = &nvmeq->cqes[idx];
970+
__u16 command_id = READ_ONCE(cqe->command_id);
970971
struct request *req;
971972

972973
/*
@@ -975,17 +976,17 @@ static inline void nvme_handle_cqe(struct nvme_queue *nvmeq, u16 idx)
975976
* aborts. We don't even bother to allocate a struct request
976977
* for them but rather special case them here.
977978
*/
978-
if (unlikely(nvme_is_aen_req(nvmeq->qid, cqe->command_id))) {
979+
if (unlikely(nvme_is_aen_req(nvmeq->qid, command_id))) {
979980
nvme_complete_async_event(&nvmeq->dev->ctrl,
980981
cqe->status, &cqe->result);
981982
return;
982983
}
983984

984-
req = blk_mq_tag_to_rq(nvme_queue_tagset(nvmeq), cqe->command_id);
985+
req = blk_mq_tag_to_rq(nvme_queue_tagset(nvmeq), command_id);
985986
if (unlikely(!req)) {
986987
dev_warn(nvmeq->dev->ctrl.device,
987988
"invalid id %d completed on queue %d\n",
988-
cqe->command_id, le16_to_cpu(cqe->sq_id));
989+
command_id, le16_to_cpu(cqe->sq_id));
989990
return;
990991
}
991992

@@ -3196,7 +3197,8 @@ static const struct pci_device_id nvme_id_table[] = {
31963197
{ PCI_DEVICE(0x144d, 0xa821), /* Samsung PM1725 */
31973198
.driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, },
31983199
{ PCI_DEVICE(0x144d, 0xa822), /* Samsung PM1725a */
3199-
.driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, },
3200+
.driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY |
3201+
NVME_QUIRK_IGNORE_DEV_SUBNQN, },
32003202
{ PCI_DEVICE(0x1d1d, 0x1f1f), /* LighNVM qemu device */
32013203
.driver_data = NVME_QUIRK_LIGHTNVM, },
32023204
{ PCI_DEVICE(0x1d1d, 0x2807), /* CNEX WL */

drivers/nvme/host/tcp.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,16 @@ static inline void nvme_tcp_advance_req(struct nvme_tcp_request *req,
262262
}
263263
}
264264

265+
static inline void nvme_tcp_send_all(struct nvme_tcp_queue *queue)
266+
{
267+
int ret;
268+
269+
/* drain the send queue as much as we can... */
270+
do {
271+
ret = nvme_tcp_try_send(queue);
272+
} while (ret > 0);
273+
}
274+
265275
static inline void nvme_tcp_queue_request(struct nvme_tcp_request *req,
266276
bool sync, bool last)
267277
{
@@ -279,7 +289,7 @@ static inline void nvme_tcp_queue_request(struct nvme_tcp_request *req,
279289
if (queue->io_cpu == smp_processor_id() &&
280290
sync && empty && mutex_trylock(&queue->send_mutex)) {
281291
queue->more_requests = !last;
282-
nvme_tcp_try_send(queue);
292+
nvme_tcp_send_all(queue);
283293
queue->more_requests = false;
284294
mutex_unlock(&queue->send_mutex);
285295
} else if (last) {

drivers/nvme/target/fcloop.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,7 +1501,8 @@ static ssize_t
15011501
fcloop_set_cmd_drop(struct device *dev, struct device_attribute *attr,
15021502
const char *buf, size_t count)
15031503
{
1504-
int opcode, starting, amount;
1504+
unsigned int opcode;
1505+
int starting, amount;
15051506

15061507
if (sscanf(buf, "%x:%d:%d", &opcode, &starting, &amount) != 3)
15071508
return -EBADRQC;
@@ -1588,8 +1589,8 @@ static int __init fcloop_init(void)
15881589

15891590
static void __exit fcloop_exit(void)
15901591
{
1591-
struct fcloop_lport *lport;
1592-
struct fcloop_nport *nport;
1592+
struct fcloop_lport *lport = NULL;
1593+
struct fcloop_nport *nport = NULL;
15931594
struct fcloop_tport *tport;
15941595
struct fcloop_rport *rport;
15951596
unsigned long flags;

drivers/nvme/target/rdma.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,6 +1641,16 @@ static void __nvmet_rdma_queue_disconnect(struct nvmet_rdma_queue *queue)
16411641
spin_lock_irqsave(&queue->state_lock, flags);
16421642
switch (queue->state) {
16431643
case NVMET_RDMA_Q_CONNECTING:
1644+
while (!list_empty(&queue->rsp_wait_list)) {
1645+
struct nvmet_rdma_rsp *rsp;
1646+
1647+
rsp = list_first_entry(&queue->rsp_wait_list,
1648+
struct nvmet_rdma_rsp,
1649+
wait_list);
1650+
list_del(&rsp->wait_list);
1651+
nvmet_rdma_put_rsp(rsp);
1652+
}
1653+
fallthrough;
16441654
case NVMET_RDMA_Q_LIVE:
16451655
queue->state = NVMET_RDMA_Q_DISCONNECTING;
16461656
disconnect = true;

0 commit comments

Comments
 (0)