aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/pktcdvd.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/pktcdvd.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/pktcdvd.c')
-rw-r--r--drivers/block/pktcdvd.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 40f1e31f42c4..b1cbeb59bb76 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -2383,6 +2383,7 @@ static int pkt_open(struct block_device *bdev, fmode_t mode)
2383 2383
2384 VPRINTK(DRIVER_NAME": entering open\n"); 2384 VPRINTK(DRIVER_NAME": entering open\n");
2385 2385
2386 lock_kernel();
2386 mutex_lock(&ctl_mutex); 2387 mutex_lock(&ctl_mutex);
2387 pd = pkt_find_dev_from_minor(MINOR(bdev->bd_dev)); 2388 pd = pkt_find_dev_from_minor(MINOR(bdev->bd_dev));
2388 if (!pd) { 2389 if (!pd) {
@@ -2410,6 +2411,7 @@ static int pkt_open(struct block_device *bdev, fmode_t mode)
2410 } 2411 }
2411 2412
2412 mutex_unlock(&ctl_mutex); 2413 mutex_unlock(&ctl_mutex);
2414 unlock_kernel();
2413 return 0; 2415 return 0;
2414 2416
2415out_dec: 2417out_dec:
@@ -2417,6 +2419,7 @@ out_dec:
2417out: 2419out:
2418 VPRINTK(DRIVER_NAME": failed open (%d)\n", ret); 2420 VPRINTK(DRIVER_NAME": failed open (%d)\n", ret);
2419 mutex_unlock(&ctl_mutex); 2421 mutex_unlock(&ctl_mutex);
2422 unlock_kernel();
2420 return ret; 2423 return ret;
2421} 2424}
2422 2425
@@ -2425,6 +2428,7 @@ static int pkt_close(struct gendisk *disk, fmode_t mode)
2425 struct pktcdvd_device *pd = disk->private_data; 2428 struct pktcdvd_device *pd = disk->private_data;
2426 int ret = 0; 2429 int ret = 0;
2427 2430
2431 lock_kernel();
2428 mutex_lock(&ctl_mutex); 2432 mutex_lock(&ctl_mutex);
2429 pd->refcnt--; 2433 pd->refcnt--;
2430 BUG_ON(pd->refcnt < 0); 2434 BUG_ON(pd->refcnt < 0);
@@ -2433,6 +2437,7 @@ static int pkt_close(struct gendisk *disk, fmode_t mode)
2433 pkt_release_dev(pd, flush); 2437 pkt_release_dev(pd, flush);
2434 } 2438 }
2435 mutex_unlock(&ctl_mutex); 2439 mutex_unlock(&ctl_mutex);
2440 unlock_kernel();
2436 return ret; 2441 return ret;
2437} 2442}
2438 2443