From 1b88247db11dd0577f5ea1a1d111624b6ac24945 Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Mon, 28 Jan 2008 19:43:18 -0500 Subject: [PATCH] --- yaml --- r: 79567 b: refs/heads/master c: d45b9d8baf41acb177abbbe6746b1dea094b8a28 h: refs/heads/master i: 79565: 56a84fbbee99be04ad363971e0130ffcef4610b4 79563: 739f7300878d1c1aeb84242e84e494bfaac2a844 79559: 4f2cd98d5f5a6f187235ef1f295893fe40377d1a 79551: b62157ceed7a13ba2f3a6794779497e99805ce6c v: v3 --- [refs] | 2 +- trunk/fs/nfs/dir.c | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 509de02873af..a9fbe07323dc 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 609005c319bc6062b95ed82e132884ed7e22cdb9 +refs/heads/master: d45b9d8baf41acb177abbbe6746b1dea094b8a28 diff --git a/trunk/fs/nfs/dir.c b/trunk/fs/nfs/dir.c index d9abdb1d6a2a..06f26d40b4fe 100644 --- a/trunk/fs/nfs/dir.c +++ b/trunk/fs/nfs/dir.c @@ -1267,6 +1267,12 @@ static int nfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) return error; } +static void nfs_dentry_handle_enoent(struct dentry *dentry) +{ + if (dentry->d_inode != NULL && !d_unhashed(dentry)) + d_delete(dentry); +} + static int nfs_rmdir(struct inode *dir, struct dentry *dentry) { int error; @@ -1279,6 +1285,8 @@ static int nfs_rmdir(struct inode *dir, struct dentry *dentry) /* Ensure the VFS deletes this inode */ if (error == 0 && dentry->d_inode != NULL) clear_nlink(dentry->d_inode); + else if (error == -ENOENT) + nfs_dentry_handle_enoent(dentry); unlock_kernel(); return error; @@ -1385,6 +1393,8 @@ static int nfs_safe_remove(struct dentry *dentry) nfs_mark_for_revalidate(inode); } else error = NFS_PROTO(dir)->remove(dir, &dentry->d_name); + if (error == -ENOENT) + nfs_dentry_handle_enoent(dentry); out: return error; } @@ -1421,7 +1431,7 @@ static int nfs_unlink(struct inode *dir, struct dentry *dentry) spin_unlock(&dentry->d_lock); spin_unlock(&dcache_lock); error = nfs_safe_remove(dentry); - if (!error) { + if (!error || error == -ENOENT) { nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); } else if (need_rehash) d_rehash(dentry); @@ -1634,7 +1644,8 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, d_move(old_dentry, new_dentry); nfs_set_verifier(new_dentry, nfs_save_change_attribute(new_dir)); - } + } else if (error == -ENOENT) + nfs_dentry_handle_enoent(old_dentry); /* new dentry created? */ if (dentry)