linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / net / sunrpc / rpc_pipe.c
index cc673dd..a5c0c7b 100644 (file)
@@ -91,8 +91,7 @@ rpc_queue_upcall(struct inode *inode, struct rpc_pipe_msg *msg)
                res = 0;
        } else if (rpci->flags & RPC_PIPE_WAIT_FOR_OPEN) {
                if (list_empty(&rpci->pipe))
-                       queue_delayed_work(rpciod_workqueue,
-                                       &rpci->queue_timeout,
+                       schedule_delayed_work(&rpci->queue_timeout,
                                        RPC_UPCALL_TIMEOUT);
                list_add_tail(&msg->list, &rpci->pipe);
                rpci->pipelen += msg->len;
@@ -133,7 +132,7 @@ rpc_close_pipes(struct inode *inode)
                if (ops->release_pipe)
                        ops->release_pipe(inode);
                cancel_delayed_work(&rpci->queue_timeout);
-               flush_workqueue(rpciod_workqueue);
+               flush_scheduled_work();
        }
        rpc_inode_setowner(inode, NULL);
        mutex_unlock(&inode->i_mutex);
@@ -395,7 +394,7 @@ enum {
  */
 struct rpc_filelist {
        char *name;
-       const struct file_operations *i_fop;
+       struct file_operations *i_fop;
        int mode;
 };
 
@@ -435,17 +434,14 @@ static struct rpc_filelist authfiles[] = {
        },
 };
 
-struct vfsmount *rpc_get_mount(void)
+static int
+rpc_get_mount(void)
 {
-       int err;
-
-       err = simple_pin_fs("rpc_pipefs", &rpc_mount, &rpc_mount_count);
-       if (err != 0)
-               return ERR_PTR(err);
-       return rpc_mount;
+       return simple_pin_fs("rpc_pipefs", &rpc_mount, &rpc_mount_count);
 }
 
-void rpc_put_mount(void)
+static void
+rpc_put_mount(void)
 {
        simple_release_fs(&rpc_mount, &rpc_mount_count);
 }
@@ -455,13 +451,12 @@ rpc_lookup_parent(char *path, struct nameidata *nd)
 {
        if (path[0] == '\0')
                return -ENOENT;
-       nd->mnt = rpc_get_mount();
-       if (IS_ERR(nd->mnt)) {
+       if (rpc_get_mount()) {
                printk(KERN_WARNING "%s: %s failed to mount "
                               "pseudofilesystem \n", __FILE__, __FUNCTION__);
-               return PTR_ERR(nd->mnt);
+               return -ENODEV;
        }
-       mntget(nd->mnt);
+       nd->mnt = mntget(rpc_mount);
        nd->dentry = dget(rpc_mount->mnt_root);
        nd->last_type = LAST_ROOT;
        nd->flags = LOOKUP_PARENT;
@@ -598,6 +593,7 @@ __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",
@@ -618,6 +614,7 @@ __rpc_rmdir(struct inode *dir, struct dentry *dentry)
        if (!error) {
                inode_dir_notify(dir, DN_DELETE);
                d_drop(dentry);
+               rpc_put_mount();
        }
        return 0;
 }
@@ -671,7 +668,7 @@ rpc_mkdir(char *path, struct rpc_clnt *rpc_client)
 out:
        mutex_unlock(&dir->i_mutex);
        rpc_release_path(&nd);
-       return dget(dentry);
+       return dentry;
 err_depopulate:
        rpc_depopulate(dentry);
        __rpc_rmdir(dir, dentry);
@@ -735,7 +732,7 @@ rpc_mkpipe(char *path, void *private, struct rpc_pipe_ops *ops, int flags)
 out:
        mutex_unlock(&dir->i_mutex);
        rpc_release_path(&nd);
-       return dget(dentry);
+       return dentry;
 err_dput:
        dput(dentry);
        dentry = ERR_PTR(-ENOMEM);
@@ -852,10 +849,9 @@ 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|
-                                               SLAB_MEM_SPREAD),
-                               init_once, NULL);
+                                             sizeof(struct rpc_inode),
+                                             0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
+                                             init_once, NULL);
        if (!rpc_inode_cachep)
                return -ENOMEM;
        register_filesystem(&rpc_pipe_fs_type);