linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jamie Lokier <jamie@shareable.org>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Oleg Drokin <green@linuxhacker.ru>,
	Mark Fasheh <mfasheh@suse.com>,
	linux-fsdevel@vger.kernel.org, Sage Weil <sage@newdream.net>,
	Andreas Dilger <adilger@sun.com>
Subject: Re: [PATCH 1/2] [RFC] vfs: 'stat light' fstatat flags
Date: Wed, 8 Apr 2009 19:48:42 +0100	[thread overview]
Message-ID: <20090408184842.GB10947@shareable.org> (raw)
In-Reply-To: <1239136642.5664.9.camel@heimdal.trondhjem.org>

Trond Myklebust wrote:
> On Tue, 2009-04-07 at 14:24 -0400, Oleg Drokin wrote:
> > Well, what the stat actually meant to do is "give me the file
> > information as it is now". By the time it returns, the data is
> > stale anyway, and the longer your path from the user app to the
> > actual file storage, the more potentially out of date the
> > information is.  NFS just takes it to an extreme case and
> > introduces an assumed validity timeout.  While I do not directly
> > oppose such a flag, I really do not see huge value in it. I wonder
> > what is the specific usecase do you have in mind?
> 
> The default behaviour of stat() on NFS is to do a revalidation of the
> cached data (by which I mean that we issue an RPC call if and only if
> the cache has timed out, or if it is known to be invalid).
> 
> The AT_STRICT would be used by the application to tell NFS that it must
> retrieve the cached data from the server. One instance where this is
> useful would be the case where you're doing a distributed compile: the
> application knows that the file may have changed on the server, and
> wants to force the kernel to check mtime.

Yes, that's exactly the sort of thing I had in mind.

The amount of time taken isn't relevant, neither is the fact that the
file may change after calling stat() before using the result.

What matters is the order of dependent events.

    program on host A does something which may affect files,
       then sends message to host B - "I've finished whatever may affect files"
    in response to message,
       program on host B calls stat() to check for changes to files

The stat() call must get attributes which are no older than when host
A modified those attributes.

This implies host A must have written the attribute changes too :-)
NFS does this on close(); other network filesystems use other mechanisms.

As Trond says, the default behaviour of stat() does not get
sufficiently recent attributes, which means things like distributed
compiles sometimes fail on NFS with default settings.

I was thinking of another application: #!/usr/bin/perlcachedcompiler
which behaves like a normal script interpreter, except it compiles the
script first (slow optimising compile...) and runs the compiled
version.  Next time it's run, it checks the persistent cache of
compiled versions against the attributes of the script file, and if
there's a match, no need to compile: just run the compiled version
quickly.

This sort of cache validation needs AT_STRICT to be reliable with NFS,
when a script is edited on one host, then run on another.

(Actually I'd like dnotify/inotify/fsnotify so I can omit the stat()
round trip entirely please on each application cache
revalidation... but only if "check for any file change events, answer
= no events" is synchronous in the same way that AT_STRICT is...)

-- Jamie

  reply	other threads:[~2009-04-08 18:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-07  8:00 [PATCH 1/2] [RFC] vfs: 'stat light' fstatat flags Mark Fasheh
2009-04-07 10:23 ` Andreas Dilger
2009-04-07 14:59   ` Oleg Drokin
2009-04-07 15:18   ` Sage Weil
2009-04-07 15:29   ` Mark Fasheh
2009-04-07 17:52     ` Andreas Dilger
2009-04-07 18:13       ` Jamie Lokier
2009-04-07 23:13   ` Russell Cattelan
2009-04-07 17:42 ` Jamie Lokier
2009-04-07 17:48   ` Oleg Drokin
2009-04-07 18:16     ` Jamie Lokier
2009-04-07 18:24       ` Oleg Drokin
2009-04-07 20:37         ` Trond Myklebust
2009-04-08 18:48           ` Jamie Lokier [this message]
2009-04-09 15:13             ` 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=20090408184842.GB10947@shareable.org \
    --to=jamie@shareable.org \
    --cc=Trond.Myklebust@netapp.com \
    --cc=adilger@sun.com \
    --cc=green@linuxhacker.ru \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mfasheh@suse.com \
    --cc=sage@newdream.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).