aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-14 17:48:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-14 17:48:31 -0400
commitd1794f2c5b5817eb79ccc5e00701ca748d1b073a (patch)
tree5a4c98e694e88a8c82f342d0cc9edb2a4cbbef36 /drivers/scsi
parenta41eebab7537890409ea9dfe0fcda9b5fbdb090d (diff)
parent2fceef397f9880b212a74c418290ce69e7ac00eb (diff)
Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6
* 'bkl-removal' of git://git.lwn.net/linux-2.6: (146 commits) IB/umad: BKL is not needed for ib_umad_open() IB/uverbs: BKL is not needed for ib_uverbs_open() bf561-coreb: BKL unneeded for open() Call fasync() functions without the BKL snd/PCM: fasync BKL pushdown ipmi: fasync BKL pushdown ecryptfs: fasync BKL pushdown Bluetooth VHCI: fasync BKL pushdown tty_io: fasync BKL pushdown tun: fasync BKL pushdown i2o: fasync BKL pushdown mpt: fasync BKL pushdown Remove BKL from remote_llseek v2 Make FAT users happier by not deadlocking x86-mce: BKL pushdown vmwatchdog: BKL pushdown vmcp: BKL pushdown via-pmu: BKL pushdown uml-random: BKL pushdown uml-mmapper: BKL pushdown ...
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/3w-9xxx.c3
-rw-r--r--drivers/scsi/3w-xxxx.c3
-rw-r--r--drivers/scsi/aacraid/linit.c3
-rw-r--r--drivers/scsi/ch.c4
-rw-r--r--drivers/scsi/dpt_i2o.c5
-rw-r--r--drivers/scsi/gdth.c3
-rw-r--r--drivers/scsi/megaraid.c5
-rw-r--r--drivers/scsi/megaraid/megaraid_mm.c2
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.c2
-rw-r--r--drivers/scsi/osst.c15
-rw-r--r--drivers/scsi/scsi_tgt_if.c2
-rw-r--r--drivers/scsi/sg.c16
-rw-r--r--drivers/scsi/st.c11
13 files changed, 66 insertions, 8 deletions
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index 867f6fd5c2c0..7045511f9ad2 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -84,6 +84,7 @@
84#include <linux/pci.h> 84#include <linux/pci.h>
85#include <linux/time.h> 85#include <linux/time.h>
86#include <linux/mutex.h> 86#include <linux/mutex.h>
87#include <linux/smp_lock.h>
87#include <asm/io.h> 88#include <asm/io.h>
88#include <asm/irq.h> 89#include <asm/irq.h>
89#include <asm/uaccess.h> 90#include <asm/uaccess.h>
@@ -862,11 +863,13 @@ out:
862} /* End twa_chrdev_ioctl() */ 863} /* End twa_chrdev_ioctl() */
863 864
864/* This function handles open for the character device */ 865/* This function handles open for the character device */
866/* NOTE that this function will race with remove. */
865static int twa_chrdev_open(struct inode *inode, struct file *file) 867static int twa_chrdev_open(struct inode *inode, struct file *file)
866{ 868{
867 unsigned int minor_number; 869 unsigned int minor_number;
868 int retval = TW_IOCTL_ERROR_OS_ENODEV; 870 int retval = TW_IOCTL_ERROR_OS_ENODEV;
869 871
872 cycle_kernel_lock();
870 minor_number = iminor(inode); 873 minor_number = iminor(inode);
871 if (minor_number >= twa_device_extension_count) 874 if (minor_number >= twa_device_extension_count)
872 goto out; 875 goto out;
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index 8c22329aa85e..a0537f09aa21 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -198,6 +198,7 @@
198 198
199#include <linux/module.h> 199#include <linux/module.h>
200#include <linux/reboot.h> 200#include <linux/reboot.h>
201#include <linux/smp_lock.h>
201#include <linux/spinlock.h> 202#include <linux/spinlock.h>
202#include <linux/interrupt.h> 203#include <linux/interrupt.h>
203#include <linux/moduleparam.h> 204#include <linux/moduleparam.h>
@@ -1027,10 +1028,12 @@ out:
1027} /* End tw_chrdev_ioctl() */ 1028} /* End tw_chrdev_ioctl() */
1028 1029
1029/* This function handles open for the character device */ 1030/* This function handles open for the character device */
1031/* NOTE that this function races with remove. */
1030static int tw_chrdev_open(struct inode *inode, struct file *file) 1032static int tw_chrdev_open(struct inode *inode, struct file *file)
1031{ 1033{
1032 unsigned int minor_number; 1034 unsigned int minor_number;
1033 1035
1036 cycle_kernel_lock();
1034 dprintk(KERN_WARNING "3w-xxxx: tw_ioctl_open()\n"); 1037 dprintk(KERN_WARNING "3w-xxxx: tw_ioctl_open()\n");
1035 1038
1036 minor_number = iminor(inode); 1039 minor_number = iminor(inode);
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 1f7c83607f84..68c140e82673 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -38,6 +38,7 @@
38#include <linux/moduleparam.h> 38#include <linux/moduleparam.h>
39#include <linux/pci.h> 39#include <linux/pci.h>
40#include <linux/slab.h> 40#include <linux/slab.h>
41#include <linux/smp_lock.h>
41#include <linux/spinlock.h> 42#include <linux/spinlock.h>
42#include <linux/syscalls.h> 43#include <linux/syscalls.h>
43#include <linux/delay.h> 44#include <linux/delay.h>
@@ -667,6 +668,7 @@ static int aac_cfg_open(struct inode *inode, struct file *file)
667 unsigned minor_number = iminor(inode); 668 unsigned minor_number = iminor(inode);
668 int err = -ENODEV; 669 int err = -ENODEV;
669 670
671 lock_kernel(); /* BKL pushdown: nothing else protects this list */
670 list_for_each_entry(aac, &aac_devices, entry) { 672 list_for_each_entry(aac, &aac_devices, entry) {
671 if (aac->id == minor_number) { 673 if (aac->id == minor_number) {
672 file->private_data = aac; 674 file->private_data = aac;
@@ -674,6 +676,7 @@ static int aac_cfg_open(struct inode *inode, struct file *file)
674 break; 676 break;
675 } 677 }
676 } 678 }
679 unlock_kernel();
677 680
678 return err; 681 return err;
679} 682}
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index c4b938bc30d3..aa2011b64683 100644
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -22,6 +22,7 @@
22#include <linux/chio.h> /* here are all the ioctls */ 22#include <linux/chio.h> /* here are all the ioctls */
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <linux/idr.h> 24#include <linux/idr.h>
25#include <linux/smp_lock.h>
25 26
26#include <scsi/scsi.h> 27#include <scsi/scsi.h>
27#include <scsi/scsi_cmnd.h> 28#include <scsi/scsi_cmnd.h>
@@ -571,16 +572,19 @@ ch_open(struct inode *inode, struct file *file)
571 scsi_changer *ch; 572 scsi_changer *ch;
572 int minor = iminor(inode); 573 int minor = iminor(inode);
573 574
575 lock_kernel();
574 spin_lock(&ch_index_lock); 576 spin_lock(&ch_index_lock);
575 ch = idr_find(&ch_index_idr, minor); 577 ch = idr_find(&ch_index_idr, minor);
576 578
577 if (NULL == ch || scsi_device_get(ch->device)) { 579 if (NULL == ch || scsi_device_get(ch->device)) {
578 spin_unlock(&ch_index_lock); 580 spin_unlock(&ch_index_lock);
581 unlock_kernel();
579 return -ENXIO; 582 return -ENXIO;
580 } 583 }
581 spin_unlock(&ch_index_lock); 584 spin_unlock(&ch_index_lock);
582 585
583 file->private_data = ch; 586 file->private_data = ch;
587 unlock_kernel();
584 return 0; 588 return 0;
585} 589}
586 590
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 8508816f303d..2bc30e32b67a 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -49,6 +49,7 @@ MODULE_DESCRIPTION("Adaptec I2O RAID Driver");
49#include <linux/kernel.h> /* for printk */ 49#include <linux/kernel.h> /* for printk */
50#include <linux/sched.h> 50#include <linux/sched.h>
51#include <linux/reboot.h> 51#include <linux/reboot.h>
52#include <linux/smp_lock.h>
52#include <linux/spinlock.h> 53#include <linux/spinlock.h>
53#include <linux/dma-mapping.h> 54#include <linux/dma-mapping.h>
54 55
@@ -1727,10 +1728,12 @@ static int adpt_open(struct inode *inode, struct file *file)
1727 int minor; 1728 int minor;
1728 adpt_hba* pHba; 1729 adpt_hba* pHba;
1729 1730
1731 lock_kernel();
1730 //TODO check for root access 1732 //TODO check for root access
1731 // 1733 //
1732 minor = iminor(inode); 1734 minor = iminor(inode);
1733 if (minor >= hba_count) { 1735 if (minor >= hba_count) {
1736 unlock_kernel();
1734 return -ENXIO; 1737 return -ENXIO;
1735 } 1738 }
1736 mutex_lock(&adpt_configuration_lock); 1739 mutex_lock(&adpt_configuration_lock);
@@ -1741,6 +1744,7 @@ static int adpt_open(struct inode *inode, struct file *file)
1741 } 1744 }
1742 if (pHba == NULL) { 1745 if (pHba == NULL) {
1743 mutex_unlock(&adpt_configuration_lock); 1746 mutex_unlock(&adpt_configuration_lock);
1747 unlock_kernel();
1744 return -ENXIO; 1748 return -ENXIO;
1745 } 1749 }
1746 1750
@@ -1751,6 +1755,7 @@ static int adpt_open(struct inode *inode, struct file *file)
1751 1755
1752 pHba->in_use = 1; 1756 pHba->in_use = 1;
1753 mutex_unlock(&adpt_configuration_lock); 1757 mutex_unlock(&adpt_configuration_lock);
1758 unlock_kernel();
1754 1759
1755 return 0; 1760 return 0;
1756} 1761}
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 46771d4c81bd..822d5214692b 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -120,6 +120,7 @@
120#include <linux/timer.h> 120#include <linux/timer.h>
121#include <linux/dma-mapping.h> 121#include <linux/dma-mapping.h>
122#include <linux/list.h> 122#include <linux/list.h>
123#include <linux/smp_lock.h>
123 124
124#ifdef GDTH_RTC 125#ifdef GDTH_RTC
125#include <linux/mc146818rtc.h> 126#include <linux/mc146818rtc.h>
@@ -4019,10 +4020,12 @@ static int gdth_open(struct inode *inode, struct file *filep)
4019{ 4020{
4020 gdth_ha_str *ha; 4021 gdth_ha_str *ha;
4021 4022
4023 lock_kernel();
4022 list_for_each_entry(ha, &gdth_instances, list) { 4024 list_for_each_entry(ha, &gdth_instances, list) {
4023 if (!ha->sdev) 4025 if (!ha->sdev)
4024 ha->sdev = scsi_get_host_dev(ha->shost); 4026 ha->sdev = scsi_get_host_dev(ha->shost);
4025 } 4027 }
4028 unlock_kernel();
4026 4029
4027 TRACE(("gdth_open()\n")); 4030 TRACE(("gdth_open()\n"));
4028 return 0; 4031 return 0;
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 18551aaf5e09..28c9da7d4a5c 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -46,6 +46,7 @@
46#include <linux/pci.h> 46#include <linux/pci.h>
47#include <linux/init.h> 47#include <linux/init.h>
48#include <linux/dma-mapping.h> 48#include <linux/dma-mapping.h>
49#include <linux/smp_lock.h>
49#include <scsi/scsicam.h> 50#include <scsi/scsicam.h>
50 51
51#include "scsi.h" 52#include "scsi.h"
@@ -3272,12 +3273,12 @@ mega_init_scb(adapter_t *adapter)
3272 * @filep - unused 3273 * @filep - unused
3273 * 3274 *
3274 * Routines for the character/ioctl interface to the driver. Find out if this 3275 * Routines for the character/ioctl interface to the driver. Find out if this
3275 * is a valid open. If yes, increment the module use count so that it cannot 3276 * is a valid open.
3276 * be unloaded.
3277 */ 3277 */
3278static int 3278static int
3279megadev_open (struct inode *inode, struct file *filep) 3279megadev_open (struct inode *inode, struct file *filep)
3280{ 3280{
3281 cycle_kernel_lock();
3281 /* 3282 /*
3282 * Only allow superuser to access private ioctl interface 3283 * Only allow superuser to access private ioctl interface
3283 */ 3284 */
diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c
index 0ad215e27b83..ac3b280c2a72 100644
--- a/drivers/scsi/megaraid/megaraid_mm.c
+++ b/drivers/scsi/megaraid/megaraid_mm.c
@@ -15,6 +15,7 @@
15 * Common management module 15 * Common management module
16 */ 16 */
17#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/smp_lock.h>
18#include "megaraid_mm.h" 19#include "megaraid_mm.h"
19 20
20 21
@@ -96,6 +97,7 @@ mraid_mm_open(struct inode *inode, struct file *filep)
96 */ 97 */
97 if (!capable(CAP_SYS_ADMIN)) return (-EACCES); 98 if (!capable(CAP_SYS_ADMIN)) return (-EACCES);
98 99
100 cycle_kernel_lock();
99 return 0; 101 return 0;
100} 102}
101 103
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index 7d84c8bbcf3f..fc7ac158476c 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -33,6 +33,7 @@
33#include <linux/spinlock.h> 33#include <linux/spinlock.h>
34#include <linux/interrupt.h> 34#include <linux/interrupt.h>
35#include <linux/delay.h> 35#include <linux/delay.h>
36#include <linux/smp_lock.h>
36#include <linux/uio.h> 37#include <linux/uio.h>
37#include <asm/uaccess.h> 38#include <asm/uaccess.h>
38#include <linux/fs.h> 39#include <linux/fs.h>
@@ -2863,6 +2864,7 @@ static void megasas_shutdown(struct pci_dev *pdev)
2863 */ 2864 */
2864static int megasas_mgmt_open(struct inode *inode, struct file *filep) 2865static int megasas_mgmt_open(struct inode *inode, struct file *filep)
2865{ 2866{
2867 cycle_kernel_lock();
2866 /* 2868 /*
2867 * Allow only those users with admin rights 2869 * Allow only those users with admin rights
2868 */ 2870 */
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 243d8becd30f..1c79f9794f4e 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -50,6 +50,7 @@ static const char * osst_version = "0.99.4";
50#include <linux/moduleparam.h> 50#include <linux/moduleparam.h>
51#include <linux/delay.h> 51#include <linux/delay.h>
52#include <linux/jiffies.h> 52#include <linux/jiffies.h>
53#include <linux/smp_lock.h>
53#include <asm/uaccess.h> 54#include <asm/uaccess.h>
54#include <asm/dma.h> 55#include <asm/dma.h>
55#include <asm/system.h> 56#include <asm/system.h>
@@ -4359,7 +4360,7 @@ os_bypass:
4359 4360
4360 4361
4361/* Open the device */ 4362/* Open the device */
4362static int os_scsi_tape_open(struct inode * inode, struct file * filp) 4363static int __os_scsi_tape_open(struct inode * inode, struct file * filp)
4363{ 4364{
4364 unsigned short flags; 4365 unsigned short flags;
4365 int i, b_size, new_session = 0, retval = 0; 4366 int i, b_size, new_session = 0, retval = 0;
@@ -4725,6 +4726,18 @@ err_out:
4725 return retval; 4726 return retval;
4726} 4727}
4727 4728
4729/* BKL pushdown: spaghetti avoidance wrapper */
4730static int os_scsi_tape_open(struct inode * inode, struct file * filp)
4731{
4732 int ret;
4733
4734 lock_kernel();
4735 ret = __os_scsi_tape_open(inode, filp);
4736 unlock_kernel();
4737 return ret;
4738}
4739
4740
4728 4741
4729/* Flush the tape buffer before close */ 4742/* Flush the tape buffer before close */
4730static int os_scsi_tape_flush(struct file * filp, fl_owner_t id) 4743static int os_scsi_tape_flush(struct file * filp, fl_owner_t id)
diff --git a/drivers/scsi/scsi_tgt_if.c b/drivers/scsi/scsi_tgt_if.c
index d2557dbc2dc1..0e9533f7aabc 100644
--- a/drivers/scsi/scsi_tgt_if.c
+++ b/drivers/scsi/scsi_tgt_if.c
@@ -21,6 +21,7 @@
21 */ 21 */
22#include <linux/miscdevice.h> 22#include <linux/miscdevice.h>
23#include <linux/file.h> 23#include <linux/file.h>
24#include <linux/smp_lock.h>
24#include <net/tcp.h> 25#include <net/tcp.h>
25#include <scsi/scsi.h> 26#include <scsi/scsi.h>
26#include <scsi/scsi_cmnd.h> 27#include <scsi/scsi_cmnd.h>
@@ -321,6 +322,7 @@ static int tgt_open(struct inode *inode, struct file *file)
321{ 322{
322 tx_ring.tr_idx = rx_ring.tr_idx = 0; 323 tx_ring.tr_idx = rx_ring.tr_idx = 0;
323 324
325 cycle_kernel_lock();
324 return 0; 326 return 0;
325} 327}
326 328
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index fe694f0ee19a..fccd2e88d600 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -49,6 +49,7 @@ static int sg_version_num = 30534; /* 2 digits for each component */
49#include <linux/delay.h> 49#include <linux/delay.h>
50#include <linux/scatterlist.h> 50#include <linux/scatterlist.h>
51#include <linux/blktrace_api.h> 51#include <linux/blktrace_api.h>
52#include <linux/smp_lock.h>
52 53
53#include "scsi.h" 54#include "scsi.h"
54#include <scsi/scsi_dbg.h> 55#include <scsi/scsi_dbg.h>
@@ -227,19 +228,26 @@ sg_open(struct inode *inode, struct file *filp)
227 int res; 228 int res;
228 int retval; 229 int retval;
229 230
231 lock_kernel();
230 nonseekable_open(inode, filp); 232 nonseekable_open(inode, filp);
231 SCSI_LOG_TIMEOUT(3, printk("sg_open: dev=%d, flags=0x%x\n", dev, flags)); 233 SCSI_LOG_TIMEOUT(3, printk("sg_open: dev=%d, flags=0x%x\n", dev, flags));
232 sdp = sg_get_dev(dev); 234 sdp = sg_get_dev(dev);
233 if ((!sdp) || (!sdp->device)) 235 if ((!sdp) || (!sdp->device)) {
236 unlock_kernel();
234 return -ENXIO; 237 return -ENXIO;
235 if (sdp->detached) 238 }
239 if (sdp->detached) {
240 unlock_kernel();
236 return -ENODEV; 241 return -ENODEV;
242 }
237 243
238 /* This driver's module count bumped by fops_get in <linux/fs.h> */ 244 /* This driver's module count bumped by fops_get in <linux/fs.h> */
239 /* Prevent the device driver from vanishing while we sleep */ 245 /* Prevent the device driver from vanishing while we sleep */
240 retval = scsi_device_get(sdp->device); 246 retval = scsi_device_get(sdp->device);
241 if (retval) 247 if (retval) {
248 unlock_kernel();
242 return retval; 249 return retval;
250 }
243 251
244 if (!((flags & O_NONBLOCK) || 252 if (!((flags & O_NONBLOCK) ||
245 scsi_block_when_processing_errors(sdp->device))) { 253 scsi_block_when_processing_errors(sdp->device))) {
@@ -295,10 +303,12 @@ sg_open(struct inode *inode, struct file *filp)
295 retval = -ENOMEM; 303 retval = -ENOMEM;
296 goto error_out; 304 goto error_out;
297 } 305 }
306 unlock_kernel();
298 return 0; 307 return 0;
299 308
300 error_out: 309 error_out:
301 scsi_device_put(sdp->device); 310 scsi_device_put(sdp->device);
311 unlock_kernel();
302 return retval; 312 return retval;
303} 313}
304 314
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 6e5a5bb31311..4684cc716aa4 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -38,6 +38,7 @@ static const char *verstr = "20080224";
38#include <linux/cdev.h> 38#include <linux/cdev.h>
39#include <linux/delay.h> 39#include <linux/delay.h>
40#include <linux/mutex.h> 40#include <linux/mutex.h>
41#include <linux/smp_lock.h>
41 42
42#include <asm/uaccess.h> 43#include <asm/uaccess.h>
43#include <asm/dma.h> 44#include <asm/dma.h>
@@ -1113,7 +1114,7 @@ static int check_tape(struct scsi_tape *STp, struct file *filp)
1113} 1114}
1114 1115
1115 1116
1116 /* Open the device. Needs to be called with BKL only because of incrementing the SCSI host 1117 /* Open the device. Needs to take the BKL only because of incrementing the SCSI host
1117 module count. */ 1118 module count. */
1118static int st_open(struct inode *inode, struct file *filp) 1119static int st_open(struct inode *inode, struct file *filp)
1119{ 1120{
@@ -1123,6 +1124,7 @@ static int st_open(struct inode *inode, struct file *filp)
1123 int dev = TAPE_NR(inode); 1124 int dev = TAPE_NR(inode);
1124 char *name; 1125 char *name;
1125 1126
1127 lock_kernel();
1126 /* 1128 /*
1127 * We really want to do nonseekable_open(inode, filp); here, but some 1129 * We really want to do nonseekable_open(inode, filp); here, but some
1128 * versions of tar incorrectly call lseek on tapes and bail out if that 1130 * versions of tar incorrectly call lseek on tapes and bail out if that
@@ -1130,8 +1132,10 @@ static int st_open(struct inode *inode, struct file *filp)
1130 */ 1132 */
1131 filp->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE); 1133 filp->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE);
1132 1134
1133 if (!(STp = scsi_tape_get(dev))) 1135 if (!(STp = scsi_tape_get(dev))) {
1136 unlock_kernel();
1134 return -ENXIO; 1137 return -ENXIO;
1138 }
1135 1139
1136 write_lock(&st_dev_arr_lock); 1140 write_lock(&st_dev_arr_lock);
1137 filp->private_data = STp; 1141 filp->private_data = STp;
@@ -1140,6 +1144,7 @@ static int st_open(struct inode *inode, struct file *filp)
1140 if (STp->in_use) { 1144 if (STp->in_use) {
1141 write_unlock(&st_dev_arr_lock); 1145 write_unlock(&st_dev_arr_lock);
1142 scsi_tape_put(STp); 1146 scsi_tape_put(STp);
1147 unlock_kernel();
1143 DEB( printk(ST_DEB_MSG "%s: Device already in use.\n", name); ) 1148 DEB( printk(ST_DEB_MSG "%s: Device already in use.\n", name); )
1144 return (-EBUSY); 1149 return (-EBUSY);
1145 } 1150 }
@@ -1188,12 +1193,14 @@ static int st_open(struct inode *inode, struct file *filp)
1188 retval = (-EIO); 1193 retval = (-EIO);
1189 goto err_out; 1194 goto err_out;
1190 } 1195 }
1196 unlock_kernel();
1191 return 0; 1197 return 0;
1192 1198
1193 err_out: 1199 err_out:
1194 normalize_buffer(STp->buffer); 1200 normalize_buffer(STp->buffer);
1195 STp->in_use = 0; 1201 STp->in_use = 0;
1196 scsi_tape_put(STp); 1202 scsi_tape_put(STp);
1203 unlock_kernel();
1197 return retval; 1204 return retval;
1198 1205
1199} 1206}