reiserfs: constify xattr_handler
[safe/jmp/linux-2.6] / fs / afs / mntpt.c
index 6f8c96f..b3feddc 100644 (file)
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/slab.h>
 #include <linux/fs.h>
 #include <linux/pagemap.h>
 #include <linux/mount.h>
 #include <linux/namei.h>
-#include <linux/mnt_namespace.h>
+#include <linux/gfp.h>
 #include "internal.h"
 
 
@@ -42,7 +41,7 @@ const struct inode_operations afs_mntpt_inode_operations = {
 static LIST_HEAD(afs_vfsmounts);
 static DECLARE_DELAYED_WORK(afs_mntpt_expiry_timer, afs_mntpt_expiry_timed_out);
 
-unsigned long afs_mntpt_expiry_timeout = 10 * 60;
+static unsigned long afs_mntpt_expiry_timeout = 10 * 60;
 
 /*
  * check a symbolic link to see whether it actually encodes a mountpoint
@@ -139,9 +138,9 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)
 {
        struct afs_super_info *super;
        struct vfsmount *mnt;
-       struct page *page = NULL;
+       struct page *page;
        size_t size;
-       char *buf, *devname = NULL, *options = NULL;
+       char *buf, *devname, *options;
        int ret;
 
        _enter("{%s}", mntpt->d_name.name);
@@ -151,31 +150,31 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)
        ret = -EINVAL;
        size = mntpt->d_inode->i_size;
        if (size > PAGE_SIZE - 1)
-               goto error;
+               goto error_no_devname;
 
        ret = -ENOMEM;
        devname = (char *) get_zeroed_page(GFP_KERNEL);
        if (!devname)
-               goto error;
+               goto error_no_devname;
 
        options = (char *) get_zeroed_page(GFP_KERNEL);
        if (!options)
-               goto error;
+               goto error_no_options;
 
        /* read the contents of the AFS special symlink */
        page = read_mapping_page(mntpt->d_inode->i_mapping, 0, NULL);
        if (IS_ERR(page)) {
                ret = PTR_ERR(page);
-               goto error;
+               goto error_no_page;
        }
 
        ret = -EIO;
        if (PageError(page))
                goto error;
 
-       buf = kmap(page);
+       buf = kmap_atomic(page, KM_USER0);
        memcpy(devname, buf, size);
-       kunmap(page);
+       kunmap_atomic(buf, KM_USER0);
        page_cache_release(page);
        page = NULL;
 
@@ -197,12 +196,12 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)
        return mnt;
 
 error:
-       if (page)
-               page_cache_release(page);
-       if (devname)
-               free_page((unsigned long) devname);
-       if (options)
-               free_page((unsigned long) options);
+       page_cache_release(page);
+error_no_page:
+       free_page((unsigned long) options);
+error_no_options:
+       free_page((unsigned long) devname);
+error_no_devname:
        _leave(" = %d", ret);
        return ERR_PTR(ret);
 }
@@ -218,34 +217,33 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)
        _enter("%p{%s},{%s:%p{%s},}",
               dentry,
               dentry->d_name.name,
-              nd->mnt->mnt_devname,
+              nd->path.mnt->mnt_devname,
               dentry,
-              nd->dentry->d_name.name);
+              nd->path.dentry->d_name.name);
 
-       dput(nd->dentry);
-       nd->dentry = dget(dentry);
+       dput(nd->path.dentry);
+       nd->path.dentry = dget(dentry);
 
-       newmnt = afs_mntpt_do_automount(nd->dentry);
+       newmnt = afs_mntpt_do_automount(nd->path.dentry);
        if (IS_ERR(newmnt)) {
-               path_release(nd);
+               path_put(&nd->path);
                return (void *)newmnt;
        }
 
        mntget(newmnt);
-       err = do_add_mount(newmnt, nd, MNT_SHRINKABLE, &afs_vfsmounts);
+       err = do_add_mount(newmnt, &nd->path, MNT_SHRINKABLE, &afs_vfsmounts);
        switch (err) {
        case 0:
-               dput(nd->dentry);
-               mntput(nd->mnt);
-               nd->mnt = newmnt;
-               nd->dentry = dget(newmnt->mnt_root);
+               path_put(&nd->path);
+               nd->path.mnt = newmnt;
+               nd->path.dentry = dget(newmnt->mnt_root);
                schedule_delayed_work(&afs_mntpt_expiry_timer,
                                      afs_mntpt_expiry_timeout * HZ);
                break;
        case -EBUSY:
                /* someone else made a mount here whilst we were busy */
-               while (d_mountpoint(nd->dentry) &&
-                      follow_down(&nd->mnt, &nd->dentry))
+               while (d_mountpoint(nd->path.dentry) &&
+                      follow_down(&nd->path))
                        ;
                err = 0;
        default:
@@ -284,11 +282,3 @@ void afs_mntpt_kill_timer(void)
        cancel_delayed_work(&afs_mntpt_expiry_timer);
        flush_scheduled_work();
 }
-
-/*
- * begin unmount by attempting to remove all automounted mountpoints we added
- */
-void afs_umount_begin(struct vfsmount *vfsmnt, int flags)
-{
-       shrink_submounts(vfsmnt, &afs_vfsmounts);
-}