diff options
author | Arnd Bergmann <arnd@arndb.de> | 2010-07-08 04:18:46 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-08-07 12:25:00 -0400 |
commit | 8a6cfeb6deca3a8fefd639d898b0d163c0b5d368 (patch) | |
tree | 9a633ad48c3b1ada0519ee7bade0602f940037f6 /drivers/scsi/sr.c | |
parent | 34484062445fe905bf02c72f87ddda21881acda3 (diff) |
block: push down BKL into .locked_ioctl
As a preparation for the removal of the big kernel
lock in the block layer, this removes the BKL
from the common ioctl handling code, moving it
into every single driver still using it.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'drivers/scsi/sr.c')
-rw-r--r-- | drivers/scsi/sr.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 0a90abc7f140..d42fa6468f41 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/init.h> | 44 | #include <linux/init.h> |
45 | #include <linux/blkdev.h> | 45 | #include <linux/blkdev.h> |
46 | #include <linux/mutex.h> | 46 | #include <linux/mutex.h> |
47 | #include <linux/smp_lock.h> | ||
47 | #include <linux/slab.h> | 48 | #include <linux/slab.h> |
48 | #include <asm/uaccess.h> | 49 | #include <asm/uaccess.h> |
49 | 50 | ||
@@ -493,6 +494,8 @@ static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, | |||
493 | void __user *argp = (void __user *)arg; | 494 | void __user *argp = (void __user *)arg; |
494 | int ret; | 495 | int ret; |
495 | 496 | ||
497 | lock_kernel(); | ||
498 | |||
496 | /* | 499 | /* |
497 | * Send SCSI addressing ioctls directly to mid level, send other | 500 | * Send SCSI addressing ioctls directly to mid level, send other |
498 | * ioctls to cdrom/block level. | 501 | * ioctls to cdrom/block level. |
@@ -500,12 +503,13 @@ static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, | |||
500 | switch (cmd) { | 503 | switch (cmd) { |
501 | case SCSI_IOCTL_GET_IDLUN: | 504 | case SCSI_IOCTL_GET_IDLUN: |
502 | case SCSI_IOCTL_GET_BUS_NUMBER: | 505 | case SCSI_IOCTL_GET_BUS_NUMBER: |
503 | return scsi_ioctl(sdev, cmd, argp); | 506 | ret = scsi_ioctl(sdev, cmd, argp); |
507 | goto out; | ||
504 | } | 508 | } |
505 | 509 | ||
506 | ret = cdrom_ioctl(&cd->cdi, bdev, mode, cmd, arg); | 510 | ret = cdrom_ioctl(&cd->cdi, bdev, mode, cmd, arg); |
507 | if (ret != -ENOSYS) | 511 | if (ret != -ENOSYS) |
508 | return ret; | 512 | goto out; |
509 | 513 | ||
510 | /* | 514 | /* |
511 | * ENODEV means that we didn't recognise the ioctl, or that we | 515 | * ENODEV means that we didn't recognise the ioctl, or that we |
@@ -516,8 +520,12 @@ static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, | |||
516 | ret = scsi_nonblockable_ioctl(sdev, cmd, argp, | 520 | ret = scsi_nonblockable_ioctl(sdev, cmd, argp, |
517 | (mode & FMODE_NDELAY) != 0); | 521 | (mode & FMODE_NDELAY) != 0); |
518 | if (ret != -ENODEV) | 522 | if (ret != -ENODEV) |
519 | return ret; | 523 | goto out; |
520 | return scsi_ioctl(sdev, cmd, argp); | 524 | ret = scsi_ioctl(sdev, cmd, argp); |
525 | |||
526 | out: | ||
527 | unlock_kernel(); | ||
528 | return ret; | ||
521 | } | 529 | } |
522 | 530 | ||
523 | static int sr_block_media_changed(struct gendisk *disk) | 531 | static int sr_block_media_changed(struct gendisk *disk) |
@@ -531,7 +539,7 @@ static const struct block_device_operations sr_bdops = | |||
531 | .owner = THIS_MODULE, | 539 | .owner = THIS_MODULE, |
532 | .open = sr_block_open, | 540 | .open = sr_block_open, |
533 | .release = sr_block_release, | 541 | .release = sr_block_release, |
534 | .locked_ioctl = sr_block_ioctl, | 542 | .ioctl = sr_block_ioctl, |
535 | .media_changed = sr_block_media_changed, | 543 | .media_changed = sr_block_media_changed, |
536 | /* | 544 | /* |
537 | * No compat_ioctl for now because sr_block_ioctl never | 545 | * No compat_ioctl for now because sr_block_ioctl never |