aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/ub.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2010-08-07 12:25:34 -0400
committerJens Axboe <jaxboe@fusionio.com>2010-08-07 12:25:34 -0400
commit6e9624b8caec290d28b4c6d9ec75749df6372b87 (patch)
tree47225b544e1da82742795553dc4e8aa70c17afdc /drivers/block/ub.c
parent8a6cfeb6deca3a8fefd639d898b0d163c0b5d368 (diff)
block: push down BKL into .open and .release
The open and release block_device_operations are currently called with the BKL held. In order to change that, we must first make sure that all drivers that currently rely on this have no regressions. This blindly pushes the BKL into all .open and .release operations for all block drivers to prepare for the next step. The drivers can subsequently replace the BKL with their own locks or remove it completely when it can be shown that it is not needed. The functions blkdev_get and blkdev_put are the only remaining users of the big kernel lock in the block layer, besides a few uses in the ioctl code, none of which need to serialize with blkdev_{get,put}. Most of these two functions is also under the protection of bdev->bd_mutex, including the actual calls to ->open and ->release, and the common code does not access any global data structures that need the BKL. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'drivers/block/ub.c')
-rw-r--r--drivers/block/ub.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index 102ed52d0e0f..c48e14878582 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -1711,6 +1711,18 @@ err_open:
1711 return rc; 1711 return rc;
1712} 1712}
1713 1713
1714static int ub_bd_unlocked_open(struct block_device *bdev, fmode_t mode)
1715{
1716 int ret;
1717
1718 lock_kernel();
1719 ret = ub_bd_open(bdev, mode);
1720 unlock_kernel();
1721
1722 return ret;
1723}
1724
1725
1714/* 1726/*
1715 */ 1727 */
1716static int ub_bd_release(struct gendisk *disk, fmode_t mode) 1728static int ub_bd_release(struct gendisk *disk, fmode_t mode)
@@ -1718,7 +1730,10 @@ static int ub_bd_release(struct gendisk *disk, fmode_t mode)
1718 struct ub_lun *lun = disk->private_data; 1730 struct ub_lun *lun = disk->private_data;
1719 struct ub_dev *sc = lun->udev; 1731 struct ub_dev *sc = lun->udev;
1720 1732
1733 lock_kernel();
1721 ub_put(sc); 1734 ub_put(sc);
1735 unlock_kernel();
1736
1722 return 0; 1737 return 0;
1723} 1738}
1724 1739
@@ -1798,7 +1813,7 @@ static int ub_bd_media_changed(struct gendisk *disk)
1798 1813
1799static const struct block_device_operations ub_bd_fops = { 1814static const struct block_device_operations ub_bd_fops = {
1800 .owner = THIS_MODULE, 1815 .owner = THIS_MODULE,
1801 .open = ub_bd_open, 1816 .open = ub_bd_unlocked_open,
1802 .release = ub_bd_release, 1817 .release = ub_bd_release,
1803 .ioctl = ub_bd_ioctl, 1818 .ioctl = ub_bd_ioctl,
1804 .media_changed = ub_bd_media_changed, 1819 .media_changed = ub_bd_media_changed,