Linux NFS development
 help / color / mirror / Atom feed
From: Timo Sirainen <tss@iki.fi>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: nfs@lists.sourceforge.net
Subject: Re: [NFS] Cache flushing
Date: Wed, 21 Nov 2007 15:14:11 +0200	[thread overview]
Message-ID: <1195650851.6039.425.camel@hurina> (raw)
In-Reply-To: <1195602454.7234.100.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 2140 bytes --]

On Tue, 2007-11-20 at 18:47 -0500, Trond Myklebust wrote:
> On Tue, 2007-11-20 at 04:14 +0200, Timo Sirainen wrote:
> > On Sun, 2007-11-18 at 00:11 +0200, Timo Sirainen wrote:
> > > > Why can't you simply close(), and then re-open() the file? That is _the_
> > > > standard way to force an attribute cache revalidation on all NFS
> > > > versions. The close-to-open caching model, which is implemented on most
> > > > NFS clients guarantees this.
> > ..
> > > close()+open() would have been difficult to handle because open() can
> > > fail, but looks like opening another file descriptor and closing it
> > > works just as well. Also looks like it works for flushing directories'
> > > attribute cache (which doesn't seem to work with FreeBSD though).
> > 
> > Actually it works for flushing a directory's attribute cache in
> > v2.6.17-rc2, but not in v2.6.22. chown() works in v2.6.22 also. Is there
> > a reason for this change? I guess it anyway means that I'm back to using
> > chown() for flushing a directory's attribute cache.
> 
> close-to-open caching works fine for me in v2.6.22. It does indeed send
> a GETATTR and revalidate the inode.

I don't have my own NFS test setup, so I can't check what actually
happens in the network, but I can easily reproduce this as a user:

1. touch foo.1 foo.2

2. Run on NFS client 1:

rm -f foo;ln foo.1 foo;sleep 0.5;rm -f foo;ln foo.2 foo

3. Run on NFS client 2 within that 0.5 secs:

echo *>/dev/null;stat foo;sleep 0.5;echo * >/dev/null;stat foo

After repeating this a few (2-5) times stat will return foo.1's inode
for both stats and running the command over and over again will return
only foo.1's inode. The only way to get NFS client 2 to notice the
change and return foo.2's inode is to either wait for attribute cache to
timeout or to run "chown 0 ."

Now that I think of it, I guess the reason is that my 2.6.22 setup has
Linux+ext3 as NFS server and 2.6.17-rc2 setup has NetApp as server. So
even though open()+close() flushes the directory's attribute cache, it
doesn't flush the file name -> NFS handle cache unless mtime changes?

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 228 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

[-- Attachment #3: Type: text/plain, Size: 362 bytes --]

_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
_______________________________________________
Please note that nfs@lists.sourceforge.net is being discontinued.
Please subscribe to linux-nfs@vger.kernel.org instead.
    http://vger.kernel.org/vger-lists.html#linux-nfs

  parent reply	other threads:[~2007-11-21 13:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-17  0:11 Cache flushing Timo Sirainen
2007-11-17 19:46 ` [NFS] " Trond Myklebust
     [not found]   ` <1195328785.6999.5.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-11-17 20:12     ` Timo Sirainen
2007-11-17 20:41       ` Trond Myklebust
     [not found]         ` <1195332062.6999.20.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-11-17 22:11           ` Timo Sirainen
2007-11-17 23:52             ` Trond Myklebust
     [not found]               ` <1195343531.7084.11.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-11-18  0:26                 ` Timo Sirainen
2007-11-18  0:46                   ` Trond Myklebust
     [not found]                     ` <1195346790.8908.0.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2007-11-18  2:03                       ` Timo Sirainen
2007-11-20  2:14             ` Timo Sirainen
2007-11-20 23:47               ` Trond Myklebust
     [not found]                 ` <1195602454.7234.100.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2007-11-21 13:14                   ` Timo Sirainen [this message]
2007-11-21 13:56                     ` Trond Myklebust
     [not found]                       ` <1195653389.8374.4.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2007-11-21 20:36                         ` Timo Sirainen
2007-11-21 20:39                           ` Trond Myklebust
     [not found]                             ` <1195677569.8374.18.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2007-11-21 20:56                               ` Timo Sirainen
2007-11-21 21:15                                 ` Trond Myklebust
     [not found]                                   ` <1195679737.8374.34.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2007-11-22  0:52                                     ` Timo Sirainen

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=1195650851.6039.425.camel@hurina \
    --to=tss@iki.fi \
    --cc=nfs@lists.sourceforge.net \
    --cc=trond.myklebust@fys.uio.no \
    /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