From 5e16bd3fcca185ce88da63c6dd71ae8763d03e2e Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Fri, 14 Dec 2012 16:38:46 -0500 Subject: [PATCH] --- yaml --- r: 346631 b: refs/heads/master c: 1f018458b30b0d5c535c94e577aa0acbb92e1395 h: refs/heads/master i: 346629: b273dad8de6a880112ad63bbcb366028318ee39e 346627: 2e357fe416bad3fbe904d4a97481ff226308089e 346623: ba5383829df44978c396d8c5300c2f8dc931e463 v: v3 --- [refs] | 2 +- trunk/fs/nfs/dir.c | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 07a8b47c2dd9..1be74596b32d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: eed9935745cc44071043ec8c4cde64c820b5c601 +refs/heads/master: 1f018458b30b0d5c535c94e577aa0acbb92e1395 diff --git a/trunk/fs/nfs/dir.c b/trunk/fs/nfs/dir.c index ce8cb926526b..a46a74654488 100644 --- a/trunk/fs/nfs/dir.c +++ b/trunk/fs/nfs/dir.c @@ -1155,11 +1155,14 @@ static int nfs_dentry_delete(const struct dentry *dentry) } +/* Ensure that we revalidate inode->i_nlink */ static void nfs_drop_nlink(struct inode *inode) { spin_lock(&inode->i_lock); - if (inode->i_nlink > 0) - drop_nlink(inode); + /* drop the inode if we're reasonably sure this is the last link */ + if (inode->i_nlink == 1) + clear_nlink(inode); + NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATTR; spin_unlock(&inode->i_lock); } @@ -1174,8 +1177,8 @@ static void nfs_dentry_iput(struct dentry *dentry, struct inode *inode) NFS_I(inode)->cache_validity |= NFS_INO_INVALID_DATA; if (dentry->d_flags & DCACHE_NFSFS_RENAMED) { - drop_nlink(inode); nfs_complete_unlink(dentry, inode); + nfs_drop_nlink(inode); } iput(inode); } @@ -1646,10 +1649,8 @@ static int nfs_safe_remove(struct dentry *dentry) if (inode != NULL) { NFS_PROTO(inode)->return_delegation(inode); error = NFS_PROTO(dir)->remove(dir, &dentry->d_name); - /* The VFS may want to delete this inode */ if (error == 0) nfs_drop_nlink(inode); - nfs_mark_for_revalidate(inode); } else error = NFS_PROTO(dir)->remove(dir, &dentry->d_name); if (error == -ENOENT)