From: Greg Banks Date: Mon, 2 Oct 2006 09:17:58 +0000 (-0700) Subject: [PATCH] knfsd: add svc_get X-Git-Tag: v2.6.19-rc1~426 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9a24ab5749a31aa10ee60d9310ad72f24d7c38ab;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git [PATCH] knfsd: add svc_get 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 Signed-off-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index cdec399..9773f59 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c @@ -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; } diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index c27d806..54d8e7b 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -71,6 +71,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 * willing to return in a single READ operation.