diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-12-06 06:23:39 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2012-12-10 16:25:41 -0500 |
commit | 4539f14981ce02d48b212786a41c8bcfb62851b4 (patch) | |
tree | aa86b4da7bf1a993e2bfba8a41e3512484ac653d /fs | |
parent | 903d9bf0edebc9d9f06df125ab2bd57b4aa4e78e (diff) |
nfsd: replace boolean nfsd_up flag by users counter
Since we have generic NFSd resurces, we have to introduce some way how to
allocate and destroy those resources on first per-net NFSd start and on
last per-net NFSd stop respectively.
This patch replaces global boolean nfsd_up flag (which is unused now) by users
counter and use it to determine either we need to allocate generic resources
or destroy them.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/nfssvc.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 0c87b4e7d1b5..5bb4a33211c7 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c | |||
@@ -204,13 +204,13 @@ static int nfsd_init_socks(struct net *net) | |||
204 | return 0; | 204 | return 0; |
205 | } | 205 | } |
206 | 206 | ||
207 | static bool nfsd_up = false; | 207 | static int nfsd_users = 0; |
208 | 208 | ||
209 | static int nfsd_startup_generic(int nrservs) | 209 | static int nfsd_startup_generic(int nrservs) |
210 | { | 210 | { |
211 | int ret; | 211 | int ret; |
212 | 212 | ||
213 | if (nfsd_up) | 213 | if (nfsd_users++) |
214 | return 0; | 214 | return 0; |
215 | 215 | ||
216 | /* | 216 | /* |
@@ -233,9 +233,11 @@ out_racache: | |||
233 | 233 | ||
234 | static void nfsd_shutdown_generic(void) | 234 | static void nfsd_shutdown_generic(void) |
235 | { | 235 | { |
236 | if (--nfsd_users) | ||
237 | return; | ||
238 | |||
236 | nfs4_state_shutdown(); | 239 | nfs4_state_shutdown(); |
237 | nfsd_racache_shutdown(); | 240 | nfsd_racache_shutdown(); |
238 | nfsd_up = false; | ||
239 | } | 241 | } |
240 | 242 | ||
241 | static int nfsd_startup_net(int nrservs, struct net *net) | 243 | static int nfsd_startup_net(int nrservs, struct net *net) |
@@ -260,7 +262,6 @@ static int nfsd_startup_net(int nrservs, struct net *net) | |||
260 | goto out_lockd; | 262 | goto out_lockd; |
261 | 263 | ||
262 | nn->nfsd_net_up = true; | 264 | nn->nfsd_net_up = true; |
263 | nfsd_up = true; | ||
264 | return 0; | 265 | return 0; |
265 | 266 | ||
266 | out_lockd: | 267 | out_lockd: |