aboutsummaryrefslogtreecommitdiff
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2009-06-22 15:09:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-22 21:28:25 -0700
commitb88f8a546f5dba213938fdfc11e66bc5c2421623 (patch)
tree4048d84046bc47d715651fdd375eabbea065bad6 /fs/nfs
parent0b75b35c7cad33e7613f5adf28fa10fe8b09b1c3 (diff)
NFS: Correct the NFS mount path when following a referral
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/super.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 8e0673a0d6a..0b4cbdc60ab 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -2559,6 +2559,27 @@ static struct vfsmount *nfs_do_root_mount(struct file_system_type *fs_type,
return root_mnt;
}
+static void nfs_fix_devname(const struct path *path, struct vfsmount *mnt)
+{
+ char *page = (char *) __get_free_page(GFP_KERNEL);
+ char *devname, *tmp;
+
+ if (page == NULL)
+ return;
+ devname = nfs_path(path->mnt->mnt_devname,
+ path->mnt->mnt_root, path->dentry,
+ page, PAGE_SIZE);
+ if (devname == NULL)
+ goto out_freepage;
+ tmp = kstrdup(devname, GFP_KERNEL);
+ if (tmp == NULL)
+ goto out_freepage;
+ kfree(mnt->mnt_devname);
+ mnt->mnt_devname = tmp;
+out_freepage:
+ free_page((unsigned long)page);
+}
+
static int nfs_follow_remote_path(struct vfsmount *root_mnt,
const char *export_path, struct vfsmount *mnt_target)
{
@@ -2585,6 +2606,9 @@ static int nfs_follow_remote_path(struct vfsmount *root_mnt,
mnt_target->mnt_sb = s;
mnt_target->mnt_root = dget(nd.path.dentry);
+ /* Correct the device pathname */
+ nfs_fix_devname(&nd.path, mnt_target);
+
path_put(&nd.path);
down_write(&s->s_umount);
return 0;