diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-08-24 01:03:17 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-09-22 23:24:54 -0400 |
commit | 158998b6fe36f6acef087f574c96d44713499cc9 (patch) | |
tree | afc0f330e51135cdcf05bd8c268bf514165a4e4a | |
parent | 5dd3177ae5012c1e2ad7a9ffdbd0e0d0de2f60e4 (diff) |
SUNRPC: Make rpc_mkpipe() take the parent dentry as an argument
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/idmap.c | 6 | ||||
-rw-r--r-- | include/linux/sunrpc/rpc_pipe_fs.h | 2 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 7 | ||||
-rw-r--r-- | net/sunrpc/rpc_pipe.c | 38 |
4 files changed, 27 insertions, 26 deletions
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c index f96dfac7dc9a..82ad7110a1c0 100644 --- a/fs/nfs/idmap.c +++ b/fs/nfs/idmap.c | |||
@@ -84,7 +84,6 @@ struct idmap_hashtable { | |||
84 | }; | 84 | }; |
85 | 85 | ||
86 | struct idmap { | 86 | struct idmap { |
87 | char idmap_path[48]; | ||
88 | struct dentry *idmap_dentry; | 87 | struct dentry *idmap_dentry; |
89 | wait_queue_head_t idmap_wq; | 88 | wait_queue_head_t idmap_wq; |
90 | struct idmap_msg idmap_im; | 89 | struct idmap_msg idmap_im; |
@@ -119,10 +118,7 @@ nfs_idmap_new(struct nfs_client *clp) | |||
119 | if ((idmap = kzalloc(sizeof(*idmap), GFP_KERNEL)) == NULL) | 118 | if ((idmap = kzalloc(sizeof(*idmap), GFP_KERNEL)) == NULL) |
120 | return -ENOMEM; | 119 | return -ENOMEM; |
121 | 120 | ||
122 | snprintf(idmap->idmap_path, sizeof(idmap->idmap_path), | 121 | idmap->idmap_dentry = rpc_mkpipe(clp->cl_rpcclient->cl_dentry, "idmap", |
123 | "%s/idmap", clp->cl_rpcclient->cl_pathname); | ||
124 | |||
125 | idmap->idmap_dentry = rpc_mkpipe(idmap->idmap_path, | ||
126 | idmap, &idmap_upcall_ops, 0); | 122 | idmap, &idmap_upcall_ops, 0); |
127 | if (IS_ERR(idmap->idmap_dentry)) { | 123 | if (IS_ERR(idmap->idmap_dentry)) { |
128 | error = PTR_ERR(idmap->idmap_dentry); | 124 | error = PTR_ERR(idmap->idmap_dentry); |
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h index a481472c9484..a2eb9b4a9de3 100644 --- a/include/linux/sunrpc/rpc_pipe_fs.h +++ b/include/linux/sunrpc/rpc_pipe_fs.h | |||
@@ -43,7 +43,7 @@ extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *); | |||
43 | 43 | ||
44 | extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *); | 44 | extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *); |
45 | extern int rpc_rmdir(struct dentry *); | 45 | extern int rpc_rmdir(struct dentry *); |
46 | extern struct dentry *rpc_mkpipe(char *, void *, struct rpc_pipe_ops *, int flags); | 46 | extern struct dentry *rpc_mkpipe(struct dentry *, const char *, void *, struct rpc_pipe_ops *, int flags); |
47 | extern int rpc_unlink(struct dentry *); | 47 | extern int rpc_unlink(struct dentry *); |
48 | extern struct vfsmount *rpc_get_mount(void); | 48 | extern struct vfsmount *rpc_get_mount(void); |
49 | extern void rpc_put_mount(void); | 49 | 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 ef1cf5b476c8..6eed3e166ba3 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -88,7 +88,6 @@ struct gss_auth { | |||
88 | struct list_head upcalls; | 88 | struct list_head upcalls; |
89 | struct rpc_clnt *client; | 89 | struct rpc_clnt *client; |
90 | struct dentry *dentry; | 90 | struct dentry *dentry; |
91 | char path[48]; | ||
92 | spinlock_t lock; | 91 | spinlock_t lock; |
93 | }; | 92 | }; |
94 | 93 | ||
@@ -690,10 +689,8 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor) | |||
690 | if (err) | 689 | if (err) |
691 | goto err_put_mech; | 690 | goto err_put_mech; |
692 | 691 | ||
693 | snprintf(gss_auth->path, sizeof(gss_auth->path), "%s/%s", | 692 | gss_auth->dentry = rpc_mkpipe(clnt->cl_dentry, gss_auth->mech->gm_name, |
694 | clnt->cl_pathname, | 693 | clnt, &gss_upcall_ops, RPC_PIPE_WAIT_FOR_OPEN); |
695 | gss_auth->mech->gm_name); | ||
696 | gss_auth->dentry = rpc_mkpipe(gss_auth->path, clnt, &gss_upcall_ops, RPC_PIPE_WAIT_FOR_OPEN); | ||
697 | if (IS_ERR(gss_auth->dentry)) { | 694 | if (IS_ERR(gss_auth->dentry)) { |
698 | err = PTR_ERR(gss_auth->dentry); | 695 | err = PTR_ERR(gss_auth->dentry); |
699 | goto err_put_mech; | 696 | goto err_put_mech; |
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 | ||
623 | static struct dentry * | 623 | static struct dentry * |
624 | rpc_lookup_negative(char *path, struct nameidata *nd) | 624 | rpc_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; |
643 | out_err: | 639 | out_err: |
644 | mutex_unlock(&dir->i_mutex); | 640 | mutex_unlock(&dir->i_mutex); |
645 | rpc_release_path(nd); | 641 | return dentry; |
642 | } | ||
643 | |||
644 | static struct dentry * | ||
645 | rpc_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 | ||
703 | struct dentry * | 712 | struct dentry * |
704 | rpc_mkpipe(char *path, void *private, struct rpc_pipe_ops *ops, int flags) | 713 | rpc_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); |
727 | out: | 735 | out: |
728 | mutex_unlock(&dir->i_mutex); | 736 | mutex_unlock(&dir->i_mutex); |
729 | rpc_release_path(&nd); | ||
730 | return dentry; | 737 | return dentry; |
731 | err_dput: | 738 | err_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 | ||