From: akpm@osdl.org
To: greg@kroah.com
Cc: linux-kernel@vger.kernel.org, akpm@osdl.org, kai.makisara@kolumbus.fi
Subject: [patch 5/5] make st seekable again
Date: Fri, 04 Mar 2005 13:16:58 -0800 [thread overview]
Message-ID: <200503042117.j24LHJLM017976@shell0.pdx.osdl.net> (raw)
From: Kai Makisara <kai.makisara@kolumbus.fi>
Apparently `tar' errors out if it cannot perform lseek() against a tape. Work
around that in-kernel.
Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---
25-akpm/drivers/ide/ide-tape.c | 8 +++++++-
25-akpm/drivers/scsi/osst.c | 8 +++++++-
25-akpm/drivers/scsi/st.c | 8 +++++++-
3 files changed, 21 insertions(+), 3 deletions(-)
diff -puN drivers/ide/ide-tape.c~make-st-seekable-again drivers/ide/ide-tape.c
--- 25/drivers/ide/ide-tape.c~make-st-seekable-again 2005-03-04 13:16:32.000000000 -0800
+++ 25-akpm/drivers/ide/ide-tape.c 2005-03-04 13:16:32.000000000 -0800
@@ -4100,7 +4100,13 @@ static int idetape_chrdev_open (struct i
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 -puN drivers/scsi/st.c~make-st-seekable-again drivers/scsi/st.c
--- 25/drivers/scsi/st.c~make-st-seekable-again 2005-03-04 13:16:32.000000000 -0800
+++ 25-akpm/drivers/scsi/st.c 2005-03-04 13:16:32.000000000 -0800
@@ -1004,7 +1004,13 @@ static int st_open(struct inode *inode,
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)) {
diff -puN drivers/scsi/osst.c~make-st-seekable-again drivers/scsi/osst.c
--- 25/drivers/scsi/osst.c~make-st-seekable-again 2005-03-04 13:16:32.000000000 -0800
+++ 25-akpm/drivers/scsi/osst.c 2005-03-04 13:16:32.000000000 -0800
@@ -4318,7 +4318,13 @@ static int os_scsi_tape_open(struct inod
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) {
_
next reply other threads:[~2005-03-04 23:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-04 21:16 akpm [this message]
2005-03-09 18:58 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200503042117.j24LHJLM017976@shell0.pdx.osdl.net \
--to=akpm@osdl.org \
--cc=greg@kroah.com \
--cc=kai.makisara@kolumbus.fi \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®