Commit cf904163 authored by Kai Mäkisara's avatar Kai Mäkisara Committed by Linus Torvalds

[PATCH] make st seekable again

Apparently `tar' errors out if it cannot perform lseek() against a tape.  Work
around that in-kernel.
Signed-off-by: default avatarKai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b86db5af
...@@ -4100,7 +4100,13 @@ static int idetape_chrdev_open (struct inode *inode, struct file *filp) ...@@ -4100,7 +4100,13 @@ static int idetape_chrdev_open (struct inode *inode, struct file *filp)
idetape_pc_t pc; idetape_pc_t pc;
int retval; int retval;
nonseekable_open(inode, filp); /*
* We really want to do nonseekable_open(inode, filp); here, but some
* versions of tar incorrectly call lseek on tapes and bail out if that
* fails. So we disallow pread() and pwrite(), but permit lseeks.
*/
filp->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE);
#if IDETAPE_DEBUG_LOG #if IDETAPE_DEBUG_LOG
printk(KERN_INFO "ide-tape: Reached idetape_chrdev_open\n"); printk(KERN_INFO "ide-tape: Reached idetape_chrdev_open\n");
#endif /* IDETAPE_DEBUG_LOG */ #endif /* IDETAPE_DEBUG_LOG */
......
...@@ -4318,7 +4318,13 @@ static int os_scsi_tape_open(struct inode * inode, struct file * filp) ...@@ -4318,7 +4318,13 @@ static int os_scsi_tape_open(struct inode * inode, struct file * filp)
int dev = TAPE_NR(inode); int dev = TAPE_NR(inode);
int mode = TAPE_MODE(inode); int mode = TAPE_MODE(inode);
nonseekable_open(inode, filp); /*
* We really want to do nonseekable_open(inode, filp); here, but some
* versions of tar incorrectly call lseek on tapes and bail out if that
* fails. So we disallow pread() and pwrite(), but permit lseeks.
*/
filp->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE);
write_lock(&os_scsi_tapes_lock); write_lock(&os_scsi_tapes_lock);
if (dev >= osst_max_dev || os_scsi_tapes == NULL || if (dev >= osst_max_dev || os_scsi_tapes == NULL ||
(STp = os_scsi_tapes[dev]) == NULL || !STp->device) { (STp = os_scsi_tapes[dev]) == NULL || !STp->device) {
......
...@@ -1004,7 +1004,13 @@ static int st_open(struct inode *inode, struct file *filp) ...@@ -1004,7 +1004,13 @@ static int st_open(struct inode *inode, struct file *filp)
int dev = TAPE_NR(inode); int dev = TAPE_NR(inode);
char *name; char *name;
nonseekable_open(inode, filp); /*
* We really want to do nonseekable_open(inode, filp); here, but some
* versions of tar incorrectly call lseek on tapes and bail out if that
* fails. So we disallow pread() and pwrite(), but permit lseeks.
*/
filp->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE);
write_lock(&st_dev_arr_lock); write_lock(&st_dev_arr_lock);
if (dev >= st_dev_max || scsi_tapes == NULL || if (dev >= st_dev_max || scsi_tapes == NULL ||
((STp = scsi_tapes[dev]) == NULL)) { ((STp = scsi_tapes[dev]) == NULL)) {
......
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