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 tag 'for-linus-20180511' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:
"Just a few NVMe fixes this round - one fixing a use-after-free, one
fixes the return value after controller reset, and the last one fixes
an issue where some drives will spuriously EIO. We should get these
into 4.17"

* tag 'for-linus-20180511' of git://git.kernel.dk/linux-block:
nvme: add quirk to force medium priority for SQ creation
nvme: Fix sync controller reset return
nvme: fix use-after-free in nvme_free_ns_head

+23 -2
+7 -1
drivers/nvme/host/core.c
··· 99 99 100 100 static void nvme_ns_remove(struct nvme_ns *ns); 101 101 static int nvme_revalidate_disk(struct gendisk *disk); 102 + static void nvme_put_subsystem(struct nvme_subsystem *subsys); 102 103 103 104 int nvme_reset_ctrl(struct nvme_ctrl *ctrl) 104 105 { ··· 118 117 ret = nvme_reset_ctrl(ctrl); 119 118 if (!ret) { 120 119 flush_work(&ctrl->reset_work); 121 - if (ctrl->state != NVME_CTRL_LIVE) 120 + if (ctrl->state != NVME_CTRL_LIVE && 121 + ctrl->state != NVME_CTRL_ADMIN_ONLY) 122 122 ret = -ENETRESET; 123 123 } 124 124 ··· 352 350 ida_simple_remove(&head->subsys->ns_ida, head->instance); 353 351 list_del_init(&head->entry); 354 352 cleanup_srcu_struct(&head->srcu); 353 + nvme_put_subsystem(head->subsys); 355 354 kfree(head); 356 355 } 357 356 ··· 2864 2861 goto out_cleanup_srcu; 2865 2862 2866 2863 list_add_tail(&head->entry, &ctrl->subsys->nsheads); 2864 + 2865 + kref_get(&ctrl->subsys->ref); 2866 + 2867 2867 return head; 2868 2868 out_cleanup_srcu: 2869 2869 cleanup_srcu_struct(&head->srcu);
+5
drivers/nvme/host/nvme.h
··· 84 84 * Supports the LighNVM command set if indicated in vs[1]. 85 85 */ 86 86 NVME_QUIRK_LIGHTNVM = (1 << 6), 87 + 88 + /* 89 + * Set MEDIUM priority on SQ creation 90 + */ 91 + NVME_QUIRK_MEDIUM_PRIO_SQ = (1 << 7), 87 92 }; 88 93 89 94 /*
+11 -1
drivers/nvme/host/pci.c
··· 1093 1093 static int adapter_alloc_sq(struct nvme_dev *dev, u16 qid, 1094 1094 struct nvme_queue *nvmeq) 1095 1095 { 1096 + struct nvme_ctrl *ctrl = &dev->ctrl; 1096 1097 struct nvme_command c; 1097 1098 int flags = NVME_QUEUE_PHYS_CONTIG; 1099 + 1100 + /* 1101 + * Some drives have a bug that auto-enables WRRU if MEDIUM isn't 1102 + * set. Since URGENT priority is zeroes, it makes all queues 1103 + * URGENT. 1104 + */ 1105 + if (ctrl->quirks & NVME_QUIRK_MEDIUM_PRIO_SQ) 1106 + flags |= NVME_SQ_PRIO_MEDIUM; 1098 1107 1099 1108 /* 1100 1109 * Note: we (ab)use the fact that the prp fields survive if no data ··· 2710 2701 .driver_data = NVME_QUIRK_STRIPE_SIZE | 2711 2702 NVME_QUIRK_DEALLOCATE_ZEROES, }, 2712 2703 { PCI_VDEVICE(INTEL, 0xf1a5), /* Intel 600P/P3100 */ 2713 - .driver_data = NVME_QUIRK_NO_DEEPEST_PS }, 2704 + .driver_data = NVME_QUIRK_NO_DEEPEST_PS | 2705 + NVME_QUIRK_MEDIUM_PRIO_SQ }, 2714 2706 { PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */ 2715 2707 .driver_data = NVME_QUIRK_IDENTIFY_CNS, }, 2716 2708 { PCI_DEVICE(0x1c58, 0x0003), /* HGST adapter */