mm: task dirty accounting fix
[safe/jmp/linux-2.6] / fs / nfs / namespace.c
index 3b6d83d..64a288e 100644 (file)
@@ -20,7 +20,7 @@
 
 static void nfs_expire_automounts(struct work_struct *work);
 
-LIST_HEAD(nfs_automount_list);
+static LIST_HEAD(nfs_automount_list);
 static DECLARE_DELAYED_WORK(nfs_automount_task, nfs_expire_automounts);
 int nfs_mountpoint_expiry_timeout = 500 * HZ;
 
@@ -105,8 +105,11 @@ static void * nfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
 
        dprintk("--> nfs_follow_mountpoint()\n");
 
-       BUG_ON(IS_ROOT(dentry));
-       dprintk("%s: enter\n", __FUNCTION__);
+       err = -ESTALE;
+       if (IS_ROOT(dentry))
+               goto out_err;
+
+       dprintk("%s: enter\n", __func__);
        dput(nd->path.dentry);
        nd->path.dentry = dget(dentry);
 
@@ -129,7 +132,7 @@ static void * nfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
                goto out_err;
 
        mntget(mnt);
-       err = do_add_mount(mnt, nd, nd->path.mnt->mnt_flags|MNT_SHRINKABLE,
+       err = do_add_mount(mnt, &nd->path, nd->path.mnt->mnt_flags|MNT_SHRINKABLE,
                           &nfs_automount_list);
        if (err < 0) {
                mntput(mnt);
@@ -137,18 +140,17 @@ static void * nfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
                        goto out_follow;
                goto out_err;
        }
-       mntput(nd->path.mnt);
-       dput(nd->path.dentry);
+       path_put(&nd->path);
        nd->path.mnt = mnt;
        nd->path.dentry = dget(mnt->mnt_root);
        schedule_delayed_work(&nfs_automount_task, nfs_mountpoint_expiry_timeout);
 out:
-       dprintk("%s: done, returned %d\n", __FUNCTION__, err);
+       dprintk("%s: done, returned %d\n", __func__, err);
 
        dprintk("<-- nfs_follow_mountpoint() = %d\n", err);
        return ERR_PTR(err);
 out_err:
-       path_release(nd);
+       path_put(&nd->path);
        goto out;
 out_follow:
        while (d_mountpoint(nd->path.dentry) &&
@@ -190,7 +192,7 @@ static struct vfsmount *nfs_do_clone_mount(struct nfs_server *server,
                                           struct nfs_clone_mount *mountdata)
 {
 #ifdef CONFIG_NFS_V4
-       struct vfsmount *mnt = NULL;
+       struct vfsmount *mnt = ERR_PTR(-EINVAL);
        switch (server->nfs_client->rpc_ops->version) {
                case 2:
                case 3:
@@ -230,7 +232,7 @@ static struct vfsmount *nfs_do_submount(const struct vfsmount *mnt_parent,
 
        dprintk("--> nfs_do_submount()\n");
 
-       dprintk("%s: submounting on %s/%s\n", __FUNCTION__,
+       dprintk("%s: submounting on %s/%s\n", __func__,
                        dentry->d_parent->d_name.name,
                        dentry->d_name.name);
        if (page == NULL)
@@ -243,7 +245,7 @@ static struct vfsmount *nfs_do_submount(const struct vfsmount *mnt_parent,
 free_page:
        free_page((unsigned long)page);
 out:
-       dprintk("%s: done\n", __FUNCTION__);
+       dprintk("%s: done\n", __func__);
 
        dprintk("<-- nfs_do_submount() = %p\n", mnt);
        return mnt;