lkml.org 
[lkml]   [2009]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH 4/4] NFS: Correct the NFS mount path when following a referral
    Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
    ---
    fs/nfs/super.c | 24 ++++++++++++++++++++++++
    1 files changed, 24 insertions(+), 0 deletions(-)

    diff --git a/fs/nfs/super.c b/fs/nfs/super.c
    index 1da36bf..f0f88a5 100644
    --- a/fs/nfs/super.c
    +++ b/fs/nfs/super.c
    @@ -2496,6 +2496,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)
    {
    @@ -2513,6 +2534,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);
    mntput(root_mnt);
    down_write(&s->s_umount);
    --
    1.6.0.4

    \
     
     \ /
      Last update: 2009-03-31 23:15    [W:0.020 / U:31.224 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site