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.c46
1 files changed, 26 insertions, 20 deletions
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 0b1a1ac8a4bc..dfa504fe383f 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -327,10 +327,8 @@ rpc_show_info(struct seq_file *m, void *v)
327 seq_printf(m, "RPC server: %s\n", clnt->cl_server); 327 seq_printf(m, "RPC server: %s\n", clnt->cl_server);
328 seq_printf(m, "service: %s (%d) version %d\n", clnt->cl_protname, 328 seq_printf(m, "service: %s (%d) version %d\n", clnt->cl_protname,
329 clnt->cl_prog, clnt->cl_vers); 329 clnt->cl_prog, clnt->cl_vers);
330 seq_printf(m, "address: %u.%u.%u.%u\n", 330 seq_printf(m, "address: %s\n", rpc_peeraddr2str(clnt, RPC_DISPLAY_ADDR));
331 NIPQUAD(clnt->cl_xprt->addr.sin_addr.s_addr)); 331 seq_printf(m, "protocol: %s\n", rpc_peeraddr2str(clnt, RPC_DISPLAY_PROTO));
332 seq_printf(m, "protocol: %s\n",
333 clnt->cl_xprt->prot == IPPROTO_UDP ? "udp" : "tcp");
334 return 0; 332 return 0;
335} 333}
336 334
@@ -623,17 +621,13 @@ __rpc_rmdir(struct inode *dir, struct dentry *dentry)
623} 621}
624 622
625static struct dentry * 623static struct dentry *
626rpc_lookup_negative(char *path, struct nameidata *nd) 624rpc_lookup_create(struct dentry *parent, const char *name, int len)
627{ 625{
626 struct inode *dir = parent->d_inode;
628 struct dentry *dentry; 627 struct dentry *dentry;
629 struct inode *dir;
630 int error;
631 628
632 if ((error = rpc_lookup_parent(path, nd)) != 0)
633 return ERR_PTR(error);
634 dir = nd->dentry->d_inode;
635 mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); 629 mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT);
636 dentry = lookup_one_len(nd->last.name, nd->dentry, nd->last.len); 630 dentry = lookup_one_len(name, parent, len);
637 if (IS_ERR(dentry)) 631 if (IS_ERR(dentry))
638 goto out_err; 632 goto out_err;
639 if (dentry->d_inode) { 633 if (dentry->d_inode) {
@@ -644,7 +638,20 @@ rpc_lookup_negative(char *path, struct nameidata *nd)
644 return dentry; 638 return dentry;
645out_err: 639out_err:
646 mutex_unlock(&dir->i_mutex); 640 mutex_unlock(&dir->i_mutex);
647 rpc_release_path(nd); 641 return dentry;
642}
643
644static struct dentry *
645rpc_lookup_negative(char *path, struct nameidata *nd)
646{
647 struct dentry *dentry;
648 int error;
649
650 if ((error = rpc_lookup_parent(path, nd)) != 0)
651 return ERR_PTR(error);
652 dentry = rpc_lookup_create(nd->dentry, nd->last.name, nd->last.len);
653 if (IS_ERR(dentry))
654 rpc_release_path(nd);
648 return dentry; 655 return dentry;
649} 656}
650 657
@@ -703,18 +710,17 @@ rpc_rmdir(struct dentry *dentry)
703} 710}
704 711
705struct dentry * 712struct dentry *
706rpc_mkpipe(char *path, void *private, struct rpc_pipe_ops *ops, int flags) 713rpc_mkpipe(struct dentry *parent, const char *name, void *private, struct rpc_pipe_ops *ops, int flags)
707{ 714{
708 struct nameidata nd;
709 struct dentry *dentry; 715 struct dentry *dentry;
710 struct inode *dir, *inode; 716 struct inode *dir, *inode;
711 struct rpc_inode *rpci; 717 struct rpc_inode *rpci;
712 718
713 dentry = rpc_lookup_negative(path, &nd); 719 dentry = rpc_lookup_create(parent, name, strlen(name));
714 if (IS_ERR(dentry)) 720 if (IS_ERR(dentry))
715 return dentry; 721 return dentry;
716 dir = nd.dentry->d_inode; 722 dir = parent->d_inode;
717 inode = rpc_get_inode(dir->i_sb, S_IFSOCK | S_IRUSR | S_IWUSR); 723 inode = rpc_get_inode(dir->i_sb, S_IFIFO | S_IRUSR | S_IWUSR);
718 if (!inode) 724 if (!inode)
719 goto err_dput; 725 goto err_dput;
720 inode->i_ino = iunique(dir->i_sb, 100); 726 inode->i_ino = iunique(dir->i_sb, 100);
@@ -728,13 +734,13 @@ rpc_mkpipe(char *path, void *private, struct rpc_pipe_ops *ops, int flags)
728 dget(dentry); 734 dget(dentry);
729out: 735out:
730 mutex_unlock(&dir->i_mutex); 736 mutex_unlock(&dir->i_mutex);
731 rpc_release_path(&nd);
732 return dentry; 737 return dentry;
733err_dput: 738err_dput:
734 dput(dentry); 739 dput(dentry);
735 dentry = ERR_PTR(-ENOMEM); 740 dentry = ERR_PTR(-ENOMEM);
736 printk(KERN_WARNING "%s: %s() failed to create pipe %s (errno = %d)\n", 741 printk(KERN_WARNING "%s: %s() failed to create pipe %s/%s (errno = %d)\n",
737 __FILE__, __FUNCTION__, path, -ENOMEM); 742 __FILE__, __FUNCTION__, parent->d_name.name, name,
743 -ENOMEM);
738 goto out; 744 goto out;
739} 745}
740 746