diff options
Diffstat (limited to 'drivers/block/ub.c')
-rw-r--r-- | drivers/block/ub.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index c48e14878582..b5690a045a01 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <linux/timer.h> | 28 | #include <linux/timer.h> |
29 | #include <linux/scatterlist.h> | 29 | #include <linux/scatterlist.h> |
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | #include <linux/smp_lock.h> | 31 | #include <linux/mutex.h> |
32 | #include <scsi/scsi.h> | 32 | #include <scsi/scsi.h> |
33 | 33 | ||
34 | #define DRV_NAME "ub" | 34 | #define DRV_NAME "ub" |
@@ -248,6 +248,7 @@ struct ub_completion { | |||
248 | spinlock_t lock; | 248 | spinlock_t lock; |
249 | }; | 249 | }; |
250 | 250 | ||
251 | static DEFINE_MUTEX(ub_mutex); | ||
251 | static inline void ub_init_completion(struct ub_completion *x) | 252 | static inline void ub_init_completion(struct ub_completion *x) |
252 | { | 253 | { |
253 | x->done = 0; | 254 | x->done = 0; |
@@ -1715,9 +1716,9 @@ static int ub_bd_unlocked_open(struct block_device *bdev, fmode_t mode) | |||
1715 | { | 1716 | { |
1716 | int ret; | 1717 | int ret; |
1717 | 1718 | ||
1718 | lock_kernel(); | 1719 | mutex_lock(&ub_mutex); |
1719 | ret = ub_bd_open(bdev, mode); | 1720 | ret = ub_bd_open(bdev, mode); |
1720 | unlock_kernel(); | 1721 | mutex_unlock(&ub_mutex); |
1721 | 1722 | ||
1722 | return ret; | 1723 | return ret; |
1723 | } | 1724 | } |
@@ -1730,9 +1731,9 @@ static int ub_bd_release(struct gendisk *disk, fmode_t mode) | |||
1730 | struct ub_lun *lun = disk->private_data; | 1731 | struct ub_lun *lun = disk->private_data; |
1731 | struct ub_dev *sc = lun->udev; | 1732 | struct ub_dev *sc = lun->udev; |
1732 | 1733 | ||
1733 | lock_kernel(); | 1734 | mutex_lock(&ub_mutex); |
1734 | ub_put(sc); | 1735 | ub_put(sc); |
1735 | unlock_kernel(); | 1736 | mutex_unlock(&ub_mutex); |
1736 | 1737 | ||
1737 | return 0; | 1738 | return 0; |
1738 | } | 1739 | } |
@@ -1747,9 +1748,9 @@ static int ub_bd_ioctl(struct block_device *bdev, fmode_t mode, | |||
1747 | void __user *usermem = (void __user *) arg; | 1748 | void __user *usermem = (void __user *) arg; |
1748 | int ret; | 1749 | int ret; |
1749 | 1750 | ||
1750 | lock_kernel(); | 1751 | mutex_lock(&ub_mutex); |
1751 | ret = scsi_cmd_ioctl(disk->queue, disk, mode, cmd, usermem); | 1752 | ret = scsi_cmd_ioctl(disk->queue, disk, mode, cmd, usermem); |
1752 | unlock_kernel(); | 1753 | mutex_unlock(&ub_mutex); |
1753 | 1754 | ||
1754 | return ret; | 1755 | return ret; |
1755 | } | 1756 | } |