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: Trond Myklebust <trond.myklebust@primarydata.com>
This commit is contained in:
parent
4b09ec4b14
commit
2dfc617364
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue