diff options
Diffstat (limited to 'drivers/block/virtio_blk.c')
-rw-r--r-- | drivers/block/virtio_blk.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 0a3222fd4442..7b0f7b624adf 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -2,6 +2,7 @@ | |||
2 | #include <linux/spinlock.h> | 2 | #include <linux/spinlock.h> |
3 | #include <linux/slab.h> | 3 | #include <linux/slab.h> |
4 | #include <linux/blkdev.h> | 4 | #include <linux/blkdev.h> |
5 | #include <linux/smp_lock.h> | ||
5 | #include <linux/hdreg.h> | 6 | #include <linux/hdreg.h> |
6 | #include <linux/virtio.h> | 7 | #include <linux/virtio.h> |
7 | #include <linux/virtio_blk.h> | 8 | #include <linux/virtio_blk.h> |
@@ -217,7 +218,7 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) | |||
217 | return blk_execute_rq(vblk->disk->queue, vblk->disk, req, false); | 218 | return blk_execute_rq(vblk->disk->queue, vblk->disk, req, false); |
218 | } | 219 | } |
219 | 220 | ||
220 | static int virtblk_ioctl(struct block_device *bdev, fmode_t mode, | 221 | static int virtblk_locked_ioctl(struct block_device *bdev, fmode_t mode, |
221 | unsigned cmd, unsigned long data) | 222 | unsigned cmd, unsigned long data) |
222 | { | 223 | { |
223 | struct gendisk *disk = bdev->bd_disk; | 224 | struct gendisk *disk = bdev->bd_disk; |
@@ -243,6 +244,18 @@ static int virtblk_ioctl(struct block_device *bdev, fmode_t mode, | |||
243 | (void __user *)data); | 244 | (void __user *)data); |
244 | } | 245 | } |
245 | 246 | ||
247 | static int virtblk_ioctl(struct block_device *bdev, fmode_t mode, | ||
248 | unsigned int cmd, unsigned long param) | ||
249 | { | ||
250 | int ret; | ||
251 | |||
252 | lock_kernel(); | ||
253 | ret = virtblk_locked_ioctl(bdev, mode, cmd, param); | ||
254 | unlock_kernel(); | ||
255 | |||
256 | return ret; | ||
257 | } | ||
258 | |||
246 | /* We provide getgeo only to please some old bootloader/partitioning tools */ | 259 | /* We provide getgeo only to please some old bootloader/partitioning tools */ |
247 | static int virtblk_getgeo(struct block_device *bd, struct hd_geometry *geo) | 260 | static int virtblk_getgeo(struct block_device *bd, struct hd_geometry *geo) |
248 | { | 261 | { |
@@ -269,7 +282,7 @@ static int virtblk_getgeo(struct block_device *bd, struct hd_geometry *geo) | |||
269 | } | 282 | } |
270 | 283 | ||
271 | static const struct block_device_operations virtblk_fops = { | 284 | static const struct block_device_operations virtblk_fops = { |
272 | .locked_ioctl = virtblk_ioctl, | 285 | .ioctl = virtblk_ioctl, |
273 | .owner = THIS_MODULE, | 286 | .owner = THIS_MODULE, |
274 | .getgeo = virtblk_getgeo, | 287 | .getgeo = virtblk_getgeo, |
275 | }; | 288 | }; |