Skip to content

Commit

Permalink
nfsd: rename nfsd_last_thread() to nfsd_destroy_serv()
Browse files Browse the repository at this point in the history
As this function now destroys the svc_serv, this is a better name.

Signed-off-by: NeilBrown <[email protected]>
Reviewed-by: Jeff Layton <[email protected]>
Signed-off-by: Chuck Lever <[email protected]>
  • Loading branch information
neilbrown authored and chucklever committed Jan 7, 2024
1 parent 1e3577a commit 17419ae
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
5 changes: 3 additions & 2 deletions fs/nfsd/nfsctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,8 @@ static ssize_t __write_ports_addfd(char *buf, struct net *net, const struct cred
err = svc_addsock(serv, net, fd, buf, SIMPLE_TRANSACTION_LIMIT, cred);

if (!serv->sv_nrthreads && list_empty(&nn->nfsd_serv->sv_permsocks))
nfsd_last_thread(net);
nfsd_destroy_serv(net);

return err;
}

Expand Down Expand Up @@ -759,7 +760,7 @@ static ssize_t __write_ports_addxprt(char *buf, struct net *net, const struct cr
}
out_err:
if (!serv->sv_nrthreads && list_empty(&nn->nfsd_serv->sv_permsocks))
nfsd_last_thread(net);
nfsd_destroy_serv(net);

return err;
}
Expand Down
2 changes: 1 addition & 1 deletion fs/nfsd/nfsd.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ int nfsd_vers(struct nfsd_net *nn, int vers, enum vers_op change);
int nfsd_minorversion(struct nfsd_net *nn, u32 minorversion, enum vers_op change);
void nfsd_reset_versions(struct nfsd_net *nn);
int nfsd_create_serv(struct net *net);
void nfsd_last_thread(struct net *net);
void nfsd_destroy_serv(struct net *net);

extern int nfsd_max_blksize;

Expand Down
12 changes: 8 additions & 4 deletions fs/nfsd/nfssvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,11 @@ static struct notifier_block nfsd_inet6addr_notifier = {
/* Only used under nfsd_mutex, so this atomic may be overkill: */
static atomic_t nfsd_notifier_refcount = ATOMIC_INIT(0);

void nfsd_last_thread(struct net *net)
/**
* nfsd_destroy_serv - tear down NFSD's svc_serv for a namespace
* @net: network namespace the NFS service is associated with
*/
void nfsd_destroy_serv(struct net *net)
{
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
struct svc_serv *serv = nn->nfsd_serv;
Expand All @@ -554,7 +558,7 @@ void nfsd_last_thread(struct net *net)
/*
* write_ports can create the server without actually starting
* any threads--if we get shut down before any threads are
* started, then nfsd_last_thread will be run before any of this
* started, then nfsd_destroy_serv will be run before any of this
* other initialization has been done except the rpcb information.
*/
svc_rpcb_cleanup(serv, net);
Expand Down Expand Up @@ -640,7 +644,7 @@ void nfsd_shutdown_threads(struct net *net)

/* Kill outstanding nfsd threads */
svc_set_num_threads(serv, NULL, 0);
nfsd_last_thread(net);
nfsd_destroy_serv(net);
mutex_unlock(&nfsd_mutex);
}

Expand Down Expand Up @@ -802,7 +806,7 @@ nfsd_svc(int nrservs, struct net *net, const struct cred *cred)
error = serv->sv_nrthreads;
out_put:
if (serv->sv_nrthreads == 0)
nfsd_last_thread(net);
nfsd_destroy_serv(net);
out:
mutex_unlock(&nfsd_mutex);
return error;
Expand Down

0 comments on commit 17419ae

Please sign in to comment.