]> git.hungrycats.org Git - linux/commitdiff
[PATCH] SCSI tape driver fixes for 2.5.51
authorKai Mäkisara <kai.makisara@kolumbus.fi>
Sat, 14 Dec 2002 12:46:29 +0000 (04:46 -0800)
committerJaroslav Kysela <perex@suse.cz>
Sat, 14 Dec 2002 12:46:29 +0000 (04:46 -0800)
This contains the following changes for the SCSI tape driver in 2.5.51:
- fix module bugs that prevent finding any devices
- allow opening a device with O_NONBLOCK | O_RDWR even if the tape in drive
  is write protected

Documentation/scsi/st.txt
drivers/scsi/st.c

index 9eeb6c72aabc8459c75104ff078488362ed3c3a2..30b9c3955c1f3b62086878324835fcc8d49176d8 100644 (file)
@@ -1,8 +1,8 @@
 This file contains brief information about the SCSI tape driver.
-The driver is currently maintained by Kai M{kisara (email
+The driver is currently maintained by Kai Mäkisara (email
 Kai.Makisara@metla.fi)
 
-Last modified: Fri Jul 26 16:01:39 2002 by makisara
+Last modified: Sat Dec 14 14:35:30 2002 by makisara
 
 
 BASICS
@@ -89,7 +89,10 @@ The compile options are defined in the file linux/drivers/scsi/st_options.h.
 4. If the open option O_NONBLOCK is used, open succeeds even if the
 drive is not ready. If O_NONBLOCK is not used, the driver waits for
 the drive to become ready. If this does not happen in ST_BLOCK_SECONDS
-seconds, open fails with the errno value EIO.
+seconds, open fails with the errno value EIO. With O_NONBLOCK the
+device can be opened for writing even if there is a write protected
+tape in the drive (commands trying to write something return error if
+attempted).
 
 
 BSD AND SYS V SEMANTICS
index 1e40fe4bf51fc94e46d57a2986de765f52011e67..8dc808d1e7274ff862d0ba5fcdbf539fb33cd0b7 100644 (file)
    Copyright 1992 - 2002 Kai Makisara
    email Kai.Makisara@metla.fi
 
-   Last modified: Tue Oct 15 22:01:04 2002 by makisara
+   Last modified: Sat Dec 14 14:25:09 2002 by makisara
    Some small formal changes - aeb, 950809
 
    Last modified: 18-JAN-1998 Richard Gooch <rgooch@atnf.csiro.au> Devfs support
  */
 
-static char *verstr = "20021015";
+static char *verstr = "20021214";
 
 #include <linux/module.h>
 
@@ -923,8 +923,9 @@ static int check_tape(Scsi_Tape *STp, struct file *filp)
 
                 DEBC(printk(ST_DEB_MSG "%s: Write protected\n", name));
 
-               if ((st_flags & O_ACCMODE) == O_WRONLY ||
-                   (st_flags & O_ACCMODE) == O_RDWR) {
+               if (do_wait &&
+                   ((st_flags & O_ACCMODE) == O_WRONLY ||
+                    (st_flags & O_ACCMODE) == O_RDWR)) {
                        retval = (-EROFS);
                        goto err_out;
                }
@@ -991,8 +992,10 @@ static int st_open(struct inode *inode, struct file *filp)
                return (-EBUSY);
        }
 
-       if(!scsi_device_get(STp->device))
+       if(scsi_device_get(STp->device)) {
+               write_unlock(&st_dev_arr_lock);
                return (-ENXIO);
+       }
        STp->in_use = 1;
        write_unlock(&st_dev_arr_lock);
        STp->rew_at_close = STp->autorew_dev = (minor(inode->i_rdev) & 0x80) == 0;