[PATCH] knfsd: add svc_get
authorGreg Banks <gnb@melbourne.sgi.com>
Mon, 2 Oct 2006 09:17:58 +0000 (02:17 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 2 Oct 2006 14:57:19 +0000 (07:57 -0700)
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>
fs/nfsd/nfssvc.c
include/linux/sunrpc/svc.h

index cdec3993e0d55134e4badd9ead100880b65e8477..9773f593b3ff97e5a8cfd5d71d2142b3df31fdfb 100644 (file)
@@ -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;
        }
index c27d806af310d9a76c830c19f35e422455fd814c..54d8e7bc23411d51764686133f40517a3a38cdd2 100644 (file)
@@ -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