aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/xen-blkfront.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/xen-blkfront.c')
-rw-r--r--drivers/block/xen-blkfront.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index ab735a605cf3..3ff06f475eef 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -41,7 +41,7 @@
41#include <linux/cdrom.h> 41#include <linux/cdrom.h>
42#include <linux/module.h> 42#include <linux/module.h>
43#include <linux/slab.h> 43#include <linux/slab.h>
44#include <linux/smp_lock.h> 44#include <linux/mutex.h>
45#include <linux/scatterlist.h> 45#include <linux/scatterlist.h>
46 46
47#include <xen/xen.h> 47#include <xen/xen.h>
@@ -69,6 +69,7 @@ struct blk_shadow {
69 unsigned long frame[BLKIF_MAX_SEGMENTS_PER_REQUEST]; 69 unsigned long frame[BLKIF_MAX_SEGMENTS_PER_REQUEST];
70}; 70};
71 71
72static DEFINE_MUTEX(blkfront_mutex);
72static const struct block_device_operations xlvbd_block_fops; 73static const struct block_device_operations xlvbd_block_fops;
73 74
74#define BLK_RING_SIZE __RING_SIZE((struct blkif_sring *)0, PAGE_SIZE) 75#define BLK_RING_SIZE __RING_SIZE((struct blkif_sring *)0, PAGE_SIZE)
@@ -1201,7 +1202,7 @@ static int blkif_open(struct block_device *bdev, fmode_t mode)
1201 struct blkfront_info *info; 1202 struct blkfront_info *info;
1202 int err = 0; 1203 int err = 0;
1203 1204
1204 lock_kernel(); 1205 mutex_lock(&blkfront_mutex);
1205 1206
1206 info = disk->private_data; 1207 info = disk->private_data;
1207 if (!info) { 1208 if (!info) {
@@ -1219,7 +1220,7 @@ static int blkif_open(struct block_device *bdev, fmode_t mode)
1219 mutex_unlock(&info->mutex); 1220 mutex_unlock(&info->mutex);
1220 1221
1221out: 1222out:
1222 unlock_kernel(); 1223 mutex_unlock(&blkfront_mutex);
1223 return err; 1224 return err;
1224} 1225}
1225 1226
@@ -1229,7 +1230,7 @@ static int blkif_release(struct gendisk *disk, fmode_t mode)
1229 struct block_device *bdev; 1230 struct block_device *bdev;
1230 struct xenbus_device *xbdev; 1231 struct xenbus_device *xbdev;
1231 1232
1232 lock_kernel(); 1233 mutex_lock(&blkfront_mutex);
1233 1234
1234 bdev = bdget_disk(disk, 0); 1235 bdev = bdget_disk(disk, 0);
1235 bdput(bdev); 1236 bdput(bdev);
@@ -1263,7 +1264,7 @@ static int blkif_release(struct gendisk *disk, fmode_t mode)
1263 } 1264 }
1264 1265
1265out: 1266out:
1266 unlock_kernel(); 1267 mutex_unlock(&blkfront_mutex);
1267 return 0; 1268 return 0;
1268} 1269}
1269 1270