diff options
| -rw-r--r-- | net/sunrpc/clnt.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 8a19849ff340..d127bd747527 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
| @@ -176,8 +176,16 @@ rpc_setup_pipedir(struct rpc_clnt *clnt, const char *dir_name) | |||
| 176 | return 0; | 176 | return 0; |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | static int __rpc_pipefs_event(struct rpc_clnt *clnt, unsigned long event, | 179 | static inline int rpc_clnt_skip_event(struct rpc_clnt *clnt, unsigned long event) |
| 180 | struct super_block *sb) | 180 | { |
| 181 | if (((event == RPC_PIPEFS_MOUNT) && clnt->cl_dentry) || | ||
| 182 | ((event == RPC_PIPEFS_UMOUNT) && !clnt->cl_dentry)) | ||
| 183 | return 1; | ||
| 184 | return 0; | ||
| 185 | } | ||
| 186 | |||
| 187 | static int __rpc_clnt_handle_event(struct rpc_clnt *clnt, unsigned long event, | ||
| 188 | struct super_block *sb) | ||
| 181 | { | 189 | { |
| 182 | struct dentry *dentry; | 190 | struct dentry *dentry; |
| 183 | int err = 0; | 191 | int err = 0; |
| @@ -206,6 +214,20 @@ static int __rpc_pipefs_event(struct rpc_clnt *clnt, unsigned long event, | |||
| 206 | return err; | 214 | return err; |
| 207 | } | 215 | } |
| 208 | 216 | ||
| 217 | static int __rpc_pipefs_event(struct rpc_clnt *clnt, unsigned long event, | ||
| 218 | struct super_block *sb) | ||
| 219 | { | ||
| 220 | int error = 0; | ||
| 221 | |||
| 222 | for (;; clnt = clnt->cl_parent) { | ||
| 223 | if (!rpc_clnt_skip_event(clnt, event)) | ||
| 224 | error = __rpc_clnt_handle_event(clnt, event, sb); | ||
| 225 | if (error || clnt == clnt->cl_parent) | ||
| 226 | break; | ||
| 227 | } | ||
| 228 | return error; | ||
| 229 | } | ||
| 230 | |||
| 209 | static struct rpc_clnt *rpc_get_client_for_event(struct net *net, int event) | 231 | static struct rpc_clnt *rpc_get_client_for_event(struct net *net, int event) |
| 210 | { | 232 | { |
| 211 | struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); | 233 | struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); |
| @@ -215,8 +237,7 @@ static struct rpc_clnt *rpc_get_client_for_event(struct net *net, int event) | |||
| 215 | list_for_each_entry(clnt, &sn->all_clients, cl_clients) { | 237 | list_for_each_entry(clnt, &sn->all_clients, cl_clients) { |
| 216 | if (clnt->cl_program->pipe_dir_name == NULL) | 238 | if (clnt->cl_program->pipe_dir_name == NULL) |
| 217 | break; | 239 | break; |
| 218 | if (((event == RPC_PIPEFS_MOUNT) && clnt->cl_dentry) || | 240 | if (rpc_clnt_skip_event(clnt, event)) |
| 219 | ((event == RPC_PIPEFS_UMOUNT) && !clnt->cl_dentry)) | ||
| 220 | continue; | 241 | continue; |
| 221 | if (atomic_inc_not_zero(&clnt->cl_count) == 0) | 242 | if (atomic_inc_not_zero(&clnt->cl_count) == 0) |
| 222 | continue; | 243 | continue; |
