aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-06-07 18:28:02 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-10 23:40:32 -0400
commit34f308960818e514fadd9365cb5b14cca319320b (patch)
tree45b91a37614559d83025356a19771e3537f5cf00
parent6e84c7b66a0aa0be16a7728d1e687c57978dac2c (diff)
SUNRPC: Enable non-exclusive create in rpc_mkpipe()
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--net/sunrpc/rpc_pipe.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 2320f1e42da4..ebcb8053836e 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -621,7 +621,7 @@ __rpc_rmdir(struct inode *dir, struct dentry *dentry)
621} 621}
622 622
623static struct dentry * 623static struct dentry *
624rpc_lookup_create(struct dentry *parent, const char *name, int len) 624rpc_lookup_create(struct dentry *parent, const char *name, int len, int exclusive)
625{ 625{
626 struct inode *dir = parent->d_inode; 626 struct inode *dir = parent->d_inode;
627 struct dentry *dentry; 627 struct dentry *dentry;
@@ -630,7 +630,7 @@ rpc_lookup_create(struct dentry *parent, const char *name, int len)
630 dentry = lookup_one_len(name, parent, len); 630 dentry = lookup_one_len(name, parent, len);
631 if (IS_ERR(dentry)) 631 if (IS_ERR(dentry))
632 goto out_err; 632 goto out_err;
633 if (dentry->d_inode) { 633 if (dentry->d_inode && exclusive) {
634 dput(dentry); 634 dput(dentry);
635 dentry = ERR_PTR(-EEXIST); 635 dentry = ERR_PTR(-EEXIST);
636 goto out_err; 636 goto out_err;
@@ -649,7 +649,7 @@ rpc_lookup_negative(char *path, struct nameidata *nd)
649 649
650 if ((error = rpc_lookup_parent(path, nd)) != 0) 650 if ((error = rpc_lookup_parent(path, nd)) != 0)
651 return ERR_PTR(error); 651 return ERR_PTR(error);
652 dentry = rpc_lookup_create(nd->dentry, nd->last.name, nd->last.len); 652 dentry = rpc_lookup_create(nd->dentry, nd->last.name, nd->last.len, 1);
653 if (IS_ERR(dentry)) 653 if (IS_ERR(dentry))
654 rpc_release_path(nd); 654 rpc_release_path(nd);
655 return dentry; 655 return dentry;
@@ -716,10 +716,20 @@ rpc_mkpipe(struct dentry *parent, const char *name, void *private, struct rpc_pi
716 struct inode *dir, *inode; 716 struct inode *dir, *inode;
717 struct rpc_inode *rpci; 717 struct rpc_inode *rpci;
718 718
719 dentry = rpc_lookup_create(parent, name, strlen(name)); 719 dentry = rpc_lookup_create(parent, name, strlen(name), 0);
720 if (IS_ERR(dentry)) 720 if (IS_ERR(dentry))
721 return dentry; 721 return dentry;
722 dir = parent->d_inode; 722 dir = parent->d_inode;
723 if (dentry->d_inode) {
724 rpci = RPC_I(dentry->d_inode);
725 if (rpci->private != private ||
726 rpci->ops != ops ||
727 rpci->flags != flags) {
728 dput (dentry);
729 dentry = ERR_PTR(-EBUSY);
730 }
731 goto out;
732 }
723 inode = rpc_get_inode(dir->i_sb, S_IFIFO | S_IRUSR | S_IWUSR); 733 inode = rpc_get_inode(dir->i_sb, S_IFIFO | S_IRUSR | S_IWUSR);
724 if (!inode) 734 if (!inode)
725 goto err_dput; 735 goto err_dput;