Merge branch 'master' of /home/trondmy/kernel/linux-2.6/
[pandora-kernel.git] / net / sunrpc / rpc_pipe.c
index 72b2217..dafe793 100644 (file)
@@ -395,7 +395,7 @@ enum {
  */
 struct rpc_filelist {
        char *name;
-       struct file_operations *i_fop;
+       const struct file_operations *i_fop;
        int mode;
 };
 
@@ -435,14 +435,17 @@ static struct rpc_filelist authfiles[] = {
        },
 };
 
-static int
-rpc_get_mount(void)
+struct vfsmount *rpc_get_mount(void)
 {
-       return simple_pin_fs("rpc_pipefs", &rpc_mount, &rpc_mount_count);
+       int err;
+
+       err = simple_pin_fs(&rpc_pipe_fs_type, &rpc_mount, &rpc_mount_count);
+       if (err != 0)
+               return ERR_PTR(err);
+       return rpc_mount;
 }
 
-static void
-rpc_put_mount(void)
+void rpc_put_mount(void)
 {
        simple_release_fs(&rpc_mount, &rpc_mount_count);
 }
@@ -452,12 +455,13 @@ rpc_lookup_parent(char *path, struct nameidata *nd)
 {
        if (path[0] == '\0')
                return -ENOENT;
-       if (rpc_get_mount()) {
+       nd->mnt = rpc_get_mount();
+       if (IS_ERR(nd->mnt)) {
                printk(KERN_WARNING "%s: %s failed to mount "
                               "pseudofilesystem \n", __FILE__, __FUNCTION__);
-               return -ENODEV;
+               return PTR_ERR(nd->mnt);
        }
-       nd->mnt = mntget(rpc_mount);
+       mntget(nd->mnt);
        nd->dentry = dget(rpc_mount->mnt_root);
        nd->last_type = LAST_ROOT;
        nd->flags = LOOKUP_PARENT;
@@ -594,7 +598,6 @@ __rpc_mkdir(struct inode *dir, struct dentry *dentry)
        d_instantiate(dentry, inode);
        dir->i_nlink++;
        inode_dir_notify(dir, DN_CREATE);
-       rpc_get_mount();
        return 0;
 out_err:
        printk(KERN_WARNING "%s: %s failed to allocate inode for dentry %s\n",
@@ -615,7 +618,6 @@ __rpc_rmdir(struct inode *dir, struct dentry *dentry)
        if (!error) {
                inode_dir_notify(dir, DN_DELETE);
                d_drop(dentry);
-               rpc_put_mount();
        }
        return 0;
 }
@@ -813,11 +815,11 @@ out:
        return -ENOMEM;
 }
 
-static struct super_block *
+static int
 rpc_get_sb(struct file_system_type *fs_type,
-               int flags, const char *dev_name, void *data)
+               int flags, const char *dev_name, void *data, struct vfsmount *mnt)
 {
-       return get_sb_single(fs_type, flags, data, rpc_fill_super);
+       return get_sb_single(fs_type, flags, data, rpc_fill_super, mnt);
 }
 
 static struct file_system_type rpc_pipe_fs_type = {
@@ -850,9 +852,10 @@ init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
 int register_rpc_pipefs(void)
 {
        rpc_inode_cachep = kmem_cache_create("rpc_inode_cache",
-                                             sizeof(struct rpc_inode),
-                                             0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
-                                             init_once, NULL);
+                               sizeof(struct rpc_inode),
+                               0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
+                                               SLAB_MEM_SPREAD),
+                               init_once, NULL);
        if (!rpc_inode_cachep)
                return -ENOMEM;
        register_filesystem(&rpc_pipe_fs_type);