ChangeSet 1.2030, 2005/03/08 09:25:05-08:00, [EMAIL PROTECTED]
[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: Kai Makisara <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
ide/ide-tape.c | 8 +++++++-
scsi/osst.c | 8 +++++++-
scsi/st.c | 8 +++++++-
3 files changed, 21 insertions(+), 3 deletions(-)
diff -Nru a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
--- a/drivers/ide/ide-tape.c 2005-03-08 11:12:00 -08:00
+++ b/drivers/ide/ide-tape.c 2005-03-08 11:12:00 -08:00
@@ -4100,7 +4100,13 @@
idetape_pc_t pc;
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
printk(KERN_INFO "ide-tape: Reached idetape_chrdev_open\n");
#endif /* IDETAPE_DEBUG_LOG */
diff -Nru a/drivers/scsi/osst.c b/drivers/scsi/osst.c
--- a/drivers/scsi/osst.c 2005-03-08 11:12:00 -08:00
+++ b/drivers/scsi/osst.c 2005-03-08 11:12:00 -08:00
@@ -4318,7 +4318,13 @@
int dev = TAPE_NR(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);
if (dev >= osst_max_dev || os_scsi_tapes == NULL ||
(STp = os_scsi_tapes[dev]) == NULL || !STp->device) {
diff -Nru a/drivers/scsi/st.c b/drivers/scsi/st.c
--- a/drivers/scsi/st.c 2005-03-08 11:12:00 -08:00
+++ b/drivers/scsi/st.c 2005-03-08 11:12:00 -08:00
@@ -1004,7 +1004,13 @@
int dev = TAPE_NR(inode);
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);
if (dev >= st_dev_max || scsi_tapes == NULL ||
((STp = scsi_tapes[dev]) == NULL)) {
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html