aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-cd.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/ide/ide-cd.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/ide/ide-cd.c')
-rw-r--r--drivers/ide/ide-cd.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index bf9f61a5c2f8..5108e9739c96 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1591,17 +1591,19 @@ static struct ide_driver ide_cdrom_driver = {
1591 1591
1592static int idecd_open(struct block_device *bdev, fmode_t mode) 1592static int idecd_open(struct block_device *bdev, fmode_t mode)
1593{ 1593{
1594 struct cdrom_info *info = ide_cd_get(bdev->bd_disk); 1594 struct cdrom_info *info;
1595 int rc = -ENOMEM; 1595 int rc = -ENXIO;
1596 1596
1597 lock_kernel();
1598 info = ide_cd_get(bdev->bd_disk);
1597 if (!info) 1599 if (!info)
1598 return -ENXIO; 1600 goto out;
1599 1601
1600 rc = cdrom_open(&info->devinfo, bdev, mode); 1602 rc = cdrom_open(&info->devinfo, bdev, mode);
1601
1602 if (rc < 0) 1603 if (rc < 0)
1603 ide_cd_put(info); 1604 ide_cd_put(info);
1604 1605out:
1606 unlock_kernel();
1605 return rc; 1607 return rc;
1606} 1608}
1607 1609
@@ -1609,9 +1611,11 @@ static int idecd_release(struct gendisk *disk, fmode_t mode)
1609{ 1611{
1610 struct cdrom_info *info = ide_drv_g(disk, cdrom_info); 1612 struct cdrom_info *info = ide_drv_g(disk, cdrom_info);
1611 1613
1614 lock_kernel();
1612 cdrom_release(&info->devinfo, mode); 1615 cdrom_release(&info->devinfo, mode);
1613 1616
1614 ide_cd_put(info); 1617 ide_cd_put(info);
1618 unlock_kernel();
1615 1619
1616 return 0; 1620 return 0;
1617} 1621}