Commit 2dfc6173 authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: Call update_changeattr() from _nfs4_proc_open only if a file was created

We don't want to invalidate the directory attribute and data cache unless we
know that a file was created, or the change attribute differs from the one
in our cache.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 4b09ec4b
...@@ -2390,11 +2390,12 @@ static int _nfs4_proc_open(struct nfs4_opendata *data) ...@@ -2390,11 +2390,12 @@ static int _nfs4_proc_open(struct nfs4_opendata *data)
nfs_fattr_map_and_free_names(server, &data->f_attr); nfs_fattr_map_and_free_names(server, &data->f_attr);
if (o_arg->open_flags & O_CREAT) { if (o_arg->open_flags & O_CREAT) {
update_changeattr(dir, &o_res->cinfo);
if (o_arg->open_flags & O_EXCL) if (o_arg->open_flags & O_EXCL)
data->file_created = 1; data->file_created = 1;
else if (o_res->cinfo.before != o_res->cinfo.after) else if (o_res->cinfo.before != o_res->cinfo.after)
data->file_created = 1; data->file_created = 1;
if (data->file_created || dir->i_version != o_res->cinfo.after)
update_changeattr(dir, &o_res->cinfo);
} }
if ((o_res->rflags & NFS4_OPEN_RESULT_LOCKTYPE_POSIX) == 0) if ((o_res->rflags & NFS4_OPEN_RESULT_LOCKTYPE_POSIX) == 0)
server->caps &= ~NFS_CAP_POSIX_LOCK; server->caps &= ~NFS_CAP_POSIX_LOCK;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment