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

Pull block fixes from Jens Axboe:

- A set of patches fixing code comments / kerneldoc (Bart)

- Don't allow loop file change for exclusive open (Jan)

- Fix revalidate of hidden genhd (Jan)

- Init queue failure memory free fix (Jes)

- Improve rq limits failure print (John)

- Fixup for queue removal/addition (Ming)

- Missed error progagation for io_uring buffer registration (Pavel)

* tag 'for-linus-20190601' of git://git.kernel.dk/linux-block:
block: print offending values when cloned rq limits are exceeded
blk-mq: Document the blk_mq_hw_queue_to_node() arguments
blk-mq: Fix spelling in a source code comment
block: Fix bsg_setup_queue() kernel-doc header
block: Fix rq_qos_wait() kernel-doc header
block: Fix blk_mq_*_map_queues() kernel-doc headers
block: Fix throtl_pending_timer_fn() kernel-doc header
block: Convert blk_invalidate_devt() header into a non-kernel-doc header
block/partitions/ldm: Convert a kernel-doc header into a non-kernel-doc header
blk-mq: Fix memory leak in error handling
block: don't protect generic_make_request_checks with blk_queue_enter
block: move blk_exit_queue into __blk_release_queue
block: Don't revalidate bdev of hidden gendisk
loop: Don't change loop device under exclusive opener
io_uring: Fix __io_uring_register() false success

+102 -113
+11 -70
block/blk-core.c
··· 282 282 } 283 283 EXPORT_SYMBOL_GPL(blk_set_queue_dying); 284 284 285 - /* Unconfigure the I/O scheduler and dissociate from the cgroup controller. */ 286 - void blk_exit_queue(struct request_queue *q) 287 - { 288 - /* 289 - * Since the I/O scheduler exit code may access cgroup information, 290 - * perform I/O scheduler exit before disassociating from the block 291 - * cgroup controller. 292 - */ 293 - if (q->elevator) { 294 - ioc_clear_queue(q); 295 - elevator_exit(q, q->elevator); 296 - q->elevator = NULL; 297 - } 298 - 299 - /* 300 - * Remove all references to @q from the block cgroup controller before 301 - * restoring @q->queue_lock to avoid that restoring this pointer causes 302 - * e.g. blkcg_print_blkgs() to crash. 303 - */ 304 - blkcg_exit_queue(q); 305 - 306 - /* 307 - * Since the cgroup code may dereference the @q->backing_dev_info 308 - * pointer, only decrease its reference count after having removed the 309 - * association with the block cgroup controller. 310 - */ 311 - bdi_put(q->backing_dev_info); 312 - } 313 - 314 285 /** 315 286 * blk_cleanup_queue - shutdown a request queue 316 287 * @q: request queue to shutdown ··· 316 345 /* @q won't process any more request, flush async actions */ 317 346 del_timer_sync(&q->backing_dev_info->laptop_mode_wb_timer); 318 347 blk_sync_queue(q); 319 - 320 - /* 321 - * I/O scheduler exit is only safe after the sysfs scheduler attribute 322 - * has been removed. 323 - */ 324 - WARN_ON_ONCE(q->kobj.state_in_sysfs); 325 - 326 - blk_exit_queue(q); 327 348 328 349 if (queue_is_mq(q)) 329 350 blk_mq_exit_queue(q); ··· 957 994 * yet. 958 995 */ 959 996 struct bio_list bio_list_on_stack[2]; 960 - blk_mq_req_flags_t flags = 0; 961 - struct request_queue *q = bio->bi_disk->queue; 962 997 blk_qc_t ret = BLK_QC_T_NONE; 963 - 964 - if (bio->bi_opf & REQ_NOWAIT) 965 - flags = BLK_MQ_REQ_NOWAIT; 966 - if (bio_flagged(bio, BIO_QUEUE_ENTERED)) 967 - blk_queue_enter_live(q); 968 - else if (blk_queue_enter(q, flags) < 0) { 969 - if (!blk_queue_dying(q) && (bio->bi_opf & REQ_NOWAIT)) 970 - bio_wouldblock_error(bio); 971 - else 972 - bio_io_error(bio); 973 - return ret; 974 - } 975 998 976 999 if (!generic_make_request_checks(bio)) 977 1000 goto out; ··· 995 1046 bio_list_init(&bio_list_on_stack[0]); 996 1047 current->bio_list = bio_list_on_stack; 997 1048 do { 998 - bool enter_succeeded = true; 1049 + struct request_queue *q = bio->bi_disk->queue; 1050 + blk_mq_req_flags_t flags = bio->bi_opf & REQ_NOWAIT ? 1051 + BLK_MQ_REQ_NOWAIT : 0; 999 1052 1000 - if (unlikely(q != bio->bi_disk->queue)) { 1001 - if (q) 1002 - blk_queue_exit(q); 1003 - q = bio->bi_disk->queue; 1004 - flags = 0; 1005 - if (bio->bi_opf & REQ_NOWAIT) 1006 - flags = BLK_MQ_REQ_NOWAIT; 1007 - if (blk_queue_enter(q, flags) < 0) { 1008 - enter_succeeded = false; 1009 - q = NULL; 1010 - } 1011 - } 1012 - 1013 - if (enter_succeeded) { 1053 + if (likely(blk_queue_enter(q, flags) == 0)) { 1014 1054 struct bio_list lower, same; 1015 1055 1016 1056 /* Create a fresh bio_list for all subordinate requests */ 1017 1057 bio_list_on_stack[1] = bio_list_on_stack[0]; 1018 1058 bio_list_init(&bio_list_on_stack[0]); 1019 1059 ret = q->make_request_fn(q, bio); 1060 + 1061 + blk_queue_exit(q); 1020 1062 1021 1063 /* sort new bios into those for a lower level 1022 1064 * and those for the same level ··· 1035 1095 current->bio_list = NULL; /* deactivate */ 1036 1096 1037 1097 out: 1038 - if (q) 1039 - blk_queue_exit(q); 1040 1098 return ret; 1041 1099 } 1042 1100 EXPORT_SYMBOL(generic_make_request); ··· 1138 1200 struct request *rq) 1139 1201 { 1140 1202 if (blk_rq_sectors(rq) > blk_queue_get_max_sectors(q, req_op(rq))) { 1141 - printk(KERN_ERR "%s: over max size limit.\n", __func__); 1203 + printk(KERN_ERR "%s: over max size limit. (%u > %u)\n", 1204 + __func__, blk_rq_sectors(rq), 1205 + blk_queue_get_max_sectors(q, req_op(rq))); 1142 1206 return -EIO; 1143 1207 } 1144 1208 ··· 1152 1212 */ 1153 1213 blk_recalc_rq_segments(rq); 1154 1214 if (rq->nr_phys_segments > queue_max_segments(q)) { 1155 - printk(KERN_ERR "%s: over max segments limit.\n", __func__); 1215 + printk(KERN_ERR "%s: over max segments limit. (%hu > %hu)\n", 1216 + __func__, rq->nr_phys_segments, queue_max_segments(q)); 1156 1217 return -EIO; 1157 1218 } 1158 1219
+7 -3
block/blk-mq-cpumap.c
··· 42 42 /* 43 43 * First do sequential mapping between CPUs and queues. 44 44 * In case we still have CPUs to map, and we have some number of 45 - * threads per cores then map sibling threads to the same queue for 46 - * performace optimizations. 45 + * threads per cores then map sibling threads to the same queue 46 + * for performance optimizations. 47 47 */ 48 48 if (cpu < nr_queues) { 49 49 map[cpu] = cpu_to_queue_index(qmap, nr_queues, cpu); ··· 60 60 } 61 61 EXPORT_SYMBOL_GPL(blk_mq_map_queues); 62 62 63 - /* 63 + /** 64 + * blk_mq_hw_queue_to_node - Look up the memory node for a hardware queue index 65 + * @qmap: CPU to hardware queue map. 66 + * @index: hardware queue index. 67 + * 64 68 * We have no quick way of doing reverse lookups. This is only used at 65 69 * queue init time, so runtime isn't important. 66 70 */
+1 -1
block/blk-mq-pci.c
··· 13 13 14 14 /** 15 15 * blk_mq_pci_map_queues - provide a default queue mapping for PCI device 16 - * @set: tagset to provide the mapping for 16 + * @qmap: CPU to hardware queue map. 17 17 * @pdev: PCI device associated with @set. 18 18 * @offset: Offset to use for the pci irq vector 19 19 *
+2 -2
block/blk-mq-rdma.c
··· 8 8 9 9 /** 10 10 * blk_mq_rdma_map_queues - provide a default queue mapping for rdma device 11 - * @set: tagset to provide the mapping for 12 - * @dev: rdma device associated with @set. 11 + * @map: CPU to hardware queue map. 12 + * @dev: rdma device to provide a mapping for. 13 13 * @first_vec: first interrupt vectors to use for queues (usually 0) 14 14 * 15 15 * This function assumes the rdma device @dev has at least as many available
+2 -2
block/blk-mq-virtio.c
··· 11 11 12 12 /** 13 13 * blk_mq_virtio_map_queues - provide a default queue mapping for virtio device 14 - * @set: tagset to provide the mapping for 15 - * @vdev: virtio device associated with @set. 14 + * @qmap: CPU to hardware queue map. 15 + * @vdev: virtio device to provide a mapping for. 16 16 * @first_vec: first interrupt vectors to use for queues (usually 0) 17 17 * 18 18 * This function assumes the virtio device @vdev has at least as many available
+4 -1
block/blk-mq.c
··· 2865 2865 goto err_exit; 2866 2866 2867 2867 if (blk_mq_alloc_ctxs(q)) 2868 - goto err_exit; 2868 + goto err_poll; 2869 2869 2870 2870 /* init q->mq_kobj and sw queues' kobjects */ 2871 2871 blk_mq_sysfs_init(q); ··· 2929 2929 kfree(q->queue_hw_ctx); 2930 2930 err_sys_init: 2931 2931 blk_mq_sysfs_deinit(q); 2932 + err_poll: 2933 + blk_stat_free_callback(q->poll_cb); 2934 + q->poll_cb = NULL; 2932 2935 err_exit: 2933 2936 q->mq_ops = NULL; 2934 2937 return ERR_PTR(-ENOMEM);
+4 -3
block/blk-rq-qos.c
··· 209 209 210 210 /** 211 211 * rq_qos_wait - throttle on a rqw if we need to 212 - * @private_data - caller provided specific data 213 - * @acquire_inflight_cb - inc the rqw->inflight counter if we can 214 - * @cleanup_cb - the callback to cleanup in case we race with a waker 212 + * @rqw: rqw to throttle on 213 + * @private_data: caller provided specific data 214 + * @acquire_inflight_cb: inc the rqw->inflight counter if we can 215 + * @cleanup_cb: the callback to cleanup in case we race with a waker 215 216 * 216 217 * This provides a uniform place for the rq_qos users to do their throttling. 217 218 * Since you can end up with a lot of things sleeping at once, this manages the
+32 -15
block/blk-sysfs.c
··· 840 840 kmem_cache_free(blk_requestq_cachep, q); 841 841 } 842 842 843 + /* Unconfigure the I/O scheduler and dissociate from the cgroup controller. */ 844 + static void blk_exit_queue(struct request_queue *q) 845 + { 846 + /* 847 + * Since the I/O scheduler exit code may access cgroup information, 848 + * perform I/O scheduler exit before disassociating from the block 849 + * cgroup controller. 850 + */ 851 + if (q->elevator) { 852 + ioc_clear_queue(q); 853 + elevator_exit(q, q->elevator); 854 + q->elevator = NULL; 855 + } 856 + 857 + /* 858 + * Remove all references to @q from the block cgroup controller before 859 + * restoring @q->queue_lock to avoid that restoring this pointer causes 860 + * e.g. blkcg_print_blkgs() to crash. 861 + */ 862 + blkcg_exit_queue(q); 863 + 864 + /* 865 + * Since the cgroup code may dereference the @q->backing_dev_info 866 + * pointer, only decrease its reference count after having removed the 867 + * association with the block cgroup controller. 868 + */ 869 + bdi_put(q->backing_dev_info); 870 + } 871 + 872 + 843 873 /** 844 874 * __blk_release_queue - release a request queue 845 875 * @work: pointer to the release_work member of the request queue to be released ··· 890 860 blk_stat_remove_callback(q, q->poll_cb); 891 861 blk_stat_free_callback(q->poll_cb); 892 862 893 - if (!blk_queue_dead(q)) { 894 - /* 895 - * Last reference was dropped without having called 896 - * blk_cleanup_queue(). 897 - */ 898 - WARN_ONCE(blk_queue_init_done(q), 899 - "request queue %p has been registered but blk_cleanup_queue() has not been called for that queue\n", 900 - q); 901 - blk_exit_queue(q); 902 - } 903 - 904 - WARN(blk_queue_root_blkg(q), 905 - "request queue %p is being released but it has not yet been removed from the blkcg controller\n", 906 - q); 907 - 908 863 blk_free_queue_stats(q->stats); 864 + 865 + blk_exit_queue(q); 909 866 910 867 blk_queue_free_zone_bitmaps(q); 911 868
+1 -1
block/blk-throttle.c
··· 1220 1220 struct throtl_grp *this_tg); 1221 1221 /** 1222 1222 * throtl_pending_timer_fn - timer function for service_queue->pending_timer 1223 - * @arg: the throtl_service_queue being serviced 1223 + * @t: the pending_timer member of the throtl_service_queue being serviced 1224 1224 * 1225 1225 * This timer is armed when a child throtl_grp with active bio's become 1226 1226 * pending and queued on the service_queue's pending_tree and expires when
-1
block/blk.h
··· 50 50 int node, int cmd_size, gfp_t flags); 51 51 void blk_free_flush_queue(struct blk_flush_queue *q); 52 52 53 - void blk_exit_queue(struct request_queue *q); 54 53 void blk_rq_bio_prep(struct request_queue *q, struct request *rq, 55 54 struct bio *bio); 56 55 void blk_freeze_queue(struct request_queue *q);
+1
block/bsg-lib.c
··· 354 354 * @dev: device to attach bsg device to 355 355 * @name: device to give bsg device 356 356 * @job_fn: bsg job handler 357 + * @timeout: timeout handler function pointer 357 358 * @dd_job_size: size of LLD data needed for each job 358 359 */ 359 360 struct request_queue *bsg_setup_queue(struct device *dev, const char *name,
+2 -2
block/genhd.c
··· 532 532 } 533 533 } 534 534 535 - /** 536 - * We invalidate devt by assigning NULL pointer for devt in idr. 535 + /* 536 + * We invalidate devt by assigning NULL pointer for devt in idr. 537 537 */ 538 538 void blk_invalidate_devt(dev_t devt) 539 539 {
+1 -1
block/partitions/ldm.c
··· 19 19 #include "check.h" 20 20 #include "msdos.h" 21 21 22 - /** 22 + /* 23 23 * ldm_debug/info/error/crit - Output an error message 24 24 * @f: A printf format string containing the message 25 25 * @...: Variables to substitute into @f
+17 -1
drivers/block/loop.c
··· 945 945 if (!file) 946 946 goto out; 947 947 948 + /* 949 + * If we don't hold exclusive handle for the device, upgrade to it 950 + * here to avoid changing device under exclusive owner. 951 + */ 952 + if (!(mode & FMODE_EXCL)) { 953 + bdgrab(bdev); 954 + error = blkdev_get(bdev, mode | FMODE_EXCL, loop_set_fd); 955 + if (error) 956 + goto out_putf; 957 + } 958 + 948 959 error = mutex_lock_killable(&loop_ctl_mutex); 949 960 if (error) 950 - goto out_putf; 961 + goto out_bdev; 951 962 952 963 error = -EBUSY; 953 964 if (lo->lo_state != Lo_unbound) ··· 1023 1012 mutex_unlock(&loop_ctl_mutex); 1024 1013 if (partscan) 1025 1014 loop_reread_partitions(lo, bdev); 1015 + if (!(mode & FMODE_EXCL)) 1016 + blkdev_put(bdev, mode | FMODE_EXCL); 1026 1017 return 0; 1027 1018 1028 1019 out_unlock: 1029 1020 mutex_unlock(&loop_ctl_mutex); 1021 + out_bdev: 1022 + if (!(mode & FMODE_EXCL)) 1023 + blkdev_put(bdev, mode | FMODE_EXCL); 1030 1024 out_putf: 1031 1025 fput(file); 1032 1026 out:
+16 -9
fs/block_dev.c
··· 1406 1406 */ 1407 1407 int revalidate_disk(struct gendisk *disk) 1408 1408 { 1409 - struct block_device *bdev; 1410 1409 int ret = 0; 1411 1410 1412 1411 if (disk->fops->revalidate_disk) 1413 1412 ret = disk->fops->revalidate_disk(disk); 1414 - bdev = bdget_disk(disk, 0); 1415 - if (!bdev) 1416 - return ret; 1417 1413 1418 - mutex_lock(&bdev->bd_mutex); 1419 - check_disk_size_change(disk, bdev, ret == 0); 1420 - bdev->bd_invalidated = 0; 1421 - mutex_unlock(&bdev->bd_mutex); 1422 - bdput(bdev); 1414 + /* 1415 + * Hidden disks don't have associated bdev so there's no point in 1416 + * revalidating it. 1417 + */ 1418 + if (!(disk->flags & GENHD_FL_HIDDEN)) { 1419 + struct block_device *bdev = bdget_disk(disk, 0); 1420 + 1421 + if (!bdev) 1422 + return ret; 1423 + 1424 + mutex_lock(&bdev->bd_mutex); 1425 + check_disk_size_change(disk, bdev, ret == 0); 1426 + bdev->bd_invalidated = 0; 1427 + mutex_unlock(&bdev->bd_mutex); 1428 + bdput(bdev); 1429 + } 1423 1430 return ret; 1424 1431 } 1425 1432 EXPORT_SYMBOL(revalidate_disk);
+1 -1
fs/io_uring.c
··· 2616 2616 2617 2617 ret = io_copy_iov(ctx, &iov, arg, i); 2618 2618 if (ret) 2619 - break; 2619 + goto err; 2620 2620 2621 2621 /* 2622 2622 * Don't impose further limits on the size and buffer