aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2017-01-11 08:47:00 -0500
committerTrond Myklebust <trond.myklebust@primarydata.com>2017-01-12 15:51:17 -0500
commit2dfc61736482441993bfb7dfaa971113b53f107c (patch)
tree955be8de3632ee1172f8dc60b324156046df4e5d
parent4b09ec4b14a168bf2c687e1f598140c3c11e9222 (diff)
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>
-rw-r--r--fs/nfs/nfs4proc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 700ed1fc1075..4010c33151ad 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2390,11 +2390,12 @@ static int _nfs4_proc_open(struct nfs4_opendata *data)
2390 nfs_fattr_map_and_free_names(server, &data->f_attr); 2390 nfs_fattr_map_and_free_names(server, &data->f_attr);
2391 2391
2392 if (o_arg->open_flags & O_CREAT) { 2392 if (o_arg->open_flags & O_CREAT) {
2393 update_changeattr(dir, &o_res->cinfo);
2394 if (o_arg->open_flags & O_EXCL) 2393 if (o_arg->open_flags & O_EXCL)
2395 data->file_created = 1; 2394 data->file_created = 1;
2396 else if (o_res->cinfo.before != o_res->cinfo.after) 2395 else if (o_res->cinfo.before != o_res->cinfo.after)
2397 data->file_created = 1; 2396 data->file_created = 1;
2397 if (data->file_created || dir->i_version != o_res->cinfo.after)
2398 update_changeattr(dir, &o_res->cinfo);
2398 } 2399 }
2399 if ((o_res->rflags & NFS4_OPEN_RESULT_LOCKTYPE_POSIX) == 0) 2400 if ((o_res->rflags & NFS4_OPEN_RESULT_LOCKTYPE_POSIX) == 0)
2400 server->caps &= ~NFS_CAP_POSIX_LOCK; 2401 server->caps &= ~NFS_CAP_POSIX_LOCK;