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

Pull block fixes from Jens Axboe:

- NVMe pull request from Christoph, fixing namespace locking when
dealing with the effects log, and a rapid add/remove issue (Keith)

- blktrace tweak, ensuring requests with -1 sectors are shown (Jan)

- link power management quirk for a Smasung SSD (Hans)

- m68k nfblock dynamic major number fix (Chengguang)

- series fixing blk-iolatency inflight counter issue (Liu)

- ensure that we clear ->private when setting up the aio kiocb (Mike)

- __find_get_block_slow() rate limit print (Tetsuo)

* tag 'for-linus-20190209' of git://git.kernel.dk/linux-block:
blk-mq: remove duplicated definition of blk_mq_freeze_queue
Blk-iolatency: warn on negative inflight IO counter
blk-iolatency: fix IO hang due to negative inflight counter
blktrace: Show requests without sector
fs: ratelimit __find_get_block_slow() failure message.
m68k: set proper major_num when specifying module param major_num
libata: Add NOLPM quirk for SAMSUNG MZ7TE512HMHP-000L1 SSD
nvme-pci: fix rapid add remove sequence
nvme: lock NS list changes while handling command effects
aio: initialize kiocb private in case any filesystems expect it.

+94 -33
+7 -3
arch/m68k/emu/nfblock.c
··· 155 155 static int __init nfhd_init(void) 156 156 { 157 157 u32 blocks, bsize; 158 + int ret; 158 159 int i; 159 160 160 161 nfhd_id = nf_get_id("XHDI"); 161 162 if (!nfhd_id) 162 163 return -ENODEV; 163 164 164 - major_num = register_blkdev(major_num, "nfhd"); 165 - if (major_num <= 0) { 165 + ret = register_blkdev(major_num, "nfhd"); 166 + if (ret < 0) { 166 167 pr_warn("nfhd: unable to get major number\n"); 167 - return major_num; 168 + return ret; 168 169 } 170 + 171 + if (!major_num) 172 + major_num = ret; 169 173 170 174 for (i = NFHD_DEV_OFFSET; i < 24; i++) { 171 175 if (nfhd_get_capacity(i, 0, &blocks, &bsize))
+48 -8
block/blk-iolatency.c
··· 72 72 #include <linux/sched/loadavg.h> 73 73 #include <linux/sched/signal.h> 74 74 #include <trace/events/block.h> 75 + #include <linux/blk-mq.h> 75 76 #include "blk-rq-qos.h" 76 77 #include "blk-stat.h" 77 78 ··· 592 591 u64 now = ktime_to_ns(ktime_get()); 593 592 bool issue_as_root = bio_issue_as_root_blkg(bio); 594 593 bool enabled = false; 594 + int inflight = 0; 595 595 596 596 blkg = bio->bi_blkg; 597 597 if (!blkg || !bio_flagged(bio, BIO_TRACKED)) ··· 603 601 return; 604 602 605 603 enabled = blk_iolatency_enabled(iolat->blkiolat); 604 + if (!enabled) 605 + return; 606 + 606 607 while (blkg && blkg->parent) { 607 608 iolat = blkg_to_lat(blkg); 608 609 if (!iolat) { ··· 614 609 } 615 610 rqw = &iolat->rq_wait; 616 611 617 - atomic_dec(&rqw->inflight); 618 - if (!enabled || iolat->min_lat_nsec == 0) 612 + inflight = atomic_dec_return(&rqw->inflight); 613 + WARN_ON_ONCE(inflight < 0); 614 + if (iolat->min_lat_nsec == 0) 619 615 goto next; 620 616 iolatency_record_time(iolat, &bio->bi_issue, now, 621 617 issue_as_root); ··· 760 754 return 0; 761 755 } 762 756 763 - static void iolatency_set_min_lat_nsec(struct blkcg_gq *blkg, u64 val) 757 + /* 758 + * return 1 for enabling iolatency, return -1 for disabling iolatency, otherwise 759 + * return 0. 760 + */ 761 + static int iolatency_set_min_lat_nsec(struct blkcg_gq *blkg, u64 val) 764 762 { 765 763 struct iolatency_grp *iolat = blkg_to_lat(blkg); 766 - struct blk_iolatency *blkiolat = iolat->blkiolat; 767 764 u64 oldval = iolat->min_lat_nsec; 768 765 769 766 iolat->min_lat_nsec = val; ··· 775 766 BLKIOLATENCY_MAX_WIN_SIZE); 776 767 777 768 if (!oldval && val) 778 - atomic_inc(&blkiolat->enabled); 769 + return 1; 779 770 if (oldval && !val) 780 - atomic_dec(&blkiolat->enabled); 771 + return -1; 772 + return 0; 781 773 } 782 774 783 775 static void iolatency_clear_scaling(struct blkcg_gq *blkg) ··· 810 800 u64 lat_val = 0; 811 801 u64 oldval; 812 802 int ret; 803 + int enable = 0; 813 804 814 805 ret = blkg_conf_prep(blkcg, &blkcg_policy_iolatency, buf, &ctx); 815 806 if (ret) ··· 845 834 blkg = ctx.blkg; 846 835 oldval = iolat->min_lat_nsec; 847 836 848 - iolatency_set_min_lat_nsec(blkg, lat_val); 837 + enable = iolatency_set_min_lat_nsec(blkg, lat_val); 838 + if (enable) { 839 + WARN_ON_ONCE(!blk_get_queue(blkg->q)); 840 + blkg_get(blkg); 841 + } 842 + 849 843 if (oldval != iolat->min_lat_nsec) { 850 844 iolatency_clear_scaling(blkg); 851 845 } ··· 858 842 ret = 0; 859 843 out: 860 844 blkg_conf_finish(&ctx); 845 + if (ret == 0 && enable) { 846 + struct iolatency_grp *tmp = blkg_to_lat(blkg); 847 + struct blk_iolatency *blkiolat = tmp->blkiolat; 848 + 849 + blk_mq_freeze_queue(blkg->q); 850 + 851 + if (enable == 1) 852 + atomic_inc(&blkiolat->enabled); 853 + else if (enable == -1) 854 + atomic_dec(&blkiolat->enabled); 855 + else 856 + WARN_ON_ONCE(1); 857 + 858 + blk_mq_unfreeze_queue(blkg->q); 859 + 860 + blkg_put(blkg); 861 + blk_put_queue(blkg->q); 862 + } 861 863 return ret ?: nbytes; 862 864 } 863 865 ··· 1011 977 { 1012 978 struct iolatency_grp *iolat = pd_to_lat(pd); 1013 979 struct blkcg_gq *blkg = lat_to_blkg(iolat); 980 + struct blk_iolatency *blkiolat = iolat->blkiolat; 981 + int ret; 1014 982 1015 - iolatency_set_min_lat_nsec(blkg, 0); 983 + ret = iolatency_set_min_lat_nsec(blkg, 0); 984 + if (ret == 1) 985 + atomic_inc(&blkiolat->enabled); 986 + if (ret == -1) 987 + atomic_dec(&blkiolat->enabled); 1016 988 iolatency_clear_scaling(blkg); 1017 989 } 1018 990
-1
block/blk-mq.h
··· 36 36 struct kobject kobj; 37 37 } ____cacheline_aligned_in_smp; 38 38 39 - void blk_mq_freeze_queue(struct request_queue *q); 40 39 void blk_mq_free_queue(struct request_queue *q); 41 40 int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr); 42 41 void blk_mq_wake_waiters(struct request_queue *q);
+1
drivers/ata/libata-core.c
··· 4554 4554 { "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_HORKAGE_NOLPM, }, 4555 4555 { "SAMSUNG SSD PM830 mSATA *", "CXM13D1Q", ATA_HORKAGE_NOLPM, }, 4556 4556 { "SAMSUNG MZ7TD256HAFV-000L9", NULL, ATA_HORKAGE_NOLPM, }, 4557 + { "SAMSUNG MZ7TE512HMHP-000L1", "EXT06L0Q", ATA_HORKAGE_NOLPM, }, 4557 4558 4558 4559 /* devices that don't properly handle queued TRIM commands */ 4559 4560 { "Micron_M500IT_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM |
+7 -1
drivers/nvme/host/core.c
··· 1253 1253 * effects say only one namespace is affected. 1254 1254 */ 1255 1255 if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) { 1256 + mutex_lock(&ctrl->scan_lock); 1256 1257 nvme_start_freeze(ctrl); 1257 1258 nvme_wait_freeze(ctrl); 1258 1259 } ··· 1282 1281 */ 1283 1282 if (effects & NVME_CMD_EFFECTS_LBCC) 1284 1283 nvme_update_formats(ctrl); 1285 - if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) 1284 + if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) { 1286 1285 nvme_unfreeze(ctrl); 1286 + mutex_unlock(&ctrl->scan_lock); 1287 + } 1287 1288 if (effects & NVME_CMD_EFFECTS_CCC) 1288 1289 nvme_init_identify(ctrl); 1289 1290 if (effects & (NVME_CMD_EFFECTS_NIC | NVME_CMD_EFFECTS_NCC)) ··· 3404 3401 if (nvme_identify_ctrl(ctrl, &id)) 3405 3402 return; 3406 3403 3404 + mutex_lock(&ctrl->scan_lock); 3407 3405 nn = le32_to_cpu(id->nn); 3408 3406 if (ctrl->vs >= NVME_VS(1, 1, 0) && 3409 3407 !(ctrl->quirks & NVME_QUIRK_IDENTIFY_CNS)) { ··· 3413 3409 } 3414 3410 nvme_scan_ns_sequential(ctrl, nn); 3415 3411 out_free_id: 3412 + mutex_unlock(&ctrl->scan_lock); 3416 3413 kfree(id); 3417 3414 down_write(&ctrl->namespaces_rwsem); 3418 3415 list_sort(NULL, &ctrl->namespaces, ns_cmp); ··· 3657 3652 3658 3653 ctrl->state = NVME_CTRL_NEW; 3659 3654 spin_lock_init(&ctrl->lock); 3655 + mutex_init(&ctrl->scan_lock); 3660 3656 INIT_LIST_HEAD(&ctrl->namespaces); 3661 3657 init_rwsem(&ctrl->namespaces_rwsem); 3662 3658 ctrl->dev = dev;
+1
drivers/nvme/host/nvme.h
··· 154 154 enum nvme_ctrl_state state; 155 155 bool identified; 156 156 spinlock_t lock; 157 + struct mutex scan_lock; 157 158 const struct nvme_ctrl_ops *ops; 158 159 struct request_queue *admin_q; 159 160 struct request_queue *connect_q;
+12 -10
drivers/nvme/host/pci.c
··· 2557 2557 if (dev->ctrl.ctrl_config & NVME_CC_ENABLE) 2558 2558 nvme_dev_disable(dev, false); 2559 2559 2560 - /* 2561 - * Introduce CONNECTING state from nvme-fc/rdma transports to mark the 2562 - * initializing procedure here. 2563 - */ 2564 - if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_CONNECTING)) { 2565 - dev_warn(dev->ctrl.device, 2566 - "failed to mark controller CONNECTING\n"); 2567 - goto out; 2568 - } 2569 - 2560 + mutex_lock(&dev->shutdown_lock); 2570 2561 result = nvme_pci_enable(dev); 2571 2562 if (result) 2572 2563 goto out; ··· 2576 2585 */ 2577 2586 dev->ctrl.max_hw_sectors = NVME_MAX_KB_SZ << 1; 2578 2587 dev->ctrl.max_segments = NVME_MAX_SEGS; 2588 + mutex_unlock(&dev->shutdown_lock); 2589 + 2590 + /* 2591 + * Introduce CONNECTING state from nvme-fc/rdma transports to mark the 2592 + * initializing procedure here. 2593 + */ 2594 + if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_CONNECTING)) { 2595 + dev_warn(dev->ctrl.device, 2596 + "failed to mark controller CONNECTING\n"); 2597 + goto out; 2598 + } 2579 2599 2580 2600 result = nvme_init_identify(&dev->ctrl); 2581 2601 if (result)
+1
fs/aio.c
··· 1436 1436 if (unlikely(!req->ki_filp)) 1437 1437 return -EBADF; 1438 1438 req->ki_complete = aio_complete_rw; 1439 + req->private = NULL; 1439 1440 req->ki_pos = iocb->aio_offset; 1440 1441 req->ki_flags = iocb_flags(req->ki_filp); 1441 1442 if (iocb->aio_flags & IOCB_FLAG_RESFD)
+10 -9
fs/buffer.c
··· 200 200 struct buffer_head *head; 201 201 struct page *page; 202 202 int all_mapped = 1; 203 + static DEFINE_RATELIMIT_STATE(last_warned, HZ, 1); 203 204 204 205 index = block >> (PAGE_SHIFT - bd_inode->i_blkbits); 205 206 page = find_get_page_flags(bd_mapping, index, FGP_ACCESSED); ··· 228 227 * file io on the block device and getblk. It gets dealt with 229 228 * elsewhere, don't buffer_error if we had some unmapped buffers 230 229 */ 231 - if (all_mapped) { 232 - printk("__find_get_block_slow() failed. " 233 - "block=%llu, b_blocknr=%llu\n", 234 - (unsigned long long)block, 235 - (unsigned long long)bh->b_blocknr); 236 - printk("b_state=0x%08lx, b_size=%zu\n", 237 - bh->b_state, bh->b_size); 238 - printk("device %pg blocksize: %d\n", bdev, 239 - 1 << bd_inode->i_blkbits); 230 + ratelimit_set_flags(&last_warned, RATELIMIT_MSG_ON_RELEASE); 231 + if (all_mapped && __ratelimit(&last_warned)) { 232 + printk("__find_get_block_slow() failed. block=%llu, " 233 + "b_blocknr=%llu, b_state=0x%08lx, b_size=%zu, " 234 + "device %pg blocksize: %d\n", 235 + (unsigned long long)block, 236 + (unsigned long long)bh->b_blocknr, 237 + bh->b_state, bh->b_size, bdev, 238 + 1 << bd_inode->i_blkbits); 240 239 } 241 240 out_unlock: 242 241 spin_unlock(&bd_mapping->private_lock);
+7 -1
include/linux/blktrace_api.h
··· 116 116 117 117 static inline sector_t blk_rq_trace_sector(struct request *rq) 118 118 { 119 - return blk_rq_is_passthrough(rq) ? 0 : blk_rq_pos(rq); 119 + /* 120 + * Tracing should ignore starting sector for passthrough requests and 121 + * requests where starting sector didn't get set. 122 + */ 123 + if (blk_rq_is_passthrough(rq) || blk_rq_pos(rq) == (sector_t)-1) 124 + return 0; 125 + return blk_rq_pos(rq); 120 126 } 121 127 122 128 static inline unsigned int blk_rq_trace_nr_sectors(struct request *rq)