Commit a0356862 authored by Trond Myklebust's avatar Trond Myklebust

NFS: Fix nfs_reval_fsid()

We don't need to revalidate the fsid on the root directory. It suffices to
revalidate it on the current directory.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent b39e625b
...@@ -897,14 +897,13 @@ int nfs_is_exclusive_create(struct inode *dir, struct nameidata *nd) ...@@ -897,14 +897,13 @@ int nfs_is_exclusive_create(struct inode *dir, struct nameidata *nd)
return (nd->intent.open.flags & O_EXCL) != 0; return (nd->intent.open.flags & O_EXCL) != 0;
} }
static inline int nfs_reval_fsid(struct vfsmount *mnt, struct inode *dir, static inline int nfs_reval_fsid(struct inode *dir, const struct nfs_fattr *fattr)
struct nfs_fh *fh, struct nfs_fattr *fattr)
{ {
struct nfs_server *server = NFS_SERVER(dir); struct nfs_server *server = NFS_SERVER(dir);
if (!nfs_fsid_equal(&server->fsid, &fattr->fsid)) if (!nfs_fsid_equal(&server->fsid, &fattr->fsid))
/* Revalidate fsid on root dir */ /* Revalidate fsid using the parent directory */
return __nfs_revalidate_inode(server, mnt->mnt_root->d_inode); return __nfs_revalidate_inode(server, dir);
return 0; return 0;
} }
...@@ -946,7 +945,7 @@ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, stru ...@@ -946,7 +945,7 @@ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, stru
res = ERR_PTR(error); res = ERR_PTR(error);
goto out_unlock; goto out_unlock;
} }
error = nfs_reval_fsid(nd->mnt, dir, &fhandle, &fattr); error = nfs_reval_fsid(dir, &fattr);
if (error < 0) { if (error < 0) {
res = ERR_PTR(error); res = ERR_PTR(error);
goto out_unlock; goto out_unlock;
......
...@@ -961,8 +961,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) ...@@ -961,8 +961,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
goto out_changed; goto out_changed;
server = NFS_SERVER(inode); server = NFS_SERVER(inode);
/* Update the fsid if and only if this is the root directory */ /* Update the fsid? */
if (inode == inode->i_sb->s_root->d_inode if (S_ISDIR(inode->i_mode)
&& !nfs_fsid_equal(&server->fsid, &fattr->fsid)) && !nfs_fsid_equal(&server->fsid, &fattr->fsid))
server->fsid = fattr->fsid; server->fsid = fattr->fsid;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment