linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: dzafman@kahuna.cag.cpqcorp.net
To: trond.myklebust@fys.uio.no
Cc: linux-kernel@vger.kernel.org
Subject: re: NFS client llseek
Date: Fri, 14 Dec 2001 12:45 PST	[thread overview]
Message-ID: <200112142109.fBEL90123231@kahuna.cag.cpqcorp.net> (raw)


Trond Myklebust wrote:

>    Just one comment: Isn't it easier to do this in generic_file_llseek()
>    itself using inode->i_op->revalidate()? That would make it work for
>    coda and smbfs too...
>
>    Cheers,
>       Trond

Yes, you are right.  I've attached a patch which does the revalidate in
both default_llseek() and generic_file_llseek().  Also, it only happens
if i_size is going to be used.  This makes NFS client, smbfs, opengfs, and coda
work right, among others.  I copied do_revalidate() from fs/stat.c.  It would be
nice if it was in a header file instead.

By the way, we are looking at the challenges of integrating a fully coherent
distributed/cluster filesystem into the Linux filesystem architecture.

--- linux-2.4.16.orig/fs/read_write.c	Fri Dec 14 12:06:44 2001
+++ linux-2.4.16/fs/read_write.c	Fri Dec 14 12:54:02 2001
@@ -20,6 +20,19 @@
 	mmap:		generic_file_mmap,
 };
 
+/*
+ * Revalidate the inode. This is required for proper NFS attribute caching.
+ * ARG! Copied from fs/stat.c   (move to a header file)
+ */
+static __inline__ int
+do_revalidate(struct dentry *dentry)
+{
+	struct inode * inode = dentry->d_inode;
+	if (inode->i_op && inode->i_op->revalidate)
+		return inode->i_op->revalidate(dentry);
+	return 0;
+}
+
 ssize_t generic_read_dir(struct file *filp, char *buf, size_t siz, loff_t *ppos)
 {
 	return -EISDIR;
@@ -31,6 +44,8 @@
 
 	switch (origin) {
 		case 2:
+			if ((retval = do_revalidate(file->f_dentry)) < 0)
+				return retval;
 			offset += file->f_dentry->d_inode->i_size;
 			break;
 		case 1:
@@ -59,6 +74,8 @@
 
 	switch (origin) {
 		case 2:
+			if ((retval = do_revalidate(file->f_dentry)) < 0)
+				return retval;
 			offset += file->f_dentry->d_inode->i_size;
 			break;
 		case 1:

             reply	other threads:[~2001-12-14 21:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-14 20:45 dzafman [this message]
2001-12-14 23:13 ` Pedro M. Rodrigues
  -- strict thread matches above, loose matches on Subject: below --
2001-12-14  0:51 dzafman
2001-12-14 12:42 ` Trond Myklebust
2001-12-14 12:51 ` Trond Myklebust
2001-12-17 18:18   ` Jan Harkes
2001-12-17 18:42     ` Alexander Viro
2001-12-17 20:34     ` Trond Myklebust

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=200112142109.fBEL90123231@kahuna.cag.cpqcorp.net \
    --to=dzafman@kahuna.cag.cpqcorp.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trond.myklebust@fys.uio.no \
    --subject='re: NFS client llseek' \
    /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

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).