diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2011-11-08 07:09:19 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-01-31 18:20:23 -0500 |
commit | 5bff0386305461021bbef2d958fa0f0151f56a6f (patch) | |
tree | 59f7f61dd4bc44bd9742571baf3c0d88395ddcec /net/sunrpc/rpc_pipe.c | |
parent | 62aa2b537c6f5957afd98e29f96897419ed5ebab (diff) |
SUNRPC: remove non-exclusive pipe creation from RPC pipefs
This patch-set was created in context of clone of git branch:
git://git.linux-nfs.org/projects/trondmy/nfs-2.6.git.
v2:
1) Rebased of current repo state (i.e. all commits were pulled before apply)
I feel it is ready for inclusion if no objections will appear.
SUNRPC pipefs non-exclusive pipe creation code looks obsolete. IOW, as I see
it, all pipes are creating with unique full path and only once.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/rpc_pipe.c')
-rw-r--r-- | net/sunrpc/rpc_pipe.c | 44 |
1 files changed, 6 insertions, 38 deletions
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 63a7a7add21e..8e3397fc0a7d 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -554,7 +554,6 @@ static int __rpc_mkpipe(struct inode *dir, struct dentry *dentry, | |||
554 | if (err) | 554 | if (err) |
555 | return err; | 555 | return err; |
556 | rpci = RPC_I(dentry->d_inode); | 556 | rpci = RPC_I(dentry->d_inode); |
557 | rpci->nkern_readwriters = 1; | ||
558 | rpci->private = private; | 557 | rpci->private = private; |
559 | rpci->flags = flags; | 558 | rpci->flags = flags; |
560 | rpci->ops = ops; | 559 | rpci->ops = ops; |
@@ -587,16 +586,12 @@ static int __rpc_unlink(struct inode *dir, struct dentry *dentry) | |||
587 | static int __rpc_rmpipe(struct inode *dir, struct dentry *dentry) | 586 | static int __rpc_rmpipe(struct inode *dir, struct dentry *dentry) |
588 | { | 587 | { |
589 | struct inode *inode = dentry->d_inode; | 588 | struct inode *inode = dentry->d_inode; |
590 | struct rpc_inode *rpci = RPC_I(inode); | ||
591 | 589 | ||
592 | rpci->nkern_readwriters--; | ||
593 | if (rpci->nkern_readwriters != 0) | ||
594 | return 0; | ||
595 | rpc_close_pipes(inode); | 590 | rpc_close_pipes(inode); |
596 | return __rpc_unlink(dir, dentry); | 591 | return __rpc_unlink(dir, dentry); |
597 | } | 592 | } |
598 | 593 | ||
599 | static struct dentry *__rpc_lookup_create(struct dentry *parent, | 594 | static struct dentry *__rpc_lookup_create_exclusive(struct dentry *parent, |
600 | struct qstr *name) | 595 | struct qstr *name) |
601 | { | 596 | { |
602 | struct dentry *dentry; | 597 | struct dentry *dentry; |
@@ -604,27 +599,13 @@ static struct dentry *__rpc_lookup_create(struct dentry *parent, | |||
604 | dentry = d_lookup(parent, name); | 599 | dentry = d_lookup(parent, name); |
605 | if (!dentry) { | 600 | if (!dentry) { |
606 | dentry = d_alloc(parent, name); | 601 | dentry = d_alloc(parent, name); |
607 | if (!dentry) { | 602 | if (!dentry) |
608 | dentry = ERR_PTR(-ENOMEM); | 603 | return ERR_PTR(-ENOMEM); |
609 | goto out_err; | ||
610 | } | ||
611 | } | 604 | } |
612 | if (!dentry->d_inode) | 605 | if (dentry->d_inode == NULL) { |
613 | d_set_d_op(dentry, &rpc_dentry_operations); | 606 | d_set_d_op(dentry, &rpc_dentry_operations); |
614 | out_err: | ||
615 | return dentry; | ||
616 | } | ||
617 | |||
618 | static struct dentry *__rpc_lookup_create_exclusive(struct dentry *parent, | ||
619 | struct qstr *name) | ||
620 | { | ||
621 | struct dentry *dentry; | ||
622 | |||
623 | dentry = __rpc_lookup_create(parent, name); | ||
624 | if (IS_ERR(dentry)) | ||
625 | return dentry; | ||
626 | if (dentry->d_inode == NULL) | ||
627 | return dentry; | 607 | return dentry; |
608 | } | ||
628 | dput(dentry); | 609 | dput(dentry); |
629 | return ERR_PTR(-EEXIST); | 610 | return ERR_PTR(-EEXIST); |
630 | } | 611 | } |
@@ -812,22 +793,9 @@ struct dentry *rpc_mkpipe(struct dentry *parent, const char *name, | |||
812 | q.hash = full_name_hash(q.name, q.len), | 793 | q.hash = full_name_hash(q.name, q.len), |
813 | 794 | ||
814 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); | 795 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); |
815 | dentry = __rpc_lookup_create(parent, &q); | 796 | dentry = __rpc_lookup_create_exclusive(parent, &q); |
816 | if (IS_ERR(dentry)) | 797 | if (IS_ERR(dentry)) |
817 | goto out; | 798 | goto out; |
818 | if (dentry->d_inode) { | ||
819 | struct rpc_inode *rpci = RPC_I(dentry->d_inode); | ||
820 | if (rpci->private != private || | ||
821 | rpci->ops != ops || | ||
822 | rpci->flags != flags) { | ||
823 | dput (dentry); | ||
824 | err = -EBUSY; | ||
825 | goto out_err; | ||
826 | } | ||
827 | rpci->nkern_readwriters++; | ||
828 | goto out; | ||
829 | } | ||
830 | |||
831 | err = __rpc_mkpipe(dir, dentry, umode, &rpc_pipe_fops, | 799 | err = __rpc_mkpipe(dir, dentry, umode, &rpc_pipe_fops, |
832 | private, ops, flags); | 800 | private, ops, flags); |
833 | if (err) | 801 | if (err) |