aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2013-08-23 13:03:50 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2013-08-30 09:19:35 -0400
commit41b6b4d0b88f80d04729a5286e838e972733db1e (patch)
tree08a5fd8c70ba28a8e0f37fb680640e843d9fb279 /net/sunrpc
parent1dada8e1f94e863a94f6622f0ddb5d1b01420150 (diff)
SUNRPC: Cleanup rpc_setup_pipedir
The directory name is _always_ clnt->cl_program->pipe_dir_name. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/clnt.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index a327cc7cbae1..79d4bc2c316c 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -123,10 +123,10 @@ static void rpc_clnt_remove_pipedir(struct rpc_clnt *clnt)
123} 123}
124 124
125static struct dentry *rpc_setup_pipedir_sb(struct super_block *sb, 125static struct dentry *rpc_setup_pipedir_sb(struct super_block *sb,
126 struct rpc_clnt *clnt, 126 struct rpc_clnt *clnt)
127 const char *dir_name)
128{ 127{
129 static uint32_t clntid; 128 static uint32_t clntid;
129 const char *dir_name = clnt->cl_program->pipe_dir_name;
130 char name[15]; 130 char name[15];
131 struct dentry *dir, *dentry; 131 struct dentry *dir, *dentry;
132 132
@@ -153,23 +153,26 @@ static struct dentry *rpc_setup_pipedir_sb(struct super_block *sb,
153} 153}
154 154
155static int 155static int
156rpc_setup_pipedir(struct rpc_clnt *clnt, const char *dir_name, 156rpc_setup_pipedir(struct super_block *pipefs_sb, struct rpc_clnt *clnt)
157 struct super_block *pipefs_sb)
158{ 157{
159 struct dentry *dentry; 158 struct dentry *dentry;
160 159
160 if (clnt->cl_program->pipe_dir_name == NULL)
161 goto out;
161 clnt->cl_dentry = NULL; 162 clnt->cl_dentry = NULL;
162 if (dir_name == NULL) 163 dentry = rpc_setup_pipedir_sb(pipefs_sb, clnt);
163 return 0;
164 dentry = rpc_setup_pipedir_sb(pipefs_sb, clnt, dir_name);
165 if (IS_ERR(dentry)) 164 if (IS_ERR(dentry))
166 return PTR_ERR(dentry); 165 return PTR_ERR(dentry);
167 clnt->cl_dentry = dentry; 166 clnt->cl_dentry = dentry;
167out:
168 return 0; 168 return 0;
169} 169}
170 170
171static inline int rpc_clnt_skip_event(struct rpc_clnt *clnt, unsigned long event) 171static int rpc_clnt_skip_event(struct rpc_clnt *clnt, unsigned long event)
172{ 172{
173 if (clnt->cl_program->pipe_dir_name == NULL)
174 return 1;
175
173 if (((event == RPC_PIPEFS_MOUNT) && clnt->cl_dentry) || 176 if (((event == RPC_PIPEFS_MOUNT) && clnt->cl_dentry) ||
174 ((event == RPC_PIPEFS_UMOUNT) && !clnt->cl_dentry)) 177 ((event == RPC_PIPEFS_UMOUNT) && !clnt->cl_dentry))
175 return 1; 178 return 1;
@@ -186,8 +189,7 @@ static int __rpc_clnt_handle_event(struct rpc_clnt *clnt, unsigned long event,
186 189
187 switch (event) { 190 switch (event) {
188 case RPC_PIPEFS_MOUNT: 191 case RPC_PIPEFS_MOUNT:
189 dentry = rpc_setup_pipedir_sb(sb, clnt, 192 dentry = rpc_setup_pipedir_sb(sb, clnt);
190 clnt->cl_program->pipe_dir_name);
191 if (!dentry) 193 if (!dentry)
192 return -ENOENT; 194 return -ENOENT;
193 if (IS_ERR(dentry)) 195 if (IS_ERR(dentry))
@@ -230,8 +232,6 @@ static struct rpc_clnt *rpc_get_client_for_event(struct net *net, int event)
230 232
231 spin_lock(&sn->rpc_client_lock); 233 spin_lock(&sn->rpc_client_lock);
232 list_for_each_entry(clnt, &sn->all_clients, cl_clients) { 234 list_for_each_entry(clnt, &sn->all_clients, cl_clients) {
233 if (clnt->cl_program->pipe_dir_name == NULL)
234 continue;
235 if (rpc_clnt_skip_event(clnt, event)) 235 if (rpc_clnt_skip_event(clnt, event))
236 continue; 236 continue;
237 spin_unlock(&sn->rpc_client_lock); 237 spin_unlock(&sn->rpc_client_lock);
@@ -282,7 +282,6 @@ static void rpc_clnt_set_nodename(struct rpc_clnt *clnt, const char *nodename)
282static int rpc_client_register(const struct rpc_create_args *args, 282static int rpc_client_register(const struct rpc_create_args *args,
283 struct rpc_clnt *clnt) 283 struct rpc_clnt *clnt)
284{ 284{
285 const struct rpc_program *program = args->program;
286 struct rpc_auth *auth; 285 struct rpc_auth *auth;
287 struct net *net = rpc_net_ns(clnt); 286 struct net *net = rpc_net_ns(clnt);
288 struct super_block *pipefs_sb; 287 struct super_block *pipefs_sb;
@@ -290,7 +289,7 @@ static int rpc_client_register(const struct rpc_create_args *args,
290 289
291 pipefs_sb = rpc_get_sb_net(net); 290 pipefs_sb = rpc_get_sb_net(net);
292 if (pipefs_sb) { 291 if (pipefs_sb) {
293 err = rpc_setup_pipedir(clnt, program->pipe_dir_name, pipefs_sb); 292 err = rpc_setup_pipedir(pipefs_sb, clnt);
294 if (err) 293 if (err)
295 goto out; 294 goto out;
296 } 295 }