History

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.

Linus Torvalds committed 7 years ago

Commit e5a8a112 parents 5610789 269848410 files · +94 −33Browse files

Unified · Split

10 files
  1. arch/m68k/emu/nfblock.c +7 −3
  2. block/blk-iolatency.c +48 −8
  3. block/blk-mq.h +0 −1
  4. drivers/ata/libata-core.c +1 −0
  5. drivers/nvme/host/core.c +7 −1
  6. drivers/nvme/host/nvme.h +1 −0
  7. drivers/nvme/host/pci.c +12 −10
  8. fs/aio.c +1 −0
  9. fs/buffer.c +10 −9
  10. include/linux/blktrace_api.h +7 −1
arch/m68k/emu/nfblock.c+7−3
@@ -155,18 +155,22 @@ out: · 154 unmodified lines
155155 static int __init nfhd_init(void)
156156 {
157157 u32 blocks, bsize;
158+ int ret;
158159 int i;
159160
160161 nfhd_id = nf_get_id("XHDI");
161162 if (!nfhd_id)
162163 return -ENODEV;
163164
164− major_num = register_blkdev(major_num, "nfhd");
165− if (major_num <= 0) {
165+ ret = register_blkdev(major_num, "nfhd");
166+ if (ret < 0) {
166167 pr_warn("nfhd: unable to get major number\n");
167− return major_num;
168+ return ret;
168169 }
169170
171+ if (!major_num)
172+ major_num = ret;
173+
170174 for (i = NFHD_DEV_OFFSET; i < 24; i++) {
171175 if (nfhd_get_capacity(i, 0, &blocks, &bsize))
172176 continue;
block/blk-iolatency.c+48−8
@@ -72,6 +72,7 @@ · 71 unmodified lines
7272 #include <linux/sched/loadavg.h>
7373 #include <linux/sched/signal.h>
7474 #include <trace/events/block.h>
75+#include <linux/blk-mq.h>
7576 #include "blk-rq-qos.h"
7677 #include "blk-stat.h"
7778
@@ -591,6 +592,7 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio) · 513 unmodified lines
591592 u64 now = ktime_to_ns(ktime_get());
592593 bool issue_as_root = bio_issue_as_root_blkg(bio);
593594 bool enabled = false;
595+ int inflight = 0;
594596
595597 blkg = bio->bi_blkg;
596598 if (!blkg || !bio_flagged(bio, BIO_TRACKED))
@@ -601,6 +603,9 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio) · 4 unmodified lines
601603 return;
602604
603605 enabled = blk_iolatency_enabled(iolat->blkiolat);
606+ if (!enabled)
607+ return;
608+
604609 while (blkg && blkg->parent) {
605610 iolat = blkg_to_lat(blkg);
606611 if (!iolat) {
@@ -609,8 +614,9 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio) · 2 unmodified lines
609614 }
610615 rqw = &iolat->rq_wait;
611616
612− atomic_dec(&rqw->inflight);
613− if (!enabled || iolat->min_lat_nsec == 0)
617+ inflight = atomic_dec_return(&rqw->inflight);
618+ WARN_ON_ONCE(inflight < 0);
619+ if (iolat->min_lat_nsec == 0)
614620 goto next;
615621 iolatency_record_time(iolat, &bio->bi_issue, now,
616622 issue_as_root);
@@ -754,10 +760,13 @@ int blk_iolatency_init(struct request_queue *q) · 137 unmodified lines
754760 return 0;
755761 }
756762
757−static void iolatency_set_min_lat_nsec(struct blkcg_gq *blkg, u64 val)
763+/*
764+ * return 1 for enabling iolatency, return -1 for disabling iolatency, otherwise
765+ * return 0.
766+ */
767+static int iolatency_set_min_lat_nsec(struct blkcg_gq *blkg, u64 val)
758768 {
759769 struct iolatency_grp *iolat = blkg_to_lat(blkg);
760− struct blk_iolatency *blkiolat = iolat->blkiolat;
761770 u64 oldval = iolat->min_lat_nsec;
762771
763772 iolat->min_lat_nsec = val;
@@ -766,9 +775,10 @@ static void iolatency_set_min_lat_nsec(struct blkcg_gq *blkg, u64 val) · 2 unmodified lines
766775 BLKIOLATENCY_MAX_WIN_SIZE);
767776
768777 if (!oldval && val)
769− atomic_inc(&blkiolat->enabled);
778+ return 1;
770779 if (oldval && !val)
771− atomic_dec(&blkiolat->enabled);
780+ return -1;
781+ return 0;
772782 }
773783
774784 static void iolatency_clear_scaling(struct blkcg_gq *blkg)
@@ -800,6 +810,7 @@ static ssize_t iolatency_set_limit(struct kernfs_open_file *of, char *buf, · 25 unmodified lines
800810 u64 lat_val = 0;
801811 u64 oldval;
802812 int ret;
813+ int enable = 0;
803814
804815 ret = blkg_conf_prep(blkcg, &blkcg_policy_iolatency, buf, &ctx);
805816 if (ret)
@@ -834,7 +845,12 @@ static ssize_t iolatency_set_limit(struct kernfs_open_file *of, char *buf, · 28 unmodified lines
834845 blkg = ctx.blkg;
835846 oldval = iolat->min_lat_nsec;
836847
837− iolatency_set_min_lat_nsec(blkg, lat_val);
848+ enable = iolatency_set_min_lat_nsec(blkg, lat_val);
849+ if (enable) {
850+ WARN_ON_ONCE(!blk_get_queue(blkg->q));
851+ blkg_get(blkg);
852+ }
853+
838854 if (oldval != iolat->min_lat_nsec) {
839855 iolatency_clear_scaling(blkg);
840856 }
@@ -842,6 +858,24 @@ static ssize_t iolatency_set_limit(struct kernfs_open_file *of, char *buf, · 1 unmodified line
842858 ret = 0;
843859 out:
844860 blkg_conf_finish(&ctx);
861+ if (ret == 0 && enable) {
862+ struct iolatency_grp *tmp = blkg_to_lat(blkg);
863+ struct blk_iolatency *blkiolat = tmp->blkiolat;
864+
865+ blk_mq_freeze_queue(blkg->q);
866+
867+ if (enable == 1)
868+ atomic_inc(&blkiolat->enabled);
869+ else if (enable == -1)
870+ atomic_dec(&blkiolat->enabled);
871+ else
872+ WARN_ON_ONCE(1);
873+
874+ blk_mq_unfreeze_queue(blkg->q);
875+
876+ blkg_put(blkg);
877+ blk_put_queue(blkg->q);
878+ }
845879 return ret ?: nbytes;
846880 }
847881
@@ -977,8 +1011,14 @@ static void iolatency_pd_offline(struct blkg_policy_data *pd) · 129 unmodified lines
9771011 {
9781012 struct iolatency_grp *iolat = pd_to_lat(pd);
9791013 struct blkcg_gq *blkg = lat_to_blkg(iolat);
1014+ struct blk_iolatency *blkiolat = iolat->blkiolat;
1015+ int ret;
9801016
981− iolatency_set_min_lat_nsec(blkg, 0);
1017+ ret = iolatency_set_min_lat_nsec(blkg, 0);
1018+ if (ret == 1)
1019+ atomic_inc(&blkiolat->enabled);
1020+ if (ret == -1)
1021+ atomic_dec(&blkiolat->enabled);
9821022 iolatency_clear_scaling(blkg);
9831023 }
9841024
block/blk-mq.h+0−1
@@ -36,7 +36,6 @@ struct blk_mq_ctx { · 35 unmodified lines
3636 struct kobject kobj;
3737 } ____cacheline_aligned_in_smp;
3838
39−void blk_mq_freeze_queue(struct request_queue *q);
4039 void blk_mq_free_queue(struct request_queue *q);
4140 int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr);
4241 void blk_mq_wake_waiters(struct request_queue *q);
drivers/ata/libata-core.c+1−0
@@ -4554,6 +4554,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { · 4553 unmodified lines
45544554 { "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_HORKAGE_NOLPM, },
45554555 { "SAMSUNG SSD PM830 mSATA *", "CXM13D1Q", ATA_HORKAGE_NOLPM, },
45564556 { "SAMSUNG MZ7TD256HAFV-000L9", NULL, ATA_HORKAGE_NOLPM, },
4557+ { "SAMSUNG MZ7TE512HMHP-000L1", "EXT06L0Q", ATA_HORKAGE_NOLPM, },
45574558
45584559 /* devices that don't properly handle queued TRIM commands */
45594560 { "Micron_M500IT_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM |
drivers/nvme/host/core.c+7−1
@@ -1253,6 +1253,7 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns, · 1252 unmodified lines
12531253 * effects say only one namespace is affected.
12541254 */
12551255 if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) {
1256+ mutex_lock(&ctrl->scan_lock);
12561257 nvme_start_freeze(ctrl);
12571258 nvme_wait_freeze(ctrl);
12581259 }
@@ -1281,8 +1282,10 @@ static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects) · 22 unmodified lines
12811282 */
12821283 if (effects & NVME_CMD_EFFECTS_LBCC)
12831284 nvme_update_formats(ctrl);
1284− if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK))
1285+ if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) {
12851286 nvme_unfreeze(ctrl);
1287+ mutex_unlock(&ctrl->scan_lock);
1288+ }
12861289 if (effects & NVME_CMD_EFFECTS_CCC)
12871290 nvme_init_identify(ctrl);
12881291 if (effects & (NVME_CMD_EFFECTS_NIC | NVME_CMD_EFFECTS_NCC))
@@ -3401,6 +3404,7 @@ static void nvme_scan_work(struct work_struct *work) · 2112 unmodified lines
34013404 if (nvme_identify_ctrl(ctrl, &id))
34023405 return;
34033406
3407+ mutex_lock(&ctrl->scan_lock);
34043408 nn = le32_to_cpu(id->nn);
34053409 if (ctrl->vs >= NVME_VS(1, 1, 0) &&
34063410 !(ctrl->quirks & NVME_QUIRK_IDENTIFY_CNS)) {
@@ -3409,6 +3413,7 @@ static void nvme_scan_work(struct work_struct *work) · 2 unmodified lines
34093413 }
34103414 nvme_scan_ns_sequential(ctrl, nn);
34113415 out_free_id:
3416+ mutex_unlock(&ctrl->scan_lock);
34123417 kfree(id);
34133418 down_write(&ctrl->namespaces_rwsem);
34143419 list_sort(NULL, &ctrl->namespaces, ns_cmp);
@@ -3652,6 +3657,7 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev, · 237 unmodified lines
36523657
36533658 ctrl->state = NVME_CTRL_NEW;
36543659 spin_lock_init(&ctrl->lock);
3660+ mutex_init(&ctrl->scan_lock);
36553661 INIT_LIST_HEAD(&ctrl->namespaces);
36563662 init_rwsem(&ctrl->namespaces_rwsem);
36573663 ctrl->dev = dev;
drivers/nvme/host/nvme.h+1−0
@@ -154,6 +154,7 @@ struct nvme_ctrl { · 153 unmodified lines
154154 enum nvme_ctrl_state state;
155155 bool identified;
156156 spinlock_t lock;
157+ struct mutex scan_lock;
157158 const struct nvme_ctrl_ops *ops;
158159 struct request_queue *admin_q;
159160 struct request_queue *connect_q;
drivers/nvme/host/pci.c+12−10
@@ -2557,16 +2557,7 @@ static void nvme_reset_work(struct work_struct *work) · 2556 unmodified lines
25572557 if (dev->ctrl.ctrl_config & NVME_CC_ENABLE)
25582558 nvme_dev_disable(dev, false);
25592559
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);
25702561 result = nvme_pci_enable(dev);
25712562 if (result)
25722563 goto out;
@@ -2585,6 +2576,17 @@ static void nvme_reset_work(struct work_struct *work) · 12 unmodified lines
25852576 */
25862577 dev->ctrl.max_hw_sectors = NVME_MAX_KB_SZ << 1;
25872578 dev->ctrl.max_segments = NVME_MAX_SEGS;
2579+ mutex_unlock(&dev->shutdown_lock);
2580+
2581+ /*
2582+ * Introduce CONNECTING state from nvme-fc/rdma transports to mark the
2583+ * initializing procedure here.
2584+ */
2585+ if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_CONNECTING)) {
2586+ dev_warn(dev->ctrl.device,
2587+ "failed to mark controller CONNECTING\n");
2588+ goto out;
2589+ }
25882590
25892591 result = nvme_init_identify(&dev->ctrl);
25902592 if (result)
fs/aio.c+1−0
@@ -1436,6 +1436,7 @@ static int aio_prep_rw(struct kiocb *req, const struct iocb *iocb) · 1435 unmodified lines
14361436 if (unlikely(!req->ki_filp))
14371437 return -EBADF;
14381438 req->ki_complete = aio_complete_rw;
1439+ req->private = NULL;
14391440 req->ki_pos = iocb->aio_offset;
14401441 req->ki_flags = iocb_flags(req->ki_filp);
14411442 if (iocb->aio_flags & IOCB_FLAG_RESFD)
fs/buffer.c+10−9
@@ -200,6 +200,7 @@ __find_get_block_slow(struct block_device *bdev, sector_t block) · 199 unmodified lines
200200 struct buffer_head *head;
201201 struct page *page;
202202 int all_mapped = 1;
203+ static DEFINE_RATELIMIT_STATE(last_warned, HZ, 1);
203204
204205 index = block >> (PAGE_SHIFT - bd_inode->i_blkbits);
205206 page = find_get_page_flags(bd_mapping, index, FGP_ACCESSED);
@@ -227,15 +228,15 @@ __find_get_block_slow(struct block_device *bdev, sector_t block) · 21 unmodified lines
227228 * file io on the block device and getblk. It gets dealt with
228229 * elsewhere, don't buffer_error if we had some unmapped buffers
229230 */
230− if (all_mapped) {
231− printk("__find_get_block_slow() failed. "
232− "block=%llu, b_blocknr=%llu\n",
233− (unsigned long long)block,
234− (unsigned long long)bh->b_blocknr);
235− printk("b_state=0x%08lx, b_size=%zu\n",
236− bh->b_state, bh->b_size);
237− printk("device %pg blocksize: %d\n", bdev,
238− 1 << bd_inode->i_blkbits);
231+ ratelimit_set_flags(&last_warned, RATELIMIT_MSG_ON_RELEASE);
232+ if (all_mapped && __ratelimit(&last_warned)) {
233+ printk("__find_get_block_slow() failed. block=%llu, "
234+ "b_blocknr=%llu, b_state=0x%08lx, b_size=%zu, "
235+ "device %pg blocksize: %d\n",
236+ (unsigned long long)block,
237+ (unsigned long long)bh->b_blocknr,
238+ bh->b_state, bh->b_size, bdev,
239+ 1 << bd_inode->i_blkbits);
239240 }
240241 out_unlock:
241242 spin_unlock(&bd_mapping->private_lock);
include/linux/blktrace_api.h+7−1
@@ -116,7 +116,13 @@ extern void blk_fill_rwbs(char *rwbs, unsigned int op, int bytes); · 115 unmodified lines
116116
117117 static inline sector_t blk_rq_trace_sector(struct request *rq)
118118 {
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);
120126 }
121127
122128 static inline unsigned int blk_rq_trace_nr_sectors(struct request *rq)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t