aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/drivers/ubd_kern.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2010-09-11 12:38:03 -0400
committerArnd Bergmann <arnd@arndb.de>2010-10-19 05:29:42 -0400
commit9a181c58617134822ae596339dbea076ef9b5cf7 (patch)
treeb90b52c0bcb4ae3057e5ddd403230415f4cb528a /arch/um/drivers/ubd_kern.c
parentfa0d4c26be9f989816b30626f6c67d9e7ef867f8 (diff)
uml: kill big kernel lock
Three uml device drivers still use the big kernel lock, but all of them can be safely converted to using a per-driver mutex instead. Most likely this is not even necessary, so after further review these can and should be removed as well. The exec system call no longer requires the BKL either, so remove it from there, too. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Jeff Dike <jdike@addtoit.com> Cc: user-mode-linux-devel@lists.sourceforge.net
Diffstat (limited to 'arch/um/drivers/ubd_kern.c')
-rw-r--r--arch/um/drivers/ubd_kern.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 1bcd208c459f..0c053607ce98 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -33,7 +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/mutex.h"
37#include "linux/blkpg.h" 37#include "linux/blkpg.h"
38#include "linux/genhd.h" 38#include "linux/genhd.h"
39#include "linux/spinlock.h" 39#include "linux/spinlock.h"
@@ -100,6 +100,7 @@ static inline void ubd_set_bit(__u64 bit, unsigned char *data)
100#define DRIVER_NAME "uml-blkdev" 100#define DRIVER_NAME "uml-blkdev"
101 101
102static DEFINE_MUTEX(ubd_lock); 102static DEFINE_MUTEX(ubd_lock);
103static DEFINE_MUTEX(ubd_mutex); /* replaces BKL, might not be needed */
103 104
104static int ubd_open(struct block_device *bdev, fmode_t mode); 105static int ubd_open(struct block_device *bdev, fmode_t mode);
105static int ubd_release(struct gendisk *disk, fmode_t mode); 106static int ubd_release(struct gendisk *disk, fmode_t mode);
@@ -1099,7 +1100,7 @@ static int ubd_open(struct block_device *bdev, fmode_t mode)
1099 struct ubd *ubd_dev = disk->private_data; 1100 struct ubd *ubd_dev = disk->private_data;
1100 int err = 0; 1101 int err = 0;
1101 1102
1102 lock_kernel(); 1103 mutex_lock(&ubd_mutex);
1103 if(ubd_dev->count == 0){ 1104 if(ubd_dev->count == 0){
1104 err = ubd_open_dev(ubd_dev); 1105 err = ubd_open_dev(ubd_dev);
1105 if(err){ 1106 if(err){
@@ -1118,7 +1119,7 @@ static int ubd_open(struct block_device *bdev, fmode_t mode)
1118 err = -EROFS; 1119 err = -EROFS;
1119 }*/ 1120 }*/
1120out: 1121out:
1121 unlock_kernel(); 1122 mutex_unlock(&ubd_mutex);
1122 return err; 1123 return err;
1123} 1124}
1124 1125
@@ -1126,10 +1127,10 @@ static int ubd_release(struct gendisk *disk, fmode_t mode)
1126{ 1127{
1127 struct ubd *ubd_dev = disk->private_data; 1128 struct ubd *ubd_dev = disk->private_data;
1128 1129
1129 lock_kernel(); 1130 mutex_lock(&ubd_mutex);
1130 if(--ubd_dev->count == 0) 1131 if(--ubd_dev->count == 0)
1131 ubd_close_dev(ubd_dev); 1132 ubd_close_dev(ubd_dev);
1132 unlock_kernel(); 1133 mutex_unlock(&ubd_mutex);
1133 return 0; 1134 return 0;
1134} 1135}
1135 1136