diff options
author | NeilBrown <neilb@suse.de> | 2014-07-21 13:28:28 +1000 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-08-03 17:05:22 -0400 |
commit | 4fa2c54b5198d09607a534e2fd436581064587ed (patch) | |
tree | b572c4f399cf2c15dbadc639791cba4f1ee73206 /fs/afs/cache.c | |
parent | 7a9e75a185e6b3a3860e6a26fb6e88691fc2c9d9 (diff) | |
download | linux-stable-4fa2c54b5198d09607a534e2fd436581064587ed.tar.gz linux-stable-4fa2c54b5198d09607a534e2fd436581064587ed.tar.bz2 linux-stable-4fa2c54b5198d09607a534e2fd436581064587ed.zip |
NFS: nfs4_do_open should add negative results to the dcache.
If you have an NFSv4 mounted directory which does not container 'foo'
and:
ls -l foo
ssh $server touch foo
cat foo
then the 'cat' will fail (usually, depending a bit on the various
cache ages). This is correct as negative looks are cached by default.
However with the same initial conditions:
cat foo
ssh $server touch foo
cat foo
will usually succeed. This is because an "open" does not add a
negative dentry to the dcache, while a "lookup" does.
This can have negative performance effects. When "gcc" searches for
an include file, it will try to "open" the file in every director in
the search path. Without caching of negative "open" results, this
generates much more traffic to the server than it should (or than
NFSv3 does).
The root of the problem is that _nfs4_open_and_get_state() will call
d_add_unique() on a positive result, but not on a negative result.
Compare with nfs_lookup() which calls d_materialise_unique on both
a positive result and on ENOENT.
This patch adds a call d_add() in the ENOENT case for
_nfs4_open_and_get_state() and also calls nfs_set_verifier().
With it, many fewer "open" requests for known-non-existent files are
sent to the server.
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/afs/cache.c')
0 files changed, 0 insertions, 0 deletions