aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2013-08-26 17:44:26 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2013-09-01 11:12:42 -0400
commitc36dcfe1f7712b7c12df2d80359e638b9d246ce6 (patch)
treec60e48fbe790d51aba77b062a002cc0032e4a612 /net/sunrpc
parent2127d82af302be94066223311ca6ff317ee13ee0 (diff)
SUNRPC: Remove the rpc_client->cl_dentry
It is now redundant. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/clnt.c35
-rw-r--r--net/sunrpc/rpc_pipe.c13
2 files changed, 25 insertions, 23 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 3c074de902ea..af3f0cf7e278 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -102,9 +102,7 @@ static void rpc_unregister_client(struct rpc_clnt *clnt)
102 102
103static void __rpc_clnt_remove_pipedir(struct rpc_clnt *clnt) 103static void __rpc_clnt_remove_pipedir(struct rpc_clnt *clnt)
104{ 104{
105 if (clnt->cl_dentry) 105 rpc_remove_client_dir(clnt);
106 rpc_remove_client_dir(clnt->cl_dentry, clnt);
107 clnt->cl_dentry = NULL;
108} 106}
109 107
110static void rpc_clnt_remove_pipedir(struct rpc_clnt *clnt) 108static void rpc_clnt_remove_pipedir(struct rpc_clnt *clnt)
@@ -154,14 +152,11 @@ rpc_setup_pipedir(struct super_block *pipefs_sb, struct rpc_clnt *clnt)
154{ 152{
155 struct dentry *dentry; 153 struct dentry *dentry;
156 154
157 if (clnt->cl_program->pipe_dir_name == NULL) 155 if (clnt->cl_program->pipe_dir_name != NULL) {
158 goto out; 156 dentry = rpc_setup_pipedir_sb(pipefs_sb, clnt);
159 clnt->cl_dentry = NULL; 157 if (IS_ERR(dentry))
160 dentry = rpc_setup_pipedir_sb(pipefs_sb, clnt); 158 return PTR_ERR(dentry);
161 if (IS_ERR(dentry)) 159 }
162 return PTR_ERR(dentry);
163 clnt->cl_dentry = dentry;
164out:
165 return 0; 160 return 0;
166} 161}
167 162
@@ -170,11 +165,18 @@ static int rpc_clnt_skip_event(struct rpc_clnt *clnt, unsigned long event)
170 if (clnt->cl_program->pipe_dir_name == NULL) 165 if (clnt->cl_program->pipe_dir_name == NULL)
171 return 1; 166 return 1;
172 167
173 if (((event == RPC_PIPEFS_MOUNT) && clnt->cl_dentry) || 168 switch (event) {
174 ((event == RPC_PIPEFS_UMOUNT) && !clnt->cl_dentry)) 169 case RPC_PIPEFS_MOUNT:
175 return 1; 170 if (clnt->cl_pipedir_objects.pdh_dentry != NULL)
176 if ((event == RPC_PIPEFS_MOUNT) && atomic_read(&clnt->cl_count) == 0) 171 return 1;
177 return 1; 172 if (atomic_read(&clnt->cl_count) == 0)
173 return 1;
174 break;
175 case RPC_PIPEFS_UMOUNT:
176 if (clnt->cl_pipedir_objects.pdh_dentry == NULL)
177 return 1;
178 break;
179 }
178 return 0; 180 return 0;
179} 181}
180 182
@@ -191,7 +193,6 @@ static int __rpc_clnt_handle_event(struct rpc_clnt *clnt, unsigned long event,
191 return -ENOENT; 193 return -ENOENT;
192 if (IS_ERR(dentry)) 194 if (IS_ERR(dentry))
193 return PTR_ERR(dentry); 195 return PTR_ERR(dentry);
194 clnt->cl_dentry = dentry;
195 break; 196 break;
196 case RPC_PIPEFS_UMOUNT: 197 case RPC_PIPEFS_UMOUNT:
197 __rpc_clnt_remove_pipedir(clnt); 198 __rpc_clnt_remove_pipedir(clnt);
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index cfeba77de567..a35b2f402aaa 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -1055,15 +1055,16 @@ struct dentry *rpc_create_client_dir(struct dentry *dentry,
1055 1055
1056/** 1056/**
1057 * rpc_remove_client_dir - Remove a directory created with rpc_create_client_dir() 1057 * rpc_remove_client_dir - Remove a directory created with rpc_create_client_dir()
1058 * @dentry: dentry for the pipe
1059 * @rpc_client: rpc_client for the pipe 1058 * @rpc_client: rpc_client for the pipe
1060 */ 1059 */
1061int rpc_remove_client_dir(struct dentry *dentry, struct rpc_clnt *rpc_client) 1060int rpc_remove_client_dir(struct rpc_clnt *rpc_client)
1062{ 1061{
1063 if (rpc_client->cl_pipedir_objects.pdh_dentry) { 1062 struct dentry *dentry = rpc_client->cl_pipedir_objects.pdh_dentry;
1064 rpc_destroy_pipe_dir_objects(&rpc_client->cl_pipedir_objects); 1063
1065 rpc_client->cl_pipedir_objects.pdh_dentry = NULL; 1064 if (dentry == NULL)
1066 } 1065 return 0;
1066 rpc_destroy_pipe_dir_objects(&rpc_client->cl_pipedir_objects);
1067 rpc_client->cl_pipedir_objects.pdh_dentry = NULL;
1067 return rpc_rmdir_depopulate(dentry, rpc_clntdir_depopulate); 1068 return rpc_rmdir_depopulate(dentry, rpc_clntdir_depopulate);
1068} 1069}
1069 1070