Re: [PATCH 02/15] osst: Use noop_llseek() instead of default_llseek()

From: Jan Blunck
Date: Fri Nov 20 2009 - 12:25:31 EST


On Fri, Nov 20, Jamie Lokier wrote:

> Jan Blunck wrote:
> > __os_scsi_tape_open() suggests that llseek() doesn't work:
> > "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."
> >
> > Instead of using the fallback default_llseek() the driver should use
> > noop_llseek() which leaves the file->f_pos untouched but succeeds.
>
> st.c has the same comment, but I didn't see a patch for st.c in the series.
>

Right, that would make sense.

I wonder if anyone has this weird tar and could test if it actually works.

--
st: Use noop_llseek() instead of default_llseek()

st_open() suggests that llseek() doesn't work:
"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."

Instead of using the fallback default_llseek() the driver should use
noop_llseek() which leaves the file->f_pos untouched but succeeds.

Signed-off-by: Jan Blunck <jblunck@xxxxxxx>
---
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 12d58a7..9f03668 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -3958,6 +3958,7 @@ static const struct file_operations st_fops =
.open = st_open,
.flush = st_flush,
.release = st_release,
+ .llseek = noop_llseek,
};

static int st_probe(struct device *dev)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/