diff options
-rw-r--r-- | fs/nfs/blocklayout/blocklayout.c | 16 | ||||
-rw-r--r-- | fs/nfs/blocklayout/blocklayout.h | 2 | ||||
-rw-r--r-- | fs/nfs/blocklayout/blocklayoutdev.c | 2 | ||||
-rw-r--r-- | fs/nfs/blocklayout/blocklayoutdm.c | 2 | ||||
-rw-r--r-- | fs/nfs/idmap.c | 28 | ||||
-rw-r--r-- | include/linux/sunrpc/rpc_pipe_fs.h | 7 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 54 | ||||
-rw-r--r-- | net/sunrpc/rpc_pipe.c | 54 |
8 files changed, 107 insertions, 58 deletions
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c index 48cfac31f64c..848660fd58c4 100644 --- a/fs/nfs/blocklayout/blocklayout.c +++ b/fs/nfs/blocklayout/blocklayout.c | |||
@@ -46,7 +46,7 @@ MODULE_LICENSE("GPL"); | |||
46 | MODULE_AUTHOR("Andy Adamson <andros@citi.umich.edu>"); | 46 | MODULE_AUTHOR("Andy Adamson <andros@citi.umich.edu>"); |
47 | MODULE_DESCRIPTION("The NFSv4.1 pNFS Block layout driver"); | 47 | MODULE_DESCRIPTION("The NFSv4.1 pNFS Block layout driver"); |
48 | 48 | ||
49 | struct dentry *bl_device_pipe; | 49 | struct rpc_pipe *bl_device_pipe; |
50 | wait_queue_head_t bl_wq; | 50 | wait_queue_head_t bl_wq; |
51 | 51 | ||
52 | static void print_page(struct page *page) | 52 | static void print_page(struct page *page) |
@@ -1051,16 +1051,23 @@ static int __init nfs4blocklayout_init(void) | |||
1051 | if (ret) | 1051 | if (ret) |
1052 | goto out_putrpc; | 1052 | goto out_putrpc; |
1053 | 1053 | ||
1054 | bl_device_pipe = rpc_mkpipe(path.dentry, "blocklayout", NULL, | 1054 | bl_device_pipe = rpc_mkpipe_data(&bl_upcall_ops, 0); |
1055 | &bl_upcall_ops, 0); | ||
1056 | path_put(&path); | 1055 | path_put(&path); |
1057 | if (IS_ERR(bl_device_pipe)) { | 1056 | if (IS_ERR(bl_device_pipe)) { |
1058 | ret = PTR_ERR(bl_device_pipe); | 1057 | ret = PTR_ERR(bl_device_pipe); |
1059 | goto out_putrpc; | 1058 | goto out_putrpc; |
1060 | } | 1059 | } |
1060 | bl_device_pipe->dentry = rpc_mkpipe_dentry(path.dentry, "blocklayout", | ||
1061 | NULL, bl_device_pipe); | ||
1062 | if (IS_ERR(bl_device_pipe->dentry)) { | ||
1063 | ret = PTR_ERR(bl_device_pipe->dentry); | ||
1064 | goto out_destroy_pipe; | ||
1065 | } | ||
1061 | out: | 1066 | out: |
1062 | return ret; | 1067 | return ret; |
1063 | 1068 | ||
1069 | out_destroy_pipe: | ||
1070 | rpc_destroy_pipe_data(bl_device_pipe); | ||
1064 | out_putrpc: | 1071 | out_putrpc: |
1065 | rpc_put_mount(); | 1072 | rpc_put_mount(); |
1066 | out_remove: | 1073 | out_remove: |
@@ -1074,7 +1081,8 @@ static void __exit nfs4blocklayout_exit(void) | |||
1074 | __func__); | 1081 | __func__); |
1075 | 1082 | ||
1076 | pnfs_unregister_layoutdriver(&blocklayout_type); | 1083 | pnfs_unregister_layoutdriver(&blocklayout_type); |
1077 | rpc_unlink(bl_device_pipe); | 1084 | rpc_unlink(bl_device_pipe->dentry); |
1085 | rpc_destroy_pipe_data(bl_device_pipe); | ||
1078 | rpc_put_mount(); | 1086 | rpc_put_mount(); |
1079 | } | 1087 | } |
1080 | 1088 | ||
diff --git a/fs/nfs/blocklayout/blocklayout.h b/fs/nfs/blocklayout/blocklayout.h index e31a2df28e70..49c670b18a9e 100644 --- a/fs/nfs/blocklayout/blocklayout.h +++ b/fs/nfs/blocklayout/blocklayout.h | |||
@@ -161,7 +161,7 @@ struct bl_msg_hdr { | |||
161 | u16 totallen; /* length of entire message, including hdr itself */ | 161 | u16 totallen; /* length of entire message, including hdr itself */ |
162 | }; | 162 | }; |
163 | 163 | ||
164 | extern struct dentry *bl_device_pipe; | 164 | extern struct rpc_pipe *bl_device_pipe; |
165 | extern wait_queue_head_t bl_wq; | 165 | extern wait_queue_head_t bl_wq; |
166 | 166 | ||
167 | #define BL_DEVICE_UMOUNT 0x0 /* Umount--delete devices */ | 167 | #define BL_DEVICE_UMOUNT 0x0 /* Umount--delete devices */ |
diff --git a/fs/nfs/blocklayout/blocklayoutdev.c b/fs/nfs/blocklayout/blocklayoutdev.c index 81019190e46d..949b62478799 100644 --- a/fs/nfs/blocklayout/blocklayoutdev.c +++ b/fs/nfs/blocklayout/blocklayoutdev.c | |||
@@ -146,7 +146,7 @@ nfs4_blk_decode_device(struct nfs_server *server, | |||
146 | 146 | ||
147 | dprintk("%s CALLING USERSPACE DAEMON\n", __func__); | 147 | dprintk("%s CALLING USERSPACE DAEMON\n", __func__); |
148 | add_wait_queue(&bl_wq, &wq); | 148 | add_wait_queue(&bl_wq, &wq); |
149 | rc = rpc_queue_upcall(RPC_I(bl_device_pipe->d_inode)->pipe, &msg); | 149 | rc = rpc_queue_upcall(bl_device_pipe, &msg); |
150 | if (rc < 0) { | 150 | if (rc < 0) { |
151 | remove_wait_queue(&bl_wq, &wq); | 151 | remove_wait_queue(&bl_wq, &wq); |
152 | rv = ERR_PTR(rc); | 152 | rv = ERR_PTR(rc); |
diff --git a/fs/nfs/blocklayout/blocklayoutdm.c b/fs/nfs/blocklayout/blocklayoutdm.c index 3c38244a8724..631f254d12ab 100644 --- a/fs/nfs/blocklayout/blocklayoutdm.c +++ b/fs/nfs/blocklayout/blocklayoutdm.c | |||
@@ -66,7 +66,7 @@ static void dev_remove(dev_t dev) | |||
66 | msg.len = sizeof(bl_msg) + bl_msg.totallen; | 66 | msg.len = sizeof(bl_msg) + bl_msg.totallen; |
67 | 67 | ||
68 | add_wait_queue(&bl_wq, &wq); | 68 | add_wait_queue(&bl_wq, &wq); |
69 | if (rpc_queue_upcall(RPC_I(bl_device_pipe->d_inode)->pipe, &msg) < 0) { | 69 | if (rpc_queue_upcall(bl_device_pipe, &msg) < 0) { |
70 | remove_wait_queue(&bl_wq, &wq); | 70 | remove_wait_queue(&bl_wq, &wq); |
71 | goto out; | 71 | goto out; |
72 | } | 72 | } |
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c index 3c63c47c793d..2992cb854e12 100644 --- a/fs/nfs/idmap.c +++ b/fs/nfs/idmap.c | |||
@@ -410,7 +410,7 @@ struct idmap_hashtable { | |||
410 | }; | 410 | }; |
411 | 411 | ||
412 | struct idmap { | 412 | struct idmap { |
413 | struct dentry *idmap_dentry; | 413 | struct rpc_pipe *idmap_pipe; |
414 | wait_queue_head_t idmap_wq; | 414 | wait_queue_head_t idmap_wq; |
415 | struct idmap_msg idmap_im; | 415 | struct idmap_msg idmap_im; |
416 | struct mutex idmap_lock; /* Serializes upcalls */ | 416 | struct mutex idmap_lock; /* Serializes upcalls */ |
@@ -435,6 +435,7 @@ int | |||
435 | nfs_idmap_new(struct nfs_client *clp) | 435 | nfs_idmap_new(struct nfs_client *clp) |
436 | { | 436 | { |
437 | struct idmap *idmap; | 437 | struct idmap *idmap; |
438 | struct rpc_pipe *pipe; | ||
438 | int error; | 439 | int error; |
439 | 440 | ||
440 | BUG_ON(clp->cl_idmap != NULL); | 441 | BUG_ON(clp->cl_idmap != NULL); |
@@ -443,14 +444,23 @@ nfs_idmap_new(struct nfs_client *clp) | |||
443 | if (idmap == NULL) | 444 | if (idmap == NULL) |
444 | return -ENOMEM; | 445 | return -ENOMEM; |
445 | 446 | ||
446 | idmap->idmap_dentry = rpc_mkpipe(clp->cl_rpcclient->cl_path.dentry, | 447 | pipe = rpc_mkpipe_data(&idmap_upcall_ops, 0); |
447 | "idmap", idmap, &idmap_upcall_ops, 0); | 448 | if (IS_ERR(pipe)) { |
448 | if (IS_ERR(idmap->idmap_dentry)) { | 449 | error = PTR_ERR(pipe); |
449 | error = PTR_ERR(idmap->idmap_dentry); | ||
450 | kfree(idmap); | 450 | kfree(idmap); |
451 | return error; | 451 | return error; |
452 | } | 452 | } |
453 | 453 | ||
454 | if (clp->cl_rpcclient->cl_path.dentry) | ||
455 | pipe->dentry = rpc_mkpipe_dentry(clp->cl_rpcclient->cl_path.dentry, | ||
456 | "idmap", idmap, pipe); | ||
457 | if (IS_ERR(pipe->dentry)) { | ||
458 | error = PTR_ERR(pipe->dentry); | ||
459 | rpc_destroy_pipe_data(pipe); | ||
460 | kfree(idmap); | ||
461 | return error; | ||
462 | } | ||
463 | idmap->idmap_pipe = pipe; | ||
454 | mutex_init(&idmap->idmap_lock); | 464 | mutex_init(&idmap->idmap_lock); |
455 | mutex_init(&idmap->idmap_im_lock); | 465 | mutex_init(&idmap->idmap_im_lock); |
456 | init_waitqueue_head(&idmap->idmap_wq); | 466 | init_waitqueue_head(&idmap->idmap_wq); |
@@ -468,7 +478,9 @@ nfs_idmap_delete(struct nfs_client *clp) | |||
468 | 478 | ||
469 | if (!idmap) | 479 | if (!idmap) |
470 | return; | 480 | return; |
471 | rpc_unlink(idmap->idmap_dentry); | 481 | if (idmap->idmap_pipe->dentry) |
482 | rpc_unlink(idmap->idmap_pipe->dentry); | ||
483 | rpc_destroy_pipe_data(idmap->idmap_pipe); | ||
472 | clp->cl_idmap = NULL; | 484 | clp->cl_idmap = NULL; |
473 | kfree(idmap); | 485 | kfree(idmap); |
474 | } | 486 | } |
@@ -589,7 +601,7 @@ nfs_idmap_id(struct idmap *idmap, struct idmap_hashtable *h, | |||
589 | msg.len = sizeof(*im); | 601 | msg.len = sizeof(*im); |
590 | 602 | ||
591 | add_wait_queue(&idmap->idmap_wq, &wq); | 603 | add_wait_queue(&idmap->idmap_wq, &wq); |
592 | if (rpc_queue_upcall(RPC_I(idmap->idmap_dentry->d_inode)->pipe, &msg) < 0) { | 604 | if (rpc_queue_upcall(idmap->idmap_pipe, &msg) < 0) { |
593 | remove_wait_queue(&idmap->idmap_wq, &wq); | 605 | remove_wait_queue(&idmap->idmap_wq, &wq); |
594 | goto out; | 606 | goto out; |
595 | } | 607 | } |
@@ -650,7 +662,7 @@ nfs_idmap_name(struct idmap *idmap, struct idmap_hashtable *h, | |||
650 | 662 | ||
651 | add_wait_queue(&idmap->idmap_wq, &wq); | 663 | add_wait_queue(&idmap->idmap_wq, &wq); |
652 | 664 | ||
653 | if (rpc_queue_upcall(RPC_I(idmap->idmap_dentry->d_inode)->pipe, &msg) < 0) { | 665 | if (rpc_queue_upcall(idmap->idmap_pipe, &msg) < 0) { |
654 | remove_wait_queue(&idmap->idmap_wq, &wq); | 666 | remove_wait_queue(&idmap->idmap_wq, &wq); |
655 | goto out; | 667 | goto out; |
656 | } | 668 | } |
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h index 3ebc257e2b43..0d1f748f76da 100644 --- a/include/linux/sunrpc/rpc_pipe_fs.h +++ b/include/linux/sunrpc/rpc_pipe_fs.h | |||
@@ -34,6 +34,7 @@ struct rpc_pipe { | |||
34 | struct delayed_work queue_timeout; | 34 | struct delayed_work queue_timeout; |
35 | const struct rpc_pipe_ops *ops; | 35 | const struct rpc_pipe_ops *ops; |
36 | spinlock_t lock; | 36 | spinlock_t lock; |
37 | struct dentry *dentry; | ||
37 | }; | 38 | }; |
38 | 39 | ||
39 | struct rpc_inode { | 40 | struct rpc_inode { |
@@ -77,8 +78,10 @@ extern struct dentry *rpc_create_cache_dir(struct dentry *, | |||
77 | struct cache_detail *); | 78 | struct cache_detail *); |
78 | extern void rpc_remove_cache_dir(struct dentry *); | 79 | extern void rpc_remove_cache_dir(struct dentry *); |
79 | 80 | ||
80 | extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *, | 81 | struct rpc_pipe *rpc_mkpipe_data(const struct rpc_pipe_ops *ops, int flags); |
81 | const struct rpc_pipe_ops *, int flags); | 82 | void rpc_destroy_pipe_data(struct rpc_pipe *pipe); |
83 | extern struct dentry *rpc_mkpipe_dentry(struct dentry *, const char *, void *, | ||
84 | struct rpc_pipe *); | ||
82 | extern int rpc_unlink(struct dentry *); | 85 | extern int rpc_unlink(struct dentry *); |
83 | extern struct vfsmount *rpc_get_mount(void); | 86 | extern struct vfsmount *rpc_get_mount(void); |
84 | extern void rpc_put_mount(void); | 87 | extern void rpc_put_mount(void); |
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 304b8309f217..f684ce606667 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -81,7 +81,7 @@ struct gss_auth { | |||
81 | * mechanism (for example, "krb5") and exists for | 81 | * mechanism (for example, "krb5") and exists for |
82 | * backwards-compatibility with older gssd's. | 82 | * backwards-compatibility with older gssd's. |
83 | */ | 83 | */ |
84 | struct dentry *dentry[2]; | 84 | struct rpc_pipe *pipe[2]; |
85 | }; | 85 | }; |
86 | 86 | ||
87 | /* pipe_version >= 0 if and only if someone has a pipe open. */ | 87 | /* pipe_version >= 0 if and only if someone has a pipe open. */ |
@@ -449,7 +449,7 @@ gss_alloc_msg(struct gss_auth *gss_auth, struct rpc_clnt *clnt, | |||
449 | kfree(gss_msg); | 449 | kfree(gss_msg); |
450 | return ERR_PTR(vers); | 450 | return ERR_PTR(vers); |
451 | } | 451 | } |
452 | gss_msg->pipe = RPC_I(gss_auth->dentry[vers]->d_inode)->pipe; | 452 | gss_msg->pipe = gss_auth->pipe[vers]; |
453 | INIT_LIST_HEAD(&gss_msg->list); | 453 | INIT_LIST_HEAD(&gss_msg->list); |
454 | rpc_init_wait_queue(&gss_msg->rpc_waitqueue, "RPCSEC_GSS upcall waitq"); | 454 | rpc_init_wait_queue(&gss_msg->rpc_waitqueue, "RPCSEC_GSS upcall waitq"); |
455 | init_waitqueue_head(&gss_msg->waitqueue); | 455 | init_waitqueue_head(&gss_msg->waitqueue); |
@@ -799,21 +799,33 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor) | |||
799 | * that we supported only the old pipe. So we instead create | 799 | * that we supported only the old pipe. So we instead create |
800 | * the new pipe first. | 800 | * the new pipe first. |
801 | */ | 801 | */ |
802 | gss_auth->dentry[1] = rpc_mkpipe(clnt->cl_path.dentry, | 802 | gss_auth->pipe[1] = rpc_mkpipe_data(&gss_upcall_ops_v1, |
803 | "gssd", | 803 | RPC_PIPE_WAIT_FOR_OPEN); |
804 | clnt, &gss_upcall_ops_v1, | 804 | if (IS_ERR(gss_auth->pipe[1])) { |
805 | RPC_PIPE_WAIT_FOR_OPEN); | 805 | err = PTR_ERR(gss_auth->pipe[1]); |
806 | if (IS_ERR(gss_auth->dentry[1])) { | ||
807 | err = PTR_ERR(gss_auth->dentry[1]); | ||
808 | goto err_put_mech; | 806 | goto err_put_mech; |
809 | } | 807 | } |
810 | 808 | ||
811 | gss_auth->dentry[0] = rpc_mkpipe(clnt->cl_path.dentry, | 809 | gss_auth->pipe[0] = rpc_mkpipe_data(&gss_upcall_ops_v0, |
812 | gss_auth->mech->gm_name, | 810 | RPC_PIPE_WAIT_FOR_OPEN); |
813 | clnt, &gss_upcall_ops_v0, | 811 | if (IS_ERR(gss_auth->pipe[0])) { |
814 | RPC_PIPE_WAIT_FOR_OPEN); | 812 | err = PTR_ERR(gss_auth->pipe[0]); |
815 | if (IS_ERR(gss_auth->dentry[0])) { | 813 | goto err_destroy_pipe_1; |
816 | err = PTR_ERR(gss_auth->dentry[0]); | 814 | } |
815 | |||
816 | gss_auth->pipe[1]->dentry = rpc_mkpipe_dentry(clnt->cl_path.dentry, | ||
817 | "gssd", | ||
818 | clnt, gss_auth->pipe[1]); | ||
819 | if (IS_ERR(gss_auth->pipe[1]->dentry)) { | ||
820 | err = PTR_ERR(gss_auth->pipe[1]->dentry); | ||
821 | goto err_destroy_pipe_0; | ||
822 | } | ||
823 | |||
824 | gss_auth->pipe[0]->dentry = rpc_mkpipe_dentry(clnt->cl_path.dentry, | ||
825 | gss_auth->mech->gm_name, | ||
826 | clnt, gss_auth->pipe[0]); | ||
827 | if (IS_ERR(gss_auth->pipe[0]->dentry)) { | ||
828 | err = PTR_ERR(gss_auth->pipe[0]->dentry); | ||
817 | goto err_unlink_pipe_1; | 829 | goto err_unlink_pipe_1; |
818 | } | 830 | } |
819 | err = rpcauth_init_credcache(auth); | 831 | err = rpcauth_init_credcache(auth); |
@@ -822,9 +834,13 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor) | |||
822 | 834 | ||
823 | return auth; | 835 | return auth; |
824 | err_unlink_pipe_0: | 836 | err_unlink_pipe_0: |
825 | rpc_unlink(gss_auth->dentry[0]); | 837 | rpc_unlink(gss_auth->pipe[0]->dentry); |
826 | err_unlink_pipe_1: | 838 | err_unlink_pipe_1: |
827 | rpc_unlink(gss_auth->dentry[1]); | 839 | rpc_unlink(gss_auth->pipe[1]->dentry); |
840 | err_destroy_pipe_0: | ||
841 | rpc_destroy_pipe_data(gss_auth->pipe[0]); | ||
842 | err_destroy_pipe_1: | ||
843 | rpc_destroy_pipe_data(gss_auth->pipe[1]); | ||
828 | err_put_mech: | 844 | err_put_mech: |
829 | gss_mech_put(gss_auth->mech); | 845 | gss_mech_put(gss_auth->mech); |
830 | err_free: | 846 | err_free: |
@@ -837,8 +853,10 @@ out_dec: | |||
837 | static void | 853 | static void |
838 | gss_free(struct gss_auth *gss_auth) | 854 | gss_free(struct gss_auth *gss_auth) |
839 | { | 855 | { |
840 | rpc_unlink(gss_auth->dentry[1]); | 856 | rpc_unlink(gss_auth->pipe[0]->dentry); |
841 | rpc_unlink(gss_auth->dentry[0]); | 857 | rpc_unlink(gss_auth->pipe[1]->dentry); |
858 | rpc_destroy_pipe_data(gss_auth->pipe[0]); | ||
859 | rpc_destroy_pipe_data(gss_auth->pipe[1]); | ||
842 | gss_mech_put(gss_auth->mech); | 860 | gss_mech_put(gss_auth->mech); |
843 | 861 | ||
844 | kfree(gss_auth); | 862 | kfree(gss_auth); |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 4093da79d512..6dd8b96e8df7 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -206,7 +206,6 @@ static void | |||
206 | rpc_i_callback(struct rcu_head *head) | 206 | rpc_i_callback(struct rcu_head *head) |
207 | { | 207 | { |
208 | struct inode *inode = container_of(head, struct inode, i_rcu); | 208 | struct inode *inode = container_of(head, struct inode, i_rcu); |
209 | kfree(RPC_I(inode)->pipe); | ||
210 | kmem_cache_free(rpc_inode_cachep, RPC_I(inode)); | 209 | kmem_cache_free(rpc_inode_cachep, RPC_I(inode)); |
211 | } | 210 | } |
212 | 211 | ||
@@ -575,34 +574,44 @@ init_pipe(struct rpc_pipe *pipe) | |||
575 | rpc_timeout_upcall_queue); | 574 | rpc_timeout_upcall_queue); |
576 | pipe->ops = NULL; | 575 | pipe->ops = NULL; |
577 | spin_lock_init(&pipe->lock); | 576 | spin_lock_init(&pipe->lock); |
577 | pipe->dentry = NULL; | ||
578 | } | ||
578 | 579 | ||
580 | void rpc_destroy_pipe_data(struct rpc_pipe *pipe) | ||
581 | { | ||
582 | kfree(pipe); | ||
579 | } | 583 | } |
584 | EXPORT_SYMBOL_GPL(rpc_destroy_pipe_data); | ||
580 | 585 | ||
581 | static int __rpc_mkpipe(struct inode *dir, struct dentry *dentry, | 586 | struct rpc_pipe *rpc_mkpipe_data(const struct rpc_pipe_ops *ops, int flags) |
582 | umode_t mode, | ||
583 | const struct file_operations *i_fop, | ||
584 | void *private, | ||
585 | const struct rpc_pipe_ops *ops, | ||
586 | int flags) | ||
587 | { | 587 | { |
588 | struct rpc_pipe *pipe; | 588 | struct rpc_pipe *pipe; |
589 | struct rpc_inode *rpci; | ||
590 | int err; | ||
591 | 589 | ||
592 | pipe = kzalloc(sizeof(struct rpc_pipe), GFP_KERNEL); | 590 | pipe = kzalloc(sizeof(struct rpc_pipe), GFP_KERNEL); |
593 | if (!pipe) | 591 | if (!pipe) |
594 | return -ENOMEM; | 592 | return ERR_PTR(-ENOMEM); |
595 | init_pipe(pipe); | 593 | init_pipe(pipe); |
594 | pipe->ops = ops; | ||
595 | pipe->flags = flags; | ||
596 | return pipe; | ||
597 | } | ||
598 | EXPORT_SYMBOL_GPL(rpc_mkpipe_data); | ||
599 | |||
600 | static int __rpc_mkpipe_dentry(struct inode *dir, struct dentry *dentry, | ||
601 | umode_t mode, | ||
602 | const struct file_operations *i_fop, | ||
603 | void *private, | ||
604 | struct rpc_pipe *pipe) | ||
605 | { | ||
606 | struct rpc_inode *rpci; | ||
607 | int err; | ||
608 | |||
596 | err = __rpc_create_common(dir, dentry, S_IFIFO | mode, i_fop, private); | 609 | err = __rpc_create_common(dir, dentry, S_IFIFO | mode, i_fop, private); |
597 | if (err) { | 610 | if (err) |
598 | kfree(pipe); | ||
599 | return err; | 611 | return err; |
600 | } | ||
601 | rpci = RPC_I(dentry->d_inode); | 612 | rpci = RPC_I(dentry->d_inode); |
602 | rpci->private = private; | 613 | rpci->private = private; |
603 | rpci->pipe = pipe; | 614 | rpci->pipe = pipe; |
604 | rpci->pipe->flags = flags; | ||
605 | rpci->pipe->ops = ops; | ||
606 | fsnotify_create(dir, dentry); | 615 | fsnotify_create(dir, dentry); |
607 | return 0; | 616 | return 0; |
608 | } | 617 | } |
@@ -819,9 +828,8 @@ static int rpc_rmdir_depopulate(struct dentry *dentry, | |||
819 | * The @private argument passed here will be available to all these methods | 828 | * The @private argument passed here will be available to all these methods |
820 | * from the file pointer, via RPC_I(file->f_dentry->d_inode)->private. | 829 | * from the file pointer, via RPC_I(file->f_dentry->d_inode)->private. |
821 | */ | 830 | */ |
822 | struct dentry *rpc_mkpipe(struct dentry *parent, const char *name, | 831 | struct dentry *rpc_mkpipe_dentry(struct dentry *parent, const char *name, |
823 | void *private, const struct rpc_pipe_ops *ops, | 832 | void *private, struct rpc_pipe *pipe) |
824 | int flags) | ||
825 | { | 833 | { |
826 | struct dentry *dentry; | 834 | struct dentry *dentry; |
827 | struct inode *dir = parent->d_inode; | 835 | struct inode *dir = parent->d_inode; |
@@ -829,9 +837,9 @@ struct dentry *rpc_mkpipe(struct dentry *parent, const char *name, | |||
829 | struct qstr q; | 837 | struct qstr q; |
830 | int err; | 838 | int err; |
831 | 839 | ||
832 | if (ops->upcall == NULL) | 840 | if (pipe->ops->upcall == NULL) |
833 | umode &= ~S_IRUGO; | 841 | umode &= ~S_IRUGO; |
834 | if (ops->downcall == NULL) | 842 | if (pipe->ops->downcall == NULL) |
835 | umode &= ~S_IWUGO; | 843 | umode &= ~S_IWUGO; |
836 | 844 | ||
837 | q.name = name; | 845 | q.name = name; |
@@ -842,8 +850,8 @@ struct dentry *rpc_mkpipe(struct dentry *parent, const char *name, | |||
842 | dentry = __rpc_lookup_create_exclusive(parent, &q); | 850 | dentry = __rpc_lookup_create_exclusive(parent, &q); |
843 | if (IS_ERR(dentry)) | 851 | if (IS_ERR(dentry)) |
844 | goto out; | 852 | goto out; |
845 | err = __rpc_mkpipe(dir, dentry, umode, &rpc_pipe_fops, | 853 | err = __rpc_mkpipe_dentry(dir, dentry, umode, &rpc_pipe_fops, |
846 | private, ops, flags); | 854 | private, pipe); |
847 | if (err) | 855 | if (err) |
848 | goto out_err; | 856 | goto out_err; |
849 | out: | 857 | out: |
@@ -856,7 +864,7 @@ out_err: | |||
856 | err); | 864 | err); |
857 | goto out; | 865 | goto out; |
858 | } | 866 | } |
859 | EXPORT_SYMBOL_GPL(rpc_mkpipe); | 867 | EXPORT_SYMBOL_GPL(rpc_mkpipe_dentry); |
860 | 868 | ||
861 | /** | 869 | /** |
862 | * rpc_unlink - remove a pipe | 870 | * rpc_unlink - remove a pipe |