]> git.baikalelectronics.ru Git - kernel.git/commitdiff
SUNRPC: change svc_get() to return the svc.
authorNeilBrown <neilb@suse.de>
Mon, 29 Nov 2021 04:51:25 +0000 (15:51 +1100)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 13 Dec 2021 18:42:50 +0000 (13:42 -0500)
It is common for 'get' functions to return the object that was 'got',
and there are a couple of places where users of svc_get() would be a
little simpler if svc_get() did that.

Make it so.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/lockd/svc.c
fs/nfs/callback.c
include/linux/sunrpc/svc.h

index b220e1b9172683b798cf83fecb2ba30c6197c1b7..2f50d5b2a8a429aa9e62f2bb8a43a49fd06ecdf6 100644 (file)
@@ -430,14 +430,12 @@ static struct svc_serv *lockd_create_svc(void)
        /*
         * Check whether we're already up and running.
         */
-       if (nlmsvc_rqst) {
+       if (nlmsvc_rqst)
                /*
                 * Note: increase service usage, because later in case of error
                 * svc_destroy() will be called.
                 */
-               svc_get(nlmsvc_rqst->rq_server);
-               return nlmsvc_rqst->rq_server;
-       }
+               return svc_get(nlmsvc_rqst->rq_server);
 
        /*
         * Sanity check: if there's no pid,
index 86d856de1389b18583f5db9842be133c6a19a6a0..6e5e742a42b8bcd0b1d99dd63fcbf0431c5b5c38 100644 (file)
@@ -266,14 +266,12 @@ static struct svc_serv *nfs_callback_create_svc(int minorversion)
        /*
         * Check whether we're already up and running.
         */
-       if (cb_info->serv) {
+       if (cb_info->serv)
                /*
                 * Note: increase service usage, because later in case of error
                 * svc_destroy() will be called.
                 */
-               svc_get(cb_info->serv);
-               return cb_info->serv;
-       }
+               return svc_get(cb_info->serv);
 
        switch (minorversion) {
        case 0:
index 0ae28ae6caf20c4511553acc427d50cccf47dcd1..5d9568953fcd8e92624f7a4a422aec980dae70c9 100644 (file)
@@ -120,9 +120,10 @@ struct svc_serv {
  * change the number of threads.  Horrible, but there it is.
  * Should be called with the "service mutex" held.
  */
-static inline void svc_get(struct svc_serv *serv)
+static inline struct svc_serv *svc_get(struct svc_serv *serv)
 {
        serv->sv_nrthreads++;
+       return serv;
 }
 
 /*