aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/dir.c')
-rw-r--r--fs/nfs/dir.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index e35c8199f82f..370b190a09d1 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -899,7 +899,7 @@ static void nfs_dentry_iput(struct dentry *dentry, struct inode *inode)
899 iput(inode); 899 iput(inode);
900} 900}
901 901
902struct dentry_operations nfs_dentry_operations = { 902const struct dentry_operations nfs_dentry_operations = {
903 .d_revalidate = nfs_lookup_revalidate, 903 .d_revalidate = nfs_lookup_revalidate,
904 .d_delete = nfs_dentry_delete, 904 .d_delete = nfs_dentry_delete,
905 .d_iput = nfs_dentry_iput, 905 .d_iput = nfs_dentry_iput,
@@ -967,7 +967,7 @@ out:
967#ifdef CONFIG_NFS_V4 967#ifdef CONFIG_NFS_V4
968static int nfs_open_revalidate(struct dentry *, struct nameidata *); 968static int nfs_open_revalidate(struct dentry *, struct nameidata *);
969 969
970struct dentry_operations nfs4_dentry_operations = { 970const struct dentry_operations nfs4_dentry_operations = {
971 .d_revalidate = nfs_open_revalidate, 971 .d_revalidate = nfs_open_revalidate,
972 .d_delete = nfs_dentry_delete, 972 .d_delete = nfs_dentry_delete,
973 .d_iput = nfs_dentry_iput, 973 .d_iput = nfs_dentry_iput,
@@ -1624,8 +1624,7 @@ static int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1624 } else if (atomic_read(&new_dentry->d_count) > 1) 1624 } else if (atomic_read(&new_dentry->d_count) > 1)
1625 /* dentry still busy? */ 1625 /* dentry still busy? */
1626 goto out; 1626 goto out;
1627 } else 1627 }
1628 nfs_drop_nlink(new_inode);
1629 1628
1630go_ahead: 1629go_ahead:
1631 /* 1630 /*
@@ -1638,10 +1637,8 @@ go_ahead:
1638 } 1637 }
1639 nfs_inode_return_delegation(old_inode); 1638 nfs_inode_return_delegation(old_inode);
1640 1639
1641 if (new_inode != NULL) { 1640 if (new_inode != NULL)
1642 nfs_inode_return_delegation(new_inode); 1641 nfs_inode_return_delegation(new_inode);
1643 d_delete(new_dentry);
1644 }
1645 1642
1646 error = NFS_PROTO(old_dir)->rename(old_dir, &old_dentry->d_name, 1643 error = NFS_PROTO(old_dir)->rename(old_dir, &old_dentry->d_name,
1647 new_dir, &new_dentry->d_name); 1644 new_dir, &new_dentry->d_name);
@@ -1650,6 +1647,8 @@ out:
1650 if (rehash) 1647 if (rehash)
1651 d_rehash(rehash); 1648 d_rehash(rehash);
1652 if (!error) { 1649 if (!error) {
1650 if (new_inode != NULL)
1651 nfs_drop_nlink(new_inode);
1653 d_move(old_dentry, new_dentry); 1652 d_move(old_dentry, new_dentry);
1654 nfs_set_verifier(new_dentry, 1653 nfs_set_verifier(new_dentry,
1655 nfs_save_change_attribute(new_dir)); 1654 nfs_save_change_attribute(new_dir));
@@ -1892,8 +1891,14 @@ static int nfs_do_access(struct inode *inode, struct rpc_cred *cred, int mask)
1892 cache.cred = cred; 1891 cache.cred = cred;
1893 cache.jiffies = jiffies; 1892 cache.jiffies = jiffies;
1894 status = NFS_PROTO(inode)->access(inode, &cache); 1893 status = NFS_PROTO(inode)->access(inode, &cache);
1895 if (status != 0) 1894 if (status != 0) {
1895 if (status == -ESTALE) {
1896 nfs_zap_caches(inode);
1897 if (!S_ISDIR(inode->i_mode))
1898 set_bit(NFS_INO_STALE, &NFS_I(inode)->flags);
1899 }
1896 return status; 1900 return status;
1901 }
1897 nfs_access_add_cache(inode, &cache); 1902 nfs_access_add_cache(inode, &cache);
1898out: 1903out:
1899 if ((mask & ~cache.mask & (MAY_READ | MAY_WRITE | MAY_EXEC)) == 0) 1904 if ((mask & ~cache.mask & (MAY_READ | MAY_WRITE | MAY_EXEC)) == 0)