Skip to content

Commit

Permalink
nfsd: replace boolean nfsd_up flag by users counter
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stanislav Kinsbursky authored and J. Bruce Fields committed Dec 10, 2012
1 parent 903d9bf commit 4539f14
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions fs/nfsd/nfssvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,13 @@ static int nfsd_init_socks(struct net *net)
return 0;
}

static bool nfsd_up = false;
static int nfsd_users = 0;

static int nfsd_startup_generic(int nrservs)
{
int ret;

if (nfsd_up)
if (nfsd_users++)
return 0;

/*
Expand All @@ -233,9 +233,11 @@ static int nfsd_startup_generic(int nrservs)

static void nfsd_shutdown_generic(void)
{
if (--nfsd_users)
return;

nfs4_state_shutdown();
nfsd_racache_shutdown();
nfsd_up = false;
}

static int nfsd_startup_net(int nrservs, struct net *net)
Expand All @@ -260,7 +262,6 @@ static int nfsd_startup_net(int nrservs, struct net *net)
goto out_lockd;

nn->nfsd_net_up = true;
nfsd_up = true;
return 0;

out_lockd:
Expand Down

0 comments on commit 4539f14

Please sign in to comment.