aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2008-01-28 19:42:59 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-01-30 02:05:22 -0500
commit609005c319bc6062b95ed82e132884ed7e22cdb9 (patch)
treeed798efb3dde26d9072fb44af743db638f76157e
parentfccca7fc6aab4e6b519e2d606ef34632e4f50e33 (diff)
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: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/nfs/unlink.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index c5fa6d8001f1..431981d0265f 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -130,13 +130,15 @@ static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct n
130 alias = d_lookup(parent, &data->args.name); 130 alias = d_lookup(parent, &data->args.name);
131 if (alias != NULL) { 131 if (alias != NULL) {
132 int ret = 0; 132 int ret = 0;
133
133 /* 134 /*
134 * Hey, we raced with lookup... See if we need to transfer 135 * Hey, we raced with lookup... See if we need to transfer
135 * the sillyrename information to the aliased dentry. 136 * the sillyrename information to the aliased dentry.
136 */ 137 */
137 nfs_free_dname(data); 138 nfs_free_dname(data);
138 spin_lock(&alias->d_lock); 139 spin_lock(&alias->d_lock);
139 if (!(alias->d_flags & DCACHE_NFSFS_RENAMED)) { 140 if (alias->d_inode != NULL &&
141 !(alias->d_flags & DCACHE_NFSFS_RENAMED)) {
140 alias->d_fsdata = data; 142 alias->d_fsdata = data;
141 alias->d_flags |= DCACHE_NFSFS_RENAMED; 143 alias->d_flags |= DCACHE_NFSFS_RENAMED;
142 ret = 1; 144 ret = 1;