]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
NFSv4: Call update_changeattr() from _nfs4_proc_open only if a file was created
authorTrond Myklebust <trond.myklebust@primarydata.com>
Wed, 11 Jan 2017 13:47:00 +0000 (08:47 -0500)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 12 Jan 2017 20:51:17 +0000 (15:51 -0500)
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>
fs/nfs/nfs4proc.c

index 700ed1fc1075997f7010a4d69faca383478c49b4..4010c33151ad73a541d8e2744283ff9e7db7d458 100644 (file)
@@ -2390,11 +2390,12 @@ static int _nfs4_proc_open(struct nfs4_opendata *data)
        nfs_fattr_map_and_free_names(server, &data->f_attr);
 
        if (o_arg->open_flags & O_CREAT) {
-               update_changeattr(dir, &o_res->cinfo);
                if (o_arg->open_flags & O_EXCL)
                        data->file_created = 1;
                else if (o_res->cinfo.before != o_res->cinfo.after)
                        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)
                server->caps &= ~NFS_CAP_POSIX_LOCK;