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-20180309' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:

- a xen-blkfront fix from Bhavesh with a multiqueue fix when
detaching/re-attaching

- a few important NVMe fixes, including a revert for a sysfs fix that
caused some user space confusion

- two bcache fixes by way of Michael Lyle

- a loop regression fix, fixing an issue with lost writes on DAX.

* tag 'for-linus-20180309' of git://git.kernel.dk/linux-block:
loop: Fix lost writes caused by missing flag
nvme_fc: rework sqsize handling
nvme-fabrics: Ignore nr_io_queues option for discovery controllers
xen-blkfront: move negotiate_mq to cover all cases of new VBDs
Revert "nvme: create 'slaves' and 'holders' entries for hidden controllers"
bcache: don't attach backing with duplicate UUID
bcache: fix crashes in duplicate cache device register
nvme: pci: pass max vectors as num_possible_cpus() to pci_alloc_irq_vectors
nvme-pci: Fix EEH failure on ppc

+60 -73
+1 -1
drivers/block/loop.c
··· 266 266 struct iov_iter i; 267 267 ssize_t bw; 268 268 269 - iov_iter_bvec(&i, ITER_BVEC, bvec, 1, bvec->bv_len); 269 + iov_iter_bvec(&i, ITER_BVEC | WRITE, bvec, 1, bvec->bv_len); 270 270 271 271 file_start_write(file); 272 272 bw = vfs_iter_write(file, &i, ppos, 0);
+8 -9
drivers/block/xen-blkfront.c
··· 262 262 263 263 static int blkfront_setup_indirect(struct blkfront_ring_info *rinfo); 264 264 static void blkfront_gather_backend_features(struct blkfront_info *info); 265 + static int negotiate_mq(struct blkfront_info *info); 265 266 266 267 static int get_id_from_freelist(struct blkfront_ring_info *rinfo) 267 268 { ··· 1775 1774 unsigned int i, max_page_order; 1776 1775 unsigned int ring_page_order; 1777 1776 1777 + if (!info) 1778 + return -ENODEV; 1779 + 1778 1780 max_page_order = xenbus_read_unsigned(info->xbdev->otherend, 1779 1781 "max-ring-page-order", 0); 1780 1782 ring_page_order = min(xen_blkif_max_ring_order, max_page_order); 1781 1783 info->nr_ring_pages = 1 << ring_page_order; 1784 + 1785 + err = negotiate_mq(info); 1786 + if (err) 1787 + goto destroy_blkring; 1782 1788 1783 1789 for (i = 0; i < info->nr_rings; i++) { 1784 1790 struct blkfront_ring_info *rinfo = &info->rinfo[i]; ··· 1986 1978 } 1987 1979 1988 1980 info->xbdev = dev; 1989 - err = negotiate_mq(info); 1990 - if (err) { 1991 - kfree(info); 1992 - return err; 1993 - } 1994 1981 1995 1982 mutex_init(&info->mutex); 1996 1983 info->vdevice = vdevice; ··· 2101 2098 } 2102 2099 2103 2100 blkif_free(info, info->connected == BLKIF_STATE_CONNECTED); 2104 - 2105 - err = negotiate_mq(info); 2106 - if (err) 2107 - return err; 2108 2101 2109 2102 err = talk_to_blkback(dev, info); 2110 2103 if (!err)
+21 -6
drivers/md/bcache/super.c
··· 963 963 uint32_t rtime = cpu_to_le32(get_seconds()); 964 964 struct uuid_entry *u; 965 965 char buf[BDEVNAME_SIZE]; 966 + struct cached_dev *exist_dc, *t; 966 967 967 968 bdevname(dc->bdev, buf); 968 969 ··· 986 985 pr_err("Couldn't attach %s: block size less than set's block size", 987 986 buf); 988 987 return -EINVAL; 988 + } 989 + 990 + /* Check whether already attached */ 991 + list_for_each_entry_safe(exist_dc, t, &c->cached_devs, list) { 992 + if (!memcmp(dc->sb.uuid, exist_dc->sb.uuid, 16)) { 993 + pr_err("Tried to attach %s but duplicate UUID already attached", 994 + buf); 995 + 996 + return -EINVAL; 997 + } 989 998 } 990 999 991 1000 u = uuid_find(c, dc->sb.uuid); ··· 1215 1204 1216 1205 return; 1217 1206 err: 1218 - pr_notice("error opening %s: %s", bdevname(bdev, name), err); 1207 + pr_notice("error %s: %s", bdevname(bdev, name), err); 1219 1208 bcache_device_stop(&dc->disk); 1220 1209 } 1221 1210 ··· 1894 1883 const char *err = NULL; /* must be set for any error case */ 1895 1884 int ret = 0; 1896 1885 1886 + bdevname(bdev, name); 1887 + 1897 1888 memcpy(&ca->sb, sb, sizeof(struct cache_sb)); 1898 1889 ca->bdev = bdev; 1899 1890 ca->bdev->bd_holder = ca; ··· 1904 1891 bio_first_bvec_all(&ca->sb_bio)->bv_page = sb_page; 1905 1892 get_page(sb_page); 1906 1893 1907 - if (blk_queue_discard(bdev_get_queue(ca->bdev))) 1894 + if (blk_queue_discard(bdev_get_queue(bdev))) 1908 1895 ca->discard = CACHE_DISCARD(&ca->sb); 1909 1896 1910 1897 ret = cache_alloc(ca); 1911 1898 if (ret != 0) { 1899 + blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL); 1912 1900 if (ret == -ENOMEM) 1913 1901 err = "cache_alloc(): -ENOMEM"; 1914 1902 else ··· 1932 1918 goto out; 1933 1919 } 1934 1920 1935 - pr_info("registered cache device %s", bdevname(bdev, name)); 1921 + pr_info("registered cache device %s", name); 1936 1922 1937 1923 out: 1938 1924 kobject_put(&ca->kobj); 1939 1925 1940 1926 err: 1941 1927 if (err) 1942 - pr_notice("error opening %s: %s", bdevname(bdev, name), err); 1928 + pr_notice("error %s: %s", name, err); 1943 1929 1944 1930 return ret; 1945 1931 } ··· 2028 2014 if (err) 2029 2015 goto err_close; 2030 2016 2017 + err = "failed to register device"; 2031 2018 if (SB_IS_BDEV(sb)) { 2032 2019 struct cached_dev *dc = kzalloc(sizeof(*dc), GFP_KERNEL); 2033 2020 if (!dc) ··· 2043 2028 goto err_close; 2044 2029 2045 2030 if (register_cache(sb, sb_page, bdev, ca) != 0) 2046 - goto err_close; 2031 + goto err; 2047 2032 } 2048 2033 out: 2049 2034 if (sb_page) ··· 2056 2041 err_close: 2057 2042 blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL); 2058 2043 err: 2059 - pr_info("error opening %s: %s", path, err); 2044 + pr_info("error %s: %s", path, err); 2060 2045 ret = -EINVAL; 2061 2046 goto out; 2062 2047 }
-2
drivers/nvme/host/core.c
··· 3033 3033 ns->disk->disk_name); 3034 3034 3035 3035 nvme_mpath_add_disk(ns->head); 3036 - nvme_mpath_add_disk_links(ns); 3037 3036 return; 3038 3037 out_unlink_ns: 3039 3038 mutex_lock(&ctrl->subsys->lock); ··· 3052 3053 return; 3053 3054 3054 3055 if (ns->disk && ns->disk->flags & GENHD_FL_UP) { 3055 - nvme_mpath_remove_disk_links(ns); 3056 3056 sysfs_remove_group(&disk_to_dev(ns->disk)->kobj, 3057 3057 &nvme_ns_id_attr_group); 3058 3058 if (ns->ndev)
+5
drivers/nvme/host/fabrics.c
··· 650 650 ret = -EINVAL; 651 651 goto out; 652 652 } 653 + if (opts->discovery_nqn) { 654 + pr_debug("Ignoring nr_io_queues value for discovery controller\n"); 655 + break; 656 + } 657 + 653 658 opts->nr_io_queues = min_t(unsigned int, 654 659 num_online_cpus(), token); 655 660 break;
+17 -10
drivers/nvme/host/fc.c
··· 1206 1206 sizeof(struct fcnvme_lsdesc_cr_assoc_cmd)); 1207 1207 1208 1208 assoc_rqst->assoc_cmd.ersp_ratio = cpu_to_be16(ersp_ratio); 1209 - assoc_rqst->assoc_cmd.sqsize = cpu_to_be16(qsize); 1209 + assoc_rqst->assoc_cmd.sqsize = cpu_to_be16(qsize - 1); 1210 1210 /* Linux supports only Dynamic controllers */ 1211 1211 assoc_rqst->assoc_cmd.cntlid = cpu_to_be16(0xffff); 1212 1212 uuid_copy(&assoc_rqst->assoc_cmd.hostid, &ctrl->ctrl.opts->host->id); ··· 1321 1321 sizeof(struct fcnvme_lsdesc_cr_conn_cmd)); 1322 1322 conn_rqst->connect_cmd.ersp_ratio = cpu_to_be16(ersp_ratio); 1323 1323 conn_rqst->connect_cmd.qid = cpu_to_be16(queue->qnum); 1324 - conn_rqst->connect_cmd.sqsize = cpu_to_be16(qsize); 1324 + conn_rqst->connect_cmd.sqsize = cpu_to_be16(qsize - 1); 1325 1325 1326 1326 lsop->queue = queue; 1327 1327 lsreq->rqstaddr = conn_rqst; ··· 2481 2481 goto out_free_tag_set; 2482 2482 } 2483 2483 2484 - ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.opts->queue_size); 2484 + ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1); 2485 2485 if (ret) 2486 2486 goto out_cleanup_blk_queue; 2487 2487 2488 - ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.opts->queue_size); 2488 + ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1); 2489 2489 if (ret) 2490 2490 goto out_delete_hw_queues; 2491 2491 ··· 2532 2532 if (ret) 2533 2533 goto out_free_io_queues; 2534 2534 2535 - ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.opts->queue_size); 2535 + ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1); 2536 2536 if (ret) 2537 2537 goto out_free_io_queues; 2538 2538 2539 - ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.opts->queue_size); 2539 + ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1); 2540 2540 if (ret) 2541 2541 goto out_delete_hw_queues; 2542 2542 ··· 2632 2632 nvme_fc_init_queue(ctrl, 0); 2633 2633 2634 2634 ret = __nvme_fc_create_hw_queue(ctrl, &ctrl->queues[0], 0, 2635 - NVME_AQ_BLK_MQ_DEPTH); 2635 + NVME_AQ_DEPTH); 2636 2636 if (ret) 2637 2637 goto out_free_queue; 2638 2638 2639 2639 ret = nvme_fc_connect_admin_queue(ctrl, &ctrl->queues[0], 2640 - NVME_AQ_BLK_MQ_DEPTH, 2641 - (NVME_AQ_BLK_MQ_DEPTH / 4)); 2640 + NVME_AQ_DEPTH, (NVME_AQ_DEPTH / 4)); 2642 2641 if (ret) 2643 2642 goto out_delete_hw_queue; 2644 2643 ··· 2665 2666 } 2666 2667 2667 2668 ctrl->ctrl.sqsize = 2668 - min_t(int, NVME_CAP_MQES(ctrl->ctrl.cap) + 1, ctrl->ctrl.sqsize); 2669 + min_t(int, NVME_CAP_MQES(ctrl->ctrl.cap), ctrl->ctrl.sqsize); 2669 2670 2670 2671 ret = nvme_enable_ctrl(&ctrl->ctrl, ctrl->ctrl.cap); 2671 2672 if (ret) ··· 2696 2697 "to queue_size\n", 2697 2698 opts->queue_size, ctrl->ctrl.maxcmd); 2698 2699 opts->queue_size = ctrl->ctrl.maxcmd; 2700 + } 2701 + 2702 + if (opts->queue_size > ctrl->ctrl.sqsize + 1) { 2703 + /* warn if sqsize is lower than queue_size */ 2704 + dev_warn(ctrl->ctrl.device, 2705 + "queue_size %zu > ctrl sqsize %u, clamping down\n", 2706 + opts->queue_size, ctrl->ctrl.sqsize + 1); 2707 + opts->queue_size = ctrl->ctrl.sqsize + 1; 2699 2708 } 2700 2709 2701 2710 ret = nvme_fc_init_aen_ops(ctrl);
-30
drivers/nvme/host/multipath.c
··· 210 210 mutex_unlock(&head->subsys->lock); 211 211 } 212 212 213 - void nvme_mpath_add_disk_links(struct nvme_ns *ns) 214 - { 215 - struct kobject *slave_disk_kobj, *holder_disk_kobj; 216 - 217 - if (!ns->head->disk) 218 - return; 219 - 220 - slave_disk_kobj = &disk_to_dev(ns->disk)->kobj; 221 - if (sysfs_create_link(ns->head->disk->slave_dir, slave_disk_kobj, 222 - kobject_name(slave_disk_kobj))) 223 - return; 224 - 225 - holder_disk_kobj = &disk_to_dev(ns->head->disk)->kobj; 226 - if (sysfs_create_link(ns->disk->part0.holder_dir, holder_disk_kobj, 227 - kobject_name(holder_disk_kobj))) 228 - sysfs_remove_link(ns->head->disk->slave_dir, 229 - kobject_name(slave_disk_kobj)); 230 - } 231 - 232 213 void nvme_mpath_remove_disk(struct nvme_ns_head *head) 233 214 { 234 215 if (!head->disk) ··· 223 242 flush_work(&head->requeue_work); 224 243 blk_cleanup_queue(head->disk->queue); 225 244 put_disk(head->disk); 226 - } 227 - 228 - void nvme_mpath_remove_disk_links(struct nvme_ns *ns) 229 - { 230 - if (!ns->head->disk) 231 - return; 232 - 233 - sysfs_remove_link(ns->disk->part0.holder_dir, 234 - kobject_name(&disk_to_dev(ns->head->disk)->kobj)); 235 - sysfs_remove_link(ns->head->disk->slave_dir, 236 - kobject_name(&disk_to_dev(ns->disk)->kobj)); 237 245 }
-8
drivers/nvme/host/nvme.h
··· 410 410 void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl); 411 411 int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl,struct nvme_ns_head *head); 412 412 void nvme_mpath_add_disk(struct nvme_ns_head *head); 413 - void nvme_mpath_add_disk_links(struct nvme_ns *ns); 414 413 void nvme_mpath_remove_disk(struct nvme_ns_head *head); 415 - void nvme_mpath_remove_disk_links(struct nvme_ns *ns); 416 414 417 415 static inline void nvme_mpath_clear_current_path(struct nvme_ns *ns) 418 416 { ··· 450 452 { 451 453 } 452 454 static inline void nvme_mpath_remove_disk(struct nvme_ns_head *head) 453 - { 454 - } 455 - static inline void nvme_mpath_add_disk_links(struct nvme_ns *ns) 456 - { 457 - } 458 - static inline void nvme_mpath_remove_disk_links(struct nvme_ns *ns) 459 455 { 460 456 } 461 457 static inline void nvme_mpath_clear_current_path(struct nvme_ns *ns)
+8 -7
drivers/nvme/host/pci.c
··· 1153 1153 if (!(csts & NVME_CSTS_CFS) && !nssro) 1154 1154 return false; 1155 1155 1156 - /* If PCI error recovery process is happening, we cannot reset or 1157 - * the recovery mechanism will surely fail. 1158 - */ 1159 - if (pci_channel_offline(to_pci_dev(dev->dev))) 1160 - return false; 1161 - 1162 1156 return true; 1163 1157 } 1164 1158 ··· 1182 1188 struct request *abort_req; 1183 1189 struct nvme_command cmd; 1184 1190 u32 csts = readl(dev->bar + NVME_REG_CSTS); 1191 + 1192 + /* If PCI error recovery process is happening, we cannot reset or 1193 + * the recovery mechanism will surely fail. 1194 + */ 1195 + mb(); 1196 + if (pci_channel_offline(to_pci_dev(dev->dev))) 1197 + return BLK_EH_RESET_TIMER; 1185 1198 1186 1199 /* 1187 1200 * Reset immediately if the controller is failed ··· 1914 1913 int result, nr_io_queues; 1915 1914 unsigned long size; 1916 1915 1917 - nr_io_queues = num_present_cpus(); 1916 + nr_io_queues = num_possible_cpus(); 1918 1917 result = nvme_set_queue_count(&dev->ctrl, &nr_io_queues); 1919 1918 if (result < 0) 1920 1919 return result;