aboutsummaryrefslogtreecommitdiffstats
path: root/arch
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 /arch
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 'arch')
-rw-r--r--arch/um/drivers/ubd_kern.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index da992a3ad6b7..1bcd208c459f 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -33,6 +33,7 @@
33#include "linux/mm.h" 33#include "linux/mm.h"
34#include "linux/slab.h" 34#include "linux/slab.h"
35#include "linux/vmalloc.h" 35#include "linux/vmalloc.h"
36#include "linux/smp_lock.h"
36#include "linux/blkpg.h" 37#include "linux/blkpg.h"
37#include "linux/genhd.h" 38#include "linux/genhd.h"
38#include "linux/spinlock.h" 39#include "linux/spinlock.h"
@@ -1098,6 +1099,7 @@ static int ubd_open(struct block_device *bdev, fmode_t mode)
1098 struct ubd *ubd_dev = disk->private_data; 1099 struct ubd *ubd_dev = disk->private_data;
1099 int err = 0; 1100 int err = 0;
1100 1101
1102 lock_kernel();
1101 if(ubd_dev->count == 0){ 1103 if(ubd_dev->count == 0){
1102 err = ubd_open_dev(ubd_dev); 1104 err = ubd_open_dev(ubd_dev);
1103 if(err){ 1105 if(err){
@@ -1115,7 +1117,8 @@ static int ubd_open(struct block_device *bdev, fmode_t mode)
1115 if(--ubd_dev->count == 0) ubd_close_dev(ubd_dev); 1117 if(--ubd_dev->count == 0) ubd_close_dev(ubd_dev);
1116 err = -EROFS; 1118 err = -EROFS;
1117 }*/ 1119 }*/
1118 out: 1120out:
1121 unlock_kernel();
1119 return err; 1122 return err;
1120} 1123}
1121 1124
@@ -1123,8 +1126,10 @@ static int ubd_release(struct gendisk *disk, fmode_t mode)
1123{ 1126{
1124 struct ubd *ubd_dev = disk->private_data; 1127 struct ubd *ubd_dev = disk->private_data;
1125 1128
1129 lock_kernel();
1126 if(--ubd_dev->count == 0) 1130 if(--ubd_dev->count == 0)
1127 ubd_close_dev(ubd_dev); 1131 ubd_close_dev(ubd_dev);
1132 unlock_kernel();
1128 return 0; 1133 return 0;
1129} 1134}
1130 1135