]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From b88f8a546f5dba213938fdfc11e66bc5c2421623 Mon Sep 17 00:00:00 2001 |
2 | From: Trond Myklebust <Trond.Myklebust@netapp.com> | |
3 | Date: Mon, 22 Jun 2009 15:09:14 -0400 | |
4 | Subject: [PATCH 5/5] NFS: Correct the NFS mount path when following a referral | |
5 | ||
6 | Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> | |
7 | Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> | |
8 | Acked-by: NeilBrown <neilb@suse.de> | |
9 | --- | |
10 | fs/nfs/super.c | 24 ++++++++++++++++++++++++ | |
11 | 1 file changed, 24 insertions(+) | |
12 | ||
13 | --- linux-2.6.27-SLE11_BRANCH.orig/fs/nfs/super.c | |
14 | +++ linux-2.6.27-SLE11_BRANCH/fs/nfs/super.c | |
15 | @@ -2420,6 +2420,27 @@ static struct vfsmount *nfs_do_root_moun | |
16 | return root_mnt; | |
17 | } | |
18 | ||
19 | +static void nfs_fix_devname(const struct path *path, struct vfsmount *mnt) | |
20 | +{ | |
21 | + char *page = (char *) __get_free_page(GFP_KERNEL); | |
22 | + char *devname, *tmp; | |
23 | + | |
24 | + if (page == NULL) | |
25 | + return; | |
26 | + devname = nfs_path(path->mnt->mnt_devname, | |
27 | + path->mnt->mnt_root, path->dentry, | |
28 | + page, PAGE_SIZE); | |
29 | + if (devname == NULL) | |
30 | + goto out_freepage; | |
31 | + tmp = kstrdup(devname, GFP_KERNEL); | |
32 | + if (tmp == NULL) | |
33 | + goto out_freepage; | |
34 | + kfree(mnt->mnt_devname); | |
35 | + mnt->mnt_devname = tmp; | |
36 | +out_freepage: | |
37 | + free_page((unsigned long)page); | |
38 | +} | |
39 | + | |
40 | static int nfs_follow_remote_path(struct vfsmount *root_mnt, | |
41 | const char *export_path, struct vfsmount *mnt_target) | |
42 | { | |
43 | @@ -2446,6 +2467,9 @@ static int nfs_follow_remote_path(struct | |
44 | mnt_target->mnt_sb = s; | |
45 | mnt_target->mnt_root = dget(nd.path.dentry); | |
46 | ||
47 | + /* Correct the device pathname */ | |
48 | + nfs_fix_devname(&nd.path, mnt_target); | |
49 | + | |
50 | path_put(&nd.path); | |
51 | down_write(&s->s_umount); | |
52 | return 0; |