* [patch 5/5] make st seekable again
@ 2005-03-04 21:16 akpm
2005-03-09 18:58 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: akpm @ 2005-03-04 21:16 UTC (permalink / raw)
To: greg; +Cc: linux-kernel, akpm, kai.makisara
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) {
_
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch 5/5] make st seekable again
2005-03-04 21:16 [patch 5/5] make st seekable again akpm
@ 2005-03-09 18:58 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2005-03-09 18:58 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, kai.makisara
On Fri, Mar 04, 2005 at 01:16:58PM -0800, akpm@osdl.org wrote:
>
> 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>
Added to the -stable queue, thanks.
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-03-09 19:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-04 21:16 [patch 5/5] make st seekable again akpm
2005-03-09 18:58 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).