aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/block/drbd/drbd_req.c27
-rw-r--r--drivers/block/xen-blkback/xenbus.c8
-rw-r--r--drivers/nvme/host/fc.c10
-rw-r--r--drivers/nvme/host/pci.c7
-rw-r--r--drivers/nvme/target/core.c6
-rw-r--r--drivers/nvme/target/fc.c4
-rw-r--r--drivers/nvme/target/fcloop.c1
-rw-r--r--drivers/nvme/target/nvmet.h1
-rw-r--r--drivers/nvme/target/rdma.c1
-rw-r--r--drivers/scsi/lpfc/lpfc_nvmet.c1
-rw-r--r--fs/fuse/inode.c9
-rw-r--r--include/linux/nvme-fc-driver.h16
-rw-r--r--kernel/trace/blktrace.c4
13 files changed, 59 insertions, 36 deletions
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
index b5730e17b455..656624314f0d 100644
--- a/drivers/block/drbd/drbd_req.c
+++ b/drivers/block/drbd/drbd_req.c
@@ -315,24 +315,32 @@ void drbd_req_complete(struct drbd_request *req, struct bio_and_error *m)
315} 315}
316 316
317/* still holds resource->req_lock */ 317/* still holds resource->req_lock */
318static int drbd_req_put_completion_ref(struct drbd_request *req, struct bio_and_error *m, int put) 318static void drbd_req_put_completion_ref(struct drbd_request *req, struct bio_and_error *m, int put)
319{ 319{
320 struct drbd_device *device = req->device; 320 struct drbd_device *device = req->device;
321 D_ASSERT(device, m || (req->rq_state & RQ_POSTPONED)); 321 D_ASSERT(device, m || (req->rq_state & RQ_POSTPONED));
322 322
323 if (!put)
324 return;
325
323 if (!atomic_sub_and_test(put, &req->completion_ref)) 326 if (!atomic_sub_and_test(put, &req->completion_ref))
324 return 0; 327 return;
325 328
326 drbd_req_complete(req, m); 329 drbd_req_complete(req, m);
327 330
331 /* local completion may still come in later,
332 * we need to keep the req object around. */
333 if (req->rq_state & RQ_LOCAL_ABORTED)
334 return;
335
328 if (req->rq_state & RQ_POSTPONED) { 336 if (req->rq_state & RQ_POSTPONED) {
329 /* don't destroy the req object just yet, 337 /* don't destroy the req object just yet,
330 * but queue it for retry */ 338 * but queue it for retry */
331 drbd_restart_request(req); 339 drbd_restart_request(req);
332 return 0; 340 return;
333 } 341 }
334 342
335 return 1; 343 kref_put(&req->kref, drbd_req_destroy);
336} 344}
337 345
338static void set_if_null_req_next(struct drbd_peer_device *peer_device, struct drbd_request *req) 346static void set_if_null_req_next(struct drbd_peer_device *peer_device, struct drbd_request *req)
@@ -519,12 +527,8 @@ static void mod_rq_state(struct drbd_request *req, struct bio_and_error *m,
519 if (req->i.waiting) 527 if (req->i.waiting)
520 wake_up(&device->misc_wait); 528 wake_up(&device->misc_wait);
521 529
522 if (c_put) { 530 drbd_req_put_completion_ref(req, m, c_put);
523 if (drbd_req_put_completion_ref(req, m, c_put)) 531 kref_put(&req->kref, drbd_req_destroy);
524 kref_put(&req->kref, drbd_req_destroy);
525 } else {
526 kref_put(&req->kref, drbd_req_destroy);
527 }
528} 532}
529 533
530static void drbd_report_io_error(struct drbd_device *device, struct drbd_request *req) 534static void drbd_report_io_error(struct drbd_device *device, struct drbd_request *req)
@@ -1366,8 +1370,7 @@ nodata:
1366 } 1370 }
1367 1371
1368out: 1372out:
1369 if (drbd_req_put_completion_ref(req, &m, 1)) 1373 drbd_req_put_completion_ref(req, &m, 1);
1370 kref_put(&req->kref, drbd_req_destroy);
1371 spin_unlock_irq(&resource->req_lock); 1374 spin_unlock_irq(&resource->req_lock);
1372 1375
1373 /* Even though above is a kref_put(), this is safe. 1376 /* Even though above is a kref_put(), this is safe.
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 8fe61b5dc5a6..1f3dfaa54d87 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -504,11 +504,13 @@ static int xen_blkbk_remove(struct xenbus_device *dev)
504 504
505 dev_set_drvdata(&dev->dev, NULL); 505 dev_set_drvdata(&dev->dev, NULL);
506 506
507 if (be->blkif) 507 if (be->blkif) {
508 xen_blkif_disconnect(be->blkif); 508 xen_blkif_disconnect(be->blkif);
509 509
510 /* Put the reference we set in xen_blkif_alloc(). */ 510 /* Put the reference we set in xen_blkif_alloc(). */
511 xen_blkif_put(be->blkif); 511 xen_blkif_put(be->blkif);
512 }
513
512 kfree(be->mode); 514 kfree(be->mode);
513 kfree(be); 515 kfree(be);
514 return 0; 516 return 0;
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 70e689bf1cad..dca7165fabcf 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -1754,6 +1754,10 @@ nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg)
1754 dev_info(ctrl->ctrl.device, 1754 dev_info(ctrl->ctrl.device,
1755 "NVME-FC{%d}: resetting controller\n", ctrl->cnum); 1755 "NVME-FC{%d}: resetting controller\n", ctrl->cnum);
1756 1756
1757 /* stop the queues on error, cleanup is in reset thread */
1758 if (ctrl->queue_count > 1)
1759 nvme_stop_queues(&ctrl->ctrl);
1760
1757 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RECONNECTING)) { 1761 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RECONNECTING)) {
1758 dev_err(ctrl->ctrl.device, 1762 dev_err(ctrl->ctrl.device,
1759 "NVME-FC{%d}: error_recovery: Couldn't change state " 1763 "NVME-FC{%d}: error_recovery: Couldn't change state "
@@ -2720,6 +2724,12 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
2720 unsigned long flags; 2724 unsigned long flags;
2721 int ret, idx; 2725 int ret, idx;
2722 2726
2727 if (!(rport->remoteport.port_role &
2728 (FC_PORT_ROLE_NVME_DISCOVERY | FC_PORT_ROLE_NVME_TARGET))) {
2729 ret = -EBADR;
2730 goto out_fail;
2731 }
2732
2723 ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); 2733 ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);
2724 if (!ctrl) { 2734 if (!ctrl) {
2725 ret = -ENOMEM; 2735 ret = -ENOMEM;
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index fed803232edc..4c2ff2bb26bc 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1506,6 +1506,11 @@ static inline void nvme_release_cmb(struct nvme_dev *dev)
1506 if (dev->cmb) { 1506 if (dev->cmb) {
1507 iounmap(dev->cmb); 1507 iounmap(dev->cmb);
1508 dev->cmb = NULL; 1508 dev->cmb = NULL;
1509 if (dev->cmbsz) {
1510 sysfs_remove_file_from_group(&dev->ctrl.device->kobj,
1511 &dev_attr_cmb.attr, NULL);
1512 dev->cmbsz = 0;
1513 }
1509 } 1514 }
1510} 1515}
1511 1516
@@ -1779,6 +1784,7 @@ static void nvme_pci_disable(struct nvme_dev *dev)
1779{ 1784{
1780 struct pci_dev *pdev = to_pci_dev(dev->dev); 1785 struct pci_dev *pdev = to_pci_dev(dev->dev);
1781 1786
1787 nvme_release_cmb(dev);
1782 pci_free_irq_vectors(pdev); 1788 pci_free_irq_vectors(pdev);
1783 1789
1784 if (pci_is_enabled(pdev)) { 1790 if (pci_is_enabled(pdev)) {
@@ -2184,7 +2190,6 @@ static void nvme_remove(struct pci_dev *pdev)
2184 nvme_dev_disable(dev, true); 2190 nvme_dev_disable(dev, true);
2185 nvme_dev_remove_admin(dev); 2191 nvme_dev_remove_admin(dev);
2186 nvme_free_queues(dev, 0); 2192 nvme_free_queues(dev, 0);
2187 nvme_release_cmb(dev);
2188 nvme_release_prp_pools(dev); 2193 nvme_release_prp_pools(dev);
2189 nvme_dev_unmap(dev); 2194 nvme_dev_unmap(dev);
2190 nvme_put_ctrl(&dev->ctrl); 2195 nvme_put_ctrl(&dev->ctrl);
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index cf90713043da..eb9399ac97cf 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -529,6 +529,12 @@ fail:
529} 529}
530EXPORT_SYMBOL_GPL(nvmet_req_init); 530EXPORT_SYMBOL_GPL(nvmet_req_init);
531 531
532void nvmet_req_uninit(struct nvmet_req *req)
533{
534 percpu_ref_put(&req->sq->ref);
535}
536EXPORT_SYMBOL_GPL(nvmet_req_uninit);
537
532static inline bool nvmet_cc_en(u32 cc) 538static inline bool nvmet_cc_en(u32 cc)
533{ 539{
534 return cc & 0x1; 540 return cc & 0x1;
diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c
index 62eba29c85fb..2006fae61980 100644
--- a/drivers/nvme/target/fc.c
+++ b/drivers/nvme/target/fc.c
@@ -517,9 +517,7 @@ nvmet_fc_queue_to_cpu(struct nvmet_fc_tgtport *tgtport, int qid)
517{ 517{
518 int cpu, idx, cnt; 518 int cpu, idx, cnt;
519 519
520 if (!(tgtport->ops->target_features & 520 if (tgtport->ops->max_hw_queues == 1)
521 NVMET_FCTGTFEAT_NEEDS_CMD_CPUSCHED) ||
522 tgtport->ops->max_hw_queues == 1)
523 return WORK_CPU_UNBOUND; 521 return WORK_CPU_UNBOUND;
524 522
525 /* Simple cpu selection based on qid modulo active cpu count */ 523 /* Simple cpu selection based on qid modulo active cpu count */
diff --git a/drivers/nvme/target/fcloop.c b/drivers/nvme/target/fcloop.c
index 15551ef79c8c..294a6611fb24 100644
--- a/drivers/nvme/target/fcloop.c
+++ b/drivers/nvme/target/fcloop.c
@@ -698,7 +698,6 @@ static struct nvmet_fc_target_template tgttemplate = {
698 .dma_boundary = FCLOOP_DMABOUND_4G, 698 .dma_boundary = FCLOOP_DMABOUND_4G,
699 /* optional features */ 699 /* optional features */
700 .target_features = NVMET_FCTGTFEAT_CMD_IN_ISR | 700 .target_features = NVMET_FCTGTFEAT_CMD_IN_ISR |
701 NVMET_FCTGTFEAT_NEEDS_CMD_CPUSCHED |
702 NVMET_FCTGTFEAT_OPDONE_IN_ISR, 701 NVMET_FCTGTFEAT_OPDONE_IN_ISR,
703 /* sizes of additional private data for data structures */ 702 /* sizes of additional private data for data structures */
704 .target_priv_sz = sizeof(struct fcloop_tport), 703 .target_priv_sz = sizeof(struct fcloop_tport),
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index 7cb77ba5993b..cfc5c7fb0ab7 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -261,6 +261,7 @@ u16 nvmet_parse_fabrics_cmd(struct nvmet_req *req);
261 261
262bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq, 262bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq,
263 struct nvmet_sq *sq, struct nvmet_fabrics_ops *ops); 263 struct nvmet_sq *sq, struct nvmet_fabrics_ops *ops);
264void nvmet_req_uninit(struct nvmet_req *req);
264void nvmet_req_complete(struct nvmet_req *req, u16 status); 265void nvmet_req_complete(struct nvmet_req *req, u16 status);
265 266
266void nvmet_cq_setup(struct nvmet_ctrl *ctrl, struct nvmet_cq *cq, u16 qid, 267void nvmet_cq_setup(struct nvmet_ctrl *ctrl, struct nvmet_cq *cq, u16 qid,
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index 99c69018a35f..9e45cde63376 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -567,6 +567,7 @@ static void nvmet_rdma_read_data_done(struct ib_cq *cq, struct ib_wc *wc)
567 rsp->n_rdma = 0; 567 rsp->n_rdma = 0;
568 568
569 if (unlikely(wc->status != IB_WC_SUCCESS)) { 569 if (unlikely(wc->status != IB_WC_SUCCESS)) {
570 nvmet_req_uninit(&rsp->req);
570 nvmet_rdma_release_rsp(rsp); 571 nvmet_rdma_release_rsp(rsp);
571 if (wc->status != IB_WC_WR_FLUSH_ERR) { 572 if (wc->status != IB_WC_WR_FLUSH_ERR) {
572 pr_info("RDMA READ for CQE 0x%p failed with status %s (%d).\n", 573 pr_info("RDMA READ for CQE 0x%p failed with status %s (%d).\n",
diff --git a/drivers/scsi/lpfc/lpfc_nvmet.c b/drivers/scsi/lpfc/lpfc_nvmet.c
index 94434e621c33..0488580eea12 100644
--- a/drivers/scsi/lpfc/lpfc_nvmet.c
+++ b/drivers/scsi/lpfc/lpfc_nvmet.c
@@ -764,7 +764,6 @@ lpfc_nvmet_create_targetport(struct lpfc_hba *phba)
764 lpfc_tgttemplate.max_sgl_segments = phba->cfg_nvme_seg_cnt + 1; 764 lpfc_tgttemplate.max_sgl_segments = phba->cfg_nvme_seg_cnt + 1;
765 lpfc_tgttemplate.max_hw_queues = phba->cfg_nvme_io_channel; 765 lpfc_tgttemplate.max_hw_queues = phba->cfg_nvme_io_channel;
766 lpfc_tgttemplate.target_features = NVMET_FCTGTFEAT_READDATA_RSP | 766 lpfc_tgttemplate.target_features = NVMET_FCTGTFEAT_READDATA_RSP |
767 NVMET_FCTGTFEAT_NEEDS_CMD_CPUSCHED |
768 NVMET_FCTGTFEAT_CMD_IN_ISR | 767 NVMET_FCTGTFEAT_CMD_IN_ISR |
769 NVMET_FCTGTFEAT_OPDONE_IN_ISR; 768 NVMET_FCTGTFEAT_OPDONE_IN_ISR;
770 769
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 5a1b58f8fef4..65c88379a3a1 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -975,8 +975,15 @@ static int fuse_bdi_init(struct fuse_conn *fc, struct super_block *sb)
975 int err; 975 int err;
976 char *suffix = ""; 976 char *suffix = "";
977 977
978 if (sb->s_bdev) 978 if (sb->s_bdev) {
979 suffix = "-fuseblk"; 979 suffix = "-fuseblk";
980 /*
981 * sb->s_bdi points to blkdev's bdi however we want to redirect
982 * it to our private bdi...
983 */
984 bdi_put(sb->s_bdi);
985 sb->s_bdi = &noop_backing_dev_info;
986 }
980 err = super_setup_bdi_name(sb, "%u:%u%s", MAJOR(fc->dev), 987 err = super_setup_bdi_name(sb, "%u:%u%s", MAJOR(fc->dev),
981 MINOR(fc->dev), suffix); 988 MINOR(fc->dev), suffix);
982 if (err) 989 if (err)
diff --git a/include/linux/nvme-fc-driver.h b/include/linux/nvme-fc-driver.h
index 0db37158a61d..6c8c5d8041b7 100644
--- a/include/linux/nvme-fc-driver.h
+++ b/include/linux/nvme-fc-driver.h
@@ -27,8 +27,8 @@
27 27
28/* FC Port role bitmask - can merge with FC Port Roles in fc transport */ 28/* FC Port role bitmask - can merge with FC Port Roles in fc transport */
29#define FC_PORT_ROLE_NVME_INITIATOR 0x10 29#define FC_PORT_ROLE_NVME_INITIATOR 0x10
30#define FC_PORT_ROLE_NVME_TARGET 0x11 30#define FC_PORT_ROLE_NVME_TARGET 0x20
31#define FC_PORT_ROLE_NVME_DISCOVERY 0x12 31#define FC_PORT_ROLE_NVME_DISCOVERY 0x40
32 32
33 33
34/** 34/**
@@ -642,15 +642,7 @@ enum {
642 * sequence in one LLDD operation. Errors during Data 642 * sequence in one LLDD operation. Errors during Data
643 * sequence transmit must not allow RSP sequence to be sent. 643 * sequence transmit must not allow RSP sequence to be sent.
644 */ 644 */
645 NVMET_FCTGTFEAT_NEEDS_CMD_CPUSCHED = (1 << 1), 645 NVMET_FCTGTFEAT_CMD_IN_ISR = (1 << 1),
646 /* Bit 1: When 0, the LLDD will deliver FCP CMD
647 * on the CPU it should be affinitized to. Thus work will
648 * be scheduled on the cpu received on. When 1, the LLDD
649 * may not deliver the CMD on the CPU it should be worked
650 * on. The transport should pick a cpu to schedule the work
651 * on.
652 */
653 NVMET_FCTGTFEAT_CMD_IN_ISR = (1 << 2),
654 /* Bit 2: When 0, the LLDD is calling the cmd rcv handler 646 /* Bit 2: When 0, the LLDD is calling the cmd rcv handler
655 * in a non-isr context, allowing the transport to finish 647 * in a non-isr context, allowing the transport to finish
656 * op completion in the calling context. When 1, the LLDD 648 * op completion in the calling context. When 1, the LLDD
@@ -658,7 +650,7 @@ enum {
658 * requiring the transport to transition to a workqueue 650 * requiring the transport to transition to a workqueue
659 * for op completion. 651 * for op completion.
660 */ 652 */
661 NVMET_FCTGTFEAT_OPDONE_IN_ISR = (1 << 3), 653 NVMET_FCTGTFEAT_OPDONE_IN_ISR = (1 << 2),
662 /* Bit 3: When 0, the LLDD is calling the op done handler 654 /* Bit 3: When 0, the LLDD is calling the op done handler
663 * in a non-isr context, allowing the transport to finish 655 * in a non-isr context, allowing the transport to finish
664 * op completion in the calling context. When 1, the LLDD 656 * op completion in the calling context. When 1, the LLDD
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index bd8ae8d5ae9c..193c5f5e3f79 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -1662,14 +1662,14 @@ static ssize_t sysfs_blk_trace_attr_store(struct device *dev,
1662 goto out; 1662 goto out;
1663 1663
1664 if (attr == &dev_attr_act_mask) { 1664 if (attr == &dev_attr_act_mask) {
1665 if (sscanf(buf, "%llx", &value) != 1) { 1665 if (kstrtoull(buf, 0, &value)) {
1666 /* Assume it is a list of trace category names */ 1666 /* Assume it is a list of trace category names */
1667 ret = blk_trace_str2mask(buf); 1667 ret = blk_trace_str2mask(buf);
1668 if (ret < 0) 1668 if (ret < 0)
1669 goto out; 1669 goto out;
1670 value = ret; 1670 value = ret;
1671 } 1671 }
1672 } else if (sscanf(buf, "%llu", &value) != 1) 1672 } else if (kstrtoull(buf, 0, &value))
1673 goto out; 1673 goto out;
1674 1674
1675 ret = -ENXIO; 1675 ret = -ENXIO;