aboutsummaryrefslogtreecommitdiffstats
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-23 00:28:25 -0400
commitb88f8a546f5dba213938fdfc11e66bc5c2421623 (patch)
tree4048d84046bc47d715651fdd375eabbea065bad6
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>
-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 8e0673a0d6aa..0b4cbdc60abd 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,
2559 return root_mnt; 2559 return root_mnt;
2560} 2560}
2561 2561
2562static void nfs_fix_devname(const struct path *path, struct vfsmount *mnt)
2563{
2564 char *page = (char *) __get_free_page(GFP_KERNEL);
2565 char *devname, *tmp;
2566
2567 if (page == NULL)
2568 return;
2569 devname = nfs_path(path->mnt->mnt_devname,
2570 path->mnt->mnt_root, path->dentry,
2571 page, PAGE_SIZE);
2572 if (devname == NULL)
2573 goto out_freepage;
2574 tmp = kstrdup(devname, GFP_KERNEL);
2575 if (tmp == NULL)
2576 goto out_freepage;
2577 kfree(mnt->mnt_devname);
2578 mnt->mnt_devname = tmp;
2579out_freepage:
2580 free_page((unsigned long)page);
2581}
2582
2562static int nfs_follow_remote_path(struct vfsmount *root_mnt, 2583static int nfs_follow_remote_path(struct vfsmount *root_mnt,
2563 const char *export_path, struct vfsmount *mnt_target) 2584 const char *export_path, struct vfsmount *mnt_target)
2564{ 2585{
@@ -2585,6 +2606,9 @@ static int nfs_follow_remote_path(struct vfsmount *root_mnt,
2585 mnt_target->mnt_sb = s; 2606 mnt_target->mnt_sb = s;
2586 mnt_target->mnt_root = dget(nd.path.dentry); 2607 mnt_target->mnt_root = dget(nd.path.dentry);
2587 2608
2609 /* Correct the device pathname */
2610 nfs_fix_devname(&nd.path, mnt_target);
2611
2588 path_put(&nd.path); 2612 path_put(&nd.path);
2589 down_write(&s->s_umount); 2613 down_write(&s->s_umount);
2590 return 0; 2614 return 0;