diff options
Diffstat (limited to 'drivers/message')
-rw-r--r-- | drivers/message/i2o/i2o_block.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c index fc593fbab696..e6733bc99724 100644 --- a/drivers/message/i2o/i2o_block.c +++ b/drivers/message/i2o/i2o_block.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #include <linux/module.h> | 53 | #include <linux/module.h> |
54 | #include <linux/slab.h> | 54 | #include <linux/slab.h> |
55 | #include <linux/i2o.h> | 55 | #include <linux/i2o.h> |
56 | #include <linux/smp_lock.h> | ||
56 | 57 | ||
57 | #include <linux/mempool.h> | 58 | #include <linux/mempool.h> |
58 | 59 | ||
@@ -577,6 +578,7 @@ static int i2o_block_open(struct block_device *bdev, fmode_t mode) | |||
577 | if (!dev->i2o_dev) | 578 | if (!dev->i2o_dev) |
578 | return -ENODEV; | 579 | return -ENODEV; |
579 | 580 | ||
581 | lock_kernel(); | ||
580 | if (dev->power > 0x1f) | 582 | if (dev->power > 0x1f) |
581 | i2o_block_device_power(dev, 0x02); | 583 | i2o_block_device_power(dev, 0x02); |
582 | 584 | ||
@@ -585,6 +587,7 @@ static int i2o_block_open(struct block_device *bdev, fmode_t mode) | |||
585 | i2o_block_device_lock(dev->i2o_dev, -1); | 587 | i2o_block_device_lock(dev->i2o_dev, -1); |
586 | 588 | ||
587 | osm_debug("Ready.\n"); | 589 | osm_debug("Ready.\n"); |
590 | unlock_kernel(); | ||
588 | 591 | ||
589 | return 0; | 592 | return 0; |
590 | }; | 593 | }; |
@@ -615,6 +618,7 @@ static int i2o_block_release(struct gendisk *disk, fmode_t mode) | |||
615 | if (!dev->i2o_dev) | 618 | if (!dev->i2o_dev) |
616 | return 0; | 619 | return 0; |
617 | 620 | ||
621 | lock_kernel(); | ||
618 | i2o_block_device_flush(dev->i2o_dev); | 622 | i2o_block_device_flush(dev->i2o_dev); |
619 | 623 | ||
620 | i2o_block_device_unlock(dev->i2o_dev, -1); | 624 | i2o_block_device_unlock(dev->i2o_dev, -1); |
@@ -625,6 +629,7 @@ static int i2o_block_release(struct gendisk *disk, fmode_t mode) | |||
625 | operation = 0x24; | 629 | operation = 0x24; |
626 | 630 | ||
627 | i2o_block_device_power(dev, operation); | 631 | i2o_block_device_power(dev, operation); |
632 | unlock_kernel(); | ||
628 | 633 | ||
629 | return 0; | 634 | return 0; |
630 | } | 635 | } |
@@ -652,30 +657,40 @@ static int i2o_block_ioctl(struct block_device *bdev, fmode_t mode, | |||
652 | { | 657 | { |
653 | struct gendisk *disk = bdev->bd_disk; | 658 | struct gendisk *disk = bdev->bd_disk; |
654 | struct i2o_block_device *dev = disk->private_data; | 659 | struct i2o_block_device *dev = disk->private_data; |
660 | int ret = -ENOTTY; | ||
655 | 661 | ||
656 | /* Anyone capable of this syscall can do *real bad* things */ | 662 | /* Anyone capable of this syscall can do *real bad* things */ |
657 | 663 | ||
658 | if (!capable(CAP_SYS_ADMIN)) | 664 | if (!capable(CAP_SYS_ADMIN)) |
659 | return -EPERM; | 665 | return -EPERM; |
660 | 666 | ||
667 | lock_kernel(); | ||
661 | switch (cmd) { | 668 | switch (cmd) { |
662 | case BLKI2OGRSTRAT: | 669 | case BLKI2OGRSTRAT: |
663 | return put_user(dev->rcache, (int __user *)arg); | 670 | ret = put_user(dev->rcache, (int __user *)arg); |
671 | break; | ||
664 | case BLKI2OGWSTRAT: | 672 | case BLKI2OGWSTRAT: |
665 | return put_user(dev->wcache, (int __user *)arg); | 673 | ret = put_user(dev->wcache, (int __user *)arg); |
674 | break; | ||
666 | case BLKI2OSRSTRAT: | 675 | case BLKI2OSRSTRAT: |
676 | ret = -EINVAL; | ||
667 | if (arg < 0 || arg > CACHE_SMARTFETCH) | 677 | if (arg < 0 || arg > CACHE_SMARTFETCH) |
668 | return -EINVAL; | 678 | break; |
669 | dev->rcache = arg; | 679 | dev->rcache = arg; |
680 | ret = 0; | ||
670 | break; | 681 | break; |
671 | case BLKI2OSWSTRAT: | 682 | case BLKI2OSWSTRAT: |
683 | ret = -EINVAL; | ||
672 | if (arg != 0 | 684 | if (arg != 0 |
673 | && (arg < CACHE_WRITETHROUGH || arg > CACHE_SMARTBACK)) | 685 | && (arg < CACHE_WRITETHROUGH || arg > CACHE_SMARTBACK)) |
674 | return -EINVAL; | 686 | break; |
675 | dev->wcache = arg; | 687 | dev->wcache = arg; |
688 | ret = 0; | ||
676 | break; | 689 | break; |
677 | } | 690 | } |
678 | return -ENOTTY; | 691 | unlock_kernel(); |
692 | |||
693 | return ret; | ||
679 | }; | 694 | }; |
680 | 695 | ||
681 | /** | 696 | /** |
@@ -883,7 +898,7 @@ static void i2o_block_request_fn(struct request_queue *q) | |||
883 | if (!req) | 898 | if (!req) |
884 | break; | 899 | break; |
885 | 900 | ||
886 | if (blk_fs_request(req)) { | 901 | if (req->cmd_type == REQ_TYPE_FS) { |
887 | struct i2o_block_delayed_request *dreq; | 902 | struct i2o_block_delayed_request *dreq; |
888 | struct i2o_block_request *ireq = req->special; | 903 | struct i2o_block_request *ireq = req->special; |
889 | unsigned int queue_depth; | 904 | unsigned int queue_depth; |
@@ -930,7 +945,8 @@ static const struct block_device_operations i2o_block_fops = { | |||
930 | .owner = THIS_MODULE, | 945 | .owner = THIS_MODULE, |
931 | .open = i2o_block_open, | 946 | .open = i2o_block_open, |
932 | .release = i2o_block_release, | 947 | .release = i2o_block_release, |
933 | .locked_ioctl = i2o_block_ioctl, | 948 | .ioctl = i2o_block_ioctl, |
949 | .compat_ioctl = i2o_block_ioctl, | ||
934 | .getgeo = i2o_block_getgeo, | 950 | .getgeo = i2o_block_getgeo, |
935 | .media_changed = i2o_block_media_changed | 951 | .media_changed = i2o_block_media_changed |
936 | }; | 952 | }; |