aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/rpc_pipe.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/rpc_pipe.c')
-rw-r--r--net/sunrpc/rpc_pipe.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index ad9d9fc4e734..aa4158be9900 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -91,7 +91,8 @@ rpc_queue_upcall(struct inode *inode, struct rpc_pipe_msg *msg)
91 res = 0; 91 res = 0;
92 } else if (rpci->flags & RPC_PIPE_WAIT_FOR_OPEN) { 92 } else if (rpci->flags & RPC_PIPE_WAIT_FOR_OPEN) {
93 if (list_empty(&rpci->pipe)) 93 if (list_empty(&rpci->pipe))
94 schedule_delayed_work(&rpci->queue_timeout, 94 queue_delayed_work(rpciod_workqueue,
95 &rpci->queue_timeout,
95 RPC_UPCALL_TIMEOUT); 96 RPC_UPCALL_TIMEOUT);
96 list_add_tail(&msg->list, &rpci->pipe); 97 list_add_tail(&msg->list, &rpci->pipe);
97 rpci->pipelen += msg->len; 98 rpci->pipelen += msg->len;
@@ -132,7 +133,7 @@ rpc_close_pipes(struct inode *inode)
132 if (ops->release_pipe) 133 if (ops->release_pipe)
133 ops->release_pipe(inode); 134 ops->release_pipe(inode);
134 cancel_delayed_work(&rpci->queue_timeout); 135 cancel_delayed_work(&rpci->queue_timeout);
135 flush_scheduled_work(); 136 flush_workqueue(rpciod_workqueue);
136 } 137 }
137 rpc_inode_setowner(inode, NULL); 138 rpc_inode_setowner(inode, NULL);
138 mutex_unlock(&inode->i_mutex); 139 mutex_unlock(&inode->i_mutex);
@@ -434,14 +435,17 @@ static struct rpc_filelist authfiles[] = {
434 }, 435 },
435}; 436};
436 437
437static int 438struct vfsmount *rpc_get_mount(void)
438rpc_get_mount(void)
439{ 439{
440 return simple_pin_fs("rpc_pipefs", &rpc_mount, &rpc_mount_count); 440 int err;
441
442 err = simple_pin_fs("rpc_pipefs", &rpc_mount, &rpc_mount_count);
443 if (err != 0)
444 return ERR_PTR(err);
445 return rpc_mount;
441} 446}
442 447
443static void 448void rpc_put_mount(void)
444rpc_put_mount(void)
445{ 449{
446 simple_release_fs(&rpc_mount, &rpc_mount_count); 450 simple_release_fs(&rpc_mount, &rpc_mount_count);
447} 451}
@@ -451,12 +455,13 @@ rpc_lookup_parent(char *path, struct nameidata *nd)
451{ 455{
452 if (path[0] == '\0') 456 if (path[0] == '\0')
453 return -ENOENT; 457 return -ENOENT;
454 if (rpc_get_mount()) { 458 nd->mnt = rpc_get_mount();
459 if (IS_ERR(nd->mnt)) {
455 printk(KERN_WARNING "%s: %s failed to mount " 460 printk(KERN_WARNING "%s: %s failed to mount "
456 "pseudofilesystem \n", __FILE__, __FUNCTION__); 461 "pseudofilesystem \n", __FILE__, __FUNCTION__);
457 return -ENODEV; 462 return PTR_ERR(nd->mnt);
458 } 463 }
459 nd->mnt = mntget(rpc_mount); 464 mntget(nd->mnt);
460 nd->dentry = dget(rpc_mount->mnt_root); 465 nd->dentry = dget(rpc_mount->mnt_root);
461 nd->last_type = LAST_ROOT; 466 nd->last_type = LAST_ROOT;
462 nd->flags = LOOKUP_PARENT; 467 nd->flags = LOOKUP_PARENT;
@@ -593,7 +598,6 @@ __rpc_mkdir(struct inode *dir, struct dentry *dentry)
593 d_instantiate(dentry, inode); 598 d_instantiate(dentry, inode);
594 dir->i_nlink++; 599 dir->i_nlink++;
595 inode_dir_notify(dir, DN_CREATE); 600 inode_dir_notify(dir, DN_CREATE);
596 rpc_get_mount();
597 return 0; 601 return 0;
598out_err: 602out_err:
599 printk(KERN_WARNING "%s: %s failed to allocate inode for dentry %s\n", 603 printk(KERN_WARNING "%s: %s failed to allocate inode for dentry %s\n",
@@ -614,7 +618,6 @@ __rpc_rmdir(struct inode *dir, struct dentry *dentry)
614 if (!error) { 618 if (!error) {
615 inode_dir_notify(dir, DN_DELETE); 619 inode_dir_notify(dir, DN_DELETE);
616 d_drop(dentry); 620 d_drop(dentry);
617 rpc_put_mount();
618 } 621 }
619 return 0; 622 return 0;
620} 623}
@@ -668,7 +671,7 @@ rpc_mkdir(char *path, struct rpc_clnt *rpc_client)
668out: 671out:
669 mutex_unlock(&dir->i_mutex); 672 mutex_unlock(&dir->i_mutex);
670 rpc_release_path(&nd); 673 rpc_release_path(&nd);
671 return dentry; 674 return dget(dentry);
672err_depopulate: 675err_depopulate:
673 rpc_depopulate(dentry); 676 rpc_depopulate(dentry);
674 __rpc_rmdir(dir, dentry); 677 __rpc_rmdir(dir, dentry);
@@ -732,7 +735,7 @@ rpc_mkpipe(char *path, void *private, struct rpc_pipe_ops *ops, int flags)
732out: 735out:
733 mutex_unlock(&dir->i_mutex); 736 mutex_unlock(&dir->i_mutex);
734 rpc_release_path(&nd); 737 rpc_release_path(&nd);
735 return dentry; 738 return dget(dentry);
736err_dput: 739err_dput:
737 dput(dentry); 740 dput(dentry);
738 dentry = ERR_PTR(-ENOMEM); 741 dentry = ERR_PTR(-ENOMEM);