diff options
Diffstat (limited to 'drivers/block/xen-blkfront.c')
-rw-r--r-- | drivers/block/xen-blkfront.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 9119cd3d56a4..91374282755d 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -41,6 +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/scatterlist.h> | 45 | #include <linux/scatterlist.h> |
45 | 46 | ||
46 | #include <xen/xen.h> | 47 | #include <xen/xen.h> |
@@ -1018,13 +1019,18 @@ static int blkfront_is_ready(struct xenbus_device *dev) | |||
1018 | static int blkif_open(struct block_device *bdev, fmode_t mode) | 1019 | static int blkif_open(struct block_device *bdev, fmode_t mode) |
1019 | { | 1020 | { |
1020 | struct blkfront_info *info = bdev->bd_disk->private_data; | 1021 | struct blkfront_info *info = bdev->bd_disk->private_data; |
1022 | |||
1023 | lock_kernel(); | ||
1021 | info->users++; | 1024 | info->users++; |
1025 | unlock_kernel(); | ||
1026 | |||
1022 | return 0; | 1027 | return 0; |
1023 | } | 1028 | } |
1024 | 1029 | ||
1025 | static int blkif_release(struct gendisk *disk, fmode_t mode) | 1030 | static int blkif_release(struct gendisk *disk, fmode_t mode) |
1026 | { | 1031 | { |
1027 | struct blkfront_info *info = disk->private_data; | 1032 | struct blkfront_info *info = disk->private_data; |
1033 | lock_kernel(); | ||
1028 | info->users--; | 1034 | info->users--; |
1029 | if (info->users == 0) { | 1035 | if (info->users == 0) { |
1030 | /* Check whether we have been instructed to close. We will | 1036 | /* Check whether we have been instructed to close. We will |
@@ -1036,6 +1042,7 @@ static int blkif_release(struct gendisk *disk, fmode_t mode) | |||
1036 | if (state == XenbusStateClosing && info->is_ready) | 1042 | if (state == XenbusStateClosing && info->is_ready) |
1037 | blkfront_closing(dev); | 1043 | blkfront_closing(dev); |
1038 | } | 1044 | } |
1045 | unlock_kernel(); | ||
1039 | return 0; | 1046 | return 0; |
1040 | } | 1047 | } |
1041 | 1048 | ||