vserver 1.9.3
[linux-2.6.git] / fs / afs / mntpt.c
index 8b5c1e2..bfc28ab 100644 (file)
@@ -235,8 +235,8 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)
  */
 static int afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)
 {
-       struct nameidata newnd;
        struct vfsmount *newmnt;
+       struct dentry *old_dentry;
        int err;
 
        kenter("%p{%s},{%s:%p{%s}}",
@@ -247,15 +247,19 @@ static int afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)
               nd->dentry->d_name.name);
 
        newmnt = afs_mntpt_do_automount(dentry);
-       if (IS_ERR(newmnt))
+       if (IS_ERR(newmnt)) {
+               path_release(nd);
                return PTR_ERR(newmnt);
+       }
 
-       newnd = *nd;
-       newnd.dentry = dentry;
-       err = do_add_mount(newmnt, &newnd, 0, &afs_vfsmounts);
+       old_dentry = nd->dentry;
+       nd->dentry = dentry;
+       err = do_add_mount(newmnt, nd, 0, &afs_vfsmounts);
+       nd->dentry = old_dentry;
+
+       path_release(nd);
 
        if (!err) {
-               path_release(nd);
                mntget(newmnt);
                nd->mnt = newmnt;
                dget(newmnt->mnt_root);