SUNRPC: change svc_get() to return the svc.

[ Upstream commit df5e49c880ea0776806b8a9f8ab95e035272cf6f ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
NeilBrown 2021-11-29 15:51:25 +11:00 committed by Greg Kroah-Hartman
parent e0bf899352
commit e9a4156137
3 changed files with 6 additions and 9 deletions

View File

@ -430,14 +430,12 @@ static struct svc_serv *lockd_create_svc(void)
/* /*
* Check whether we're already up and running. * Check whether we're already up and running.
*/ */
if (nlmsvc_rqst) { if (nlmsvc_rqst)
/* /*
* Note: increase service usage, because later in case of error * Note: increase service usage, because later in case of error
* svc_destroy() will be called. * svc_destroy() will be called.
*/ */
svc_get(nlmsvc_rqst->rq_server); return svc_get(nlmsvc_rqst->rq_server);
return nlmsvc_rqst->rq_server;
}
/* /*
* Sanity check: if there's no pid, * Sanity check: if there's no pid,

View File

@ -266,14 +266,12 @@ static struct svc_serv *nfs_callback_create_svc(int minorversion)
/* /*
* Check whether we're already up and running. * 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 * Note: increase service usage, because later in case of error
* svc_destroy() will be called. * svc_destroy() will be called.
*/ */
svc_get(cb_info->serv); return svc_get(cb_info->serv);
return cb_info->serv;
}
switch (minorversion) { switch (minorversion) {
case 0: case 0:

View File

@ -120,9 +120,10 @@ struct svc_serv {
* change the number of threads. Horrible, but there it is. * change the number of threads. Horrible, but there it is.
* Should be called with the "service mutex" held. * 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++; serv->sv_nrthreads++;
return serv;
} }
/* /*