Commit 609005c3 authored by Trond Myklebust's avatar Trond Myklebust

NFS: Sillyrename: in the case of a race, check aliases are really positive

In nfs_do_call_unlink() we check that we haven't raced, and that lookup()
hasn't created an aliased dentry to our sillydeleted dentry. If somebody
has deleted the file on the server and the lookup() resulted in a negative
dentry, then ignore...
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent fccca7fc
...@@ -130,13 +130,15 @@ static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct n ...@@ -130,13 +130,15 @@ static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct n
alias = d_lookup(parent, &data->args.name); alias = d_lookup(parent, &data->args.name);
if (alias != NULL) { if (alias != NULL) {
int ret = 0; int ret = 0;
/* /*
* Hey, we raced with lookup... See if we need to transfer * Hey, we raced with lookup... See if we need to transfer
* the sillyrename information to the aliased dentry. * the sillyrename information to the aliased dentry.
*/ */
nfs_free_dname(data); nfs_free_dname(data);
spin_lock(&alias->d_lock); spin_lock(&alias->d_lock);
if (!(alias->d_flags & DCACHE_NFSFS_RENAMED)) { if (alias->d_inode != NULL &&
!(alias->d_flags & DCACHE_NFSFS_RENAMED)) {
alias->d_fsdata = data; alias->d_fsdata = data;
alias->d_flags |= DCACHE_NFSFS_RENAMED; alias->d_flags |= DCACHE_NFSFS_RENAMED;
ret = 1; ret = 1;
......
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