Commit 82eae5a4 authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: nfs4_inc/dec_nlink_locked should also invalidate ctime

If the nlink changes, then so will the ctime.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 7b24dacf
...@@ -1169,14 +1169,18 @@ int nfs4_call_sync(struct rpc_clnt *clnt, ...@@ -1169,14 +1169,18 @@ int nfs4_call_sync(struct rpc_clnt *clnt,
static void static void
nfs4_inc_nlink_locked(struct inode *inode) nfs4_inc_nlink_locked(struct inode *inode)
{ {
nfs_set_cache_invalid(inode, NFS_INO_INVALID_NLINK); nfs_set_cache_invalid(inode, NFS_INO_INVALID_CHANGE |
NFS_INO_INVALID_CTIME |
NFS_INO_INVALID_NLINK);
inc_nlink(inode); inc_nlink(inode);
} }
static void static void
nfs4_dec_nlink_locked(struct inode *inode) nfs4_dec_nlink_locked(struct inode *inode)
{ {
nfs_set_cache_invalid(inode, NFS_INO_INVALID_NLINK); nfs_set_cache_invalid(inode, NFS_INO_INVALID_CHANGE |
NFS_INO_INVALID_CTIME |
NFS_INO_INVALID_NLINK);
drop_nlink(inode); drop_nlink(inode);
} }
...@@ -4602,11 +4606,11 @@ _nfs4_proc_remove(struct inode *dir, const struct qstr *name, u32 ftype) ...@@ -4602,11 +4606,11 @@ _nfs4_proc_remove(struct inode *dir, const struct qstr *name, u32 ftype)
status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 1); status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 1);
if (status == 0) { if (status == 0) {
spin_lock(&dir->i_lock); spin_lock(&dir->i_lock);
nfs4_update_changeattr_locked(dir, &res.cinfo, timestamp,
NFS_INO_INVALID_DATA);
/* Removing a directory decrements nlink in the parent */ /* Removing a directory decrements nlink in the parent */
if (ftype == NF4DIR && dir->i_nlink > 2) if (ftype == NF4DIR && dir->i_nlink > 2)
nfs4_dec_nlink_locked(dir); nfs4_dec_nlink_locked(dir);
nfs4_update_changeattr_locked(dir, &res.cinfo, timestamp,
NFS_INO_INVALID_DATA);
spin_unlock(&dir->i_lock); spin_unlock(&dir->i_lock);
} }
return status; return status;
...@@ -4864,12 +4868,12 @@ static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_ ...@@ -4864,12 +4868,12 @@ static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_
&data->arg.seq_args, &data->res.seq_res, 1); &data->arg.seq_args, &data->res.seq_res, 1);
if (status == 0) { if (status == 0) {
spin_lock(&dir->i_lock); spin_lock(&dir->i_lock);
nfs4_update_changeattr_locked(dir, &data->res.dir_cinfo,
data->res.fattr->time_start,
NFS_INO_INVALID_DATA);
/* Creating a directory bumps nlink in the parent */ /* Creating a directory bumps nlink in the parent */
if (data->arg.ftype == NF4DIR) if (data->arg.ftype == NF4DIR)
nfs4_inc_nlink_locked(dir); nfs4_inc_nlink_locked(dir);
nfs4_update_changeattr_locked(dir, &data->res.dir_cinfo,
data->res.fattr->time_start,
NFS_INO_INVALID_DATA);
spin_unlock(&dir->i_lock); spin_unlock(&dir->i_lock);
status = nfs_instantiate(dentry, data->res.fh, data->res.fattr, data->res.label); status = nfs_instantiate(dentry, data->res.fh, data->res.fattr, data->res.label);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment