From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964798AbWGaAou (ORCPT ); Sun, 30 Jul 2006 20:44:50 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S964801AbWGaAm2 (ORCPT ); Sun, 30 Jul 2006 20:42:28 -0400 Received: from cantor2.suse.de ([195.135.220.15]:44173 "EHLO mx2.suse.de") by vger.kernel.org with ESMTP id S964799AbWGaAmY (ORCPT ); Sun, 30 Jul 2006 20:42:24 -0400 From: NeilBrown To: Andrew Morton Date: Mon, 31 Jul 2006 10:42:19 +1000 Message-Id: <1060731004219.29255@suse.de> X-face: [Gw_3E*Gng}4rRrKRYotwlE?.2|**#s9D Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Banks knfsd: 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 ### Diffstat output ./fs/nfsd/nfssvc.c | 2 +- ./include/linux/sunrpc/svc.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff .prev/fs/nfsd/nfssvc.c ./fs/nfsd/nfssvc.c --- .prev/fs/nfsd/nfssvc.c 2006-07-28 15:01:38.000000000 +1000 +++ ./fs/nfsd/nfssvc.c 2006-07-31 10:20:49.000000000 +1000 @@ -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 .prev/include/linux/sunrpc/svc.h ./include/linux/sunrpc/svc.h --- .prev/include/linux/sunrpc/svc.h 2006-07-31 10:14:54.000000000 +1000 +++ ./include/linux/sunrpc/svc.h 2006-07-31 10:20:49.000000000 +1000 @@ -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.