Skip to content

Commit

Permalink
[PATCH] knfsd: add svc_get
Browse files Browse the repository at this point in the history
add svc_get() for those occasions when we need to temporarily bump up
svc_serv->sv_nrthreads as a pseudo refcount.

Signed-off-by: Greg Banks <gnb@melbourne.sgi.com>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Greg Banks authored and Linus Torvalds committed Oct 2, 2006
1 parent 3262c81 commit 9a24ab5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fs/nfsd/nfssvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ int nfsd_create_serv(void)
int err = 0;
lock_kernel();
if (nfsd_serv) {
nfsd_serv->sv_nrthreads++;
svc_get(nfsd_serv);
unlock_kernel();
return 0;
}
Expand Down
11 changes: 11 additions & 0 deletions include/linux/sunrpc/svc.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ struct svc_serv {
*/
};

/*
* We use sv_nrthreads as a reference count. svc_destroy() drops
* this refcount, so we need to bump it up around operations that
* change the number of threads. Horrible, but there it is.
* Should be called with the BKL held.
*/
static inline void svc_get(struct svc_serv *serv)
{
serv->sv_nrthreads++;
}

/*
* Maximum payload size supported by a kernel RPC server.
* This is use to determine the max number of pages nfsd is
Expand Down

0 comments on commit 9a24ab5

Please sign in to comment.