Re: NFS caching.

Trond Myklebust (trond.myklebust@fys.uio.no)
31 Oct 1999 14:12:48 +0100


>>>>> " " == Rogier Wolff <R.E.Wolff@BitWizard.nl> writes:

> Hi,

> 2.2.x caches NFS accesses. I have a LED on the wall that
> indicates that I have mail. When I see it on, I want to read my
> Email. Is there a way that I can foce a cache invalidate? It is
> now annoying to have to wait something like 30 seconds before I
> can read Email that I know is simply sitting in my mailbox...

In principle, just reopening the file should be good enough. Of
course, if your mail-reader is deleting the file after use, so that
you end up with negative dentries, then the current code is not good
enough. In that case, please try the following patch together with a
low value of acdirmin/acdirmax on your mail directory.

Cheers,
Trond

--- linux-2.2.11/fs/nfs/dir.c.orig Mon Aug 9 21:04:57 1999
+++ linux-2.2.11/fs/nfs/dir.c Tue Aug 24 14:28:54 1999
@@ -395,13 +395,14 @@
* If mtime is close to present time, we revalidate
* more often.
*/
+#define NFS_REVALIDATE_NEGATIVE (1 * HZ)
static inline int nfs_neg_need_reval(struct dentry *dentry)
{
- unsigned long timeout = 30 * HZ;
+ unsigned long timeout = NFS_ATTRTIMEO(dentry->d_parent->d_inode);
long diff = CURRENT_TIME - dentry->d_parent->d_inode->i_mtime;

- if (diff < 5*60)
- timeout = 1 * HZ;
+ if (diff < 5*60 && timeout > NFS_REVALIDATE_NEGATIVE)
+ timeout = NFS_REVALIDATE_NEGATIVE;

return time_after(jiffies, dentry->d_time + timeout);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/