SUNRPC: Clean up bc_svc_process()

The test robot complained that, in some build configurations, the
@error variable in bc_svc_process's only caller is set but never
used. This happens because dprintk() is the only consumer of that
value.

 - Remove the dprintk() call sites in favor of the svc_process
   tracepoint
 - The @error variable and the return value of bc_svc_process() are
   now unused, so get rid of them.
 - The @serv parameter is set to rqstp->rq_serv by the only caller,
   and bc_svc_process() then uses it only to set rqstp->rq_serv. It
   can be removed.
 - Rename bc_svc_process() according to the convention that
   globally-visible RPC server functions have names that begin with
   "svc_"; and because it is globally-visible, give it a proper
   kdoc comment.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202308121314.HA8Rq2XG-lkp@intel.com/
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
Chuck Lever 2023-09-11 10:38:51 -04:00
parent 7b31f4daeb
commit 6ed8cdf967
3 changed files with 14 additions and 33 deletions

View File

@ -95,7 +95,6 @@ nfs41_callback_svc(void *vrqstp)
struct svc_rqst *rqstp = vrqstp; struct svc_rqst *rqstp = vrqstp;
struct svc_serv *serv = rqstp->rq_server; struct svc_serv *serv = rqstp->rq_server;
struct rpc_rqst *req; struct rpc_rqst *req;
int error;
DEFINE_WAIT(wq); DEFINE_WAIT(wq);
set_freezable(); set_freezable();
@ -109,10 +108,7 @@ nfs41_callback_svc(void *vrqstp)
list_del(&req->rq_bc_list); list_del(&req->rq_bc_list);
spin_unlock_bh(&serv->sv_cb_lock); spin_unlock_bh(&serv->sv_cb_lock);
finish_wait(&serv->sv_cb_waitq, &wq); finish_wait(&serv->sv_cb_waitq, &wq);
dprintk("Invoking bc_svc_process()\n"); svc_process_bc(req, rqstp);
error = bc_svc_process(serv, req, rqstp);
dprintk("bc_svc_process() returned w/ error code= %d\n",
error);
} else { } else {
spin_unlock_bh(&serv->sv_cb_lock); spin_unlock_bh(&serv->sv_cb_lock);
if (!kthread_should_stop()) if (!kthread_should_stop())

View File

@ -413,8 +413,7 @@ struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int,
int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int);
int svc_pool_stats_open(struct svc_serv *serv, struct file *file); int svc_pool_stats_open(struct svc_serv *serv, struct file *file);
void svc_process(struct svc_rqst *rqstp); void svc_process(struct svc_rqst *rqstp);
int bc_svc_process(struct svc_serv *, struct rpc_rqst *, void svc_process_bc(struct rpc_rqst *req, struct svc_rqst *rqstp);
struct svc_rqst *);
int svc_register(const struct svc_serv *, struct net *, const int, int svc_register(const struct svc_serv *, struct net *, const int,
const unsigned short, const unsigned short); const unsigned short, const unsigned short);

View File

@ -1544,24 +1544,20 @@ out_drop:
} }
#if defined(CONFIG_SUNRPC_BACKCHANNEL) #if defined(CONFIG_SUNRPC_BACKCHANNEL)
/* /**
* Process a backchannel RPC request that arrived over an existing * svc_process_bc - process a reverse-direction RPC request
* outbound connection * @req: RPC request to be used for client-side processing
* @rqstp: server-side execution context
*
*/ */
int void svc_process_bc(struct rpc_rqst *req, struct svc_rqst *rqstp)
bc_svc_process(struct svc_serv *serv, struct rpc_rqst *req,
struct svc_rqst *rqstp)
{ {
struct rpc_task *task; struct rpc_task *task;
int proc_error; int proc_error;
int error;
dprintk("svc: %s(%p)\n", __func__, req);
/* Build the svc_rqst used by the common processing routine */ /* Build the svc_rqst used by the common processing routine */
rqstp->rq_xid = req->rq_xid; rqstp->rq_xid = req->rq_xid;
rqstp->rq_prot = req->rq_xprt->prot; rqstp->rq_prot = req->rq_xprt->prot;
rqstp->rq_server = serv;
rqstp->rq_bc_net = req->rq_xprt->xprt_net; rqstp->rq_bc_net = req->rq_xprt->xprt_net;
rqstp->rq_addrlen = sizeof(req->rq_xprt->addr); rqstp->rq_addrlen = sizeof(req->rq_xprt->addr);
@ -1590,10 +1586,8 @@ bc_svc_process(struct svc_serv *serv, struct rpc_rqst *req,
* been processed by the caller. * been processed by the caller.
*/ */
svcxdr_init_decode(rqstp); svcxdr_init_decode(rqstp);
if (!xdr_inline_decode(&rqstp->rq_arg_stream, XDR_UNIT * 2)) { if (!xdr_inline_decode(&rqstp->rq_arg_stream, XDR_UNIT * 2))
error = -EINVAL; return;
goto out;
}
/* Parse and execute the bc call */ /* Parse and execute the bc call */
proc_error = svc_process_common(rqstp); proc_error = svc_process_common(rqstp);
@ -1602,26 +1596,18 @@ bc_svc_process(struct svc_serv *serv, struct rpc_rqst *req,
if (!proc_error) { if (!proc_error) {
/* Processing error: drop the request */ /* Processing error: drop the request */
xprt_free_bc_request(req); xprt_free_bc_request(req);
error = -EINVAL; return;
goto out;
} }
/* Finally, send the reply synchronously */ /* Finally, send the reply synchronously */
memcpy(&req->rq_snd_buf, &rqstp->rq_res, sizeof(req->rq_snd_buf)); memcpy(&req->rq_snd_buf, &rqstp->rq_res, sizeof(req->rq_snd_buf));
task = rpc_run_bc_task(req); task = rpc_run_bc_task(req);
if (IS_ERR(task)) { if (IS_ERR(task))
error = PTR_ERR(task); return;
goto out;
}
WARN_ON_ONCE(atomic_read(&task->tk_count) != 1); WARN_ON_ONCE(atomic_read(&task->tk_count) != 1);
error = task->tk_status;
rpc_put_task(task); rpc_put_task(task);
out:
dprintk("svc: %s(), error=%d\n", __func__, error);
return error;
} }
EXPORT_SYMBOL_GPL(bc_svc_process); EXPORT_SYMBOL_GPL(svc_process_bc);
#endif /* CONFIG_SUNRPC_BACKCHANNEL */ #endif /* CONFIG_SUNRPC_BACKCHANNEL */
/** /**