Skip to contentSkip to conversation

knfsd: add svc_get

PATCH New Greg Banks 1 participant 1 message Jul 25, 2006

Subsystems (3)
lore
Share & tools
lore

Greg Banks

author
#0 lore raw

PATCH 1/1 knfsd: add svc_get

knfsd: add svc_get() for those occasions when we need to temporarily bump up svc_serv->sv_nrthreads as a pseudo refcount.

---

 fs/nfsd/nfssvc.c           |    2 +-
 include/linux/sunrpc/svc.h |   11 +++++++++++
 net/sunrpc/svc.c           |    2 +-
 3 files changed, 13 insertions(+), 2 deletions(-)
include/linux/sunrpc/svc.h +11 -0
Index: linus-git/include/linux/sunrpc/svc.h
===================================================================
@@ -65,6 +65,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.
fs/nfsd/nfssvc.c +1 -1
Index: linus-git/fs/nfsd/nfssvc.c
===================================================================
@@ -211,7 +211,7 @@ nfsd_svc(unsigned short port, int nrserv
 #endif
 		do_gettimeofday(&nfssvc_boot);		/* record boot time */
 	} else
-		nfsd_serv->sv_nrthreads++;
+		svc_get(nfsd_serv);
 	nrservs -= (nfsd_serv->sv_nrthreads-1);
 	while (nrservs > 0) {
 		nrservs--;
net/sunrpc/svc.c +1 -1
Index: linus-git/net/sunrpc/svc.c
===================================================================
@@ -88,7 +88,7 @@ svc_create(struct svc_program *prog, uns
 }
 
 /*
- * Destroy an RPC service
+ * Destroy an RPC service.  Should be called with the BKL held
  */
 void
 svc_destroy(struct svc_serv *serv)
Signature · 13 lines
Greg Banks, R&D Software Engineer, SGI Australian Software Group.
I don't speak for SGI.



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist  -  [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs