Commit 226e3bda authored by Kai Mäkisara's avatar Kai Mäkisara Committed by Jaroslav Kysela

[PATCH] SCSI tape driver fixes for 2.5.51

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
parent 55478b6c
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
......
......@@ -12,13 +12,13 @@
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment