Commit d75340cc authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: Fix nfs_atomic_open() to set the verifier on negative dentries too

Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 216d5d06
...@@ -656,11 +656,6 @@ static int nfs_check_verifier(struct inode *dir, struct dentry *dentry) ...@@ -656,11 +656,6 @@ static int nfs_check_verifier(struct inode *dir, struct dentry *dentry)
return 1; return 1;
} }
static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf)
{
dentry->d_time = verf;
}
/* /*
* Return the intent data that applies to this particular path component * Return the intent data that applies to this particular path component
* *
...@@ -1016,7 +1011,6 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry ...@@ -1016,7 +1011,6 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry
} }
} else if (res != NULL) } else if (res != NULL)
dentry = res; dentry = res;
nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
out: out:
return res; return res;
no_open: no_open:
...@@ -1060,8 +1054,6 @@ static int nfs_open_revalidate(struct dentry *dentry, struct nameidata *nd) ...@@ -1060,8 +1054,6 @@ static int nfs_open_revalidate(struct dentry *dentry, struct nameidata *nd)
*/ */
lock_kernel(); lock_kernel();
ret = nfs4_open_revalidate(dir, dentry, openflags, nd); ret = nfs4_open_revalidate(dir, dentry, openflags, nd);
if (ret == 1)
nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
unlock_kernel(); unlock_kernel();
out: out:
dput(parent); dput(parent);
......
...@@ -1399,13 +1399,16 @@ nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd) ...@@ -1399,13 +1399,16 @@ nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
state = nfs4_do_open(dir, &path, nd->intent.open.flags, &attr, cred); state = nfs4_do_open(dir, &path, nd->intent.open.flags, &attr, cred);
put_rpccred(cred); put_rpccred(cred);
if (IS_ERR(state)) { if (IS_ERR(state)) {
if (PTR_ERR(state) == -ENOENT) if (PTR_ERR(state) == -ENOENT) {
d_add(dentry, NULL); d_add(dentry, NULL);
nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
}
return (struct dentry *)state; return (struct dentry *)state;
} }
res = d_add_unique(dentry, igrab(state->inode)); res = d_add_unique(dentry, igrab(state->inode));
if (res != NULL) if (res != NULL)
path.dentry = res; path.dentry = res;
nfs_set_verifier(path.dentry, nfs_save_change_attribute(dir));
nfs4_intent_set_file(nd, &path, state); nfs4_intent_set_file(nd, &path, state);
return res; return res;
} }
...@@ -1439,6 +1442,7 @@ nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags, st ...@@ -1439,6 +1442,7 @@ nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags, st
} }
} }
if (state->inode == dentry->d_inode) { if (state->inode == dentry->d_inode) {
nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
nfs4_intent_set_file(nd, &path, state); nfs4_intent_set_file(nd, &path, state);
return 1; return 1;
} }
...@@ -1885,6 +1889,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, ...@@ -1885,6 +1889,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
goto out; goto out;
} }
d_add(dentry, igrab(state->inode)); d_add(dentry, igrab(state->inode));
nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
if (flags & O_EXCL) { if (flags & O_EXCL) {
struct nfs_fattr fattr; struct nfs_fattr fattr;
status = nfs4_do_setattr(state->inode, &fattr, sattr, state); status = nfs4_do_setattr(state->inode, &fattr, sattr, state);
......
...@@ -240,6 +240,11 @@ static inline int NFS_USE_READDIRPLUS(struct inode *inode) ...@@ -240,6 +240,11 @@ static inline int NFS_USE_READDIRPLUS(struct inode *inode)
return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_FLAGS(inode)); return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_FLAGS(inode));
} }
static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf)
{
dentry->d_time = verf;
}
/** /**
* nfs_save_change_attribute - Returns the inode attribute change cookie * nfs_save_change_attribute - Returns the inode attribute change cookie
* @dir - pointer to parent directory inode * @dir - pointer to parent directory inode
......
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