Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -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;