aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/rpc_pipe.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-08-24 01:03:17 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-09-22 23:24:54 -0400
commit158998b6fe36f6acef087f574c96d44713499cc9 (patch)
treeafc0f330e51135cdcf05bd8c268bf514165a4e4a /net/sunrpc/rpc_pipe.c
parent5dd3177ae5012c1e2ad7a9ffdbd0e0d0de2f60e4 (diff)
SUNRPC: Make rpc_mkpipe() take the parent dentry as an argument
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/rpc_pipe.c')
-rw-r--r--net/sunrpc/rpc_pipe.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index c21dc07f2a8c..11ec12a09d70 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -621,17 +621,13 @@ __rpc_rmdir(struct inode *dir, struct dentry *dentry)
621} 621}
622 622
623static struct dentry * 623static struct dentry *
624rpc_lookup_negative(char *path, struct nameidata *nd) 624rpc_lookup_create(struct dentry *parent, const char *name, int len)
625{ 625{
626 struct inode *dir = parent->d_inode;
626 struct dentry *dentry; 627 struct dentry *dentry;
627 struct inode *dir;
628 int error;
629 628
630 if ((error = rpc_lookup_parent(path, nd)) != 0)
631 return ERR_PTR(error);
632 dir = nd->dentry->d_inode;
633 mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); 629 mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT);
634 dentry = lookup_one_len(nd->last.name, nd->dentry, nd->last.len); 630 dentry = lookup_one_len(name, parent, len);
635 if (IS_ERR(dentry)) 631 if (IS_ERR(dentry))
636 goto out_err; 632 goto out_err;
637 if (dentry->d_inode) { 633 if (dentry->d_inode) {
@@ -642,7 +638,20 @@ rpc_lookup_negative(char *path, struct nameidata *nd)
642 return dentry; 638 return dentry;
643out_err: 639out_err:
644 mutex_unlock(&dir->i_mutex); 640 mutex_unlock(&dir->i_mutex);
645 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);
646 return dentry; 655 return dentry;
647} 656}
648 657
@@ -701,17 +710,16 @@ rpc_rmdir(struct dentry *dentry)
701} 710}
702 711
703struct dentry * 712struct dentry *
704rpc_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)
705{ 714{
706 struct nameidata nd;
707 struct dentry *dentry; 715 struct dentry *dentry;
708 struct inode *dir, *inode; 716 struct inode *dir, *inode;
709 struct rpc_inode *rpci; 717 struct rpc_inode *rpci;
710 718
711 dentry = rpc_lookup_negative(path, &nd); 719 dentry = rpc_lookup_create(parent, name, strlen(name));
712 if (IS_ERR(dentry)) 720 if (IS_ERR(dentry))
713 return dentry; 721 return dentry;
714 dir = nd.dentry->d_inode; 722 dir = parent->d_inode;
715 inode = rpc_get_inode(dir->i_sb, S_IFSOCK | S_IRUSR | S_IWUSR); 723 inode = rpc_get_inode(dir->i_sb, S_IFSOCK | S_IRUSR | S_IWUSR);
716 if (!inode) 724 if (!inode)
717 goto err_dput; 725 goto err_dput;
@@ -726,13 +734,13 @@ rpc_mkpipe(char *path, void *private, struct rpc_pipe_ops *ops, int flags)
726 dget(dentry); 734 dget(dentry);
727out: 735out:
728 mutex_unlock(&dir->i_mutex); 736 mutex_unlock(&dir->i_mutex);
729 rpc_release_path(&nd);
730 return dentry; 737 return dentry;
731err_dput: 738err_dput:
732 dput(dentry); 739 dput(dentry);
733 dentry = ERR_PTR(-ENOMEM); 740 dentry = ERR_PTR(-ENOMEM);
734 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",
735 __FILE__, __FUNCTION__, path, -ENOMEM); 742 __FILE__, __FUNCTION__, parent->d_name.name, name,
743 -ENOMEM);
736 goto out; 744 goto out;
737} 745}
738 746