Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-linus' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:
"A small collection of fixes that should go into this cycle.

- a pull request from Christoph for NVMe, which ended up being
manually applied to avoid pulling in newer bits in master. Mostly
fibre channel fixes from James, but also a few fixes from Jon and
Vijay

- a pull request from Konrad, with just a single fix for xen-blkback
from Gustavo.

- a fuseblk bdi fix from Jan, fixing a regression in this series with
the dynamic backing devices.

- a blktrace fix from Shaohua, replacing sscanf() with kstrtoull().

- a request leak fix for drbd from Lars, fixing a regression in the
last series with the kref changes. This will go to stable as well"

* 'for-linus' of git://git.kernel.dk/linux-block:
nvmet: release the sq ref on rdma read errors
nvmet-fc: remove target cpu scheduling flag
nvme-fc: stop queues on error detection
nvme-fc: require target or discovery role for fc-nvme targets
nvme-fc: correct port role bits
nvme: unmap CMB and remove sysfs file in reset path
blktrace: fix integer parse
fuseblk: Fix warning in super_setup_bdi_name()
block: xen-blkback: add null check to avoid null pointer dereference
drbd: fix request leak introduced by locking/atomic, kref: Kill kref_sub()

+59 -36
+15 -12
drivers/block/drbd/drbd_req.c
··· 315 315 } 316 316 317 317 /* still holds resource->req_lock */ 318 - static int drbd_req_put_completion_ref(struct drbd_request *req, struct bio_and_error *m, int put) 318 + static void drbd_req_put_completion_ref(struct drbd_request *req, struct bio_and_error *m, int put) 319 319 { 320 320 struct drbd_device *device = req->device; 321 321 D_ASSERT(device, m || (req->rq_state & RQ_POSTPONED)); 322 322 323 + if (!put) 324 + return; 325 + 323 326 if (!atomic_sub_and_test(put, &req->completion_ref)) 324 - return 0; 327 + return; 325 328 326 329 drbd_req_complete(req, m); 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; 327 335 328 336 if (req->rq_state & RQ_POSTPONED) { 329 337 /* don't destroy the req object just yet, 330 338 * but queue it for retry */ 331 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 338 346 static void set_if_null_req_next(struct drbd_peer_device *peer_device, struct drbd_request *req) ··· 527 519 if (req->i.waiting) 528 520 wake_up(&device->misc_wait); 529 521 530 - if (c_put) { 531 - if (drbd_req_put_completion_ref(req, m, c_put)) 532 - kref_put(&req->kref, drbd_req_destroy); 533 - } else { 534 - kref_put(&req->kref, drbd_req_destroy); 535 - } 522 + drbd_req_put_completion_ref(req, m, c_put); 523 + kref_put(&req->kref, drbd_req_destroy); 536 524 } 537 525 538 526 static void drbd_report_io_error(struct drbd_device *device, struct drbd_request *req) ··· 1370 1366 } 1371 1367 1372 1368 out: 1373 - if (drbd_req_put_completion_ref(req, &m, 1)) 1374 - kref_put(&req->kref, drbd_req_destroy); 1369 + drbd_req_put_completion_ref(req, &m, 1); 1375 1370 spin_unlock_irq(&resource->req_lock); 1376 1371 1377 1372 /* Even though above is a kref_put(), this is safe.
+5 -3
drivers/block/xen-blkback/xenbus.c
··· 504 504 505 505 dev_set_drvdata(&dev->dev, NULL); 506 506 507 - if (be->blkif) 507 + if (be->blkif) { 508 508 xen_blkif_disconnect(be->blkif); 509 509 510 - /* Put the reference we set in xen_blkif_alloc(). */ 511 - xen_blkif_put(be->blkif); 510 + /* Put the reference we set in xen_blkif_alloc(). */ 511 + xen_blkif_put(be->blkif); 512 + } 513 + 512 514 kfree(be->mode); 513 515 kfree(be); 514 516 return 0;
+10
drivers/nvme/host/fc.c
··· 1754 1754 dev_info(ctrl->ctrl.device, 1755 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 1761 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RECONNECTING)) { 1758 1762 dev_err(ctrl->ctrl.device, 1759 1763 "NVME-FC{%d}: error_recovery: Couldn't change state " ··· 2723 2719 struct nvme_fc_ctrl *ctrl; 2724 2720 unsigned long flags; 2725 2721 int ret, idx; 2722 + 2723 + if (!(rport->remoteport.port_role & 2724 + (FC_PORT_ROLE_NVME_DISCOVERY | FC_PORT_ROLE_NVME_TARGET))) { 2725 + ret = -EBADR; 2726 + goto out_fail; 2727 + } 2726 2728 2727 2729 ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); 2728 2730 if (!ctrl) {
+6 -1
drivers/nvme/host/pci.c
··· 1506 1506 if (dev->cmb) { 1507 1507 iounmap(dev->cmb); 1508 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 ··· 1784 1779 { 1785 1780 struct pci_dev *pdev = to_pci_dev(dev->dev); 1786 1781 1782 + nvme_release_cmb(dev); 1787 1783 pci_free_irq_vectors(pdev); 1788 1784 1789 1785 if (pci_is_enabled(pdev)) { ··· 2190 2184 nvme_dev_disable(dev, true); 2191 2185 nvme_dev_remove_admin(dev); 2192 2186 nvme_free_queues(dev, 0); 2193 - nvme_release_cmb(dev); 2194 2187 nvme_release_prp_pools(dev); 2195 2188 nvme_dev_unmap(dev); 2196 2189 nvme_put_ctrl(&dev->ctrl);
+6
drivers/nvme/target/core.c
··· 529 529 } 530 530 EXPORT_SYMBOL_GPL(nvmet_req_init); 531 531 532 + void nvmet_req_uninit(struct nvmet_req *req) 533 + { 534 + percpu_ref_put(&req->sq->ref); 535 + } 536 + EXPORT_SYMBOL_GPL(nvmet_req_uninit); 537 + 532 538 static inline bool nvmet_cc_en(u32 cc) 533 539 { 534 540 return cc & 0x1;
+1 -3
drivers/nvme/target/fc.c
··· 517 517 { 518 518 int cpu, idx, cnt; 519 519 520 - if (!(tgtport->ops->target_features & 521 - NVMET_FCTGTFEAT_NEEDS_CMD_CPUSCHED) || 522 - tgtport->ops->max_hw_queues == 1) 520 + if (tgtport->ops->max_hw_queues == 1) 523 521 return WORK_CPU_UNBOUND; 524 522 525 523 /* Simple cpu selection based on qid modulo active cpu count */
-1
drivers/nvme/target/fcloop.c
··· 698 698 .dma_boundary = FCLOOP_DMABOUND_4G, 699 699 /* optional features */ 700 700 .target_features = NVMET_FCTGTFEAT_CMD_IN_ISR | 701 - NVMET_FCTGTFEAT_NEEDS_CMD_CPUSCHED | 702 701 NVMET_FCTGTFEAT_OPDONE_IN_ISR, 703 702 /* sizes of additional private data for data structures */ 704 703 .target_priv_sz = sizeof(struct fcloop_tport),
+1
drivers/nvme/target/nvmet.h
··· 261 261 262 262 bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq, 263 263 struct nvmet_sq *sq, struct nvmet_fabrics_ops *ops); 264 + void nvmet_req_uninit(struct nvmet_req *req); 264 265 void nvmet_req_complete(struct nvmet_req *req, u16 status); 265 266 266 267 void nvmet_cq_setup(struct nvmet_ctrl *ctrl, struct nvmet_cq *cq, u16 qid,
+1
drivers/nvme/target/rdma.c
··· 567 567 rsp->n_rdma = 0; 568 568 569 569 if (unlikely(wc->status != IB_WC_SUCCESS)) { 570 + nvmet_req_uninit(&rsp->req); 570 571 nvmet_rdma_release_rsp(rsp); 571 572 if (wc->status != IB_WC_WR_FLUSH_ERR) { 572 573 pr_info("RDMA READ for CQE 0x%p failed with status %s (%d).\n",
-1
drivers/scsi/lpfc/lpfc_nvmet.c
··· 764 764 lpfc_tgttemplate.max_sgl_segments = phba->cfg_nvme_seg_cnt + 1; 765 765 lpfc_tgttemplate.max_hw_queues = phba->cfg_nvme_io_channel; 766 766 lpfc_tgttemplate.target_features = NVMET_FCTGTFEAT_READDATA_RSP | 767 - NVMET_FCTGTFEAT_NEEDS_CMD_CPUSCHED | 768 767 NVMET_FCTGTFEAT_CMD_IN_ISR | 769 768 NVMET_FCTGTFEAT_OPDONE_IN_ISR; 770 769
+8 -1
fs/fuse/inode.c
··· 975 975 int err; 976 976 char *suffix = ""; 977 977 978 - if (sb->s_bdev) 978 + if (sb->s_bdev) { 979 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 987 err = super_setup_bdi_name(sb, "%u:%u%s", MAJOR(fc->dev), 981 988 MINOR(fc->dev), suffix); 982 989 if (err)
+4 -12
include/linux/nvme-fc-driver.h
··· 27 27 28 28 /* FC Port role bitmask - can merge with FC Port Roles in fc transport */ 29 29 #define FC_PORT_ROLE_NVME_INITIATOR 0x10 30 - #define FC_PORT_ROLE_NVME_TARGET 0x11 31 - #define FC_PORT_ROLE_NVME_DISCOVERY 0x12 30 + #define FC_PORT_ROLE_NVME_TARGET 0x20 31 + #define FC_PORT_ROLE_NVME_DISCOVERY 0x40 32 32 33 33 34 34 /** ··· 642 642 * sequence in one LLDD operation. Errors during Data 643 643 * sequence transmit must not allow RSP sequence to be sent. 644 644 */ 645 - NVMET_FCTGTFEAT_NEEDS_CMD_CPUSCHED = (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), 645 + NVMET_FCTGTFEAT_CMD_IN_ISR = (1 << 1), 654 646 /* Bit 2: When 0, the LLDD is calling the cmd rcv handler 655 647 * in a non-isr context, allowing the transport to finish 656 648 * op completion in the calling context. When 1, the LLDD ··· 650 658 * requiring the transport to transition to a workqueue 651 659 * for op completion. 652 660 */ 653 - NVMET_FCTGTFEAT_OPDONE_IN_ISR = (1 << 3), 661 + NVMET_FCTGTFEAT_OPDONE_IN_ISR = (1 << 2), 654 662 /* Bit 3: When 0, the LLDD is calling the op done handler 655 663 * in a non-isr context, allowing the transport to finish 656 664 * op completion in the calling context. When 1, the LLDD
+2 -2
kernel/trace/blktrace.c
··· 1662 1662 goto out; 1663 1663 1664 1664 if (attr == &dev_attr_act_mask) { 1665 - if (sscanf(buf, "%llx", &value) != 1) { 1665 + if (kstrtoull(buf, 0, &value)) { 1666 1666 /* Assume it is a list of trace category names */ 1667 1667 ret = blk_trace_str2mask(buf); 1668 1668 if (ret < 0) 1669 1669 goto out; 1670 1670 value = ret; 1671 1671 } 1672 - } else if (sscanf(buf, "%llu", &value) != 1) 1672 + } else if (kstrtoull(buf, 0, &value)) 1673 1673 goto out; 1674 1674 1675 1675 ret = -ENXIO;