Commit 6ff50b3dea9a242b50642a703b513986bffb8ce9
Committed by
J. Bruce Fields
1 parent
081603520b
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
nfsd: move per-net startup code to separated function
NFSd resources are partially per-net and partially globally used. This patch splits resources init and shutdown and moves per-net code to separated functions. Generic and per-net init and shutdown are called sequentially for a while. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Showing 1 changed file with 33 additions and 15 deletions Side-by-side Diff
fs/nfsd/nfssvc.c
... | ... | @@ -203,6 +203,27 @@ |
203 | 203 | |
204 | 204 | static bool nfsd_up = false; |
205 | 205 | |
206 | +static int nfsd_startup_net(struct net *net) | |
207 | +{ | |
208 | + int ret; | |
209 | + | |
210 | + ret = nfsd_init_socks(net); | |
211 | + if (ret) | |
212 | + return ret; | |
213 | + ret = lockd_up(net); | |
214 | + if (ret) | |
215 | + return ret; | |
216 | + ret = nfs4_state_start_net(net); | |
217 | + if (ret) | |
218 | + goto out_lockd; | |
219 | + | |
220 | + return 0; | |
221 | + | |
222 | +out_lockd: | |
223 | + lockd_down(net); | |
224 | + return ret; | |
225 | +} | |
226 | + | |
206 | 227 | static int nfsd_startup(int nrservs, struct net *net) |
207 | 228 | { |
208 | 229 | int ret; |
209 | 230 | |
210 | 231 | |
211 | 232 | |
212 | 233 | |
213 | 234 | |
214 | 235 | |
... | ... | @@ -217,31 +238,29 @@ |
217 | 238 | ret = nfsd_racache_init(2*nrservs); |
218 | 239 | if (ret) |
219 | 240 | return ret; |
220 | - ret = nfsd_init_socks(net); | |
241 | + ret = nfs4_state_start(); | |
221 | 242 | if (ret) |
222 | 243 | goto out_racache; |
223 | - ret = lockd_up(net); | |
244 | + ret = nfsd_startup_net(net); | |
224 | 245 | if (ret) |
225 | - goto out_racache; | |
226 | - ret = nfs4_state_start(); | |
227 | - if (ret) | |
228 | - goto out_lockd; | |
246 | + goto out_net; | |
229 | 247 | |
230 | - ret = nfs4_state_start_net(net); | |
231 | - if (ret) | |
232 | - goto out_net_state; | |
233 | - | |
234 | 248 | nfsd_up = true; |
235 | 249 | return 0; |
236 | -out_net_state: | |
250 | + | |
251 | +out_net: | |
237 | 252 | nfs4_state_shutdown(); |
238 | -out_lockd: | |
239 | - lockd_down(net); | |
240 | 253 | out_racache: |
241 | 254 | nfsd_racache_shutdown(); |
242 | 255 | return ret; |
243 | 256 | } |
244 | 257 | |
258 | +static void nfsd_shutdown_net(struct net *net) | |
259 | +{ | |
260 | + nfs4_state_shutdown_net(net); | |
261 | + lockd_down(net); | |
262 | +} | |
263 | + | |
245 | 264 | static void nfsd_shutdown(struct net *net) |
246 | 265 | { |
247 | 266 | /* |
248 | 267 | |
... | ... | @@ -252,9 +271,8 @@ |
252 | 271 | */ |
253 | 272 | if (!nfsd_up) |
254 | 273 | return; |
255 | - nfs4_state_shutdown_net(net); | |
274 | + nfsd_shutdown_net(net); | |
256 | 275 | nfs4_state_shutdown(); |
257 | - lockd_down(net); | |
258 | 276 | nfsd_racache_shutdown(); |
259 | 277 | nfsd_up = false; |
260 | 278 | } |