aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/blktrace.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-10-09 03:02:35 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-10-09 03:02:35 -0400
commit1236d6bb6e19fc72ffc6bbcdeb1bfefe450e54ee (patch)
tree47da3feee8e263e8c9352c85cf518e624be3c211 /kernel/trace/blktrace.c
parent750b1a6894ecc9b178c6e3d0a1170122971b2036 (diff)
parent8a5776a5f49812d29fe4b2d0a2d71675c3facf3f (diff)
Merge 4.14-rc4 into staging-next
We want the staging/iio fixes in here as well to handle merge issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/trace/blktrace.c')
-rw-r--r--kernel/trace/blktrace.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 2a685b45b73b..45a3928544ce 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -648,6 +648,12 @@ int blk_trace_startstop(struct request_queue *q, int start)
648} 648}
649EXPORT_SYMBOL_GPL(blk_trace_startstop); 649EXPORT_SYMBOL_GPL(blk_trace_startstop);
650 650
651/*
652 * When reading or writing the blktrace sysfs files, the references to the
653 * opened sysfs or device files should prevent the underlying block device
654 * from being removed. So no further delete protection is really needed.
655 */
656
651/** 657/**
652 * blk_trace_ioctl: - handle the ioctls associated with tracing 658 * blk_trace_ioctl: - handle the ioctls associated with tracing
653 * @bdev: the block device 659 * @bdev: the block device
@@ -665,7 +671,7 @@ int blk_trace_ioctl(struct block_device *bdev, unsigned cmd, char __user *arg)
665 if (!q) 671 if (!q)
666 return -ENXIO; 672 return -ENXIO;
667 673
668 mutex_lock(&bdev->bd_mutex); 674 mutex_lock(&q->blk_trace_mutex);
669 675
670 switch (cmd) { 676 switch (cmd) {
671 case BLKTRACESETUP: 677 case BLKTRACESETUP:
@@ -691,7 +697,7 @@ int blk_trace_ioctl(struct block_device *bdev, unsigned cmd, char __user *arg)
691 break; 697 break;
692 } 698 }
693 699
694 mutex_unlock(&bdev->bd_mutex); 700 mutex_unlock(&q->blk_trace_mutex);
695 return ret; 701 return ret;
696} 702}
697 703
@@ -1727,7 +1733,7 @@ static ssize_t sysfs_blk_trace_attr_show(struct device *dev,
1727 if (q == NULL) 1733 if (q == NULL)
1728 goto out_bdput; 1734 goto out_bdput;
1729 1735
1730 mutex_lock(&bdev->bd_mutex); 1736 mutex_lock(&q->blk_trace_mutex);
1731 1737
1732 if (attr == &dev_attr_enable) { 1738 if (attr == &dev_attr_enable) {
1733 ret = sprintf(buf, "%u\n", !!q->blk_trace); 1739 ret = sprintf(buf, "%u\n", !!q->blk_trace);
@@ -1746,7 +1752,7 @@ static ssize_t sysfs_blk_trace_attr_show(struct device *dev,
1746 ret = sprintf(buf, "%llu\n", q->blk_trace->end_lba); 1752 ret = sprintf(buf, "%llu\n", q->blk_trace->end_lba);
1747 1753
1748out_unlock_bdev: 1754out_unlock_bdev:
1749 mutex_unlock(&bdev->bd_mutex); 1755 mutex_unlock(&q->blk_trace_mutex);
1750out_bdput: 1756out_bdput:
1751 bdput(bdev); 1757 bdput(bdev);
1752out: 1758out:
@@ -1788,7 +1794,7 @@ static ssize_t sysfs_blk_trace_attr_store(struct device *dev,
1788 if (q == NULL) 1794 if (q == NULL)
1789 goto out_bdput; 1795 goto out_bdput;
1790 1796
1791 mutex_lock(&bdev->bd_mutex); 1797 mutex_lock(&q->blk_trace_mutex);
1792 1798
1793 if (attr == &dev_attr_enable) { 1799 if (attr == &dev_attr_enable) {
1794 if (value) 1800 if (value)
@@ -1814,7 +1820,7 @@ static ssize_t sysfs_blk_trace_attr_store(struct device *dev,
1814 } 1820 }
1815 1821
1816out_unlock_bdev: 1822out_unlock_bdev:
1817 mutex_unlock(&bdev->bd_mutex); 1823 mutex_unlock(&q->blk_trace_mutex);
1818out_bdput: 1824out_bdput:
1819 bdput(bdev); 1825 bdput(bdev);
1820out: 1826out: