diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2017-01-11 22:07:28 -0500 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2017-01-12 15:51:19 -0500 |
commit | d3129ef672cac81c4d0185336af377c8dc1091d3 (patch) | |
tree | 210ee244346b76a8fe9796dba5353db903e0a5ec | |
parent | c40d52fe1c2ba25dcb8cd207c8d26ef5f57f0476 (diff) |
NFSv4: update_changeattr should update the attribute timestamp
Otherwise, the attribute cache remains marked as being expired.
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
-rw-r--r-- | fs/nfs/nfs4proc.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 6a35204affa4..ecc151697fd4 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -1082,7 +1082,8 @@ int nfs4_call_sync(struct rpc_clnt *clnt, | |||
1082 | return nfs4_call_sync_sequence(clnt, server, msg, args, res); | 1082 | return nfs4_call_sync_sequence(clnt, server, msg, args, res); |
1083 | } | 1083 | } |
1084 | 1084 | ||
1085 | static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo) | 1085 | static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo, |
1086 | unsigned long timestamp) | ||
1086 | { | 1087 | { |
1087 | struct nfs_inode *nfsi = NFS_I(dir); | 1088 | struct nfs_inode *nfsi = NFS_I(dir); |
1088 | 1089 | ||
@@ -1098,6 +1099,7 @@ static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo) | |||
1098 | NFS_INO_INVALID_ACL; | 1099 | NFS_INO_INVALID_ACL; |
1099 | } | 1100 | } |
1100 | dir->i_version = cinfo->after; | 1101 | dir->i_version = cinfo->after; |
1102 | nfsi->read_cache_jiffies = timestamp; | ||
1101 | nfsi->attr_gencount = nfs_inc_attr_generation_counter(); | 1103 | nfsi->attr_gencount = nfs_inc_attr_generation_counter(); |
1102 | nfs_fscache_invalidate(dir); | 1104 | nfs_fscache_invalidate(dir); |
1103 | spin_unlock(&dir->i_lock); | 1105 | spin_unlock(&dir->i_lock); |
@@ -2395,7 +2397,8 @@ static int _nfs4_proc_open(struct nfs4_opendata *data) | |||
2395 | else if (o_res->cinfo.before != o_res->cinfo.after) | 2397 | else if (o_res->cinfo.before != o_res->cinfo.after) |
2396 | data->file_created = 1; | 2398 | data->file_created = 1; |
2397 | if (data->file_created || dir->i_version != o_res->cinfo.after) | 2399 | if (data->file_created || dir->i_version != o_res->cinfo.after) |
2398 | update_changeattr(dir, &o_res->cinfo); | 2400 | update_changeattr(dir, &o_res->cinfo, |
2401 | o_res->f_attr->time_start); | ||
2399 | } | 2402 | } |
2400 | if ((o_res->rflags & NFS4_OPEN_RESULT_LOCKTYPE_POSIX) == 0) | 2403 | if ((o_res->rflags & NFS4_OPEN_RESULT_LOCKTYPE_POSIX) == 0) |
2401 | server->caps &= ~NFS_CAP_POSIX_LOCK; | 2404 | server->caps &= ~NFS_CAP_POSIX_LOCK; |
@@ -4073,11 +4076,12 @@ static int _nfs4_proc_remove(struct inode *dir, const struct qstr *name) | |||
4073 | .rpc_argp = &args, | 4076 | .rpc_argp = &args, |
4074 | .rpc_resp = &res, | 4077 | .rpc_resp = &res, |
4075 | }; | 4078 | }; |
4079 | unsigned long timestamp = jiffies; | ||
4076 | int status; | 4080 | int status; |
4077 | 4081 | ||
4078 | status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 1); | 4082 | status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 1); |
4079 | if (status == 0) | 4083 | if (status == 0) |
4080 | update_changeattr(dir, &res.cinfo); | 4084 | update_changeattr(dir, &res.cinfo, timestamp); |
4081 | return status; | 4085 | return status; |
4082 | } | 4086 | } |
4083 | 4087 | ||
@@ -4126,7 +4130,7 @@ static int nfs4_proc_unlink_done(struct rpc_task *task, struct inode *dir) | |||
4126 | &data->timeout) == -EAGAIN) | 4130 | &data->timeout) == -EAGAIN) |
4127 | return 0; | 4131 | return 0; |
4128 | if (task->tk_status == 0) | 4132 | if (task->tk_status == 0) |
4129 | update_changeattr(dir, &res->cinfo); | 4133 | update_changeattr(dir, &res->cinfo, res->dir_attr->time_start); |
4130 | return 1; | 4134 | return 1; |
4131 | } | 4135 | } |
4132 | 4136 | ||
@@ -4161,9 +4165,9 @@ static int nfs4_proc_rename_done(struct rpc_task *task, struct inode *old_dir, | |||
4161 | return 0; | 4165 | return 0; |
4162 | 4166 | ||
4163 | if (task->tk_status == 0) { | 4167 | if (task->tk_status == 0) { |
4164 | update_changeattr(old_dir, &res->old_cinfo); | 4168 | update_changeattr(old_dir, &res->old_cinfo, res->old_fattr->time_start); |
4165 | if (new_dir != old_dir) | 4169 | if (new_dir != old_dir) |
4166 | update_changeattr(new_dir, &res->new_cinfo); | 4170 | update_changeattr(new_dir, &res->new_cinfo, res->new_fattr->time_start); |
4167 | } | 4171 | } |
4168 | return 1; | 4172 | return 1; |
4169 | } | 4173 | } |
@@ -4201,7 +4205,7 @@ static int _nfs4_proc_link(struct inode *inode, struct inode *dir, const struct | |||
4201 | 4205 | ||
4202 | status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1); | 4206 | status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1); |
4203 | if (!status) { | 4207 | if (!status) { |
4204 | update_changeattr(dir, &res.cinfo); | 4208 | update_changeattr(dir, &res.cinfo, res.fattr->time_start); |
4205 | status = nfs_post_op_update_inode(inode, res.fattr); | 4209 | status = nfs_post_op_update_inode(inode, res.fattr); |
4206 | if (!status) | 4210 | if (!status) |
4207 | nfs_setsecurity(inode, res.fattr, res.label); | 4211 | nfs_setsecurity(inode, res.fattr, res.label); |
@@ -4276,7 +4280,8 @@ static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_ | |||
4276 | int status = nfs4_call_sync(NFS_SERVER(dir)->client, NFS_SERVER(dir), &data->msg, | 4280 | int status = nfs4_call_sync(NFS_SERVER(dir)->client, NFS_SERVER(dir), &data->msg, |
4277 | &data->arg.seq_args, &data->res.seq_res, 1); | 4281 | &data->arg.seq_args, &data->res.seq_res, 1); |
4278 | if (status == 0) { | 4282 | if (status == 0) { |
4279 | update_changeattr(dir, &data->res.dir_cinfo); | 4283 | update_changeattr(dir, &data->res.dir_cinfo, |
4284 | data->res.fattr->time_start); | ||
4280 | status = nfs_instantiate(dentry, data->res.fh, data->res.fattr, data->res.label); | 4285 | status = nfs_instantiate(dentry, data->res.fh, data->res.fattr, data->res.label); |
4281 | } | 4286 | } |
4282 | return status; | 4287 | return status; |