Skip to content

Commit

Permalink
statfs() gives ESTALE error
Browse files Browse the repository at this point in the history
Hi,

An NFS client executes a statfs("file", &buff) call.
"file" exists / existed, the client has read / written it,
but it has already closed it.

user_path(pathname, &path) looks up "file" successfully in the
directory-cache  and restarts the aging timer of the directory-entry.
Even if "file" has already been removed from the server, because the
lookupcache=positive option I use, keeps the entries valid for a while.

nfs_statfs() returns ESTALE if "file" has already been removed from the
server.

If the user application repeats the statfs("file", &buff) call, we
are stuck: "file" remains young forever in the directory-cache.

Signed-off-by: Zoltan Menyhart  <Zoltan.Menyhart@bull.net>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: stable@kernel.org
  • Loading branch information
Menyhart Zoltan authored and Trond Myklebust committed Sep 12, 2010
1 parent b20d37c commit fbf3fdd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fs/nfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,15 @@ static int nfs_statfs(struct dentry *dentry, struct kstatfs *buf)
goto out_err;

error = server->nfs_client->rpc_ops->statfs(server, fh, &res);
if (unlikely(error == -ESTALE)) {
struct dentry *pd_dentry;

pd_dentry = dget_parent(dentry);
if (pd_dentry != NULL) {
nfs_zap_caches(pd_dentry->d_inode);
dput(pd_dentry);
}
}
nfs_free_fattr(res.fattr);
if (error < 0)
goto out_err;
Expand Down

0 comments on commit fbf3fdd

Please sign in to comment.