aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS1
-rw-r--r--block/blk-core.c3
-rw-r--r--block/blk-mq.c2
-rw-r--r--block/blk-mq.h1
-rw-r--r--crypto/asymmetric_keys/x509_cert_parser.c12
-rw-r--r--drivers/block/brd.c3
-rw-r--r--drivers/char/tpm/tpm-chip.c20
-rw-r--r--drivers/char/tpm/tpm2-cmd.c15
-rw-r--r--drivers/char/tpm/tpm_of.c3
-rw-r--r--drivers/char/tpm/tpm_tis.c8
-rw-r--r--drivers/nvme/host/pci.c15
-rw-r--r--fs/block_dev.c15
-rw-r--r--fs/dax.c4
-rw-r--r--include/linux/blk_types.h2
-rw-r--r--kernel/trace/trace.c16
-rw-r--r--kernel/trace/trace.h1
-rw-r--r--kernel/trace/trace_functions_graph.c6
17 files changed, 79 insertions, 48 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 8d941d6818cd..ecc43c255eb8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2210,6 +2210,7 @@ F: drivers/leds/leds-blinkm.c
2210 2210
2211BLOCK LAYER 2211BLOCK LAYER
2212M: Jens Axboe <axboe@kernel.dk> 2212M: Jens Axboe <axboe@kernel.dk>
2213L: linux-block@vger.kernel.org
2213T: git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git 2214T: git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
2214S: Maintained 2215S: Maintained
2215F: block/ 2216F: block/
diff --git a/block/blk-core.c b/block/blk-core.c
index 2bbf08cd2900..5131993b23a1 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1575,6 +1575,9 @@ bool bio_attempt_front_merge(struct request_queue *q, struct request *req,
1575 * @q: request_queue new bio is being queued at 1575 * @q: request_queue new bio is being queued at
1576 * @bio: new bio being queued 1576 * @bio: new bio being queued
1577 * @request_count: out parameter for number of traversed plugged requests 1577 * @request_count: out parameter for number of traversed plugged requests
1578 * @same_queue_rq: pointer to &struct request that gets filled in when
1579 * another request associated with @q is found on the plug list
1580 * (optional, may be %NULL)
1578 * 1581 *
1579 * Determine whether @bio being queued on @q can be merged with a request 1582 * Determine whether @bio being queued on @q can be merged with a request
1580 * on %current's plugged list. Returns %true if merge was successful, 1583 * on %current's plugged list. Returns %true if merge was successful,
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 86bd5b25288e..3ae09de62f19 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -358,7 +358,7 @@ static void blk_mq_ipi_complete_request(struct request *rq)
358 put_cpu(); 358 put_cpu();
359} 359}
360 360
361void __blk_mq_complete_request(struct request *rq) 361static void __blk_mq_complete_request(struct request *rq)
362{ 362{
363 struct request_queue *q = rq->q; 363 struct request_queue *q = rq->q;
364 364
diff --git a/block/blk-mq.h b/block/blk-mq.h
index b44dce165761..713820b47b31 100644
--- a/block/blk-mq.h
+++ b/block/blk-mq.h
@@ -25,7 +25,6 @@ struct blk_mq_ctx {
25 struct kobject kobj; 25 struct kobject kobj;
26} ____cacheline_aligned_in_smp; 26} ____cacheline_aligned_in_smp;
27 27
28void __blk_mq_complete_request(struct request *rq);
29void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async); 28void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async);
30void blk_mq_freeze_queue(struct request_queue *q); 29void blk_mq_freeze_queue(struct request_queue *q);
31void blk_mq_free_queue(struct request_queue *q); 30void blk_mq_free_queue(struct request_queue *q);
diff --git a/crypto/asymmetric_keys/x509_cert_parser.c b/crypto/asymmetric_keys/x509_cert_parser.c
index 3000ea3b6687..021d39c0ba75 100644
--- a/crypto/asymmetric_keys/x509_cert_parser.c
+++ b/crypto/asymmetric_keys/x509_cert_parser.c
@@ -531,7 +531,11 @@ int x509_decode_time(time64_t *_t, size_t hdrlen,
531 if (*p != 'Z') 531 if (*p != 'Z')
532 goto unsupported_time; 532 goto unsupported_time;
533 533
534 mon_len = month_lengths[mon]; 534 if (year < 1970 ||
535 mon < 1 || mon > 12)
536 goto invalid_time;
537
538 mon_len = month_lengths[mon - 1];
535 if (mon == 2) { 539 if (mon == 2) {
536 if (year % 4 == 0) { 540 if (year % 4 == 0) {
537 mon_len = 29; 541 mon_len = 29;
@@ -543,14 +547,12 @@ int x509_decode_time(time64_t *_t, size_t hdrlen,
543 } 547 }
544 } 548 }
545 549
546 if (year < 1970 || 550 if (day < 1 || day > mon_len ||
547 mon < 1 || mon > 12 ||
548 day < 1 || day > mon_len ||
549 hour > 23 || 551 hour > 23 ||
550 min > 59 || 552 min > 59 ||
551 sec > 59) 553 sec > 59)
552 goto invalid_time; 554 goto invalid_time;
553 555
554 *_t = mktime64(year, mon, day, hour, min, sec); 556 *_t = mktime64(year, mon, day, hour, min, sec);
555 return 0; 557 return 0;
556 558
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index c9f9c30d6467..a5880f4ab40e 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -337,6 +337,9 @@ static blk_qc_t brd_make_request(struct request_queue *q, struct bio *bio)
337 goto io_error; 337 goto io_error;
338 338
339 if (unlikely(bio->bi_rw & REQ_DISCARD)) { 339 if (unlikely(bio->bi_rw & REQ_DISCARD)) {
340 if (sector & ((PAGE_SIZE >> SECTOR_SHIFT) - 1) ||
341 bio->bi_iter.bi_size & PAGE_MASK)
342 goto io_error;
340 discard_from_brd(brd, sector, bio->bi_iter.bi_size); 343 discard_from_brd(brd, sector, bio->bi_iter.bi_size);
341 goto out; 344 goto out;
342 } 345 }
diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
index f26b0ae23bea..45cc39aabeee 100644
--- a/drivers/char/tpm/tpm-chip.c
+++ b/drivers/char/tpm/tpm-chip.c
@@ -226,21 +226,23 @@ int tpm_chip_register(struct tpm_chip *chip)
226 if (rc) 226 if (rc)
227 goto out_err; 227 goto out_err;
228 228
229 if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) {
230 rc = __compat_only_sysfs_link_entry_to_kobj(&chip->pdev->kobj,
231 &chip->dev.kobj,
232 "ppi");
233 if (rc)
234 goto out_err;
235 }
236
237 /* Make the chip available. */ 229 /* Make the chip available. */
238 spin_lock(&driver_lock); 230 spin_lock(&driver_lock);
239 list_add_rcu(&chip->list, &tpm_chip_list); 231 list_add_tail_rcu(&chip->list, &tpm_chip_list);
240 spin_unlock(&driver_lock); 232 spin_unlock(&driver_lock);
241 233
242 chip->flags |= TPM_CHIP_FLAG_REGISTERED; 234 chip->flags |= TPM_CHIP_FLAG_REGISTERED;
243 235
236 if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) {
237 rc = __compat_only_sysfs_link_entry_to_kobj(&chip->pdev->kobj,
238 &chip->dev.kobj,
239 "ppi");
240 if (rc && rc != -ENOENT) {
241 tpm_chip_unregister(chip);
242 return rc;
243 }
244 }
245
244 return 0; 246 return 0;
245out_err: 247out_err:
246 tpm1_chip_unregister(chip); 248 tpm1_chip_unregister(chip);
diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
index bd7039fafa8a..c12130485fc1 100644
--- a/drivers/char/tpm/tpm2-cmd.c
+++ b/drivers/char/tpm/tpm2-cmd.c
@@ -443,12 +443,13 @@ int tpm2_seal_trusted(struct tpm_chip *chip,
443 TPM_DIGEST_SIZE); 443 TPM_DIGEST_SIZE);
444 444
445 /* sensitive */ 445 /* sensitive */
446 tpm_buf_append_u16(&buf, 4 + TPM_DIGEST_SIZE + payload->key_len); 446 tpm_buf_append_u16(&buf, 4 + TPM_DIGEST_SIZE + payload->key_len + 1);
447 447
448 tpm_buf_append_u16(&buf, TPM_DIGEST_SIZE); 448 tpm_buf_append_u16(&buf, TPM_DIGEST_SIZE);
449 tpm_buf_append(&buf, options->blobauth, TPM_DIGEST_SIZE); 449 tpm_buf_append(&buf, options->blobauth, TPM_DIGEST_SIZE);
450 tpm_buf_append_u16(&buf, payload->key_len); 450 tpm_buf_append_u16(&buf, payload->key_len + 1);
451 tpm_buf_append(&buf, payload->key, payload->key_len); 451 tpm_buf_append(&buf, payload->key, payload->key_len);
452 tpm_buf_append_u8(&buf, payload->migratable);
452 453
453 /* public */ 454 /* public */
454 tpm_buf_append_u16(&buf, 14); 455 tpm_buf_append_u16(&buf, 14);
@@ -573,6 +574,8 @@ static int tpm2_unseal(struct tpm_chip *chip,
573 u32 blob_handle) 574 u32 blob_handle)
574{ 575{
575 struct tpm_buf buf; 576 struct tpm_buf buf;
577 u16 data_len;
578 u8 *data;
576 int rc; 579 int rc;
577 580
578 rc = tpm_buf_init(&buf, TPM2_ST_SESSIONS, TPM2_CC_UNSEAL); 581 rc = tpm_buf_init(&buf, TPM2_ST_SESSIONS, TPM2_CC_UNSEAL);
@@ -591,11 +594,13 @@ static int tpm2_unseal(struct tpm_chip *chip,
591 rc = -EPERM; 594 rc = -EPERM;
592 595
593 if (!rc) { 596 if (!rc) {
594 payload->key_len = be16_to_cpup( 597 data_len = be16_to_cpup(
595 (__be16 *) &buf.data[TPM_HEADER_SIZE + 4]); 598 (__be16 *) &buf.data[TPM_HEADER_SIZE + 4]);
599 data = &buf.data[TPM_HEADER_SIZE + 6];
596 600
597 memcpy(payload->key, &buf.data[TPM_HEADER_SIZE + 6], 601 memcpy(payload->key, data, data_len - 1);
598 payload->key_len); 602 payload->key_len = data_len - 1;
603 payload->migratable = data[data_len - 1];
599 } 604 }
600 605
601 tpm_buf_destroy(&buf); 606 tpm_buf_destroy(&buf);
diff --git a/drivers/char/tpm/tpm_of.c b/drivers/char/tpm/tpm_of.c
index 1141456a4b1f..570f30c5c5f4 100644
--- a/drivers/char/tpm/tpm_of.c
+++ b/drivers/char/tpm/tpm_of.c
@@ -53,17 +53,18 @@ int read_log(struct tpm_bios_log *log)
53 goto cleanup_eio; 53 goto cleanup_eio;
54 } 54 }
55 55
56 of_node_put(np);
57 log->bios_event_log = kmalloc(*sizep, GFP_KERNEL); 56 log->bios_event_log = kmalloc(*sizep, GFP_KERNEL);
58 if (!log->bios_event_log) { 57 if (!log->bios_event_log) {
59 pr_err("%s: ERROR - Not enough memory for BIOS measurements\n", 58 pr_err("%s: ERROR - Not enough memory for BIOS measurements\n",
60 __func__); 59 __func__);
60 of_node_put(np);
61 return -ENOMEM; 61 return -ENOMEM;
62 } 62 }
63 63
64 log->bios_event_log_end = log->bios_event_log + *sizep; 64 log->bios_event_log_end = log->bios_event_log + *sizep;
65 65
66 memcpy(log->bios_event_log, __va(*basep), *sizep); 66 memcpy(log->bios_event_log, __va(*basep), *sizep);
67 of_node_put(np);
67 68
68 return 0; 69 return 0;
69 70
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 696ef1d56b4f..65f7eecc45b0 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -645,6 +645,7 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
645{ 645{
646 u32 vendor, intfcaps, intmask; 646 u32 vendor, intfcaps, intmask;
647 int rc, i, irq_s, irq_e, probe; 647 int rc, i, irq_s, irq_e, probe;
648 int irq_r = -1;
648 struct tpm_chip *chip; 649 struct tpm_chip *chip;
649 struct priv_data *priv; 650 struct priv_data *priv;
650 651
@@ -751,6 +752,7 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
751 irq_s = 752 irq_s =
752 ioread8(chip->vendor.iobase + 753 ioread8(chip->vendor.iobase +
753 TPM_INT_VECTOR(chip->vendor.locality)); 754 TPM_INT_VECTOR(chip->vendor.locality));
755 irq_r = irq_s;
754 if (irq_s) { 756 if (irq_s) {
755 irq_e = irq_s; 757 irq_e = irq_s;
756 } else { 758 } else {
@@ -805,6 +807,8 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
805 iowrite32(intmask, 807 iowrite32(intmask,
806 chip->vendor.iobase + 808 chip->vendor.iobase +
807 TPM_INT_ENABLE(chip->vendor.locality)); 809 TPM_INT_ENABLE(chip->vendor.locality));
810
811 devm_free_irq(dev, i, chip);
808 } 812 }
809 } 813 }
810 if (chip->vendor.irq) { 814 if (chip->vendor.irq) {
@@ -831,7 +835,9 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
831 chip->vendor.iobase + 835 chip->vendor.iobase +
832 TPM_INT_ENABLE(chip->vendor.locality)); 836 TPM_INT_ENABLE(chip->vendor.locality));
833 } 837 }
834 } 838 } else if (irq_r != -1)
839 iowrite8(irq_r, chip->vendor.iobase +
840 TPM_INT_VECTOR(chip->vendor.locality));
835 841
836 if (chip->flags & TPM_CHIP_FLAG_TPM2) { 842 if (chip->flags & TPM_CHIP_FLAG_TPM2) {
837 chip->vendor.timeout_a = msecs_to_jiffies(TPM2_TIMEOUT_A); 843 chip->vendor.timeout_a = msecs_to_jiffies(TPM2_TIMEOUT_A);
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 3dfc28875cc3..8187df204695 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1725,7 +1725,7 @@ static int nvme_configure_admin_queue(struct nvme_dev *dev)
1725{ 1725{
1726 int result; 1726 int result;
1727 u32 aqa; 1727 u32 aqa;
1728 u64 cap = readq(&dev->bar->cap); 1728 u64 cap = lo_hi_readq(&dev->bar->cap);
1729 struct nvme_queue *nvmeq; 1729 struct nvme_queue *nvmeq;
1730 unsigned page_shift = PAGE_SHIFT; 1730 unsigned page_shift = PAGE_SHIFT;
1731 unsigned dev_page_min = NVME_CAP_MPSMIN(cap) + 12; 1731 unsigned dev_page_min = NVME_CAP_MPSMIN(cap) + 12;
@@ -1774,8 +1774,8 @@ static int nvme_configure_admin_queue(struct nvme_dev *dev)
1774 dev->ctrl_config |= NVME_CC_IOSQES | NVME_CC_IOCQES; 1774 dev->ctrl_config |= NVME_CC_IOSQES | NVME_CC_IOCQES;
1775 1775
1776 writel(aqa, &dev->bar->aqa); 1776 writel(aqa, &dev->bar->aqa);
1777 writeq(nvmeq->sq_dma_addr, &dev->bar->asq); 1777 lo_hi_writeq(nvmeq->sq_dma_addr, &dev->bar->asq);
1778 writeq(nvmeq->cq_dma_addr, &dev->bar->acq); 1778 lo_hi_writeq(nvmeq->cq_dma_addr, &dev->bar->acq);
1779 1779
1780 result = nvme_enable_ctrl(dev, cap); 1780 result = nvme_enable_ctrl(dev, cap);
1781 if (result) 1781 if (result)
@@ -2606,7 +2606,7 @@ static int nvme_dev_add(struct nvme_dev *dev)
2606 struct pci_dev *pdev = to_pci_dev(dev->dev); 2606 struct pci_dev *pdev = to_pci_dev(dev->dev);
2607 int res; 2607 int res;
2608 struct nvme_id_ctrl *ctrl; 2608 struct nvme_id_ctrl *ctrl;
2609 int shift = NVME_CAP_MPSMIN(readq(&dev->bar->cap)) + 12; 2609 int shift = NVME_CAP_MPSMIN(lo_hi_readq(&dev->bar->cap)) + 12;
2610 2610
2611 res = nvme_identify_ctrl(dev, &ctrl); 2611 res = nvme_identify_ctrl(dev, &ctrl);
2612 if (res) { 2612 if (res) {
@@ -2622,6 +2622,8 @@ static int nvme_dev_add(struct nvme_dev *dev)
2622 memcpy(dev->firmware_rev, ctrl->fr, sizeof(ctrl->fr)); 2622 memcpy(dev->firmware_rev, ctrl->fr, sizeof(ctrl->fr));
2623 if (ctrl->mdts) 2623 if (ctrl->mdts)
2624 dev->max_hw_sectors = 1 << (ctrl->mdts + shift - 9); 2624 dev->max_hw_sectors = 1 << (ctrl->mdts + shift - 9);
2625 else
2626 dev->max_hw_sectors = UINT_MAX;
2625 if ((pdev->vendor == PCI_VENDOR_ID_INTEL) && 2627 if ((pdev->vendor == PCI_VENDOR_ID_INTEL) &&
2626 (pdev->device == 0x0953) && ctrl->vs[3]) { 2628 (pdev->device == 0x0953) && ctrl->vs[3]) {
2627 unsigned int max_hw_sectors; 2629 unsigned int max_hw_sectors;
@@ -2695,7 +2697,7 @@ static int nvme_dev_map(struct nvme_dev *dev)
2695 goto unmap; 2697 goto unmap;
2696 } 2698 }
2697 2699
2698 cap = readq(&dev->bar->cap); 2700 cap = lo_hi_readq(&dev->bar->cap);
2699 dev->q_depth = min_t(int, NVME_CAP_MQES(cap) + 1, NVME_Q_DEPTH); 2701 dev->q_depth = min_t(int, NVME_CAP_MQES(cap) + 1, NVME_Q_DEPTH);
2700 dev->db_stride = 1 << NVME_CAP_STRIDE(cap); 2702 dev->db_stride = 1 << NVME_CAP_STRIDE(cap);
2701 dev->dbs = ((void __iomem *)dev->bar) + 4096; 2703 dev->dbs = ((void __iomem *)dev->bar) + 4096;
@@ -2758,7 +2760,7 @@ static void nvme_wait_dq(struct nvme_delq_ctx *dq, struct nvme_dev *dev)
2758 * queues than admin tags. 2760 * queues than admin tags.
2759 */ 2761 */
2760 set_current_state(TASK_RUNNING); 2762 set_current_state(TASK_RUNNING);
2761 nvme_disable_ctrl(dev, readq(&dev->bar->cap)); 2763 nvme_disable_ctrl(dev, lo_hi_readq(&dev->bar->cap));
2762 nvme_clear_queue(dev->queues[0]); 2764 nvme_clear_queue(dev->queues[0]);
2763 flush_kthread_worker(dq->worker); 2765 flush_kthread_worker(dq->worker);
2764 nvme_disable_queue(dev, 0); 2766 nvme_disable_queue(dev, 0);
@@ -3401,6 +3403,7 @@ static const struct pci_error_handlers nvme_err_handler = {
3401 3403
3402static const struct pci_device_id nvme_id_table[] = { 3404static const struct pci_device_id nvme_id_table[] = {
3403 { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) }, 3405 { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) },
3406 { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001) },
3404 { 0, } 3407 { 0, }
3405}; 3408};
3406MODULE_DEVICE_TABLE(pci, nvme_id_table); 3409MODULE_DEVICE_TABLE(pci, nvme_id_table);
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 0a793c7930eb..bb0dfb1c7af1 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -50,12 +50,21 @@ struct block_device *I_BDEV(struct inode *inode)
50} 50}
51EXPORT_SYMBOL(I_BDEV); 51EXPORT_SYMBOL(I_BDEV);
52 52
53static void bdev_write_inode(struct inode *inode) 53static void bdev_write_inode(struct block_device *bdev)
54{ 54{
55 struct inode *inode = bdev->bd_inode;
56 int ret;
57
55 spin_lock(&inode->i_lock); 58 spin_lock(&inode->i_lock);
56 while (inode->i_state & I_DIRTY) { 59 while (inode->i_state & I_DIRTY) {
57 spin_unlock(&inode->i_lock); 60 spin_unlock(&inode->i_lock);
58 WARN_ON_ONCE(write_inode_now(inode, true)); 61 ret = write_inode_now(inode, true);
62 if (ret) {
63 char name[BDEVNAME_SIZE];
64 pr_warn_ratelimited("VFS: Dirty inode writeback failed "
65 "for block device %s (err=%d).\n",
66 bdevname(bdev, name), ret);
67 }
59 spin_lock(&inode->i_lock); 68 spin_lock(&inode->i_lock);
60 } 69 }
61 spin_unlock(&inode->i_lock); 70 spin_unlock(&inode->i_lock);
@@ -1504,7 +1513,7 @@ static void __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part)
1504 * ->release can cause the queue to disappear, so flush all 1513 * ->release can cause the queue to disappear, so flush all
1505 * dirty data before. 1514 * dirty data before.
1506 */ 1515 */
1507 bdev_write_inode(bdev->bd_inode); 1516 bdev_write_inode(bdev);
1508 } 1517 }
1509 if (bdev->bd_contains == bdev) { 1518 if (bdev->bd_contains == bdev) {
1510 if (disk->fops->release) 1519 if (disk->fops->release)
diff --git a/fs/dax.c b/fs/dax.c
index 131fd35ae39d..8e17b371aeb8 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -174,8 +174,10 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter,
174 else 174 else
175 len = iov_iter_zero(max - pos, iter); 175 len = iov_iter_zero(max - pos, iter);
176 176
177 if (!len) 177 if (!len) {
178 retval = -EFAULT;
178 break; 179 break;
180 }
179 181
180 pos += len; 182 pos += len;
181 addr += len; 183 addr += len;
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 641e5a3ed58c..0fb65843ec1e 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -265,7 +265,7 @@ static inline unsigned int blk_qc_t_to_queue_num(blk_qc_t cookie)
265 265
266static inline unsigned int blk_qc_t_to_tag(blk_qc_t cookie) 266static inline unsigned int blk_qc_t_to_tag(blk_qc_t cookie)
267{ 267{
268 return cookie & 0xffff; 268 return cookie & ((1u << BLK_QC_T_SHIFT) - 1);
269} 269}
270 270
271#endif /* __LINUX_BLK_TYPES_H */ 271#endif /* __LINUX_BLK_TYPES_H */
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 2198a630ef58..87fb9801bd9e 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -100,8 +100,6 @@ static DEFINE_PER_CPU(bool, trace_cmdline_save);
100 */ 100 */
101static int tracing_disabled = 1; 101static int tracing_disabled = 1;
102 102
103DEFINE_PER_CPU(int, ftrace_cpu_disabled);
104
105cpumask_var_t __read_mostly tracing_buffer_mask; 103cpumask_var_t __read_mostly tracing_buffer_mask;
106 104
107/* 105/*
@@ -1775,10 +1773,6 @@ trace_function(struct trace_array *tr,
1775 struct ring_buffer_event *event; 1773 struct ring_buffer_event *event;
1776 struct ftrace_entry *entry; 1774 struct ftrace_entry *entry;
1777 1775
1778 /* If we are reading the ring buffer, don't trace */
1779 if (unlikely(__this_cpu_read(ftrace_cpu_disabled)))
1780 return;
1781
1782 event = trace_buffer_lock_reserve(buffer, TRACE_FN, sizeof(*entry), 1776 event = trace_buffer_lock_reserve(buffer, TRACE_FN, sizeof(*entry),
1783 flags, pc); 1777 flags, pc);
1784 if (!event) 1778 if (!event)
@@ -4554,6 +4548,8 @@ out:
4554 return ret; 4548 return ret;
4555} 4549}
4556 4550
4551#ifdef CONFIG_TRACER_MAX_TRACE
4552
4557static ssize_t 4553static ssize_t
4558tracing_max_lat_read(struct file *filp, char __user *ubuf, 4554tracing_max_lat_read(struct file *filp, char __user *ubuf,
4559 size_t cnt, loff_t *ppos) 4555 size_t cnt, loff_t *ppos)
@@ -4568,6 +4564,8 @@ tracing_max_lat_write(struct file *filp, const char __user *ubuf,
4568 return tracing_nsecs_write(filp->private_data, ubuf, cnt, ppos); 4564 return tracing_nsecs_write(filp->private_data, ubuf, cnt, ppos);
4569} 4565}
4570 4566
4567#endif
4568
4571static int tracing_open_pipe(struct inode *inode, struct file *filp) 4569static int tracing_open_pipe(struct inode *inode, struct file *filp)
4572{ 4570{
4573 struct trace_array *tr = inode->i_private; 4571 struct trace_array *tr = inode->i_private;
@@ -5469,12 +5467,14 @@ static const struct file_operations tracing_thresh_fops = {
5469 .llseek = generic_file_llseek, 5467 .llseek = generic_file_llseek,
5470}; 5468};
5471 5469
5470#ifdef CONFIG_TRACER_MAX_TRACE
5472static const struct file_operations tracing_max_lat_fops = { 5471static const struct file_operations tracing_max_lat_fops = {
5473 .open = tracing_open_generic, 5472 .open = tracing_open_generic,
5474 .read = tracing_max_lat_read, 5473 .read = tracing_max_lat_read,
5475 .write = tracing_max_lat_write, 5474 .write = tracing_max_lat_write,
5476 .llseek = generic_file_llseek, 5475 .llseek = generic_file_llseek,
5477}; 5476};
5477#endif
5478 5478
5479static const struct file_operations set_tracer_fops = { 5479static const struct file_operations set_tracer_fops = {
5480 .open = tracing_open_generic, 5480 .open = tracing_open_generic,
@@ -6847,7 +6847,9 @@ struct dentry *tracing_init_dentry(void)
6847 if (tr->dir) 6847 if (tr->dir)
6848 return NULL; 6848 return NULL;
6849 6849
6850 if (WARN_ON(!debugfs_initialized())) 6850 if (WARN_ON(!tracefs_initialized()) ||
6851 (IS_ENABLED(CONFIG_DEBUG_FS) &&
6852 WARN_ON(!debugfs_initialized())))
6851 return ERR_PTR(-ENODEV); 6853 return ERR_PTR(-ENODEV);
6852 6854
6853 /* 6855 /*
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index dd7620802e72..919d9d07686f 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -667,7 +667,6 @@ extern int DYN_FTRACE_TEST_NAME2(void);
667 667
668extern bool ring_buffer_expanded; 668extern bool ring_buffer_expanded;
669extern bool tracing_selftest_disabled; 669extern bool tracing_selftest_disabled;
670DECLARE_PER_CPU(int, ftrace_cpu_disabled);
671 670
672#ifdef CONFIG_FTRACE_STARTUP_TEST 671#ifdef CONFIG_FTRACE_STARTUP_TEST
673extern int trace_selftest_startup_function(struct tracer *trace, 672extern int trace_selftest_startup_function(struct tracer *trace,
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 92382af7a213..a663cbb84107 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -288,9 +288,6 @@ int __trace_graph_entry(struct trace_array *tr,
288 struct ring_buffer *buffer = tr->trace_buffer.buffer; 288 struct ring_buffer *buffer = tr->trace_buffer.buffer;
289 struct ftrace_graph_ent_entry *entry; 289 struct ftrace_graph_ent_entry *entry;
290 290
291 if (unlikely(__this_cpu_read(ftrace_cpu_disabled)))
292 return 0;
293
294 event = trace_buffer_lock_reserve(buffer, TRACE_GRAPH_ENT, 291 event = trace_buffer_lock_reserve(buffer, TRACE_GRAPH_ENT,
295 sizeof(*entry), flags, pc); 292 sizeof(*entry), flags, pc);
296 if (!event) 293 if (!event)
@@ -403,9 +400,6 @@ void __trace_graph_return(struct trace_array *tr,
403 struct ring_buffer *buffer = tr->trace_buffer.buffer; 400 struct ring_buffer *buffer = tr->trace_buffer.buffer;
404 struct ftrace_graph_ret_entry *entry; 401 struct ftrace_graph_ret_entry *entry;
405 402
406 if (unlikely(__this_cpu_read(ftrace_cpu_disabled)))
407 return;
408
409 event = trace_buffer_lock_reserve(buffer, TRACE_GRAPH_RET, 403 event = trace_buffer_lock_reserve(buffer, TRACE_GRAPH_RET,
410 sizeof(*entry), flags, pc); 404 sizeof(*entry), flags, pc);
411 if (!event) 405 if (!event)