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.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 19362712452f..9b496ef4abea 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -31,6 +31,7 @@
31#include <linux/pagemap.h> 31#include <linux/pagemap.h>
32#include <linux/smp_lock.h> 32#include <linux/smp_lock.h>
33#include <linux/namei.h> 33#include <linux/namei.h>
34#include <linux/mount.h>
34 35
35#include "nfs4_fs.h" 36#include "nfs4_fs.h"
36#include "delegation.h" 37#include "delegation.h"
@@ -870,14 +871,14 @@ int nfs_is_exclusive_create(struct inode *dir, struct nameidata *nd)
870 return (nd->intent.open.flags & O_EXCL) != 0; 871 return (nd->intent.open.flags & O_EXCL) != 0;
871} 872}
872 873
873static inline int nfs_reval_fsid(struct inode *dir, 874static inline int nfs_reval_fsid(struct vfsmount *mnt, struct inode *dir,
874 struct nfs_fh *fh, struct nfs_fattr *fattr) 875 struct nfs_fh *fh, struct nfs_fattr *fattr)
875{ 876{
876 struct nfs_server *server = NFS_SERVER(dir); 877 struct nfs_server *server = NFS_SERVER(dir);
877 878
878 if (!nfs_fsid_equal(&server->fsid, &fattr->fsid)) 879 if (!nfs_fsid_equal(&server->fsid, &fattr->fsid))
879 /* Revalidate fsid on root dir */ 880 /* Revalidate fsid on root dir */
880 return __nfs_revalidate_inode(server, dir->i_sb->s_root->d_inode); 881 return __nfs_revalidate_inode(server, mnt->mnt_root->d_inode);
881 return 0; 882 return 0;
882} 883}
883 884
@@ -913,7 +914,7 @@ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, stru
913 res = ERR_PTR(error); 914 res = ERR_PTR(error);
914 goto out_unlock; 915 goto out_unlock;
915 } 916 }
916 error = nfs_reval_fsid(dir, &fhandle, &fattr); 917 error = nfs_reval_fsid(nd->mnt, dir, &fhandle, &fattr);
917 if (error < 0) { 918 if (error < 0) {
918 res = ERR_PTR(error); 919 res = ERR_PTR(error);
919 goto out_unlock; 920 goto out_unlock;
@@ -922,8 +923,9 @@ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, stru
922 res = (struct dentry *)inode; 923 res = (struct dentry *)inode;
923 if (IS_ERR(res)) 924 if (IS_ERR(res))
924 goto out_unlock; 925 goto out_unlock;
926
925no_entry: 927no_entry:
926 res = d_add_unique(dentry, inode); 928 res = d_materialise_unique(dentry, inode);
927 if (res != NULL) 929 if (res != NULL)
928 dentry = res; 930 dentry = res;
929 nfs_renew_times(dentry); 931 nfs_renew_times(dentry);
@@ -1117,11 +1119,13 @@ static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc)
1117 dput(dentry); 1119 dput(dentry);
1118 return NULL; 1120 return NULL;
1119 } 1121 }
1120 alias = d_add_unique(dentry, inode); 1122
1123 alias = d_materialise_unique(dentry, inode);
1121 if (alias != NULL) { 1124 if (alias != NULL) {
1122 dput(dentry); 1125 dput(dentry);
1123 dentry = alias; 1126 dentry = alias;
1124 } 1127 }
1128
1125 nfs_renew_times(dentry); 1129 nfs_renew_times(dentry);
1126 nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); 1130 nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
1127 return dentry; 1131 return dentry;