linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: Nathan March <nathan@gt.net>
Cc: linux-nfs@vger.kernel.org
Subject: Re: Stale file not being refreshed automatically?
Date: Tue, 25 Jan 2011 17:48:59 -0500	[thread overview]
Message-ID: <1295995739.6867.14.camel@heimdal.trondhjem.org> (raw)
In-Reply-To: <4D3F50DA.3060208@gt.net>

On Tue, 2011-01-25 at 14:38 -0800, Nathan March wrote: 
> Ah ha, yes, it's using a stat call.
> 
> What would be the proper C call to check the file exists without 
> incurring the stat()?

access("file", F_OK) should do it.

Cheers
  Trond

> On 1/25/2011 2:28 PM, Trond Myklebust wrote:
> > On Tue, 2011-01-25 at 14:11 -0800, Nathan March wrote:
> >> Hi All,
> >>
> >> Having a strange issue, I've reproduced this both on nfs 3 and 4.
> >> Currently using v4 with:
> >>
> >> exports:
> >> /var/home/voyage
> >> 10.2.1.0/24(rw,fsid=0,async,wdelay,secure,no_subtree_check,anonuid=1000,anongid=1006)
> >>
> >> fstab:
> >> 10.2.1.1:/ /mnt/voyage nfs4
> >> rsize=32768,wsize=32768,noatime,nosuid,rw,bg,hard,intr 0 0
> >>
> >> Can be produced using these two commands on 2 machines:
> >>
> >> perl -le '$| = 1 ; while (1) { sleep 1; $res = -e "/home/voyage/test";
> >> if ($res) { print "-e : $res"; } else { print "-e : $res ($!)"; } }'
> >> -e : 1
> >>
> >> perl -le '$| = 1 ; while (1) { sleep 5; open(F, ">",
> >> "/home/voyage/test.foo"); close F; my $res =
> >> rename("/home/voyage/test.foo", "/home/voyage/test"); print "rename
> >> ($res)"; }'
> >>
> >> The first command will occasionally print out: -e :  (Stale NFS file handle)
> >>
> >> Now according to http://nfs.sourceforge.net/#faq_a10 as of 2.6.12 the
> >> vfs should automatically retry when it gets a estale during path
> >> resolution. This doesn't appear to be happening though based on the
> >> errors I'm seeing.
> >>
> >> Anyone have any thoughts on what might be happening here? Or am I
> >> misinterpreting that faq entry? (This is on ext3 if it matters)
> > Does '-e' in perl only do a lookup, or does it result in a 'stat()'
> > call? If the latter, then your test is flawed: a stat() is a lookup+a
> > getattr, and the latter can definitely return ESTALE when you are
> > constantly replacing the file.
> >
> > Cheers
> >    Trond

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com


  reply	other threads:[~2011-01-25 22:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-25 22:11 Stale file not being refreshed automatically? Nathan March
2011-01-25 22:25 ` Nathan March
2011-01-25 22:28 ` Trond Myklebust
2011-01-25 22:38   ` Nathan March
2011-01-25 22:48     ` Trond Myklebust [this message]
2011-01-25 22:52       ` Nathan March
2011-01-25 23:24   ` Nathan March
     [not found]   ` <1295994532.6867.12.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2011-01-25 23:29     ` Nathan March
2011-01-25 23:35       ` 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=1295995739.6867.14.camel@heimdal.trondhjem.org \
    --to=trond.myklebust@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=nathan@gt.net \
    /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;
as well as URLs for NNTP newsgroup(s).