aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-tape.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r--drivers/ide/ide-tape.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index b07232880ec9..6d622cb5ac81 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -32,6 +32,7 @@
32#include <linux/errno.h> 32#include <linux/errno.h>
33#include <linux/genhd.h> 33#include <linux/genhd.h>
34#include <linux/seq_file.h> 34#include <linux/seq_file.h>
35#include <linux/smp_lock.h>
35#include <linux/slab.h> 36#include <linux/slab.h>
36#include <linux/pci.h> 37#include <linux/pci.h>
37#include <linux/ide.h> 38#include <linux/ide.h>
@@ -577,7 +578,8 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
577 rq->cmd[0], (unsigned long long)blk_rq_pos(rq), 578 rq->cmd[0], (unsigned long long)blk_rq_pos(rq),
578 blk_rq_sectors(rq)); 579 blk_rq_sectors(rq));
579 580
580 BUG_ON(!(blk_special_request(rq) || blk_sense_request(rq))); 581 BUG_ON(!(rq->cmd_type == REQ_TYPE_SPECIAL ||
582 rq->cmd_type == REQ_TYPE_SENSE));
581 583
582 /* Retry a failed packet command */ 584 /* Retry a failed packet command */
583 if (drive->failed_pc && drive->pc->c[0] == REQUEST_SENSE) { 585 if (drive->failed_pc && drive->pc->c[0] == REQUEST_SENSE) {
@@ -1905,7 +1907,11 @@ static const struct file_operations idetape_fops = {
1905 1907
1906static int idetape_open(struct block_device *bdev, fmode_t mode) 1908static int idetape_open(struct block_device *bdev, fmode_t mode)
1907{ 1909{
1908 struct ide_tape_obj *tape = ide_tape_get(bdev->bd_disk, false, 0); 1910 struct ide_tape_obj *tape;
1911
1912 lock_kernel();
1913 tape = ide_tape_get(bdev->bd_disk, false, 0);
1914 unlock_kernel();
1909 1915
1910 if (!tape) 1916 if (!tape)
1911 return -ENXIO; 1917 return -ENXIO;
@@ -1917,7 +1923,10 @@ static int idetape_release(struct gendisk *disk, fmode_t mode)
1917{ 1923{
1918 struct ide_tape_obj *tape = ide_drv_g(disk, ide_tape_obj); 1924 struct ide_tape_obj *tape = ide_drv_g(disk, ide_tape_obj);
1919 1925
1926 lock_kernel();
1920 ide_tape_put(tape); 1927 ide_tape_put(tape);
1928 unlock_kernel();
1929
1921 return 0; 1930 return 0;
1922} 1931}
1923 1932
@@ -1926,9 +1935,14 @@ static int idetape_ioctl(struct block_device *bdev, fmode_t mode,
1926{ 1935{
1927 struct ide_tape_obj *tape = ide_drv_g(bdev->bd_disk, ide_tape_obj); 1936 struct ide_tape_obj *tape = ide_drv_g(bdev->bd_disk, ide_tape_obj);
1928 ide_drive_t *drive = tape->drive; 1937 ide_drive_t *drive = tape->drive;
1929 int err = generic_ide_ioctl(drive, bdev, cmd, arg); 1938 int err;
1939
1940 lock_kernel();
1941 err = generic_ide_ioctl(drive, bdev, cmd, arg);
1930 if (err == -EINVAL) 1942 if (err == -EINVAL)
1931 err = idetape_blkdev_ioctl(drive, cmd, arg); 1943 err = idetape_blkdev_ioctl(drive, cmd, arg);
1944 unlock_kernel();
1945
1932 return err; 1946 return err;
1933} 1947}
1934 1948
@@ -1936,7 +1950,7 @@ static const struct block_device_operations idetape_block_ops = {
1936 .owner = THIS_MODULE, 1950 .owner = THIS_MODULE,
1937 .open = idetape_open, 1951 .open = idetape_open,
1938 .release = idetape_release, 1952 .release = idetape_release,
1939 .locked_ioctl = idetape_ioctl, 1953 .ioctl = idetape_ioctl,
1940}; 1954};
1941 1955
1942static int ide_tape_probe(ide_drive_t *drive) 1956static int ide_tape_probe(ide_drive_t *drive)